1import{g as w,T as j,r as t,j as e,S as N,b as u,N as m,a as y,f as v}from"./index-Cpv5a_We.js";function k(){const x=w(),{token:n}=j.useSearch(),[r,p]=t.useState(""),[o,h]=t.useState(""),[g,b]=t.useState(!1),[l,d]=t.useState(!1),[i,a]=t.useState(null),f=async s=>{if(s.preventDefault(),a(null),r.length<8){a("Password must be at least 8 characters.");return}if(r!==o){a("Passwords don't match.");return}d(!0);try{await v.auth.resetPassword(n,r),b(!0)}catch(c){a(c instanceof Error?c.message:"Couldn't reset your password. Please request a new link.")}finally{d(!1)}};return e.jsxs("div",{className:"min-h-screen bg-background font-sans text-foreground",children:[e.jsx(N,{}),e.jsx("main",{className:"flex items-center justify-center px-6 py-24 md:px-8",children:e.jsx("div",{className:"w-full max-w-md rounded-3xl border border-border bg-card p-10 shadow-sm",children:g?e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-3xl",children:"â
"}),e.jsx("h1",{className:"mb-2 mt-3 font-serif text-2xl",children:"Password updated"}),e.jsx("p",{className:"text-sm text-foreground/60",children:"Your password has been changed. You can now sign in with your new password."}),e.jsx("button",{onClick:()=>x({to:"/login"}),className:"mt-8 w-full rounded-xl bg-primary py-3.5 font-medium text-primary-foreground transition-colors hover:bg-accent",children:"Sign in"})]}
1):n?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8 text-center",children:[e.jsx("h1",{className:"mb-2 font-serif text-3xl",children:"Set a new password"}),e.jsx("p",{className:"text-sm text-foreground/50",children:"Choose a strong password you'll remember."})]}),e.jsxs("form",{className:"space-y-5",onSubmit:f,children:[e.jsx(m,{label:"New Password",children:e.jsx("input",{type:"password",required:!0,minLength:8,value:r,onChange:s=>p(s.target.value),placeholder:"At least 8 characters",className:"w-full rounded-xl border border-border bg-background px-4 py-3 outline-none transition-colors focus:border-accent"})}),e.jsx(m,{label:"Confirm Password",children:e.jsx("input",{type:"password",required:!0,minLength:8,value:o,onChange:s=>h(s.target.value),placeholder:"Re-enter your password",className:"w-full rounded-xl border border-border bg-background px-4 py-3 outline-none transition-colors focus:border-accent"})}),i&&e.jsx("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 text-sm text-destructive",children:i}),e.jsx("button",{type:"submit",disabled:l,className:"w-full rounded-xl bg-primary py-3.5 font-medium text-primary-foreground transition-colors hover:bg-accent disabled:opacity-60",children:l?"Updatingâ¦":"Update password"})]}),e.jsx("p",{className:"mt-6 text-center text-sm text-foreground/50",children:e.jsx(u,{to:"/login",className:"font-medium text-accent hover:underline",children:"Back to sign in"})})]}):e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-3xl",children:"â ï¸"}),e.jsx("h1",{className:"mb-2 mt-3 font-serif text-2xl",children:"Invalid reset link"}),e.jsx("p",{className:"text-sm text-foreground/60",children:"This link is missing or incomplete. Please request a new password-reset email."}),e.jsx(u,{to:"/forgot-password",className:"mt-8 inline-block rounded-xl bg-accent px-6 py-3 text-sm font-semibold text-accent-foreground transition hover:brightness-95",children:"Request a new link"})]})})}),e.jsx(y,{})]})}export{k as component};
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.