"use strict";const e=require("../../../../common/vendor.js"),t=require("../emoji-config/index.js"),s=require("../../../utils/type-check.js"),a=class a{constructor(){this.quoteMessageMap=new Map}static getInstance(){return a.instance||(a.instance=new a),a.instance}setStore(t,s,a,o){var n,i;if(t&&(this.isEditorNotEmpty(s)||(null==(n=null==o?void 0:o.message)?void 0:n.ID))){let n={};(null==(i=null==o?void 0:o.message)?void 0:i.ID)&&(this.quoteMessageMap.set(o.message.ID,o.message),n={messageID:o.message.ID,type:o.type});const r={conversationID:t,draftInfo:{html:s,abstract:a,...n}};e.Xt.setConversationDraft(r),e.Jt.update(e.o.CHAT,"quoteMessage",{message:void 0,type:"quote"})}}getStore(t,a){const o=e.Jt.getConversationModel(t);if(o){if(o.conversationID&&o.draftText){const t=s.JSONToObject(o.draftText);e.Jt.update(e.o.CHAT,"quoteMessage",{message:this.quoteMessageMap.get(t.messageID)||void 0,type:t.type}),a(t.html)}e.Xt.setConversationDraft({conversationID:o.conversationID})}}generateAbstract(s){let a="";return null==s||s.forEach((s=>{switch(s.type){case"text":a+=t.transformTextWithKeysToEmojiNames(s.payload.text||"");break;case"image":a+=e.Wt.t("TUIChat.图片");break;case"video":a+=e.Wt.t("TUIChat.视频");break;case"file":a+=e.Wt.t("TUIChat.文件")}})),a}isEditorNotEmpty(e){return e&&!e.includes("is-empty")&&"<p></p>"!==e}};a.instance=null;const o=a.getInstance();exports.DraftManager=o;
