1import{j as e}from"./vendor-query-CniT1WJL.js";import{r as i,L as o}from"./vendor-react-69GsFwrV.js";import{f as x,r as h,o as p,s as f}from"./vendor-forms-q6h4WU-p.js";import{L as g,I as j,B as v,h as y}from"./index-KjAD5lCC.js";import{M as N,K as b}from"./vendor-ui-Ad3ANzF6.js";const k=p({email:f().email("Valid email required")});function E(){const[r,l]=i.useState(!1),[d,c]=i.useState(!1),[m,a]=i.useState(null),n=x({defaultValues:{email:""},validationLogic:h({mode:"submit",modeAfterSubmission:"change"}),validators:{onDynamic:k},onSubmit:async({value:t})=>{await u(t)}}),u=async t=>{l(!0),a(null);try{const{error:s}=await y.requestPasswordReset({email:t.email,redirectTo:"/reset-password"});if(s){a(s.status===429?"Too many requests from this network. Please wait a few minutes and try again.":s.message||"We couldn't send the reset email. Please wait a moment and try again.");return}c(!0)}catch{a("We couldn't reach the server. Check your connection and try again.")}finally{l(!1)}};return d?e.jsx("div",{className:"min-h-[70vh] flex items-center justify-center px-4 py-8",children:e.jsx("div",{className:"w-full max-w-sm",children:e.jsxs("div",{className:"vp-glass rounded-card p-6 text-center","data-testid":"forgot-success",children:[e.jsx("div",{className:"inline-flex items-center justify-center bg-vida-mint-soft rounded-pill p-3 mb-3",children:e.jsx(N,{className:"w-7 h-7 text-vida-green-700","aria-hidden":"true"})}),e.jsx("h1",{className:"font-display text-t2 text-ink",children:"Check your email"}),e.jsx("p",{className:"text-ink-3 text-sm mt-2",children:"If an account exists for that email, a password reset link has been sent. The link expires after a short time, so use it soon."}),e.jsx("p",{className:"text-center text-sm text-ink-3 mt-6",children:e.jsx(o,{href:"/login",className:"text-primary hover:underline font-medium","data-testid":"link-back-to-login",children:"Back to sign in"})})]})})}):e.jsx("div",{className:"min-h-[70vh] flex items-center justify-center px-4 py-8",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center bg-vida-mint-soft rounded-pill p-3 mb-3",children:e.jsx(b,{className:"w-7 h-7 text-vida-green-700","aria-hidden":"true"})}),e.jsx("h1",{className:"font-display text-t2 text-ink",children:"Forgot Password"}),e.jsx("p",{className:"text-ink-3 text-sm mt-1",children:"Enter your email and we'll send you a reset link"})]}),e.jsx("div",{className:"vp-glass rounded-card p-6",children:e.jsxs("form",{onSubmit:t=>{t.preventDefault(),t.stopPropagation(),n.handleSubmit()},className:"space-y-4",children:[e.jsx(n.Field,{name:"email",children:t=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(g,{htmlFor:t.name,children:"Email"}),e.jsx(j,{id:t.name,name:t.name,type:"email",autoComplete:"email","data-testid":"input-forgot-email",value:t.state.value,onBlur:t.handleBlur,onChange:s=>t.handleChange(s.target.value)}),(t.state.meta.isTouched||n.state.submissionAttempts>0)&&t.state.meta.errors.length>0?e.jsx("p",{className:"text-danger text-sm",children:String(t.state.meta.errors[0]?.message??t.state.meta.errors[0])}):null]})}),m?e.jsx("p",{className:"text-danger text-sm",role:"alert","data-testid":"forgot-send-error",children:m}):null,e.jsx(v,{type:"submit",className:"w-full",disabled:r,"data-testid":"button-send-reset-link",children:r?"Sending...":"Send Reset Link"})]})}),e.jsxs("p",{className:"text-center text-sm text-ink-3 mt-4",children:["Remembered it?"," ",e.jsx(o,{href:"/login",className:"text-primary hover:underline font-medium","data-testid":"link-login",children:"Sign in"})]})]})})}export{E 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.