1import{r as b,j as e,c as A,d as L,u as w,L as P}from"./vendor-react.MfGudbed.js";import{v as E,F as I,w as R,z as d,y as B}from"./vendor-form.Dl9kkiLw.js";import{u as F,a as D,b as k}from"./main.DX-Yurvi.js";import{u as T}from"./useIsMountedRef.1MyuAiD_.js";import{A as z}from"./AuthLayout.N3jfPbOx.js";import{s as O,V as Q,B as p,W as _,b as v,T as y}from"./vendor-mui.C3L14zBt.js";import{h as H,g as M}from"./react-google-recaptcha-v3.esm.CGcB2DtM.js";import{n as N}from"./vendor-icons.DdMavDm7.js";import"./vendor-query.DIUg6SBK.js";import"./vendor-aws.BQPMFirn.js";function W(t){if(t.target.value.length>t.target.maxLength)return t.target.value=t.target.value.slice(0,t.target.maxLength)}const Y=O(Q)(({theme:t})=>({"& .MuiOutlinedInput-input":{width:36,height:36,padding:0,textAlign:"center",[t.breakpoints.up("sm")]:{width:56,height:56}}})),K=({formik:t})=>{const{values:r,errors:f,isValid:m,touched:x,isSubmitting:l,handleSubmit:u,getFieldProps:s,setValues:g}=t,i=a=>{let o=a?.clipboardData?.getData("Text")||"";o=o.split(""),g({code1:o[0],code2:o[1],code3:o[2],code4:o[3],code5:o[4],code6:o[5]})};return b.useEffect(()=>{document.addEventListener("paste",i)},[]),b.useEffect(()=>{r.code6&&u()},[u,r.code6]),e.jsx(E,{value:t,children:e.jsxs(I,{autoComplete:"off",noValidate:!0,onSubmit:u,children:[e.jsx(p,{sx:{display:"flex",justifyContent:"center"},children:Object.keys(r).map(a=>e.jsx(p,{sx:{mx:1},children:e.jsx(Y,{...s(a),type:"number",placeholder:"-",onInput:W,inputProps:{maxLength:1},error:!!(x[a]&&f[a])})},a))}),e.jsx(_,{error:!m,style:{textAlign:"right"},children:!m&&"Code is required"}),e.jsx(p,{sx:{mt:3},children:e.jsx(v,{fullWidth:!0,size:"large",type:"submit",variant:"solid",loading:l,children:"Verify"})})]})})},U=!0,$="6Lc7aQ0tAAAAANnQtYYkP36VURJ6DS2DQ-kuVHI7",J=()=>{const{executeRecaptcha:t}=M(),r=L(),{confirmSignup:f,login:m,resendConfirmationCode:x}=F(),{enqueueSnackbar:l}=D(),u=T(),s=w(),g=k(s.state),i=k(s.search),a=R().shape({code1:d().required("Code is required"),code2:d().required("Code is required"),code3:d().required("Code is required"),code4:d().required("Code is required"),code5:d().required("Code is required"),code6:d().required("Code is required")}),o=i?.get("email")||"",n=i.get("verificationCode")||"",C=g.get("password")||"",q=i.get("type")||"",j=B({initialValues:{code1:n[0]||"",code2:n[1]||"",code3:n[2]||"",code4:n[3]||"",code5:n[4]||"",code6:n[5]||""},validationSchema:a,onSubmit:async(G,{setSubmitting:S})=>{try{const c=Object.values(j.values).map(h=>[h]).join("");if(q?.toLowerCase()==="verify-account"){let h=null;if(U&&t&&(h=await t("verify")),await f({email:o,code:c,recaptchaToken:h}),l("Verification successful. You can now log in.",{variant:"success"}),C&&await m({email:o,password:C}),s.state?.from){const V=s.state.from.pathname+s.state.from.search;r(V)}else r("/login")}else r("/change-password?email="+encodeURIComponent(o)+"&code="+c)}catch(c){l(c.message,{variant:"error"}),u.current&&(S(!1),l(c.code||c.message,{variant:"error"}))}}});return e.jsxs(z,{title:"Verify | Cerebrium",children:[e.jsx(v,{size:"small",component:P,to:"/login",startIcon:e.jsx(N,{size:20,stroke:1.75}),sx:{mb:3},children:"Back"}),e.jsx(y,{variant:"h3",gutterBottom:!0,children:"Please check your email!"}),e.jsxs(y,{sx:{color:"text.secondary"},children:["We have emailed a 6-digit confirmation code to ",i.get("email"),", please enter the code in below box to verify your email."]}),e.jsx(p,{sx:{mt:5,mb:3},children:e.jsx(K,{formik:j})}),e.jsxs(y,{variant:"body2",align:"center",children:["Don't have a code? Â ",e.jsx(v,{variant:"text",onClick:()=>x(o),disabled:!o,children:"Resend code"})]})]})},ce=()=>{const t=A.c(2);{let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=e.jsx(H,{reCaptchaKey:$,children:e.jsx(J,{})}),t[0]=r):r=t[0],r}};export{ce as default}; 2//# sourceMappingURL=VerifyCodePage.CEEiHtqz.js.map
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.