"use strict";const e=require("../../../../../../common/vendor.js");require("../../../../../adapter-vue.js");const t=require("../../../../../../common/assets.js"),a=require("../../../emoji-config/index.js"),s=require("../../../../../utils/env.js"),o=require("../../../emoji-config/custom-emoji.js"),n=require("../../../emoji-config/default-emoji.js");Math||(r+d+u)();const r=()=>"../../../../common/Icon.js",u=()=>"./message-container.js",d=()=>"../message-record/index.js",f=e.defineComponent({__name:"index",props:{messageID:{default:""},isMounted:{type:Boolean,default:!1}},emits:["closeOverlay"],setup(r,{emit:u}){const d=u,f=r,i=e.qt.TYPES,m=e.ref(!1),y=e.ref([]),l=e.ref({title:"",messageList:[]});e.ref(),e.watch((()=>y.value.length),(async t=>{if(m.value=!1,t<1)return;const a=y.value[y.value.length-1];if(a.downloadKey&&0===a.messageList.length)try{const t=await e.Qt.downloadMergedMessages({payload:a,type:e.qt.TYPES.MSG_MERGER});y.value[y.value.length-1]=t.payload}catch(s){m.value=!0}l.value=y.value[y.value.length-1]})),e.watch((()=>f.isMounted),(t=>{if(t){if(!f.messageID)throw new Error("messageID is required when first render of simple-message-list.");const t=e.Jt.getMessageModel(f.messageID).getMessage().payload;y.value=[t]}else y.value=[]}),{immediate:!0});const p=e.computed((()=>y.value.length>1)),g=e.computed((()=>{var e;return!!(null==(e=l.value)?void 0:e.messageList)&&l.value.messageList.length>0}));function c(){y.value.pop(),y.value.length<1&&d("closeOverlay")}function M(e){let t="";return e.indexOf("@custom")>-1?t=o.CUSTOM_BIG_EMOJI_URL+e:(t=n.DEFAULT_BIG_EMOJI_URL+e,-1===t.indexOf("@2x")?t+="@2x.png":t+=".png"),t}return(o,n)=>e.e({a:e.p({file:e.unref(t.backIcon),size:"18px"}),b:e.unref(p)},e.unref(p)?{c:e.t(e.unref(e.Wt).t("TUIChat.返回"))}:{d:e.t(e.unref(e.Wt).t("TUIChat.关闭"))},{e:e.o$1(c),f:e.t(e.unref(l).title),g:e.unref(m)},e.unref(m)?{}:e.unref(g)?{i:e.f(e.unref(l).messageList,((o,n,r)=>e.e({a:o.messageBody[0].type===e.unref(i).MSG_TEXT},o.messageBody[0].type===e.unref(i).MSG_TEXT?{b:e.f(e.unref(a.parseTextToRenderArray)(o.messageBody[0].payload.text),((t,a,s)=>e.e({a:"text"===t.type},"text"===t.type?{b:e.t(t.content)}:{c:t.content},{d:a})))}:o.messageBody[0].type===e.unref(i).MSG_IMAGE?{d:o.messageBody[0].payload.imageInfoArray[2].url}:o.messageBody[0].type===e.unref(i).MSG_VIDEO?e.e({f:e.unref(s.isUniFrameWork)},e.unref(s.isUniFrameWork)?{g:o.messageBody[0].payload.thumbUrl,h:"366f76ff-2-"+r+",366f76ff-1-"+r,i:e.p({file:e.unref(t.playIcon)}),j:e.o$1((t=>function(t){if(s.isUniFrameWork){const a=encodeURIComponent(t);e.index.navigateTo({url:`/TUIKit/components/TUIChat/video-play?videoUrl=${a}`})}}(o.messageBody[0].payload.remoteVideoUrl)),o.ID)}:{k:o.messageBody[0].payload.remoteVideoUrl,l:o.messageBody[0].payload.thumbUrl}):o.messageBody[0].type===e.unref(i).MSG_AUDIO?{n:e.t(e.unref(e.Wt).t("TUIChat.语音")),o:e.t(o.messageBody[0].payload.second)}:o.messageBody[0].type===e.unref(i).MSG_FACE?{q:M(o.messageBody[0].payload.data)}:o.messageBody[0].type===e.unref(i).MSG_FILE?{s:e.t(e.unref(e.Wt).t("TUIChat.[文件]"))}:o.messageBody[0].type===e.unref(i).MSG_LOCATION?{v:e.t(e.unref(e.Wt).t("TUIChat.[地理位置]"))}:o.messageBody[0].type===e.unref(i).MSG_MERGER?{x:"366f76ff-3-"+r+",366f76ff-1-"+r,y:e.p({disabled:!0,renderData:o.messageBody[0].payload}),z:e.o$1((e=>{return t=e,a=o,y.value.push(a.messageBody[0].payload),void t.stopPropagation();var t,a}),o.ID)}:o.messageBody[0].type===e.unref(i).MSG_CUSTOM?{B:e.t(e.unref(e.Wt).t("TUIChat.[自定义消息]"))}:{},{c:o.messageBody[0].type===e.unref(i).MSG_IMAGE,e:o.messageBody[0].type===e.unref(i).MSG_VIDEO,m:o.messageBody[0].type===e.unref(i).MSG_AUDIO,p:o.messageBody[0].type===e.unref(i).MSG_FACE,r:o.messageBody[0].type===e.unref(i).MSG_FILE,t:o.messageBody[0].type===e.unref(i).MSG_LOCATION,w:o.messageBody[0].type===e.unref(i).MSG_MERGER,A:o.messageBody[0].type===e.unref(i).MSG_CUSTOM,C:"366f76ff-1-"+r,D:e.p({sender:o.nick,avatar:o.avatar,type:o.messageBody[0].type,time:o.time}),E:o.ID})))}:{},{h:e.unref(g),j:e.unref(s.isMobile)?1:""})}}),i=e._export_sfc(f,[["__scopeId","data-v-366f76ff"]]);wx.createComponent(i);
