import{G as e,o as t,q as n}from"./useStore-B9WcefOa.js";import{t as r}from"./link-CSxX31-N.js";import{D as i,T as a,c as o}from"./index-VYIssuI_.js";import{i as s,t as c}from"./Layout-uiA8q21U.js";var l=n(e()),u=t();function d(){let e=i(),[t,n]=(0,l.useState)(!1);async function d(t){t.preventDefault();let r=new FormData(t.currentTarget),i=String(r.get(`email`)??``).trim(),s=String(r.get(`password`)??``);if(!i||s.length<6){o.error(`Enter an email and a password of at least 6 characters.`);return}n(!0);let{error:c}=await a.auth.signInWithPassword({email:i,password:s});if(n(!1),c){o.error(c.message);return}e({to:`/admin`})}return(0,u.jsx)(s,{children:(0,u.jsx)(c,{children:(0,u.jsxs)(`div`,{className:`mx-auto max-w-md border border-border bg-card p-8 shadow-sm`,children:[(0,u.jsx)(`h1`,{className:`font-display text-3xl text-maroon`,children:`Staff sign in`}),(0,u.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Admin and staff accounts are created internally — there is no public sign-up.`}),(0,u.jsxs)(`form`,{onSubmit:d,className:`mt-6 space-y-4`,children:[(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`email`,className:`block text-sm font-semibold text-maroon`,children:`Email`}),(0,u.jsx)(`input`,{id:`email`,name:`email`,type:`email`,required:!0,autoComplete:`email`,className:`mt-1 w-full border border-input bg-background px-3 py-2 outline-none focus:border-gold`})]}),(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`label`,{htmlFor:`password`,className:`block text-sm font-semibold text-maroon`,children:`Password`}),(0,u.jsx)(`input`,{id:`password`,name:`password`,type:`password`,required:!0,autoComplete:`current-password`,className:`mt-1 w-full border border-input bg-background px-3 py-2 outline-none focus:border-gold`})]}),(0,u.jsx)(`button`,{type:`submit`,disabled:t,className:`w-full bg-maroon px-5 py-3 uppercase tracking-wide text-primary-foreground hover:bg-maroon-dark disabled:opacity-60`,children:t?`Please wait…`:`Sign in`})]}),(0,u.jsx)(`p`,{className:`mt-5 text-sm text-muted-foreground`,children:`Need access? Ask an existing administrator to create your account.`}),(0,u.jsx)(`p`,{className:`mt-6 text-center text-sm`,children:(0,u.jsx)(r,{to:`/`,className:`text-maroon underline`,children:`Back to the gallery`})})]})})})}export{d as component};