import{_ as B}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{m as N,cm as O,i as R}from"./index-BTglIPU2.js?v=1773287522785";import{u as E}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{i as I}from"./index-BsHsIKON.js?v=1773287522785";import{k as L,R as F,r as g,e as U,am as D,$ as h,Z as H,a0 as a,a9 as s,_ as b,S as i,a8 as T,j as r,aa as Z,ak as q,F as z}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as A,au as G,b as J,av as K,a6 as Q}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DgjjuUjT.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-B7YvCBmY.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-C5hb-Th7.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import"./useTableColumns-DDeyYvje.js?v=1773287522785";import"./index-S15tYq5l.js?v=1773287522785";import"./copy-D-wIKr0q.js?v=1773287522785";import"./index-DIKmrNCq.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DeTfbeeM.js?v=1773287522785";import"./index-Cg6fMjw6.js?v=1773287522785";import"./useTableData-BmkIKQ_R.js?v=1773287522785";import"./mail-COTHIXbY.js?v=1773287522785";const X={class:"p-20px pt-24px pb-8px"},Y={class:"w-240px"},ee={class:"w-240px"},we=L({__name:"install",props:{domain:{type:Object}},emits:["refresh"],setup(l,{expose:x,emit:w}){const k=w,{t:u}=F(),c=g(null),e=U({domain:"",php_version:null}),y={domain:{trigger:"change",validator:()=>e.domain.trim()===""?new Error(u("Mail.Setting.index_20")):!0},php_version:{trigger:"change",validator:()=>e.php_version===null?new Error(u("Mail.Setting.index_21")):!0}},d=g([]),M=async()=>{const{message:n}=await O();if(R(n)){d.value=n.versions.reverse().map(t=>({label:t.name,value:t.version}));const o=n.versions.findIndex(t=>t.version==="74");o!==-1?e.php_version=n.versions[o].version:e.php_version=n.versions[0].version}},{loading:S,setLoading:f}=E(),C=async()=>{try{f(!0),await Promise.all([M()])}finally{f(!1)}},P=D(),$=async()=>{var o,t,p;await((o=c.value)==null?void 0:o.validate()),await I({webmail_domain:"".concat(e.domain,".").concat(((t=l.domain)==null?void 0:t.domain)||""),php_version:e.php_version||"",domain:((p=l.domain)==null?void 0:p.domain)||""});const{close:n}=N.success({content:()=>a(z,null,[r("WebMail Installation Successful, "),a("br",null,null),r(' Manage WebMail view in "'),a("a",{class:"bt-link",href:"javascript:;",onClick:()=>{P.push("/site/php"),n()}},[r("Website > PHP Project")]),r('"')]),close:!0,maxWidth:480});k("refresh")};return C(),x({onConfirm:$}),(n,o)=>{const t=J,p=K,j=G,v=A,V=Q,W=B;return h(),H("div",X,[a(W,{ref_key:"formRef",ref:c,model:i(e),rules:y},{default:s(()=>[a(v,{label:n.$t("Mail.Setting.index_18"),path:"domain"},{default:s(()=>[b("div",Y,[a(j,null,{default:s(()=>{var m;return[a(t,{value:i(e).domain,"onUpdate:value":o[0]||(o[0]=_=>i(e).domain=_)},null,8,["value"]),(m=l.domain)!=null&&m.domain?(h(),T(p,{key:0},{default:s(()=>{var _;return[r(" ."+Z((_=l.domain)==null?void 0:_.domain),1)]}),_:1})):q("",!0)]}),_:1})])]),_:1},8,["label"]),a(v,{label:n.$t("Mail.Setting.index_19"),path:"php_version"},{default:s(()=>[b("div",ee,[a(V,{value:i(e).php_version,"onUpdate:value":o[1]||(o[1]=m=>i(e).php_version=m),loading:i(S),options:i(d)},null,8,["value","loading","options"])])]),_:1},8,["label"])]),_:1},8,["model"])])}}});export{we as default};
