import U from"./Ca5uvwMn.js";import{_ as k}from"./D57Mp6KB.js";import{_ as C}from"./DuWt9Bdf.js";import{f as I,u as R,g as _,s as O,r as j,h,o as i,c as m,a as e,b as r,w as f,i as T,j as v,v as V,k as t,l as E,m as b,n as d,d as w,p as B,e as F}from"./YTYhyFR4.js";import{u as L}from"./DmFLhtjE.js";import{L as M,F as $}from"./xZuKn1jn.js";import{_ as z}from"./DlAUqK2U.js";import"./y_BXiV4o.js";const x=l=>(B("data-v-440dfa59"),l=l(),F(),l),D={class:"login-page"},H={class:"flex items-center justify-center h-screen"},P={class:"mb-4"},q=x(()=>e("label",{class:"block text-sm font-bold mb-2",for:"email"},"Usuario",-1)),G={class:"mb-6"},J=x(()=>e("label",{class:"block text-sm font-bold mb-2",for:"password"},"Contraseña",-1)),K={class:"relative"},Q=["type"],W={class:"mb-4"},X=["disabled"],Y={class:"flex flex-row items-center justify-center"},Z={key:2,class:"font-bold text-white"},ee={key:0,class:"flex justify-center mt-2"},te={class:"flex justify-center items-center mt-4"},se={class:"flex justify-center items-center mt-4"},oe=I({__name:"login",setup(l){const y=R();L({title:"Iniciar Sesión"});const{loginUser:g}=_(),{authenticated:S}=O(_()),o=j({USUARIO:"",CONTRASENA:""}),c=h(!1),a=h(!1),A=async()=>{!o.USUARIO||!o.CONTRASENA||(a.value=!0,await g(o),S.value?y.push("/dashboard/admin"):($.error("Usuario o contraseña incorrectos"),a.value=!1))};return(ae,s)=>{const u=U,p=k,N=C;return i(),m("div",D,[e("div",H,[r(N,{title:"Iniciar Sesión",icon:"radix-icons:person",class:"w-96 z-index-30"},{default:f(()=>[e("form",{class:"p-6",onSubmit:s[3]||(s[3]=T(n=>A(),["prevent"]))},[e("div",P,[q,v(e("input",{class:"shadow appearance-none border rounded w-full py-2 px-3 leading-tight focus:outline-none focus:shadow-outline",type:"text",id:"email","onUpdate:modelValue":s[0]||(s[0]=n=>t(o).USUARIO=n),autocomplete:"off"},null,512),[[V,t(o).USUARIO,void 0,{trim:!0}]])]),e("div",G,[J,e("div",K,[v(e("input",{type:t(c)?"text":"password",class:"shadow appearance-none border rounded w-full py-2 px-3 mb-3 leading-tight focus:outline-none focus:shadow-outline pr-10",id:"password","onUpdate:modelValue":s[1]||(s[1]=n=>t(o).CONTRASENA=n),autocomplete:"off"},null,8,Q),[[E,t(o).CONTRASENA,void 0,{trim:!0}]]),r(u,{name:t(c)?"mdi:eye-off":"mdi:eye",class:"absolute inset-y-0 right-0 flex items-center justify-center mr-3 h-full",onClick:s[2]||(s[2]=n=>c.value=!t(c))},null,8,["name"])])]),e("div",W,[e("button",{type:"submit",class:"w-full py-4 bg-primary rounded-lg relative",disabled:t(a)},[e("div",Y,[t(a)?d("",!0):(i(),b(u,{key:0,name:"mdi:login-variant",color:"white",class:"mr-2 h-5 w-5"})),t(a)?(i(),b(u,{key:1,name:"svg-spinners:ring-resize",color:"white",class:"h-5 w-5 mr-2"})):d("",!0),t(a)?d("",!0):(i(),m("div",Z,"Ingresar"))])],8,X),t(a)?(i(),m("div",ee)):d("",!0)]),e("div",te,[r(p,{href:"#",class:"hover:underline"},{default:f(()=>[w(" ¿Olvidaste tu contraseña? ")]),_:1})]),e("div",se,[r(p,{href:"/auth/register",class:"hover:underline"},{default:f(()=>[w(" Crear Cuenta ")]),_:1})])],32)]),_:1})]),r(t(M),{theme:"light",position:"bottom-center"})])}}}),fe=z(oe,[["__scopeId","data-v-440dfa59"]]);export{fe as default};
