import{C as Q,b as Z,av as ee,a4 as W,_ as te,a as q,j as se,u as oe,z as A,k as z,a1 as F,a8 as ae,m,o as n,p as D,N as j,f as s,n as k,g as e,e as u,L as O,r as R,a6 as ne,c as h,h as P,t as d,P as J,ab as C,aw as le,O as ie,T as ce,w as re,I as de,F as X,al as me,af as ue,ao as he,D as pe,aj as fe,ax as ge,ah as ye,ap as _e,ay as U,an as V}from"./index-DpP8vbvu.js";import{E as ve}from"./el-image-viewer-BT4BRtUp.js";import{E as we}from"./el-scrollbar-DIXSy-7M.js";import{_ as Y}from"./_plugin-vue_export-helper-DlAUqK2U.js";import{b as ke}from"./email-CsVstZMr.js";import{I as w}from"./iconify-CxZjXnJf.js";import{u as Se}from"./email-BqixZxSP.js";import{f as be}from"./day-B6NtfdPE.js";import{s as Ie,a as Ce}from"./star-DxhhrwZA.js";import{a as Ee,g as $e}from"./file-utils-xSqLUDrh.js";import{g as De}from"./icon-utils-BF6YYqhF.js";import{a as Te}from"./all-email-hZpif8BK.js";import{u as Be,a as Ae}from"./index-dQfRzLGT.js";import{E as Me}from"./index-CcAtbSPY.js";import"./vnode-DPqF99Zc.js";import"./index-BMdPKuCq.js";import"./event-BB_Ol6Sd.js";import"./index-D7KcZu8a.js";import"./throttle-BCwYugI2.js";import"./dayjs.min-BjOfKEma.js";import"./index-BWeK8p2T.js";const Ne=["light","dark"],Fe=Z({title:{type:String,default:""},description:{type:String,default:""},type:{type:String,values:ee(W),default:"info"},closable:{type:Boolean,default:!0},closeText:{type:String,default:""},showIcon:Boolean,center:Boolean,effect:{type:String,values:Ne,default:"light"},...Be}),Re={open:()=>!0,close:S=>Q(S)||S instanceof Event},je=q({name:"ElAlert"}),He=q({...je,props:Fe,emits:Re,setup(S,{emit:v}){const p=S,{Close:b}=le,l=se(),i=oe("alert"),t=A(!1),y=z(()=>W[p.type]),c=z(()=>!!(p.description||l.default)),r=()=>{t.value=!0,v("open")},_=a=>{t.value=!1,v("close",a)},{onOpen:I,onClose:E}=Ae({showAfter:F(p,"showAfter"),hideAfter:F(p,"hideAfter"),autoClose:F(p,"autoClose"),open:r,close:_});return ae&&I(),(a,$)=>(n(),m(ce,{name:e(i).b("fade"),persisted:""},{default:D(()=>[j(s("div",{class:k([e(i).b(),e(i).m(a.type),e(i).is("center",a.center),e(i).is(a.effect)]),role:"alert"},[a.showIcon&&(a.$slots.icon||e(y))?(n(),m(e(O),{key:0,class:k([e(i).e("icon"),{[e(i).is("big")]:e(c)}])},{default:D(()=>[R(a.$slots,"icon",{},()=>[(n(),m(ne(e(y))))])]),_:3},8,["class"])):u("v-if",!0),s("div",{class:k(e(i).e("content"))},[a.title||a.$slots.title?(n(),h("span",{key:0,class:k([e(i).e("title"),{"with-description":e(c)}])},[R(a.$slots,"title",{},()=>[P(d(a.title),1)])],2)):u("v-if",!0),e(c)?(n(),h("p",{key:1,class:k(e(i).e("description"))},[R(a.$slots,"default",{},()=>[P(d(a.description),1)])],2)):u("v-if",!0),a.closable?(n(),h(J,{key:2},[a.closeText?(n(),h("div",{key:0,class:k([e(i).e("close-btn"),e(i).is("customed")]),onClick:_},d(a.closeText),3)):(n(),m(e(O),{key:1,class:k(e(i).e("close-btn")),onClick:e(E)},{default:D(()=>[C(e(b))]),_:1},8,["class","onClick"]))],64)):u("v-if",!0)],2)],2),[[ie,t.value]])]),_:3},8,["name"]))}});var Le=te(He,[["__file","alert.vue"]]);const xe=re(Le),ze={__name:"index",props:{html:{type:String,required:!0}},setup(S){const v=S,p=A(null),b=A(null);let l=null;function i(){const c=document.createElement("style");document.head.appendChild(c)}function t(){if(!l)return;const c=/<body[^>]*style="([^"]*)"[^>]*>/i,r=v.html.match(c),_=r?r[1]:"",I=v.html.replace(/<\/?body[^>]*>/gi,"");l.innerHTML=`
    <style>
      :host {
        all: initial;
        width: 100%;
        height: 100%;
        font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
        font-size: 14px;
        color: #13181D;
        word-break: break-word;
      }

      .shadow-content {
        background: #FFFFFF;
        width: fit-content;
        height: fit-content;
        min-width: 100%;
        ${_||""} /* 注入 body 的 style */
      }

      img:not(table img) {
        max-width: 100% !important;
        height: auto !important;
      }

    </style>
    <div class="shadow-content">
      ${I}
    </div>
  `}function y(){if(!l||!b.value)return;const c=b.value,r=l.querySelector(".shadow-content");if(!r)return;const _=c.offsetWidth,I=c.offsetHeight,E=r.scrollWidth,a=r.scrollHeight;if(E===0||a===0)return;const $=_/E,M=I/a,T=Math.min($,M),B=l.host;B.style.zoom=T}return de(()=>{i(),l=p.value.attachShadow({mode:"open"}),t(),y()}),X(()=>v.html,()=>{t(),y()}),(c,r)=>(n(),h("div",{class:"content-box",ref_key:"contentBox",ref:b},[s("div",{ref_key:"container",ref:p,class:"content-html"},null,512)],512))}},Oe=Y(ze,[["__scopeId","data-v-29aefc2b"]]),Pe={class:"box"},Ue={class:"header-actions"},Ve={key:0,class:"star"},We={class:"container"},qe={class:"email-title"},Je={class:"content"},Xe={class:"email-info"},Ye={class:"send"},Ge={class:"send-source"},Ke={class:"send-name"},Qe={class:"send-name-title"},Ze={class:"receive"},et={class:"source"},tt={class:"receive-email"},st={class:"date"},ot={key:1,class:"email-text"},at={key:0,class:"att"},nt={class:"att-title"},lt={class:"att-box"},it=["onClick"],ct=["onClick"],rt={class:"att-size"},dt={class:"opt-icon att-icon"},mt=["href"],ut={__name:"index",setup(S){const v=me(),p=ue(),b=he(),l=Se(),i=ge(),t=l.contentData.email,y=A(!1),c=pe([]),{t:r}=fe();X(()=>b.currentAccountId,()=>{B()});function _(){v.writerRef.openReply(t)}function I(o){return o?JSON.parse(o).message:""}function E(o){o=o||"";const f=p.settings.r2Domain;return o.replace(/{{domain}}/g,f+"/")}function a(o){if(!$(o))return;const f=U(o);c.length=0,c.push(f),y.value=!0}function $(o){return["png","jpg","jpeg","bmp","gif","jfif"].includes($e(o))}function M(o){return o=JSON.parse(o),o.map(f=>f.address).join(", ")}function T(){t.isStar?(t.isStar=0,Ie(t.emailId).then(()=>{t.isStar=0,l.cancelStarEmailId=t.emailId,setTimeout(()=>l.cancelStarEmailId=0),l.starScroll?.deleteEmail([t.emailId])}).catch(o=>{console.error(o),t.isStar=1})):(t.isStar=1,Ce(t.emailId).then(()=>{t.isStar=1,l.addStarEmailId=t.emailId,setTimeout(()=>l.addStarEmailId=0),l.starScroll?.addItem(t)}).catch(o=>{console.error(o),t.isStar=0}))}const B=()=>{i.back()},G=()=>{Me.confirm(r("delEmailConfirm"),{confirmButtonText:r("confirm"),cancelButtonText:r("cancel"),type:"warning"}).then(()=>{l.contentData.delType==="logic"?ke(t.emailId).then(()=>{V({message:r("delSuccessMsg"),type:"success",plain:!0}),l.deleteIds=[t.emailId]}):Te(t.emailId).then(()=>{V({message:r("delSuccessMsg"),type:"success",plain:!0}),l.deleteIds=[t.emailId]}),i.back()})};return(o,f)=>{const N=xe,H=we,K=ve,L=ye("perm");return n(),h("div",Pe,[s("div",Ue,[C(e(w),{class:"icon",icon:"material-symbols-light:arrow-back-ios-new",width:"20",height:"20",onClick:B}),j(C(e(w),{class:"icon",icon:"uiw:delete",width:"16",height:"16",onClick:G},null,512),[[L,"email:delete"]]),e(l).contentData.showStar?(n(),h("span",Ve,[e(t).isStar?(n(),m(e(w),{key:0,class:"icon",onClick:T,icon:"fluent-color:star-16",width:"21",height:"20"})):(n(),m(e(w),{key:1,class:"icon",onClick:T,icon:"solar:star-line-duotone",width:"19",height:"19"}))])):u("",!0),e(l).contentData.showReply?j((n(),m(e(w),{key:1,class:"icon",onClick:_,icon:"carbon:reply",width:"20",height:"20"},null,512)),[[L,"email:send"]]):u("",!0)]),f[1]||(f[1]=s("div",null,null,-1)),C(H,{class:"scrollbar"},{default:D(()=>[s("div",We,[s("div",qe,d(e(t).subject),1),s("div",Je,[s("div",Xe,[s("div",null,[s("div",Ye,[s("span",Ge,d(o.$t("from")),1),s("div",Ke,[s("span",Qe,d(e(t).name),1),s("span",null,"<"+d(e(t).sendEmail)+">",1)])]),s("div",Ze,[s("span",et,d(o.$t("recipient")),1),s("span",tt,d(M(e(t).recipient)),1)]),s("div",st,[s("div",null,d(e(be)(e(t).createTime)),1)])]),e(t).status===3?(n(),m(N,{key:0,closable:!1,title:`${o.$t("bounced")} `+I(e(t).message),class:"email-msg",type:"error","show-icon":""},null,8,["title"])):u("",!0),e(t).status===4?(n(),m(N,{key:1,closable:!1,title:o.$t("complained"),class:"email-msg",type:"warning","show-icon":""},null,8,["title"])):u("",!0),e(t).status===5?(n(),m(N,{key:2,closable:!1,title:o.$t("delayed"),class:"email-msg",type:"warning","show-icon":""},null,8,["title"])):u("",!0)]),C(H,{class:k(["htm-scrollbar",e(t).attList.length===0?"bottom-distance":""])},{default:D(()=>[e(t).content?(n(),m(Oe,{key:0,class:"shadow-html",html:E(e(t).content)},null,8,["html"])):(n(),h("pre",ot,d(e(t).text),1))]),_:1},8,["class"]),e(t).attList.length>0?(n(),h("div",at,[s("div",nt,[s("span",null,d(o.$t("attachments")),1),s("span",null,d(o.$t("attCount",{total:e(t).attList.length})),1)]),s("div",lt,[(n(!0),h(J,null,_e(e(t).attList,g=>(n(),h("div",{class:"att-item",key:g.attId},[s("div",{class:"att-icon",onClick:x=>a(g.key)},[C(e(w),{icon:e(De)(g.filename),width:"20",height:"20"},null,8,["icon"])],8,it),s("div",{class:"att-name",onClick:x=>a(g.key)},d(g.filename),9,ct),s("div",rt,d(e(Ee)(g.size)),1),s("div",dt,[$(g.filename)?(n(),m(e(w),{key:0,icon:"hugeicons:view",width:"22",height:"22",onClick:x=>a(g.key)},null,8,["onClick"])):u("",!0),s("a",{href:e(U)(g.key),download:""},[C(e(w),{icon:"system-uicons:push-down",width:"22",height:"22"})],8,mt)])]))),128))])])):u("",!0)])])]),_:1}),y.value?(n(),m(K,{key:0,"url-list":c,"show-progress":"",onClose:f[0]||(f[0]=g=>y.value=!1)},null,8,["url-list"])):u("",!0)])}}},Ft=Y(ut,[["__scopeId","data-v-a054a25f"]]);export{Ft as default};
