import{n as v}from"./rolldown-runtime-M0oDzQ_3.js";import{$t as h,Gt as S,Kn as s,Kt as U,Rn as n,Rt as Z,Ut as y,Zn as a,Zt as e,_n as q,an as D,en as p,kn as w,yn as g}from"./ui-vendor-CepnLjNg.js";import{c as I,f as N,l as E,m as G}from"./vue-vendor-BQwgTLLQ.js";import{c as T,f as W,l as X,n as $,t as j}from"./_plugin-vue_export-helper-BP_yjQAc.js";import{X as z,a as F,l as J,u as O}from"./index-BxPouqCs.js";var b,L,V,k,x,M,R,H,K,A,P,C=v((()=>{Z(),z(),N(),I(),X(),J(),b={class:"login-view"},L={class:"login-card"},V={class:"login-title"},k={class:"login-desc"},x={class:"login-default-hint"},M=["placeholder"],R=["placeholder"],H={key:0,class:"login-error"},K={key:1,class:"login-lock-hint"},A=["disabled"],P=D({__name:"LoginView",setup(te){const{t}=E(),m=G(),o=n(""),r=n(""),u=n(!1),l=n(""),d=n(!1);T()&&m.replace("/hermes/chat"),q(async()=>{try{await F()}catch{}});async function f(){await B()}async function B(){if(!o.value.trim()||!r.value){l.value=t("login.credentialsRequired");return}u.value=!0,l.value="",d.value=!1;try{W(await O(o.value.trim(),r.value)),m.replace("/hermes/chat")}catch(_){_.status===429||_.status===503?(l.value=t("login.tooManyAttempts"),d.value=!0):l.value=_.message||t("login.invalidCredentials")}finally{u.value=!1}}return(_,i)=>(g(),p("div",b,[e("div",L,[i[4]||(i[4]=e("div",{class:"login-logo"},[e("img",{src:"/logo.png",alt:"Hermes",width:"80",height:"80"})],-1)),e("h1",V,a(s(t)("login.title")),1),e("p",k,a(s(t)("login.description")),1),e("p",x,a(s(t)("login.defaultCredentialsHint")),1),e("form",{class:"login-form",onSubmit:U(f,["prevent"])},[w(e("input",{"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),type:"text",class:"login-input",placeholder:s(t)("login.usernamePlaceholder"),autofocus:""},null,8,M),[[y,o.value]]),w(e("input",{"onUpdate:modelValue":i[1]||(i[1]=c=>r.value=c),type:"password",class:"login-input",placeholder:s(t)("login.passwordPlaceholder"),onKeyup:S(f,["enter"])},null,40,R),[[y,r.value]]),l.value?(g(),p("div",H,a(l.value),1)):h("",!0),d.value?(g(),p("div",K,[e("span",null,a(s(t)("login.lockResetHint")),1),i[2]||(i[2]=e("code",null,"hermes-web-ui clear-login-locks --restart",-1)),e("span",null,a(s(t)("login.defaultLoginResetHint")),1),i[3]||(i[3]=e("code",null,"hermes-web-ui reset-default-login",-1))])):h("",!0),e("button",{type:"submit",class:"login-btn",disabled:u.value},a(u.value?"...":s(t)("login.submit")),9,A)],32)])]))}})})),Q=v((()=>{})),Y,ee=v((()=>{C(),C(),Q(),$(),Y=j(P,[["__scopeId","data-v-fc7ec87c"]])}));ee();export{Y as default};
