import{o,c as m,w as a,b as c,a as s,u as t,g as r,h as l,F as p,D as h,f as u,t as d,i as y}from"./app-SC54XQDl.js";import{P as b}from"./app-BGgVpkqZ.js";import{i as k,c as x}from"./app-Ba7ZqSpq.js";import{_ as N}from"./app-DFulsyXy.js";import{_ as $,a as v}from"./app-PrSv7rSt.js";import{_ as B}from"./app-CVQkwzlf.js";import{_ as C}from"./app-DWUwCFNm.js";import{T}from"./app-CNHjdV6U.js";import{T as V}from"./app-DoVkxbmA.js";import{D as q}from"./app-ZeVDYyDS.js";import"./app-yUrwy8EY.js";import"./app-BZGObKCm.js";import"./app-BPIIxVwk.js";import"./app-PPG0ZS4d.js";import"./app-DgoEZtNT.js";import"./app-Ch8j4za4.js";import"./app-Dw0jKdCD.js";import"./app-DnXuoh8P.js";import"./app-CCkWSX4Q.js";import"./app-C2mBgI5Z.js";function w(){const{utils:_,Tea:e}=k(this);this.isRequesting=!1,this.userId=0,this.remove=function(i){this.serverNames.$remove(i)},this.beforeSubmit=function(){this.isRequesting=!0},this.fail=function(i){this.isRequesting=!1,_.warn(i.message),i.data.acmeUser!=null&&(this.users.push({id:i.data.acmeUser.id,email:i.data.acmeUser.email,description:""}),this.userId=i.data.acmeUser.id)}}const R=s("header",null,"申请免费证书",-1),I=s("td",{class:"title"},"证书包含的域名 *",-1),S={key:0,class:"disabled"},U={key:1,class:"label-group"},D=["value"],F=["onClick"],E=s("i",{class:"icon remove"},null,-1),L=[E],P=s("td",null,"证书用户 *",-1),M={key:0},j=s("p",{class:"comment"},"用来申请证书的用户。",-1),z={key:1},A=s("p",{class:"comment"},"用来申请证书的用户邮箱，可以任意填写，只要格式正确即可。",-1),ce={__name:"requestCertPopup",setup(_){const e=x(new w);return(i,f)=>(o(),m(b,null,{default:a(()=>[R,c(N,{onSuccess:t(e).success,action:"$",timeout:"300",onBefore:t(e).beforeSubmit,onFail:t(e).fail},{default:a(()=>[c(q,null,{default:a(()=>[s("tbody",null,[s("tr",null,[I,s("td",null,[t(e).serverNames.length==0?(o(),r("span",S,"还没有需要申请证书的域名，暂时不能申请。")):l("",!0),t(e).serverNames.length>0?(o(),r("div",U,[(o(!0),r(p,null,h(t(e).serverNames,(n,g)=>(o(),m(V,{outlined:""},{default:a(()=>[s("input",{type:"hidden",name:"serverNames",value:n},null,8,D),u(" "+d(n)+" ",1),s("a",{href:"",title:"删除",onClick:y(G=>t(e).remove(g),["prevent"])},L,8,F)]),_:2},1024))),256))])):l("",!0)])]),s("tr",null,[P,s("td",null,[t(e).users.length>0?(o(),r("div",M,[c($,{name:"userId",modelValue:t(e).userId,"onUpdate:modelValue":f[0]||(f[0]=n=>t(e).userId=n)},{default:a(()=>[c(v,{value:"0"},{default:a(()=>[u("[请选择]")]),_:1}),(o(!0),r(p,null,h(t(e).users,n=>(o(),m(v,{value:n.id},{default:a(()=>[u(d(n.email)+d(n.description),1)]),_:2},1032,["value"]))),256)),u("> ")]),_:1},8,["modelValue"]),j])):l("",!0),t(e).users.length==0?(o(),r("div",z,[c(B,{name:"userEmail",maxlength:"100",placeholder:"用户E-mail",autofocus:"",class:"w-full"}),A])):l("",!0)])])])]),_:1}),t(e).isRequesting?l("",!0):(o(),m(C,{key:0},{default:a(()=>[u("提交")]),_:1})),t(e).isRequesting?(o(),m(T,{key:1,secondary:"",type:"button"},{default:a(()=>[u("处理中...")]),_:1})):l("",!0)]),_:1},8,["onSuccess","onBefore","onFail"])]),_:1}))}};export{ce as default};
