Files
qhmes/web-dist/js/ImChat-CP9TPra1.js
2026-06-16 18:19:57 +08:00

2 lines
28 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
var Hn=Object.defineProperty,Un=Object.defineProperties;var Fn=Object.getOwnPropertyDescriptors;var Rt=Object.getOwnPropertySymbols;var Wn=Object.prototype.hasOwnProperty,On=Object.prototype.propertyIsEnumerable;var xt=(x,k,p)=>k in x?Hn(x,k,{enumerable:!0,configurable:!0,writable:!0,value:p}):x[k]=p,R=(x,k)=>{for(var p in k||(k={}))Wn.call(k,p)&&xt(x,p,k[p]);if(Rt)for(var p of Rt(k))On.call(k,p)&&xt(x,p,k[p]);return x},X=(x,k)=>Un(x,Fn(k));var I=(x,k,p)=>new Promise((Me,pe)=>{var V=A=>{try{$(p.next(A))}catch(ge){pe(ge)}},Ue=A=>{try{$(p.throw(A))}catch(ge){pe(ge)}},$=A=>A.done?Me(A.value):Promise.resolve(A.value).then(V,Ue);$((p=p.apply(x,k)).next())});import{e as Vn,r as d,o as $n,a as Kn,ac as Yn,d as qn,C as _,z as i,Q as r,f,O as ne,T as Xn,J as B,c as L,P as ae,G as w,A as T,E as W,H as D,K as Pt,y as G,F as de,D as tt,a5 as jn,u as O,n as H,R as Jn}from"./vue-vendor-DNhG1Cve.js";import{u as Zn,e5 as zt,e6 as Qn,e7 as At,e8 as ea,e9 as Lt,ea as Ge,eb as nt,ec as ta,ed as na,T as aa,aG as oa,aH as sa,M as ra,ee as Dt,ef as la,eg as fe,aK as U,eh as ua,ei as Ee,ej as ia,cZ as ca,ek as va,c_ as da,el as fa,em as j,en as at,eo as we,ep as ma,eq as Gt,er as pa,s as ga,es as ha,dg as me,et as Ca,eu as _a,ev as Ta,ew as ya,ex as Ne,bL as Ia,aR as ba,aS as wa,ey as Et,ez as Nt,eA as Ma,c$ as J,eB as Sa,eC as ka,eD as Ra,v as xa,eE as Pa,eF as za,eG as ot,eH as Aa,eI as Be,eJ as La,eK as Da,au as Ga}from"./index-X7Y8jykP.js";import{ensureWebSocketConnected as Ea,onWebSocketReconnect as Na}from"./useWebSocket-CMyoaPFz.js";import Ba from"./ImChatInput-rBvfVpHc.js";import Ha from"./ImChatSettingsModal-4rnykuc8.js";import{_ as Ua}from"./ImPageListPickModal.vue_vue_type_script_setup_true_lang-DaELlYpW.js";import Fa from"./ImBizRecordMessageContent-DJr_9NNp.js";import Wa from"./ImCreateGroupModal-Co9b_zTb.js";import Oa from"./ImGroupSettingDrawer-CYkJsATT.js";import"./index-D9GWo192.js";import"./index-BDvqZ5j4.js";import{u as st}from"./useModal-DaJ3Bflg.js";import{a as Va}from"./useDrawer-BDPywy9W.js";import"./index-CfNJyBRj.js";import{D as $a}from"./dropdown-jkliuVyN.js";import{B as Ka}from"./index-DfX9t4DO.js";import{A as Ya}from"./index-B4gPlWQt.js";import"./emoji-mart-vue-fast-R0uJEDq-.js";/* empty css */import"./index-DklMb9Qc.js";import"./UpOutlined-B1UMbtrP.js";import"./BasicTable-C6eG0bgK.js";import"./BasicTable.vue_vue_type_style_index_0_lang-B9DxrWas.js";import"./BasicForm-ClUSoD_-.js";import"./helper-DcLcf4v6.js";import"./index-BzChaRPg.js";import"./useAppInject-DPZGPcR3.js";import"./BasicForm.vue_vue_type_style_index_0_lang-B29PWQy0.js";import"./index-DO7ZhK45.js";import"./index-ByCwbQDV.js";import"./index-Upeu4GGa.js";import"./index-C4wWpZeQ.js";import"./useTimeout-D5AmIBZw.js";import"./index-M9QP6cvf.js";import"./Skeleton-CimgOdM7.js";import"./useScrollTo-0FPEw5-K.js";import"./useIntersectionObserver-BGOgyKyu.js";import"./index-saD4h7VJ.js";import"./useBreakpoint-DXhPW7nV.js";import"./useEventListener-BRXjwk7A.js";import"./breakpointEnum-BhAg6bcX.js";import"./uniqBy--vsL0WVB.js";import"./BasicModal-xH56XuRZ.js";import"./ModalHeader-Sr8KwhJJ.js";import"./useWindowSizeFn-C-0M9_Ul.js";import"./index-CuWaQdlK.js";import"./useForm-D61zovon.js";import"./injectionKey-DPVn4AgL.js";import"./index-DSsDi_fL.js";import"./Group-UHkub2tu.js";import"./Checkbox-Dbxs4we4.js";import"./index-BuONesFs.js";import"./FormOutlined-Y84itqS0.js";import"./useTableContext-CncNVXgp.js";import"./index-DTjkSGYl.js";import"./eagerComputed-BTlOruLW.js";import"./fromPairs-Dx9PT-t0.js";import"./useMaxLevel-DE205ncc.js";import"./index-DfHu-LAS.js";import"./Group-DBzJABA_.js";import"./RadioButton-DRBix2Fq.js";import"./index-C7ckZv9Z.js";import"./DirectoryTree-nk_YTTIy.js";import"./FolderOpenOutlined-SzIPA7z0.js";import"./index-Cl-8Hzo4.js";import"./scrollTo-D49dA-9c.js";import"./operationUnit-vCu2co3e.js";import"./index-C69VKHba.js";import"./index-DsixALRt.js";import"./dayjs-jnKD3YGS.js";import"./index-aCD42OrZ.js";import"./quarterOfYear-BU2sPnff.js";import"./index-J2mOtM3w.js";import"./dayjs-ALi1pEeb.js";import"./clickOutside-DHfwTU6R.js";import"./onMountedOrActivated-DhSdLlqP.js";import"./throttle-De_jAmBh.js";import"./uuid-CODpppBC.js";import"./sortable.esm-DJNoJSdJ.js";import"./RedoOutlined-Cq2g4Slp.js";import"./index-CeNCCWzL.js";import"./TableAction.vue_vue_type_style_index_0_lang-BIWZ0bGo.js";import"./index-fAAIzD3j.js";import"./TableImg.vue_vue_type_style_index_0_lang-65ZOQtFn.js";import"./useListPage-CK9oQ-1O.js";import"./useTable-DbHE4FHE.js";import"./useMethods-D3efiSSd.js";import"./useApprovalSelection-D4wlWO_T.js";import"./approvalHandle.api-gBzdKBq5.js";import"./ImApprovalDetailModal-Dnx-eyNG.js";import"./index-DWDasoBX.js";import"./index-3-sNW-01.js";import"./ImGroupAddMemberModal-N0YNycEF.js";import"./ArrowLeftOutlined-B3JgaWh-.js";import"./index-DZJwICFr.js";import"./isNumeric-DjvBa-1E.js";const qa={class:"im-chat-left-header"},Xa={class:"header-main"},ja={class:"dept-tip"},Ja={class:"im-left-tabs"},Za={key:0,class:"tab-unread-badge"},Qa={key:0,class:"tab-unread-badge"},eo={class:"im-search-wrap"},to={class:"im-group-actions"},no={class:"conv-list"},ao=["onClick"],oo={class:"conv-meta"},so={class:"conv-top"},ro={class:"conv-name"},lo={key:0,class:"conv-tag"},uo={class:"conv-time"},io={class:"conv-bottom"},co={class:"conv-preview"},vo=["onClick"],fo={class:"conv-meta"},mo={class:"conv-top"},po={class:"conv-name"},go={class:"conv-time"},ho={class:"conv-bottom"},Co={class:"conv-preview"},_o={class:"im-chat-right"},To={class:"im-chat-right-header"},yo={class:"chat-peer-name"},Io={class:"message-box-wrap"},bo={key:0,class:"load-more-hint"},wo={key:1,class:"load-more"},Mo={key:0,class:"message-name"},So=["src","onClick"],ko={key:2,class:"message-content"},Ro={key:4,class:"message-content"},xo={class:"message-time"},Po={class:"message-input"},zo=["title"],Ao={class:"im-page-context-text"},Lo={key:1,class:"im-work-notify-readonly-tip"},Do=["src"],He=20,Bt="im-chat-left-width",Ht="im-chat-left-collapsed",Go=56,Ut=220,Ft=420,Eo=280,No=Vn({name:"ImChat",__name:"ImChat",props:{embedded:{type:Boolean,default:!1}},setup(x,{expose:k}){const p=x,Me=Zn(),pe=d(!0),V=ha(),{createMessage:Ue}=ga(),$=L(()=>{var e;return p.embedded&&((e=V.value)==null?void 0:e.title)||""}),A=L(()=>{var e,t,n;return p.embedded?!!((n=(t=(e=V.value)==null?void 0:e.listSnapshot)==null?void 0:t.records)!=null&&n.length):!1}),ge=L(()=>A.value?`${$.value}(点击选择明细发送)`:$.value);let Se=null,ke=null,he=null,Re=null,xe=null,Pe=null;function oe(){return p.embedded?Dt():la()&&!Dt()}function Wt(){return oe()}function Ot(){return oe()}function ze(){var e;return g.value||((e=M.value)==null?void 0:e.id)||""}function Vt(e){var v,C;if(!e||!oe())return;const t=fe(e),n=(v=t==null?void 0:t.records)==null?void 0:v[t.records.length-1];if(!n)return;const a=J(n.content,n.msgType);if(P.value==="group"&&((C=l.value)==null?void 0:C.conversationId)===e){F(e,{lastContent:a,lastTime:n.createTime,unreadCount:0},{moveToTop:!0});return}const u=ze();u&&ee(u,{conversationId:e,lastContent:a,lastTime:n.createTime,unreadCount:0},{moveToTop:!0})}function $t(e){var a,u;if(!e)return!1;if(e===s.value)return!0;const t=fe(e),n=(a=t==null?void 0:t.records)==null?void 0:a[t.records.length-1];return n?P.value==="group"?((u=l.value)==null?void 0:u.conversationId)===e:Fe(n.senderId):!1}function Fe(e){return P.value==="group"||!e?!1:ze()===e}function Kt(e,t,n){return e?!!(e===s.value||!n&&Fe(t)):!1}function We(e){!e||e===s.value||(s.value=e,Ce())}function Ce(){s.value&&j(s.value),g.value&&me(g.value)}function rt(e,t){const n=new Map;for(const a of e)a!=null&&a.id&&n.set(a.id,a);for(const a of t)a!=null&&a.id&&n.set(a.id,a);return Array.from(n.values()).sort((a,u)=>U(a.createTime||0).valueOf()-U(u.createTime||0).valueOf())}function lt(){if(!s.value)return;const e=fe(s.value);if(!(e!=null&&e.records.length))return;const t=Qe(e.records);c.value=rt(c.value,t),ve(c.value),H(()=>N())}function ut(){s.value&&(Ce(),lt(),ce(s.value)&&z(!0,{forceRefresh:!0}))}const[Yt,{openModal:qt}]=st(),[Xt,{openModal:jt}]=st(),[Jt,{openModal:Zt}]=st(),[Qt,{openDrawer:en,closeDrawer:tn}]=Va(),it=d(zt()),ct=L(()=>{var e;return((e=Me.getUserInfo)==null?void 0:e.id)||""}),nn=L(()=>{const e=Me.getUserInfo;return(e==null?void 0:e.orgCodeTxt)||(e==null?void 0:e.orgCode)||"本部门同事"}),Oe=d(!1),se=d(!1),Z=d(!1),Ve=d(!1),$e=d(""),_e=d(!0),K=d(0);function an(e){return Sa(e)}function vt(e){return ka(e)}function re(e){return(e==null?void 0:e.contactType)===Ra||(e==null?void 0:e.username)==="im_work_notify"}const on=L(()=>re(M.value));function dt(e,t=!1){return e?J(e):t?"暂无系统通知":"点击开始聊天"}const Ke=d(""),E=d("member"),le=d(""),b=d([]),h=d([]),ue=d(!1),c=d([]),g=d(""),M=d(null),l=d(null),P=d(""),s=d(""),Ae=d(),Y=d(!1);let Ye=0,qe=!1;const sn=d(),Te=d(Eo),m=d(!1),ye=d(!1);let ft=0,mt=0;const rn=L(()=>({width:`${m.value?Go:Te.value}px`})),pt=L(()=>P.value==="group"),Xe=L(()=>b.value.reduce((e,t)=>e+(t.unreadCount||0),0)),je=L(()=>h.value.length>0?h.value.reduce((e,t)=>e+(t.unreadCount||0),0):nt.value),ln=L(()=>{if(l.value){const e=l.value.memberCount?`(${l.value.memberCount}人)`:"";return`${l.value.groupName||"群聊"}${e}`}return M.value&&(M.value.realname||M.value.username)||"IM聊天"});function ie(){const e=[...b.value,...h.value.map(t=>({id:t.conversationId,conversationId:t.conversationId,unreadCount:t.unreadCount}))];Ee(e)}function un(){const e=Number(localStorage.getItem(Bt));!Number.isNaN(e)&&e>=Ut&&e<=Ft&&(Te.value=e),m.value=localStorage.getItem(Ht)==="1"}function cn(){localStorage.setItem(Bt,String(Te.value))}function vn(){m.value=!m.value,localStorage.setItem(Ht,m.value?"1":"0")}function dn(e){m.value||(ye.value=!0,ft=e.clientX,mt=Te.value,document.body.style.userSelect="none",document.body.style.cursor="col-resize",document.addEventListener("mousemove",gt),document.addEventListener("mouseup",Je))}function gt(e){if(!ye.value)return;const t=e.clientX-ft;Te.value=Math.min(Ft,Math.max(Ut,mt+t))}function Je(){ye.value&&(ye.value=!1,document.body.style.userSelect="",document.body.style.cursor="",document.removeEventListener("mousemove",gt),document.removeEventListener("mouseup",Je),cn())}function Le(e){return e?xa(e):""}function fn(e){e&&($e.value=Le(e),Ve.value=!0)}function mn(){Ve.value=!1,$e.value=""}function Ze(e){if(!e)return"";const t=U(e);return t.isValid()?t.isSame(U(),"day")?t.format("HH:mm"):t.format("MM-DD HH:mm"):""}function Qe(e){return e.filter(t=>Ta(t.createTime))}function ce(e){var u;const t=fe(e),n=Ct();if(!n)return!1;if(!(t!=null&&t.records.length))return!0;const a=(u=t.records[t.records.length-1])==null?void 0:u.createTime;return a?U(n).isAfter(U(a)):!0}function pn(e,t=!1){return t||_a(e)||ce(e)}function gn({key:e}){var t;if(e==="chatSettings"){qt(!0,{});return}if(e==="groupSettings"){if(!((t=l.value)!=null&&t.conversationId))return;en(!0,{conversationId:l.value.conversationId})}}function hn(e){return I(this,null,function*(){var t,n,a;e!=null&&e.conversationId&&(F(e.conversationId,{groupName:e.groupName,memberCount:e.memberCount},{moveToTop:!1}),((t=l.value)==null?void 0:t.conversationId)===e.conversationId&&(l.value=X(R({},l.value),{groupName:(n=e.groupName)!=null?n:l.value.groupName,memberCount:(a=e.memberCount)!=null?a:l.value.memberCount})),yield Q(!0))})}function Cn(e){return I(this,null,function*(){var t;e&&(h.value=h.value.filter(n=>n.conversationId!==e),at(e),ie(),((t=l.value)==null?void 0:t.conversationId)===e&&(l.value=null,P.value="",s.value="",j(""),c.value=[],le.value="",Ne()),tn())})}function _n(){it.value=zt(),s.value&&z(!0),At(!0)}function Ie(e=!1,t=!1){return I(this,null,function*(){const n=Ke.value.trim();let a=!1;if(!n&&!t){const u=ua();if(u!=null&&u.length){if(b.value=u,Ee(u),ht(),a=!0,!ia())return;e=!0}}!e&&!a&&(Oe.value=!0);try{b.value=(yield ca(n||void 0))||[],n||va(b.value),Ee(b.value),ie(),ht(),q()}finally{!e&&!a&&(Oe.value=!1)}})}function Tn(e){return(e.unreadCount||0)>0&&g.value!==e.id}function yn(e){var t;return(e.unreadCount||0)>0&&((t=l.value)==null?void 0:t.conversationId)!==e.conversationId}function Q(e=!1){return I(this,null,function*(){if(!ue.value){ue.value=!0;try{h.value=(yield da())||[],fa(h.value),ie()}finally{ue.value=!1}}})}function In(){E.value="group",h.value.length||Q()}function F(e,t,n){var y;const a=h.value.findIndex(S=>S.conversationId===e);if(a<0)return;const u=h.value[a],v=R(R({},u),t);n!=null&&n.unreadIncrement&&(v.unreadCount=(u.unreadCount||0)+n.unreadIncrement);const C=h.value.slice();C.splice(a,1),(n==null?void 0:n.moveToTop)!==!1?C.unshift(v):C.splice(a,0,v),h.value=C,ie(),((y=l.value)==null?void 0:y.conversationId)===e&&(l.value=R(R({},l.value),v))}function be(e,t){if(P.value==="group"&&l.value){F(l.value.conversationId,{lastContent:e,lastTime:t,unreadCount:0},{moveToTop:!0});return}const n=ze();n&&ee(n,{conversationId:s.value,lastContent:e,lastTime:t,unreadCount:0},{moveToTop:!0})}function et(e,t){return I(this,null,function*(){var a;const n=!!(t!=null&&t.forceRefreshMessages);if(K.value=0,_e.value=!0,((a=l.value)==null?void 0:a.conversationId)===e.conversationId&&s.value){l.value=X(R({},e),{unreadCount:0}),q(),(n||ce(s.value))&&(yield z(!0,{forceRefresh:!0}));return}P.value="group",l.value=X(R({},e),{unreadCount:0}),M.value=null,g.value="",me(""),s.value=e.conversationId,j(e.conversationId),F(e.conversationId,{unreadCount:0},{moveToTop:!1}),at(e.conversationId),yield z(!0,{forceRefresh:n})})}function bn(){Zt(!0,{members:b.value.filter(e=>e.id!==ct.value&&!re(e))})}function wn(e){return I(this,null,function*(){yield Q(!0);const t=h.value.find(n=>n.conversationId===e.conversationId);t&&(E.value="group",yield et(t,{forceRefreshMessages:!0}))})}function ee(e,t,n){var y;const a=b.value.findIndex(S=>S.id===e);if(a<0)return;const u=b.value[a],v=R(R({},u),t);n!=null&&n.unreadIncrement&&(v.unreadCount=(u.unreadCount||0)+n.unreadIncrement);const C=b.value.slice();C.splice(a,1),(n==null?void 0:n.moveToTop)!==!1?C.unshift(v):C.splice(a,0,v),b.value=C,Ca(e,t,n),Ee(b.value),ie(),(g.value===e||((y=M.value)==null?void 0:y.id)===e)&&(g.value||(g.value=e,me(e)),M.value=R(R({},M.value||v),v),v.conversationId&&v.conversationId!==s.value&&(s.value=v.conversationId,Ce()))}function ht(){const e=ze();if(!e)return;const t=b.value.find(n=>n.id===e);if(t){const n=X(R({},t),{unreadCount:0});M.value=n,g.value=e,me(e),t.conversationId&&(s.value=t.conversationId,j(t.conversationId))}}function q(){s.value&&(Ce(),P.value==="group"&&l.value?(F(l.value.conversationId,{unreadCount:0},{moveToTop:!1}),at(l.value.conversationId)):g.value&&ee(g.value,{unreadCount:0},{moveToTop:!1}),we(s.value).catch(()=>{}))}function Ct(){var e,t;return P.value==="group"?(e=l.value)==null?void 0:e.lastTime:(t=M.value)==null?void 0:t.lastTime}function ve(e){var a;if(e.length>=He){Y.value=!0;return}const t=Ct();if(!t){Y.value=!1;return}const n=(a=c.value[0])==null?void 0:a.createTime;if(!n){Y.value=U(t).isBefore(U().subtract(it.value,"day"));return}Y.value=U(t).isBefore(U(n))}function z(e=!0,t){return I(this,null,function*(){if(!s.value){c.value=[];return}const n=s.value,a=++Ye;let u=!1;const v=!!(t!=null&&t.forceRefresh),C=pn(n,v);if(e){const y=fe(n);if(y!=null&&y.records.length){if(c.value=Qe(y.records),ve(c.value),u=!0,yield H(),N(),we(n).catch(()=>{}),P.value==="group"&&l.value?F(l.value.conversationId,{unreadCount:0},{moveToTop:!1}):g.value&&ee(g.value,{unreadCount:0},{moveToTop:!1}),!C)return}else c.value=[],ve([])}u||(se.value=!0);try{const y=yield ma(e?{conversationId:n,pageSize:He,startTime:Gt()}:{conversationId:n,pageSize:He,beforeTime:c.value.length>0?c.value[0].createTime:Gt()});if(a!==Ye||n!==s.value)return;const S=(y==null?void 0:y.records)||[];if(e){if(S.length>0||!u){const te=rt(c.value,S);c.value=te,pa(n,te,te.length>=He,{allowEmpty:te.length===0})}ve(S.length>0?S:c.value),yield H(),N(),we(n).catch(()=>{}),P.value==="group"&&l.value?F(l.value.conversationId,{unreadCount:0},{moveToTop:!1}):g.value&&ee(g.value,{unreadCount:0},{moveToTop:!1})}else S.length>0?(c.value=[...S,...c.value],ve(S)):Y.value=!1}catch(y){}finally{a===Ye&&(se.value=!1)}})}function _t(){return I(this,null,function*(){if(!s.value||se.value||!Y.value)return;const e=Ae.value,t=(e==null?void 0:e.scrollHeight)||0;yield z(!1),yield H(),e&&(e.scrollTop=e.scrollHeight-t)})}function Mn(){return I(this,null,function*(){const e=Ae.value;if(!e)return;const t=e.scrollHeight-e.scrollTop-e.clientHeight<120;if(_e.value=t,t&&K.value>0&&(K.value=0),!(se.value||!Y.value||qe)&&!(e.scrollTop>80)){qe=!0;try{yield _t()}finally{qe=!1}}})}function Tt(e,t){return I(this,null,function*(){const n=!!(t!=null&&t.forceRefreshMessages);if(K.value=0,_e.value=!0,g.value===e.id&&s.value){M.value=X(R({},e),{unreadCount:0}),q(),(n||ce(s.value))&&(yield z(!0,{forceRefresh:!0}));return}if(g.value=e.id,me(e.id),M.value=X(R({},e),{unreadCount:0}),l.value=null,P.value="single",e.conversationId){s.value=e.conversationId,j(e.conversationId),yield z(!0,{forceRefresh:n});return}const a=yield ya(e.id);s.value=a.conversationId,j(a.conversationId),M.value=X(R({},e),{conversationId:a.conversationId,lastContent:a.lastContent,lastTime:a.lastTime,unreadCount:0}),ee(e.id,{conversationId:a.conversationId,lastContent:a.lastContent,lastTime:a.lastTime,unreadCount:0},{moveToTop:!1}),yield z(!0,{forceRefresh:n})})}function N(){const e=Ae.value;e&&(e.scrollTop=e.scrollHeight,_e.value=!0,K.value=0)}function Sn(e){return I(this,null,function*(){if(s.value){Z.value=!0;try{const t=yield ot({conversationId:s.value,content:e,msgType:La});c.value.push(t),Be(s.value,t),yield H(),N(),be(J(t.content,t.msgType),t.createTime)}finally{Z.value=!1}}})}function kn(){return I(this,null,function*(){const e=le.value.trim();!e||!s.value||(yield zn(e),le.value="")})}function Rn(){var e;if(A.value){if(!s.value){Ue.warning("请先选择聊天对象");return}jt(!0,{snapshot:((e=V.value)==null?void 0:e.listSnapshot)||null})}}function xn(e){return I(this,null,function*(){var a,u,v;if(!e.length||!s.value)return;const t=(a=V.value)==null?void 0:a.listSnapshot;if(!t)return;const n=Pa({pageTitle:((u=V.value)==null?void 0:u.title)||t.title,pagePath:((v=V.value)==null?void 0:v.path)||t.pagePath,rowKey:t.rowKey,columns:t.columns,sourceColumns:t.sourceColumns,rows:e});yield Pn(n)})}function Pn(e){return I(this,null,function*(){if(s.value){Z.value=!0;try{const t=za(e),n=yield ot({conversationId:s.value,content:t,msgType:Aa});c.value.push(n),Be(s.value,n),yield H(),N(),be(J(n.content,n.msgType),n.createTime)}finally{Z.value=!1}}})}function zn(e){return I(this,null,function*(){if(!(!e||!s.value)){Z.value=!0;try{const t=yield ot({conversationId:s.value,content:e,msgType:Da});c.value.push(t),Be(s.value,t),yield H(),N(),be(J(t.content,t.msgType),t.createTime)}finally{Z.value=!1}}})}function yt(e){const t=e.conversationId,n=e.senderId;if(c.value.some(u=>u.id===e.messageId)){be(J(e.content,e.msgType),e.createTime);return}const a={id:e.messageId,conversationId:t,senderId:n,senderName:e.senderName,senderAvatar:e.senderAvatar,content:e.content,msgType:e.msgType,mine:n===ct.value,createTime:e.createTime};c.value.push(a),Be(t,a),be(J(e.content,e.msgType),e.createTime),H(()=>{_e.value?N():K.value++})}function An(){return I(this,null,function*(){s.value&&(yield z(!0,{forceRefresh:!0}),yield H(),N())})}function Ln(e){if(e.cmd!=="chat"||!Ot())return;const t=e.conversationId,n=e.senderId,a=J(e.content,e.msgType),u=e.convType==="group",v=h.value.find(S=>S.conversationId===t);if(Kt(t,n,u||!!v)){We(t),yt(e),we(t);return}if(u||v){if(!v){Q(!0).then(()=>{F(t,{lastContent:a,lastTime:e.createTime})});return}F(t,{lastContent:a,lastTime:e.createTime},{unreadIncrement:1});return}if(Fe(n)){We(t),yt(e),we(t);return}ee(n,{conversationId:t,lastContent:a,lastTime:e.createTime},{unreadIncrement:1})}$n(()=>{un(),Ea(),ke=Qn(Ln),Ie(),At(),xe=Na(()=>{!oe()||!s.value||z(!0,{forceRefresh:!0})}),document.addEventListener("visibilitychange",wt),Se=ea(e=>{!e||!oe()||$t(e)&&(e!==s.value&&We(e),lt(),Vt(e))}),p.embedded?he=Lt(e=>{e&&(It(),q(),nt.value>0&&!h.value.length&&!ue.value&&Q())}):(Ge(!0),nt.value>0&&!h.value.length&&!ue.value&&Q(),he=Lt(e=>{e||(ut(),q())}),Re=ta(e=>Mt(e)),Pe=na(e=>St(e)))}),p.embedded||(Kn(()=>{pe.value=!0,Ge(!0),ut(),q()}),Yn(()=>{pe.value=!1,Ge(!1)}));function It(){if(!s.value)return;if(Ce(),ce(s.value)){z(!0,{forceRefresh:!0});return}if(c.value.length>0){q();return}const e=fe(s.value);if(e!=null&&e.records.length){c.value=Qe(e.records),ve(c.value),H(()=>N()),q();return}z(!0)}function bt(e){if(!e)return;const t=g.value!==e;g.value=e,me(e),P.value="single",l.value=null,t&&(s.value="",j(""),M.value=null)}function wt(){document.hidden||!oe()||!s.value||ce(s.value)&&z(!0,{forceRefresh:!0})}function Mt(e){return I(this,null,function*(){if(!e)return;g.value!==e&&bt(e),b.value.length||(yield Ie(!1,!0));let t=b.value.find(n=>n.id===e);t||(yield Ie(!1,!0),t=b.value.find(n=>n.id===e)),t&&(yield Tt(t,{forceRefreshMessages:!0}))})}function St(e){return I(this,null,function*(){if(!e)return;E.value="group",h.value.length||(yield Q());const t=h.value.find(n=>n.conversationId===e);t&&(yield et(t,{forceRefreshMessages:!0}))})}function Dn(){Ne(),s.value="",j("")}function Gn(){g.value="",s.value="",M.value=null,l.value=null,P.value="",c.value=[],le.value="",Ne(),ie()}return k({restoreSessionIfNeeded:It,openTargetChat:Mt,openGroupConversation:St,clearActiveSession:Gn,pauseActiveSession:Dn,presetActivePeer:bt}),qn(()=>{ke==null||ke(),Se==null||Se(),he==null||he(),Re==null||Re(),Pe==null||Pe(),xe==null||xe(),document.removeEventListener("visibilitychange",wt),p.embedded||Ge(!1),Wt()&&Ne(),Je()}),(e,t)=>{const n=Pt("Icon"),a=aa,u=oa,v=Pt("a-button"),C=Ya,y=Ka,S=Ia,te=sa,kt=wa,En=ba,Nn=$a,Bn=ra;return i(),_("div",{class:B(["im-chat-page",{"im-chat-page--embedded":x.embedded}])},[r("div",{ref_key:"chatRowRef",ref:sn,class:"im-chat-row"},[r("aside",{class:B(["im-chat-left",{collapsed:m.value}]),style:Xn(rn.value)},[r("div",qa,[ne(r("div",Xa,[t[4]||(t[4]=r("span",{class:"title"},"IM聊天",-1)),r("div",ja,w(nn.value),1)],512),[[ae,!m.value]]),f(a,{title:m.value?"展开列表":"折叠列表"},{default:T(()=>[r("button",{type:"button",class:"collapse-btn",onClick:vn},[f(n,{icon:m.value?"ant-design:menu-unfold-outlined":"ant-design:menu-fold-outlined"},null,8,["icon"])])]),_:1},8,["title"])]),ne(r("div",Ja,[r("button",{type:"button",class:B(["im-left-tab",{active:E.value==="member"}]),onClick:t[0]||(t[0]=o=>E.value="member")},[t[5]||(t[5]=W(" 同事 ",-1)),Xe.value>0?(i(),_("span",Za,w(Xe.value>99?"99+":Xe.value),1)):D("",!0)],2),r("button",{type:"button",class:B(["im-left-tab",{active:E.value==="group"}]),onClick:In},[t[6]||(t[6]=W(" 群聊 ",-1)),je.value>0?(i(),_("span",Qa,w(je.value>99?"99+":je.value),1)):D("",!0)],2)],512),[[ae,!m.value]]),ne(r("div",eo,[f(u,{value:Ke.value,"onUpdate:value":t[1]||(t[1]=o=>Ke.value=o),placeholder:"搜索同事","allow-clear":"",size:"small",class:"im-search",onPressEnter:Ie},{suffix:T(()=>[f(n,{icon:"ant-design:search-outlined",class:"im-search-icon",onClick:Ie})]),_:1},8,["value"])],512),[[ae,!m.value&&E.value==="member"]]),ne(r("div",to,[f(v,{type:"primary",size:"small",block:"",onClick:bn},{default:T(()=>[f(n,{icon:"ant-design:plus-outlined"}),t[7]||(t[7]=W(" 发起群聊 ",-1))]),_:1})],512),[[ae,!m.value&&E.value==="group"]]),f(te,{spinning:E.value==="group"?ue.value:Oe.value,class:"left-spin"},{default:T(()=>[r("div",no,[E.value==="member"?(i(),_(de,{key:0},[(i(!0),_(de,null,tt(b.value,o=>(i(),G(a,{key:o.id,title:m.value?o.realname||o.username:"",placement:"right"},{default:T(()=>[r("div",{class:B(["conv-item",{active:g.value===o.id,"conv-item--work-notify":re(o)}]),onClick:De=>Tt(o)},[f(y,{count:Tn(o)?o.unreadCount:0,offset:[-2,2]},{default:T(()=>[re(o)?(i(),G(C,{key:0,size:m.value?36:40,style:{backgroundColor:"#fa8c16"}},{default:T(()=>[f(n,{icon:"ant-design:notification-outlined"})]),_:1},8,["size"])):(i(),G(C,{key:1,size:m.value?36:40,src:Le(o.avatar)},{default:T(()=>[W(w((o.realname||o.username||"?").slice(0,1)),1)]),_:2},1032,["size","src"]))]),_:2},1032,["count"]),ne(r("div",oo,[r("div",so,[r("span",ro,w(o.realname||o.username),1),re(o)?(i(),_("span",lo,"公众号")):D("",!0),r("span",uo,w(Ze(o.lastTime)),1)]),r("div",io,[r("span",co,w(dt(o.lastContent,re(o))),1)])],512),[[ae,!m.value]])],10,ao)]),_:2},1032,["title"]))),128)),!b.value.length&&!m.value?(i(),G(S,{key:0,description:"本部门暂无其他同事"})):D("",!0)],64)):(i(),_(de,{key:1},[(i(!0),_(de,null,tt(h.value,o=>(i(),G(a,{key:o.conversationId,title:m.value?o.groupName:"",placement:"right"},{default:T(()=>{var De;return[r("div",{class:B(["conv-item",((De=l.value)==null?void 0:De.conversationId)===o.conversationId?"active":""]),onClick:Bo=>et(o)},[f(y,{count:yn(o)?o.unreadCount:0,offset:[-2,2]},{default:T(()=>[f(C,{size:m.value?36:40,style:{backgroundColor:"#1677ff"}},{default:T(()=>[f(n,{icon:"ant-design:team-outlined"})]),_:1},8,["size"])]),_:1},8,["count"]),ne(r("div",fo,[r("div",mo,[r("span",po,w(o.groupName),1),r("span",go,w(Ze(o.lastTime)),1)]),r("div",ho,[r("span",Co,w(dt(o.lastContent)),1)])],512),[[ae,!m.value]])],10,vo)]}),_:2},1032,["title"]))),128)),!h.value.length&&!m.value?(i(),G(S,{key:0,description:"暂无群聊点击上方发起群聊"})):D("",!0)],64))])]),_:1},8,["spinning"])],6),ne(r("div",{class:B(["im-resize-handle",{dragging:ye.value}]),onMousedown:dn},null,34),[[ae,!m.value]]),r("main",_o,[r("div",To,[r("span",yo,w(ln.value),1),f(Nn,{trigger:["click"],placement:"bottomRight"},{overlay:T(()=>[f(En,{onClick:gn},{default:T(()=>[pt.value?(i(),G(kt,{key:"groupSettings"},{default:T(()=>[...t[8]||(t[8]=[W("群设置",-1)])]),_:1})):D("",!0),f(kt,{key:"chatSettings"},{default:T(()=>[...t[9]||(t[9]=[W("聊天设置",-1)])]),_:1})]),_:1})]),default:T(()=>[r("button",{type:"button",class:"chat-settings-btn",onClick:t[2]||(t[2]=Jn(()=>{},["prevent"]))},[f(n,{icon:"ant-design:setting-outlined"})])]),_:1})]),M.value||l.value?(i(),_(de,{key:0},[r("div",Io,[r("div",{ref_key:"messageBoxRef",ref:Ae,class:"message-box",onScroll:Mn},[se.value&&c.value.length?(i(),_("div",bo,[f(te,{size:"small"}),t[10]||(t[10]=r("span",null,"加载更早的消息...",-1))])):Y.value&&!c.value.length?(i(),_("div",wo,[f(v,{type:"link",size:"small",loading:se.value,onClick:_t},{default:T(()=>[...t[11]||(t[11]=[W("查看更早的消息",-1)])]),_:1},8,["loading"])])):D("",!0),(i(!0),_(de,null,tt(c.value,o=>(i(),_("div",{key:o.id,class:B(["message-row",o.mine?"mine":"other"])},[f(C,{size:32,src:Le(o.senderAvatar)},{default:T(()=>[W(w((o.senderName||"?").slice(0,1)),1)]),_:2},1032,["src"]),r("div",{class:B(["message-bubble",{"message-bubble--image":O(Nt)(o.msgType),"message-bubble--biz-record":O(Et)(o.msgType)}])},[pt.value||!o.mine?(i(),_("div",Mo,w(o.senderName),1)):D("",!0),O(Nt)(o.msgType)?(i(),_("img",{key:1,class:"message-image",src:Le(o.content),alt:"图片消息",onClick:De=>fn(o.content)},null,8,So)):O(Ma)(o.msgType)?(i(),_("div",ko,w(an(o.content)),1)):O(Et)(o.msgType)&&vt(o.content)?(i(),G(Fa,{key:3,payload:vt(o.content),mine:o.mine,"receiver-has-biz-page-permission":o.receiverHasBizPagePermission,onHandled:An},null,8,["payload","mine","receiver-has-biz-page-permission"])):(i(),_("div",Ro,w(o.content),1)),r("div",xo,w(Ze(o.createTime)),1)],2)],2))),128))],544),f(jn,{name:"new-msg-tip-fade"},{default:T(()=>[K.value>0?(i(),_("div",{key:0,class:"new-msg-tip",onClick:N},[f(n,{icon:"ant-design:arrow-down-outlined"}),W(" "+w(K.value)+" 条新消息 ",1)])):D("",!0)]),_:1})]),r("div",Po,[$.value?(i(),_("div",{key:0,class:B(["im-page-context-bubble",{"is-clickable":A.value}]),title:ge.value,onClick:Rn},[f(n,{icon:"ant-design:environment-outlined",class:"im-page-context-icon"}),r("span",Ao,w($.value),1),A.value?(i(),G(n,{key:0,icon:"ant-design:select-outlined",class:"im-page-context-action"})):D("",!0)],10,zo)):D("",!0),on.value?(i(),_("div",Lo,"工作通知为系统消息通道仅接收审批等工作消息")):(i(),G(Ba,{key:2,modelValue:le.value,"onUpdate:modelValue":t[3]||(t[3]=o=>le.value=o),disabled:!s.value,sending:Z.value,onSend:kn,onImageUploaded:Sn},null,8,["modelValue","disabled","sending"]))])],64)):(i(),G(S,{key:1,class:"empty-chat",description:"请从左侧选择同事或群聊开始聊天"}))])],512),f(Ha,{onRegister:O(Yt),onSaved:_n},null,8,["onRegister"]),f(Ua,{onRegister:O(Xt),onConfirm:xn},null,8,["onRegister"]),f(Wa,{onRegister:O(Jt),onSuccess:wn},null,8,["onRegister"]),f(Oa,{onRegister:O(Qt),onChanged:hn,onExited:Cn},null,8,["onRegister"]),f(Bn,{open:Ve.value,footer:null,width:"720px",onCancel:mn},{default:T(()=>[r("img",{alt:"图片预览",style:{width:"100%"},src:$e.value},null,8,Do)]),_:1},8,["open"])],2)}}}),Rr=Ga(No,[["__scopeId","data-v-4a73c065"]]);export{Rr as default};