import{_ as T}from"./index-BGYvyLDv.js?v=1773287522785";import{_ as V}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as W}from"./index.vue_vue_type_script_setup_true_lang-DgjjuUjT.js?v=1773287522785";import{_ as q}from"./index.vue_vue_type_script_setup_true_lang-C5hb-Th7.js?v=1773287522785";import{_ as N}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{i as B,n as z,ap as F,m as M}from"./index-BTglIPU2.js?v=1773287522785";import{u as H}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{m as E,n as X,i as Z,p as G,q as J,t as K}from"./ssh-g_xvV-TS.js?v=1773287522785";import{k as A,R as $,r as L,e as Q,$ as v,Z as b,a0 as o,a9 as S,F as Y,P as tt,S as a,_ as x,aa as k,N as et,X as U,j as at}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a8 as st,k as nt,b as ot,B as it}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{u as lt}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-B7YvCBmY.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";const ct={class:"mr-12px"},mt=A({__name:"logs",props:{config:{}},emits:["setName"],setup(h,{expose:d,emit:_}){const s=h,g=_,{t:n}=$(),l=L(""),c=L([]),m=async e=>{const i=l.value!==e;await E(i,{type:e}),await y(),g("setName",l.value)},{table:t,columns:p,setLoading:w}=H([{key:"log",title:n("Security.SSH.Basic.LoginAlarm.logs_1")},{key:"addtime",title:n("Security.SSH.Basic.LoginAlarm.logs_2"),width:160}]),u=Q({p:1,p_size:10}),f=async()=>{try{w(!0);const{message:e}=await X(et(u));B(e)&&(t.data=z(e.data)?e.data:[],t.total=F(e.page))}finally{w(!1)}},y=async()=>{const{message:e}=await Z();B(e)&&(l.value=e.result)},R=async()=>{const{config:e}=s;B(e)&&(c.value=Object.entries(e).map(([,i])=>({name:i.name,title:i.title})))};return f(),y(),R(),d({init:()=>{f(),y()}}),(e,i)=>{const j=st,C=nt,I=N,P=q,D=W,O=V;return v(),b("div",null,[o(C,{class:"mb-20px",size:20},{default:S(()=>[(v(!0),b(Y,null,tt(a(c),r=>(v(),b("div",{key:r.name,class:"flex items-center"},[x("span",ct,k(r.title),1),o(j,{value:a(l)===r.name,size:"small","onUpdate:value":gt=>m(r.name)},null,8,["value","onUpdate:value"])]))),128))]),_:1}),o(D,null,{table:S(()=>[o(I,{"max-height":450,loading:a(t).loading,data:a(t).data,columns:a(p)},null,8,["loading","data","columns"])]),pageRight:S(()=>[o(P,{page:a(u).p,"onUpdate:page":i[0]||(i[0]=r=>a(u).p=r),"page-size":a(u).p_size,"onUpdate:pageSize":i[1]||(i[1]=r=>a(u).p_size=r),"item-count":a(t).total,"show-size-picker":!1,"show-quick-jumper":!1,onRefresh:f},null,8,["page","page-size","item-count"])]),_:1}),o(O,{class:"mt-16px"},{default:S(()=>[x("li",null,k(e.$t("Security.SSH.Basic.LoginAlarm.logs_3")),1)]),_:1})])}}}),pt={class:"flex"},rt={class:"w-200px mr-10px mb-12px"},_t=A({__name:"whitelist",setup(h,{expose:d}){const{t:_}=$(),s=L(""),g=async()=>{if(s.value.trim()===""){M.error(_("Security.SSH.Basic.LoginAlarm.whitelist_1"));return}await K({ip:s.value}),s.value=""},{table:n,columns:l,setLoading:c}=H([{key:"ip",title:_("Security.SSH.Basic.LoginAlarm.whitelist_2")},lt({width:100,options:t=>[{label:_("Public.Btn.Del"),onClick:async()=>{await G({ip:t.ip}),m()}}]})]),m=async()=>{try{c(!0);const{message:t}=await J();z(t)&&(n.data=t.map(p=>({ip:p})))}finally{c(!1)}};return m(),d({init:m}),(t,p)=>{const w=ot,u=it,f=N;return v(),b("div",null,[x("div",pt,[x("div",rt,[o(w,{value:a(s),"onUpdate:value":p[0]||(p[0]=y=>U(s)?s.value=y:null),placeholder:t.$t("Security.SSH.Basic.LoginAlarm.whitelist_1")},null,8,["value","placeholder"])]),o(u,{type:"primary",onClick:g},{default:S(()=>[at(k(t.$t("Public.Btn.Add")),1)]),_:1})]),o(f,{loading:a(n).loading,"max-height":500,data:a(n).data,columns:a(l)},null,8,["loading","data","columns"])])}}}),ut={class:"h-full"},Rt=A({__name:"index",props:{config:{}},emits:["setName"],setup(h,{emit:d}){const _=h,s=d,{t:g}=$(),n=L("login"),l=[{key:"login",label:g("Security.SSH.Basic.LoginAlarm.index_1"),data:{config:_.config,onSetName:c=>{s("setName",c)}},component:mt},{key:"whitelist",label:g("Security.SSH.Basic.LoginAlarm.index_2"),component:_t}];return(c,m)=>{const t=T;return v(),b("div",ut,[o(t,{value:a(n),"onUpdate:value":m[0]||(m[0]=p=>U(n)?n.value=p:null),data:l},null,8,["value"])])}}});export{Rt as default};
