import{f as x,I as h,p as L,q as V,s as q,_ as U}from"./index.e4ceb7bd.js";/* empty css              *//* empty css               *//* empty css               *//* empty css               */import{j as d,d as C,C as k,D as N,aI as e,aH as o,E as n,u as r,aJ as B,aR as P,bq as R,br as E,bs as S,aU as T,bt as F,aY as G}from"./arco.2329baeb.js";import{u as H}from"./vue.46369188.js";import"./chart.db8aed57.js";function M(m=!1){const a=d(m);return{loading:a,setLoading:u=>{a.value=u},toggle:()=>{a.value=!a.value}}}const O={class:"login-wrapper"},W={class:"social-login"},j={name:"Login"},D=C({...j,setup(m){const a=H(),p=d(""),_=x(),{loading:u,setLoading:g}=M(),t=d({username:"",password:""}),v=async()=>{g(!0);try{await _.login(t.value);const{redirect:l,...s}=a.currentRoute.value.query;a.push({name:l||"home",query:{...s}}),P.success("Login successful!")}catch(l){p.value=l.message}finally{g(!1)}};return(l,s)=>{const w=R,f=E,y=S,i=T,I=F,b=G;return k(),N("div",O,[e(b,{class:"login-container"},{default:o(()=>[s[4]||(s[4]=n("div",{class:"login-header"},[n("h1",null,"Welcome to aimaestro"),n("p",null,"Login to continue accessing the management backend")],-1)),e(I,{model:t.value,"auto-label-width":""},{default:o(()=>[e(f,{field:"username",rules:[{required:!0,message:"Username is required"}]},{default:o(()=>[e(w,{modelValue:t.value.username,"onUpdate:modelValue":s[0]||(s[0]=c=>t.value.username=c),placeholder:"Username",class:"custom-input"},{prefix:o(()=>[e(r(h))]),_:1},8,["modelValue"])]),_:1}),e(f,{field:"password",rules:[{required:!0,message:"Password is required"}]},{default:o(()=>[e(y,{modelValue:t.value.password,"onUpdate:modelValue":s[1]||(s[1]=c=>t.value.password=c),placeholder:"Password",class:"custom-input"},{prefix:o(()=>[e(r(L))]),_:1},8,["modelValue"])]),_:1}),e(i,{type:"primary","html-type":"submit",class:"login-btn",loading:r(u),onClick:v},{default:o(()=>s[2]||(s[2]=[B(" Continue ")])),_:1},8,["loading"]),s[3]||(s[3]=n("div",{class:"divider"},[n("span",null,"OR CONTINUE WITH")],-1)),n("div",W,[e(i,{shape:"circle",class:"social-icon"},{icon:o(()=>[e(r(V))]),_:1}),e(i,{shape:"circle",class:"social-icon"},{icon:o(()=>[e(r(q))]),_:1})])]),_:1},8,["model"])]),_:1})])}}});const $=U(D,[["__scopeId","data-v-1667e839"]]);export{$ as default};
