1import{j as s,a as b,d as O,L as R,E as j,e as y,b as T,g as _,A as F}from"./index-DtC850PH.js";import{c as I,u as V,b as r,L as D}from"./react-vendor-h5iCtO61.js";import{a as v,v as N}from"./passwordRules-C1GdKp8X.js";import{A as P}from"./AuthLayout-BjZF6m-5.js";import{O as S}from"./OnboardingProgress-Cecnv6BQ.js";import"./d3-DtwXkwuQ.js";function B(){const C=I(),p=V().state||{},d=p.email||"",u=p.token||"",[o,E]=r.useState(""),[c,k]=r.useState(""),[l,A]=r.useState(!1),[i,z]=r.useState(!1),[f,h]=r.useState(!1),[w,x]=r.useState(null),[e,m]=r.useState({});if(!d||!u)return s.jsx(P,{scroll:"auto",header:s.jsx(S,{step:0,caption:"Create your password"}),children:s.jsxs("div",{className:"w-full py-6 text-center flex flex-col items-center",children:[s.jsx("div",{className:"w-16 h-16 rounded-full bg-rose-50 text-rose-600 flex items-center justify-center mb-4 ring-8 ring-rose-50/50",children:s.jsx(b,{size:32})}),s.jsx("h1",{className:"text-2xl font-extrabold text-gray-900 mb-2",children:"Setup link expired or missing"}),s.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"We couldn't verify your password setup link. Verify your email again to get a fresh code."}),s.jsxs(D,{to:"/verify-email",className:"w-full py-3 bg-[#5c5bf4] hover:bg-[#4d4be3] text-white text-sm font-bold tracking-wider rounded-xl transition-all flex items-center justify-center gap-2",children:[s.jsx("span",{children:"VERIFY MY EMAIL"}),s.jsx(O,{size:16})]})]})});const L=async t=>{t.preventDefault();const a=v(o),g=N(o,c);if(m({password:a,confirmPassword:g}),!(a||g)){h(!0),x(null);try{const n=await T.setStudentPassword({email:d,passwordSetupToken:u,password:o,confirmPassword:c});C(_(n.user),{replace:!0})}catch(n){n instanceof F?x(n.message):x("Could not set password. The link may have expired.")}finally{h(!1)}}};return s.jsx(P,{scroll:"auto",header:s.jsx(S,{step:0,caption:"Create your password"}),children:s.jsxs("div",{className:"w-full",children:[s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 bg-indigo-50 text-[#5c5bf4] rounded-full text-xs font-semibold mb-2",children:[s.jsx(R,{size:14}),s.jsx("span",{children:"Password Setup"})]}),s.jsx("h1",{className:"text-2xl sm:text-3xl font-extrabold text-gray-900 tracking-tight mb-1",children:"Create your password"}),s.jsxs("p",{className:"text-xs sm:text-sm text-gray-500 font-normal",children:["Set a password for ",s.jsx("strong",{className:"text-gray-800 font-semibold",children:d})," to complete your account."]})]}),w&&s.jsxs("div",{className:"mb-5 p-3.5 bg-rose-50 border border-rose-200 text-rose-800 text-sm rounded-xl flex items-start gap-2",children:[s.jsx(b,{size:16,className:"shrink-0 mt-0.5 text-rose-600"}),s.jsx("span",{className:"font-medium",children:w})]}),s.jsxs("form",{onSubmit:L,noValidate:!0,className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("label",{htmlFor:"create-password",className:"text-xs font-semibold text-gray-700",children:["Password ",s.jsx("span",{className:"text-rose-500",children:"*"})]}),s.jsxs("div",{className:"relative w-full",children:[s.jsx("input",{id:"create-password",type:l?"text":"password",placeholder:"Enter password",value:o,onChange:t=>{E(t.target.value),e.password&&m(a=>({...a,password:v(t.target.value)}))},className:`w-full px-3.5 py-2.5 pr-11 text-sm text-gray-900 bg-white border rounded-xl outline-none transition-all ${e.password?"border-red-500 focus:ring-2 focus:ring-red-500/20":"border-gray-200 focus:ring-2 focus:ring-[#5c5bf4]/20"}`}),s.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-600 rounded-md",onClick:()=>A(!l),"aria-label":l?"Hide password":"Show password",children:l?s.jsx(j,{size:16}):s.jsx(y,{size:16})})]}),e.password&&s.jsx("p",{className:"text-xs text-rose-600",children:e.password})]}),s.jsxs("div",{className:"flex flex-col gap-1.5",children:[s.jsxs("label",{htmlFor:"create-confirm-password",className:"text-xs font-semibold text-gray-700",children:["Confirm Password ",s.jsx("span",{className:"text-rose-500",children:"*"})]}),s.jsxs("div",{className:"relative w-full",children:[s.jsx("input",{id:"create-confirm-password",type:i?"text":"password",placeholder:"Confirm password",value:c,onChange:t=>{k(t.target.value),e.confirmPassword&&m(a=>({...a,confirmPassword:N(o,t.target.value)}))},className:`w-full px-3.5 py-2.5 pr-11 text-sm text-gray-900 bg-white border rounded-xl outline-none transition-all ${e.confirmPassword?"border-red-500 focus:ring-2 focus:ring-red-500/20":"border-gray-200 focus:ring-2 focus:ring-[#5c5bf4]/20"}`}),s.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 p-1.5 text-gray-400 hover:text-gray-600 rounded-md",onClick:()=>z(!i),"aria-label":i?"Hide password":"Show password",children:i?s.jsx(j,{size:16}):s.jsx(y,{size:16})})]}),e.confirmPassword&&s.jsx("p",{className:"text-xs text-rose-600",children:e.confirmPassword})]}),s.jsx("button",{type:"submit",disabled:f,className:"w-full py-3 mt-2 bg-[#5c5bf4] hover:bg-[#4d4be3] disabled:opacity-40 text-white text-sm font-bold tracking-wider rounded-xl shadow-[0_8px_20px_-4px_rgba(92,91,244,0.4)] flex items-center justify-center min-h-[46px] cursor-pointer",children:f?s.jsx("span",{className:"w-5 h-5 border-2 border-white/40 border-t-white rounded-full animate-spin"}):"SET PASSWORD & CONTINUE"})]})]})})}export{B 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.