import{n as p,k as s,j as e,L as c}from"./index-D0iJORaS.js";import{C as j,B as m,I as g,L as v}from"./input-CcQzS21A.js";import{L as b}from"./label-gVuAupIv.js";import{C as N}from"./circle-check-CfUyk-e8.js";import{M as w}from"./mail-u7iluGro.js";import{A as y}from"./arrow-left-DyGsb0RC.js";function I(){const{requestPasswordReset:d}=p(),[a,u]=s.useState(""),[x,h]=s.useState(!1),[t,l]=s.useState(null),[i,n]=s.useState(!1),f=async r=>{r.preventDefault(),l(null),n(!0);try{await d(a),h(!0)}catch(o){l(o instanceof Error?o.message:"Erro ao solicitar.")}finally{n(!1)}};return e.jsx("div",{className:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-muted/40 via-background to-accent/30 px-4 py-10",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs("div",{className:"mb-6 flex flex-col items-center",children:[e.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-xl bg-gradient-to-br from-primary to-primary-glow shadow-lg shadow-primary/20",children:e.jsx(j,{className:"h-6 w-6 text-primary-foreground"})}),e.jsx("h1",{className:"mt-3 text-xl font-bold tracking-tight",children:"365-BI"})]}),e.jsx("div",{className:"rounded-2xl border border-border bg-card p-6 shadow-xl shadow-black/[0.04] sm:p-8",children:x?e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-success/10",children:e.jsx(N,{className:"h-6 w-6 text-success"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Link enviado"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Enviamos um link de redefinição para ",e.jsx("strong",{children:a}),". Verifique sua caixa de entrada."]})]}),e.jsx(m,{asChild:!0,variant:"outline",className:"w-full",children:e.jsx(c,{to:"/login",children:"Voltar para o login"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-6 space-y-1",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Recuperar senha"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Informe seu e-mail e enviaremos um link para redefinir sua senha."})]}),e.jsxs("form",{onSubmit:f,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(b,{htmlFor:"email",children:"E-mail"}),e.jsxs("div",{className:"relative",children:[e.jsx(w,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(g,{id:"email",type:"email",required:!0,placeholder:"voce@empresa.com",value:a,onChange:r=>u(r.target.value),className:"h-11 pl-9"})]})]}),t&&e.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive",children:t}),e.jsx(m,{type:"submit",className:"w-full h-11",disabled:i,children:i?e.jsxs(e.Fragment,{children:[e.jsx(v,{className:"h-4 w-4 animate-spin"})," Enviando..."]}):"Enviar link de recuperação"}),e.jsxs(c,{to:"/login",className:"flex items-center justify-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[e.jsx(y,{className:"h-3.5 w-3.5"}),"Voltar para o login"]})]})]})})]})})}export{I as component};
