import{e as v}from"./index-v7AaNdhX.js";import{b as D}from"./email-CsVstZMr.js";import{s as S,a as _}from"./star-DxhhrwZA.js";import{u as g}from"./email-BqixZxSP.js";import{al as y,z as L,F as c,I as b,m as j,o as I,p as m,h as E,t as f,f as k,g as i,au as p}from"./index-DpP8vbvu.js";import{u as x,d as s}from"./db-0ez5p68O.js";import"./time-utils-B0cDvgwY.js";import"./index-BMdPKuCq.js";import"./vnode-DPqF99Zc.js";import"./event-BB_Ol6Sd.js";import"./index-D7KcZu8a.js";import"./position-5hNBDW7r.js";import"./throttle-BCwYugI2.js";import"./iconify-CxZjXnJf.js";import"./el-scrollbar-DIXSy-7M.js";import"./el-empty-BRrnteWe.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-tag-CjAzCWMf.js";import"./index-dQfRzLGT.js";import"./el-checkbox-DjYzjb3f.js";import"./index-Bm-x70H-.js";import"./_plugin-vue_export-helper-DlAUqK2U.js";import"./day-B6NtfdPE.js";import"./dayjs.min-BjOfKEma.js";/* empty css                       *//* empty css                  *//* empty css                 */import"./index-CcAtbSPY.js";import"./index-BWeK8p2T.js";const B={class:"send-email"},nt=Object.assign({name:"draft"},{__name:"index",setup(C){const a=x(),d=y(),o=L({}),n=g();c(()=>a.setDraft,async()=>{const t=p(a.setDraft),e=t.draftId,r=p(a.setDraft.attachments);if(delete t.draftId,delete t.attachments,!t.content&&!t.subject&&!(t.receiveEmail.length>0)){await s.value.draft.delete(e),await s.value.att.delete(e),a.refreshList++;return}await s.value.draft.update(e,t),await s.value.att.update(e,{attachments:r}),a.refreshList++},{deep:!0}),c(()=>a.refreshList,async()=>{const{list:t}=await l();o.value.emailList.length=0,o.value.emailList.push(...t)});function l(){return new Promise((t,e)=>{s.value.draft.orderBy("createTime").reverse().toArray().then(r=>{t({list:r})})})}async function u(t){await s.value.draft.bulkDelete(t),a.refreshList++}async function h(t){const e=await s.value.att.get(t.draftId);t.attachments=e.attachments,d.writerRef.openDraft(t)}function w(t){n.cancelStarEmailId=t.emailId,o.value.deleteEmail([t.emailId])}return b(()=>{n.starScroll=o}),(t,e)=>(I(),j(v,{ref_key:"scroll",ref:o,"allow-star":!1,"cancel-success":w,getEmailList:l,emailDelete:i(D),"star-add":i(_),"star-cancel":i(S),onJump:h,actionLeft:"6px","show-account-icon":!1,"show-first-loading":!1,showStar:!1,onDeleteDraft:u,type:"draft"},{name:m(r=>[k("span",B,f(r.email.receiveEmail.join(",")||"("+t.$t("noRecipient")+")"),1)]),subject:m(r=>[E(f(r.email.subject||"("+t.$t("noSubject")+")"),1)]),_:1},8,["emailDelete","star-add","star-cancel"]))}});export{nt as default};
