import{e as a,j as s,r as e,f as l,g as i,a as n,p as t,q as o,ac as u,b as r,t as c,l as v,aw as d,z as p,o as m,I as f,J as x,n as g,F as k,G as b,ax as w,W as y,_ as C}from"./index-C1tQD-C0.js";import{g as _}from"./user-manage-zr2Gk81S.js";import{c as h}from"./socket-BAyDdojS.js";import{a as j}from"./init-BL4PE5xL.js";import{a as S}from"./login-BJxo4u3L.js";import{e as I}from"./index-BimIWPqC.js";const z=""+new URL("avatar-uscRzRXF.png",import.meta.url).href,R={class:"login-box"},F={key:0,class:"user-box"},J={class:"user-list"},N=["onClick"],U={class:"name"},D={key:1,class:"password-box"},O={class:"user-info user-info-active"},q={class:"name"},B={class:"password-list"},G={class:"pin-keypad"},L=["onClick"],M={class:"version"},P=C(a({__name:"index",setup(a){const C=s("/api/v1/app/ws/state"),P=h(C.wsUrl),T=a=>{a.loginFlag&&(sessionStorage.setItem("token",JSON.stringify(a.loginUser)),d.push("/index"))},W=e([]);l((()=>{P.subscribe("DeviceContext",T),P.connect(),(async()=>{const a=await _();W.value=a.data})()})),i((()=>{P.unsubscribe("DeviceContext",T)}));const X=e(),A=e(""),E=a=>{A.value.length>=4||(A.value.length<4&&(A.value+=a),4===A.value.length&&K())},H=e(!1),K=async()=>{var a;if(!(await j()).data)return I.error("设备正在初始化，请稍候重试"),void(A.value="");const s={id:null==(a=X.value)?void 0:a.id,password:A.value},e=await S(s);e.success?(sessionStorage.setItem("token",JSON.stringify(e.data)),await d.push("/index")):(H.value=!0,setTimeout((()=>{H.value=!1}),600),A.value="")},Q=e(!1),V=()=>{var a;(null==(a=X.value)?void 0:a.id)&&(Q.value=!0)},Y=()=>{Q.value=!1,A.value=""};return(a,s)=>{const e=w,l=p("Select"),i=y,d=p("Right"),C=p("Back");return m(),n("div",R,[t(u,{name:"flip-card",mode:"out-in"},{default:o((()=>{var a;return[Q.value?(m(),n("div",D,[r("div",O,[t(e,{size:40,src:v(z)},null,8,["src"]),r("span",q,c(X.value.account),1)]),s[3]||(s[3]=r("p",{class:"title"},"请输入4位PIN码",-1)),r("div",B,[(m(),n(f,null,x(4,(a=>r("div",{key:a,class:g(["password-item",{"password-item-fill":a<=A.value.length,"password-error":H.value}])},null,2))),64))]),r("div",G,[(m(),n(f,null,x(9,(a=>r("div",{key:a,class:"key",onClick:s=>E(a.toString())},c(a),9,L))),64)),s[2]||(s[2]=r("div",null,null,-1)),r("div",{class:"key",onClick:s[0]||(s[0]=a=>E("0"))},"0")]),r("div",{class:"next-box next-box-active",onClick:Y},[t(i,null,{default:o((()=>[t(C)])),_:1})])])):(m(),n("div",F,[s[1]||(s[1]=r("p",{class:"title"},"选择用户",-1)),r("div",J,[(m(!0),n(f,null,x(W.value,(a=>{var s,u;return m(),n("div",{class:g(["user-info",{"user-info-active":(null==(s=X.value)?void 0:s.id)===a.id}]),key:a.id,onClick:s=>X.value=a},[t(e,{size:60,src:v(z)},null,8,["src"]),r("span",U,c(a.account),1),k(t(i,{color:"#fff"},{default:o((()=>[t(l)])),_:2},1536),[[b,(null==(u=X.value)?void 0:u.id)===a.id]])],10,N)})),128))]),r("div",{class:g(["next-box",{"next-box-active":null==(a=X.value)?void 0:a.id}]),onClick:V},[t(i,null,{default:o((()=>[t(d)])),_:1})],2)]))]})),_:1}),r("div",M,"版本号：v "+c(v("0.0.23")),1)])}}}),[["__scopeId","data-v-1195dbbb"]]);export{P as default};
