import{n as e,Q as a,P as t,W as r,O as s,l,ah as o,p as n}from"./utils-lib.js?v=1761009159";import{_ as i}from"./index105.js?v=1761009159";import{_ as p}from"./index114.js?v=1761009159";import{c as d,r as _,o as m,e as u,q as c,H as f,v as y,x as g,y as j,N as v,B as b,D as h,C as w,Q as x,I as E,z as O,A as S,G as q}from"./base-lib.js?v=1761009159";import{_ as A}from"./index133.js?v=1761009159";import{F,G as I}from"./firewall.js?v=1761009159";import{r as N,e as V,f as k}from"./useMethod6.js?v=1761009159";import{g as C}from"./useStore5.js?v=1761009159";import{a as D}from"./column.js?v=1761009159";import{_ as H}from"./index.vue_vue_type_script_setup_true_lang11.js?v=1761009159";import{_ as J}from"./index.vue_vue_type_script_setup_true_lang12.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./validator.js?v=1761009159";import"./index.vue_vue_type_style_index_0_scoped_cdc7f4d3_lang.js?v=1761009159";const P={class:"min-h-[30rem]"},T={class:"mt-16px leading-8 text-small list-disc ml-[2rem]"},U=d({__name:"index",setup(d){const{refs:{firewallInfo:U,systemTabActive:G}}=C(),Q=_(null),R=_([]),z=_(""),B=_(0),L=_(!1),M=m({p:1,limit:20}),W=(t,r)=>{e({title:t?"修改地区规则":"添加地区规则",area:44,component:()=>a(()=>import("./add-area-rule.js?v=1761009159"),__vite__mapDeps([]),import.meta.url),showFooter:!0,compData:{...r,isEdit:t,refreshFn:K}})},K=async(e=1)=>{"area"===G.value&&await t({loading:L,request:F({data:JSON.stringify({...M,query:z.value})}),data:{data:[Array,R],page:r(B)}})},X=[D(),{label:"地区",render:e=>u("span",null,[e.country+"("+e.brief+")"])},{label:"策略",render:(e,a)=>u("span",{class:"text-"+("accept"===e.types?"primary":"danger")},["accept"==e.types?"放行":"禁止"])},{label:"端口",render:e=>u("span",null,[e.ports?e.ports:"全部"])},{label:"时间",prop:"addtime",renderHeader:()=>N("时间","-- : 表示面板数据库中未记录创建时间，规则从系统中直接读取，忽略即可")},V({editEvent:e=>W(!0,e),deleteEvent:async e=>{await n({icon:"warning-filled",title:"删除地区规则",content:"删除选中规则后，该规则屏蔽的地区，端口将恢复正常访问，是否继续操作？"});const a={...e,s_port:e.start_port,d_port:e.ended_port,d_ip:e.ended_ip};delete a.start_port,a.ended_port,a.ended_ip,await t({loading:"正在删除规则，请稍后...",request:I({data:JSON.stringify(a)}),message:!0,success:K})}})],Y=[{label:"删除",value:"delete",event:async(e,a)=>{await k(e,a,async e=>{const a={...e,s_port:e.start_port,d_port:e.ended_port,d_ip:e.ended_ip};return delete a.start_port,a.ended_port,a.ended_ip,await I({data:JSON.stringify(a)})},{label:"地区",prop:"country"},K)}}];return c(()=>K()),(e,a)=>{const t=A,r=q,n=s,d=l,_=o,m=p,c=i,F=f("bt-loading");return y(),g("div",P,[j(U).init_status?h("",!0):(y(),v(t,{key:0,width:"38rem"},{content:b(()=>[u(J)]),_:1})),u(c,null,{"header-left":b(()=>[u(r,{type:"primary",onClick:a[0]||(a[0]=e=>W())},{default:b(()=>a[6]||(a[6]=[w(" 添加地区规则 ",-1)])),_:1,__:[6]}),u(H,{type:"country_rule",refreshFn:K})]),"header-right":b(()=>[u(n,{class:"!w-[32rem]",modelValue:j(z),"onUpdate:modelValue":a[1]||(a[1]=e=>x(z)?z.value=e:null),onSearch:a[2]||(a[2]=e=>K()),placeholder:"请输入地区"},null,8,["modelValue"])]),content:b(()=>[E(u(d,{ref_key:"areaTableRef",ref:Q,column:X,data:j(R),description:"地区列表为空"},null,8,["data"]),[[F,j(L)],[F,"正在加载地区列表，请稍后...","title"]])]),"footer-left":b(()=>[u(_,{"table-ref":j(Q),options:Y},null,8,["table-ref"])]),"footer-right":b(()=>[u(m,{total:j(B),page:j(M).p,"onUpdate:page":a[3]||(a[3]=e=>j(M).p=e),row:j(M).limit,"onUpdate:row":a[4]||(a[4]=e=>j(M).limit=e),onChange:a[5]||(a[5]=e=>K()),name:"area"},null,8,["total","page","row"])]),_:1}),O("ul",T,[O("li",null,"每隔一个月会自动更新一次最新的IP池，最近更新时间："+S(j(U).update_time),1)])])}}});export{U as default};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
