1import{r as m,E as v,u as b,a as C,j as s}from"./CZzrexQa.production.bundle.min.js";import{B as N}from"./YCM_kEyP.production.bundle.min.js";import{F as l}from"./CpVN2k6O.production.bundle.min.js";import{F as u}from"./B0uEge7d.production.bundle.min.js";import{F}from"./DwHJw1jo.production.bundle.min.js";import{u as V,s as I}from"./9eHdvLN4.production.bundle.min.js";import{L as f}from"./Ch78CD0x.production.bundle.min.js";import{s as S}from"./JMY7hIGQ.production.bundle.min.js";import{A as k}from"./BWOzg60F.production.bundle.min.js";import{v as P,e as h}from"./CBIXpEo7.production.bundle.min.js";import"./DGYQp8fe.production.bundle.min.js";import"./kkIr59yR.production.bundle.min.js";import"./BmBjCq8D.production.bundle.min.js";import"./CHClG9UV.production.bundle.min.js";import"./Dsqj8S3w.production.bundle.min.js";import"./CiD4UJCU.production.bundle.min.js";const L=n=>{const e=P(n);return{setPasswordErr:!e.isValid,passwordErrorMsg:e.isValid?"":e.error}},O=()=>{const n=V(),e=s.jsxs("p",{children:[s.jsx("span",{children:"Already have an account?"}),s.jsx(f,{to:"/auth/login",children:"Sign In"})]});m.useEffect(()=>{v.dispatch("header__secondaryContext",e)});const d=b(),c=C(),[o,p]=m.useState({password:"",confirmPassword:"",message:"",inflight:!1,setPasswordErr:!1,confirmPasswordErr:!1,passwordErrorMsg:""}),g=()=>{const t=P(o.password),a=!o.confirmPassword||o.password!==o.confirmPassword;return p(i=>({...i,setPasswordErr:!t.isValid,passwordErrorMsg:t.isValid?"":t.error,confirmPasswordErr:a})),t.isValid&&!a},x=c.get("redirect_uri")?`?redirect_uri=${encodeURIComponent(c.get("redirect_uri"))}`:"",E=async t=>{if(t.preventDefault(),o.inflight||!g())return;const i=await h(o.password),j=await h(o.confirmPassword);n(S({access_code:d.token,password:i,confirm_password:j},(_,w,r)=>{p(y=>({...y,inflight:typeof w<"u"?w:!1,message:(r==null?void 0:r.message)||"",password:r!=null&&r.status?"":o.password,confirmPassword:r!=null&&r.status?"":o.confirmPassword})),r!=null&&r.message&&n(I(r!=null&&r.status?"success":"error",r==null?void 0:r.message)),_&&(r!=null&&r.status)&&setTimeout(()=>{window.location.href=window.location.origin+(c.get("redirect_uri")?c.get("redirect_uri"):"")},700)}))};return s.jsx("div",{className:"set_password__context auth__common__context",children:d!=null&&d.token?s.jsx(k,{type:"set-password",title:"Create a New Password",subTitle:s.jsxs("span",{children:["Enter and confirm your new password to secure your account.",s.jsx("br",{}),"You can login once itâs updated"]}),authLogo:s.jsx(F,{}),children:s.jsxs("form",{className:"set_password__form",method:"post",onSubmit:t=>E(t),children:[s.jsxs("div",{className:"input-row",children:[s.jsx(u,{id:"password",type:"password",label:"New Password*",placeholder:"Set a strong password to protect your profile",value:o.password,isError:o.setPasswordErr,onChange:t=>{const a=L(t);p(i=>({...i,password:t,...a}))},autoComplete:"new-password"}),o.setPasswordErr&&s.jsx(l,{isError:!0,text:o.passwordErrorMsg})]}),s.jsxs("div",{className:"input-row",children:[s.jsx(u,{id:"confirm-password",label:"Confirm New Password*",type:"password",placeholder:"Should match with your new password above",value:o.confirmPassword,isError:o.confirmPasswordErr,onChange:t=>{p(a=>({...a,confirmPassword:t,confirmPasswordErr:t.length<1||t!==o.password}))},autoComplete:"new-password"}),o.confirmPasswordErr&&s.jsx(l,{isError:!0,text:o.confirmPassword.length?"Passwords do not match!":"Please enter the password"})]}),s.jsx(N,{className:"sign-up-login-btn password-reset-btn",disabled:o.inflight,primary:!0,children:"Update Password"}),s.jsx("div",{className:"or-seperator already-account back-to-login",children:s.jsxs("span",{className:"divider",children:["Remembered it?"," ",s.jsx(f,{to:`/auth/login${x}`,children:"Log In instead"})]})})]})}):s.jsx(s.Fragment,{children:s.jsx("p",{children:"Token is invalid or expired"})})})};export{O as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.