import{r as k,o as s,g as n,a as t,u as r,F as v,D as b,n as S,ae as y,t as m,b as d,w as p,f as _,h as i,c as z,i as g,L as E}from"./app-BYcXwl4U.js";import{u as R}from"./app-a6cKceqE.js";import"./app-MtOp7vk3.js";import{T as x}from"./app-CrjU8lgK.js";import{a as w,_ as L}from"./app-DxbU-QrX.js";import{T as C}from"./app-D2Wz0BUQ.js";const A=["value"],F={key:0},J={class:"ui table definition"},M={class:"label-group"},q={key:0,style:{"font-style":"normal"}},H={key:1,style:{"font-style":"normal"}},Q={key:2,title:"不区分大小写"},j=t("i",{class:"icon info small"},null,-1),K=[j],W={key:0},X={key:1},Y=["onClick"],Z=t("i",{class:"icon pencil small"},null,-1),I=[Z],tt=["onClick"],et=t("i",{class:"icon remove"},null,-1),ot=[et],st={key:1,class:"ui table definition"},nt=t("td",{class:"title"},"分组之间关系",-1),rt={class:"comment"},at={key:0},lt={key:1},mt={__name:"HTTPRequestCondsBox",props:["v-conds"],emits:["change"],setup(N,{emit:T}){const f=R(),O=N,G=T,{conds:e,components:P}=function(){let o=O.vConds;return o==null&&(o={isOn:!0,connector:"or",groups:[]}),o.groups==null&&(o.groups=[]),{conds:k(o),components:k(window.REQUEST_COND_COMPONENTS)}}(),h=function(){G("change",e.value)},$=function(){window.UPDATING_COND_GROUP=null,f.popup("/servers/server/settings/conds/addGroupPopup",{width:"40em",callback:function(o){e.value.groups.push(o.data.group),h()}})},D=function(o,c){window.UPDATING_COND_GROUP=c,f.popup("/servers/server/settings/conds/addGroupPopup",{width:"40em",callback:function(a){e.value.groups[o]=a.data.group,h()}})},U=function(o){f.confirm("确定要删除这一组条件吗？",function(){e.value.groups.$remove(o),h()})},V=function(o){let c=P.value.$find(function(a,u){return u.type==o.type});return c!=null?c.name:o.param+" "+o.operator};return(o,c)=>(s(),n("div",null,[t("input",{type:"hidden",name:"condsJSON",value:JSON.stringify(r(e))},null,8,A),r(e).groups.length>0?(s(),n("div",F,[t("table",J,[(s(!0),n(v,null,b(r(e).groups,(a,u)=>(s(),n("tr",null,[t("td",{class:S(["title",{"color-border":r(e).connector=="and"}]),style:y({"border-bottom":u<r(e).groups.length-1?"1px solid rgba(34,36,38,.15)":""})},"分组"+m(u+1),7),t("td",{style:y([{background:"white","word-break":"break-all"},{"border-bottom":u<r(e).groups.length-1?"1px solid rgba(34,36,38,.15)":""}])},[t("div",M,[(s(!0),n(v,null,b(a.conds,(l,B)=>(s(),n(v,null,[d(C,{outlined:"",size:"small"},{default:p(()=>[l.type.length==0||l.type=="params"?(s(),n("var",q,[_(m(l.param)+" ",1),t("var",null,m(l.operator),1)])):i("",!0),l.type.length>0&&l.type!="params"?(s(),n("var",H,m(V(l))+": ",1)):i("",!0),_(" "+m(l.value)+" ",1),l.isCaseInsensitive?(s(),n("sup",Q,K)):i("",!0)]),_:2},1024),B<a.conds.length-1?(s(),z(C,{key:0},{default:p(()=>[a.connector=="or"?(s(),n("span",W,"或")):i("",!0),a.connector=="and"?(s(),n("span",X,"和")):i("",!0)]),_:2},1024)):i("",!0)],64))),256))])],4),t("td",{style:y([{width:"5em",background:"white"},{"border-bottom":u<r(e).groups.length-1?"1px solid rgba(34,36,38,.15)":""}])},[t("a",{href:"",title:"修改分组",onClick:g(l=>D(u,a),["prevent"])},I,8,Y),_("  "),t("a",{href:"",title:"删除分组",onClick:g(l=>U(u),["prevent"])},ot,8,tt)],4)]))),256))]),d(E)])):i("",!0),r(e).groups.length>1?(s(),n("table",st,[t("tr",null,[nt,t("td",null,[d(L,{modelValue:r(e).connector,"onUpdate:modelValue":c[0]||(c[0]=a=>r(e).connector=a)},{default:p(()=>[d(w,{value:"and"},{default:p(()=>[_("和")]),_:1}),d(w,{value:"or"},{default:p(()=>[_("或")]),_:1})]),_:1},8,["modelValue"]),t("p",rt,[r(e).connector=="or"?(s(),n("span",at,"只要满足其中一个条件分组即可。")):i("",!0),r(e).connector=="and"?(s(),n("span",lt,"需要满足所有条件分组。")):i("",!0)])])])])):i("",!0),t("div",null,[d(x,{secondary:"",size:"small",type:"button",onClick:c[1]||(c[1]=g(a=>$(),["prevent"]))},{default:p(()=>[_("+添加分组")]),_:1})])]))}};export{mt as _};
