import{_ as a}from"./index245.js?v=1763625242172";import{c as e,h as t,_ as s,f as i}from"./public.js?v=1763625242172";import{_ as l}from"./index.vue_vue_type_script_setup_true_lang5.js?v=1763625242172";import{_ as n}from"./index.vue_vue_type_script_setup_true_lang7.js?v=1763625242172";import{c as o,x as u,y as p,m as r}from"./page_layout.js?v=1763625242172";import{s as m,a as c,b as _,d,c as g,e as v}from"./index59.js?v=1763625242172";import{k as y,P as x,r as S,e as f,R as j,S as h,X as w,a3 as b,F as k,O as B,V as L,U as z,a4 as A,N as H,aj as U,j as N}from"./vue.js?v=1763625242172";import{dj as C,d9 as P,au as R,aC as $}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./index.vue_vue_type_script_setup_true_lang6.js?v=1763625242172";import"./index107.js?v=1763625242172";import"./index.js?v=1763625242172";import"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import"./index.vue_vue_type_script_setup_true_lang2.js?v=1763625242172";import"./index98.js?v=1763625242172";import"./config3.js?v=1763625242172";import"./index.vue_vue_type_script_setup_true_lang8.js?v=1763625242172";const O={class:"mr-12px"},q=y({__name:"logs",props:{config:{}},emits:["setName"],setup(a,{expose:i,emit:r}){const d=a,g=r,{t:v}=x(),y=S(""),U=S([]),{table:N,columns:R,setLoading:$}=e([{key:"log",title:v("Security.SSH.Basic.LoginAlarm.logs_1")},{key:"addtime",title:v("Security.SSH.Basic.LoginAlarm.logs_2"),width:160}]),q=f({p:1,p_size:10}),D=async()=>{try{$(!0);const{message:a}=await c(H(q));o(a)&&(N.data=u(a.data)?a.data:[],N.total=p(a.page))}finally{$(!1)}},F=async()=>{const{message:a}=await _();o(a)&&(y.value=a.result)};return D(),F(),(async()=>{const{config:a}=d;o(a)&&(U.value=Object.entries(a).map((([,a])=>({name:a.name,title:a.title}))))})(),i({init:()=>{D(),F()}}),(a,e)=>{const i=C,o=P,u=t,p=n,r=l,c=s;return j(),h("div",null,[w(o,{class:"mb-20px",size:20},{default:b((()=>[(j(!0),h(k,null,B(L(U),(a=>(j(),h("div",{key:a.name,class:"flex items-center"},[z("span",O,A(a.title),1),w(i,{value:L(y)===a.name,size:"small","onUpdate:value":e=>(async a=>{const e=y.value!==a;await m(e,{type:a}),await F(),g("setName",y.value)})(a.name)},null,8,["value","onUpdate:value"])])))),128))])),_:1}),w(r,null,{table:b((()=>[w(u,{"max-height":450,loading:L(N).loading,data:L(N).data,columns:L(R)},null,8,["loading","data","columns"])])),pageRight:b((()=>[w(p,{page:L(q).p,"onUpdate:page":e[0]||(e[0]=a=>L(q).p=a),"page-size":L(q).p_size,"onUpdate:pageSize":e[1]||(e[1]=a=>L(q).p_size=a),"item-count":L(N).total,"show-size-picker":!1,"show-quick-jumper":!1,onRefresh:D},null,8,["page","page-size","item-count"])])),_:1}),w(c,{class:"mt-16px"},{default:b((()=>[z("li",null,A(a.$t("Security.SSH.Basic.LoginAlarm.logs_3")),1)])),_:1})])}}}),D={class:"flex"},F={class:"w-200px mr-10px mb-12px"},V=y({__name:"whitelist",setup(a,{expose:s}){const{t:l}=x(),n=S(""),o=async()=>{""!==n.value.trim()?(await v({ip:n.value}),n.value=""):r.error(l("Security.SSH.Basic.LoginAlarm.whitelist_1"))},{table:p,columns:m,setLoading:c}=e([{key:"ip",title:l("Security.SSH.Basic.LoginAlarm.whitelist_2")},i({width:100,options:a=>[{label:l("Public.Btn.Del"),onClick:async()=>{await d({ip:a.ip}),_()}}]})]),_=async()=>{try{c(!0);const{message:a}=await g();u(a)&&(p.data=a.map((a=>({ip:a}))))}finally{c(!1)}};return _(),s({init:_}),(a,e)=>{const s=R,i=$,l=t;return j(),h("div",null,[z("div",D,[z("div",F,[w(s,{value:L(n),"onUpdate:value":e[0]||(e[0]=a=>U(n)?n.value=a:null),placeholder:a.$t("Security.SSH.Basic.LoginAlarm.whitelist_1")},null,8,["value","placeholder"])]),w(i,{type:"primary",onClick:o},{default:b((()=>[N(A(a.$t("Public.Btn.Add")),1)])),_:1})]),w(l,{loading:L(p).loading,"max-height":500,data:L(p).data,columns:L(m)},null,8,["loading","data","columns"])])}}}),X={class:"h-full"},E=y({__name:"index",props:{config:{}},emits:["setName"],setup(e,{emit:t}){const s=e,i=t,{t:l}=x(),n=S("login"),o=[{key:"login",label:l("Security.SSH.Basic.LoginAlarm.index_1"),data:{config:s.config,onSetName:a=>{i("setName",a)}},component:q},{key:"whitelist",label:l("Security.SSH.Basic.LoginAlarm.index_2"),component:V}];return(e,t)=>{const s=a;return j(),h("div",X,[w(s,{value:L(n),"onUpdate:value":t[0]||(t[0]=a=>U(n)?n.value=a:null),data:o},null,8,["value"])])}}});export{E as default};
