1import{r as a,t as R,$ as C,ar as E,j as e,a6 as y,ad as k,L as F,O as I}from"./index-CEqNdWMB.js";import{L as w}from"./label-MzaZtEZW.js";import{L as N}from"./loader-circle-CSZF46_Z.js";import{L as P}from"./lock-HR5d3pcE.js";function q(s){return!s||!s.startsWith("/")||s.startsWith("//")||s.includes("\\")?null:s}const D=()=>{const[s,v]=a.useState(""),[i,b]=a.useState(""),[l,o]=a.useState(!1),{signIn:S,user:c,hasAnyRole:d,hasAnySiteRole:m,hasAnyEventRole:u,hasAnyCitcRole:x,isLoading:r,rolesLoaded:h}=R(),p=C(),[f]=E(),n=q(f.get("next")),[g,L]=a.useState(f.get("recovered")!=="1");a.useEffect(()=>{if(g&&!r&&h&&c){if(n){window.location.replace(n);return}d&&p(m?"/admin":u?"/admin/events":x?"/admin/citc":"/admin",{replace:!0})}},[c,d,m,u,x,r,h,p,n,g]);const A=async t=>{t.preventDefault(),o(!0);const{error:j}=await S(s,i);o(!1),j?I.error(j):L(!0)};return r?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:e.jsx(N,{className:"h-8 w-8 animate-spin text-primary"})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-primary/10 mb-4",children:e.jsx(P,{className:"h-7 w-7 text-primary"})}),e.jsxs("h1",{className:"font-display text-2xl font-semibold text-foreground",children:["CI ",e.jsx("span",{className:"text-primary",children:"Admin"})]}),e.jsx("p",{className:"text-body-sm text-muted-foreground mt-1",children:"Sign in to your admin account"})]}),e.jsxs("form",{onSubmit:A,className:"card-warm p-6 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"email",children:"Email"}),e.jsx(y,{id:"email",type:"email",value:s,onChange:t=>v(t.target.value),placeholder:"[email protected]",required:!0,autoComplete:"email"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(w,{htmlFor:"password",children:"Password"}),e.jsx(y,{id:"password",type:"password",value:i,onChange:t=>b(t.target.value),placeholder:"â¢â¢â¢â¢â¢â¢â¢â¢",required:!0,autoComplete:"current-password"})]}),e.jsx(k,{type:"submit",className:"w-full",disabled:l,children:l?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"h-4 w-4 animate-spin"}),"Signing in..."]}):"Sign In"})]}),e.jsx("p",{className:"text-center text-sm mt-4",children:e.jsx(F,{to:"/admin/forgot-password",className:"text-primary underline underline-offset-4",children:"Forgot password?"})}),e.jsx("p",{className:"text-center text-xs text-muted-foreground mt-6",children:"Only authorized administrators can access this area."})]})})};export{D as default};
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.