import{u as g,a as f,r as a,j as s,B as j,s as v,t as b}from"./index-B8oXSmui.js";import{I as d}from"./input-BeAjoI93.js";import{L as m}from"./label-D89q0mK-.js";function S(){const{user:r,loading:n}=g(),t=f();a.useEffect(()=>{!n&&r&&t({to:"/app"})},[r,n,t]);const[i,p]=a.useState(""),[o,h]=a.useState(""),[l,c]=a.useState(!1),x=async e=>{e.preventDefault(),c(!0);const{error:u}=await v.auth.signInWithPassword({email:i,password:o});c(!1),u?b.error(u.message):t({to:"/app"})};return s.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:s.jsxs("div",{className:"w-full max-w-md rounded-2xl border bg-card p-8 shadow-sm",children:[s.jsxs("div",{className:"mb-6 flex items-center gap-2",children:[s.jsx("img",{src:"/logo.png",alt:"MY STUDIO",className:"h-7 w-7",width:28,height:28}),s.jsx("span",{className:"font-semibold",children:"MY STUDIO"})]}),s.jsxs("form",{onSubmit:x,className:"space-y-4 pt-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{children:"Email"}),s.jsx(d,{type:"email",required:!0,value:i,onChange:e=>p(e.target.value)})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(m,{children:"Mot de passe"}),s.jsx(d,{type:"password",required:!0,value:o,onChange:e=>h(e.target.value)})]}),s.jsx(j,{className:"w-full",disabled:l,children:l?"...":"Se connecter"})]})]})})}export{S as component};
