import{g as v,G as b,r as h,d as C,x as q,a as x,I as k,J as S,K as s,T as K,S as T,m as e,L as m,M as p,u as l,N as f,P as _,U as y}from"./vue-BSryv7ps.js";import{_ as A,__tla as __tla_0}from"./PasswordField.vue_vue_type_script_setup_true_lang-CqQQlY6F.js";import{n as U,o as B,c as F,p as I,d as M,e as N,f as L,k as O,g as R,i as D,V as E,__tla as __tla_1}from"./index-bUuJUL5l.js";import"./vuetify-i5Qjiq6M.js";let z;let __tla=Promise.all([(()=>{try{return __tla_0}catch{}})(),(()=>{try{return __tla_1}catch{}})()]).then(async()=>{z=v({__name:"Login",setup(G){const{t:a}=b(),w=K(),o=T(),u=U(),r=h({username:"",password:""}),c=C(!1),V={username:[d=>!!d||a("login.rules.username_required")],password:[d=>!!d||a("login.rules.password_required")]},i=async()=>{c.value&&(await u.login(r.username,r.password),u.isAuthenticated?(y.success(a("login.success")),g()):y.error(a("login.error")))},g=()=>{o.query.redirect?w.push(o.query.redirect):w.push({name:"dashboard"})};return q(async()=>{o.query.username&&o.query.password&&await u.login(o.query.username,o.query.password)}),x(()=>{u.isAuthenticated&&g()}),(d,n)=>(k(),S(B,{class:"fill-height"},{default:s(()=>[e(E,{class:"mx-auto",rounded:"lg","min-width":"250"},{default:s(()=>[e(F,null,{default:s(()=>[m(p(l(a)("login.title")),1)]),_:1}),e(I,null,{default:s(()=>[m(p(l(a)("login.subtitle")),1)]),_:1}),e(M,null,{default:s(()=>[e(N,{modelValue:c.value,"onUpdate:modelValue":n[2]||(n[2]=t=>c.value=t),onSubmit:f(i,["prevent"])},{default:s(()=>[e(L,{modelValue:r.username,"onUpdate:modelValue":n[0]||(n[0]=t=>r.username=t),id:"username",name:"username",label:l(a)("login.username"),autofocus:"",rules:V.username,onKeydown:_(f(i,["prevent"]),["enter"]),variant:"outlined"},{prepend:s(()=>[e(O,{color:"accent",icon:"mdi-account"})]),_:1},8,["modelValue","label","rules","onKeydown"]),e(A,{modelValue:r.password,"onUpdate:modelValue":n[1]||(n[1]=t=>r.password=t),id:"password",label:l(a)("login.password"),rules:V.password,"prepend-icon":"mdi-lock",onKeydown:_(f(i,["prevent"]),["enter"]),variant:"outlined"},null,8,["modelValue","label","rules","onKeydown"])]),_:1},8,["modelValue"])]),_:1}),e(R,null,{default:s(()=>[e(D,{variant:"elevated",block:"",color:"accent",onClick:i},{default:s(()=>[m(p(l(a)("login.submit")),1)]),_:1})]),_:1})]),_:1})]),_:1}))}})});export{z as default,__tla};