import{i as N,v as E,h as H,x as I,hp as T,m as U}from"./index-BTglIPU2.js?v=1773287522785";import{_ as j}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as q}from"./index.vue_vue_type_script_setup_true_lang-BeO8Hyma.js?v=1773287522785";import{u as A}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{u as Z}from"./useTableData-BmkIKQ_R.js?v=1773287522785";import{am as F,an as G,ao as J,ap as K,aq as Q}from"./mail-COTHIXbY.js?v=1773287522785";import{_ as W}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{k as C,R as B,r as D,e as X,$ as L,Z as O,a0 as o,S as s,a9 as p,_ as M,aa as w,N as Y,am as tt,a8 as et,j as $}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as nt,b as st,B as ot}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{_ as at}from"./index-lEMZglLp.js?v=1773287522785";import{u as it}from"./useLoop-BadgF3pN.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";const lt={class:"p-20px"},rt={class:"w-260px"},ct=C({__name:"hostname",emits:["refresh"],setup(P,{expose:b,emit:h}){const n=h,{t:d}=B(),l=D(null),r=X({hostname:""}),i={hostname:{trigger:["input","blur"],validator:()=>r.hostname.trim()===""?new Error(d("Mail.Setting.index_50")):!0}};return b({onConfirm:async()=>{var c;await((c=l.value)==null?void 0:c.validate()),await F(Y(r)),n("refresh")}}),(c,m)=>{const x=st,_=nt,S=W,f=j;return L(),O("div",lt,[o(S,{ref_key:"formRef",ref:l,model:s(r),rules:i},{default:p(()=>[o(_,{label:c.$t("Mail.Setting.index_48"),path:"hostname"},{default:p(()=>[M("div",rt,[o(x,{value:s(r).hostname,"onUpdate:value":m[0]||(m[0]=k=>s(r).hostname=k)},null,8,["value"])])]),_:1},8,["label"])]),_:1},8,["model"]),o(f,{class:"mt-8px"},{default:p(()=>[M("li",null,w(c.$t("Mail.Setting.index_49")),1)]),_:1})])}}}),mt=C({__name:"log",emits:["close","close-env"],setup(P,{emit:b}){const h=b,{t:n}=B(),d=D(n("Mail.Setting.index_47")),l=async()=>{const{message:m}=await G();N(m)&&(d.value=m.result||n("Mail.Setting.index_47"))},{loop:r}=it(async()=>{await l()},1),i=tt(),y=async()=>{await J(),h("close"),h("close-env"),i.push("/mail/domain")};return(async()=>(y(),await l(),r()))(),(m,x)=>{const _=at;return L(),et(_,{log:s(d)},null,8,["log"])}}}),_t={class:"flex flex-col h-full overflow-hidden"},ut={class:"flex-1 p-20px overflow-auto"},Rt=C({__name:"index",emits:["close"],setup(P,{emit:b}){const h=b,{t:n}=B(),d=["Redis-install","Redis-Passwd","SElinux"],{table:l,columns:r}=Z([{key:"env",title:n("Mail.Setting.index_39"),width:150},{key:"details",title:n("Mail.Setting.index_40"),ellipsis:{tooltip:!0},render:t=>{let e="";const{env:a,status:g,details:u}=t,v=d.includes(a);return u&&v?e=g?"Ready":u:e=g?"Ready":u!=""?u:"Abnormity",o("span",{class:g?"text-primary":"text-error"},[e])}},{key:"action",title:n("Public.Table.Operation"),width:120,render:t=>{const{env:e,status:a,details:g}=t;return!d.includes(e)&&g&&!a?o("a",{class:"bt-link",href:"javascript:;",onClick:()=>{t.env==="HostName"?y(t):c(t)}},[n("Public.Btn.Repair")]):n("Mail.Setting.index_41")}}]),i=E(n("Mail.Setting.index_42"),{onRefresh:()=>{_()}}),y=t=>{i.data.row=t,i.show=!0},c=t=>{H({title:n("Mail.Setting.index_43"),content:n("Mail.Setting.index_44"),onConfirm:async()=>{const{env:e}=t;let a="";switch(e){case"Postfix-Version":case"Postfix-install":case"Sqlite-support":a="repair_postfix";break;case"Rspamd-install":a="install_rspamd";break;case"Dovecot-install":a="repair_dovecot";break}await K(e,a),_()}})},{loading:m,setLoading:x}=A(),_=async()=>{try{x(!0);const{message:t}=await Q();N(t)&&(l.data=Object.entries(t).map(([e,a])=>({env:e,details:a.msg,status:a.status})))}finally{x(!1)}},S=()=>{h("close")},f=E(n("Mail.Setting.index_45"),{onCloseEnv:()=>{S()}}),k=()=>{f.show=!0},V=async()=>{if(!l.data.every(e=>e.status)){U.error(n("Mail.Setting.index_46"));return}k()};return _(),(t,e)=>{const a=q,g=j,u=I,v=ot,z=T;return L(),O("div",_t,[M("div",ut,[o(a,{"max-height":364,"single-line":!1,loading:s(m),data:s(l).data,columns:s(r)},null,8,["loading","data","columns"]),o(g,{class:"mt-20px"},{default:p(()=>[M("li",null,w(t.$t("Mail.Setting.index_38")),1)]),_:1}),o(u,{show:s(i).show,"onUpdate:show":e[0]||(e[0]=R=>s(i).show=R),title:s(i).title,data:s(i).data,width:500,footer:!0,component:ct},null,8,["show","title","data"]),o(u,{show:s(f).show,"onUpdate:show":e[1]||(e[1]=R=>s(f).show=R),title:s(f).title,data:s(f).data,"hide-close":!0,width:700,height:490,component:mt},null,8,["show","title","data"])]),o(z,null,{default:p(()=>[o(v,{class:"cancel-btn",color:"#cbcbcb",size:"small",onClick:S},{default:p(()=>[$(w(t.$t("Public.Btn.Cancel")),1)]),_:1}),o(v,{type:"primary",size:"small",onClick:_},{default:p(()=>[$(w(t.$t("Public.Btn.Refresh")),1)]),_:1}),o(v,{type:"primary",size:"small",onClick:V},{default:p(()=>[$(w(t.$t("Public.Btn.Submit")),1)]),_:1})]),_:1})])}}});export{Rt as default};
