@rongcloud/imlib-v2-adapter 5.7.2-beemrtc.2 → 5.7.2-beemrtc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -705,6 +705,7 @@ declare class ChannelClient {
705
705
  * @returns
706
706
  */
707
707
  getFirstUnreadMessage(conversationType: ConversationType, targetId: string, callback: ICallback<IReceivedMessageV2 | null>): void;
708
+ getMessageByUids(msgUids: string[]): IReceivedMessage[];
708
709
  /**
709
710
  * 按msgUids批量获取会话内消息
710
711
  * @param targetId
@@ -1660,6 +1661,12 @@ declare class IMClient {
1660
1661
  * @returns
1661
1662
  */
1662
1663
  getFirstUnreadMessage(conversationType: ConversationType, targetId: string, callback: ICallback<IReceivedMessageV2 | null>): void;
1664
+ /**
1665
+ * 按msgUids批量获取消息
1666
+ * @param msgUids
1667
+ * @returns
1668
+ */
1669
+ getMessageByUids(msgUids: string[]): IReceivedMessage[];
1663
1670
  /**
1664
1671
  * 按msgUids批量获取会话内消息
1665
1672
  * @param targetId
@@ -1668,6 +1675,7 @@ declare class IMClient {
1668
1675
  * @returns
1669
1676
  */
1670
1677
  getMessageByMsgUids(targetId: string, conversationType: ConversationType, msgUids: string[]): IReceivedMessage[];
1678
+ setMessageSearchContent(messageId: number, content: string): Promise<ErrorCode>;
1671
1679
  /**
1672
1680
  * 获取会话免打扰状态
1673
1681
  * @param conversationType 会话类型
package/index.esm.js CHANGED
@@ -1 +1 @@
1
- import{NetworkType as e,HttpMethod as t,HTTP_TIMEOUT as n,appendUrl as o,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as s,ReceivedStatus as r,MessageDirection as c,usingCppEngine as i,assert as g,AssertRules as d,LogTagId as u,isArray as l,ConversationType as h,VersionManage as C,AppStorage as f,APIContext as p,logger as S}from"@rongcloud/engine";export{ChatroomEntryType,ChatroomUserChangeType,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RCConnectionStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var I;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(I||(I={}));var v,m=I;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(v||(v={}));var y=v,R=function(){return R=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},R.apply(this,arguments)};function M(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function T(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(a=2&c[0]?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(6===c[0]&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],o=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var E=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},N=E();var O={tag:"browser",httpReq:function(e){var a=e.method||t.GET,s=e.timeout||n,r=e.headers,c=e.query,i=e.body,g=o(e.url,c);return new Promise((function(e){var t,n=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),o="[object XDomainRequest]"===Object.prototype.toString.call(n);if(n.open(a,g),r&&n.setRequestHeader)for(var c in r)n.setRequestHeader(c,r[c]);if(o){n.timeout=s,n.onload=function(){e({data:n.responseText,status:n.status||200})},n.onerror=function(){e({status:n.status})},n.ontimeout=function(){e({status:n.status})};var d="object"==typeof i?JSON.stringify(i):i;n.send(d)}else n.onreadystatechange=function(){4===n.readyState&&e({data:n.responseText,status:n.status})},n.onerror=function(){e({status:n.status})},setTimeout((function(){n.abort(),e({status:n.status})}),s),n.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:N,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,a=n||o||e.UNKONWN;return new Promise((function(e){e(a)}))}},U=E(),_=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},A={setItem:_("setStorageSync"),getItem:_("getStorageSync"),removeItem:_("removeStorageSync"),clear:_("clearStorageSync")},B={tag:"wechat",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){wx.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:A,sessionStorage:A,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:U,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},L=E(),x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var o=my[e]({key:t[0]}).data;return o?JSON.stringify(o):o}catch(e){}}},w={setItem:x("setStorageSync"),getItem:x("getStorageSync"),removeItem:x("removeStorageSync"),clear:x("clearStorageSync")},P={tag:"alipay",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:s,headers:c,timeout:r,data:g,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:w,sessionStorage:w,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e){return my.connectSocket({url:e}),{id:Date.now(),onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},k=E(),b=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,t)}catch(e){}}},G={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},D={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:k,localStorage:G,sessionStorage:G,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},K=E(),F=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,t)}catch(e){}}},H={setItem:F("setStorageSync"),getItem:F("getStorageSync"),removeItem:F("removeStorageSync"),clear:F("clearStorageSync")},W={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:K,localStorage:H,sessionStorage:H,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return M(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))]}))}))}},j=E(),V=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},J={setItem:V("setStorageSync"),getItem:V("getStorageSync"),removeItem:V("removeStorageSync"),clear:V("clearStorageSync")},q={tag:"jingdong",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){jd.request({url:d,method:s,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:J,sessionStorage:J,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:j,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){jd.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},Y=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},Q={setItem:Y("setStorageSync"),getItem:Y("getStorageSync"),removeItem:Y("removeStorageSync"),clear:Y("clearStorageSync")},X={tag:"uniapp",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){uni.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:Q,sessionStorage:Q,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={url:e,protocols:t},o=uni.connectSocket(n);return{id:Date.now(),onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},z=function(e){return e&&e.request&&e.getSystemInfo},$="undefined"!=typeof uni&&z(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return X;case"mp-jd":return q;case"mp-baidu":return W;case"mp-toutiao":return D;case"mp-alipay":return P;case"mp-weixin":return B;default:return O}}():"undefined"!=typeof jd&&z(jd)?q:"undefined"!=typeof my&&z(my)?P:"undefined"!=typeof tt&&z(tt)?D:"undefined"!=typeof swan&&z(swan)?W:"undefined"!=typeof wx&&z(wx)?B:O;function Z(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var ee=function(){function e(){}return e.set=function(t){if(s[t.messageType]&&s[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=Z(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=Z(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=Z(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),te={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},ne={};function oe(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,g=e.matchCount;if(!i()){var d=ee.get(n,o,t||"");s?d&&s.sentTime<d.sentTime&&(s=d):s=d}var u=s?ae(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:g}}function ae(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,a=e.content,s=e.messageType,c=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,u=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,f=e.expansion,p=e.messageId,S=e.sentStatus,I=e.channelId,v=e.readReceiptInfo,y=e.pushConfig,R=e.extraContent,M="";return s in te?M=te[s]:s in ne?M=ne[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},M="UnknownMessage"),u||(u=r.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:I||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:M,messageUId:c,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:u,receivedTime:l,objectName:s,messageId:p,sentStatus:S||m.SENT,disableNotification:C,canIncludeExpansion:h,expansion:f,readReceiptInfo:v,pushConfig:y,extraContent:R}}function se(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,r=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===r&&s&&i===c.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&s){var d="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),u=a.get(d);if(u)if(e.senderUserId in u)u[e.senderUserId].uIds&&-1===u[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(u[e.senderUserId].uIds.push(e.content.messageUId),u[e.senderUserId].dealtime=e.sentTime,u[e.senderUserId].isResponse=!1,a.set(d,u));else{var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};u[e.senderUserId]=l,a.set(d,u)}else{var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(d,h)}}}function re(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function ce(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var ie=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function ge(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new ie(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var de,ue,le=ge("ReadReceiptResponseMessage","RC:RRRspMsg"),he=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;g("callback",e,d.CALLBACK),g("conversationTypes",t,d.ARRAY),g("count",n,d.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,c=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(oe(e))})):r.forEach((function(e){c.push(oe(e))})),re(e.onSuccess,c)):(o.logger.warn(u.O,"getConversationList -> code:".concat(s)),ce(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;g("callback",n,d.CALLBACK),g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,s,r;return T(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(u.O,"getConversation ->code:".concat(s,",targetId:").concat(t)),n.onError(s),[2]):(n.onSuccess(r?oe(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||ee.remove(e,t,o.channelId),re(n.onSuccess)):(o.logger.warn(u.O,"removeConversation ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("draftText",n,d.STRING,!0),this.logger.info(u.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;g("callback",e,d.CALLBACK),this.logger.info(u.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?re(e.onSuccess,s):(o.logger.warn(u.O,"getTotalUnreadCount ->code:".concat(n)),ce(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?re(n.onSuccess,r):(o.logger.warn(u.O,"getUnreadCount ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(u.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?re(e.onSuccess,!0):(n.logger.warn(u.O,"clearConversations ->code:".concat(t)),ce(e.onError,t))})):this.logger.error(u.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),ce(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;g("callback",e,d.CALLBACK),this.logger.info(u.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?re(e.onSuccess,!0):(t.logger.warn(u.O,"clearUnreadCount ->code:".concat(n)),ce(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?re(n.onSuccess,e.data?ae(e.data):null):(o.logger.warn(u.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),ce(n.onError,e.code))}))},e.prototype.getMessageByMsgUids=function(e,t,n){return this._isCPPMode?(g("targetId",e,d.STRING,!0),g("conversationType",t,d.NUMBER,!0),g("msgUids",n,d.ARRAY,!0),this._context.getMessageByMsgUids(e,this.channelId,t,n)):(this.logger.error(u.O,"getUnreadMentionedMessages method is not supported in a browser!"),[])},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",o,d.CALLBACK),g("status",n,d.OBJECT,!0),this.logger.info(u.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,t,r,c,this.channelId).then((function(e){e===a.SUCCESS?re(o.onSuccess):(s.logger.warn(u.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),ce(o.onError,e))}))},e.prototype.setConversationsMuteStatus=function(e){g("status",e,d.ARRAY,!0),this.logger.info(u.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){g("status",e,d.ARRAY,!0),this.logger.info(u.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,t,n,o,s,i,l,h){var C=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("msg",n,d.OBJECT,!0),g("callback",o,d.CALLBACK),g("isMentioned",s,d.BOOLEAN),g("pushContent",i,d.ONLY_STRING),g("pushData",l,d.ONLY_STRING),g("options.userIds",null==h?void 0:h.userIds,d.ARRAY),g("options.isVoipPush",null==h?void 0:h.isVoipPush,d.BOOLEAN),g("options.disableNotification",null==h?void 0:h.disableNotification,d.BOOLEAN),g("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,d.BOOLEAN),g("options.expansion",null==h?void 0:h.expansion,d.OBJECT),g("options.pushConfig",null==h?void 0:h.pushConfig,d.OBJECT),g("options.resendMessageId",null==h?void 0:h.resendMessageId,d.NUMBER),this.logger.info(u.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var f=!(!(null==h?void 0:h.isStatusMessage)&&!(null==h?void 0:h.isStatus)),p=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,u=a.pushConfig,l=a.resendMessageId,h=a.isResend,C=[];if(t){var f=(n||{}).content.mentionedInfo;C=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:C,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l,isResend:h}}(h,s,n),S=Object.assign(n,R(R({isMentioned:s,pushContent:i,pushData:l},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:f})),I=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(u.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),v),this._context.sendMessage(e,t,S,o.onBefore,v).then((function(s){var i=s.code,g=s.data,d=i===a.SUCCESS?"info":"warn";if(C.logger[d](u.A_SEND_MSG_R,JSON.stringify({code:i,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),v),i===a.SUCCESS){C._isCPPMode||ee.set(g);var l=ae(g);se(l,I,C._context.getConnectedTime(),C._readReceiptTimeout,C._storage),re(o.onSuccess,l)}else C.logger.warn(u.O,"sendMessage ->code:".concat(i,",targetId:").concat(t)),ce(o.onError,i,ae({isMentioned:!!S.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==h?void 0:h.disableNotification),canIncludeExpansion:!!(null==h?void 0:h.canIncludeExpansion),expansion:(null==h?void 0:h.expansion)||null,conversationType:e,targetId:t,senderUserId:I,messageUId:"",messageDirection:c.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:r.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:m.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;g("message.conversationType",e.conversationType,d.NUMBER,!0),g("message.targetId",e.targetId,d.STRING,!0),g("message.messageUId",e.messageUId,d.STRING,!0),g("message.sentTime",e.sentTime,d.NUMBER,!0),g("callback",t,d.CALLBACK),g("options.disableNotification",null==n?void 0:n.disableNotification,d.BOOLEAN),g("options.pushConfig",null==n?void 0:n.pushConfig,d.OBJECT),g("options.extra",null==n?void 0:n.extra,d.STRING);var s=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(u.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(s,",messageUId:").concat(c));var l=R({channelId:this.channelId},n);this._context.recallMessage(s,r,c,i,l).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||ee.set(s),re(t.onSuccess,ae(s))):(o.logger.warn(u.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),ce(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("typingContentType",n,d.STRING,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(u.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),c),this._context.sendMessage(e,t,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===a.SUCCESS?"info":"warn";s.logger[i](u.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===a.SUCCESS?re(o.onSuccess,ae(r)):(s.logger.warn(u.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),ce(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(u.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var c=[];for(var i in r){var g={};g[i]=r[i].uIds,r[i].isResponse||c.push(g)}if(0===c.length)return void n.onSuccess(null);var d=setInterval((function(){1===c.length&&clearInterval(d);var a=c.splice(0,1)[0],i=new le({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),re(n.onSuccess,e)},onError:function(e){o.logger.warn(u.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),ce(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;g("messageUIds",e,d.ARRAY,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var s=0,r=e;s<r.length;s++){var c=r[s];g("messageUId",c,d.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(s){var r=s.code;r===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(u.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;g("messageUId",e,d.STRING,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(u.O,"getMessageReader ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(u.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.setReadMessages=function(e,t,n,o){var s=this;g("targetId",e,d.STRING,!0),g("beginMessageUId",t,d.STRING,!0),g("endMessageUId",n,d.STRING,!0),this.logger.info(u.O,"setReadMessages ->targetId:".concat(e,",\n channelId:").concat(this.channelId,",\n beginMessageUId:").concat(t,",\n endMessageUId:").concat(n)),this._context.setReadMessages(e,this.channelId,t,n).then((function(r){var c=r.code;c===a.SUCCESS?o.onSuccess():(s.logger.warn(u.O,"setReadMessages ->code:".concat(c,",targetId:").concat(e,",channelId:").concat(s.channelId,",\n beginMessageUId:").concat(t,",endMessageUId:").concat(n)),o.onError(c))})).catch((function(a){s.logger.warn(u.O,"setReadMessages ->code:".concat(a,",targetId:").concat(e,",channelId:").concat(s.channelId,",\n beginMessageUId:").concat(t,",endMessageUId:").concat(n)),o.onError(a)}))},e.prototype.getMessageReceiptInfo=function(e,t,n){var o=this;g("messageUId",e,d.STRING,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getMessageReceiptInfo ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReceiptInfo(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(u.O,"getMessageReceiptInfo ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(u.O,"getMessageReceiptInfo ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;g("expansion",e,d.OBJECT,!0),g("message",t,d.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion,l=t.expansion;this.logger.info(u.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:l,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ce(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;g("keys",e,d.ARRAY,!0),g("message",t,d.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion;this.logger.info(u.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ce(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,c){var i=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),g("count",o,d.NUMBER,!0),g("callback",s,d.CALLBACK,!0),g("order",c,d.NUMBER),this.logger.info(u.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var l=this.logger.createTraceId();this.logger.info(u.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),l),this._context.getHistoryMessage(e,t,n,o,c,this.channelId,r,l).then((function(e){var t=e.code,n=e.data;if(t===a.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],g=o.map((function(e){return c.push(e.messageUId),ae(e)}));i.logger.info(u.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),l),re(s.onSuccess,g,r)}else i.logger.info(u.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),l),re(s.onSuccess,[],!1);else i.logger.warn(u.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),l),ce(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("messages",n,d.ARRAY,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var c=ee.get(e,t,s.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&ee.remove(e,t,s.channelId)}))}re(o.onSuccess)}else s.logger.warn(u.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),ce(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;g("param.conversationType",e.conversationType,d.NUMBER,!0),g("param.targetId",e.targetId,d.STRING,!0),g("param.timestamp",e.timestamp,d.NUMBER,!0),g("callback",t,d.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(u.O,"clearRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"clearRemoteHistoryMessages ->code:".concat(e)),ce(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){g("callback",e,d.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?re(e.onSuccess,o.map(oe)):ce(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){g("callback",e,d.CALLBACK),g("index",t,d.NUMBER),g("limit",n,d.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?re(e.onSuccess,o.map(oe)):ce(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var l=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,f=n.sentTime,p=n.sentStatus;this.logger.info(u.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=s.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:f,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:C,canIncludeExpansion:l,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,I).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?re(o.onSuccess,ae(s)):(r.logger.warn(u.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),ce(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===a.SUCCESS?re(n.onSuccess,o):ce(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===a.SUCCESS?re(n.onSuccess,o):ce(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(u.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?re(s.onSuccess,!0):(r.logger.warn(u.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),ce(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var c=this;this.logger.info(u.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return ae(e)}));re(s.onSuccess,g,i)}else re(s.onSuccess,[],!1);else c.logger.warn(u.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),ce(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(u.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||ee.remove(e,t,o.channelId),re(n.onSuccess,!0)):(o.logger.warn(u.O,"clearMessages ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(u.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(oe(e))})),re(t.onSuccess,c)):(s.logger.warn(u.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),ce(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),this.logger.info(u.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(oe(e))})),re(t.onSuccess,c)):(s.logger.warn(u.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),ce(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,c){var i=this;this.logger.info(u.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,s,r,this.channelId).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){s.push(ae(e))})),re(c.onSuccess,s,d)}else i.logger.warn(u.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),ce(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var c=this;this.logger.info(u.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(s)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,s).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){s.push(ae(e))})),re(r.onSuccess,s,d)}else c.logger.warn(u.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ce(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,c,i){var g=this;this.logger.info(u.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(s,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,c).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(ae(e))})),re(i.onSuccess,s)):(g.logger.warn(u.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ce(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(u.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return ae(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(u.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?re(o.onSuccess,!0):(s.logger.warn(u.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),ce(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(u.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?re(n.onSuccess,r):(o.logger.warn(u.O,"getConversationNotificationStatus ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(u.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?re(n.onSuccess,r):(o.logger.warn(u.O,"getGroupMessageDeliverList ->code:".concat(s,",messageUId:").concat(t)),ce(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(u.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getPrivateMessageDeliverTime ->code:".concat(s,",messageUId:").concat(e)),ce(t.onError,s))}))},e}(),Ce=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},fe=function(){function e(e,t,n,o){this._context=e,this._options=t,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=i(),this._defaultChannelClient=new he(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(u.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(u.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(u.O,"getChannel method is only available in protocol stack mode"),null;if(g("channelId",e,d.STRING,!0),e.length>20)return this.logger.error(u.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(u.O,"Only 1000 channels can be obtained"),null;var t=new he(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;g("channelIds",e,d.ARRAY,!0),this.logger.info(u.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.7.2-beemrtc.2"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return M(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info(u.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(u.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.setConversationsMuteStatus=function(e){return this._defaultChannelClient.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){return this._defaultChannelClient.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.getMessageReceiptInfo=function(e,t,n){this._defaultChannelClient.getMessageReceiptInfo(e,t,n)},e.prototype.setReadMessages=function(e,t,n,o){this._defaultChannelClient.setReadMessages(e,t,n,o)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"joinChatRoom ->chatRoomId:".concat(e));var s=this.logger.createTraceId();this.logger.info(u.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),s),this._context.joinChatroom(e,t,s).then((function(t){var r=t===a.SUCCESS?"info":"warn";o.logger[r](u.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),s),t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;g("chatRoomId",e,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(u.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(s){var r=s===a.SUCCESS?"info":"warn";n.logger[r](u.A_QUIT_CHATROOM_R,JSON.stringify({code:s}),o),s===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"quitChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),ce(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;g("chatRoomId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("order",n,d.NUMBER,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?re(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(u.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),ce(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(g("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){g("entry.key",e.key,d.STRING,!0),g("entry.value",e.value,d.STRING,!0)})),g("options.isAutoDelete",e.isAutoDelete,d.BOOLEAN)}(t),g("callback",n,d.CALLBACK),t.entries.length>10)ce(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:".concat(e);this.logger.info(u.O,"set chatroom entry->".concat(s)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"set chatroom entry fail ->code+:".concat(t,",").concat(s)),ce(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){g("key",e,d.STRING,!0)}))}(t);var s="id:".concat(e);this.logger.debug(u.O,"remove chatroom entry->".concat(s));var r=R({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(s)),ce(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("key",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?re(n.onSuccess,r||""):(o.logger.warn(u.O,"getChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),ce(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;g("chatRoomId",e,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getAllChatroomEntries ->code:".concat(s,",chatRoomId:").concat(e)),ce(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),g("chatRoomId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("order",n,d.NUMBER,!0),g("callback",o,d.CALLBACK),g("timestamp",s,d.NUMBER),this.logger.info(u.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,s).then((function(t){var n=t.code,s=t.data;if(n===a.SUCCESS)if(s){var c=s.list,i=s.hasMore,g=c.map((function(e){return ae(e)}));re(o.onSuccess,g,i)}else re(o.onSuccess,[],!1);else r.logger.warn(u.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),ce(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,a){g("fileType",e,d.NUMBER,!0),g("fileName",n,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,a,s){g("fileType",e,d.NUMBER,!0),g("fileName",t,d.STRING,!0),g("saveName",n,d.STRING),g("callback",o,d.CALLBACK),g("serverType",s,d.NUMBER),g("uploadRes",a,d.OBJECT),this.logger.info(u.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,a,s).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;g("tag.tagId",e.tagId,d.STRING,!0),g("tag.tagId",e.tagId,(function(e){return e.length<=10})),g("tag.tagName",e.tagName,(function(e){return e.length<=15})),g("tag.tagName",e.tagName,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(u.O,"createTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(u.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;g("tagId",e,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(u.O,"removeTag ->code:".concat(s,",tagId:").concat(e)),t.onError(s))})).catch((function(o){n.logger.warn(u.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;g("tag.tagId",e.tagId,d.STRING,!0),g("tag.tagName",e.tagName,d.STRING,!0),g("tag.tagName",e.tagName,(function(e){return e.length<=15})),g("callback",t,d.CALLBACK),this.logger.info(u.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(u.O,"updateTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(u.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;g("callback",e,d.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(u.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(u.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;g("conversationType",e.type,d.NUMBER),g("targetId",e.targetId,d.STRING),g("channelId",e.channelId,d.ONLY_STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Ce(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(u.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(u.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;g("tagId",e,d.STRING,!0),g("conversations",t,d.ARRAY,!0),g("callback",n,d.CALLBACK),t.forEach((function(e){g("conversation.type",e.type,d.NUMBER,!0),g("conversation.targetId",e.targetId,d.STRING,!0),g("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(u.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return Ce(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"addTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(u.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;g("tagId",e,d.STRING,!0),g("conversations",t,d.ARRAY,!0),g("callback",n,d.CALLBACK),t.forEach((function(e){g("conversation.type",e.type,d.NUMBER,!0),g("conversation.targetId",e.targetId,d.STRING,!0),g("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(u.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return Ce(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"removeTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(u.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;g("conversation.type",e.type,d.NUMBER,!0),g("conversation.targetId",e.targetId,d.STRING,!0),g("conversation.channelId",e.channelId,d.ONLY_STRING),g("tagIds",t,d.ARRAY,!0),g("callback",n,d.CALLBACK),t.forEach((function(e){g("tagId",e,d.STRING,!0)})),this.logger.info(u.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Ce(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"removeTagsForConversation ->code:".concat(s,",tagIds:").concat(t)),n.onError(s))})).catch((function(e){o.logger.warn(u.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;g("tagId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("startTime",n,d.NUMBER,!0),g("callback",o,d.CALLBACK,!0),this.logger.info(u.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,c=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?ae(s):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(s.logger.warn(u.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(u.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;g("tagId",e,d.STRING,!0),g("containMuted",t,d.BOOLEAN,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var s=t.code,r=t.data;o.logger.info(u.O,JSON.stringify({code:s,data:r})),s===a.SUCCESS?n.onSuccess(r||0):(o.logger.warn(u.O,"getUnreadCountByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(u.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;g("tagId",e,d.STRING,!0),g("conversation.targetId",t.targetId,d.STRING,!0),g("conversation.type",t.type,d.NUMBER,!0),g("conversation.channelId",t.channelId,d.ONLY_STRING),g("status.isTop",null==n?void 0:n.isTop,d.BOOLEAN,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,Ce(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(u.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(u.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];this.logger.info(u.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],s,!1)).then((function(n){var s=n.code,r=n.data;if(s!==a.SUCCESS)o.logger.warn(u.O,"callExtra ->code:".concat(s)),t.onError&&ce(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?ae(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return ae(e)}));return void re(t.onSuccess,d,g)}t.onSuccess&&re(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){g("callback",t,d.CALLBACK),this.logger.info(u.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){re(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(u.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;g("status",e,d.NUMBER),g("callback",t,d.CALLBACK),this.logger.info(u.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?re(t.onSuccess,!0):(n.logger.warn(u.O,"setUserStatus ->code:".concat(e)),ce(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getUserStatus ->code:".concat(s,",useerId:").concat(e)),ce(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),ce(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),ce(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;g("callback",e,d.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?re(e.onSuccess,s):(t.logger.warn(u.O,"getBlacklist ->code:".concat(o)),ce(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getBlacklistStatus ->code:".concat(s,",userId:").concat(e)),ce(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("content.senderUserId",n.senderUserId,d.STRING,!0),g("content.messageDirection",n.messageDirection,d.NUMBER,!0),g("content.objectName",n.objectName,d.STRING,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){s._defaultChannelClient.insertMessage(e,t,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,a,s=this;for(var r in g("messages",e,(function(t){return l(t)&&!(e.length<=0||e.length>=500)}),!0),g("checkDuplicate",t,d.BOOLEAN),g("callback",n,d.CALLBACK),e)g("message",e[r],d.OBJECT,!0),g("message.conversationType",e[r].conversationType,(function(e){return[h.PRIVATE,h.DISCUSSION,h.GROUP,h.CUSTOMER_SERVICE,h.SYSTEM,h.APP_PUBLIC_SERVICE,h.PUBLIC_SERVICE].includes(e)}),!0),g("message.targetId",e[r].targetId,d.STRING,!0),g("message.senderUserId",e[r].senderUserId,d.STRING,!0),g("message.messageType",e[r].messageType,d.STRING,!0),g("message.content",e[r].content,d.OBJECT,!0),g("message.messageDirection",e[r].messageDirection,d.NUMBER,!0),g("message.canIncludeExpansion",e[r].canIncludeExpansion,d.BOOLEAN),g("message.expansion",e[r].expansion,d.OBJECT),g("message.disableNotification",e[r].disableNotification,d.BOOLEAN),g("message.sentTime",e[r].sentTime,d.NUMBER),g("message.sentStatus",e[r].sentStatus,d.NUMBER),g("options.isUnread",null===(o=e[r])||void 0===o?void 0:o.isUnread,d.BOOLEAN),g("options.searchContent",null===(a=e[r])||void 0===a?void 0:a.searchContent,d.STRING);this.assertCPPMode((function(){s._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),g("count",o,d.NUMBER,!0),g("callback",a,d.CALLBACK),g("options.order",s.order,d.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;g("messageIds",n,d.ARRAY,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?re(o.onSuccess,!0):(s.logger.warn(u.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),ce(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),g("cleanSpace",o,d.BOOLEAN),g("callback",a,d.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;g("callback",t,d.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,ae(r)):(n.logger.warn(u.O,"getMessage ->code:".concat(s,",messageId:").concat(e)),ce(t.onError,s))}))}),"getMessage",t)},e.prototype.setTextMessageExtra=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("value",t,d.STRING,!1),this.logger.info(u.O,"setTextMessageExtra ->messageId:".concat(e,",value:").concat(t)),this.assertCPPMode((function(){o._context.setTextMessageExtra(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"setTextMessageExtra ->code:".concat(t,",messageId:").concat(e)),ce(n.onError,t))}))}),"setTextMessageExtra",n)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("sentStatus",t,d.NUMBER,!0),this.logger.info(u.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),ce(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("receivedStatus",t,d.NUMBER,!0),this.logger.info(u.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),ce(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;g("messageId",e,d.NUMBER,!0),g("objectName",n,d.ONLY_STRING,!0),this.assertCPPMode((function(){s.logger.info(u.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),s._context.setMessageContent(e,t,n).then((function(e){e===a.SUCCESS?re(o.onSuccess,!0):ce(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("searchFiles",n,d.STRING,!0),this.logger.info(u.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;g("keyword",e,d.STRING,!0),g("callback",t,d.CALLBACK),g("conversationTypes",n,d.ARRAY),g("customMessageType",o,d.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),g("keyword",e,d.STRING,!0),g("callback",t,d.CALLBACK),g("conversationTypes",o,d.ARRAY),g("customMessageType",n,d.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("keyword",n,d.STRING,!0),g("timestamp",o,d.NUMBER),g("count",a,d.NUMBER),g("total",s,d.NUMBER),g("callback",r,d.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("keyword",n,d.STRING,!0),g("timestamp",o,d.NUMBER),g("count",a,d.NUMBER),g("callback",s,d.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("keyword",n,d.STRING,!0),g("startTime",o,d.NUMBER),g("endTime",a,d.NUMBER),g("offset",s,d.NUMBER),g("limit",r,d.NUMBER),g("callback",c,d.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(u.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getMessageByMsgUids=function(e,t,n){return this._defaultChannelClient.getMessageByMsgUids(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),pe=1;C.add("imlib-v2-adapter","5.7.2-beemrtc.2");var Se,Ie,ve=null,me={init:function(e,t,n){var o;void 0===n&&(n={}),g("appkey",e,d.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||$;Se=new f(a,"API-V2"),ue=p.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(ve=ue.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),ve.info(u.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),pe=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),de=new fe(ue,{readReceiptTimeout:pe},ve,Se),S.init(ve)},getInstance:function(){return de},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){ue.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==ve||ve.error(u.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){ue.assignWatcher({message:function(t,n,o){try{var a=ae(t),s=ue.getCurrentUserId(),r=ue.getConnectedTime();se(a,s,r,pe,Se),a=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],u=0;u<c.length;u++)i="".concat(t).concat(c[u],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[u]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[u]]=g.count,a.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(a,s,r,pe,Se),i()||ee.set(t),e.onReceived(a,void 0,o)}catch(e){null==ve||ve.error(u.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){ue.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==ve||ve.error(u.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ue.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ve||ve.error(u.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ue.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ve||ve.error(u.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ue.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ve||ve.error(u.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ue.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ve||ve.error(u.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ue.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ve||ve.error(u.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ue.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ue.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ue.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(u.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ue.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(u.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,s,r,c;return T(this,(function(i){switch(i.label){case 0:return o=null==ve?void 0:ve.createTraceId(),null==ve||ve.info(u.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ue.connect(e,!!n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==ve||ve[r](u.A_CONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===a.SUCCESS?(t.onSuccess(s.userId),c=new Date(ue.getConnectedTime()-1e3*pe*60*60*24).getTime(),Se.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=Se.get(e).dealtime;t&&c-t>0&&Se.remove(e)}else if(/RECEIVED$/.test(e)){var n=Se.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&c-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?Se.remove(e):Se.set(e,n))}}))):s.code===a.RC_CONN_TOKEN_INCORRECT?(null==ve||ve.warn(u.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ve||ve.warn(u.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onError(s.code)),[2]}}))}))},reconnect:function(e,t,n){var o=null==ve?void 0:ve.createTraceId();null==ve||ve.info(u.A_RECONNECT_T,null,o),ue.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==ve||ve[n](u.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==ve||ve.warn(u.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:ne,getMessageObjectName:function(e){var t=R(R({},te),ne);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=ge(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,ue.registerMessageType(t,n.isPersited,n.isCounted,o)}},ye=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},Re=function(e,t){this.isCounted=e,this.isPersited=t},Me=ge("TextMessage","RC:TxtMsg"),Te=ge("LocationMessage","RC:LBSMsg"),Ee=ge("TypingStatusMessage","RC:TypSts"),Ne=ge("ImageMessage","RC:ImgMsg"),Oe=ge("RichContentMessage","RC:ImgTextMsg"),Ue=ge("VoiceMessage","RC:VcMsg"),_e=ge("HQVoiceMessage","RC:HQVCMsg"),Ae=ge("FileMessage","RC:FileMsg"),Be=ge("SightMessage","RC:SightMsg"),Le=ge("GIFMessage","RC:GIFMsg"),xe=ge("ReadReceiptMessage","RC:ReadNtf"),we=ge("ReadReceiptRequestMessage","RC:RRReqMsg"),Pe=ge("RCCombineMessage","RC:CombineMsg"),ke=function(e,t,n,o,a,s,r,c,i,g,d,u,l,h,C,f,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=f,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(Ie||(Ie={}));var be,Ge=ge("AcceptMessage","RC:VCAccept"),De=ge("RingingMessage","RC:VCRinging"),Ke=ge("SummaryMessage","RC:VCSummary"),Fe=ge("HungupMessage","RC:VCHangup"),He=ge("InviteMessage","RC:VCInvite"),We=ge("MediaModifyMessage","RC:VCModifyMedia"),je=ge("MemberModifyMessage","RC:VCModifyMem"),Ve=ge("lastMessageSendTime","RC:SRSMsg"),Je=ge("ReferenceMessage","RC:ReferenceMsg"),qe=ge("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ye=ge("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(be||(be={}));var Qe=be,Xe={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=me);export{Ge as AcceptMessage,ie as BaseMessage,he as ChannelClient,Xe as ConnectionState,Ae as FileMessage,Le as GIFMessage,y as GetChatRoomType,_e as HQVoiceMessage,Fe as HungupMessage,fe as IMClient,Ne as ImageMessage,He as InviteMessage,Te as LocationMessage,We as MediaModifyMessage,je as MemberModifyMessage,ye as MentionedInfo,Qe as MentionedType,ke as Message,Re as MessageTag,Ye as PublicServiceMultiRichContentMessage,qe as PublicServiceRichContentMessage,Pe as RCCombineMessage,xe as ReadReceiptMessage,we as ReadReceiptRequestMessage,le as ReadReceiptResponseMessage,Je as ReferenceMessage,Oe as RichContentMessage,De as RingingMessage,me as RongIMClient,m as SentStatus,Be as SightMessage,Ke as SummaryMessage,Ve as SyncReadStatusMessage,Me as TextMessage,Ee as TypingStatusMessage,Ie as VoIPMediaType,Ue as VoiceMessage};
1
+ import{NetworkType as e,HttpMethod as t,HTTP_TIMEOUT as n,appendUrl as o,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as s,ReceivedStatus as r,MessageDirection as c,usingCppEngine as i,assert as g,AssertRules as d,LogTagId as u,isArray as l,ConversationType as h,VersionManage as C,AppStorage as f,APIContext as p,logger as S}from"@rongcloud/engine";export{ChatroomEntryType,ChatroomUserChangeType,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RCConnectionStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var I;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(I||(I={}));var v,m=I;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(v||(v={}));var y=v,M=function(){return M=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},M.apply(this,arguments)};function R(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function T(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(a=2&c[0]?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(6===c[0]&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],o=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var E=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},N=E();var O={tag:"browser",httpReq:function(e){var a=e.method||t.GET,s=e.timeout||n,r=e.headers,c=e.query,i=e.body,g=o(e.url,c);return new Promise((function(e){var t,n=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),o="[object XDomainRequest]"===Object.prototype.toString.call(n);if(n.open(a,g),r&&n.setRequestHeader)for(var c in r)n.setRequestHeader(c,r[c]);if(o){n.timeout=s,n.onload=function(){e({data:n.responseText,status:n.status||200})},n.onerror=function(){e({status:n.status})},n.ontimeout=function(){e({status:n.status})};var d="object"==typeof i?JSON.stringify(i):i;n.send(d)}else n.onreadystatechange=function(){4===n.readyState&&e({data:n.responseText,status:n.status})},n.onerror=function(){e({status:n.status})},setTimeout((function(){n.abort(),e({status:n.status})}),s),n.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:N,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,a=n||o||e.UNKONWN;return new Promise((function(e){e(a)}))}},U=E(),_=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},A={setItem:_("setStorageSync"),getItem:_("getStorageSync"),removeItem:_("removeStorageSync"),clear:_("clearStorageSync")},B={tag:"wechat",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){wx.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:A,sessionStorage:A,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:U,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},L=E(),x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var o=my[e]({key:t[0]}).data;return o?JSON.stringify(o):o}catch(e){}}},w={setItem:x("setStorageSync"),getItem:x("getStorageSync"),removeItem:x("removeStorageSync"),clear:x("clearStorageSync")},P={tag:"alipay",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:s,headers:c,timeout:r,data:g,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:w,sessionStorage:w,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e){return my.connectSocket({url:e}),{id:Date.now(),onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},k=E(),b=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,t)}catch(e){}}},G={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},D={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:k,localStorage:G,sessionStorage:G,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},K=E(),F=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,t)}catch(e){}}},H={setItem:F("setStorageSync"),getItem:F("getStorageSync"),removeItem:F("removeStorageSync"),clear:F("clearStorageSync")},W={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:K,localStorage:H,sessionStorage:H,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return R(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))]}))}))}},j=E(),V=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},J={setItem:V("setStorageSync"),getItem:V("getStorageSync"),removeItem:V("removeStorageSync"),clear:V("clearStorageSync")},q={tag:"jingdong",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){jd.request({url:d,method:s,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:J,sessionStorage:J,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:j,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){jd.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},Y=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},Q={setItem:Y("setStorageSync"),getItem:Y("getStorageSync"),removeItem:Y("removeStorageSync"),clear:Y("clearStorageSync")},X={tag:"uniapp",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){uni.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:Q,sessionStorage:Q,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={url:e,protocols:t},o=uni.connectSocket(n);return{id:Date.now(),onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},z=function(e){return e&&e.request&&e.getSystemInfo},$="undefined"!=typeof uni&&z(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return X;case"mp-jd":return q;case"mp-baidu":return W;case"mp-toutiao":return D;case"mp-alipay":return P;case"mp-weixin":return B;default:return O}}():"undefined"!=typeof jd&&z(jd)?q:"undefined"!=typeof my&&z(my)?P:"undefined"!=typeof tt&&z(tt)?D:"undefined"!=typeof swan&&z(swan)?W:"undefined"!=typeof wx&&z(wx)?B:O;function Z(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var ee=function(){function e(){}return e.set=function(t){if(s[t.messageType]&&s[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=Z(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=Z(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=Z(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),te={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},ne={};function oe(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,g=e.matchCount;if(!i()){var d=ee.get(n,o,t||"");s?d&&s.sentTime<d.sentTime&&(s=d):s=d}var u=s?ae(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:g}}function ae(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,a=e.content,s=e.messageType,c=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,u=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,f=e.expansion,p=e.messageId,S=e.sentStatus,I=e.channelId,v=e.readReceiptInfo,y=e.pushConfig,M=e.extraContent,R="";return s in te?R=te[s]:s in ne?R=ne[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},R="UnknownMessage"),u||(u=r.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:I||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:R,messageUId:c,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:u,receivedTime:l,objectName:s,messageId:p,sentStatus:S||m.SENT,disableNotification:C,canIncludeExpansion:h,expansion:f,readReceiptInfo:v,pushConfig:y,extraContent:M}}function se(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,r=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===r&&s&&i===c.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&s){var d="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),u=a.get(d);if(u)if(e.senderUserId in u)u[e.senderUserId].uIds&&-1===u[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(u[e.senderUserId].uIds.push(e.content.messageUId),u[e.senderUserId].dealtime=e.sentTime,u[e.senderUserId].isResponse=!1,a.set(d,u));else{var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};u[e.senderUserId]=l,a.set(d,u)}else{var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(d,h)}}}function re(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function ce(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var ie=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function ge(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new ie(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var de,ue,le=ge("ReadReceiptResponseMessage","RC:RRRspMsg"),he=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;g("callback",e,d.CALLBACK),g("conversationTypes",t,d.ARRAY),g("count",n,d.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,c=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(oe(e))})):r.forEach((function(e){c.push(oe(e))})),re(e.onSuccess,c)):(o.logger.warn(u.O,"getConversationList -> code:".concat(s)),ce(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;g("callback",n,d.CALLBACK),g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),R(o,void 0,void 0,(function(){var o,s,r;return T(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(u.O,"getConversation ->code:".concat(s,",targetId:").concat(t)),n.onError(s),[2]):(n.onSuccess(r?oe(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||ee.remove(e,t,o.channelId),re(n.onSuccess)):(o.logger.warn(u.O,"removeConversation ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("draftText",n,d.STRING,!0),this.logger.info(u.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;g("callback",e,d.CALLBACK),this.logger.info(u.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?re(e.onSuccess,s):(o.logger.warn(u.O,"getTotalUnreadCount ->code:".concat(n)),ce(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?re(n.onSuccess,r):(o.logger.warn(u.O,"getUnreadCount ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(u.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?re(e.onSuccess,!0):(n.logger.warn(u.O,"clearConversations ->code:".concat(t)),ce(e.onError,t))})):this.logger.error(u.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),ce(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;g("callback",e,d.CALLBACK),this.logger.info(u.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?re(e.onSuccess,!0):(t.logger.warn(u.O,"clearUnreadCount ->code:".concat(n)),ce(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?re(n.onSuccess,e.data?ae(e.data):null):(o.logger.warn(u.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),ce(n.onError,e.code))}))},e.prototype.getMessageByUids=function(e){return this._isCPPMode?(g("msgUids",e,d.ARRAY,!0),this._context.getMessageByUids(e)):(this.logger.error(u.O,"getMessageByUids method is not supported in a browser!"),[])},e.prototype.getMessageByMsgUids=function(e,t,n){return this._isCPPMode?(g("targetId",e,d.STRING,!0),g("conversationType",t,d.NUMBER,!0),g("msgUids",n,d.ARRAY,!0),this._context.getMessageByMsgUids(e,this.channelId,t,n)):(this.logger.error(u.O,"getUnreadMentionedMessages method is not supported in a browser!"),[])},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",o,d.CALLBACK),g("status",n,d.OBJECT,!0),this.logger.info(u.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,t,r,c,this.channelId).then((function(e){e===a.SUCCESS?re(o.onSuccess):(s.logger.warn(u.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),ce(o.onError,e))}))},e.prototype.setConversationsMuteStatus=function(e){g("status",e,d.ARRAY,!0),this.logger.info(u.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){g("status",e,d.ARRAY,!0),this.logger.info(u.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,t,n,o,s,i,l,h){var C=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("msg",n,d.OBJECT,!0),g("callback",o,d.CALLBACK),g("isMentioned",s,d.BOOLEAN),g("pushContent",i,d.ONLY_STRING),g("pushData",l,d.ONLY_STRING),g("options.userIds",null==h?void 0:h.userIds,d.ARRAY),g("options.isVoipPush",null==h?void 0:h.isVoipPush,d.BOOLEAN),g("options.disableNotification",null==h?void 0:h.disableNotification,d.BOOLEAN),g("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,d.BOOLEAN),g("options.expansion",null==h?void 0:h.expansion,d.OBJECT),g("options.pushConfig",null==h?void 0:h.pushConfig,d.OBJECT),g("options.resendMessageId",null==h?void 0:h.resendMessageId,d.NUMBER),this.logger.info(u.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var f=!(!(null==h?void 0:h.isStatusMessage)&&!(null==h?void 0:h.isStatus)),p=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,u=a.pushConfig,l=a.resendMessageId,h=a.isResend,C=[];if(t){var f=(n||{}).content.mentionedInfo;C=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:C,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l,isResend:h}}(h,s,n),S=Object.assign(n,M(M({isMentioned:s,pushContent:i,pushData:l},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:f})),I=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(u.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),v),this._context.sendMessage(e,t,S,o.onBefore,v).then((function(s){var i=s.code,g=s.data,d=i===a.SUCCESS?"info":"warn";if(C.logger[d](u.A_SEND_MSG_R,JSON.stringify({code:i,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),v),i===a.SUCCESS){C._isCPPMode||ee.set(g);var l=ae(g);se(l,I,C._context.getConnectedTime(),C._readReceiptTimeout,C._storage),re(o.onSuccess,l)}else C.logger.warn(u.O,"sendMessage ->code:".concat(i,",targetId:").concat(t)),ce(o.onError,i,ae({isMentioned:!!S.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==h?void 0:h.disableNotification),canIncludeExpansion:!!(null==h?void 0:h.canIncludeExpansion),expansion:(null==h?void 0:h.expansion)||null,conversationType:e,targetId:t,senderUserId:I,messageUId:"",messageDirection:c.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:r.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:m.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;g("message.conversationType",e.conversationType,d.NUMBER,!0),g("message.targetId",e.targetId,d.STRING,!0),g("message.messageUId",e.messageUId,d.STRING,!0),g("message.sentTime",e.sentTime,d.NUMBER,!0),g("callback",t,d.CALLBACK),g("options.disableNotification",null==n?void 0:n.disableNotification,d.BOOLEAN),g("options.pushConfig",null==n?void 0:n.pushConfig,d.OBJECT),g("options.extra",null==n?void 0:n.extra,d.STRING);var s=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(u.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(s,",messageUId:").concat(c));var l=M({channelId:this.channelId},n);this._context.recallMessage(s,r,c,i,l).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||ee.set(s),re(t.onSuccess,ae(s))):(o.logger.warn(u.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),ce(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("typingContentType",n,d.STRING,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(u.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),c),this._context.sendMessage(e,t,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===a.SUCCESS?"info":"warn";s.logger[i](u.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===a.SUCCESS?re(o.onSuccess,ae(r)):(s.logger.warn(u.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),ce(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(u.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var c=[];for(var i in r){var g={};g[i]=r[i].uIds,r[i].isResponse||c.push(g)}if(0===c.length)return void n.onSuccess(null);var d=setInterval((function(){1===c.length&&clearInterval(d);var a=c.splice(0,1)[0],i=new le({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),re(n.onSuccess,e)},onError:function(e){o.logger.warn(u.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),ce(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;g("messageUIds",e,d.ARRAY,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var s=0,r=e;s<r.length;s++){var c=r[s];g("messageUId",c,d.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(s){var r=s.code;r===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(u.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;g("messageUId",e,d.STRING,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(u.O,"getMessageReader ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(u.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.setReadMessages=function(e,t,n,o){var s=this;g("targetId",e,d.STRING,!0),g("beginMessageUId",t,d.STRING,!0),g("endMessageUId",n,d.STRING,!0),this.logger.info(u.O,"setReadMessages ->targetId:".concat(e,",\n channelId:").concat(this.channelId,",\n beginMessageUId:").concat(t,",\n endMessageUId:").concat(n)),this._context.setReadMessages(e,this.channelId,t,n).then((function(r){var c=r.code;c===a.SUCCESS?o.onSuccess():(s.logger.warn(u.O,"setReadMessages ->code:".concat(c,",targetId:").concat(e,",channelId:").concat(s.channelId,",\n beginMessageUId:").concat(t,",endMessageUId:").concat(n)),o.onError(c))})).catch((function(a){s.logger.warn(u.O,"setReadMessages ->code:".concat(a,",targetId:").concat(e,",channelId:").concat(s.channelId,",\n beginMessageUId:").concat(t,",endMessageUId:").concat(n)),o.onError(a)}))},e.prototype.getMessageReceiptInfo=function(e,t,n){var o=this;g("messageUId",e,d.STRING,!0),g("targetId",t,d.STRING,!0),this.logger.info(u.O,"getMessageReceiptInfo ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReceiptInfo(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(u.O,"getMessageReceiptInfo ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(u.O,"getMessageReceiptInfo ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;g("expansion",e,d.OBJECT,!0),g("message",t,d.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion,l=t.expansion;this.logger.info(u.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:l,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ce(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;g("keys",e,d.ARRAY,!0),g("message",t,d.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion;this.logger.info(u.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ce(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,c){var i=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),g("count",o,d.NUMBER,!0),g("callback",s,d.CALLBACK,!0),g("order",c,d.NUMBER),this.logger.info(u.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var l=this.logger.createTraceId();this.logger.info(u.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),l),this._context.getHistoryMessage(e,t,n,o,c,this.channelId,r,l).then((function(e){var t=e.code,n=e.data;if(t===a.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],g=o.map((function(e){return c.push(e.messageUId),ae(e)}));i.logger.info(u.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),l),re(s.onSuccess,g,r)}else i.logger.info(u.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),l),re(s.onSuccess,[],!1);else i.logger.warn(u.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),l),ce(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("messages",n,d.ARRAY,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var c=ee.get(e,t,s.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&ee.remove(e,t,s.channelId)}))}re(o.onSuccess)}else s.logger.warn(u.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),ce(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;g("param.conversationType",e.conversationType,d.NUMBER,!0),g("param.targetId",e.targetId,d.STRING,!0),g("param.timestamp",e.timestamp,d.NUMBER,!0),g("callback",t,d.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(u.O,"clearRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"clearRemoteHistoryMessages ->code:".concat(e)),ce(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){g("callback",e,d.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?re(e.onSuccess,o.map(oe)):ce(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){g("callback",e,d.CALLBACK),g("index",t,d.NUMBER),g("limit",n,d.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?re(e.onSuccess,o.map(oe)):ce(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var l=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,f=n.sentTime,p=n.sentStatus;this.logger.info(u.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=s.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:f,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:C,canIncludeExpansion:l,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,I).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?re(o.onSuccess,ae(s)):(r.logger.warn(u.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),ce(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===a.SUCCESS?re(n.onSuccess,o):ce(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===a.SUCCESS?re(n.onSuccess,o):ce(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(u.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?re(s.onSuccess,!0):(r.logger.warn(u.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),ce(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var c=this;this.logger.info(u.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return ae(e)}));re(s.onSuccess,g,i)}else re(s.onSuccess,[],!1);else c.logger.warn(u.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),ce(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(u.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||ee.remove(e,t,o.channelId),re(n.onSuccess,!0)):(o.logger.warn(u.O,"clearMessages ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(u.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(oe(e))})),re(t.onSuccess,c)):(s.logger.warn(u.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),ce(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),this.logger.info(u.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(oe(e))})),re(t.onSuccess,c)):(s.logger.warn(u.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),ce(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,c){var i=this;this.logger.info(u.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,s,r,this.channelId).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){s.push(ae(e))})),re(c.onSuccess,s,d)}else i.logger.warn(u.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),ce(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var c=this;this.logger.info(u.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(s)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,s).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){s.push(ae(e))})),re(r.onSuccess,s,d)}else c.logger.warn(u.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ce(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,c,i){var g=this;this.logger.info(u.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(s,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,c).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(ae(e))})),re(i.onSuccess,s)):(g.logger.warn(u.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ce(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(u.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return ae(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(u.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?re(o.onSuccess,!0):(s.logger.warn(u.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),ce(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(u.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?re(n.onSuccess,r):(o.logger.warn(u.O,"getConversationNotificationStatus ->code:".concat(s,",targetId:").concat(t)),ce(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(u.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?re(n.onSuccess,r):(o.logger.warn(u.O,"getGroupMessageDeliverList ->code:".concat(s,",messageUId:").concat(t)),ce(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(u.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getPrivateMessageDeliverTime ->code:".concat(s,",messageUId:").concat(e)),ce(t.onError,s))}))},e}(),Ce=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},fe=function(){function e(e,t,n,o){this._context=e,this._options=t,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=i(),this._defaultChannelClient=new he(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(u.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(u.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(u.O,"getChannel method is only available in protocol stack mode"),null;if(g("channelId",e,d.STRING,!0),e.length>20)return this.logger.error(u.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(u.O,"Only 1000 channels can be obtained"),null;var t=new he(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;g("channelIds",e,d.ARRAY,!0),this.logger.info(u.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.7.2-beemrtc.3"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return R(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return this.logger.info(u.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(u.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.setConversationsMuteStatus=function(e){return this._defaultChannelClient.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){return this._defaultChannelClient.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.getMessageReceiptInfo=function(e,t,n){this._defaultChannelClient.getMessageReceiptInfo(e,t,n)},e.prototype.setReadMessages=function(e,t,n,o){this._defaultChannelClient.setReadMessages(e,t,n,o)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"joinChatRoom ->chatRoomId:".concat(e));var s=this.logger.createTraceId();this.logger.info(u.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),s),this._context.joinChatroom(e,t,s).then((function(t){var r=t===a.SUCCESS?"info":"warn";o.logger[r](u.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),s),t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;g("chatRoomId",e,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(u.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(s){var r=s===a.SUCCESS?"info":"warn";n.logger[r](u.A_QUIT_CHATROOM_R,JSON.stringify({code:s}),o),s===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"quitChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),ce(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;g("chatRoomId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("order",n,d.NUMBER,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?re(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(u.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),ce(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(g("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){g("entry.key",e.key,d.STRING,!0),g("entry.value",e.value,d.STRING,!0)})),g("options.isAutoDelete",e.isAutoDelete,d.BOOLEAN)}(t),g("callback",n,d.CALLBACK),t.entries.length>10)ce(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:".concat(e);this.logger.info(u.O,"set chatroom entry->".concat(s)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"set chatroom entry fail ->code+:".concat(t,",").concat(s)),ce(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){g("key",e,d.STRING,!0)}))}(t);var s="id:".concat(e);this.logger.debug(u.O,"remove chatroom entry->".concat(s));var r=M({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(s)),ce(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("chatroomEntry",t,d.OBJECT,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess):(o.logger.warn(u.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ce(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;g("chatRoomId",e,d.STRING,!0),g("key",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?re(n.onSuccess,r||""):(o.logger.warn(u.O,"getChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),ce(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;g("chatRoomId",e,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getAllChatroomEntries ->code:".concat(s,",chatRoomId:").concat(e)),ce(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),g("chatRoomId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("order",n,d.NUMBER,!0),g("callback",o,d.CALLBACK),g("timestamp",s,d.NUMBER),this.logger.info(u.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,s).then((function(t){var n=t.code,s=t.data;if(n===a.SUCCESS)if(s){var c=s.list,i=s.hasMore,g=c.map((function(e){return ae(e)}));re(o.onSuccess,g,i)}else re(o.onSuccess,[],!1);else r.logger.warn(u.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),ce(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,a){g("fileType",e,d.NUMBER,!0),g("fileName",n,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,a,s){g("fileType",e,d.NUMBER,!0),g("fileName",t,d.STRING,!0),g("saveName",n,d.STRING),g("callback",o,d.CALLBACK),g("serverType",s,d.NUMBER),g("uploadRes",a,d.OBJECT),this.logger.info(u.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,a,s).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;g("tag.tagId",e.tagId,d.STRING,!0),g("tag.tagId",e.tagId,(function(e){return e.length<=10})),g("tag.tagName",e.tagName,(function(e){return e.length<=15})),g("tag.tagName",e.tagName,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(u.O,"createTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(u.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;g("tagId",e,d.STRING,!0),g("callback",t,d.CALLBACK),this.logger.info(u.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(u.O,"removeTag ->code:".concat(s,",tagId:").concat(e)),t.onError(s))})).catch((function(o){n.logger.warn(u.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;g("tag.tagId",e.tagId,d.STRING,!0),g("tag.tagName",e.tagName,d.STRING,!0),g("tag.tagName",e.tagName,(function(e){return e.length<=15})),g("callback",t,d.CALLBACK),this.logger.info(u.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(u.O,"updateTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(u.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;g("callback",e,d.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(u.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(u.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;g("conversationType",e.type,d.NUMBER),g("targetId",e.targetId,d.STRING),g("channelId",e.channelId,d.ONLY_STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Ce(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(u.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(u.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;g("tagId",e,d.STRING,!0),g("conversations",t,d.ARRAY,!0),g("callback",n,d.CALLBACK),t.forEach((function(e){g("conversation.type",e.type,d.NUMBER,!0),g("conversation.targetId",e.targetId,d.STRING,!0),g("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(u.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return Ce(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"addTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(u.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;g("tagId",e,d.STRING,!0),g("conversations",t,d.ARRAY,!0),g("callback",n,d.CALLBACK),t.forEach((function(e){g("conversation.type",e.type,d.NUMBER,!0),g("conversation.targetId",e.targetId,d.STRING,!0),g("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(u.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return Ce(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"removeTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(u.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;g("conversation.type",e.type,d.NUMBER,!0),g("conversation.targetId",e.targetId,d.STRING,!0),g("conversation.channelId",e.channelId,d.ONLY_STRING),g("tagIds",t,d.ARRAY,!0),g("callback",n,d.CALLBACK),t.forEach((function(e){g("tagId",e,d.STRING,!0)})),this.logger.info(u.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Ce(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(u.O,"removeTagsForConversation ->code:".concat(s,",tagIds:").concat(t)),n.onError(s))})).catch((function(e){o.logger.warn(u.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;g("tagId",e,d.STRING,!0),g("count",t,d.NUMBER,!0),g("startTime",n,d.NUMBER,!0),g("callback",o,d.CALLBACK,!0),this.logger.info(u.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,c=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?ae(s):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(s.logger.warn(u.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(u.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;g("tagId",e,d.STRING,!0),g("containMuted",t,d.BOOLEAN,!0),g("callback",n,d.CALLBACK),this.logger.info(u.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var s=t.code,r=t.data;o.logger.info(u.O,JSON.stringify({code:s,data:r})),s===a.SUCCESS?n.onSuccess(r||0):(o.logger.warn(u.O,"getUnreadCountByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(u.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;g("tagId",e,d.STRING,!0),g("conversation.targetId",t.targetId,d.STRING,!0),g("conversation.type",t.type,d.NUMBER,!0),g("conversation.channelId",t.channelId,d.ONLY_STRING),g("status.isTop",null==n?void 0:n.isTop,d.BOOLEAN,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,Ce(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(u.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(u.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];this.logger.info(u.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],s,!1)).then((function(n){var s=n.code,r=n.data;if(s!==a.SUCCESS)o.logger.warn(u.O,"callExtra ->code:".concat(s)),t.onError&&ce(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?ae(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return ae(e)}));return void re(t.onSuccess,d,g)}t.onSuccess&&re(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){g("callback",t,d.CALLBACK),this.logger.info(u.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){re(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(u.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;g("status",e,d.NUMBER),g("callback",t,d.CALLBACK),this.logger.info(u.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?re(t.onSuccess,!0):(n.logger.warn(u.O,"setUserStatus ->code:".concat(e)),ce(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getUserStatus ->code:".concat(s,",useerId:").concat(e)),ce(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),ce(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?re(t.onSuccess):(n.logger.warn(u.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),ce(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;g("callback",e,d.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?re(e.onSuccess,s):(t.logger.warn(u.O,"getBlacklist ->code:".concat(o)),ce(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;g("userId",e,d.STRING),g("callback",t,d.CALLBACK),this.logger.info(u.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,r):(n.logger.warn(u.O,"getBlacklistStatus ->code:".concat(s,",userId:").concat(e)),ce(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("content.senderUserId",n.senderUserId,d.STRING,!0),g("content.messageDirection",n.messageDirection,d.NUMBER,!0),g("content.objectName",n.objectName,d.STRING,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){s._defaultChannelClient.insertMessage(e,t,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,a,s=this;for(var r in g("messages",e,(function(t){return l(t)&&!(e.length<=0||e.length>=500)}),!0),g("checkDuplicate",t,d.BOOLEAN),g("callback",n,d.CALLBACK),e)g("message",e[r],d.OBJECT,!0),g("message.conversationType",e[r].conversationType,(function(e){return[h.PRIVATE,h.DISCUSSION,h.GROUP,h.CUSTOMER_SERVICE,h.SYSTEM,h.APP_PUBLIC_SERVICE,h.PUBLIC_SERVICE].includes(e)}),!0),g("message.targetId",e[r].targetId,d.STRING,!0),g("message.senderUserId",e[r].senderUserId,d.STRING,!0),g("message.messageType",e[r].messageType,d.STRING,!0),g("message.content",e[r].content,d.OBJECT,!0),g("message.messageDirection",e[r].messageDirection,d.NUMBER,!0),g("message.canIncludeExpansion",e[r].canIncludeExpansion,d.BOOLEAN),g("message.expansion",e[r].expansion,d.OBJECT),g("message.disableNotification",e[r].disableNotification,d.BOOLEAN),g("message.sentTime",e[r].sentTime,d.NUMBER),g("message.sentStatus",e[r].sentStatus,d.NUMBER),g("options.isUnread",null===(o=e[r])||void 0===o?void 0:o.isUnread,d.BOOLEAN),g("options.searchContent",null===(a=e[r])||void 0===a?void 0:a.searchContent,d.STRING);this.assertCPPMode((function(){s._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),g("count",o,d.NUMBER,!0),g("callback",a,d.CALLBACK),g("options.order",s.order,d.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;g("messageIds",n,d.ARRAY,!0),g("callback",o,d.CALLBACK),this.logger.info(u.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?re(o.onSuccess,!0):(s.logger.warn(u.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),ce(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),g("cleanSpace",o,d.BOOLEAN),g("callback",a,d.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;g("callback",t,d.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?re(t.onSuccess,ae(r)):(n.logger.warn(u.O,"getMessage ->code:".concat(s,",messageId:").concat(e)),ce(t.onError,s))}))}),"getMessage",t)},e.prototype.setTextMessageExtra=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("value",t,d.STRING,!1),this.logger.info(u.O,"setTextMessageExtra ->messageId:".concat(e,",value:").concat(t)),this.assertCPPMode((function(){o._context.setTextMessageExtra(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"setTextMessageExtra ->code:".concat(t,",messageId:").concat(e)),ce(n.onError,t))}))}),"setTextMessageExtra",n)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("sentStatus",t,d.NUMBER,!0),this.logger.info(u.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),ce(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("receivedStatus",t,d.NUMBER,!0),this.logger.info(u.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?re(n.onSuccess,!0):(o.logger.warn(u.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),ce(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;g("messageId",e,d.NUMBER,!0),g("objectName",n,d.ONLY_STRING,!0),this.assertCPPMode((function(){s.logger.info(u.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),s._context.setMessageContent(e,t,n).then((function(e){e===a.SUCCESS?re(o.onSuccess,!0):ce(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;g("messageId",e,d.NUMBER,!0),g("searchFiles",n,d.STRING,!0),this.logger.info(u.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;g("keyword",e,d.STRING,!0),g("callback",t,d.CALLBACK),g("conversationTypes",n,d.ARRAY),g("customMessageType",o,d.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),g("keyword",e,d.STRING,!0),g("callback",t,d.CALLBACK),g("conversationTypes",o,d.ARRAY),g("customMessageType",n,d.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("keyword",n,d.STRING,!0),g("timestamp",o,d.NUMBER),g("count",a,d.NUMBER),g("total",s,d.NUMBER),g("callback",r,d.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("keyword",n,d.STRING,!0),g("timestamp",o,d.NUMBER),g("count",a,d.NUMBER),g("callback",s,d.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("keyword",n,d.STRING,!0),g("startTime",o,d.NUMBER),g("endTime",a,d.NUMBER),g("offset",s,d.NUMBER),g("limit",r,d.NUMBER),g("callback",c,d.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(u.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),g("timestamp",n,d.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getMessageByUids=function(e){return this._defaultChannelClient.getMessageByUids(e)},e.prototype.getMessageByMsgUids=function(e,t,n){return this._defaultChannelClient.getMessageByMsgUids(e,t,n)},e.prototype.setMessageSearchContent=function(e,t){return this._context.setMessageSearchContent(e,t)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;g("conversationType",e,d.NUMBER,!0),g("targetId",t,d.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),pe=1;C.add("imlib-v2-adapter","5.7.2-beemrtc.3");var Se,Ie,ve=null,me={init:function(e,t,n){var o;void 0===n&&(n={}),g("appkey",e,d.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||$;Se=new f(a,"API-V2"),ue=p.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(ve=ue.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),ve.info(u.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),pe=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),de=new fe(ue,{readReceiptTimeout:pe},ve,Se),S.init(ve)},getInstance:function(){return de},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){ue.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==ve||ve.error(u.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){ue.assignWatcher({message:function(t,n,o){try{var a=ae(t),s=ue.getCurrentUserId(),r=ue.getConnectedTime();se(a,s,r,pe,Se),a=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],u=0;u<c.length;u++)i="".concat(t).concat(c[u],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[u]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[u]]=g.count,a.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(a,s,r,pe,Se),i()||ee.set(t),e.onReceived(a,void 0,o)}catch(e){null==ve||ve.error(u.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){ue.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==ve||ve.error(u.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ue.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ve||ve.error(u.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ue.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ve||ve.error(u.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ue.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ve||ve.error(u.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ue.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ve||ve.error(u.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ue.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ve||ve.error(u.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ue.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ue.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ue.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(u.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ue.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ve||ve.error(u.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return R(this,void 0,void 0,(function(){var o,s,r,c;return T(this,(function(i){switch(i.label){case 0:return o=null==ve?void 0:ve.createTraceId(),null==ve||ve.info(u.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ue.connect(e,!!n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==ve||ve[r](u.A_CONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===a.SUCCESS?(t.onSuccess(s.userId),c=new Date(ue.getConnectedTime()-1e3*pe*60*60*24).getTime(),Se.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=Se.get(e).dealtime;t&&c-t>0&&Se.remove(e)}else if(/RECEIVED$/.test(e)){var n=Se.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&c-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?Se.remove(e):Se.set(e,n))}}))):s.code===a.RC_CONN_TOKEN_INCORRECT?(null==ve||ve.warn(u.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ve||ve.warn(u.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onError(s.code)),[2]}}))}))},reconnect:function(e,t,n){var o=null==ve?void 0:ve.createTraceId();null==ve||ve.info(u.A_RECONNECT_T,null,o),ue.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==ve||ve[n](u.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==ve||ve.warn(u.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:ne,getMessageObjectName:function(e){var t=M(M({},te),ne);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=ge(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,ue.registerMessageType(t,n.isPersited,n.isCounted,o)}},ye=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},Me=function(e,t){this.isCounted=e,this.isPersited=t},Re=ge("TextMessage","RC:TxtMsg"),Te=ge("LocationMessage","RC:LBSMsg"),Ee=ge("TypingStatusMessage","RC:TypSts"),Ne=ge("ImageMessage","RC:ImgMsg"),Oe=ge("RichContentMessage","RC:ImgTextMsg"),Ue=ge("VoiceMessage","RC:VcMsg"),_e=ge("HQVoiceMessage","RC:HQVCMsg"),Ae=ge("FileMessage","RC:FileMsg"),Be=ge("SightMessage","RC:SightMsg"),Le=ge("GIFMessage","RC:GIFMsg"),xe=ge("ReadReceiptMessage","RC:ReadNtf"),we=ge("ReadReceiptRequestMessage","RC:RRReqMsg"),Pe=ge("RCCombineMessage","RC:CombineMsg"),ke=function(e,t,n,o,a,s,r,c,i,g,d,u,l,h,C,f,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=f,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(Ie||(Ie={}));var be,Ge=ge("AcceptMessage","RC:VCAccept"),De=ge("RingingMessage","RC:VCRinging"),Ke=ge("SummaryMessage","RC:VCSummary"),Fe=ge("HungupMessage","RC:VCHangup"),He=ge("InviteMessage","RC:VCInvite"),We=ge("MediaModifyMessage","RC:VCModifyMedia"),je=ge("MemberModifyMessage","RC:VCModifyMem"),Ve=ge("lastMessageSendTime","RC:SRSMsg"),Je=ge("ReferenceMessage","RC:ReferenceMsg"),qe=ge("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ye=ge("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(be||(be={}));var Qe=be,Xe={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=me);export{Ge as AcceptMessage,ie as BaseMessage,he as ChannelClient,Xe as ConnectionState,Ae as FileMessage,Le as GIFMessage,y as GetChatRoomType,_e as HQVoiceMessage,Fe as HungupMessage,fe as IMClient,Ne as ImageMessage,He as InviteMessage,Te as LocationMessage,We as MediaModifyMessage,je as MemberModifyMessage,ye as MentionedInfo,Qe as MentionedType,ke as Message,Me as MessageTag,Ye as PublicServiceMultiRichContentMessage,qe as PublicServiceRichContentMessage,Pe as RCCombineMessage,xe as ReadReceiptMessage,we as ReadReceiptRequestMessage,le as ReadReceiptResponseMessage,Je as ReferenceMessage,Oe as RichContentMessage,De as RingingMessage,me as RongIMClient,m as SentStatus,Be as SightMessage,Ke as SummaryMessage,Ve as SyncReadStatusMessage,Re as TextMessage,Ee as TypingStatusMessage,Ie as VoIPMediaType,Ue as VoiceMessage};
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var s,n=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var o=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function r(e,t,s,n){return new(s||(s=Promise))((function(o,a){function r(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((n=n.apply(e,t||[])).next())}))}function c(e,t){var s,n,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],n=0}finally{s=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var i=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],s=0,n=t.length;s<n;s++)if(!e[t[s]])return!1;return!0}(uni))},g=i();var d={tag:"browser",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){var t,a=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(s,c),o&&a.setRequestHeader)for(var g in o)a.setRequestHeader(g,o[g]);if(i){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status})},a.ontimeout=function(){e({status:a.status})};var d="object"==typeof r?JSON.stringify(r):r;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status})},setTimeout((function(){a.abort(),e({status:a.status})}),n),a.send(r)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var s=new WebSocket(e,t);return s.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){s.onclose=function(t){var s=t.code,n=t.reason;e(s,n)}},onError:function(e){s.onerror=e},onMessage:function(e){s.onmessage=function(t){e(t.data)}},onOpen:function(e){s.onopen=e},send:function(e){s.send(e)},close:function(e,t){s.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection,s=e.type,n=e.effectiveType,o=s||n||t.NetworkType.UNKONWN;return new Promise((function(e){e(o)}))}},u=i(),l=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},C={setItem:l("setStorageSync"),getItem:l("getStorageSync"),removeItem:l("removeStorageSync"),clear:l("clearStorageSync")},h={tag:"wechat",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:C,sessionStorage:C,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:u,createWebSocket:function(e,t){var s=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},p=i(),f=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var n=my[e]({key:t[0]}).data;return n?JSON.stringify(n):n}catch(e){}}},I={setItem:f("setStorageSync"),getItem:f("getStorageSync"),removeItem:f("removeStorageSync"),clear:f("clearStorageSync")},R={tag:"alipay",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:s,headers:o,timeout:n,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:I,sessionStorage:I,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:p,createWebSocket:function(e){return my.connectSocket({url:e}),{id:Date.now(),onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},T=i(),S=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return tt[e].apply(tt,t)}catch(e){}}},v={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},m={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,localStorage:v,sessionStorage:v,httpReq:function(e){return new Promise((function(s){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},y=i(),M=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return swan[e].apply(swan,t)}catch(e){}}},E={setItem:M("setStorageSync"),getItem:M("getStorageSync"),removeItem:M("removeStorageSync"),clear:M("clearStorageSync")},A={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:y,localStorage:E,sessionStorage:E,httpReq:function(e){return new Promise((function(s,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))}},L=i(),N=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},O={setItem:N("setStorageSync"),getItem:N("getStorageSync"),removeItem:N("removeStorageSync"),clear:N("clearStorageSync")},U={tag:"jingdong",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:s,headers:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:O,sessionStorage:O,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},_=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},x={setItem:_("setStorageSync"),getItem:_("getStorageSync"),removeItem:_("removeStorageSync"),clear:_("clearStorageSync")},B={tag:"uniapp",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:x,sessionStorage:x,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var s={url:e,protocols:t},n=uni.connectSocket(s);return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},P=function(e){return e&&e.request&&e.getSystemInfo},w="undefined"!=typeof uni&&P(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return B;case"mp-jd":return U;case"mp-baidu":return A;case"mp-toutiao":return m;case"mp-alipay":return R;case"mp-weixin":return h;default:return d}}():"undefined"!=typeof jd&&P(jd)?U:"undefined"!=typeof my&&P(my)?R:"undefined"!=typeof tt&&P(tt)?m:"undefined"!=typeof swan&&P(swan)?A:"undefined"!=typeof wx&&P(wx)?h:d;function b(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var k=function(){function e(){}return e.set=function(s){if(t.SEND_MESSAGE_TYPE_OPTION[s.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[s.messageType].isPersited){var n=e.get(s.conversationType,s.targetId,s.channelId||"");if(!n||n.sentTime<s.sentTime){var o=b(s.conversationType,s.targetId,s.channelId||"");e.map[o]=s}}},e.get=function(t,s,n){var o=b(t,s,n);return e.map[o]||null},e.remove=function(t,s,n){var o=b(t,s,n);delete e.map[o]},e.clear=function(){e.map={}},e.map={},e}(),G={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},D={};function K(e){var s=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var d=k.get(n,o,s||"");r?d&&r.sentTime<d.sentTime&&(r=d):r=d}var u=r?F(r):null;return{channelId:s||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:g}}function F(e){var s=e.conversationType,o=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,d=e.isOffLineMessage,u=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,p=e.disableNotification,f=e.expansion,I=e.messageId,R=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,v=e.pushConfig,m=e.extraContent,y="";return c in G?y=G[c]:c in D?y=D[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},y="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===I&&(I=~~(16777215*Math.random())),{channelId:T||"",conversationType:s,targetId:o,senderUserId:a,content:r,messageType:y,messageUId:i,messageDirection:g,offLineMessage:d,sentTime:u,receivedStatus:l,receivedTime:C,objectName:c,messageId:I,sentStatus:R||n.SENT,disableNotification:p,canIncludeExpansion:h,expansion:f,readReceiptInfo:S,pushConfig:v,extraContent:m}}function H(e,s,n,o,a){var r=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===t.MessageDirection.SEND){var g="".concat(s).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var d="".concat(s).concat(e.conversationType).concat(e.targetId,"RECEIVED"),u=a.get(d);if(u)if(e.senderUserId in u)u[e.senderUserId].uIds&&-1===u[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(u[e.senderUserId].uIds.push(e.content.messageUId),u[e.senderUserId].dealtime=e.sentTime,u[e.senderUserId].isResponse=!1,a.set(d,u));else{var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};u[e.senderUserId]=l,a.set(d,u)}else{var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(d,C)}}}function j(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function W(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var V=function(e,t,s,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=n,this.isCounted=o};function J(e,t,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0);var o=function(o){return new V(e,t,o,s,n)};return o.MessageType=e,o.ObjectName=t,o}var q,Y,Q=J("ReadReceiptResponseMessage","RC:RRRspMsg"),X=function(){function e(e,t,s,n,o,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=n,this._readReceiptTimeout=o,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",n,t.AssertRules.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(K(e))})):r.forEach((function(e){c.push(K(e))})),j(e.onSuccess,c)):(o.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),W(e.onError,a))}))},e.prototype.getConversation=function(e,s,n){var o=this;t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(s,",conversationType:").concat(e)),r(o,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),n.onError(a),[2]):(n.onSuccess(r?K(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(s,",conversationType:").concat(e)),this._context.removeConversation(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||k.remove(e,s,o.channelId),j(n.onSuccess)):(o.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,n).then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?j(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(n)),W(e.onError,n))}))},e.prototype.getUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadCount(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.clearConversations=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(s)),this._isCPPMode?this._context.clearConversations(s,this.channelId).then((function(s){s===t.ErrorCode.SUCCESS?j(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),W(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCount(e,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),W(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===t.ErrorCode.SUCCESS?j(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(n)),W(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,s,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?j(n.onSuccess,e.data?F(e.data):null):(o.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),W(n.onError,e.code))}))},e.prototype.getMessageByMsgUids=function(e,s,n){return this._isCPPMode?(t.assert("targetId",e,t.AssertRules.STRING,!0),t.assert("conversationType",s,t.AssertRules.NUMBER,!0),t.assert("msgUids",n,t.AssertRules.ARRAY,!0),this._context.getMessageByMsgUids(e,this.channelId,s,n)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),[])},e.prototype.setConversationStatus=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("status",n,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),W(o.onError,e))}))},e.prototype.setConversationsMuteStatus=function(e){t.assert("status",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){t.assert("status",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,s,o,r,c,i,g,d){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",o,t.AssertRules.OBJECT,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("isMentioned",c,t.AssertRules.BOOLEAN),t.assert("pushContent",i,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==d?void 0:d.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==d?void 0:d.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==d?void 0:d.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==d?void 0:d.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==d?void 0:d.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==d?void 0:d.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==d?void 0:d.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var l=!(!(null==d?void 0:d.isStatusMessage)&&!(null==d?void 0:d.isStatus)),C=function(e,t,s){var n,o=e||{},a=o.userIds,r=o.isVoipPush,c=o.disableNotification,i=o.isFilerWhiteBlacklist,g=o.expansion,d=o.canIncludeExpansion,u=o.pushConfig,l=o.resendMessageId,C=o.isResend,h=[];if(t){var p=(s||{}).content.mentionedInfo;h=p.userIdList,n=p.type}return{mentionedType:n,mentionedUserIdList:h,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l,isResend:C}}(d,c,o),h=Object.assign(o,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:o.objectName,channelId:this.channelId,isStatusMessage:l})),p=this._context.getCurrentUserId(),f=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:s,channelId:this.channelId}),f),this._context.sendMessage(e,s,h,r.onBefore,f).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),f),c===t.ErrorCode.SUCCESS){u._isCPPMode||k.set(i);var C=F(i);H(C,p,u._context.getConnectedTime(),u._readReceiptTimeout,u._storage),j(r.onSuccess,C)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),W(r.onError,c,F({isMentioned:!!h.isMentioned,content:o.content,messageType:o.messageType,isPersited:o.isPersited,isCounted:o.isCounted,disableNotification:!!(null==d?void 0:d.disableNotification),canIncludeExpansion:!!(null==d?void 0:d.canIncludeExpansion),expansion:(null==d?void 0:d.expansion)||null,conversationType:e,targetId:s,senderUserId:p,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,messageId:null==i?void 0:i.messageId,sentStatus:n.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,n){var o=this;t.assert("message.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("message.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("message.messageUId",e.messageUId,t.AssertRules.STRING,!0),t.assert("message.sentTime",e.sentTime,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==n?void 0:n.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==n?void 0:n.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==n?void 0:n.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var d=a({channelId:this.channelId},n);this._context.recallMessage(r,c,i,g,d).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?(o._isCPPMode||k.set(a),j(s.onSuccess,F(a))):(o.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(c,",messageUId:").concat(i)),W(s.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",n,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:s,channelId:r.channelId}),c),this._context.sendMessage(e,s,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===t.ErrorCode.SUCCESS?j(o.onSuccess,F(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(s)),W(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(s,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(s,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var d={};d[g]=c[g].uIds,c[g].isResponse||i.push(d)}if(0===i.length)return void n.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var a=i.splice(0,1)[0],g=new Q({receiptMessageDic:a});o.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,o._storage.set(r,c),j(n.onSuccess,e)},onError:function(e){o.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),W(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,n){var o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(s,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(s,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReader(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.setReadMessages=function(e,s,n,o){var a=this;t.assert("targetId",e,t.AssertRules.STRING,!0),t.assert("beginMessageUId",s,t.AssertRules.STRING,!0),t.assert("endMessageUId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setReadMessages ->targetId:".concat(e,",\n channelId:").concat(this.channelId,",\n beginMessageUId:").concat(s,",\n endMessageUId:").concat(n)),this._context.setReadMessages(e,this.channelId,s,n).then((function(r){var c=r.code;c===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setReadMessages ->code:".concat(c,",targetId:").concat(e,",channelId:").concat(a.channelId,",\n beginMessageUId:").concat(s,",endMessageUId:").concat(n)),o.onError(c))})).catch((function(r){a.logger.warn(t.LogTagId.O,"setReadMessages ->code:".concat(r,",targetId:").concat(e,",channelId:").concat(a.channelId,",\n beginMessageUId:").concat(s,",endMessageUId:").concat(n)),o.onError(r)}))},e.prototype.getMessageReceiptInfo=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReceiptInfo ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReceiptInfo(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReceiptInfo ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReceiptInfo ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,n){var o=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion,g=s.expansion;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),W(n.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,n){var o=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),W(n.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",c,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,s,n,o,c,this.channelId,r,g).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],d=o.map((function(e){return c.push(e.messageUId),F(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),j(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),j(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),W(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,n,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=k.get(e,s,a.channelId);c&&n.forEach((function(t){c.messageUId===t.messageUId&&k.remove(e,s,a.channelId)}))}j(o.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),W(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var n=this;t.assert("param.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("param.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("param.timestamp",e.timestamp,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),W(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?j(e.onSuccess,o.map(K)):W(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,n){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",n,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,n).then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?j(e.onSuccess,o.map(K)):W(e.onError,n)}))},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var u=n.canIncludeExpansion,l=n.expansion,C=n.disableNotification,h=n.sentTime,p=n.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var f=a.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:h,sentStatus:p,searchContent:a.searchContent,isUnread:f,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,s,I).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?j(o.onSuccess,F(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(n,",targetId:").concat(s)),W(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,s,n){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess,o):W(n.onError,s)}))},e.prototype.getMessageCount=function(e,s,n){this._context.getMessageCount(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess,o):W(n.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,s,n,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),W(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,s,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===t.ErrorCode.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return F(e)}));j(a.onSuccess,g,i)}else j(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(s)),W(a.onError,n)}))},e.prototype.clearMessages=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearMessages(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||k.remove(e,s,o.channelId),j(n.onSuccess,!0)):(o.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(K(e))})),j(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),W(s.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(K(e))})),j(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),W(s.onError,o))}))},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,s,n,o,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(F(e))})),j(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(s)),W(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(F(e))})),j(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(s)),W(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===t.ErrorCode.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(F(e))})),j(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(s)),W(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,s){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,s,this.channelId).map((function(e){return F(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),W(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(s)),this._context.getGroupMessageDeliverList(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),W(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),W(s.onError,a))}))},e}(),z=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},$=function(){function e(e,s,n,o){this._context=e,this._options=s,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new X(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,n){if(!this._isCPPMode)return null==n||n.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(s,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(t.LogTagId.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(t.LogTagId.O,"getChannel method is only available in protocol stack mode"),null;if(t.assert("channelId",e,t.AssertRules.STRING,!0),e.length>20)return this.logger.error(t.LogTagId.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(t.LogTagId.O,"Only 1000 channels can be obtained"),null;var s=new X(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=s,s},e.prototype.deleteChannels=function(e){var s=this;t.assert("channelIds",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete s._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.7.2-beemrtc.2"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return r(this,void 0,void 0,(function(){return c(this,(function(s){switch(s.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return s.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,s){this._defaultChannelClient.getConversationList(e,t,s)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,s){void 0===s&&(s=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,s)},e.prototype.getConversation=function(e,t,s){return this._defaultChannelClient.getConversation(e,t,s)},e.prototype.removeConversation=function(e,t,s){return this._defaultChannelClient.removeConversation(e,t,s)},e.prototype.saveTextMessageDraft=function(e,t,s){return this._defaultChannelClient.saveTextMessageDraft(e,t,s)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,s){return this._defaultChannelClient.getTotalUnreadCount(e,t,s)},e.prototype.getUnreadCount=function(e,t,s){return this._defaultChannelClient.getUnreadCount(e,t,s)},e.prototype.getConversationUnreadCount=function(e,s){this.logger.error(t.LogTagId.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,s){this._defaultChannelClient.clearUnreadCount(e,t,s)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,s,n){return this._defaultChannelClient.setConversationStatus(e,t,s,n)},e.prototype.setConversationsMuteStatus=function(e){return this._defaultChannelClient.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){return this._defaultChannelClient.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,t,s,n,o,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,n,o,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,n){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,n)},e.prototype.sendReceiptResponse=function(e,t,s){return this._defaultChannelClient.sendReceiptResponse(e,t,s)},e.prototype.sendReadReceiptMessage=function(e,t,s){return this._defaultChannelClient.sendReadReceiptMessage(e,t,s)},e.prototype.getMessageReader=function(e,t,s){this._defaultChannelClient.getMessageReader(e,t,s)},e.prototype.getMessageReceiptInfo=function(e,t,s){this._defaultChannelClient.getMessageReceiptInfo(e,t,s)},e.prototype.setReadMessages=function(e,t,s,n){this._defaultChannelClient.setReadMessages(e,t,s,n)},e.prototype.updateMessageExpansion=function(e,t,s){this._defaultChannelClient.updateMessageExpansion(e,t,s)},e.prototype.removeMessageExpansionForKey=function(e,t,s){this._defaultChannelClient.removeMessageExpansionForKey(e,t,s)},e.prototype.getHistoryMessages=function(e,t,s,n,o,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,n,o,a,r)},e.prototype.joinChatRoom=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(t.LogTagId.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:s,joinExist:!1}),a),this._context.joinChatroom(e,s,a).then((function(s){var r=s===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),W(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,n,o){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,n).then((function(s){var n=s.code,r=s.data;n===t.ErrorCode.SUCCESS?j(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),W(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,n){var o=this;if(t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("entry.key",e.key,t.AssertRules.STRING,!0),t.assert("entry.value",e.value,t.AssertRules.STRING,!0)})),t.assert("options.isAutoDelete",e.isAutoDelete,t.AssertRules.BOOLEAN)}(s),t.assert("callback",n,t.AssertRules.CALLBACK),s.entries.length>10)W(n.onError,t.ErrorCode.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(t.LogTagId.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,s).then((function(e){var s=e.code,r=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),W(n.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(s);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},s);c.entries=s.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),W(n.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(s)),this._context.getChatroomEntry(e,s).then((function(s){var a=s.code,r=s.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r||""):(o.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),W(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),W(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,n,o,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,s,n,a).then((function(s){var n=s.code,a=s.data;if(n===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return F(e)}));j(o.onSuccess,g,i)}else j(o.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),W(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,n){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,n)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,n,o,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(s.onSuccess).catch(s.onError)},e.prototype.getFileUrl=function(e,s,n,o,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",n,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("serverType",r,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(s)),this._context.getFileUrl(e,s,n,a,r).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagId",e.tagId,(function(e){return e.length<=10})),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.removeTag=function(e,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.updateTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,s){var n=this;t.assert("conversationType",e.type,t.AssertRules.NUMBER),t.assert("targetId",e.targetId,t.AssertRules.STRING),t.assert("channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(z(e)).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(o)),s.onError(o))})).catch((function(e){n.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,s.map((function(e){return z(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,s.map((function(e){return z(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,n){var o=this;t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("tagIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(s,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(z(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),n.onError(a))})).catch((function(e){o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,s).then((function(s){var n=s.code,r=s.data,c=[];n===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,n=e.targetId,o=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?F(a):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:s,targetId:n,unreadMessageCount:o,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,s).then((function(s){var a=s.code,r=s.data;o.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?n.onSuccess(r||0):(o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",s.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",s.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",s.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==n?void 0:n.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(s.targetId,",type").concat(s.type)),this._context.setConversationStatusInTag(e,z(s),n).then((function(s){var n=s.code;s.data,n===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.callExtra=function(e,s){for(var n,o=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,s){if(s||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)o.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&W(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?F(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return F(e)}));return void j(s.onSuccess,d,g)}s.onSuccess&&j(s.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,s){t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){j(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var n=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?j(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),W(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),W(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),W(s.onError,o))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),W(s.onError,o))}))}),"removeFromBlacklist",s)},e.prototype.getBlacklist=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?j(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(o)),W(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),W(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("content.senderUserId",n.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",n.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",n.objectName,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,s,n){var o,a,r=this;for(var c in t.assert("messages",e,(function(s){return t.isArray(s)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",s,t.AssertRules.BOOLEAN),t.assert("callback",n,t.AssertRules.CALLBACK),e)t.assert("message",e[c],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[c].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[c].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[c].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[c].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[c].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[c].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[c].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[c].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[c].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[c].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[c].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(o=e[c])||void 0===o?void 0:o.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[c])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){r._defaultChannelClient.batchInsertMessage(e,s,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,s,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",r.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){c._defaultChannelClient.getRemoteHistoryMessages(e,s,n,o,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,n,o){var a=this;t.assert("messageIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),W(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",o,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,s,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,F(r)):(n.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),W(s.onError,a))}))}),"getMessage",s)},e.prototype.setTextMessageExtra=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("value",s,t.AssertRules.STRING,!1),this.logger.info(t.LogTagId.O,"setTextMessageExtra ->messageId:".concat(e,",value:").concat(s)),this.assertCPPMode((function(){o._context.setTextMessageExtra(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setTextMessageExtra ->code:".concat(s,",messageId:").concat(e)),W(n.onError,s))}))}),"setTextMessageExtra",n)},e.prototype.setMessageSentStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),W(n.onError,s))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),W(n.onError,s))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,s,n,o){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",n,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,s,n).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess,!0):W(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,s,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",o,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,s,n,o)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,s,n,o)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",r,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContent(e,s,n,o,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,s,n,o,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("startTime",o,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",r,t.AssertRules.NUMBER),t.assert("limit",c,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,s){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,s)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getMessageByMsgUids=function(e,t,s){return this._defaultChannelClient.getMessageByMsgUids(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,s,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,s){this._defaultChannelClient.getGroupMessageDeliverList(e,t,s)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Z=1;t.VersionManage.add("imlib-v2-adapter","5.7.2-beemrtc.2");var ee,te,se=null,ne={init:function(e,s,n){var o;void 0===n&&(n={}),t.assert("appkey",e,t.AssertRules.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||w;ee=new t.AppStorage(a,"API-V2"),Y=t.APIContext.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(se=Y.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),se.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Z=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),q=new $(Y,{readReceiptTimeout:Z},se,ee),t.logger.init(se)},getInstance:function(){return q},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){Y.assignWatcher({connection:function(s,n){try{e.onChanged(s,n)}catch(e){null==se||se.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){Y.assignWatcher({message:function(s,n,o){try{var a=F(s),r=Y.getCurrentUserId(),c=Y.getConnectedTime();H(a,r,c,Z,ee),a=function(e,t,s,n,o){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],u=0;u<c.length;u++)i="".concat(t).concat(c[u],"SENT"),(g=o.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[u]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[u]]=g.count,o.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(a,r,c,Z,ee),t.usingCppEngine()||k.set(s),e.onReceived(a,void 0,o)}catch(e){null==se||se.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){Y.assignWatcher({conversationState:function(s){try{var n=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,o=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:o,channelId:a||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==se||se.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){Y.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==se||se.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){Y.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==se||se.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){Y.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==se||se.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){Y.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==se||se.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){Y.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==se||se.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){Y.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Y.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Y.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==se||se.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){Y.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==se||se.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,n){return r(this,void 0,void 0,(function(){var o,a,r,i;return c(this,(function(c){switch(c.label){case 0:return o=null==se?void 0:se.createTraceId(),null==se||se.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,Y.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==se||se[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(Y.getConnectedTime()-1e3*Z*60*60*24).getTime(),ee.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=ee.get(e).dealtime;t&&i-t>0&&ee.remove(e)}else if(/RECEIVED$/.test(e)){var s=ee.get(e),n=Object.keys(s).length;Object.keys(s).forEach((function(e){var t=s[e].dealtime;t&&i-t>0&&delete s[e]})),Object.keys(s).length!==n&&(0===s.length?ee.remove(e):ee.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==se||se.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==se||se.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}}))}))},reconnect:function(e,s,n){var o=null==se?void 0:se.createTraceId();null==se||se.info(t.LogTagId.A_RECONNECT_T,null,o),Y.reconnect(n).then((function(s){var n=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==se||se[n](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==se||se.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:D,getMessageObjectName:function(e){var t=a(a({},G),D);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,n){this.RegisterMessage[e]=J(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,Y.registerMessageType(t,s.isPersited,s.isCounted,n)}},oe=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},ae=function(e,t){this.isCounted=e,this.isPersited=t},re=J("TextMessage","RC:TxtMsg"),ce=J("LocationMessage","RC:LBSMsg"),ie=J("TypingStatusMessage","RC:TypSts"),ge=J("ImageMessage","RC:ImgMsg"),de=J("RichContentMessage","RC:ImgTextMsg"),ue=J("VoiceMessage","RC:VcMsg"),le=J("HQVoiceMessage","RC:HQVCMsg"),Ce=J("FileMessage","RC:FileMsg"),he=J("SightMessage","RC:SightMsg"),pe=J("GIFMessage","RC:GIFMsg"),fe=J("ReadReceiptMessage","RC:ReadNtf"),Ie=J("ReadReceiptRequestMessage","RC:RRReqMsg"),Re=J("RCCombineMessage","RC:CombineMsg"),Te=function(e,t,s,n,o,a,r,c,i,g,d,u,l,C,h,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=n,this.objectName=o,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};exports.VoIPMediaType=void 0,(te=exports.VoIPMediaType||(exports.VoIPMediaType={}))[te.MEDIA_AUDIO=1]="MEDIA_AUDIO",te[te.MEDIA_VEDIO=2]="MEDIA_VEDIO",te[te.MEDIA_VIDEO=2]="MEDIA_VIDEO";var Se,ve=J("AcceptMessage","RC:VCAccept"),me=J("RingingMessage","RC:VCRinging"),ye=J("SummaryMessage","RC:VCSummary"),Me=J("HungupMessage","RC:VCHangup"),Ee=J("InviteMessage","RC:VCInvite"),Ae=J("MediaModifyMessage","RC:VCModifyMedia"),Le=J("MemberModifyMessage","RC:VCModifyMem"),Ne=J("lastMessageSendTime","RC:SRSMsg"),Oe=J("ReferenceMessage","RC:ReferenceMsg"),Ue=J("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),_e=J("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Se||(Se={}));var xe=Se;window&&(window.RongIMClient=ne),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=ve,exports.BaseMessage=V,exports.ChannelClient=X,exports.ConnectionState={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20},exports.FileMessage=Ce,exports.GIFMessage=pe,exports.GetChatRoomType=o,exports.HQVoiceMessage=le,exports.HungupMessage=Me,exports.IMClient=$,exports.ImageMessage=ge,exports.InviteMessage=Ee,exports.LocationMessage=ce,exports.MediaModifyMessage=Ae,exports.MemberModifyMessage=Le,exports.MentionedInfo=oe,exports.MentionedType=xe,exports.Message=Te,exports.MessageTag=ae,exports.PublicServiceMultiRichContentMessage=_e,exports.PublicServiceRichContentMessage=Ue,exports.RCCombineMessage=Re,exports.ReadReceiptMessage=fe,exports.ReadReceiptRequestMessage=Ie,exports.ReadReceiptResponseMessage=Q,exports.ReferenceMessage=Oe,exports.RichContentMessage=de,exports.RingingMessage=me,exports.RongIMClient=ne,exports.SentStatus=n,exports.SightMessage=he,exports.SummaryMessage=ye,exports.SyncReadStatusMessage=Ne,exports.TextMessage=re,exports.TypingStatusMessage=ie,exports.VoiceMessage=ue;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var s,n=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var o=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function r(e,t,s,n){return new(s||(s=Promise))((function(o,a){function r(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((n=n.apply(e,t||[])).next())}))}function c(e,t){var s,n,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],n=0}finally{s=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var i=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],s=0,n=t.length;s<n;s++)if(!e[t[s]])return!1;return!0}(uni))},g=i();var d={tag:"browser",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){var t,a=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(s,c),o&&a.setRequestHeader)for(var g in o)a.setRequestHeader(g,o[g]);if(i){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status})},a.ontimeout=function(){e({status:a.status})};var d="object"==typeof r?JSON.stringify(r):r;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status})},setTimeout((function(){a.abort(),e({status:a.status})}),n),a.send(r)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var s=new WebSocket(e,t);return s.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){s.onclose=function(t){var s=t.code,n=t.reason;e(s,n)}},onError:function(e){s.onerror=e},onMessage:function(e){s.onmessage=function(t){e(t.data)}},onOpen:function(e){s.onopen=e},send:function(e){s.send(e)},close:function(e,t){s.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection,s=e.type,n=e.effectiveType,o=s||n||t.NetworkType.UNKONWN;return new Promise((function(e){e(o)}))}},u=i(),l=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},C={setItem:l("setStorageSync"),getItem:l("getStorageSync"),removeItem:l("removeStorageSync"),clear:l("clearStorageSync")},h={tag:"wechat",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:C,sessionStorage:C,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:u,createWebSocket:function(e,t){var s=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},p=i(),f=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var n=my[e]({key:t[0]}).data;return n?JSON.stringify(n):n}catch(e){}}},I={setItem:f("setStorageSync"),getItem:f("getStorageSync"),removeItem:f("removeStorageSync"),clear:f("clearStorageSync")},R={tag:"alipay",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:s,headers:o,timeout:n,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:I,sessionStorage:I,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:p,createWebSocket:function(e){return my.connectSocket({url:e}),{id:Date.now(),onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},T=i(),S=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return tt[e].apply(tt,t)}catch(e){}}},v={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},m={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,localStorage:v,sessionStorage:v,httpReq:function(e){return new Promise((function(s){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},y=i(),M=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return swan[e].apply(swan,t)}catch(e){}}},E={setItem:M("setStorageSync"),getItem:M("getStorageSync"),removeItem:M("removeStorageSync"),clear:M("clearStorageSync")},A={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:y,localStorage:E,sessionStorage:E,httpReq:function(e){return new Promise((function(s,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))}},L=i(),N=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},O={setItem:N("setStorageSync"),getItem:N("getStorageSync"),removeItem:N("removeStorageSync"),clear:N("clearStorageSync")},U={tag:"jingdong",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:s,headers:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:O,sessionStorage:O,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},_=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},x={setItem:_("setStorageSync"),getItem:_("getStorageSync"),removeItem:_("removeStorageSync"),clear:_("clearStorageSync")},B={tag:"uniapp",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:x,sessionStorage:x,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var s={url:e,protocols:t},n=uni.connectSocket(s);return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},P=function(e){return e&&e.request&&e.getSystemInfo},w="undefined"!=typeof uni&&P(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return B;case"mp-jd":return U;case"mp-baidu":return A;case"mp-toutiao":return m;case"mp-alipay":return R;case"mp-weixin":return h;default:return d}}():"undefined"!=typeof jd&&P(jd)?U:"undefined"!=typeof my&&P(my)?R:"undefined"!=typeof tt&&P(tt)?m:"undefined"!=typeof swan&&P(swan)?A:"undefined"!=typeof wx&&P(wx)?h:d;function b(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var k=function(){function e(){}return e.set=function(s){if(t.SEND_MESSAGE_TYPE_OPTION[s.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[s.messageType].isPersited){var n=e.get(s.conversationType,s.targetId,s.channelId||"");if(!n||n.sentTime<s.sentTime){var o=b(s.conversationType,s.targetId,s.channelId||"");e.map[o]=s}}},e.get=function(t,s,n){var o=b(t,s,n);return e.map[o]||null},e.remove=function(t,s,n){var o=b(t,s,n);delete e.map[o]},e.clear=function(){e.map={}},e.map={},e}(),G={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},D={};function K(e){var s=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var d=k.get(n,o,s||"");r?d&&r.sentTime<d.sentTime&&(r=d):r=d}var u=r?F(r):null;return{channelId:s||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:g}}function F(e){var s=e.conversationType,o=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,d=e.isOffLineMessage,u=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,p=e.disableNotification,f=e.expansion,I=e.messageId,R=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,v=e.pushConfig,m=e.extraContent,y="";return c in G?y=G[c]:c in D?y=D[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},y="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===I&&(I=~~(16777215*Math.random())),{channelId:T||"",conversationType:s,targetId:o,senderUserId:a,content:r,messageType:y,messageUId:i,messageDirection:g,offLineMessage:d,sentTime:u,receivedStatus:l,receivedTime:C,objectName:c,messageId:I,sentStatus:R||n.SENT,disableNotification:p,canIncludeExpansion:h,expansion:f,readReceiptInfo:S,pushConfig:v,extraContent:m}}function H(e,s,n,o,a){var r=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===t.MessageDirection.SEND){var g="".concat(s).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var d="".concat(s).concat(e.conversationType).concat(e.targetId,"RECEIVED"),u=a.get(d);if(u)if(e.senderUserId in u)u[e.senderUserId].uIds&&-1===u[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(u[e.senderUserId].uIds.push(e.content.messageUId),u[e.senderUserId].dealtime=e.sentTime,u[e.senderUserId].isResponse=!1,a.set(d,u));else{var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};u[e.senderUserId]=l,a.set(d,u)}else{var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(d,C)}}}function j(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function W(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var V=function(e,t,s,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=n,this.isCounted=o};function J(e,t,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0);var o=function(o){return new V(e,t,o,s,n)};return o.MessageType=e,o.ObjectName=t,o}var q,Y,Q=J("ReadReceiptResponseMessage","RC:RRRspMsg"),X=function(){function e(e,t,s,n,o,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=n,this._readReceiptTimeout=o,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",n,t.AssertRules.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(K(e))})):r.forEach((function(e){c.push(K(e))})),j(e.onSuccess,c)):(o.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),W(e.onError,a))}))},e.prototype.getConversation=function(e,s,n){var o=this;t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(s,",conversationType:").concat(e)),r(o,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),n.onError(a),[2]):(n.onSuccess(r?K(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(s,",conversationType:").concat(e)),this._context.removeConversation(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||k.remove(e,s,o.channelId),j(n.onSuccess)):(o.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,n).then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?j(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(n)),W(e.onError,n))}))},e.prototype.getUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadCount(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.clearConversations=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(s)),this._isCPPMode?this._context.clearConversations(s,this.channelId).then((function(s){s===t.ErrorCode.SUCCESS?j(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),W(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCount(e,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),W(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===t.ErrorCode.SUCCESS?j(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(n)),W(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,s,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?j(n.onSuccess,e.data?F(e.data):null):(o.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),W(n.onError,e.code))}))},e.prototype.getMessageByUids=function(e){return this._isCPPMode?(t.assert("msgUids",e,t.AssertRules.ARRAY,!0),this._context.getMessageByUids(e)):(this.logger.error(t.LogTagId.O,"getMessageByUids method is not supported in a browser!"),[])},e.prototype.getMessageByMsgUids=function(e,s,n){return this._isCPPMode?(t.assert("targetId",e,t.AssertRules.STRING,!0),t.assert("conversationType",s,t.AssertRules.NUMBER,!0),t.assert("msgUids",n,t.AssertRules.ARRAY,!0),this._context.getMessageByMsgUids(e,this.channelId,s,n)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),[])},e.prototype.setConversationStatus=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("status",n,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),W(o.onError,e))}))},e.prototype.setConversationsMuteStatus=function(e){t.assert("status",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){t.assert("status",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"setConversationsStatus ->status:".concat(e)),this._context.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,s,o,r,c,i,g,d){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",o,t.AssertRules.OBJECT,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("isMentioned",c,t.AssertRules.BOOLEAN),t.assert("pushContent",i,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==d?void 0:d.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==d?void 0:d.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==d?void 0:d.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==d?void 0:d.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==d?void 0:d.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==d?void 0:d.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==d?void 0:d.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var l=!(!(null==d?void 0:d.isStatusMessage)&&!(null==d?void 0:d.isStatus)),C=function(e,t,s){var n,o=e||{},a=o.userIds,r=o.isVoipPush,c=o.disableNotification,i=o.isFilerWhiteBlacklist,g=o.expansion,d=o.canIncludeExpansion,u=o.pushConfig,l=o.resendMessageId,C=o.isResend,h=[];if(t){var p=(s||{}).content.mentionedInfo;h=p.userIdList,n=p.type}return{mentionedType:n,mentionedUserIdList:h,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l,isResend:C}}(d,c,o),h=Object.assign(o,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:o.objectName,channelId:this.channelId,isStatusMessage:l})),p=this._context.getCurrentUserId(),f=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:s,channelId:this.channelId}),f),this._context.sendMessage(e,s,h,r.onBefore,f).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),f),c===t.ErrorCode.SUCCESS){u._isCPPMode||k.set(i);var C=F(i);H(C,p,u._context.getConnectedTime(),u._readReceiptTimeout,u._storage),j(r.onSuccess,C)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),W(r.onError,c,F({isMentioned:!!h.isMentioned,content:o.content,messageType:o.messageType,isPersited:o.isPersited,isCounted:o.isCounted,disableNotification:!!(null==d?void 0:d.disableNotification),canIncludeExpansion:!!(null==d?void 0:d.canIncludeExpansion),expansion:(null==d?void 0:d.expansion)||null,conversationType:e,targetId:s,senderUserId:p,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,messageId:null==i?void 0:i.messageId,sentStatus:n.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,n){var o=this;t.assert("message.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("message.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("message.messageUId",e.messageUId,t.AssertRules.STRING,!0),t.assert("message.sentTime",e.sentTime,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==n?void 0:n.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==n?void 0:n.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==n?void 0:n.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var d=a({channelId:this.channelId},n);this._context.recallMessage(r,c,i,g,d).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?(o._isCPPMode||k.set(a),j(s.onSuccess,F(a))):(o.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(c,",messageUId:").concat(i)),W(s.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",n,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:s,channelId:r.channelId}),c),this._context.sendMessage(e,s,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===t.ErrorCode.SUCCESS?j(o.onSuccess,F(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(s)),W(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(s,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(s,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var d={};d[g]=c[g].uIds,c[g].isResponse||i.push(d)}if(0===i.length)return void n.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var a=i.splice(0,1)[0],g=new Q({receiptMessageDic:a});o.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,o._storage.set(r,c),j(n.onSuccess,e)},onError:function(e){o.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),W(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,n){var o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(s,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(s,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReader(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.setReadMessages=function(e,s,n,o){var a=this;t.assert("targetId",e,t.AssertRules.STRING,!0),t.assert("beginMessageUId",s,t.AssertRules.STRING,!0),t.assert("endMessageUId",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setReadMessages ->targetId:".concat(e,",\n channelId:").concat(this.channelId,",\n beginMessageUId:").concat(s,",\n endMessageUId:").concat(n)),this._context.setReadMessages(e,this.channelId,s,n).then((function(r){var c=r.code;c===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setReadMessages ->code:".concat(c,",targetId:").concat(e,",channelId:").concat(a.channelId,",\n beginMessageUId:").concat(s,",endMessageUId:").concat(n)),o.onError(c))})).catch((function(r){a.logger.warn(t.LogTagId.O,"setReadMessages ->code:".concat(r,",targetId:").concat(e,",channelId:").concat(a.channelId,",\n beginMessageUId:").concat(s,",endMessageUId:").concat(n)),o.onError(r)}))},e.prototype.getMessageReceiptInfo=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReceiptInfo ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReceiptInfo(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReceiptInfo ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReceiptInfo ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,n){var o=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion,g=s.expansion;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),W(n.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,n){var o=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),W(n.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",c,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,s,n,o,c,this.channelId,r,g).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],d=o.map((function(e){return c.push(e.messageUId),F(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),j(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),j(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),W(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,n,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=k.get(e,s,a.channelId);c&&n.forEach((function(t){c.messageUId===t.messageUId&&k.remove(e,s,a.channelId)}))}j(o.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),W(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var n=this;t.assert("param.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("param.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("param.timestamp",e.timestamp,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),W(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?j(e.onSuccess,o.map(K)):W(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,n){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",n,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,n).then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?j(e.onSuccess,o.map(K)):W(e.onError,n)}))},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var u=n.canIncludeExpansion,l=n.expansion,C=n.disableNotification,h=n.sentTime,p=n.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var f=a.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:h,sentStatus:p,searchContent:a.searchContent,isUnread:f,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,s,I).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?j(o.onSuccess,F(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(n,",targetId:").concat(s)),W(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,s,n){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess,o):W(n.onError,s)}))},e.prototype.getMessageCount=function(e,s,n){this._context.getMessageCount(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess,o):W(n.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,s,n,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),W(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,s,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===t.ErrorCode.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return F(e)}));j(a.onSuccess,g,i)}else j(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(s)),W(a.onError,n)}))},e.prototype.clearMessages=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearMessages(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||k.remove(e,s,o.channelId),j(n.onSuccess,!0)):(o.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(K(e))})),j(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),W(s.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(K(e))})),j(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),W(s.onError,o))}))},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,s,n,o,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(F(e))})),j(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(s)),W(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(F(e))})),j(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(s)),W(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===t.ErrorCode.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(F(e))})),j(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(s)),W(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,s){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,s,this.channelId).map((function(e){return F(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),W(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),W(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(s)),this._context.getGroupMessageDeliverList(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),W(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),W(s.onError,a))}))},e}(),z=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},$=function(){function e(e,s,n,o){this._context=e,this._options=s,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new X(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,n){if(!this._isCPPMode)return null==n||n.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(s,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(t.LogTagId.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(t.LogTagId.O,"getChannel method is only available in protocol stack mode"),null;if(t.assert("channelId",e,t.AssertRules.STRING,!0),e.length>20)return this.logger.error(t.LogTagId.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(t.LogTagId.O,"Only 1000 channels can be obtained"),null;var s=new X(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=s,s},e.prototype.deleteChannels=function(e){var s=this;t.assert("channelIds",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete s._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.7.2-beemrtc.3"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return r(this,void 0,void 0,(function(){return c(this,(function(s){switch(s.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return s.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,s){this._defaultChannelClient.getConversationList(e,t,s)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,s){void 0===s&&(s=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,s)},e.prototype.getConversation=function(e,t,s){return this._defaultChannelClient.getConversation(e,t,s)},e.prototype.removeConversation=function(e,t,s){return this._defaultChannelClient.removeConversation(e,t,s)},e.prototype.saveTextMessageDraft=function(e,t,s){return this._defaultChannelClient.saveTextMessageDraft(e,t,s)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,s){return this._defaultChannelClient.getTotalUnreadCount(e,t,s)},e.prototype.getUnreadCount=function(e,t,s){return this._defaultChannelClient.getUnreadCount(e,t,s)},e.prototype.getConversationUnreadCount=function(e,s){this.logger.error(t.LogTagId.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,s){this._defaultChannelClient.clearUnreadCount(e,t,s)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,s,n){return this._defaultChannelClient.setConversationStatus(e,t,s,n)},e.prototype.setConversationsMuteStatus=function(e){return this._defaultChannelClient.setConversationsMuteStatus(e)},e.prototype.setConversationsTopStatus=function(e){return this._defaultChannelClient.setConversationsTopStatus(e)},e.prototype.sendMessage=function(e,t,s,n,o,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,n,o,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,n){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,n)},e.prototype.sendReceiptResponse=function(e,t,s){return this._defaultChannelClient.sendReceiptResponse(e,t,s)},e.prototype.sendReadReceiptMessage=function(e,t,s){return this._defaultChannelClient.sendReadReceiptMessage(e,t,s)},e.prototype.getMessageReader=function(e,t,s){this._defaultChannelClient.getMessageReader(e,t,s)},e.prototype.getMessageReceiptInfo=function(e,t,s){this._defaultChannelClient.getMessageReceiptInfo(e,t,s)},e.prototype.setReadMessages=function(e,t,s,n){this._defaultChannelClient.setReadMessages(e,t,s,n)},e.prototype.updateMessageExpansion=function(e,t,s){this._defaultChannelClient.updateMessageExpansion(e,t,s)},e.prototype.removeMessageExpansionForKey=function(e,t,s){this._defaultChannelClient.removeMessageExpansionForKey(e,t,s)},e.prototype.getHistoryMessages=function(e,t,s,n,o,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,n,o,a,r)},e.prototype.joinChatRoom=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(t.LogTagId.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:s,joinExist:!1}),a),this._context.joinChatroom(e,s,a).then((function(s){var r=s===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),W(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,n,o){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,n).then((function(s){var n=s.code,r=s.data;n===t.ErrorCode.SUCCESS?j(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),W(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,n){var o=this;if(t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("entry.key",e.key,t.AssertRules.STRING,!0),t.assert("entry.value",e.value,t.AssertRules.STRING,!0)})),t.assert("options.isAutoDelete",e.isAutoDelete,t.AssertRules.BOOLEAN)}(s),t.assert("callback",n,t.AssertRules.CALLBACK),s.entries.length>10)W(n.onError,t.ErrorCode.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(t.LogTagId.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,s).then((function(e){var s=e.code,r=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),W(n.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(s);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},s);c.entries=s.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),W(n.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),W(n.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(s)),this._context.getChatroomEntry(e,s).then((function(s){var a=s.code,r=s.data;a===t.ErrorCode.SUCCESS?j(n.onSuccess,r||""):(o.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),W(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),W(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,n,o,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,s,n,a).then((function(s){var n=s.code,a=s.data;if(n===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return F(e)}));j(o.onSuccess,g,i)}else j(o.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),W(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,n){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,n)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,n,o,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(s.onSuccess).catch(s.onError)},e.prototype.getFileUrl=function(e,s,n,o,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",n,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("serverType",r,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(s)),this._context.getFileUrl(e,s,n,a,r).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagId",e.tagId,(function(e){return e.length<=10})),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.removeTag=function(e,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.updateTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,s){var n=this;t.assert("conversationType",e.type,t.AssertRules.NUMBER),t.assert("targetId",e.targetId,t.AssertRules.STRING),t.assert("channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(z(e)).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(o)),s.onError(o))})).catch((function(e){n.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,s.map((function(e){return z(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,s.map((function(e){return z(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,n){var o=this;t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("tagIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(s,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(z(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),n.onError(a))})).catch((function(e){o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,s).then((function(s){var n=s.code,r=s.data,c=[];n===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,n=e.targetId,o=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?F(a):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:s,targetId:n,unreadMessageCount:o,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,s).then((function(s){var a=s.code,r=s.data;o.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?n.onSuccess(r||0):(o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",s.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",s.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",s.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==n?void 0:n.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(s.targetId,",type").concat(s.type)),this._context.setConversationStatusInTag(e,z(s),n).then((function(s){var n=s.code;s.data,n===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.callExtra=function(e,s){for(var n,o=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,s){if(s||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)o.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&W(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?F(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return F(e)}));return void j(s.onSuccess,d,g)}s.onSuccess&&j(s.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,s){t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){j(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var n=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?j(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),W(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),W(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),W(s.onError,o))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?j(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),W(s.onError,o))}))}),"removeFromBlacklist",s)},e.prototype.getBlacklist=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?j(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(o)),W(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),W(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("content.senderUserId",n.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",n.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",n.objectName,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,s,n){var o,a,r=this;for(var c in t.assert("messages",e,(function(s){return t.isArray(s)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",s,t.AssertRules.BOOLEAN),t.assert("callback",n,t.AssertRules.CALLBACK),e)t.assert("message",e[c],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[c].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[c].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[c].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[c].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[c].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[c].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[c].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[c].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[c].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[c].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[c].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(o=e[c])||void 0===o?void 0:o.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[c])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){r._defaultChannelClient.batchInsertMessage(e,s,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,s,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",r.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){c._defaultChannelClient.getRemoteHistoryMessages(e,s,n,o,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,n,o){var a=this;t.assert("messageIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),W(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",o,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,s,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?j(s.onSuccess,F(r)):(n.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),W(s.onError,a))}))}),"getMessage",s)},e.prototype.setTextMessageExtra=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("value",s,t.AssertRules.STRING,!1),this.logger.info(t.LogTagId.O,"setTextMessageExtra ->messageId:".concat(e,",value:").concat(s)),this.assertCPPMode((function(){o._context.setTextMessageExtra(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setTextMessageExtra ->code:".concat(s,",messageId:").concat(e)),W(n.onError,s))}))}),"setTextMessageExtra",n)},e.prototype.setMessageSentStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),W(n.onError,s))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?j(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),W(n.onError,s))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,s,n,o){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",n,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,s,n).then((function(e){e===t.ErrorCode.SUCCESS?j(o.onSuccess,!0):W(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,s,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",o,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,s,n,o)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,s,n,o)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",r,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContent(e,s,n,o,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,s,n,o,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("startTime",o,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",r,t.AssertRules.NUMBER),t.assert("limit",c,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,s){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,s)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getMessageByUids=function(e){return this._defaultChannelClient.getMessageByUids(e)},e.prototype.getMessageByMsgUids=function(e,t,s){return this._defaultChannelClient.getMessageByMsgUids(e,t,s)},e.prototype.setMessageSearchContent=function(e,t){return this._context.setMessageSearchContent(e,t)},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,s,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,s){this._defaultChannelClient.getGroupMessageDeliverList(e,t,s)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Z=1;t.VersionManage.add("imlib-v2-adapter","5.7.2-beemrtc.3");var ee,te,se=null,ne={init:function(e,s,n){var o;void 0===n&&(n={}),t.assert("appkey",e,t.AssertRules.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||w;ee=new t.AppStorage(a,"API-V2"),Y=t.APIContext.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(se=Y.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),se.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Z=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),q=new $(Y,{readReceiptTimeout:Z},se,ee),t.logger.init(se)},getInstance:function(){return q},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){Y.assignWatcher({connection:function(s,n){try{e.onChanged(s,n)}catch(e){null==se||se.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){Y.assignWatcher({message:function(s,n,o){try{var a=F(s),r=Y.getCurrentUserId(),c=Y.getConnectedTime();H(a,r,c,Z,ee),a=function(e,t,s,n,o){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],u=0;u<c.length;u++)i="".concat(t).concat(c[u],"SENT"),(g=o.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[u]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[u]]=g.count,o.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(a,r,c,Z,ee),t.usingCppEngine()||k.set(s),e.onReceived(a,void 0,o)}catch(e){null==se||se.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){Y.assignWatcher({conversationState:function(s){try{var n=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,o=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:o,channelId:a||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==se||se.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){Y.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==se||se.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){Y.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==se||se.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){Y.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==se||se.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){Y.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==se||se.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){Y.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==se||se.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){Y.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Y.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Y.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==se||se.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){Y.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==se||se.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,n){return r(this,void 0,void 0,(function(){var o,a,r,i;return c(this,(function(c){switch(c.label){case 0:return o=null==se?void 0:se.createTraceId(),null==se||se.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,Y.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==se||se[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(Y.getConnectedTime()-1e3*Z*60*60*24).getTime(),ee.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=ee.get(e).dealtime;t&&i-t>0&&ee.remove(e)}else if(/RECEIVED$/.test(e)){var s=ee.get(e),n=Object.keys(s).length;Object.keys(s).forEach((function(e){var t=s[e].dealtime;t&&i-t>0&&delete s[e]})),Object.keys(s).length!==n&&(0===s.length?ee.remove(e):ee.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==se||se.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==se||se.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}}))}))},reconnect:function(e,s,n){var o=null==se?void 0:se.createTraceId();null==se||se.info(t.LogTagId.A_RECONNECT_T,null,o),Y.reconnect(n).then((function(s){var n=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==se||se[n](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==se||se.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:D,getMessageObjectName:function(e){var t=a(a({},G),D);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,n){this.RegisterMessage[e]=J(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,Y.registerMessageType(t,s.isPersited,s.isCounted,n)}},oe=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},ae=function(e,t){this.isCounted=e,this.isPersited=t},re=J("TextMessage","RC:TxtMsg"),ce=J("LocationMessage","RC:LBSMsg"),ie=J("TypingStatusMessage","RC:TypSts"),ge=J("ImageMessage","RC:ImgMsg"),de=J("RichContentMessage","RC:ImgTextMsg"),ue=J("VoiceMessage","RC:VcMsg"),le=J("HQVoiceMessage","RC:HQVCMsg"),Ce=J("FileMessage","RC:FileMsg"),he=J("SightMessage","RC:SightMsg"),pe=J("GIFMessage","RC:GIFMsg"),fe=J("ReadReceiptMessage","RC:ReadNtf"),Ie=J("ReadReceiptRequestMessage","RC:RRReqMsg"),Re=J("RCCombineMessage","RC:CombineMsg"),Te=function(e,t,s,n,o,a,r,c,i,g,d,u,l,C,h,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=n,this.objectName=o,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};exports.VoIPMediaType=void 0,(te=exports.VoIPMediaType||(exports.VoIPMediaType={}))[te.MEDIA_AUDIO=1]="MEDIA_AUDIO",te[te.MEDIA_VEDIO=2]="MEDIA_VEDIO",te[te.MEDIA_VIDEO=2]="MEDIA_VIDEO";var Se,ve=J("AcceptMessage","RC:VCAccept"),me=J("RingingMessage","RC:VCRinging"),ye=J("SummaryMessage","RC:VCSummary"),Me=J("HungupMessage","RC:VCHangup"),Ee=J("InviteMessage","RC:VCInvite"),Ae=J("MediaModifyMessage","RC:VCModifyMedia"),Le=J("MemberModifyMessage","RC:VCModifyMem"),Ne=J("lastMessageSendTime","RC:SRSMsg"),Oe=J("ReferenceMessage","RC:ReferenceMsg"),Ue=J("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),_e=J("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Se||(Se={}));var xe=Se;window&&(window.RongIMClient=ne),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=ve,exports.BaseMessage=V,exports.ChannelClient=X,exports.ConnectionState={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20},exports.FileMessage=Ce,exports.GIFMessage=pe,exports.GetChatRoomType=o,exports.HQVoiceMessage=le,exports.HungupMessage=Me,exports.IMClient=$,exports.ImageMessage=ge,exports.InviteMessage=Ee,exports.LocationMessage=ce,exports.MediaModifyMessage=Ae,exports.MemberModifyMessage=Le,exports.MentionedInfo=oe,exports.MentionedType=xe,exports.Message=Te,exports.MessageTag=ae,exports.PublicServiceMultiRichContentMessage=_e,exports.PublicServiceRichContentMessage=Ue,exports.RCCombineMessage=Re,exports.ReadReceiptMessage=fe,exports.ReadReceiptRequestMessage=Ie,exports.ReadReceiptResponseMessage=Q,exports.ReferenceMessage=Oe,exports.RichContentMessage=de,exports.RingingMessage=me,exports.RongIMClient=ne,exports.SentStatus=n,exports.SightMessage=he,exports.SummaryMessage=ye,exports.SyncReadStatusMessage=Ne,exports.TextMessage=re,exports.TypingStatusMessage=ie,exports.VoiceMessage=ue;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "types": "index.d.ts",
12
12
  "module": "index.esm.js",
13
- "version": "5.7.2-beemrtc.2",
13
+ "version": "5.7.2-beemrtc.3",
14
14
  "author": "pass-web@rongcloud.cn",
15
15
  "license": "LGPL 2.1",
16
16
  "homepage": "https://www.rongcloud.cn",
@@ -21,6 +21,6 @@
21
21
  "globals": "RongIMLib"
22
22
  },
23
23
  "peerDependencies": {
24
- "@rongcloud/engine": "=5.7.2-beemrtc.2"
24
+ "@rongcloud/engine": "=5.7.2-beemrtc.3"
25
25
  }
26
26
  }