import{r as s,u as f,j as e,aj as p,ak as b}from"./index-BVAJPyoi.js";function v(){const[c,m]=s.useState(""),[d,x]=s.useState(""),[a,o]=s.useState(""),[r,u]=s.useState(""),[l,n]=s.useState(""),g=f(),y=async t=>{t.preventDefault();try{await p(c)?(u("Email verified successfully!"),setTimeout(()=>g("/signin"),2e3)):o("Unexpected error")}catch(i){o(i instanceof Error?i.message:"Unexpected error")}},h=async()=>{try{const t=await b(d);n(t?"Verification code resent to your email.":"Failed to resend code")}catch(t){n(t instanceof Error?t.message:"Failed to resend code")}};return e.jsx("div",{className:"flex flex-col items-center justify-center min-h-screen px-4 py-8 bg-gray-50 dark:bg-gray-900",children:e.jsxs("div",{className:"w-full max-w-md p-6 bg-white rounded-lg shadow-md dark:bg-gray-800",children:[e.jsx("h2",{className:"mb-4 text-xl font-semibold text-center text-gray-800 dark:text-white",children:"Verify Your Email"}),e.jsxs("form",{onSubmit:y,className:"space-y-4",children:[e.jsx("input",{type:"text",placeholder:"Enter verification code",value:c,onChange:t=>m(t.target.value),className:"w-full px-4 py-2 border rounded-md dark:bg-gray-700 dark:text-white"}),e.jsx("button",{type:"submit",className:"w-full bg-brand-500 text-white py-2 rounded hover:bg-brand-600 transition",children:"Verify Email"})]}),e.jsxs("div",{className:"mt-6 space-y-3",children:[e.jsx("input",{type:"email",placeholder:"Enter your email to resend code",value:d,onChange:t=>x(t.target.value),className:"w-full px-4 py-2 border rounded-md dark:bg-gray-700 dark:text-white"}),e.jsx("button",{onClick:h,className:"w-full bg-gray-200 text-gray-800 py-2 rounded hover:bg-gray-300 transition dark:bg-gray-700 dark:text-white",children:"Resend Verification Code"}),l&&e.jsx("p",{className:"text-sm text-center text-green-600",children:l})]}),(a||r)&&e.jsxs("div",{className:"mt-4 text-center",children:[a&&e.jsx("p",{className:"text-sm text-error-500",children:a}),r&&e.jsx("p",{className:"text-sm text-green-600",children:r})]})]})})}export{v as default};
