import{a as P,j as e}from"./vendor-query-Brcc40-Y.js";import{u as j,b as y,s as p}from"./vendor-form-BQNAly2Z.js";import{d as k,I as u,B as v,t as M}from"./index-tN-ddyeb.js";import{b as N,L as w}from"./vendor-react-DP6BW_9B.js";import{A as x}from"./AuthLayout-DounjrD9.js";import"./vendor-utils-ui5PHgZB.js";import"./vendor-zustand-CVDiRiMG.js";const S=y({newPassword:p().min(8,"At least 8 characters").regex(/[A-Z]/,"Must include an uppercase letter").regex(/\d/,"Must include a number").regex(/[^A-Za-z0-9]/,"Must include a special character"),confirmPassword:p()}).refine(s=>s.newPassword===s.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]});function E(){var i,l,d,m,c;const[s,h]=P.useState(!1),[g]=N(),a=g.get("token")??"",r=k(),{register:o,handleSubmit:b,formState:{errors:n}}=j({resolver:M(S)}),f=t=>r.mutate({token:a,newPassword:t.newPassword});return a?e.jsxs(x,{title:"Set new password",subtitle:"Choose a strong password for your account",children:[e.jsxs("form",{onSubmit:b(f),noValidate:!0,className:"space-y-5",children:[e.jsx(u,{label:"New password",type:s?"text":"password",autoComplete:"new-password",placeholder:"••••••••",error:(i=n.newPassword)==null?void 0:i.message,rightElement:e.jsx("button",{type:"button",onClick:()=>h(t=>!t),className:"text-ink-muted hover:text-ink transition-colors","aria-label":"Toggle password visibility",children:e.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:s?"M13.875 18.825A10.05 10.05 0 0112 19c-4.478 0-8.268-2.943-9.543-7a9.97 9.97 0 011.563-3.029m5.858.908a3 3 0 114.243 4.243M9.878 9.878l4.242 4.242M9.88 9.88l-3.29-3.29m7.532 7.532l3.29 3.29M3 3l3.59 3.59m0 0A9.953 9.953 0 0112 5c4.478 0 8.268 2.943 9.543 7a10.025 10.025 0 01-4.132 5.411m0 0L21 21":"M15 12a3 3 0 11-6 0 3 3 0 016 0zM2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})})}),...o("newPassword")}),e.jsx(u,{label:"Confirm new password",type:s?"text":"password",autoComplete:"new-password",placeholder:"••••••••",error:(l=n.confirmPassword)==null?void 0:l.message,...o("confirmPassword")}),r.error&&e.jsx("div",{className:"rounded-xl border border-danger/30 bg-danger-subtle px-4 py-3",children:e.jsx("p",{className:"text-sm text-danger",children:((c=(m=(d=r.error)==null?void 0:d.response)==null?void 0:m.data)==null?void 0:c.message)??"This link may have expired. Please request a new one."})}),e.jsx(v,{type:"submit",fullWidth:!0,size:"lg",loading:r.isPending,children:"Update password"})]}),e.jsx("p",{className:"mt-8 text-center text-sm text-ink-muted",children:e.jsx(w,{to:"/login",className:"text-primary hover:text-primary-hover font-medium transition-colors",children:"← Back to sign in"})})]}):e.jsx(x,{title:"Invalid link",subtitle:"This password reset link is invalid or has expired.",children:e.jsx(w,{to:"/forgot-password",className:"inline-flex w-full items-center justify-center rounded-xl border border-bg-overlay bg-bg-elevated px-6 py-3 text-base font-medium text-ink hover:bg-bg-overlay transition-all",children:"Request a new link"})})}export{E as default};
