import{u as x,r as a,o as b,b as n,c as r,d as s,p as _,q as v,v as I,n as m,F as f,k as w,s as M,f as C,l as V,t as g,L,x as T}from"./main.37e79106.js";const U={class:"form full-form auth-cover"},B={class:"form-container"},D={class:"form-form"},E={class:"form-form-wrap"},S={class:"form-container"},j={class:"form-content"},F={class:"form"},A={id:"username-field",class:"field-wrapper input"},N={class:"invalid-feedback"},P={id:"password-field",class:"field-wrapper input mb-2"},R=["type"],q={class:"invalid-feedback"},G={__name:"login",setup(z){x({title:"Iniciar sesi\xF3n"});const d=a("password"),i=a({email:null,password:null}),k=a(null),u=a(!1),t=a({}),c=a(!0),h=()=>{d.value=d.value==="password"?"text":"password"},y=async()=>{u.value=!0;try{const l=await T(i.value);if(!l.success)return t.value=l.error;t.value={email:null,password:null},localStorage.setItem("token",l.token),window.location.href=window.location.origin+window.location.pathname+"?nocache="+Date.now()}catch(l){console.log(l)}};return b(async()=>{c.value=!1,console.log({}.VITE_API_URL,"({}).VITE_API_URL")}),(l,e)=>(n(),r("div",U,[s("div",B,[s("div",D,[s("div",E,[s("div",S,[s("div",j,[e[10]||(e[10]=s("h1",{class:""}," Iniciar sesi\xF3n ",-1)),s("form",{novalidate:"",class:"text-start",ref_key:"formComponent",ref:k,onSubmit:_(y,["stop","prevent"])},[s("div",F,[s("div",A,[e[3]||(e[3]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-user"},[s("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s("circle",{cx:"12",cy:"7",r:"4"})],-1)),v(s("input",{"onUpdate:modelValue":e[0]||(e[0]=o=>i.value.email=o),type:"text",class:m([u.value?t.value.email?"is-invalid":"is-valid":""]),placeholder:"Usuario"},null,2),[[I,i.value.email]]),e[4]||(e[4]=s("div",{class:"valid-feedback"},null,-1)),s("div",N,[(n(!0),r(f,null,w(t.value.email,(o,p)=>(n(),r("li",{key:p},g(o),1))),128))])]),s("div",P,[e[5]||(e[5]=s("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"feather feather-lock"},[s("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})],-1)),v(s("input",{"onUpdate:modelValue":e[1]||(e[1]=o=>i.value.password=o),type:d.value,class:m([u.value?t.value.password?"is-invalid":"is-valid":""]),placeholder:"Contrase\xF1a"},null,10,R),[[M,i.value.password]]),e[6]||(e[6]=s("div",{class:"valid-feedback"},null,-1)),s("div",q,[(n(!0),r(f,null,w(t.value.password,(o,p)=>(n(),r("li",{key:p},g(o),1))),128))])]),s("div",{class:"d-sm-flex justify-content-between"},[s("div",{class:"field-wrapper toggle-pass d-flex align-items-center"},[e[8]||(e[8]=s("p",{class:"d-inline-block"},"Mostrar contrase\xF1a",-1)),s("label",{class:"switch s-primary mx-2"},[s("input",{onClick:h,type:"checkbox",class:"custom-control-input",checked:""}),e[7]||(e[7]=s("span",{class:"slider round"},null,-1))])]),e[9]||(e[9]=s("div",{class:"field-wrapper"},[s("button",{type:"submit",class:"btn btn-primary"},"Iniciar sesi\xF3n")],-1))])])],544),e[11]||(e[11]=s("p",{class:"terms-conditions"}," \xA9 2020 Todos los derechos reservados. Es un producto de Techmedia Solutiones tecnologicas. ",-1))])])])]),e[12]||(e[12]=s("div",{class:"form-image"},[s("div",{class:"l-image"})],-1))]),C(V(L),{active:c.value,"onUpdate:active":e[2]||(e[2]=o=>c.value=o),"can-cancel":!1,"is-full-page":!0},null,8,["active"])]))}};export{G as default};
