import{r as e}from"./rolldown-runtime-CpWojdLp.js";import{n as t,r as n,t as r}from"./jsx-runtime-BrKkGzFB.js";import{t as i}from"./password-input-DWL5jxHj.js";import{n as a}from"./wayfinder-DdLOzeRB.js";import{B as o,Et as s,O as c,Tt as l,at as u,l as d,v as f}from"./app-KzKSswgw.js";import{t as p}from"./checkbox-CzdgXFa3.js";import{t as m}from"./input-error-B1iqlu2_.js";import{t as h}from"./label-1JB2VirV.js";import{n as g}from"./password-BTPIYPD6.js";import{t as _}from"./turnstile-field-B_v13F1v.js";var v=e(n(),1),y=t(),b=e=>({url:b.url(e),method:`post`});b.definition={methods:[`post`],url:`/login`},b.url=e=>b.definition.url+a(e),b.post=e=>({url:b.url(e),method:`post`});var x=e=>({action:b.url(e),method:`post`});x.post=e=>({action:b.url(e),method:`post`}),b.form=x,Object.assign(b,b);var S=r();function C(e){let t=(0,y.c)(17),{status:n,canResetPassword:r,canRegister:a,maintenanceMode:x,turnstileSiteKey:C}=e,w=x===void 0?!1:x,[T,E]=(0,v.useState)(null),D;t[0]===C?D=t[1]:(D=C?.trim(),t[0]=C,t[1]=D);let O=!!D,k;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,S.jsx)(s,{title:`Iniciar sesión`}),t[2]=k):k=t[2];let A,j;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(A=b.form(),j=[`password`],t[3]=A,t[4]=j):(A=t[3],j=t[4]);let M;t[5]!==a||t[6]!==r||t[7]!==w||t[8]!==O||t[9]!==C||t[10]!==T?(M=(0,S.jsx)(l,{...A,resetOnSuccess:j,className:`flex flex-col gap-6`,children:e=>{let{processing:t,errors:n}=e;return(0,S.jsxs)(S.Fragment,{children:[w?(0,S.jsxs)(`div`,{className:`rounded-lg border border-amber-500/40 bg-amber-500/10 px-4 py-3 text-sm text-muted-foreground`,children:[`La plataforma está en`,` `,(0,S.jsx)(`strong`,{className:`text-foreground`,children:`modo mantenimiento`}),`. Solo cuentas de administrador pueden iniciar sesión.`]}):null,(0,S.jsxs)(`div`,{className:`grid gap-6`,children:[(0,S.jsxs)(`div`,{className:`grid gap-2`,children:[(0,S.jsx)(h,{htmlFor:`email`,children:`Correo electrónico`}),(0,S.jsx)(c,{id:`email`,type:`email`,name:`email`,required:!0,autoFocus:!0,tabIndex:1,autoComplete:`email`,placeholder:`email@example.com`}),(0,S.jsx)(m,{message:n.email})]}),(0,S.jsxs)(`div`,{className:`grid gap-2`,children:[(0,S.jsxs)(`div`,{className:`flex items-center`,children:[(0,S.jsx)(h,{htmlFor:`password`,children:`Contraseña`}),r&&(0,S.jsx)(d,{href:g(),className:`ml-auto text-sm`,tabIndex:5,children:`¿Olvidaste tu contraseña?`})]}),(0,S.jsx)(i,{id:`password`,name:`password`,required:!0,tabIndex:2,autoComplete:`current-password`,placeholder:`Contraseña`}),(0,S.jsx)(m,{message:n.password})]}),(0,S.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,S.jsx)(p,{id:`remember`,name:`remember`,tabIndex:3}),(0,S.jsx)(h,{htmlFor:`remember`,children:`Recordarme`})]}),(0,S.jsx)(_,{siteKey:C,message:n[`cf-turnstile-response`],onTokenChange:E}),(0,S.jsxs)(o,{type:`submit`,className:`mt-4 w-full`,tabIndex:4,disabled:t||O&&!T,"data-test":`login-button`,children:[t&&(0,S.jsx)(u,{}),`Iniciar sesión`]})]}),a&&(0,S.jsxs)(`div`,{className:`text-center text-sm text-muted-foreground`,children:[`¿No tienes cuenta?`,` `,(0,S.jsx)(d,{href:f(),tabIndex:5,children:`Registrarte`})]})]})}}),t[5]=a,t[6]=r,t[7]=w,t[8]=O,t[9]=C,t[10]=T,t[11]=M):M=t[11];let N;t[12]===n?N=t[13]:(N=n&&(0,S.jsx)(`div`,{className:`mb-4 text-center text-sm font-medium text-green-600`,children:n}),t[12]=n,t[13]=N);let P;return t[14]!==M||t[15]!==N?(P=(0,S.jsxs)(S.Fragment,{children:[k,M,N]}),t[14]=M,t[15]=N,t[16]=P):P=t[16],P}C.layout={title:`Inicia sesión`,description:`Introduce tu correo electrónico y tu contraseña para continuar`};export{C as default};