import{i as t,a4 as w,a2 as _,a5 as p,an as H,f as I,v as T,r as D,P as S,bx as N}from"./app-JmgyQoR0.js";import{F as A}from"./suspense-lwY0NW4i.js";import{F as g}from"./split-mI9ZWkMh.js";import{F as j}from"./section-yxO0GkeZ.js";import{b as z,a as i,c as B,D as V,h,i as K,j as e,l,u as R,K as n,E as o,z as m,t as W,F as Y,H as q}from"./vue-y3KLWBaS.js";const G={class:"_formRoot"},$=z({__name:"email-settings",setup(J){let r=i(!1),d=i(null),c=i(!1),f=i(""),v=i(0),b=i(""),k=i("");async function y(){const u=await I("admin/meta");r.value=u.enableEmail,d.value=u.email,c.value=u.smtpSecure,f.value=u.smtpHost,v.value=u.smtpPort,b.value=u.smtpUser,k.value=u.smtpPass}async function P(){const{canceled:u,result:a}=await T({title:t.ts.destination,type:"email",placeholder:D.maintainerEmail});u||S("admin/send-email",{to:a,subject:"Test email",text:"Yo"})}function x(){S("admin/update-meta",{enableEmail:r.value,email:d.value,smtpSecure:c.value,smtpHost:f.value,smtpPort:v.value,smtpUser:b.value,smtpPass:k.value}).then(()=>{N()})}const U=B(()=>[{asFullButton:!0,icon:"ph-test-tube ph-bold ph-lg",text:t.ts.testEmail,handler:P},{asFullButton:!0,icon:"ph-check ph-bold ph-lg",text:t.ts.save,handler:x}]),F=B(()=>[]);return w({title:t.ts.emailServer,icon:"ph-envelope-simple-open ph-bold ph-lg"}),(u,a)=>{const M=V("MkPageHeader"),E=V("MkSpacer"),C=V("MkStickyContainer");return h(),K(C,null,{header:e(()=>[l(M,{actions:U.value,tabs:F.value,"display-back-button":!0},null,8,["actions","tabs"])]),default:e(()=>[l(E,{"content-max":700,"margin-min":16,"margin-max":32},{default:e(()=>[l(A,{p:y},{default:e(()=>[R("div",G,[l(_,{modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=s=>r.value=s),class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.enableEmail)+" ("+o(m(t).ts.recommended)+")",1)]),caption:e(()=>[n(o(m(t).ts.emailConfigInfo),1)]),_:1},8,["modelValue"]),r.value?(h(),W(Y,{key:0},[l(p,{modelValue:d.value,"onUpdate:modelValue":a[1]||(a[1]=s=>d.value=s),type:"email",class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.emailAddress),1)]),_:1},8,["modelValue"]),l(j,null,{label:e(()=>[n(o(m(t).ts.smtpConfig),1)]),default:e(()=>[l(g,{"min-width":280},{default:e(()=>[l(p,{modelValue:f.value,"onUpdate:modelValue":a[2]||(a[2]=s=>f.value=s),class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.smtpHost),1)]),_:1},8,["modelValue"]),l(p,{modelValue:v.value,"onUpdate:modelValue":a[3]||(a[3]=s=>v.value=s),type:"number",class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.smtpPort),1)]),_:1},8,["modelValue"])]),_:1}),l(g,{"min-width":280},{default:e(()=>[l(p,{modelValue:b.value,"onUpdate:modelValue":a[4]||(a[4]=s=>b.value=s),class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.smtpUser),1)]),_:1},8,["modelValue"]),l(p,{modelValue:k.value,"onUpdate:modelValue":a[5]||(a[5]=s=>k.value=s),type:"password",class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.smtpPass),1)]),_:1},8,["modelValue"])]),_:1}),l(H,{class:"_formBlock"},{default:e(()=>[n(o(m(t).ts.emptyToDisableSmtpAuth),1)]),_:1}),l(_,{modelValue:c.value,"onUpdate:modelValue":a[6]||(a[6]=s=>c.value=s),class:"_formBlock"},{label:e(()=>[n(o(m(t).ts.smtpSecure),1)]),caption:e(()=>[n(o(m(t).ts.smtpSecureInfo),1)]),_:1},8,["modelValue"])]),_:1})],64)):q("",!0)])]),_:1})]),_:1})]),_:1})}}});export{$ as default};
