import{n as F,_ as A,u as y,a as H,b as T,r as j,c as E,d as g,e as U,j as r,F as _,S as m,f as t,A as f,R as w,I as q,g as B,h as $,L as x,i as v,k as W,o as D,l as b,m as z,T as c,C as M,B as O,p as G,q as N,s as V,t as o}from"./index.8f299a7d.js";import{P as J}from"./Page.4c1db0aa.js";import{R as K}from"./RHFCheckbox.5107bbb8.js";import{C as Q}from"./Card.1ec83a31.js";import"./FormControlLabel.4a0a74ee.js";import"./Checkbox.8fe02966.js";function X(e){return e.charAt(0).toUpperCase()+e.substr(1)}function Y(e){return X(e.toLowerCase())}function Z(e,s){return s===void 0&&(s={}),F(e,A({delimiter:" ",transform:Y},s))}function i(e,s){return`${e}${s}`}const a="/auth",ee={root:a,login:i(a,"/login"),register:i(a,"/register"),loginUnprotected:i(a,"/login-unprotected"),registerUnprotected:i(a,"/register-unprotected"),verify:i(a,"/verify"),resetPassword:i(a,"/reset-password")};function te(){const{login:e}=y(),s=H(),d=T(),[l,S]=j.exports.useState(!1),C=E().shape({email:g().email("Email must be a valid email address").required("Email is required"),password:g().required("Password is required")}),k={email:"admin@linksehat.dev",password:"password",remember:!0},u=U({resolver:D(C),defaultValues:k}),{reset:I,setError:L,handleSubmit:P,formState:{errors:p,isSubmitting:R}}=u;return r(_,{methods:u,onSubmit:P(async h=>{try{const n=await e(h.email,h.password);s("/dashboard")}catch(n){console.error(n),I(),d.current&&L("afterSubmit",{...n,message:n.data.message})}}),children:[r(m,{spacing:3,children:[t(f,{severity:"info",children:"Email : admin@linksehat.dev & Password : password"}),!!p.afterSubmit&&t(f,{severity:"error",children:p.afterSubmit.message}),t(w,{name:"email",label:"Email address"}),t(w,{name:"password",label:"Password",type:l?"text":"password",InputProps:{endAdornment:t(q,{position:"end",children:t(B,{onClick:()=>S(!l),edge:"end",children:t($,{icon:l?"eva:eye-fill":"eva:eye-off-fill"})})})}})]}),r(m,{direction:"row",alignItems:"center",justifyContent:"space-between",sx:{my:2},children:[t(K,{name:"remember",label:"Remember me"}),t(x,{component:v,variant:"subtitle2",to:ee.resetPassword,children:"Forgot password?"})]}),t(W,{fullWidth:!0,size:"large",type:"submit",variant:"contained",loading:R,children:"Login"})]})}const se=o("div")(({theme:e})=>({[e.breakpoints.up("md")]:{display:"flex"}})),re=o("header")(({theme:e})=>({top:0,zIndex:9,lineHeight:0,width:"100%",display:"flex",alignItems:"center",position:"absolute",padding:e.spacing(3),justifyContent:"space-between",[e.breakpoints.up("md")]:{alignItems:"flex-start",padding:e.spacing(7,5,0,7)}}));o(Q)(({theme:e})=>({width:"100%",maxWidth:464,display:"flex",flexDirection:"column",justifyContent:"center",margin:e.spacing(2,0,2,2)}));const ae=o("div")(({theme:e})=>({maxWidth:480,margin:"auto",display:"flex",minHeight:"100vh",flexDirection:"column",justifyContent:"center",padding:e.spacing(12,0)}));function ue(){const{method:e}=y(),s=b("up","sm");return b("up","md"),t(J,{title:"Login",children:r(se,{children:[r(re,{children:[t(z,{sx:{width:150,height:150}}),s&&r(c,{variant:"body2",sx:{mt:{md:-2}},children:["Has problem with your account? ","",t(x,{variant:"subtitle2",component:v,to:"#",onClick:d=>{window.location.href="mailto:admin@linksehat.com",d.preventDefault()},children:"Contact Us"})]})]}),t(M,{maxWidth:"sm",children:r(ae,{children:[r(m,{direction:"row",alignItems:"center",sx:{mb:5},children:[r(O,{sx:{flexGrow:1},children:[t(c,{variant:"h4",gutterBottom:!0,children:"Sign in to LinkSehat"}),t(c,{sx:{color:"text.secondary"},children:"Enter your details below."})]}),t(G,{title:Z(e),placement:"right",children:t(N,{children:t(V,{disabledEffect:!0,src:`https://minimal-assets-api.vercel.app/assets/icons/auth/ic_${e}.png`,sx:{width:32,height:32}})})})]}),t(te,{}),!1]})})]})})}export{ue as default};
