import{_ as a,a as t}from"./index.js?v=1753954525509";import{_ as e,l as s,b as i,e as l,d as n,c as o,f as r}from"./public.js?v=1753954525509";import{c as d,m as c}from"./page_layout.js?v=1753954525509";import{ak as m,al as u,am as p,an as _,ao as f}from"./mail2.js?v=1753954525509";import{_ as h}from"./index.vue_vue_type_script_setup_true_lang.js?v=1753954525509";import{k as x,P as v,r as g,e as w,U as y,V as b,Q as S,a2 as j,W as M,X as k,a3 as P,N as R,aj as C,a1 as $,j as B}from"./vue.js?v=1753954525509";import{aq as U,cA as z,ay as E}from"./naive.js?v=1753954525509";import{_ as q}from"./index101.js?v=1753954525509";import"./common.js?v=1753954525509";import"./__commonjsHelpers__.js?v=1753954525509";const A={class:"p-20px"},H={class:"w-260px"},N=x({__name:"hostname",emits:["refresh"],setup(a,{expose:t,emit:s}){const i=s,{t:l}=v(),n=g(null),o=w({hostname:""}),r={hostname:{trigger:["input","blur"],validator:()=>""!==o.hostname.trim()||new Error(l("Mail.Setting.index_50"))}};return t({onConfirm:async()=>{var a;await(null==(a=n.value)?void 0:a.validate()),await m(R(o)),i("refresh")}}),(a,t)=>{const s=U,i=z,l=h,d=e;return y(),b("div",A,[S(l,{ref_key:"formRef",ref:n,model:k(o),rules:r},{default:j((()=>[S(i,{label:a.$t("Mail.Setting.index_48"),path:"hostname"},{default:j((()=>[M("div",H,[S(s,{value:k(o).hostname,"onUpdate:value":t[0]||(t[0]=a=>k(o).hostname=a)},null,8,["value"])])])),_:1},8,["label"])])),_:1},8,["model"]),S(d,{class:"mt-8px"},{default:j((()=>[M("li",null,P(a.$t("Mail.Setting.index_49")),1)])),_:1})])}}}),O=x({__name:"log",emits:["close","close-env"],setup(a,{emit:t}){const e=t,{t:i}=v(),l=g(i("Mail.Setting.index_47")),n=async()=>{const{message:a}=await u();d(a)&&(l.value=a.result||i("Mail.Setting.index_47"))},{loop:o}=s((async()=>{await n()}),1),r=C();return(async()=>{(async()=>{await p(),e("close"),e("close-env"),r.push("/mail/domain")})(),await n(),o()})(),(a,t)=>{const e=q;return y(),$(e,{log:k(l)},null,8,["log"])}}}),V={class:"flex flex-col h-full overflow-hidden"},D={class:"flex-1 p-20px overflow-auto"},L=x({__name:"index",emits:["close"],setup(s,{emit:m}){const u=m,{t:p}=v(),h=["Redis-install","Redis-Passwd","SElinux"],{table:x,columns:g}=i([{key:"env",title:p("Mail.Setting.index_39"),width:150},{key:"details",title:p("Mail.Setting.index_40"),ellipsis:{tooltip:!0},render:a=>{let t="";const{env:e,status:s,details:i}=a,l=h.includes(e);return t=i&&l?s?"Ready":i:s?"Ready":""!=i?i:"Abnormity",S("span",{class:s?"text-primary":"text-error"},[t])}},{key:"action",title:p("Public.Table.Operation"),width:120,render:a=>{const{env:t,status:e,details:s}=a;return h.includes(t)||!s||e?p("Mail.Setting.index_41"):S("a",{class:"bt-link",href:"javascript:;",onClick:()=>{"HostName"===a.env?R(a):C(a)}},[p("Public.Btn.Repair")])}}]),w=l(p("Mail.Setting.index_42"),{onRefresh:()=>{z()}}),R=a=>{w.data.row=a,w.show=!0},C=a=>{n({title:p("Mail.Setting.index_43"),content:p("Mail.Setting.index_44"),onConfirm:async()=>{const{env:t}=a;let e="";switch(t){case"Postfix-Version":case"Postfix-install":case"Sqlite-support":e="repair_postfix";break;case"Rspamd-install":e="install_rspamd";break;case"Dovecot-install":e="repair_dovecot"}await _(t,e),z()}})},{loading:$,setLoading:U}=o(),z=async()=>{try{U(!0);const{message:a}=await f();d(a)&&(x.data=Object.entries(a).map((([a,t])=>({env:a,details:t.msg,status:t.status}))))}finally{U(!1)}},q=()=>{u("close")},A=l(p("Mail.Setting.index_45"),{onCloseEnv:()=>{q()}}),H=async()=>{x.data.every((a=>a.status))?A.show=!0:c.error(p("Mail.Setting.index_46"))};return z(),(s,i)=>{const l=r,n=e,o=a,d=E,c=t;return y(),b("div",V,[M("div",D,[S(l,{"max-height":364,"single-line":!1,loading:k($),data:k(x).data,columns:k(g)},null,8,["loading","data","columns"]),S(n,{class:"mt-20px"},{default:j((()=>[M("li",null,P(s.$t("Mail.Setting.index_38")),1)])),_:1}),S(o,{show:k(w).show,"onUpdate:show":i[0]||(i[0]=a=>k(w).show=a),title:k(w).title,data:k(w).data,width:500,footer:!0,component:N},null,8,["show","title","data"]),S(o,{show:k(A).show,"onUpdate:show":i[1]||(i[1]=a=>k(A).show=a),title:k(A).title,data:k(A).data,"hide-close":!0,width:700,height:490,component:O},null,8,["show","title","data"])]),S(c,null,{default:j((()=>[S(d,{class:"cancel-btn",color:"#cbcbcb",size:"small",onClick:q},{default:j((()=>[B(P(s.$t("Public.Btn.Cancel")),1)])),_:1}),S(d,{type:"primary",size:"small",onClick:z},{default:j((()=>[B(P(s.$t("Public.Btn.Refresh")),1)])),_:1}),S(d,{type:"primary",size:"small",onClick:H},{default:j((()=>[B(P(s.$t("Public.Btn.Submit")),1)])),_:1})])),_:1})])}}});export{L as default};
