import{r as v,o as a,g as r,a as s,u as i,F as w,D as x,c as N,w as d,f as t,t as K,i as c,b as o,L as k,h as p,bb as L,a_ as T}from"./app-BYcXwl4U.js";import{u as P}from"./app-a6cKceqE.js";import{T as S}from"./app-D2Wz0BUQ.js";import{_ as z}from"./app-Ufpj4Ll4.js";import{T as E}from"./app-CrjU8lgK.js";import{C}from"./app-iaXXZg9Y.js";import{P as O}from"./app-0YmIdYYs.js";const R=["value"],U={key:0,class:"label-group"},A=["onClick"],D=s("i",{class:"icon remove small"},null,-1),F=[D],G={key:1},J={class:"ui fields inline"},H={class:"ui field"},j={class:"ui field"},q=s("i",{class:"icon remove small"},null,-1),I=[q],Q={class:"comment"},W={key:2,style:{"margin-top":"0.5em"}},le={__name:"HTTPMethodsBox",props:["v-methods"],setup(b){const h=P(),B=b,f=v(),{methods:n,isAdding:m,addingMethod:e}=function(){let l=B.vMethods;return l==null&&(l=[]),{methods:v(l),isAdding:v(!1),addingMethod:v("")}}(),M=function(){m.value=!0,setTimeout(function(){f.value.focus()},100)},y=function(){if(e.value=e.value.replace(/\s/g,"").toUpperCase(),e.value.length==0){h.warn("请输入要添加的请求方法",function(){f.value.focus()});return}if(n.value.$contains(e.value)){h.warn("此请求方法已经存在，无需重复添加",function(){f.value.focus()});return}n.value.push(e.value),g()},V=function(l){n.value.$remove(l)},g=function(){m.value=!1,e.value=""};return(l,_)=>(a(),r("div",null,[s("input",{type:"hidden",name:"methodsJSON",value:JSON.stringify(i(n))},null,8,R),i(n).length>0?(a(),r("div",U,[(a(!0),r(w,null,x(i(n),(u,$)=>(a(),N(S,{outlined:""},{default:d(()=>[t(K(u)+"   ",1),s("a",{href:"",title:"删除",onClick:c(X=>V($),["prevent"])},F,8,A)]),_:2},1024))),256)),o(k)])):p("",!0),i(m)?(a(),r("div",G,[s("div",J,[s("div",H,[o(z,{type:"text",modelValue:i(e),"onUpdate:modelValue":_[0]||(_[0]=u=>L(e)?e.value=u:null),onKeyup:_[1]||(_[1]=T(u=>y(),["enter"])),onKeypress:T(c(u=>1,["prevent"]),["enter"]),ref_key:"addingMethodRef",ref:f,placeholder:"如GET",size:"10"},null,8,["modelValue","onKeypress"])]),s("div",j,[o(E,{secondary:"",size:"small",type:"button",onClick:c(y,["prevent"])},{default:d(()=>[t("确定")]),_:1}),t("   "),s("a",{href:"",title:"取消",onClick:c(g,["prevent"])},I)])]),s("p",Q,[t("格式为大写，比如 "),o(C,null,{default:d(()=>[t("GET")]),_:1}),t(" 、 "),o(C,null,{default:d(()=>[t("POST")]),_:1}),t(" 等。 ")]),o(k)])):p("",!0),i(m)?p("",!0):(a(),r("div",W,[o(O,{secondary:"",size:"small",type:"button",onClick:c(M,["prevent"])},{default:d(()=>[t("+")]),_:1})]))]))}};export{le as _};
