"use strict";const e=require("../../common/vendor.js");require("../adapter-vue.js");const n=require("../utils/env.js"),r=require("./TUIChat/config.js"),a=require("./TUIChat/entry-chat-only.js"),t=require("./TUIChat/utils/utils.js"),o=require("./TUIChat/offlinePushInfoManager/index.js"),i=require("../../stores/counter.js"),s=require("../../components/request.js"),u=require("../../components/generateMsgId.js"),c=require("./TUIChat/server.js"),l=require("./TUIConversation/server.js"),h=require("./TUISearch/search-type-list.js"),p=require("./TUISearch/search-time-list.js"),d=require("./TUISearch/server.js"),v=require("./TUIContact/server.js"),f=require("./TUIGroup/server.js");require("./TUIConversation/entry.js"),Math||(T+g+C+m+y+I)();const T=()=>"./TUIChat/chat-header/index.js",C=()=>"./TUIChat/message-list/index.js",I=()=>"./TUIChat/message-input/index.js",m=()=>"./TUIChat/mulitple-select-panel/index.js",g=()=>"./TUIChat/forward/index.js",y=()=>"./TUIChat/message-input-toolbar/index.js",U=e.defineComponent({__name:"index",emits:["closeChat"],setup(c,{emit:l}){const h=i.useCounterStore();let p=e.ref(),d=e.ref();e.onLoad((n=>{a.initChat(n);try{p.value=JSON.parse(n.myitem),d.value=JSON.parse(n.youritem),h.$patch({youritem:d.value}),setTimeout((()=>{var n,r;n=p.value,r=d.value,s.request({url:"pk/createPkRecord",method:"POST",data:{pkIdA:r.id,pkIdB:n.id,userIdA:r.senderId,userIdB:n.senderId,pkTime:r.pkTime,pkNumber:r.pkNumber,anchorIdA:r.anchorId,anchorIdB:n.anchorId,anchorIconA:r.anchorIcon,anchorIconB:n.anchorIcon,piIdA:r.id,piIdB:n.id},userInfo:!0}).then((a=>{var i,c,l,p,d;if(200===a.code){const v=u.generateMsgId(),f={data:JSON.stringify({businessID:"pk",keyid:v,myitem:h.myitem.id,pkIdA:r.id,pkIdB:n.id,userIdA:r.senderId,userIdB:n.senderId,pkTime:r.pkTime,pkNumber:r.pkNumber,id:a.data.id,link:"https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pk.png",btnDisplay:!0}),description:"邀请参加PK",extension:"邀请参加PK"},T={to:(null==(c=null==(i=null==P?void 0:P.value)?void 0:i.groupProfile)?void 0:c.groupID)||(null==(p=null==(l=null==P?void 0:P.value)?void 0:l.userProfile)?void 0:p.userID),conversationType:null==(d=null==P?void 0:P.value)?void 0:d.type,payload:f,needReadReceipt:t.isEnabledMessageReadReceiptGlobal()},C={conversation:P.value,payload:T.payload,messageType:e.qt.TYPES.MSG_CUSTOM},I={offlinePushInfo:o.OfflinePushInfoManager.create(C)};e.Qt.sendCustomMessage(T,I).then((e=>{s.request({url:"chat/add",method:"POST",data:{messageInfo:JSON.stringify(e.data.message),keyId:v},userInfo:!0})})),n.value=null,r.value=null,P.value=null}else e.index.showToast({title:a.msg,icon:"none",duration:3e3})}))}),1e3)}catch(r){}})),e.onUnload((()=>{a.logout(!1).then((()=>{})).catch((()=>{}))}));const v=e.ref(void 0),f=e.ref(!1),T=e.ref(!1),C=e.ref(),I=e.ref(),m=e.ref(!1),g=e.ref("none"),y=e.ref(),U=e.ref(),S=e.ref([]),E=r.ChatConfig.getFeatureConfig();e.ref("0px"),e.onMounted((()=>{e.Jt.watch(e.o.CONV,{currentConversation:A})})),e.onUnmounted((()=>{e.Jt.unwatch(e.o.CONV,{currentConversation:A}),k()}));let P=e.ref();e.Jt.watch(e.o.CONV,{currentConversation:e=>{P.value=e}});const b=e.computed((()=>!n.isUniFrameWork||"none"!==g.value)),x=e.computed((()=>{let n="";switch(C.value){case 4:n=e.Wt.t("TUIChat.您已被管理员移出群聊");break;case 5:n=e.Wt.t("TUIChat.该群聊已被解散");break;default:n=e.Wt.t("TUIChat.您已退出该群聊")}return n})),k=()=>{e.Xt.switchConversation("")},j=e=>{var n;null==(n=y.value)||n.insertEmoji(e)},M=(e,n)=>{var r,a,t;if(e&&n)switch(n){case"reference":case"reply":break;case"reedit":(null==(r=null==e?void 0:e.payload)?void 0:r.text)&&(null==(t=null==y?void 0:y.value)||t.reEdit(null==(a=null==e?void 0:e.payload)?void 0:a.text))}},_=()=>{S.value[0].listener.onClicked({groupID:v.value})};function w(r){g.value=g.value===r?"none":r,"none"!==g.value&&n.isUniFrameWork&&e.index.$emit("scroll-to-bottom")}function O(){var e;null==(e=U.value)||e.scrollToLatestMessage()}function R(e){m.value=void 0===e?!m.value:e}function q(){var e;null==(e=U.value)||e.mergeForwardMessage()}function N(){var e;null==(e=U.value)||e.oneByOneForwardMessage()}function A(n){if(function(e){(null==e?void 0:e.operationType)>0?(S.value=[],T.value=!0,C.value=null==e?void 0:e.operationType):(T.value=!1,C.value=void 0)}(n),!n)return;if(I.value===(null==n?void 0:n.conversationID))return;f.value=!1;let a=e.qt.TYPES.CONV_C2C;const t=n.conversationID;if(t.startsWith(e.qt.TYPES.CONV_GROUP)&&(a=e.qt.TYPES.CONV_GROUP,f.value=!0,v.value=t.replace(e.qt.TYPES.CONV_GROUP,"")),S.value=[],m.value=!1,r.ChatConfig.setChatType(a),e.R.notifyEvent(e.E.TUIChat.EVENT.CHAT_STATE_CHANGED,e.E.TUIChat.EVENT_SUB_KEY.CHAT_OPENED,{groupID:v.value}),e.R.callService({serviceName:e.E.TUICustomerServicePlugin.SERVICE.NAME,method:e.E.TUICustomerServicePlugin.SERVICE.METHOD.ACTIVE_CONVERSATION,params:{conversationID:t}}),r.ChatConfig.getChatType()===e.E.TUIChat.TYPE.ROOM&&!0===r.ChatConfig.getFeatureConfig(e.E.TUIChat.FEATURE.InputVoice))return r.ChatConfig.setTheme("light"),void(I.value="");r.ChatConfig.getChatType()===e.E.TUIChat.TYPE.GROUP&&(S.value=e.R.getExtensionList(e.E.TUIChat.EXTENSION.CHAT_HEADER.EXT_ID)),e.Jt.update(e.o.CUSTOM,"activeConversation",t),I.value=t}return(r,a)=>e.e({a:!e.unref(I)},e.unref(I)?{}:{b:e.n(!e.unref(n.isPC)&&"tui-chat-h5-default")},{c:e.unref(I)},e.unref(I)?e.e({d:e.o$1(R),e:e.sr(U,"69ae3511-2",{k:"messageListRef"}),f:e.n(!e.unref(n.isPC)&&"tui-chat-h5-message-list"),g:e.o$1(M),h:e.o$1((()=>w("none"))),i:e.o$1(R),j:e.p({isGroup:e.unref(f),groupID:e.unref(v),isNotInGroup:e.unref(T),isMultipleSelectMode:e.unref(m)}),k:e.unref(T)},e.unref(T)?{l:e.t(e.unref(x)),m:e.unref(n.isMobile)?1:""}:e.unref(m)?{o:e.o$1(N),p:e.o$1(q),q:e.o$1(R)}:e.e({r:e.unref(b)},e.unref(b)?{s:e.n(!e.unref(n.isPC)&&"tui-chat-h5-message-input-toolbar"),t:e.n(e.unref(n.isUniFrameWork)&&"tui-chat-uni-message-input-toolbar"),v:e.o$1(j),w:e.o$1(w),x:e.o$1(O),y:e.p({displayType:e.unref(g)})}:{},{z:e.sr(y,"69ae3511-5",{k:"messageInputRef"}),A:e.n(!e.unref(n.isPC)&&"tui-chat-h5-message-input"),B:e.n(e.unref(n.isUniFrameWork)&&"tui-chat-uni-message-input"),C:e.n(e.unref(n.isWeChat)&&"tui-chat-wx-message-input"),D:e.o$1(w),E:e.p({enableAt:e.unref(E).InputMention,isMuted:!1,muteText:e.unref(e.Wt).t("TUIChat.您已被管理员禁言"),placeholder:e.unref(e.Wt).t("TUIChat.请输入消息"),inputToolbarDisplayType:e.unref(g)})}),{n:e.unref(m),F:e.n(!e.unref(n.isPC)&&"tui-chat-h5")}):{},{G:!e.unref(T)&&!e.unref(n.isApp)&&e.unref(n.isUniFrameWork)&&e.unref(f)&&e.unref(S).length>0},!e.unref(T)&&!e.unref(n.isApp)&&e.unref(n.isUniFrameWork)&&e.unref(f)&&e.unref(S).length>0?{H:e.t(e.unref(S)[0].text),I:e.o$1(_)}:{},{J:e.n(!e.unref(n.isPC)&&"tui-chat-h5")})}}),S=e._export_sfc(U,[["__scopeId","data-v-69ae3511"]]);new c.TUIChatServer,new l.TUIConversationServer,Math||(E+b+P)();const E=()=>"./TUISearch/search-input/index.js",P=()=>"./TUISearch/search-container/index.js",b=()=>"./TUISearch/search-result/index.js",x=e.defineComponent({__name:"index",props:{searchType:{default:()=>n.isUniFrameWork?"conversation":"global"}},setup(r){const a=r,t=e.ref(),o=e.ref(""),i=e.ref(!1),s=e.ref(n.isUniFrameWork),u=e.computed((()=>!n.isPC&&("global"===a.searchType&&i.value||"conversation"===a.searchType&&s.value))),c=n=>{e.Jt.update(e.o.SEARCH,"currentSearchInputValue",{value:"",searchType:n}),e.Jt.update(e.o.SEARCH,"currentSearchMessageType",{value:h.searchMessageTypeDefault[n],searchType:n}),e.Jt.update(e.o.SEARCH,"currentSearchMessageTime",{value:p.searchMessageTimeDefault,searchType:n})};function l(e){n.isUniFrameWork||o.value===e||T(),o.value=e}function d(r){var o,s,u,c;(null==r?void 0:r.searchType)===a.searchType&&(i.value=null==r?void 0:r.isSearching,"global"===(null==r?void 0:r.searchType)&&t.value&&n.isPC&&r.isSearching&&e.O.listen({domRefs:t.value,handler:f}),"global"===(null==r?void 0:r.searchType)&&n.isUniFrameWork&&(r.isSearching?null==(s=null==(o=e.i)?void 0:o.hideTabBar())||s.catch((()=>{})):null==(c=null==(u=e.i)?void 0:u.showTabBar())||c.catch((()=>{}))))}function v(e){s.value=!!e,s.value&&c(a.searchType)}function f(){e.Jt.update(e.o.SEARCH,"currentSearchingStatus",{isSearching:!1,searchType:a.searchType})}function T(){e.Jt.update(e.o.SEARCH,"isShowInConversationSearch",!1)}return e.onMounted((()=>{["global","conversation"].forEach((e=>{c(e)})),e.Jt.watch(e.o.CONV,{currentConversationID:l}),e.Jt.watch(e.o.SEARCH,{currentSearchingStatus:d,isShowInConversationSearch:v})})),e.onUnmounted((()=>{e.Jt.unwatch(e.o.CONV,{currentConversationID:l}),e.Jt.unwatch(e.o.SEARCH,{currentSearchingStatus:d,isShowInConversationSearch:v})})),(r,a)=>e.e({a:"global"===r.searchType||("conversation"===r.searchType||!r.searchType&&e.unref(n.isUniFrameWork))&&e.unref(s)},"global"===r.searchType||("conversation"===r.searchType||!r.searchType&&e.unref(n.isUniFrameWork))&&e.unref(s)?e.e({b:"global"===r.searchType},"global"===r.searchType?e.e({c:e.p({searchType:r.searchType}),d:e.n(!e.unref(n.isPC)&&"tui-search-h5-global-header"),e:e.unref(i)},e.unref(i)?{f:e.p({searchType:r.searchType}),g:e.p({popupPosition:"bottom",searchType:r.searchType})}:{},{h:e.n(!e.unref(n.isPC)&&"tui-search-h5-global")}):"conversation"===r.searchType&&e.unref(s)||e.unref(n.isUniFrameWork)?{j:e.p({searchType:r.searchType?r.searchType:"conversation"}),k:e.p({searchType:r.searchType?r.searchType:"conversation"}),l:e.o$1(T),m:e.p({popupPosition:"aside",searchType:r.searchType?r.searchType:"conversation"}),n:e.n(!e.unref(n.isPC)&&"tui-search-h5-conversation")}:{},{i:"conversation"===r.searchType&&e.unref(s)||e.unref(n.isUniFrameWork),o:e.n(!e.unref(n.isPC)&&"tui-search-h5"),p:e.n(`tui-search-main-${r.searchType?r.searchType:"conversation"}`),q:e.n(e.unref(u)&&"tui-search-h5-full-screen")}):{})}}),k=e._export_sfc(x,[["__scopeId","data-v-1f488a62"]]);new d.TUISearchServer,Math||(j+M+_+w)();const j=()=>"./TUIContact/select-friend/index.js",M=()=>"./TUIContact/contact-search/index.js",_=()=>"./TUIContact/contact-list/index.js",w=()=>"./TUIContact/contact-info/index.js",O=e.defineComponent({__name:"index",props:{displayType:{type:String,default:"contactList",require:!1}},emits:["switchConversation"],setup(r,{emit:a}){const t=a,o=r,i=e.ref(o.displayType||"contactList"),s=e.ref(!1),u=e.ref(!0),c=e.ref(!0);e.watchEffect((()=>{u.value="selectFriend"!==(null==o?void 0:o.displayType)})),e.Jt.watch(e.o.CUSTOM,{isShowSelectFriendComponent:r=>{var a,t,c;if(!n.isUniFrameWork&&"selectFriend"===(null==o?void 0:o.displayType))return s.value=r,void(u.value=!1);r?(s.value=!0,n.isUniFrameWork&&(i.value="selectFriend",null==(a=e.i)||a.hideTabBar())):(s.value=!1,n.isUniFrameWork&&(i.value=o.displayType,null==(c=null==(t=e.i)?void 0:t.showTabBar())||c.catch((()=>{}))))},currentContactInfo:e=>{var r;c.value=n.isPC||e&&"object"==typeof e&&(null==(r=Object.keys(e))?void 0:r.length)>0}});const l=r=>{var a;n.isUniFrameWork&&(null==(a=e.i)||a.navigateTo({url:"/TUIKit/components/TUIChat/index"})),t("switchConversation",r)};return(r,a)=>e.e({a:e.unref(s)},e.unref(s)?{}:e.unref(u)?e.e({c:e.n(!e.unref(n.isPC)&&"tui-contact-h5-left-list"),d:e.n(!e.unref(n.isPC)&&"tui-contact-h5-left"),e:e.unref(c)},e.unref(c)?{f:e.o$1(l),g:e.n(!e.unref(n.isPC)&&"tui-contact-h5-right")}:{},{h:e.n(!e.unref(n.isPC)&&"tui-contact-h5")}):{},{b:e.unref(u)})}}),R=e._export_sfc(O,[["__scopeId","data-v-8f969de8"]]);v.TUIContactServer.getInstance(),Math||(q+N+A)();const q=()=>"./TUIGroup/create-group/index.js",N=()=>"./TUIGroup/manage-group/index.js",A=()=>"./TUIGroup/select-member/index.js",F=e.defineComponent({__name:"index",setup(n){const r=e.ref(!1),a=e.ref(!1),t=e.ref(!1);return e.Jt.watch(e.o.GRP,{isShowCreateComponent:e=>{r.value=!!e},isShowManageComponent:e=>{a.value=!!e},isShowSelectComponent:e=>{t.value=!!e}}),(n,o)=>e.e({a:e.unref(r)},(e.unref(r),{}),{b:e.unref(a)},(e.unref(a),{}),{c:e.unref(t)},(e.unref(t),{}),{d:e.n((e.unref(r)||e.unref(a)||e.unref(t))&&"tui-group")})}}),$=e._export_sfc(F,[["__scopeId","data-v-3ff2cd9d"]]);f.TUIGroupServer.getInstance(),Math||(W+J+V+D+B)();const W=()=>"./TUISearch/index.js",D=()=>"./TUIConversation/conversation-list/index.js",J=()=>"./TUIConversation/conversation-header/index.js",V=()=>"./TUIConversation/conversation-network/index.js",B=()=>"../../components/tabBar/tabBar.js",G=e.defineComponent({__name:"index",emits:["handleSwitchConversation"],setup(n,{emit:r}){const a=r,t=e.ref(0),o=e.ref(),i=e.ref(),s=e.ref(0),u=e.ref(0),c=e.ref(!0);e.Jt.watch(e.o.CONV,{totalUnreadCount:e=>{t.value=e}}),e.Jt.watch(e.o.CUSTOM,{isShowConversationHeader:e=>{c.value=!1!==e}});const l=n=>{var r;null==(r=e.i)||r.navigateTo({url:"/TUIKit/components/TUIChat/index"}),a("handleSwitchConversation",n)},h=()=>{var e,n;null==(e=null==o?void 0:o.value)||e.closeChildren(),null==(n=null==i?void 0:i.value)||n.closeChildren()},p=()=>{h()};e.onHide(h);const d=e=>{s.value=e.changedTouches[0].clientX,u.value=e.changedTouches[0].clientY},v=e=>{const n=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY;let a="";n-s.value>50&&Math.abs(r-u.value)<50?a="right":n-s.value<-50&&Math.abs(r-u.value)<50&&(a="left"),r-u.value>50&&Math.abs(n-s.value)<50?a="down":r-u.value<-50&&Math.abs(n-s.value)<50&&(a="up"),"down"!==a&&"up"!==a||h()},f=e=>{e.value=i.value};return(n,r)=>e.e({a:e.p({searchType:"global"}),b:e.unref(c)},e.unref(c)?{c:e.sr(o,"338437e2-1",{k:"headerRef"})}:{},{d:e.sr(i,"338437e2-3",{k:"conversationListDomRef"}),e:e.o$1(l),f:e.o$1(f),g:e.o$1(p),h:e.o$1(d),i:e.o$1(v),j:e.p({tabIndex:3})})}}),H=e._export_sfc(G,[["__scopeId","data-v-338437e2"]]);exports.MiniProgramPage=H,exports.MiniProgramPage$1=S,exports.MiniProgramPage$2=R,exports.MiniProgramPage$3=$,exports.MiniProgramPage$4=k;