import{P as a,l as e}from"./utils-lib.js?v=1761009159";import{c as t,r as s,aD as l,q as n,H as r,v as i,x as m,z as o,e as u,y as c,Q as p,D as d,F as b,b0 as f,I as y,an as v,A as g}from"./base-lib.js?v=1761009159";import{aX as _,aY as x,aZ as j,a_ as D}from"./firewall.js?v=1761009159";import{u as h}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const q={class:"p-[2rem]"},w={key:0,class:"flex items-center mb-[2rem]"},A={class:"flex items-center justify-center mb-[1.2rem] bg-lighter border-1 border-base py-[1.2rem]"},I={class:"text-small"},P={class:"font-bold text-large mt-[.8rem]"},S=t({__name:"index",props:{compData:{default:()=>({})}},setup(t){const S=t,k=s(!1),V=s(),z=s(!1),C=s([{title:"封锁的IP总数",value:"total_banned",num:0},{title:"连接失败总数",value:"total_failed",num:0},{title:"当前封锁IP数",value:"currently_banned",num:0},{title:"当前连接失败次数",value:"currently_failed",num:0}]),F=async e=>{k.value=!e,await a({loading:"正在设置防扫描开关，请稍候...",request:_({status:e?1:0}),message:!0}),k.value=e},H=async()=>{"AntiScan"==S.compData.type&&(async()=>{try{const{data:e}=await a({loading:"正在获取防扫描开关状态，请稍候...",request:D()});k.value=Boolean(e.status)}catch(e){}})(),(async()=>{const e=await a({loading:z,request:S.compData.requestFn()});C.value.forEach(a=>{a.num=Number(e.data[a.value])||0}),V.value=e.data.banned_ip_list})()},N=[{label:"IP",prop:"ip",render:a=>l("span",a)},h([{onClick:e=>(async e=>{const t="AntiScan"===S.compData.type;await a({loading:"正在解封,请稍后...",request:t?x({data:JSON.stringify({ip:e})}):j({ip:e}),message:!0}),H()})(e),title:"删除"}])];return n(H),(a,t)=>{const s=v,l=e,n=r("bt-loading");return i(),m("div",q,["AntiScan"==a.compData.type?(i(),m("div",w,[t[1]||(t[1]=o("span",{class:"mr-[.8rem]"},"防扫描开关",-1)),u(s,{modelValue:c(k),"onUpdate:modelValue":t[0]||(t[0]=a=>p(k)?k.value=a:null),size:"small",onChange:F},null,8,["modelValue"])])):d("",!0),o("div",A,[(i(!0),m(b,null,f(c(C),(a,e)=>(i(),m("div",{key:e,class:"flex flex-col items-center mx-[.4rem] p-[.8rem]"},[o("span",I,g(a.title),1),o("span",P,g(a.num||0),1)]))),128))]),y(u(l,{ref:"antiTable",column:N,data:c(V),"max-height":220},null,8,["data"]),[[n,c(z)],[n,"正在加载中，请稍后...","title"]])])}}});export{S as default};
