System.register(["./xterm-legacy.js?v=1764233927359","./xterm-addon-canvas-legacy.js?v=1764233927359","./vue-legacy.js?v=1764233927359","./page_layout-legacy.js?v=1764233927359","./public-legacy.js?v=1764233927359"],function(e,t){"use strict";var a,o,s,n,i,c,r,d,l,u,p,m,v,g,h,x,f,_,y,w,A,b,S,O,C,T,M,j;return{setters:[e=>{a=e.x,o=e.a,s=e.b,n=e.c},e=>{i=e.x},e=>{c=e.r,r=e._,d=e.k,l=e.P,u=e.af,p=e.a0,m=e.w,v=e.ap,g=e.o,h=e.b,x=e.R,f=e.V,_=e.n},e=>{y=e.bf,w=e.i,A=e.a,b=e.x,S=e.e,O=e.dF,C=e.p},e=>{T=e.u,M=e.d,j=e.C}],execute:function(){var k=document.createElement("style");k.textContent="[data-v-03ea5778] .xterm{padding:12px!important}.box[data-v-03ea5778]{height:calc(100vh - 160px)}\n/*$vite$:1*/",document.head.appendChild(k);const{t:I}=w.global,{t:q}=(e("f",e=>y.post("/xterm?action=create_host",e,{requestOptions:{loading:I("Security.Api.Index_4"),successMessage:!0}})),e("h",e=>y.post("/xterm?action=get_host_find",e)),e("d",e=>y.post("/xterm?action=remove_host",e,{requestOptions:{loading:I("Security.Api.Index_3"),successMessage:!0}})),e("c",()=>y.post("/xterm?action=get_command_list")),e("a",e=>y.post("/xterm?action=create_command",e,{requestOptions:{loading:I("Security.Api.Index_4"),successMessage:!0}})),e("e",e=>y.post("/xterm?action=modify_command",e,{requestOptions:{loading:I("Crontab.Api.index_5"),successMessage:!0}})),e("b",e=>y.post("/xterm?action=remove_command",e,{requestOptions:{loading:I("Security.Api.Index_3"),successMessage:!0}})),w.global),D=e("o",e=>{T({title:e.title,width:600,footer:!0,data:e.data,component:r(()=>A(()=>t.import("./form-legacy9.js?v=1764233927359"),void 0))})}),{loading:F}=M();e("l",F);const R=e("s",c([])),$=e("g",async()=>{const{message:e}=await y.post("/xterm?action=get_host_list");b(e)&&(R.value=e)}),z=c("aaaaaaaaa"),E=c([{id:"aaaaaaaaa",host:"127.0.0.1",port:22,ps:q("Database.form.index_12"),state:!0}]),L=e=>{z.value=e},P=e=>{const t=S(9,"letter");E.value.push({id:t,host:e.host,port:e.port,ps:e.ps,state:!0}),setTimeout(()=>{L(t)},20)},B=(e,t)=>{E.value=E.value.map(a=>a.id===e?{...a,state:t}:a)},H=(e("u",()=>({activeTerminalId:z,terminals:E,setActiveTerminal:L,onServerList:P,onUpdateState:B})),d({__name:"terminal",props:{data:{},active:{type:Boolean}},emits:["updateState","connectSuccess"],setup(e,{expose:t,emit:r}){const{t:d}=l(),y=e,{data:w}=y,{active:A}=u(y),b=r,S=O(),{isFull:C}=p(S),{ws:T,status:M,send:k,open:I,close:q}=j("/webssh",{get verifyData(){return{host:w.host,port:w.port,id:w.id,ps:w.ps,sort:0}},onMessage:(e,t)=>{const a=t.data;if(a.indexOf("Authentication timeout.")>-1)L.value=!0;else{if(!(-1===a.indexOf("127.0.0.1:")&&-1===a.indexOf("localhost:")||-1===a.indexOf("Password or private key cannot both be empty")&&-1===a.indexOf("Account or Password incorrect: Authentication failed")))return b("updateState",w.id,!1),q(),U(),void F();if("\\r\\nlogout\\r\\n"==a||"logout\\r\\n"==a||"\r\nlogout\r\n"==a||"logout\r\n"==a||a.search(/logout[\r\n]+$/)>-1)return b("updateState",w.id,!1),z.write("\r"+d("Component.Terminal.index_1")+"\r"),U(),void q()}b("connectSuccess",a)}}),F=()=>{D({title:d("Term.index_22"),data:{isEdit:!0,tips:!0,localhost:!0,onRefresh:()=>{w.host.includes("127.0.0.1")&&!w.host.includes("_22")&&(w.host=w.host.replace("127.0.0.1","127.0.0.1_22")),G()}}})};let z,E;const L=c(!1),P=c(null),B=()=>{const e=T.value;e&&(z.loadAddon(E),z.loadAddon(new i.CanvasAddon),z.loadAddon(new s.WebLinksAddon),z.loadAddon(new n.AttachAddon(e)),setTimeout(()=>{E.fit();const e=P.value;e&&(V.value=`${e.clientHeight}px`)},100))},H=()=>{P.value&&z.open(P.value)};let N=!1;const U=()=>{N=!1},V=c(""),W=()=>{z.focus(),z.onData(e=>{const t=T.value;"\r"===e&&L.value&&(L.value=!1,z.write("\r\n"),G()),void 0!==t||"\r"!==e||N||(N=!0,z.write("\r\n"+d("Component.Terminal.index_2")+"\r\n"),G())})},G=()=>{I(),W();const e=T.value;e&&(z.loadAddon(new n.AttachAddon(e)),b("updateState",w.id,!0))},J=()=>{_(()=>{if(E.fit(),"CLOSED"!==M.value){b("updateState",w.id,!0);const{cols:e,rows:t}=z;k({cols:e,rows:t,resize:1})}})};m(()=>C.value,e=>{const t=P.value;t&&!e&&(t.style.height=V.value)});let K=!0;const Q=new ResizeObserver(()=>{A.value&&v(()=>{K?K=!1:J()},200)()});return t({send:k}),g(async()=>{await(async()=>{await $(),R.value.some(e=>"127.0.0.1_22"===e.host)&&"127.0.0.1"===w.host&&(w.host="127.0.0.1_22")})(),z=new a.Terminal({cursorBlink:!0,fontSize:14,fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#333",foreground:"#ececec"}}),E=new o.FitAddon,B(),H(),W(),J(),(()=>{const e=P.value;e&&Q.observe(e)})()}),h(()=>{Q?.disconnect()}),(e,t)=>(f(),x("div",{ref_key:"terminalRef",ref:P,class:"w-full box"},null,512))}}));e("T",C(H,[["__scopeId","data-v-03ea5778"]]))}}});
