import{r as v,o as l,g as c,a as s,u as i,F as x,D as B,c as V,w as d,f as t,t as N,i as f,b as n,L as k,h,bb as K,a_ as C}from"./app-DnroACXc.js";import{u as z}from"./app-DckefXYL.js";import{_ as P}from"./app-DPkDcD7h.js";import{T as R}from"./app-LqsmzyUT.js";import{C as L}from"./app-Do8DhyKT.js";import{P as U}from"./app-z7Z_Uo-k.js";import{T as A}from"./app-B8VsrFxM.js";const D=["value"],F={key:0,class:"label-group"},J=["onClick"],O=s("i",{class:"icon remove small"},null,-1),E=[O],H={key:1},I={class:"ui fields inline"},M={class:"ui field"},j={class:"ui field"},q=s("i",{class:"icon remove small"},null,-1),G=[q],Q={class:"comment"},W={key:2,style:{"margin-top":"0.5em"}},oe={__name:"HTTPStatusBox",props:["v-status-list"],setup(S){const p=z(),b=S,u=v(),{statusList:a,isAdding:m,addingStatus:e}=function(){let o=b.vStatusList;return o==null&&(o=[]),{statusList:v(o),isAdding:v(!1),addingStatus:v("")}}(),w=function(){m.value=!0,setTimeout(function(){u.value.focus()},100)},y=function(){if(e.value=e.value.replace(/\s/g,"").toUpperCase(),e.value.length==0){p.warn("请输入要添加的状态码",function(){u.value.focus()});return}if(a.value.$contains(e.value)){p.warn("此状态码已经存在，无需重复添加",function(){u.value.focus()});return}if(!e.value.match(/^\d{3}$/)){p.warn("请输入正确的状态码",function(){u.value.focus()});return}a.value.push(parseInt(e.value,10)),g()},T=function(o){a.value.$remove(o)},g=function(){m.value=!1,e.value=""};return(o,_)=>(l(),c("div",null,[s("input",{type:"hidden",name:"statusListJSON",value:JSON.stringify(i(a))},null,8,D),i(a).length>0?(l(),c("div",F,[(l(!0),c(x,null,B(i(a),(r,$)=>(l(),V(A,{outlined:""},{default:d(()=>[t(N(r)+"   ",1),s("a",{href:"",title:"删除",onClick:f(X=>T($),["prevent"])},E,8,J)]),_:2},1024))),256)),n(k)])):h("",!0),i(m)?(l(),c("div",H,[s("div",I,[s("div",M,[n(P,{type:"text",modelValue:i(e),"onUpdate:modelValue":_[0]||(_[0]=r=>K(e)?e.value=r:null),onKeyup:_[1]||(_[1]=C(r=>y(),["enter"])),onKeypress:C(f(r=>1,["prevent"]),["enter"]),ref_key:"addingStatusRef",ref:u,placeholder:"如200",size:"3",maxlength:"3",style:{width:"5em"}},null,8,["modelValue","onKeypress"])]),s("div",j,[n(R,{secondary:"",size:"small",type:"button",onClick:f(y,["prevent"])},{default:d(()=>[t("确定")]),_:1}),t("   "),s("a",{href:"",title:"取消",onClick:f(g,["prevent"])},G)])]),s("p",Q,[t("格式为三位数字，比如 "),n(L,null,{default:d(()=>[t("200")]),_:1}),t(" 、 "),n(L,null,{default:d(()=>[t("404")]),_:1}),t(" 等。 ")]),n(k)])):h("",!0),i(m)?h("",!0):(l(),c("div",W,[n(U,{secondary:"",size:"small",type:"button",onClick:f(w,["prevent"])},{default:d(()=>[t("+")]),_:1})]))]))}};export{oe as _};
