import{o as t,P as s,n as a,Q as e,bK as o,p as r}from"./utils-lib.js?v=1761009159";import{s as c,j as l,r as i,Q as u}from"./base-lib.js?v=1761009159";const p=()=>t.post("ssh_security/get_login_record",{check:"object"}),n=s=>{const a=s?"stop_login_record":"start_login_record";return t.post("ssh_security/".concat(a),{check:"msg"})},d=s=>t.post("ssh_security/get_record_list",{data:s,check:"object"}),h=()=>t.post("xterm/get_command_list",{check:"array"}),m=s=>t.post("xterm/create_command",{data:s,check:"msg"}),_=s=>t.post("xterm/modify_command",{data:s,check:"msg"}),v=s=>t.post("xterm/remove_command",{data:{title:s},check:"msg"}),g=()=>t.post("xterm/out_command",{check:"msg"}),y=s=>t.post("xterm/set_completion_tool_status",{data:{status:s},check:"msg"}),w=()=>t.post("xterm/completion_tool_status",{check:"msg"}),k=s=>t.post("ssh_security/get_record_video",{data:{record_id:s},check:"object"}),f=s=>t.post("ssh_security/remove_video_record",{data:{record_ids:JSON.stringify(s)},check:"msg"}),x=l("TERM-HOST-LIST",()=>{const a=i({}),e=i(!1),o=i(!1),r=i("password"),c=i(!1);return{isEdit:e,rowData:a,$reset:()=>{e.value=!1,o.value=!1,r.value="password"},isTableLoad:o,cutAuthType:r,getHostData:async()=>{const a=await s({loading:o,request:t.post("xterm/get_host_list",{check:"array"}),data:Array});return{data:a,total:a.length,other:{}}},isRefreshList:c}}),b=()=>{const t=x();return{...t,...c(t)}},{cutAuthType:T,isEdit:j,rowData:O,isRefreshList:L}=b(),D=(t,s,o)=>{null==o||o.stopPropagation(),O.value=t,a({title:j.value?"编辑主机信息":"添加主机信息",area:48,component:()=>e(()=>import("./add-host.js?v=1761009159"),__vite__mapDeps([]),import.meta.url),compData:{rows:t||{},refresh:s},showFooter:!0})},E=t=>{if(j.value)return;if(!u(t)||!t.value)return;let s,a,e,o=t.value.host;if(-1!=o.indexOf("@")){let t=o.split("@");if(o=t[1],a=t[0],-1!=a.indexOf(":")){let t=a.split(":");a=t[0],e=t[1]}}if(-1!=o.indexOf(":")){let t=o.split(":");o=t[0],s=t[1]}o&&(t.value.host=o,t.value.ps=o),s&&(t.value.port=Number(s)),a&&(t.value.username=a),e&&(t.value.password=e)},S=(t,s)=>{s();for(const a in t.value)"password"===a&&(t.value[a]="");"password"===T.value?(t.value.pkey="",t.value.pkey_passwd=""):t.value.password=""},A=async s=>{const{data:a}=await(e=s.host,o=s.port,t.post("xterm/get_host_find",{data:{host:e,port:o},check:"object"}));var e,o;for(const t in a)"host"!==t&&(s[t]=a[t]);return(t=>{let s=t.shell;try{s=JSON.parse(null==t?void 0:t.shell)}catch(a){s=t.shell}t.shell=s})(s),a},P=async a=>{try{const{status:r}=await s({loading:"正在"+(j.value?"修改":"创建")+"主机信息，请稍后...",request:(e=o(a.value),t.post("xterm/create_host",{data:e,check:"msg"})),data:{status:Boolean,msg:String},message:!0});return L.value=!0,r}catch(r){return!1}var e},R=async(a,e,o)=>{o.stopPropagation();try{await r({title:"删除服务器信息【"+a.host+"】",content:"删除选中的信息后，该服务器信息将不在列表中显示，是否继续操作？",icon:"warning-filled"});const{status:o}=await s({loading:"正在删除服务器信息，请稍后...",request:(c=a.host,l=a.port,t.post("xterm/remove_host",{data:{host:c,port:l},check:"msg"})),data:{status:Boolean},message:!0});o&&e()}catch(i){}var c,l},q=async()=>{if(O.value){if(O.value.isLocal)return{...O.value.rows,authType:O.value.rows.pkey?"private":"password"};{const t=await A(O.value);return t.authType=t.pkey?"private":"password",t}}return{host:"",port:22,username:"root",password:"",pkey:"",pkey_passwd:"",ps:"",authType:"password"}};export{E as a,y as b,S as c,R as d,D as e,d as f,w as g,p as h,q as i,n as j,k,h as l,g as m,_ as n,m as o,v as p,f as r,P as s,b as u};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
