import{j as e}from"./ui-vendor-Cn57k9R1.js";import{r as i,j as w,e as p}from"./react-vendor-B9tfxWGs.js";import{c as b,B as v,r as y}from"./index-DT-X9ySe.js";import{I as m}from"./input-DSW3IQ5Z.js";import{E as j}from"./eye-off-vu7LJGiw.js";import{E as N}from"./eye-B79ITPqV.js";import"./query-vendor-BGnEs3s8.js";import"./charts-vendor-DecUTkfU.js";import"./editor-vendor-BA3QzDsK.js";const P=t=>t.length<6?{label:"Weak",color:"bg-destructive",width:"w-1/4"}:t.length<10?{label:"Fair",color:"bg-primary",width:"w-2/4"}:/[A-Z]/.test(t)&&/[0-9]/.test(t)&&/[^A-Za-z0-9]/.test(t)?{label:"Strong",color:"bg-success",width:"w-full"}:{label:"Good",color:"bg-accent-gold",width:"w-3/4"},R=()=>{const[t,u]=i.useState(""),[a,f]=i.useState(""),[o,h]=i.useState(!1),x=w(),{toast:r}=b(),n=P(t),[l]=p(),d=l.get("token")??"",c=l.get("email")??"",g=async s=>{if(s.preventDefault(),t!==a){r({title:"Passwords don't match",variant:"destructive"});return}if(!d||!c){r({title:"Missing reset link",description:"Open the password reset link from your email.",variant:"destructive"});return}try{await y({token:d,email:c,password:t,password_confirmation:a}),r({title:"Password updated",description:"Please sign in with your new password."}),x("/admin/login")}catch{r({title:"Unable to reset password",description:"Please try again or request a new reset link.",variant:"destructive"})}};return e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"#2D3142"},children:e.jsxs("div",{className:"w-full max-w-sm bg-card rounded-2xl p-10 shadow-2xl",children:[e.jsxs("div",{className:"flex flex-col items-center mb-8",children:[e.jsx("div",{className:"w-12 h-12 rounded-xl bg-primary flex items-center justify-center mb-3",children:e.jsx("span",{className:"text-primary-foreground font-display font-bold text-lg",children:"B"})}),e.jsx("h1",{className:"font-display text-2xl font-bold text-foreground",children:"Set New Password"})]}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground font-body mb-1.5 block",children:"New Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(m,{type:o?"text":"password",value:t,onChange:s=>u(s.target.value),required:!0,minLength:6}),e.jsx("button",{type:"button",onClick:()=>h(!o),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:o?e.jsx(j,{className:"w-4 h-4"}):e.jsx(N,{className:"w-4 h-4"})})]}),t&&e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"h-1.5 rounded-full bg-muted overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all ${n.color} ${n.width}`})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-body",children:n.label})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium text-foreground font-body mb-1.5 block",children:"Confirm Password"}),e.jsx(m,{type:"password",value:a,onChange:s=>f(s.target.value),required:!0})]}),e.jsx(v,{type:"submit",className:"w-full bg-primary hover:bg-primary-dark text-primary-foreground font-body",children:"Set New Password"})]})]})})};export{R as default};
