"use strict";const e=require("../../../../../common/vendor.js");require("../../../../adapter-vue.js");const a=require("../../../../../common/assets.js"),t=require("../../../../utils/env.js");Math||(r+u+s+n)();const r=()=>"../../../common/Icon.js",n=()=>"../../../common/Overlay/index.js",u=()=>"../../../common/Avatar/index.js",s=()=>"../../../common/FetchMore/index.js",o=e.defineComponent({__name:"index",props:{message:{default:()=>({})}},emits:["setReadReceiptPanelVisible"],setup(r,{emit:n}){const u=n,s=r;let o="",i="";const d=["unread","read"],c={unread:!1,read:!1,close:!1},f=e.ref(!1),l=e.ref(!1),m=e.ref(!1),v=e.ref(!1),b=e.ref("unread"),p=e.ref({read:{tabName:e.Wt.t("TUIChat.已读"),count:void 0,memberList:[]},unread:{tabName:e.Wt.t("TUIChat.未读"),count:void 0,memberList:[]},close:{tabName:e.Wt.t("TUIChat.关闭"),count:void 0,memberList:[]}});async function I(a="all"){const t=e.Jt.getMessageModel(s.message.ID);let r={},n={};"all"!==a&&"unread"!==a||(r=await e.Qt.getGroupMessageReadMemberList({message:t,filter:1,cursor:o,count:100}),r&&(o=r.data.cursor,r.data.isCompleted&&(c.unread=!0))),"all"!==a&&"read"!==a||(n=await e.Qt.getGroupMessageReadMemberList({message:t,filter:0,cursor:i,count:100}),n&&(i=n.data.cursor,n.data.isCompleted&&(c.read=!0)));const{unreadCount:u,readCount:d}=t.readReceiptInfo;return{unreadResult:{count:u,...r.data},readResult:{count:d,...n.data}}}async function L(){if(!c[b.value]&&!f.value&&(f.value=!0,"unread"===b.value||"read"===b.value)){const{unreadResult:e,readResult:a}=await I(b.value);g();try{p.value.unread.memberList=p.value.unread.memberList.concat(e.unreadUserInfoList||[]),p.value.read.memberList=p.value.read.memberList.concat(a.readUserInfoList||[])}finally{f.value=!1}}}async function R(){o="",i="",v.value=!1,c.unread=!1,c.read=!1;const{unreadResult:e,readResult:a}=await I("all");g(),C("read",a.count,a.readUserInfoList),C("unread",e.count,e.unreadUserInfoList),C("close")}function g(){c.read&&c.unread&&(v.value=!0)}function C(e,a,t){p.value[e].count=a,p.value[e].memberList=t||[]}function h(){l.value=!0,setTimeout((()=>{u("setReadReceiptPanelVisible",!1)}),200)}return e.onMounted((async()=>{await R(),e.nextTick$1((()=>{m.value=!0}))})),e.watch((()=>s.message.readReceiptInfo.readCount),(()=>{R()})),(r,n)=>e.e({a:e.t(e.unref(e.Wt).t("TUIChat.消息详情")),b:e.o$1(h),c:e.p({size:"12px",hotAreaSize:"8",file:e.unref(a.closeIcon$2)}),d:e.f(d,((a,t,r)=>({a:e.t(e.unref(p)[a].tabName),b:e.t(void 0===e.unref(p)[a].count?"":e.unref(p)[a].count),c:a,d:a===e.unref(b)?1:"",e:e.o$1((e=>function(e){b.value=e}(a)),a)}))),e:0===e.unref(p)[e.unref(b)].count&&e.unref(m)},0===e.unref(p)[e.unref(b)].count&&e.unref(m)?{f:e.t(e.unref(e.Wt).t("TUIChat.空"))}:e.unref(m)?e.e({h:"unread"===e.unref(b)},"unread"===e.unref(b)?{i:e.f(e.unref(p)[e.unref(b)].memberList,((a,t,r)=>({a:"f19a5438-2-"+r+",f19a5438-0",b:e.p({useSkeletonAnimation:!0,url:a.avatar||""}),c:e.t(a.nick||a.userID),d:a.userID})))}:{},{j:"read"===e.unref(b)},"read"===e.unref(b)?{k:e.f(e.unref(p)[e.unref(b)].memberList,((a,t,r)=>({a:"f19a5438-3-"+r+",f19a5438-0",b:e.p({useSkeletonAnimation:!0,url:a.avatar}),c:e.t(a.nick||a.userID),d:a.userID})))}:{}):{},{g:e.unref(m),l:e.unref(m)},e.unref(m)?{m:e.o$1(L),n:e.p({isFetching:e.unref(f),isTerminateObserve:e.unref(v)})}:{},{o:e.unref(t.isMobile)?1:"",p:e.unref(t.isUniFrameWork)?1:"",q:e.unref(t.isMobile)&&e.unref(l)?1:"",r:e.o$1(h),s:e.p({maskColor:"transparent"})})}}),i=e._export_sfc(o,[["__scopeId","data-v-f19a5438"]]);wx.createComponent(i);
