"use strict";const t=require("../../../../common/vendor.js"),e=class e{constructor(){this.isUseCache=!0,this.translationCache=new Map}static getInstance(){return e.instance||(e.instance=new e),e.instance}async get(e){if(this.isUseCache){const t=this.translationCache.get(e.ID);if(void 0!==t)return t}const s=t.Jt.getMessageModel(e.ID);if(!s)return[];const{text:n}=s.getMessageContent()||{},a=[],i=await this.getNickList(s);for(let t=0;t"text"===t.type&&""!==t.value.trim()&&(r.push(e),!0))).map((t=>t.value));if(0===c.length)return this.translationCache.set(s.ID,a),a;return(await this.getTranslationStandard(c)).forEach(((t,e)=>{a[r[e]].value=t})),this.translationCache.set(s.ID,a),a}clear(){this.translationCache.clear()}disableCache(){this.isUseCache=!1}enableCache(){this.isUseCache=!0}getTranslationStandard(e){return new Promise(((s,n)=>{t.Qt.translateText({sourceTextList:e,sourceLanguage:"auto"}).then((t=>{const{data:{translatedTextList:e}}=t;s(e)})).catch((t=>{n(t)}))}))}async getNickList(e){const s=[],{atUserList:n=[]}=e,a=t.qt.TYPES.MSG_AT_ALL;if(n.includes(a)&&s.push(`@${t.Wt.t("TUIChat.所有人")}`),n.length>0){const{data:e}=await t.Zt.getUserProfile({userIDList:n});e.forEach((t=>{const e=`@${t.nick||t.userID}`;s.push(e)}))}return[...new Set(s)]}getSplitResult(t,e){let s=0;const n=[],a=[];for(;s