import{r as g,j as e,L as f,R as x,B as j,a9 as w,aa as b}from"./index-C-gKvEDq.js";import{u as y,F as N,a as i,b as l,c as m,d,e as c}from"./form-rPxRlXL8.js";import{u as v}from"./zod-B-5Oumzy.js";import{I as u}from"./input-B9yFYvyi.js";import{u as k,l as S}from"./reset-password.schema-CwyhfFqu.js";import{E as F}from"./eye-off-C4jQEr1z.js";import{E}from"./eye-CPt1Lma-.js";import{L}from"./loader-circle-MiR2w4nF.js";import"./label-B3YRGmn1.js";import"./schemas-IctYPUjJ.js";import"./query-keys-DGBjVswC.js";const R=r=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);function A(){const[r,n]=g.useState(!1),{login:p,isLoggingIn:t}=k(),a=y({resolver:v(S),defaultValues:{identifier:"",password:""}}),h=s=>{const o={password:s.password};R(s.identifier)?o.email=s.identifier:o.username=s.identifier,p(o)};return e.jsx(N,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(h),className:"space-y-4",children:[e.jsx(i,{control:a.control,name:"identifier",render:({field:s})=>e.jsxs(l,{children:[e.jsx(m,{required:!0,children:"Email or Username"}),e.jsx(d,{children:e.jsx(u,{type:"text",placeholder:"Enter your email or username",...s,disabled:t,autoComplete:"username"})}),e.jsx(c,{})]})}),e.jsx(i,{control:a.control,name:"password",render:({field:s})=>e.jsxs(l,{children:[e.jsx(m,{required:!0,children:"Password"}),e.jsx(d,{children:e.jsxs("div",{className:"relative",children:[e.jsx(u,{type:r?"text":"password",placeholder:"Enter your password",...s,disabled:t,autoComplete:"current-password"}),e.jsx("button",{type:"button",onClick:()=>n(!r),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:r?e.jsx(F,{className:"h-4 w-4"}):e.jsx(E,{className:"h-4 w-4"})})]})}),e.jsx(c,{})]})}),e.jsx("div",{className:"flex items-center justify-between",children:e.jsx("div",{className:"text-sm",children:e.jsx(f,{to:x.FORGOT_PASSWORD,className:"text-primary hover:underline",children:"Forgot password?"})})}),e.jsxs(j,{type:"submit",className:"w-full",disabled:t,children:[t&&e.jsx(L,{className:"mr-2 h-4 w-4 animate-spin"}),"Sign In"]})]})})}const I="/assets/floral_background-IHL1nwwk.png";function $(){const{isAuthenticated:r}=w();return r?e.jsx(b,{to:x.DASHBOARD,replace:!0}):e.jsxs("div",{className:"flex min-h-screen items-center justify-center relative",style:{backgroundImage:`url(${I})`,backgroundPosition:"right top",backgroundRepeat:"no-repeat"},children:[e.jsx("div",{className:"absolute inset-0"}),e.jsxs("div",{className:"relative z-10 w-full max-w-md space-y-8 rounded-lg bg-white/95 backdrop-blur-sm p-8 shadow-2xl dark:bg-gray-950/95 mx-4",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-gray-900 dark:text-white",children:"Hospital Accounts Module"}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground dark:text-muted-foreground",children:"Sign in to your account"})]}),e.jsx(A,{}),e.jsx("div",{className:"text-center text-sm text-muted-foreground dark:text-muted-foreground",children:e.jsxs("p",{children:["© ",new Date().getFullYear()," Absolin Hospital Management System"]})})]})]})}export{$ as LoginPage};
