import{aa as b,r as d,J as A,o as n,g as i,a as l,u as a,F as D,D as F,c as P,w as U,t as m,h as u,n as v,f as w,i as h,b as $,L,bb as M}from"./app-SC54XQDl.js";import{u as G}from"./app-Ba7ZqSpq.js";import{T as I}from"./app-DoVkxbmA.js";import{_ as J}from"./app-CVQkwzlf.js";const j=["value"],z={key:0,class:"label-group"},O={key:0},q=["onClick"],H=l("i",{class:"icon pencil small"},null,-1),K=[H],Q=["onClick"],W=l("i",{class:"icon remove"},null,-1),X=[W],Y={class:"ui fields inline"},Z={class:"ui field"},ee={key:0,class:"ui field"},se=l("span",{class:"grey"},"|",-1),te=[se],ne={key:1,class:"ui field"},oe=l("i",{class:"icon search small"},null,-1),ie=[oe],le=l("i",{class:"icon close small"},null,-1),ae=[le],ue={key:2,class:"ui field"},he={__name:"ServerNameBox",props:["v-server-names","autoSubmit"],setup(E,{expose:C}){const r=G();b("$Tea");const p=E,N=d(),k=d(),{serverNames:o,isSearching:c,keyword:f}=function(){let t=p.vServerNames;return t==null&&(t=[]),{serverNames:d(t),isSearching:d(!1),keyword:d("")}}(),g=function(){window.UPDATING_SERVER_NAME=null,r.popup("/servers/addServerNamePopup",{callback:function(t){var e=t.data.serverName;o.value.push(e),setTimeout(y,100)}})},T=function(t){o.value.$remove(t)},R=function(t,e){window.UPDATING_SERVER_NAME=r.clone(e),r.popup("/servers/addServerNamePopup",{callback:function(s){o.value[t]=s.data.serverName,setTimeout(y,100)}})},S=function(){c.value=!c.value,c.value?setTimeout(function(){k.value.focus()},200):f.value=""},V=function(){if(o.value==null)return[];let t=[];return o.value.forEach(function(e){e.subNames!=null&&e.subNames.length>0?e.subNames.forEach(function(s){s!=null&&s.length>0&&(t.$contains(s)||t.push(s))}):e.name!=null&&e.name.length>0&&(t.$contains(e.name)||t.push(e.name))}),t},x=b("$postForm"),y=function(){(typeof p.autoSubmit=="string"||p.autoSubmit)&&setTimeout(()=>x.exposed.submit(),200)};return A(f,function(t){o.value.forEach(function(e){if(t.length==0){e.isShowing=!0;return}if(e.subNames==null||e.subNames.length==0)r.match(e.name,t)?e.isShowing=!0:e.isShowing=!1;else{let s=!1;e.subNames.forEach(function(_){r.match(_,t)&&(s=!0)}),e.isShowing=s}})}),C({addServerName:g,allServerNames:V}),(t,e)=>(n(),i("div",null,[l("input",{type:"hidden",name:"serverNames",value:JSON.stringify(a(o)),ref_key:"serverNamesRef",ref:N},null,8,j),a(o).length>0?(n(),i("div",z,[(n(!0),i(D,null,F(a(o),(s,_)=>(n(),P(I,{outlined:"",class:v({hidden:s.isShowing===!1})},{default:U(()=>[s.type!="full"?(n(),i("em",O,m(s.type),1)):u("",!0),s.subNames==null||s.subNames.length==0?(n(),i("span",{key:1,class:v({disabled:s.isShowing===!1})},m(s.name),3)):(n(),i("span",{key:2,class:v({disabled:s.isShowing===!1})},m(s.subNames[0])+"等"+m(s.subNames.length)+"个域名",3)),w("  "),l("a",{href:"",title:"修改",onClick:h(B=>R(_,s),["prevent"])},K,8,q),w("  "),l("a",{href:"",title:"删除",onClick:h(B=>T(_),["prevent"])},X,8,Q)]),_:2},1032,["class"]))),256)),$(L)])):u("",!0),l("div",Y,[l("div",Z,[l("a",{href:"",onClick:e[0]||(e[0]=h(s=>g(),["prevent"]))},"[添加域名绑定]")]),a(o).length>0?(n(),i("div",ee,te)):u("",!0),a(o).length>0?(n(),i("div",ne,[a(c)?u("",!0):(n(),i("a",{key:0,href:"",onClick:e[1]||(e[1]=h(s=>S(),["prevent"]))},ie)),a(c)?(n(),i("a",{key:1,href:"",onClick:e[2]||(e[2]=h(s=>S(),["prevent"]))},ae)):u("",!0)])):u("",!0),a(c)?(n(),i("div",ue,[$(J,{type:"text",placeholder:"搜索域名",ref_key:"keywordRef",ref:k,modelValue:a(f),"onUpdate:modelValue":e[3]||(e[3]=s=>M(f)?f.value=s:null)},null,8,["modelValue"])])):u("",!0)])]))}};export{he as _};
