import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,o as n}from"./vendor-motion-COLzAB1Q.js";import{m as r}from"./vendor-react-CSSUNbfU.js";import{_ as i,c as a,r as o,s}from"./index-DLFWvoW-.js";var c=e(n(),1),l=t(),u=()=>{let[e,t]=(0,c.useState)(``),[n,u]=(0,c.useState)(``),[d,f]=(0,c.useState)(!1),p=r(),{user:m,role:h,loading:g}=s(),_=h===`admin`||h===`content_manager`||h===`hr_manager`||h===`viewer`;return(0,c.useEffect)(()=>{!g&&m&&_&&p(`/admin`)},[m,_,g,p]),(0,l.jsx)(`div`,{className:`min-h-screen bg-background flex items-center justify-center px-4`,children:(0,l.jsxs)(`div`,{className:`w-full max-w-sm`,children:[(0,l.jsxs)(`div`,{className:`text-center mb-10`,children:[(0,l.jsx)(`a`,{href:`/`,className:`text-meta text-muted-foreground hover:text-foreground transition-colors`,children:`← Back to site`}),(0,l.jsx)(`h1`,{className:`text-2xl font-bold text-foreground mt-6 mb-2`,children:`Admin Login`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sign in to manage the studio`})]}),(0,l.jsxs)(`form`,{onSubmit:async t=>{t.preventDefault(),f(!0);let{error:r}=await a.auth.signInWithPassword({email:e,password:n});if(r){i.error(r.message),f(!1);return}i.success(`Welcome back.`)},className:`space-y-5`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:`text-meta text-muted-foreground block mb-2`,children:`Email`}),(0,l.jsx)(`input`,{type:`email`,value:e,onChange:e=>t(e.target.value),className:`w-full bg-card border border-border rounded-xl px-5 py-3 text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:border-primary/50 focus:ring-1 focus:ring-primary/30 transition-all duration-300`,placeholder:`admin@ao3studios.com`,required:!0})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:`text-meta text-muted-foreground block mb-2`,children:`Password`}),(0,l.jsx)(`input`,{type:`password`,value:n,onChange:e=>u(e.target.value),className:`w-full bg-card border border-border rounded-xl px-5 py-3 text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:border-primary/50 focus:ring-1 focus:ring-primary/30 transition-all duration-300`,placeholder:`••••••••`,required:!0})]}),(0,l.jsx)(o,{variant:`hero`,size:`xl`,type:`submit`,className:`w-full`,disabled:d,children:d?`Signing in...`:`Sign In`})]})]})})};export{u as default};