import{c,I as P,k as I,r as m,o as T,a as U,b as f,d as a,w as s,j as g,g as i,f as y,u as v,h as d,e as M,t as z,R as G,q as J}from"./index.js";import{D as C}from"./DesktopOutlined.js";var Q={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M326 664H104c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h174v176c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V696c0-17.7-14.3-32-32-32zm16-576h-48c-8.8 0-16 7.2-16 16v176H104c-8.8 0-16 7.2-16 16v48c0 8.8 7.2 16 16 16h222c17.7 0 32-14.3 32-32V104c0-8.8-7.2-16-16-16zm578 576H698c-17.7 0-32 14.3-32 32v224c0 8.8 7.2 16 16 16h48c8.8 0 16-7.2 16-16V744h174c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16zm0-384H746V104c0-8.8-7.2-16-16-16h-48c-8.8 0-16 7.2-16 16v224c0 17.7 14.3 32 32 32h222c8.8 0 16-7.2 16-16v-48c0-8.8-7.2-16-16-16z"}}]},name:"compress",theme:"outlined"};function $(n){for(var e=1;eimport("./rfb.js"),[])).default);const r=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/admin/vnc?token=${e.token}`;u=new V(x.value,r,{wsProtocols:["binary"]}),u.scaleViewport=!0,u.clipViewport=!1,u.resizeSession=!1,u.addEventListener("connect",()=>{o.value="connected"}),u.addEventListener("disconnect",_=>{o.value="disconnected",_.detail.clean===!1&&(b.value="连接意外断开"),u=null}),u.addEventListener("credentialsrequired",()=>{u.sendCredentials({password:""})})}catch(p){o.value="error",b.value=p.message||"连接失败"}}}function N(){u&&(u.disconnect(),u=null),o.value="disconnected"}function F(){x.value&&(document.fullscreenElement?(document.exitFullscreen(),h.value=!1):(x.value.requestFullscreen(),h.value=!0))}function D(){h.value=!!document.fullscreenElement}return T(async()=>{await j(),document.addEventListener("fullscreenchange",D)}),U(()=>{N(),document.removeEventListener("fullscreenchange",D)}),(p,r)=>{const _=y("a-spin"),O=y("a-tag"),w=y("a-button"),A=y("a-space"),R=y("a-card"),q=y("a-layout");return a(),f(q,{style:{background:"transparent"}},{default:s(()=>[c(R,{title:"虚拟显示器",bordered:!1,style:{height:"100%"}},{default:s(()=>[t.value?(a(),g("div",ee,[c(_,{size:"large"}),r[0]||(r[0]=i("div",{style:{"margin-top":"16px",color:"#8c8c8c"}},"正在检查 VNC 状态...",-1))])):l.value?.xvfbMode?l.value?.enabled?(a(),g("div",oe,[i("div",re,[i("div",null,[o.value==="connected"?(a(),f(O,{key:0,color:"success"},{default:s(()=>[...r[5]||(r[5]=[d("已连接",-1)])]),_:1})):o.value==="connecting"?(a(),f(O,{key:1,color:"processing"},{default:s(()=>[...r[6]||(r[6]=[d("连接中...",-1)])]),_:1})):o.value==="error"?(a(),f(O,{key:2,color:"error"},{default:s(()=>[...r[7]||(r[7]=[d("连接错误",-1)])]),_:1})):(a(),f(O,{key:3,color:"default"},{default:s(()=>[...r[8]||(r[8]=[d("未连接",-1)])]),_:1})),b.value?(a(),g("span",le,z(b.value),1)):M("",!0)]),c(A,null,{default:s(()=>[o.value!=="connected"?(a(),f(w,{key:0,type:"primary",onClick:B,loading:o.value==="connecting"},{icon:s(()=>[c(v(C))]),default:s(()=>[r[9]||(r[9]=d(" 连接 ",-1))]),_:1},8,["loading"])):(a(),f(w,{key:1,danger:"",onClick:N},{icon:s(()=>[c(v(k))]),default:s(()=>[r[10]||(r[10]=d(" 断开 ",-1))]),_:1})),c(w,{onClick:F,disabled:o.value!=="connected"},{icon:s(()=>[h.value?(a(),f(v(E),{key:0})):(a(),f(v(S),{key:1}))]),_:1},8,["disabled"]),c(w,{onClick:j},{icon:s(()=>[c(v(G))]),_:1})]),_:1})]),i("div",{ref_key:"vncContainer",ref:x,style:{width:"100%","aspect-ratio":"16/9","min-height":"400px","max-height":"70vh",background:"#000","border-radius":"8px",overflow:"hidden"}},[o.value==="disconnected"?(a(),g("div",ae,[i("div",ce,[c(v(C),{style:{"font-size":"48px",color:"#434343"}}),r[11]||(r[11]=i("div",{style:{"margin-top":"16px"}},'点击"连接"按钮查看远程显示器',-1))])])):M("",!0)],512),i("div",se," 显示器: "+z(l.value.display)+" | VNC 端口: "+z(l.value.port),1)])):(a(),g("div",ne,[c(v(C),{style:{"font-size":"64px",color:"#bfbfbf"}}),r[3]||(r[3]=i("div",{style:{"margin-top":"16px","font-size":"16px",color:"#595959"}},"VNC 服务未启动",-1)),r[4]||(r[4]=i("div",{style:{"margin-top":"8px",color:"#8c8c8c"}},[d(" 请确保启动时包含 "),i("code",null,"-vnc"),d(" 参数,并已安装 x11vnc ")],-1))])):(a(),g("div",te,[c(v(k),{style:{"font-size":"64px",color:"#bfbfbf"}}),r[1]||(r[1]=i("div",{style:{"margin-top":"16px","font-size":"16px",color:"#595959"}},"程序未使用虚拟显示器运行",-1)),r[2]||(r[2]=i("div",{style:{"margin-top":"8px",color:"#8c8c8c"}},[d(" VNC 远程显示功能仅在 Linux 环境下使用 "),i("code",null,"-xvfb -vnc"),d(" 参数启动时可用 ")],-1))]))]),_:1})]),_:1})}}};export{de as default};