System.register(["./xterm-legacy.js?v=1763625242172","./xterm-addon-canvas-legacy.js?v=1763625242172","./vue-legacy.js?v=1763625242172","./page_layout-legacy.js?v=1763625242172","./public-legacy.js?v=1763625242172"],(function(e,t){"use strict";var o,n,a,d,s,i,l,r,c,u,v,p,f,m,h,x,g,w,y,A,b,S,C;return{setters:[e=>{o=e.x,n=e.a,a=e.b,d=e.c},e=>{s=e.x},e=>{i=e._,l=e.k,r=e.P,c=e.af,u=e.a0,v=e.r,p=e.w,f=e.ap,m=e.o,h=e.b,x=e.R,g=e.S,w=e.n},e=>{y=e.a,A=e.dE,b=e.p},e=>{S=e.u,C=e.C}],execute:function(){var O=document.createElement("style");O.textContent="[data-v-12768f9a] .xterm{padding:12px!important}.box[data-v-12768f9a]{height:calc(100vh - 160px)}\n",document.head.appendChild(O);const _=e("o",(e=>{S({title:e.title,width:600,footer:!0,data:e.data,component:i((()=>y((()=>t.import("./form-legacy9.js?v=1763625242172")),void 0)))})})),j=l({__name:"terminal",props:{data:{},active:{type:Boolean}},emits:["updateState","connectSuccess"],setup(e,{expose:t,emit:i}){const{t:l}=r(),y=e,{data:b}=y,{active:S}=c(y),O=i,j=A(),{isFull:k}=u(j),{ws:E,status:T,send:R,open:z,close:D}=C("/webssh",{verifyData:{host:b.host,port:b.port,id:b.id,ps:b.ps,sort:0},onMessage:(e,t)=>{const o=t.data;return o.indexOf("Authentication timeout.")>-1&&(L.value=!0),-1==o.indexOf("@127.0.0.1:")&&-1==o.indexOf("@localhost:")||-1==o.indexOf("Authentication failed")?-1==o.indexOf("127.0.0.1:")&&-1==o.indexOf("localhost:")||-1==o.indexOf("Password or private key cannot both be empty")?"\\r\\nlogout\\r\\n"==o||"logout\\r\\n"==o||"\r\nlogout\r\n"==o||"logout\r\n"==o||o.search(/logout[\r\n]+$/)>-1?(O("updateState",b.id,!1),M.write("\r"+l("Component.Terminal.index_1")+"\r"),N(),void D()):void O("connectSuccess",o):(O("updateState",b.id,!1),D(),N(),void F()):(O("updateState",b.id,!1),D(),void N())}}),F=()=>{_({title:"Edit server",data:{isEdit:!0,tips:!0,localhost:!0,onRefresh:()=>{G()}}})};let M,B;const L=v(!1),P=v(null),$=()=>{const e=E.value;e&&(M.loadAddon(B),M.loadAddon(new s.CanvasAddon),M.loadAddon(new a.WebLinksAddon),M.loadAddon(new d.AttachAddon(e)),setTimeout((()=>{B.fit();const e=P.value;e&&(W.value=`${e.clientHeight}px`)}),100))},H=()=>{P.value&&M.open(P.value)};let I=!1;const N=()=>{I=!1},W=v(""),q=()=>{M.focus(),M.onData((e=>{const t=E.value;"\r"===e&&L.value&&(L.value=!1,M.write("\r\n"),G()),void 0!==t||"\r"!==e||I||(I=!0,M.write("\r\n"+l("Component.Terminal.index_2")+"\r\n"),G())}))},G=()=>{z(),q();const e=E.value;e&&(M.loadAddon(new d.AttachAddon(e)),O("updateState",b.id,!0))},J=()=>{w((()=>{if(B.fit(),"CLOSED"!==T.value){O("updateState",b.id,!0);const{cols:e,rows:t}=M;R({cols:e,rows:t,resize:1})}}))};p((()=>k.value),(e=>{const t=P.value;t&&!e&&(t.style.height=W.value)}));let K=!0;const Q=new ResizeObserver((()=>{S.value&&f((()=>{K?K=!1:J()}),200)()}));return t({send:R}),m((()=>{M=new o.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#333",foreground:"#ececec"}}),B=new n.FitAddon,$(),H(),q(),J(),(()=>{const e=P.value;e&&Q.observe(e)})()})),h((()=>{Q?.disconnect()})),(e,t)=>(x(),g("div",{ref_key:"terminalRef",ref:P,class:"w-full box"},null,512))}});e("T",b(j,[["__scopeId","data-v-12768f9a"]]))}}}));
