(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2935],{90976:function(e,t,n){(window.__NEXT_P=window.__NEXT_P||[]).push(["/password-reset",function(){return n(18070)}])},41171:function(e,t,n){"use strict";n.d(t,{u:function(){return s}});var r={ceil:Math.ceil,round:Math.round,floor:Math.floor,trunc:function(e){return e<0?Math.ceil(e):Math.floor(e)}};function s(e){return e?r[e]:r.trunc}},69160:function(e,t,n){"use strict";n.d(t,{Z:function(){return a}});var r=n(25067),s=n(97372);function a(e,t){return(0,s.Z)(2,arguments),(0,r.Z)(e).getTime()-(0,r.Z)(t).getTime()}},5867:function(e,t,n){"use strict";n.d(t,{Z:function(){return i}});var r=n(69160),s=n(97372),a=n(41171);function i(e,t,n){(0,s.Z)(2,arguments);var i=(0,r.Z)(e,t)/1e3;return(0,a.u)(null==n?void 0:n.roundingMethod)(i)}},18070:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return x}});var r=n(85893),s=n(43078),a=n(95429),i=n(28008),o=n(42195),u=n(54410),c=n(24920),l=n(67294),d=n(11163),h=n(5867),f=n(82922),m=n(57432),g=n(36281),p=n(79014);let w=(0,f.k)(e=>({root:{paddingTop:80,paddingBottom:80},label:{textAlign:"center",fontWeight:700,fontSize:220,lineHeight:1,color:"dark"===e.colorScheme?e.colors.dark[4]:e.colors.gray[2]},title:{textAlign:"center",fontWeight:700,fontSize:38},description:{maxWidth:500,margin:"auto",marginTop:e.spacing.xl}}));function x(){let{classes:{root:e,title:t,description:n}}=w(),f=p.SX.authUser.migrateWPUserIfNeeded.useMutation(),[x,j]=(0,l.useState)(""),[k,y]=(0,l.useState)(""),[S,_]=(0,l.useState)(""),[E,N]=(0,l.useState)(!1),[P,v]=(0,l.useState)(null),[W,R]=(0,l.useState)(null),T=(0,d.useRouter)();async function Z(){await f.mutateAsync({email:x});let{error:e}=await g.OQ.auth.resetPasswordForEmail(x,{redirectTo:(0,m.Ax)("/password-reset")});e?_(e.message):(v(new Date),_("Password reset email sent to ".concat(x)))}let C=async()=>{if(k.length<6){_("Password must be at least 6 characters.");return}let{error:e}=await g.OQ.auth.updateUser({password:k});e?_(e.message):_("Password updated successfully! Redirecting you to the home page...")};if((0,l.useEffect)(()=>{g.OQ.auth.onAuthStateChange(async e=>{"PASSWORD_RECOVERY"==e?N(!0):"USER_UPDATED"===e&&setTimeout(()=>{T.push("/")},3e3)})},[]),(0,l.useEffect)(()=>{if(!P)return;R((0,h.Z)(new Date,P));let e=setInterval(()=>R((0,h.Z)(new Date,P)),1e3);return()=>{clearInterval(e)}},[P]),E)return(0,r.jsx)(s.W,{className:e,children:(0,r.jsxs)(a.k,{direction:"column",gap:24,children:[(0,r.jsx)(i.D,{className:t,children:"Reset Password"}),(0,r.jsx)(o.I.Wrapper,{label:"New password",children:(0,r.jsx)(o.I,{type:"password",onChange:e=>y(e.target.value)})}),(0,r.jsx)(u.x,{children:S}),(0,r.jsx)(a.k,{justify:"center",children:(0,r.jsx)(c.z,{onClick:C,children:"Update Password"})})]})});let D=null!==W&&W<60;return(0,r.jsx)(s.W,{className:e,children:(0,r.jsxs)(a.k,{direction:"column",gap:24,children:[(0,r.jsx)(i.D,{className:t,children:"Enter the email associated with your account"}),(0,r.jsx)(u.x,{color:"dimmed",size:"lg",ta:"center",className:n,children:"We will send you an email with a link to reset your password"}),(0,r.jsx)(o.I.Wrapper,{label:"Your email",children:(0,r.jsx)(o.I,{type:"email",onChange:e=>j(e.target.value)})}),(0,r.jsx)(u.x,{children:S}),(0,r.jsx)(a.k,{justify:"center",children:(0,r.jsx)(c.z,{disabled:D||!(0,m.Ju)(x),onClick:Z,children:D?"Resend in ".concat(60-W," seconds"):"Reset email"})})]})})}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=90976)}),_N_E=e.O()}]);