import{_ as A}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as O}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{c as L,n as T,p as N}from"./index-BTglIPU2.js?v=1773287522785";import{u as U}from"./useTableColumns-DDeyYvje.js?v=1773287522785";import{u as B}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{B as M,C as D,D as I}from"./setting-DouXuJGW.js?v=1773287522785";import{_ as q}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{k as P,an as V,c as j,$ as y,Z as C,_ as p,aa as v,L as $,S as s,F,P as H,ao as K,R as k,r as w,e as z,a0 as r,a9 as h,j as G}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as Y,a6 as Z,b as J,B as Q}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";const X={class:"param-list"},ee=["onClick"],te=P({__name:"param",props:{value:{default:()=>[]},valueModifiers:{}},emits:K(["change"],["update:value"]),setup(b,{emit:l}){const _=l,o=V(b,"value"),n=["POST","GET","PUT","OPTIONS","HEAD","DELETE","TRACE","PATCH","MOVE","COPY","LINK","UNLINK","WRAPPED","PROPFIND","PROPPATCH","MKCOL","CONNECT","SRARCH"],f=a=>o.value.includes(a),i=j(()=>n.length===o.value.length),t=()=>{o.value=[],i.value||(o.value=n.map(a=>a)),_("change")},e=a=>{const m=o.value.indexOf(a);m===-1?o.value.push(a):o.value.splice(m,1),_("change")};return(a,m)=>(y(),C("div",X,[p("div",{class:$(["param-item",{active:s(i)}]),onClick:t},v(a.$t("Public.SelectAll")),3),(y(),C(F,null,H(n,c=>p("div",{key:c,class:$(["param-item",{active:f(c)}]),onClick:S=>e(c)},v(c),11,ee)),64))]))}}),ae=L(te,[["__scopeId","data-v-d6f769f3"]]),ne={class:"p-20px"},oe={class:"w-100px mr-8px"},se={class:"w-220px"},le={class:"w-328px"},re=P({__name:"form",props:{isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(b,{expose:l,emit:_}){const o=_,{t:n}=k(),f=w(null),i=w(null),t=z({type:"refuse",url:"",param:[]}),e=[{label:n("Waf.Setting.config_111"),value:"refuse"},{label:n("Waf.Setting.config_110"),value:"accept"}],a={url:{trigger:["blur","input"],validator:()=>t.url.trim()===""?new Error(n("Waf.Setting.config_55")):!0},param:{validator:()=>t.param.length===0?new Error(n("Waf.Setting.config_112")):!0}},m=()=>{var u;(u=i.value)==null||u.restoreValidation()},c=()=>({type:t.type,url:t.url,param:t.param.join(",")});return l({onConfirm:async()=>{var u;await((u=f.value)==null?void 0:u.validate()),await M(c()),o("refresh")}}),(u,d)=>{const x=Z,E=J,R=Y,W=q;return y(),C("div",ne,[r(W,{ref_key:"formRef",ref:f,model:s(t),rules:a},{default:h(()=>[r(R,{label:u.$t("Waf.Setting.config_73"),path:"url"},{default:h(()=>[p("div",oe,[r(x,{value:s(t).type,"onUpdate:value":d[0]||(d[0]=g=>s(t).type=g),options:e},null,8,["value"])]),p("div",se,[r(E,{value:s(t).url,"onUpdate:value":d[1]||(d[1]=g=>s(t).url=g),placeholder:"URL"},null,8,["value"])])]),_:1},8,["label"]),r(R,{ref_key:"paramItemRef",ref:i,label:u.$t("Waf.Setting.config_65"),path:"param"},{default:h(()=>[p("div",le,[r(ae,{value:s(t).param,"onUpdate:value":d[2]||(d[2]=g=>s(t).param=g),onChange:m},null,8,["value"])])]),_:1},8,["label"])]),_:1},8,["model"])])}}}),ie={class:"p-20px"},ce={class:"flex mb-16px"},$e=P({__name:"config",setup(b){const{t:l}=k(),_=e=>{N({title:e.title,width:550,footer:!0,data:{...e.data,onRefresh:()=>{t()}},component:re})},o=async()=>{_({title:l("Waf.Setting.config_64"),data:{isEdit:!1}})},{table:n,columns:f,setLoading:i}=B([{key:"url",title:"URL",ellipsis:{tooltip:!0}},{key:"type",title:l("Waf.Setting.config_73"),width:80,ellipsis:{tooltip:!0},render:e=>e.type==="refuse"?l("Waf.Setting.config_111"):l("Waf.Setting.config_110")},{key:"mode",title:l("Waf.Setting.config_93"),width:216,ellipsis:{tooltip:!0},render:e=>Object.entries(e.mode).map(([,a])=>a).join(", ")},U({width:60,options:e=>[{label:l("Public.Btn.Del"),onClick:async()=>{await D({url:e.url}),t()}}]})]),t=async()=>{try{i(!0);const{message:e}=await I();n.data=T(e)?e:[]}finally{i(!1)}};return t(),(e,a)=>{const m=Q,c=O,S=A;return y(),C("div",ie,[p("div",ce,[r(m,{type:"primary",onClick:o},{default:h(()=>[G(v(e.$t("Public.Btn.Add")),1)]),_:1})]),r(c,{"max-height":270,loading:s(n).loading,data:s(n).data,columns:s(f)},null,8,["loading","data","columns"]),r(S,{class:"mt-12px"},{default:h(()=>[p("li",null,v(e.$t("Waf.Setting.config_108")),1),p("li",null,v(e.$t("Waf.Setting.config_109")),1)]),_:1})])}}});export{$e as default};
