import{r as m,C as Re,o as s,g as n,a as l,u as a,F as C,D as M,b as u,w as r,f as p,t as _,h as i,i as I,d as pe,c as j,L as Ne,aa as Pe,J as N,ak as Le,e as ye,n as we,bb as w,a_ as k}from"./app-DnroACXc.js";import{u as Ke}from"./app-DckefXYL.js";import"./app-MtOp7vk3.js";import{T as fe}from"./app-B8VsrFxM.js";import{P as Ve}from"./app-z7Z_Uo-k.js";import{_ as Oe}from"./app-BBDtZW3a.js";import{a as b,_ as J}from"./app-DntYVxd7.js";import{T as Be}from"./app-LqsmzyUT.js";import{_ as F}from"./app-DPkDcD7h.js";import{_ as Ae}from"./app-BZyjLC2w.js";import{_ as De}from"./app-DFWP-E91.js";import{_ as ge}from"./app-BbRQPmFH.js";import{a as D,T as E}from"./app-NF1oOHjK.js";import{S as Ee}from"./app-C0-Qcoum.js";import{C as Me}from"./app-Do8DhyKT.js";const je=["value"],Ge={key:0,class:"label-group"},We=["title"],Je={class:"small grey"},He={key:0},qe={key:1},ze={key:2},Ye={key:0},Qe={key:1},Xe={key:3},Ze={key:4},et=["title"],tt={key:1,class:"hover"},lt={key:2,class:"disabled",style:{"font-weight":"normal"},title:"空字符串"},ot={key:5,class:"grey small"},st={key:6},nt=["onClick"],at=l("i",{class:"icon pencil small"},null,-1),ut=[at],it=["onClick"],rt=l("i",{class:"icon remove"},null,-1),dt=[rt],qo={__name:"HTTPFirewallRulesBox",props:["v-rules","v-type","connector"],emits:["change"],setup(ee,{emit:ve}){const V=Ke(),$=ee,x=ve,{rules:P}=function(){let y=$.vRules;return y==null&&(y=[]),{rules:m(y)}}(),S=function(){window.UPDATING_RULE=null,V.popup("/servers/components/waf/createRulePopup?type="+$.vType,{width:"60em",height:"50em",callback:function(y){P.value.push(y.data.rule),x("change")}})},G=function(y,h){window.UPDATING_RULE=V.clone(h),V.popup("/servers/components/waf/createRulePopup?type="+$.vType,{width:"60em",height:"50em",callback:function(f){P.value[y]=f.data.rule,x("change")}})},H=function(y){V.confirm("确定要删除此规则吗？",function(){P.value.$remove(y),x("change")})},O=function(y){let h=y;return typeof window.WAF_RULE_OPERATORS!=null&&window.WAF_RULE_OPERATORS.forEach(function(f){f.code==y&&(h=f.name)}),h},R=function(y){let h=y,f="";return typeof window.WAF_RULE_OPERATORS!=null&&window.WAF_RULE_OPERATORS.forEach(function(d){d.code==y&&(h=d.name,f=d.description)}),h+": "+f},v=function(y){let h="none";return typeof window.WAF_RULE_OPERATORS!=null&&window.WAF_RULE_OPERATORS.forEach(function(f){f.code==y&&(h=f.dataType)}),h},c=function(y){let h="";return y!=null&&window.WAF_RULE_CHECKPOINTS.forEach(function(f){(y=="${"+f.prefix+"}"||y.startsWith("${"+f.prefix+"."))&&(h=f.name)}),h},he=function(y){let h="",f="";return y!=null&&window.WAF_RULE_CHECKPOINTS.forEach(function(d){(y=="${"+d.prefix+"}"||y.startsWith("${"+d.prefix+"."))&&(h=d.name,f=d.description)}),h+": "+f},L=function(y){return typeof y=="string"&&y.length==0};return(y,h)=>{const f=Re("tooltip");return s(),n("div",null,[l("input",{type:"hidden",name:"rulesJSON",value:JSON.stringify(a(P))},null,8,je),a(P).length>0?(s(),n("div",Ge,[(s(!0),n(C,null,M(a(P),(d,B)=>(s(),n(C,null,[u(fe,{outlined:""},{default:r(()=>[p(_(d.name)+" ",1),l("span",{title:he(d.param),class:"hover"},[p(_(c(d.param))+" ",1),l("span",Je,_(d.param),1),p(" ")],8,We),d.param=="${cc}"?(s(),n("span",He,_(d.checkpointOptions.period)+"秒内请求数 ",1)):i("",!0),d.param=="${requestGeneralHeaderLength}"?(s(),n("span",qe," 超出长度 "+_(d.checkpointOptions.length)+" 字节 ",1)):d.param=="${refererBlock}"?(s(),n("span",ze,[d.checkpointOptions.allowDomains!=null&&d.checkpointOptions.allowDomains.length>0?(s(),n("span",Ye,"允许"+_(d.checkpointOptions.allowDomains),1)):i("",!0),d.checkpointOptions.denyDomains!=null&&d.checkpointOptions.denyDomains.length>0?(s(),n("span",Qe,"禁止"+_(d.checkpointOptions.denyDomains),1)):i("",!0)])):d.param=="${commonAIBot}"?(s(),n("span",Xe)):(s(),n("span",Ze,[d.paramFilters!=null&&d.paramFilters.length>0?(s(!0),n(C,{key:0},M(d.paramFilters,U=>(s(),n("span",null," | "+_(U.code),1))),256)):i("",!0),p(),l("span",{class:"hover",title:R(d.operator)+(!d.isComposed&&d.isCaseInsensitive?"\\n[大小写不敏感] ":"")},"<"+_(O(d.operator))+">",9,et),p("  "),L(d.value)?v(d.operator)!="none"?(s(),n("span",lt,"[空]")):i("",!0):(s(),n("span",tt,_(d.value),1))])),d.description!=null&&d.description.length>0?(s(),n("span",ot,"（"+_(d.description)+"）",1)):i("",!0),d.score>0?(s(),n("span",st,[p("   "),u(Oe,{value:"分值："+d.score,severity:"secondary"},null,8,["value"])])):i("",!0),p("   "),l("a",{href:"",title:"修改",onClick:I(U=>G(B,d),["prevent"])},ut,8,nt),p("  "),l("a",{href:"",title:"删除",onClick:I(U=>H(B),["prevent"])},dt,8,it)]),_:2},1024),B!=a(P).length-1?(s(),n(C,{key:0},[ee.connector=="and"?pe((s(),j(fe,{key:0},{default:r(()=>[p("和")]),_:1})),[[f,`规则之间关系-和：
所有规则都满足才视为匹配`,void 0,{bottom:!0}]]):i("",!0),ee.connector=="or"?pe((s(),j(fe,{key:1},{default:r(()=>[p("或")]),_:1})),[[f,`规则之间关系-或：
任一规则满足了就视为匹配`,void 0,{bottom:!0}]]):i("",!0)],64)):i("",!0)],64))),256)),u(Ne)])):i("",!0),u(Ve,{size:"small",type:"button",onClick:h[0]||(h[0]=I(d=>S(),["prevent"]))})])}}},pt=["value"],vt={class:"small"},mt={key:0,class:"small"},ct={key:0},_t={key:1},yt={key:2},ft={key:1},ht={key:0},kt={key:0},bt={key:1},wt={key:1},Vt={key:2},$t={key:0},It={key:3},Pt={key:0},gt={key:4},Nt={key:5},xt={key:6},Ft={key:7},Tt={key:8},Ct={key:0},St={key:9},Ut={key:10},Rt={key:11},Lt={key:12,class:"small grey"},Kt={key:0},Ot={key:1},Bt=["onClick"],At=l("i",{class:"icon pencil small"},null,-1),Dt=[At],Et=["onClick"],Mt=l("i",{class:"icon remove small"},null,-1),jt=[Mt],Gt=l("a",{href:"",title:"拖动改变顺序"},[l("i",{class:"icon bars sort-handle"})],-1),Wt={key:0,style:{"margin-bottom":"0.5em"}},Jt=l("td",{class:"title"},"动作类型 *",-1),Ht={key:0,class:"comment"},qt={key:0},zt=l("td",null,"有效范围",-1),Yt={key:0,class:"comment"},Qt={key:1,class:"comment"},Xt={key:2,class:"comment"},Zt={key:1},el=l("td",null,"封禁范围",-1),tl={key:0,class:"comment"},ll={key:1,class:"comment"},ol={key:2},sl=l("td",null,"封禁时长",-1),nl=l("span",null,"秒",-1),al={key:3},ul=l("td",null,"最大封禁时长",-1),il=l("span",null,"秒",-1),rl=l("p",{class:"comment"},"选填项。如果同时填写了封禁时长和最大封禁时长，则会在两者之间随机选择一个数字作为最终的封禁时长。",-1),dl={key:4},pl=l("td",null,"封禁整个C段IP",-1),vl=l("p",{class:"comment"},"选中后，表示在封禁当前访客IP的同时，封禁整个对应的C段IP；比如当前访客IP为192.168.1.100，则封禁C段192.168.1.0~192.168.1.255。",-1),ml={key:5},cl=l("td",null,"有效时间",-1),_l=l("span",null,"秒",-1),yl=l("p",{class:"comment"},"验证通过后在这个时间内不再验证；如果为空或者为0表示默认。",-1),fl={key:6},hl=l("td",null,"最多失败次数",-1),kl=l("span",null,"次",-1),bl={class:"comment"},wl={key:0,class:"red"},Vl={key:7},$l=l("td",null,"失败拦截时间",-1),Il=l("span",null,"秒",-1),Pl=l("p",{class:"comment"},"在达到最多失败次数（大于0）时，自动拦截的时间；如果为空或者为0表示默认。",-1),gl={key:8},Nl=l("td",null,"有效时间",-1),xl=l("span",null,"秒",-1),Fl=l("p",{class:"comment"},"验证通过后在这个时间内不再验证；如果为空或者为0表示默认。",-1),Tl={key:9},Cl=l("td",null,"最多失败次数",-1),Sl=l("span",null,"次",-1),Ul=l("p",{class:"comment"},"允许用户失败尝试的最多次数，超过这个次数将被自动加入黑名单；如果为空或者为0表示默认。",-1),Rl={key:10},Ll=l("td",null,"失败拦截时间",-1),Kl=l("span",null,"秒",-1),Ol=l("p",{class:"comment"},"在达到最多失败次数（大于0）时，自动拦截的时间；如果为空或者为0表示默认。",-1),Bl={key:11},Al=l("td",null,"有效时间",-1),Dl=l("span",null,"秒",-1),El=l("p",{class:"comment"},"验证通过后在这个时间内不再验证。",-1),Ml={key:12},jl=l("td",null,"有效时间",-1),Gl=l("span",null,"秒",-1),Wl=l("p",{class:"comment"},"验证通过后在这个时间内不再验证。",-1),Jl={key:13},Hl=l("td",null,"IP名单类型 *",-1),ql={key:14},zl=l("td",null,"选择IP名单",-1),Yl={key:0,class:"mb-2"},Ql=l("i",{class:"icon remove small"},null,-1),Xl=[Ql],Zl=l("p",{class:"comment"},"如不选择，则自动添加到当前策略的IP名单中。",-1),eo={key:15},to=l("td",null,"级别",-1),lo={key:16},oo=l("td",null,"超时时间",-1),so=l("span",null,"秒",-1),no=l("p",{class:"comment"},"0表示不超时。",-1),ao={key:17},uo=l("td",null,"标签 *",-1),io={key:18},ro=l("td",null,"使用默认提示",-1),po={key:19},vo=l("td",{class:"color-border"},"状态码 *",-1),mo={key:20},co=l("td",{class:"color-border"},"网页内容",-1),_o={key:21},yo=l("td",null,"状态码 *",-1),fo={key:22},ho=l("td",null,"跳转到URL",-1),ko={class:"comment"},bo={key:23},wo=l("td",null,"下一个分组 *",-1),Vo={key:24},$o=l("td",null,"下一个分组 *",-1),Io={key:25},Po=l("td",null,"下一个规则集 *",-1),go=l("i",{class:"icon remove small"},null,-1),No=[go],xo={key:1},Fo=l("p",{class:"comment"},"系统总是会先执行记录日志、标签等不会修改请求的动作，再执行阻止、验证码等可能改变请求的动作。",-1),zo={__name:"HTTPFirewallActionsBox",props:["v-actions","v-firewall-policy","v-action-configs","v-group-type"],setup(ee){const ve=Pe("$utils"),V=Pe("$Tea"),$=ee,x=m(),{id:P,actions:S,configs:G,isAdding:H,editingIndex:O,action:R,actionCode:v,actionOptions:c,ipListLevels:he,allowScope:L,blockTimeout:y,blockTimeoutMax:h,blockScope:f,blockCClassIP:d,captchaLife:B,captchaMaxFails:U,captchaFailBlockTimeout:te,get302Life:le,post307Life:oe,recordIPType:z,recordIPLevel:me,recordIPTimeout:se,recordIPListId:Y,recordIPListName:_e,tagTags:Q,pageUseDefault:W,pageStatus:ne,pageBody:ae,defaultPageBody:$e,redirectStatus:ue,redirectURL:X,goGroupName:Z,goGroupId:K,goGroup:A,goSetId:q,goSetName:ce,jsCookieLife:ie,jsCookieMaxFails:re,jsCookieFailBlockTimeout:de,statusOptions:xe}=function(){$.vFirewallPolicy.inbound==null&&($.vFirewallPolicy.inbound={}),$.vFirewallPolicy.inbound.groups==null&&($.vFirewallPolicy.inbound.groups=[]),$.vFirewallPolicy.outbound==null&&($.vFirewallPolicy.outbound={}),$.vFirewallPolicy.outbound.groups==null&&($.vFirewallPolicy.outbound.groups=[]);let o=0,e=[];$.vActionConfigs!=null&&(e=$.vActionConfigs,e.forEach(function(g){g.id=o++}));var t=`<!DOCTYPE html>
<html lang="en">
<head>
	<title>403 Forbidden</title>
	<style>
		address { line-height: 1.8; }
	</style>
</head>
<body>
<h1>403 Forbidden</h1>
<address>Connection: \${remoteAddr} (Client) -&gt; \${serverAddr} (Server)</address>
<address>Request ID: \${requestId}</address>
</body>
</html>`;return{id:m(o),actions:m($.vActions),configs:m(e),isAdding:m(!1),editingIndex:m(-1),action:m(null),actionCode:m(""),actionOptions:m({}),ipListLevels:m([]),allowScope:m("global"),blockTimeout:m(""),blockTimeoutMax:m(""),blockScope:m("global"),blockCClassIP:m(!1),captchaLife:m(""),captchaMaxFails:m(""),captchaFailBlockTimeout:m(""),get302Life:m(""),post307Life:m(""),recordIPType:m("black"),recordIPLevel:m("critical"),recordIPTimeout:m(""),recordIPListId:m(0),recordIPListName:m(""),tagTags:m([]),pageUseDefault:m(!0),pageStatus:m(403),pageBody:m(t),defaultPageBody:m(t),redirectStatus:m(307),redirectURL:m(""),goGroupName:m(""),goGroupId:m(0),goGroup:m(null),goSetId:m(0),goSetName:m(""),jsCookieLife:m(""),jsCookieMaxFails:m(""),jsCookieFailBlockTimeout:m(""),statusOptions:m([{code:301,text:"Moved Permanently"},{code:308,text:"Permanent Redirect"},{code:302,text:"Found"},{code:303,text:"See Other"},{code:307,text:"Temporary Redirect"}])}}(),Ie=function(){R.value=null,v.value="page",H.value=!0,c.value={},L.value="global",y.value="",h.value="",f.value="global",d.value=!1,B.value="",U.value="",te.value="",ie.value="",re.value="",de.value="",le.value="",oe.value="",me.value="critical",z.value="black",se.value="",Y.value=0,_e.value="",Q.value=[],W.value=!0,ne.value=403,ae.value=$e.value,ue.value=307,X.value="",Z.value="",K.value=0,A.value=null,q.value=0,ce.value="",R.value=$.vActions.$find(function(o,e){return e.code==v.value})},Fe=function(o){H.value=!1,O.value=-1,G.value.$remove(o)},Te=function(o,e){if(H.value&&O.value==o){ke();return}switch(Ie(),H.value=!0,O.value=o,v.value=e.code,R.value=S.value.$find(function(t,g){return g.code==e.code}),e.code){case"block":y.value="",h.value="",(e.options.timeout!=null||e.options.timeout>0)&&(y.value=e.options.timeout.toString()),(e.options.timeoutMax!=null||e.options.timeoutMax>0)&&(h.value=e.options.timeoutMax.toString()),e.options.scope!=null&&e.options.scope.length>0?f.value=e.options.scope:f.value="global",d.value=!1,typeof e.options.blockCClassIP=="boolean"&&(d.value=e.options.blockCClassIP);break;case"allow":e.options!=null&&e.options.scope!=null&&e.options.scope.length>0?L.value=e.options.scope:L.value="global";break;case"log":break;case"captcha":B.value="",(e.options.life!=null||e.options.life>0)&&(B.value=e.options.life.toString()),U.value="",(e.options.maxFails!=null||e.options.maxFails>0)&&(U.value=e.options.maxFails.toString()),te.value="",(e.options.failBlockTimeout!=null||e.options.failBlockTimeout>0)&&(te.value=e.options.failBlockTimeout.toString());break;case"js_cookie":ie.value="",(e.options.life!=null||e.options.life>0)&&(ie.value=e.options.life.toString()),re.value="",(e.options.maxFails!=null||e.options.maxFails>0)&&(re.value=e.options.maxFails.toString()),de.value="",(e.options.failBlockTimeout!=null||e.options.failBlockTimeout>0)&&(de.value=e.options.failBlockTimeout.toString());break;case"notify":break;case"get_302":le.value="",(e.options.life!=null||e.options.life>0)&&(le.value=e.options.life.toString());break;case"post_307":oe.value="",(e.options.life!=null||e.options.life>0)&&(oe.value=e.options.life.toString());break;case"record_ip":e.options!=null&&(me.value=e.options.level,z.value=e.options.type,e.options.timeout>0&&(se.value=e.options.timeout.toString()),setTimeout(function(){Y.value=e.options.ipListId,_e.value=e.options.ipListName}));break;case"tag":Q.value=[],e.options.tags!=null&&(Q.value=e.options.tags);break;case"page":W.value=!0,ne.value=403,ae.value=$e.value,typeof e.options.useDefault=="boolean"?W.value=e.options.useDefault:W.value=!1,e.options.status!=null&&(ne.value=e.options.status),e.options.body!=null&&(ae.value=e.options.body);break;case"redirect":ue.value=307,X.value="",e.options.status!=null&&(ue.value=e.options.status),e.options.url!=null&&(X.value=e.options.url);break;case"go_group":e.options!=null&&(Z.value=e.options.groupName,K.value=e.options.groupId,A.value=$.vFirewallPolicy.inbound.groups.$find(function(t,g){return g.id==e.options.groupId}));break;case"go_set":e.options!=null&&(Z.value=e.options.groupName,K.value=e.options.groupId,A.value=$.vFirewallPolicy.inbound.groups.$find(function(t,g){return g.id==e.options.groupId}),setTimeout(function(){if(q.value=e.options.setId,A.value!=null){let t=A.value.sets.$find(function(g,be){return be.id==e.options.setId});t!=null&&(ce.value=t.name)}}));break}},ke=function(){H.value=!1,O.value=-1},T=function(){if(R.value==null)return;if(c.value==null&&(c.value={}),v.value=="record_ip"){let e=parseInt(se.value);if(isNaN(e)&&(e=0),Y.value<0)return;c.value={type:z.value,level:me.value,timeout:e,ipListId:Y.value,ipListName:_e.value}}else if(v.value=="tag"){if(Q.value==null||Q.value.length==0)return;c.value={tags:Q.value}}else if(v.value=="page"){let e=ne.value.toString();e.match(/^\d{3}$/)?e=parseInt(e):e=403,c.value={useDefault:W.value,status:e,body:ae.value}}else if(v.value=="redirect"){let e=ue.value.toString();if(e.match(/^\d{3}$/)?e=parseInt(e):e=307,X.value.length==0){ve.warn("请输入跳转到URL");return}c.value={status:e,url:X.value}}else if(v.value=="go_group"){let e=K.value;if(typeof e=="string"&&(e=parseInt(e),isNaN(e)&&(e=0)),e<=0)return;c.value={groupId:e.toString(),groupName:Z.value}}else if(v.value=="go_set"){let e=K.value;typeof e=="string"&&(e=parseInt(e),isNaN(e)&&(e=0));let t=q.value;if(typeof t=="string"&&(t=parseInt(t),isNaN(t)&&(t=0)),t<=0)return;c.value={groupId:e.toString(),groupName:Z.value,setId:t.toString(),setName:ce.value}}let o={};for(let e in c.value)c.value.hasOwnProperty(e)&&(o[e]=c.value[e]);O.value>-1?G.value[O.value]={id:G.value[O.value].id,code:v.value,name:R.value.name,options:o}:G.value.push({id:P.value++,code:v.value,name:R.value.name,options:o}),ke()},Ce=function(){Y.value=0},Se=function(){ve.popup("/servers/iplists/selectPopup?type="+z.value,{width:"50em",callback:function(o){Y.value=o.data.list.id,_e.value=o.data.list.name}})},Ue=function(o){Q.value=o};return N(v,function(o){R.value=S.value.$find(function(e,t){return t.code==o}),c.value={}}),N(L,function(o){c.value.scope=o}),N(y,function(o){o=parseInt(o),isNaN(o)?c.value.timeout=0:c.value.timeout=o}),N(h,function(o){o=parseInt(o),isNaN(o)?c.value.timeoutMax=0:c.value.timeoutMax=o}),N(f,function(o){c.value.scope=o}),N(d,function(o){c.value.blockCClassIP=o}),N(B,function(o){o=parseInt(o),isNaN(o)?c.value.life=0:c.value.life=o}),N(U,function(o){o=parseInt(o),isNaN(o)?c.value.maxFails=0:c.value.maxFails=o}),N(te,function(o){o=parseInt(o),isNaN(o)?c.value.failBlockTimeout=0:c.value.failBlockTimeout=o}),N(le,function(o){o=parseInt(o),isNaN(o)?c.value.life=0:c.value.life=o}),N(oe,function(o){o=parseInt(o),isNaN(o)?c.value.life=0:c.value.life=o}),N(z,function(o){Y.value=0}),N(se,function(o){o=parseInt(o),isNaN(o)?c.value.timeout=0:c.value.timeout=o}),N(K,function(o){let e=$.vFirewallPolicy.inbound.groups.$find(function(t,g){return g.id==o});A.value=e,e==null?(e=$.vFirewallPolicy.outbound.groups.$find(function(t,g){return g.id==o}),e==null?Z.value="":(A.value=e,Z.value=e.name)):Z.value=e.name,q.value=0,ce.value=""}),N(q,function(o){if(A.value==null)return;let e=A.value.sets.$find(function(t,g){return g.id==o});e==null?(q.value=0,ce.value=""):ce.value=e.name}),N(ie,function(o){o=parseInt(o),isNaN(o)?c.value.life=0:c.value.life=o}),N(re,function(o){o=parseInt(o),isNaN(o)?c.value.maxFails=0:c.value.maxFails=o}),N(de,function(o){o=parseInt(o),isNaN(o)?c.value.failBlockTimeout=0:c.value.failBlockTimeout=o}),Le(()=>{V.action("/servers/iplists/levelOptions").success(function(o){he.value=o.data.levels}).post(),Ee.create(x.value,{draggable:".sort-label",handle:".sort-handle",onUpdate:function(o){ve.moveElement(G.value,o.oldDraggableIndex,o.newDraggableIndex)}})}),(o,e)=>(s(),n("div",null,[l("input",{type:"hidden",name:"actionsJSON",value:JSON.stringify(a(G))},null,8,pt),pe(l("div",{class:"label-group",ref_key:"actionsBoxRef",ref:x},[(s(!0),n(C,null,M(a(G),(t,g)=>(s(),j(fe,{outlined:"","data-index":g,key:t.id,class:we(["sort-label",{blue:g==a(O)}])},{default:r(()=>[p(_(t.name)+" ",1),l("span",vt,"("+_(t.code.toUpperCase())+")",1),t.code=="allow"&&t.options!=null&&t.options.scope!=null&&t.options.scope.length>0?(s(),n("span",mt,[t.options.scope=="group"?(s(),n("span",ct,"[分组]")):i("",!0),t.options.scope=="server"?(s(),n("span",_t,"[网站]")):i("",!0),t.options.scope=="global"?(s(),n("span",yt,"[网站和策略]")):i("",!0)])):i("",!0),t.code=="block"&&(t.options.timeout>0||t.options.blockCClassIP)?(s(),n("span",ft,[p("： "),t.options.timeout>0?(s(),n("span",ht,[p(" 封禁时长"+_(t.options.timeout),1),t.options.timeoutMax>t.options.timeout?(s(),n("span",kt,"-"+_(t.options.timeoutMax),1)):i("",!0),p("秒 "),t.options.blockCClassIP?(s(),n("span",bt,"/ 封禁C段")):i("",!0)])):t.options.blockCClassIP?(s(),n("span",wt,"封禁C段")):i("",!0)])):i("",!0),t.code=="captcha"&&t.options.life>0?(s(),n("span",Vt,[p("：有效期"+_(t.options.life)+"秒 ",1),t.options.maxFails>0?(s(),n("span",$t," / 最多失败"+_(t.options.maxFails)+"次",1)):i("",!0)])):i("",!0),t.code=="js_cookie"&&t.options.life>0?(s(),n("span",It,[p("：有效期"+_(t.options.life)+"秒 ",1),t.options.maxFails>0?(s(),n("span",Pt," / 最多失败"+_(t.options.maxFails)+"次",1)):i("",!0)])):i("",!0),t.code=="get_302"&&t.options.life>0?(s(),n("span",gt,"：有效期"+_(t.options.life)+"秒",1)):i("",!0),t.code=="post_307"&&t.options.life>0?(s(),n("span",Nt,"：有效期"+_(t.options.life)+"秒",1)):i("",!0),t.code=="record_ip"?(s(),n("span",xt,[p("："),l("span",{class:we({red:t.options.ipListIsDeleted})},_(t.options.ipListName),3)])):i("",!0),t.code=="tag"?(s(),n("span",Ft,"："+_(t.options.tags.join(", ")),1)):i("",!0),t.code=="page"?(s(),n("span",Tt,[p("：["+_(t.options.status)+"]",1),t.options.useDefault?(s(),n("span",Ct,"  [默认页面]")):i("",!0)])):i("",!0),t.code=="redirect"?(s(),n("span",St,"："+_(t.options.url),1)):i("",!0),t.code=="go_group"?(s(),n("span",Ut,"："+_(t.options.groupName),1)):i("",!0),t.code=="go_set"?(s(),n("span",Rt,"："+_(t.options.groupName)+" / "+_(t.options.setName),1)):i("",!0),t.code!="allow"&&t.options.scope!=null&&t.options.scope.length>0?(s(),n("span",Lt,[p("   "),t.options.scope=="global"?(s(),n("span",Kt,"[所有网站]")):i("",!0),t.options.scope=="service"?(s(),n("span",Ot,"[当前网站]")):i("",!0)])):i("",!0),p("   "),l("a",{href:"",title:"修改",onClick:I(be=>Te(g,t),["prevent"])},Dt,8,Bt),p("   "),l("a",{href:"",title:"删除",onClick:I(be=>Fe(g),["prevent"])},jt,8,Et),p("   "),Gt]),_:2},1032,["data-index","class"]))),128)),u(Ne)],512),[[ye,a(G).length>0]]),a(H)?(s(),n("div",Wt,[l("table",{class:we(["ui table definition",{blue:a(O)>-1}])},[l("tr",null,[Jt,l("td",null,[u(J,{modelValue:a(v),"onUpdate:modelValue":e[0]||(e[0]=t=>w(v)?v.value=t:null)},{default:r(()=>[(s(!0),n(C,null,M(a(S),t=>(s(),j(b,{value:t.code},{default:r(()=>[p(_(t.name)+" ("+_(t.code.toUpperCase())+")",1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"]),a(R)!=null&&a(R).description.length>0?(s(),n("p",Ht,_(a(R).description),1)):i("",!0)])]),a(v)=="allow"?(s(),n("tr",qt,[zt,l("td",null,[u(J,{modelValue:a(L),"onUpdate:modelValue":e[1]||(e[1]=t=>w(L)?L.value=t:null)},{default:r(()=>[u(b,{value:"group"},{default:r(()=>[p("分组")]),_:1}),u(b,{value:"server"},{default:r(()=>[p("网站")]),_:1}),u(b,{value:"global"},{default:r(()=>[p("网站和策略")]),_:1})]),_:1},8,["modelValue"]),a(L)=="group"?(s(),n("p",Yt,"跳过当前分组其他规则集，继续执行其他分组的规则集。")):i("",!0),a(L)=="server"?(s(),n("p",Qt,"跳过当前网站所有的规则集。")):i("",!0),a(L)=="global"?(s(),n("p",Xt,"跳过当前网站和网站对应WAF策略所有的规则集。")):i("",!0)])])):i("",!0),a(v)=="block"?(s(),n("tr",Zt,[el,l("td",null,[u(J,{modelValue:a(f),"onUpdate:modelValue":e[2]||(e[2]=t=>w(f)?f.value=t:null)},{default:r(()=>[u(b,{value:"service"},{default:r(()=>[p("当前网站")]),_:1}),u(b,{value:"global"},{default:r(()=>[p("所有网站")]),_:1})]),_:1},8,["modelValue"]),a(f)=="service"?(s(),n("p",tl,"只封禁用户对当前网站的访问，其他网站不受影响。")):i("",!0),a(f)=="global"?(s(),n("p",ll,"封禁用户对所有网站的访问。")):i("",!0)])])):i("",!0),a(v)=="block"?(s(),n("tr",ol,[sl,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(y),"onUpdate:modelValue":e[3]||(e[3]=t=>w(y)?y.value=t:null),onKeyup:e[4]||(e[4]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[nl]),_:1})]),_:1})])])):i("",!0),a(v)=="block"?(s(),n("tr",al,[ul,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(h),"onUpdate:modelValue":e[5]||(e[5]=t=>w(h)?h.value=t:null),onKeyup:e[6]||(e[6]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[il]),_:1})]),_:1}),rl])])):i("",!0),a(v)=="block"?(s(),n("tr",dl,[pl,l("td",null,[u(ge,{modelValue:a(d),"onUpdate:modelValue":e[7]||(e[7]=t=>w(d)?d.value=t:null)},null,8,["modelValue"]),vl])])):i("",!0),a(v)=="captcha"?(s(),n("tr",ml,[cl,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(B),"onUpdate:modelValue":e[8]||(e[8]=t=>w(B)?B.value=t:null),onKeyup:e[9]||(e[9]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[_l]),_:1})]),_:1}),yl])])):i("",!0),a(v)=="captcha"?(s(),n("tr",fl,[hl,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(U),"onUpdate:modelValue":e[10]||(e[10]=t=>w(U)?U.value=t:null),onKeyup:e[11]||(e[11]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[kl]),_:1})]),_:1}),l("p",bl,[a(U)>0&&a(U)<5?(s(),n("span",wl,"建议填入一个不小于5的数字，以减少误判几率。")):i("",!0),p("允许用户失败尝试的最多次数，超过这个次数将被自动加入黑名单；如果为空或者为0表示默认。 ")])])])):i("",!0),a(v)=="captcha"?(s(),n("tr",Vl,[$l,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(te),"onUpdate:modelValue":e[12]||(e[12]=t=>w(te)?te.value=t:null),onKeyup:e[13]||(e[13]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[Il]),_:1})]),_:1}),Pl])])):i("",!0),a(v)=="js_cookie"?(s(),n("tr",gl,[Nl,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(ie),"onUpdate:modelValue":e[14]||(e[14]=t=>w(ie)?ie.value=t:null),onKeyup:e[15]||(e[15]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[xl]),_:1})]),_:1}),Fl])])):i("",!0),a(v)=="js_cookie"?(s(),n("tr",Tl,[Cl,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(re),"onUpdate:modelValue":e[16]||(e[16]=t=>w(re)?re.value=t:null),onKeyup:e[17]||(e[17]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[Sl]),_:1})]),_:1}),Ul])])):i("",!0),a(v)=="js_cookie"?(s(),n("tr",Rl,[Ll,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(de),"onUpdate:modelValue":e[18]||(e[18]=t=>w(de)?de.value=t:null),onKeyup:e[19]||(e[19]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[Kl]),_:1})]),_:1}),Ol])])):i("",!0),a(v)=="get_302"?(s(),n("tr",Bl,[Al,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(le),"onUpdate:modelValue":e[20]||(e[20]=t=>w(le)?le.value=t:null),onKeyup:e[21]||(e[21]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[Dl]),_:1})]),_:1}),El])])):i("",!0),a(v)=="post_307"?(s(),n("tr",Ml,[jl,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"5em"},maxlength:"9",modelValue:a(oe),"onUpdate:modelValue":e[22]||(e[22]=t=>w(oe)?oe.value=t:null),onKeyup:e[23]||(e[23]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[Gl]),_:1})]),_:1}),Wl])])):i("",!0),a(v)=="record_ip"?(s(),n("tr",Jl,[Hl,l("td",null,[u(J,{modelValue:a(z),"onUpdate:modelValue":e[24]||(e[24]=t=>w(z)?z.value=t:null)},{default:r(()=>[u(b,{value:"black"},{default:r(()=>[p("黑名单")]),_:1}),u(b,{value:"white"},{default:r(()=>[p("白名单")]),_:1}),u(b,{value:"grey"},{default:r(()=>[p("灰名单")]),_:1})]),_:1},8,["modelValue"])])])):i("",!0),a(v)=="record_ip"?(s(),n("tr",ql,[zl,l("td",null,[a(Y)>0?(s(),n("div",Yl,[u(fe,{outlined:""},{default:r(()=>[p(_(a(_e))+" ",1),l("a",{href:"",onClick:I(Ce,["prevent"])},Xl)]),_:1})])):i("",!0),u(Ve,{size:"small",onClick:I(Se,["prevent"])},{default:r(()=>[p("+")]),_:1}),Zl])])):i("",!0),a(v)=="record_ip"?(s(),n("tr",eo,[to,l("td",null,[u(J,{modelValue:a(me),"onUpdate:modelValue":e[25]||(e[25]=t=>w(me)?me.value=t:null)},{default:r(()=>[(s(!0),n(C,null,M(a(he),t=>(s(),j(b,{value:t.code},{default:r(()=>[p(_(t.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])])])):i("",!0),a(v)=="record_ip"?(s(),n("tr",lo,[oo,l("td",null,[u(E,null,{default:r(()=>[u(F,{type:"text",style:{width:"6em"},maxlength:"9",modelValue:a(se),"onUpdate:modelValue":e[26]||(e[26]=t=>w(se)?se.value=t:null),onKeyup:e[27]||(e[27]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),u(D,null,{default:r(()=>[so]),_:1})]),_:1}),no])])):i("",!0),a(v)=="tag"?(s(),n("tr",ao,[uo,l("td",null,[u(Ae,{onChange:Ue,values:a(Q)},null,8,["values"])])])):i("",!0),a(v)=="page"?(s(),n("tr",io,[ro,l("td",null,[u(ge,{modelValue:a(W),"onUpdate:modelValue":e[28]||(e[28]=t=>w(W)?W.value=t:null)},null,8,["modelValue"])])])):i("",!0),a(v)=="page"&&!a(W)?(s(),n("tr",po,[vo,l("td",null,[u(F,{type:"text",style:{width:"4em"},maxlength:"3",modelValue:a(ne),"onUpdate:modelValue":e[29]||(e[29]=t=>w(ne)?ne.value=t:null),onKeyup:e[30]||(e[30]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"])])])):i("",!0),a(v)=="page"&&!a(W)?(s(),n("tr",mo,[co,l("td",null,[u(De,{modelValue:a(ae),"onUpdate:modelValue":e[31]||(e[31]=t=>w(ae)?ae.value=t:null),class:"w-full",rows:"5"},null,8,["modelValue"])])])):i("",!0),a(v)=="redirect"?(s(),n("tr",_o,[yo,l("td",null,[u(J,{modelValue:a(ue),"onUpdate:modelValue":e[32]||(e[32]=t=>w(ue)?ue.value=t:null)},{default:r(()=>[(s(!0),n(C,null,M(a(xe),t=>(s(),j(b,{value:t.code},{default:r(()=>[p(_(t.code)+" "+_(t.text),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])])])):i("",!0),a(v)=="redirect"?(s(),n("tr",fo,[ho,l("td",null,[u(F,{type:"text",modelValue:a(X),"onUpdate:modelValue":e[33]||(e[33]=t=>w(X)?X.value=t:null),class:"w-full",onKeyup:e[34]||(e[34]=k(t=>T(),["enter"])),onKeypress:k(I(t=>1,["prevent"]),["enter"])},null,8,["modelValue","onKeypress"]),l("p",ko,[p("支持在URL中使用类似于"),u(Me,null,{default:r(()=>[p("${host}")]),_:1}),p("之类的请求变量。")])])])):i("",!0),a(v)=="go_group"?(s(),n("tr",bo,[wo,l("td",null,[u(J,{modelValue:a(K),"onUpdate:modelValue":e[35]||(e[35]=t=>w(K)?K.value=t:null)},{default:r(()=>[u(b,{value:"0"},{default:r(()=>[p("[选择分组]")]),_:1}),o.vFirewallPolicy.inbound!=null&&o.vFirewallPolicy.inbound.groups!=null?(s(!0),n(C,{key:0},M(o.vFirewallPolicy.inbound.groups,t=>(s(),j(b,{value:t.id},{default:r(()=>[p("入站："+_(t.name),1)]),_:2},1032,["value"]))),256)):i("",!0),o.vGroupType=="outbound"&&o.vFirewallPolicy.outbound!=null&&o.vFirewallPolicy.outbound.groups!=null?(s(!0),n(C,{key:1},M(o.vFirewallPolicy.outbound.groups,t=>(s(),j(b,{value:t.id},{default:r(()=>[p("出站："+_(t.name),1)]),_:2},1032,["value"]))),256)):i("",!0)]),_:1},8,["modelValue"])])])):i("",!0),a(v)=="go_set"?(s(),n("tr",Vo,[$o,l("td",null,[u(J,{modelValue:a(K),"onUpdate:modelValue":e[36]||(e[36]=t=>w(K)?K.value=t:null)},{default:r(()=>[u(b,{value:"0"},{default:r(()=>[p("[选择分组]")]),_:1}),o.vFirewallPolicy.inbound!=null&&o.vFirewallPolicy.inbound.groups!=null?(s(!0),n(C,{key:0},M(o.vFirewallPolicy.inbound.groups,t=>(s(),j(b,{value:t.id},{default:r(()=>[p("入站："+_(t.name),1)]),_:2},1032,["value"]))),256)):i("",!0),o.vGroupType=="outbound"&&o.vFirewallPolicy.outbound!=null&&o.vFirewallPolicy.outbound.groups!=null?(s(!0),n(C,{key:1},M(o.vFirewallPolicy.outbound.groups,t=>(s(),j(b,{value:t.id},{default:r(()=>[p("出站："+_(t.name),1)]),_:2},1032,["value"]))),256)):i("",!0)]),_:1},8,["modelValue"])])])):i("",!0),a(v)=="go_set"&&a(A)!=null?(s(),n("tr",Io,[Po,l("td",null,[u(J,{modelValue:a(q),"onUpdate:modelValue":e[37]||(e[37]=t=>w(q)?q.value=t:null)},{default:r(()=>[u(b,{value:"0"},{default:r(()=>[p("[选择规则集]")]),_:1}),(s(!0),n(C,null,M(a(A).sets,t=>(s(),j(b,{value:t.id},{default:r(()=>[p(_(t.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue"])])])):i("",!0)],2),u(Be,{secondary:"",size:"small",type:"button",onClick:I(T,["prevent"])},{default:r(()=>[p("确定")]),_:1}),p("   "),l("a",{href:"",onClick:I(ke,["prevent"]),title:"取消"},No)])):i("",!0),a(H)?i("",!0):(s(),n("div",xo,[u(Ve,{size:"small",onClick:I(Ie,["prevent"])})])),Fo]))}},To=["value"],Co={class:"flex gap-3 items-center"},So=l("span",null,"匹配规则总分值",-1),Yo={__name:"HTTPFirewallScoreRulesBox",props:{scoreRules:{type:Array,default:[]}},setup(ee){const V=m(ee.scoreRules);(V.value==null||V.value.length==0)&&(V.value=[{operator:"gt",value:0,maxValue:0}]);const $=function(){V.value.forEach(x=>{x.value=parseInt(x.value),isNaN(x.value)&&(x.value=0),x.maxValue=parseInt(x.maxValue),isNaN(x.maxValue)&&(x.maxValue=0)})};return(x,P)=>(s(),n(C,null,[l("input",{type:"hidden",name:"scoreRulesJSON",value:JSON.stringify(V.value)},null,8,To),l("div",Co,[So,u(J,{modelValue:V.value[0].operator,"onUpdate:modelValue":P[0]||(P[0]=S=>V.value[0].operator=S)},{default:r(()=>[u(b,{name:"大于",value:"gt"}),u(b,{name:"大于等于",value:"gte"}),u(b,{name:"小于",value:"lt"}),u(b,{name:"小于等于",value:"lte"}),u(b,{name:"等于",value:"eq"}),u(b,{name:"不等于",value:"neq"}),u(b,{name:"范围",value:"between"})]),_:1},8,["modelValue"]),pe(l("span",null,"在",512),[[ye,V.value[0].operator=="between"]]),u(F,{style:{width:"6em"},maxlength:"5",placeholder:V.value[0].operator!="between"?"对比数值":"最小值",modelValue:V.value[0].value,"onUpdate:modelValue":P[1]||(P[1]=S=>V.value[0].value=S),onInput:P[2]||(P[2]=S=>$())},null,8,["placeholder","modelValue"]),pe(l("span",null,"和",512),[[ye,V.value[0].operator=="between"]]),pe(u(F,{style:{width:"6em"},maxlength:"4",placeholder:"最大值",modelValue:V.value[0].maxValue,"onUpdate:modelValue":P[3]||(P[3]=S=>V.value[0].maxValue=S),onInput:P[4]||(P[4]=S=>$())},null,8,["modelValue"]),[[ye,V.value[0].operator=="between"]]),pe(l("span",null,"之间",512),[[ye,V.value[0].operator=="between"]])])],64))}};export{qo as _,Yo as a,zo as b};
