import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n}from"./markdown-Biq8ujIZ.js";import{n as r}from"./AuthContext-Bov8HYX4.js";import{n as i,r as a}from"./validation-BzXm0WTc.js";import{Z as o,a as s,i as c}from"./index-Bh9Wgd1K.js";import{t as l}from"./Alert-DgQ1Y_9i.js";var u=e(t(),1),d=n();function f(){let{sendPasswordReset:e}=r(),[t,n]=(0,u.useState)(``),[f,p]=(0,u.useState)(``),[m,h]=(0,u.useState)(!1),[g,_]=(0,u.useState)(!1);async function v(n){if(n.preventDefault(),p(``),!i(t))return p(`Please enter a valid email address.`);_(!0);let r=await e(t.trim());_(!1),r.success?h(!0):p(r.error??`Could not send the reset email.`)}return(0,d.jsx)(a,{variant:`reset`,title:`Reset your password`,subtitle:`We’ll email you a secure link to set a new one.`,footer:(0,d.jsx)(o,{to:`/login`,className:`font-medium text-brand-600 hover:underline`,children:`Back to sign in`}),children:m?(0,d.jsxs)(l,{tone:`success`,children:[`If an account exists for `,(0,d.jsx)(`strong`,{children:t}),`, a reset link is on its way. Check your inbox (and spam).`]}):(0,d.jsxs)(`form`,{onSubmit:v,className:`space-y-4`,children:[f&&(0,d.jsx)(l,{tone:`error`,children:f}),(0,d.jsx)(c,{label:`Email`,name:`email`,type:`email`,autoComplete:`email`,placeholder:`you@example.com`,value:t,onChange:e=>n(e.target.value)}),(0,d.jsx)(s,{type:`submit`,fullWidth:!0,loading:g,children:`Send reset link`})]})})}export{f as default};