"use strict";(()=>{vare={};e.id=7537,e.ids=[3220,7537],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){returnfunctione(t,r){returnrint?t[r]:"then"int&&"function"==typeoft.then?t.then(t=>e(t,r)):"function"==typeoft&&"default"===r?t:void0}}})},20416:(e,t,r)=>{r.r(t),r.d(t,{config:()=>T,default:()=>E,getServerSideProps:()=>D,getStaticPaths:()=>L,getStaticProps:()=>A,reportWebVitals:()=>N,routeModule:()=>C,unstable_getServerProps:()=>b,unstable_getServerSideProps:()=>q,unstable_getStaticParams:()=>R,unstable_getStaticPaths:()=>I,unstable_getStaticProps:()=>O});vars={};r.r(s),r.d(s,{ResetPasswordContext:()=>P,default:()=>v,getServerSideProps:()=>w});varn=r(63865),a=r(9455),o=r(30671),i=r(5583),c=r(53881),l=r(8732),p=r(82015),u=r.n(p),d=r(26228),m=r(91258),g=r(16757),S=r(92702),x=r(46169),f=r(90048),h=r(71205),_=r(77047),y=r(27825),j=r.n(y);letP=u().createContext({});functionv(e){let{email:t}=e,r="Reset Password | Datasquirel",s="Set a new password",n=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:r}),(0,l.jsx)("meta",{name:"description",content:s}),(0,l.jsx)(m.A,{pageTitle:r,pageDescription:s,pagePathname:"/"})]}),[a,o]=u().useState(!1),[i,c]=u().useState(!1);return(0,l.jsx)(d.A,{head:n,user:e.user,children:(0,l.jsx)(P.Provider,{value:{user:e.user},children:(0,l.jsx)("main",{children:(0,l.jsxs)("section",{children:[a&&(0,l.jsx)(g.A,{}),(0,l.jsx)("div",{className:"main-container flex-col items-start",children:i?(0,l.jsx)(f.A,{message:"Password Updated Sucessfully. Redirecting you ..."}):(0,l.jsxs)(u().Fragment,{children:[(0,l.jsx)("h1",{className:"m-0 text-4xl",children:"Reset Password"}),(0,l.jsx)("span",{children:"Please enter new passord and confirm it"}),(0,l.jsxs)("form",{className:"max-w-xl w-full flex flex-col items-stretch gap-4",onSubmit:e=>{o(!0),e.preventDefault();letr=e.target,s=r.password.value,n=r["confirm-password"].classList.contains("warning");if(s?.length<8){window.alert("Password must be at least 8 characters"),setTimeout(()=>{o(!1)},500);return}if(n){window.alert("Passwords don't match"),setTimeout(()=>{o(!1)},500);return}(0,x.A)(`/api/resetPassword?email=${t}&password=${s}`).then(e=>{setTimeout(()=>{o(!1)},500),setTimeout(()=>{window.location.href="/logout?login=true"},1e3),e.success&&c(!0)})},children:[(0,l.jsx)("input",{type:"password",name:"password",id:"password",className:"w-full",placeholder:"New Password",required:!0}),(0,l.jsx)("input",{type:"password",name:"confirm-password",id:"confirm-password",className:"w-full",placeholder:"Confirm New Password",required:!0,onInput:e=>{lett=e.target,r=t.closest("form");try{r.password.value.match(RegExp(`^${j().escapeRegExp(t.value)}$`))?t.classList.remove("warning"):t.classList.add("warning")}catch(t){(0,x.A)("/api/admin/clientError",{method:"post",body:{component:"reset-password-page-component/lines-170-177",message:t.message,user:{}}}),e.target.classList.add("warning")}}}),(0,l.jsx)("button",{children:"Reset Password"})]})]})})]})})})})}asyncfunctionw({req:e,res:t,query:r}){let{user:s,appData:n}=await(0,S.A)(e,t);if(!r?.token?.toString()?.match(/./))return{redirect:{destination:"/",permanent:!1}};leta=null;try{lete=(0,h.A)({encryptedString:r.token.toString()}),t=JSON.parse(e||"");if(Date.now()-t.dateCode>36e5)return{redirect:{destination:"/",permanent:!1}};a=t.email}catch(e){return(0,_.A)({component:"reset-password-page-component/getServersideProps/lines-251-260",message:e.message,user:s}),{redirect:{destination:"/",permanent:!1}}}returna?.match(/./)?{props:{user:s,appData:n,email:a}}:{redirect:{destination:"/",permanent:!1}}}letE=(0,o.M)(s,"default"),A=(0,o.M)(s,"getStaticProps"),L=(0,o.M)(s,"getStaticPaths"),D=(0,o.M)(s,"getServerSideProps"),T=(0,o.M)(s,"config"),N=(0,o.M)(s,"reportWebVitals"),O=(0,o.M)(s,"unstable_getStaticProps"),I=(0,o.M)(s,"unstable_getStaticPaths"),R=(0,o.M)(s,"unstable_getStaticParams"),b=(0,o.M)(s,"unstable_getServerProps"),q=(0,o.M)(s,"unstable_getServerSideProps"),C=newn.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/reset-password",pathname:"/reset-pas