import{l as e,Y as t,a4 as a,$ as s,t as l,A as r,a7 as o,z as i,x as n,a2 as p}from"./utils-lib.js?v=20260328163632";import{B as c}from"./index91.js?v=20260328163632";import{u as d}from"./index92.js?v=20260328163632";import{g as u}from"./index50.js?v=20260328163632";import{L as m,M as y,N as h,O as v}from"./wsl.js?v=20260328163632";import{r as S,O as k,c as w,u as _,k as f,o as b,J as x,V as g,_ as j,a3 as H,Y as O}from"./base-lib.js?v=20260328163632";import{aI as D,l as L}from"./naive-ui.js?v=20260328163632";function T(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!_(e)}const A=S(!1),R=S(null),C=t=>{R.value=t||null,r({title:t?e("编辑远程Docker")+" [ ".concat(t.title," ]"):e("添加远程Docker"),area:600,component:()=>o((()=>import("./add-docker.js?v=20260328163632")),[],import.meta.url),showFooter:!0})},{BtOperation:I}=d({options:[{active:!0,label:e("添加"),onClick:()=>C()}]}),E=S({columns:[{title:e("别名"),width:100,key:"title"},{title:"主机名",key:"host"},{title:e("端口"),width:100,key:"port"},{title:e("添加时间"),key:"addtime",render:e=>e.addtime?t(e.addtime):"--"},{title:e("TLS验证"),key:"tls",width:80,render:t=>k("span",{class:t.tls.tls?"bt-danger":"bt-link",onClick:()=>(async t=>{await i({title:e("设置TLS验证")+" [ ".concat(t.title," ]"),content:e("是否{0}TLS验证吗？",[t.tls.tls?e("关闭"):e("开启")])}),n({loading:e("正在设置TLS验证，请稍后..."),request:m({sid:t.id,status:Number(!t.tls.tls)}),message:!0,success:()=>q()})})(t)},[t.tls.tls?e("关闭"):e("开启")])},a([{onClick:t=>{R.value=t,r({title:e("编辑SSH信息")+" [ ".concat(t.title," ]"),area:600,component:()=>o((()=>import("./edit-ssh.js?v=20260328163632")),[],import.meta.url),showFooter:!0})},title:e("配置SSH")},{onClick:C,title:e("编辑")},{onClick:async t=>{await i({title:e("删除远程Docker"),content:e("确认删除远程Docker【{0}】吗？",[t.title])}),n({loading:e("正在删除远程Docker..."),request:y({id:t.id}),message:!0,success:()=>{q()}})},title:e("删除")}])],data:[]}),[P,V]=s(E),q=async()=>{A.value=!0;const e=await u();E.value.data=Array.isArray(e.data)?e.data:[],A.value=!1},z=()=>{A.value=!1,E.value.data=[]},B=S("password"),F={labelStyle:"min-width: 110px"},M=S({formAttrs:{labelWidth:"auto"},formItems:[]}),N=S({label:e("SSH端口"),attrs:F,children:[{key:"ssh_port",type:"input",attrs:{class:"!w-[380px]",placeholder:e("请输入SSH端口，如：22")}}]}),Y=S({label:e("SSH账号"),attrs:F,children:[{key:"ssh_username",type:"input",attrs:{class:"!w-[380px]",placeholder:e("请输入SSH账号，如：root")}}]}),J=S({label:e("类型"),attrs:F,children:[{type:"custom",key:"type",render:()=>{let t,a;return k(L,{value:Q.value.type,"onUpdate:value":[e=>Q.value.type=e,e=>{X.value.restoreValidation(),B.value=e}]},{default:()=>[k(D,{value:"password"},T(t=e("密码认证"))?t:{default:()=>[t]}),k(D,{value:"private"},T(a=e("私钥验证"))?a:{default:()=>[a]})]})}}]}),U=S({label:e("SSH密码"),attrs:F,children:[{key:"ssh_password",type:"input",attrs:{type:"password",class:"!w-[380px]",placeholder:e("请输入SSH密码")}}]}),W=S({label:e("私钥"),attrs:F,children:[{type:"input",key:"ssh_pkey",attrs:{class:"!w-380px",placeholder:e("请输入SSH私钥"),type:"textarea",autosize:{minRows:4,maxRows:4}}}]}),$=S({label:e("私钥密码"),attrs:F,children:[{type:"input",key:"ssh_pkey_passwd",attrs:{class:"!w-380px",placeholder:e("请输入SSH私钥密码")}}]}),G=w((()=>(M.value.formItems=[N.value,Y.value,J.value,..."password"===B.value?[U.value]:[W.value,$.value]],M.value))),[K,Q,X]=l(G),Z=(e,t)=>{const a=e.hasOwnProperty("id")?h:v;return n({loading:t,request:a(e),message:!0,success:()=>{q()}})},ee=f({__name:"index",setup:e=>(b(q),x(z),(e,t)=>(g(),j(O(p),{class:"p-20px"},{"header-left":H((()=>[k(O(I),{class:"gap-10px"})])),"header-right":H((()=>[k(O(c),{onRefresh:O(q)},null,8,["onRefresh"])])),content:H((()=>[k(O(P),{loading:O(A),"max-height":400},null,8,["loading"])])),_:1})))}),te=Object.freeze(Object.defineProperty({__proto__:null,default:ee},Symbol.toStringTag,{value:"Module"}));export{K as B,F as a,B as c,Q as f,te as i,R as r,Z as s};
