import{o as n,c as _,w as o,b as a,a as t,u as s,f as d,g as l,D as m,t as h,F as f,h as g,d as u,e as c}from"./app-BYcXwl4U.js";import{P as S}from"./app-Doj30F-n.js";import{i as T,c as C}from"./app-a6cKceqE.js";import{_ as b,a as v}from"./app-DxbU-QrX.js";import{_ as y}from"./app-DwtlHtUX.js";import{_ as $}from"./app-CignoBaV.js";import{T as x}from"./app-CrjU8lgK.js";import{_ as w}from"./app-CQ-vNlMj.js";import{D as V}from"./app-7GBSHA5C.js";import"./app-Ceh-tphd.js";import"./app-Cp3gmk2J.js";import"./app--MWyBMkA.js";import"./app-BG60hdvp.js";import"./app-CNARLpXE.js";import"./app-SxAW7vhf.js";import"./app-D5k1HLu9.js";import"./app-ysQ8KbGS.js";import"./app-BDgR0DSb.js";import"./app-BHl80pFw.js";function k(){T(this),this.targetType="",this.countServers=-1,this.targets=[],this.reloadCountServers=function(){this.countServers=-1,this.$post(".countServers").params({targets:this.targets}).success(function(e){this.countServers=e.data.countServers})},this.changeTargetType=function(){this.targets=[],this.countServers=-1,this.targetType.match(/^(user):/)&&(this.targets=[this.targetType],this.reloadCountServers())};let i=[];this.changeGroupId=function(e){i.$contains(e)?i.$removeValue(e):i.push(e),i.length>0?(this.targets=["groups:"+i.join(",")],this.reloadCountServers()):(this.targets=[],this.countServers=-1)},this.isRequesting=!1,this.before=function(){this.isRequesting=!0},this.done=function(){this.isRequesting=!1}}const B=t("header",null,"批量复制配置",-1),D=["value"],I=["value"],R=["value"],N=t("td",{class:"title"},"将当前配置复制到",-1),q={key:0,class:"comment"},F=t("td",null,"同时拷贝国家/地区/省份封禁",-1),O=t("p",{class:"comment"},"WAF设置专有选项。",-1),P=t("td",null,"分组",-1),A={class:"grid grid-cols-3 gap-2"},J=t("tr",null,[t("td",null,"网站"),t("td")],-1),L=[J],W=t("td",null,"目标网站数量",-1),j={key:0},E={key:1},G={key:0},U=t("td",null,"提醒",-1),z=t("td",null,[t("span",{class:"red"},"此操作无法撤销，请谨慎确认！")],-1),H=[U,z],mt={__name:"index",setup(i){const e=C(new k);return(K,p)=>(n(),_(S,null,{default:o(()=>[B,a(w,{action:"$",onSuccess:s(e).success,onDone:s(e).done,onBefore:s(e).before},{default:o(()=>[t("input",{type:"hidden",name:"serverId",value:s(e).serverId},null,8,D),t("input",{type:"hidden",name:"configCode",value:s(e).configCode},null,8,I),t("input",{type:"hidden",name:"targetsJSON",value:JSON.stringify(s(e).targets)},null,8,R),a(V,null,{default:o(()=>[t("tbody",null,[t("tr",null,[N,t("td",null,[a(b,{modelValue:s(e).targetType,"onUpdate:modelValue":p[0]||(p[0]=r=>s(e).targetType=r),onChange:s(e).changeTargetType},{default:o(()=>[a(v,{value:""},{default:o(()=>[d("[选择目标]")]),_:1}),(n(!0),l(f,null,m(s(e).targetOptions,r=>(n(),_(v,{value:r.code},{default:o(()=>[d(h(r.name),1)]),_:2},1032,["value"]))),256))]),_:1},8,["modelValue","onChange"]),s(e).configCode=="waf"?(n(),l("p",q,"目前只能同步WAF设置的启用和停用，不能复制规则、IP名单等。")):g("",!0)])])]),u(t("tbody",null,[t("tr",null,[F,t("td",null,[a(y,{name:"wafCopyRegions"}),O])])],512),[[c,s(e).configCode=="waf"]]),u(t("tbody",null,[u(t("tr",null,[P,t("td",null,[t("div",A,[(n(!0),l(f,null,m(s(e).userGroups,r=>(n(),_(y,{"v-value":r.id,onInput:M=>s(e).changeGroupId(r.id)},{default:o(()=>[d(h(r.name),1)]),_:2},1032,["v-value","onInput"]))),256))])])],512),[[c,s(e).userId>0]])],512),[[c,s(e).targetType=="group"]]),u(t("tbody",null,L,512),[[c,s(e).targetType=="server"]]),t("tbody",null,[t("tr",null,[W,t("td",null,[s(e).countServers<0?(n(),l("span",j,"-")):(n(),l("span",E,[t("strong",null,h(s(e).countServers)+"个",1)]))])]),s(e).countServers>0?(n(),l("tr",G,H)):g("",!0)])]),_:1}),u(a($,null,{default:o(()=>[d("确认复制")]),_:1},512),[[c,!s(e).isRequesting]]),u(a(x,{secondary:"",type:"button"},{default:o(()=>[d("正在复制...")]),_:1},512),[[c,s(e).isRequesting]])]),_:1},8,["onSuccess","onDone","onBefore"])]),_:1}))}};export{mt as default};
