var m=(f,g,e)=>new Promise((p,l)=>{var a=t=>{try{i(e.next(t))}catch(o){l(o)}},r=t=>{try{i(e.throw(t))}catch(o){l(o)}},i=t=>t.done?p(t.value):Promise.resolve(t.value).then(a,r);i((e=e.apply(f,g)).next())});import{f as S,g as h,e as C,h as u,i as s,j as n,F as y,s as v,v as _,P as k,k as b,z as V,r as w,m as x,p as d,q as L}from"./main-CqQrmdFR.js";import{u as B,l as M}from"./ai-science-spark-B4ZslRQQ.js";const H={class:"login-layout"},I={class:"login-card"},K=["innerHTML"],T={key:0,class:"login-muted"},D={class:"login-field"},F={class:"login-field"},N=["disabled"],U={key:0,class:"login-message login-message--error"},j={key:1,class:"login-message login-message--ok"},q=S({__name:"LoginView",setup(f){const g=x(),e=h(),p=B(),l=w(""),a=w("");function r(){g.replace("/")}function i(){return m(this,null,function*(){if(!l.value||!a.value||e.busy)return;const t=yield e.login(l.value,a.value);e.loggedIn&&(t&&(yield p.fetchBackendConfig()),r())})}return C(()=>m(null,null,function*(){yield e.refreshStatus(),(e.enabled===!1||e.loggedIn)&&r()})),(t,o)=>(d(),u("div",H,[s("div",I,[s("div",{class:"login-logo",innerHTML:n(M)},null,8,K),o[5]||(o[5]=s("h1",{class:"login-title"},"论文助手",-1)),o[6]||(o[6]=s("p",{class:"login-sub"},"登录云端账号，同步模型与密钥配置",-1)),n(e).enabled===null?(d(),u("p",T,"加载中...")):n(e).enabled===!1?(d(),u(y,{key:1},[o[2]||(o[2]=s("p",{class:"login-muted"},"账号服务未启用，无需登录即可使用本机功能",-1)),s("button",{class:"login-btn login-btn--primary",type:"button",onClick:r},"进入应用")],64)):(d(),u(y,{key:2},[s("div",D,[o[3]||(o[3]=s("label",null,"用户名",-1)),v(s("input",{"onUpdate:modelValue":o[0]||(o[0]=c=>l.value=c),type:"text",placeholder:"请输入账号",autocomplete:"username",onKeyup:k(i,["enter"])},null,544),[[_,l.value]])]),s("div",F,[o[4]||(o[4]=s("label",null,"密码",-1)),v(s("input",{"onUpdate:modelValue":o[1]||(o[1]=c=>a.value=c),type:"password",placeholder:"请输入密码",autocomplete:"current-password",onKeyup:k(i,["enter"])},null,544),[[_,a.value]])]),s("button",{class:"login-btn login-btn--primary",type:"button",disabled:n(e).busy||!l.value||!a.value,onClick:i},b(n(e).busy?"登录中…":"登录"),9,N),s("button",{class:"login-btn",type:"button",onClick:r},"暂不登录，先使用"),n(e).error?(d(),u("p",U,b(n(e).error),1)):n(e).notice?(d(),u("p",j,b(n(e).notice),1)):V("",!0)],64))])]))}}),P=L(q,[["__scopeId","data-v-b3833583"]]);export{P as default};
