import{aa as U,r as v,ak as T,o as i,g as d,b as o,w as a,F as B,D as N,u as t,c as L,f as s,t as b,bb as S,a as e,h as m,d as k,e as $,n as y}from"./app-SC54XQDl.js";import{P as F}from"./app-BGgVpkqZ.js";import{i as O,c as R}from"./app-Ba7ZqSpq.js";import{_ as A}from"./app-DWUwCFNm.js";import{_ as w}from"./app-CVQkwzlf.js";import{_ as E}from"./app-DFulsyXy.js";import{a as V,_ as D}from"./app-PrSv7rSt.js";import{_ as C}from"./app-Y56vIEoR.js";import{_ as M}from"./app-T1ysvErZ.js";import{C as x}from"./app-Ciy_QwIW.js";import{_ as j}from"./app-_SlMJZK-.js";import{_ as q}from"./app-huVLEujn.js";import{D as z}from"./app-ZeVDYyDS.js";import"./app-yUrwy8EY.js";import"./app-CNHjdV6U.js";import"./app-DnXuoh8P.js";import"./app-BZGObKCm.js";import"./app-BPIIxVwk.js";import"./app-PPG0ZS4d.js";import"./app-DgoEZtNT.js";import"./app-Ch8j4za4.js";import"./app-Dw0jKdCD.js";import"./app-CCkWSX4Q.js";import"./app-D_RBJHM6.js";import"./app-DoVkxbmA.js";import"./app-C2mBgI5Z.js";import"./app-BJBSV0K6.js";import"./app-kBNY2ZLt.js";import"./app-_Ovp2dOH.js";import"./app-BjSCO7rC.js";import"./app-DmYIyyK5.js";import"./app-B5UbDc9M.js";function G(){O(this),this.value="",this.ip&&this.ip.length>0&&(this.value=this.ip),this.type="ip",this.eventLevel=this.listType=="white"?"debug":"critical",this.method="single"}const H={class:"comment"},J={__name:"FirewallEventLevelOptions",props:["v-value"],emits:["change"],setup(I,{emit:l}){const g=U("$Tea"),n=I,u=l,{levels:_,description:f,level:c}=function(){let r=n.vValue;return(r==null||r.length==0)&&(r=""),{levels:v([]),description:v(""),level:v(r)}}(),P=function(){u("change");let r=_.value.$find(function(h,p){return p.code==c.value});r!=null?f.value=r.description:f.value=""};return T(()=>{g.action("/ui/eventLevelOptions").post().success(function(r){_.value=r.data.eventLevels,P()})}),(r,h)=>(i(),d("div",null,[o(D,{name:"eventLevel",modelValue:t(c),"onUpdate:modelValue":h[0]||(h[0]=p=>S(c)?c.value=p:null),onChange:P},{default:a(()=>[(i(!0),d(B,null,N(t(_),p=>(i(),L(V,{value:p.code},{default:a(()=>[s(b(p.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"]),e("p",H,b(t(f)),1)]))}},K={key:0},Q={key:1},W={key:2},X=["value"],Y=["value"],Z=["value"],ee=e("td",{class:"title"},"类型 *",-1),te={key:0,class:"comment"},le={key:1,class:"comment"},oe={key:0},se=e("td",null,"添加方式",-1),ae={key:0},ne=e("td",null,"IP或IP段 *",-1),ie=e("p",{class:"comment"},"支持IPv4和IPv6；支持三种格式：单个IP（比如192.168.1.100）、IP范围（比如192.168.1.1-192.168.1.255）、CIDR（比如192.168.1.1/24）。",-1),ue={key:1},re=e("td",null,"IP列表",-1),de={class:"comment"},me=e("td",null,"过期时间",-1),pe=e("p",{class:"comment"},"在加入名单某一段时间后会失效，留空表示永久有效。",-1),ce=e("td",null,"级别",-1),_e={colspan:"2"},fe=e("td",null,"备注",-1),Ke={__name:"createIPPopup",setup(I){const l=R(new G);return(g,n)=>(i(),L(F,null,{default:a(()=>[t(l).list.type=="white"?(i(),d("header",K,"添加IP到白名单")):m("",!0),t(l).list.type=="black"?(i(),d("header",Q,"添加IP到黑名单")):m("",!0),t(l).list.type=="grey"?(i(),d("header",W,"添加IP到灰名单")):m("",!0),o(E,{action:"$",onSuccess:t(l).success},{default:a(()=>[e("input",{type:"hidden",name:"listId",value:t(l).listId},null,8,X),e("input",{type:"hidden",name:"serverId",value:t(l).serverId},null,8,Y),e("input",{type:"hidden",name:"sourceCategory",value:t(l).sourceCategory},null,8,Z),o(z,null,{default:a(()=>[k(e("tbody",null,[e("tr",null,[ee,e("td",null,[o(D,{name:"type",modelValue:t(l).type,"onUpdate:modelValue":n[0]||(n[0]=u=>t(l).type=u)},{default:a(()=>[o(V,{value:"ip"},{default:a(()=>[s("单IP或IP段")]),_:1}),o(V,{value:"all"},{default:a(()=>[s("所有IP")]),_:1})]),_:1},8,["modelValue"]),t(l).type=="ip"?(i(),d("p",te,"单个IP或一个IP范围。")):m("",!0),t(l).type=="all"?(i(),d("p",le,"允许或禁用所有的IP。")):m("",!0)])]),t(l).type!="all"?(i(),d("tr",oe,[se,e("td",null,[o(C,{name:"method",value:"single",modelValue:t(l).method,"onUpdate:modelValue":n[1]||(n[1]=u=>t(l).method=u)},{default:a(()=>[s("单个添加")]),_:1},8,["modelValue"]),s("     "),o(C,{name:"method",value:"batch",modelValue:t(l).method,"onUpdate:modelValue":n[2]||(n[2]=u=>t(l).method=u)},{default:a(()=>[s("批量添加")]),_:1},8,["modelValue"])])])):m("",!0)],512),[[$,!t(l).quickMode]]),t(l).method=="single"&&t(l).type=="ip"?(i(),d("tbody",ae,[e("tr",null,[ne,e("td",null,[o(w,{type:"text",name:"value",maxlength:"64",placeholder:"x.x.x.x",autofocus:"",class:"w-full",modelValue:t(l).value,"onUpdate:modelValue":n[3]||(n[3]=u=>t(l).value=u)},null,8,["modelValue"]),ie])])])):m("",!0),t(l).method=="batch"&&t(l).type=="ip"?(i(),d("tbody",ue,[e("tr",null,[re,e("td",null,[o(M,{name:"ipData",class:"w-full",placeholder:`x.x.x.x
x.x.x.x/24
x.x.x.x-y.y.y.y`,rows:"3"}),e("p",de,[s("每行一个IP，支持三种格式： "),o(x,{class:y("grey")},{default:a(()=>[s("192.168.1.100")]),_:1}),s(" 、 "),o(x,{class:y("grey")},{default:a(()=>[s("192.168.1.1-192.168.1.255")]),_:1}),s(" 、 "),o(x,{class:y("grey")},{default:a(()=>[s("192.168.1.1/24")]),_:1}),s(" 。 ")])])])])):m("",!0),e("tbody",null,[e("tr",null,[me,e("td",null,[o(j,{"v-name":"expiredAt","v-timestamp":t(l).expiresAt},null,8,["v-timestamp"]),pe])]),e("tr",null,[ce,e("td",null,[o(J,{"v-value":t(l).eventLevel},null,8,["v-value"])])]),e("tr",null,[e("td",_e,[o(q)])])]),k(e("tbody",null,[e("tr",null,[fe,e("td",null,[o(w,{type:"text",name:"reason",maxlength:"100",class:"w-full",modelValue:t(l).reason,"onUpdate:modelValue":n[4]||(n[4]=u=>t(l).reason=u)},null,8,["modelValue"])])])],512),[[$,t(l).moreOptionsVisible]])]),_:1}),o(A)]),_:1},8,["onSuccess"])]),_:1}))}};export{Ke as default};
