1import{c as g,k,l as S,r as t,j as e,L as h,B as C,t as x}from"./main-BGPPHxHM.js";import{I as p}from"./input-D0ZnlPy7.js";import{L as f}from"./label-Cs-fnIPW.js";import{C as E}from"./car-C2IJ_QB7.js";import{E as L}from"./eye-5ih1ta9I.js";const I=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P=g("eye-off",I);const M=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],A=g("log-in",M);function U(){const{signIn:j,isAdmin:n,user:o,loading:i,roleChecked:d}=k(),a=S(),[l,c]=t.useState(!1),[m,w]=t.useState(""),[u,y]=t.useState(""),[r,b]=t.useState(!1);t.useEffect(()=>{!i&&d&&o&&n&&a({to:"/admin"})},[i,d,o,n,a]);async function N(s){s.preventDefault(),c(!0);const{error:v}=await j(m.trim(),u);if(c(!1),v){x.error("Invalid username or password");return}x.success("Welcome back"),a({to:"/admin"})}return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-soft px-4",children:e.jsxs("div",{className:"w-full max-w-md",children:[e.jsxs(h,{to:"/",className:"mb-8 flex items-center justify-center gap-2 font-display text-2xl font-bold",children:[e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-hero text-primary-foreground shadow-elegant",children:e.jsx(E,{className:"h-5 w-5"})}),"Pulse Cars"]}),e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8 shadow-elegant",children:[e.jsx("h1",{className:"font-display text-2xl font-bold",children:"Admin sign in"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Enter your credentials to manage the dealership."}),e.jsxs("form",{onSubmit:N,className:"mt-6 space-y-4",children:[e.jsxs("div",{children:[e.jsx(f,{htmlFor:"u",children:"Username"}),e.jsx(p,{id:"u",value:m,onChange:s=>w(s.target.value),required:!0})]}),e.jsxs("div",{children:[e.jsx(f,{htmlFor:"p",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(p,{id:"p",type:r?"text":"password",value:u,onChange:s=>y(s.target.value),required:!0,className:"pr-10"}),e.jsx("button",{type:"button",onClick:()=>b(s=>!s),"aria-label":r?"Hide password":"Show password",className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-md p-1.5 text-muted-foreground hover:text-foreground",children:r?e.jsx(P,{className:"h-4 w-4"}):e.jsx(L,{className:"h-4 w-4"})})]})]}),e.jsxs(C,{type:"submit",className:"w-full bg-gradient-hero shadow-elegant",disabled:l,children:[e.jsx(A,{className:"mr-2 h-4 w-4"}),l?"Signing inâ¦":"Sign in"]})]})]}),e.jsx("p",{className:"mt-6 text-center text-xs text-muted-foreground",children:e.jsx(h,{to:"/",className:"hover:text-primary",children:"â Back to site"})})]})})}export{U as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.