@rongcloud/imlib-v2-adapter 5.14.0 → 5.16.0
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.cjs +15 -0
- package/index.cjs.js +15 -0
- package/index.d.ts +1 -1
- package/index.esm.js +2 -2
- package/index.mjs +15 -0
- package/package.json +14 -5
- package/index.js +0 -15
package/index.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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,o=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var n=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,o=arguments.length;s<o;s++)for(var n in t=arguments[s])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function r(e,t,s,o){return new(s||(s=Promise))((function(n,a){function r(e){try{i(o.next(e))}catch(e){a(e)}}function c(e){try{i(o.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function c(e,t){var s,o,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(a){return function(c){return function(a){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(6===a[0]&&r.label<n[1]){r.label=n[1],n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break}n[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],o=0}finally{s=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function i(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var g=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 o=e.get(s.conversationType,s.targetId,s.channelId||"");if(!o||o.sentTime<s.sentTime){var n=i(s.conversationType,s.targetId,s.channelId||"");e.map[n]=s}}},e.get=function(t,s,o){var n=i(t,s,o);return e.map[n]||null},e.remove=function(t,s,o){var n=i(t,s,o);delete e.map[n]},e.clear=function(){e.map={}},e.map={},e}(),d={"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","RC:RcNtf":"NotificationMessage"},l={};function u(e){var s=e.channelId,o=e.conversationType,n=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,d=e.matchCount;if(!t.usingCppEngine()){var l=g.get(o,n,s||"");(!r||l&&r.sentTime<l.sentTime)&&(r=l)}var u=r?C(r):null;return{channelId:s||"",conversationType:o,targetId:n,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:d}}function C(e){var s=e.conversationType,n=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,u=e.isOffLineMessage,C=e.sentTime,h=e.receivedStatus,p=e.receivedTime,I=e.canIncludeExpansion,R=e.disableNotification,f=e.expansion,T=e.messageId,S=e.sentStatus,v=e.channelId,m=e.readReceiptInfo,E=e.pushConfig,M="";return c in d?M=d[c]:c in l?M=l[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},M="UnknownMessage"),h||(h=t.ReceivedStatus.UNREAD),void 0===T&&(T=~~(16777215*Math.random())),{channelId:v||"",conversationType:s,targetId:n,senderUserId:a,content:r,messageType:M,messageUId:i,messageDirection:g,offLineMessage:u,sentTime:C,receivedStatus:h,receivedTime:p,objectName:c,messageId:T,sentStatus:S||o.SENT,disableNotification:R,canIncludeExpansion:I,expansion:f,readReceiptInfo:m,pushConfig:E}}function h(e,s,o,n,a){var r=new Date(o-1e3*n*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"),l=a.get(d);if(l){if(e.senderUserId in l)return void(l[e.senderUserId].uIds&&-1===l[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(l[e.senderUserId].uIds.push(e.content.messageUId),l[e.senderUserId].dealtime=e.sentTime,l[e.senderUserId].isResponse=!1,a.set(d,l)));var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return l[e.senderUserId]=u,void a.set(d,l)}var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(d,C)}}function p(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function I(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var R=function(e,t,s,o,n){void 0===o&&(o=!0),void 0===n&&(n=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=o,this.isCounted=n};function f(e,t,s,o){void 0===s&&(s=!0),void 0===o&&(o=!0);var n=function(n){return new R(e,t,n,s,o)};return n.MessageType=e,n.ObjectName=t,n}var T,S,v=f("ReadReceiptResponseMessage","RC:RRRspMsg"),m=function(){function e(e,t,s,o,n,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=o,this._readReceiptTimeout=n,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,o){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",o,t.AssertRules.NUMBER),this._context.getConversationList(o,void 0,0,0,this.channelId).then((function(o){var a=o.code,r=o.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(u(e))})):r.forEach((function(e){c.push(u(e))})),p(e.onSuccess,c)):(n.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),I(e.onError,a))}))},e.prototype.getConversation=function(e,s,o){var n=this;t.assert("callback",o,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(n,void 0,void 0,(function(){var n,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return n=c.sent(),a=n.code,r=n.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),o.onError(a),[2]):(o.onSuccess(r?u(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?(n._isCPPMode||g.remove(e,s,n.channelId),p(o.onSuccess)):(n.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&((this._draftMap[n]=this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=o,!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 o=this._context.getCurrentUserId();if(o)return(this._draftMap[o]||{})["".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 o=this._context.getCurrentUserId();return!!o&&delete(this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,o){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,o).then((function(s){var o=s.code,a=s.data;o===t.ErrorCode.SUCCESS?p(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(o)),I(e.onError,o))}))},e.prototype.getUnreadCount=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.clearConversations=function(e,s){var o=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?p(e.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),I(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),I(o.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(o){o===t.ErrorCode.SUCCESS?p(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(o)),I(e.onError,o))}))},e.prototype.getFirstUnreadMessage=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,e.data?C(e.data):null):(n.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),I(o.onError,e.code))}))},e.prototype.setConversationStatus=function(e,s,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("status",o,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(o));var r=o.isTop,c=o.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),I(n.onError,e))}))},e.prototype.sendMessage=function(e,s,n,r,c,i,d,l){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",n,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",d,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==l?void 0:l.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==l?void 0:l.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==l?void 0:l.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==l?void 0:l.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==l?void 0:l.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==l?void 0:l.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==l?void 0:l.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var R=!(!(null==l?void 0:l.isStatusMessage)&&!(null==l?void 0:l.isStatus)),f=function(e,t,s){var o,n=e||{},a=n.userIds,r=n.isVoipPush,c=n.disableNotification,i=n.isFilerWhiteBlacklist,g=n.expansion,d=n.canIncludeExpansion,l=n.pushConfig,u=n.resendMessageId,C=[];if(t){var h=(s||{}).content.mentionedInfo;C=h.userIdList,o=h.type}return{mentionedType:o,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:l,messageId:u}}(l,c,n);i=i||"",d=d||"";var T=Object.assign(n,a(a({isMentioned:c,pushContent:i,pushData:d},f),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:R})),S=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:T.messageType,conversationType:e,targetId:s,channelId:this.channelId}),v),this._context.sendMessage(e,s,T,r.onBefore,v).then((function(a){var c=a.code,i=a.data,d=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[d](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),v),c===t.ErrorCode.SUCCESS){u._isCPPMode||g.set(i);var f=C(i);h(f,S,u._context.getConnectedTime(),u._readReceiptTimeout,u._storage),p(r.onSuccess,f)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),I(r.onError,c,C({isMentioned:!!T.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==l?void 0:l.disableNotification),canIncludeExpansion:!!(null==l?void 0:l.canIncludeExpansion),expansion:(null==l?void 0:l.expansion)||null,conversationType:e,targetId:s,senderUserId:S,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:R,receivedStatus:t.ReceivedStatus.UNREAD,receivedStatusInfo:t.transformReceivedStatusInfo(t.ReceivedStatus.UNREAD),messageId:null==i?void 0:i.messageId,sentStatus:o.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,o){var n=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==o?void 0:o.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==o?void 0:o.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==o?void 0:o.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,d=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var l={conversationType:r,targetId:c,channelId:this.channelId},u=a({messageUId:i,sentTime:d},o);this._context.recallMessage(l,u).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?(n._isCPPMode||g.set(a),p(s.onSuccess,C(a))):(n.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(o,",targetId:").concat(c,",messageUId:").concat(i)),I(s.onError,o))}))},e.prototype.sendTypingStatusMessage=function(e,s,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",o,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:o},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 o=e.code,r=e.data,i=o===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:o,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),o===t.ErrorCode.SUCCESS?p(n.onSuccess,C(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(o,",targetId:").concat(s)),I(n.onError,o))}))},e.prototype.sendReceiptResponse=function(e,s,o){var n=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 o.onSuccess(null);var l=setInterval((function(){1===i.length&&clearInterval(l);var a=i.splice(0,1)[0],g=new v({receiptMessageDic:a});n.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,n._storage.set(r,c),p(o.onSuccess,e)},onError:function(e){n.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),I(o.onError,e)}})}),200)}else o.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,o){var n,a,r=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));try{for(var c=function(e){var t="function"==typeof Symbol&&Symbol.iterator,s=t&&e[t],o=0;if(s)return s.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),i=c.next();!i.done;i=c.next()){var g=i.value;t.assert("messageUId",g,t.AssertRules.STRING)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(a=c.return)&&a.call(c)}finally{if(n)throw n.error}}this._context.sendReadReceiptMessage(s,e,this.channelId).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(r.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),o.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(n,",targetId:").concat(s,",messageUIds:").concat(e)),o.onError(n)}))},e.prototype.getMessageReader=function(e,s,o){var n=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?o.onSuccess(c):(n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),o.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),o.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,o){var n=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,d=s.objectName;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({messageType:d,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),I(o.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,o){var n=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,g=s.objectName;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,messageType:g}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),I(o.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,o,n,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",o,t.AssertRules.NUMBER,!0),t.assert("count",n,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(o));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:o,count:n}),g),this._context.getHistoryMessage(e,s,o,n,c,this.channelId,r,g).then((function(e){var s=e.code,o=e.data;if(s===t.ErrorCode.SUCCESS)if(o){var n=o.list,r=o.hasMore,c=[],d=n.map((function(e){return c.push(e.messageUId),C(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),p(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),p(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),I(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",o,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,o,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=g.get(e,s,a.channelId);c&&o.forEach((function(t){c.messageUId===t.messageUId&&g.remove(e,s,a.channelId)}))}p(n.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),I(n.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var o=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 n=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(n)),this._context.deleteRemoteMessageByTimestamp(n,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),I(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var o=s.code,n=s.data;o===t.ErrorCode.SUCCESS?p(e.onSuccess,n.map(u)):I(e.onError,o)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,o){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",o,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,o).then((function(s){var o=s.code,n=s.data;o===t.ErrorCode.SUCCESS?p(e.onSuccess,n.map(u)):I(e.onError,o)}))},e.prototype.insertMessage=function(e,s,o,n,a){var r=this;void 0===a&&(a={});var c=o.senderUserId,i=o.objectName,g=o.content,d=o.messageDirection,l=o.canIncludeExpansion,u=o.expansion,h=o.disableNotification,R=o.sentTime,f=o.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var T=a.isUnread,S={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:R,sentStatus:f,searchContent:a.searchContent,isUnread:T,messageUId:"",disableNotification:h,canIncludeExpansion:l,expansionMsg:JSON.stringify(u),channelId:this.channelId};this._context.insertMessage(e,s,S).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?p(n.onSuccess,C(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(o,",targetId:").concat(s)),I(n.onError,o))}))},e.prototype.batchInsertMessage=function(e,s,o){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,n=e.data;s===t.ErrorCode.SUCCESS?p(o.onSuccess,n):I(o.onError,s)}))},e.prototype.getMessageCount=function(e,s,o){this._context.getMessageCount(e,s).then((function(e){var s=e.code,n=e.data;s===t.ErrorCode.SUCCESS?p(o.onSuccess,n):I(o.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,o,n,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(o)),this._context.deleteMessagesByTimestamp(e,s,o,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),I(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,o,n,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,o,n,i,this.channelId).then((function(e){var o=e.code,n=e.data;if(o===t.ErrorCode.SUCCESS)if(n){var r=n.list,i=n.hasMore,g=r.map((function(e){return C(e)}));p(a.onSuccess,g,i)}else p(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(o,",targetId:").concat(s)),I(a.onError,o)}))},e.prototype.clearMessages=function(e,s,o){var n=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?(n._isCPPMode||g.remove(e,s,n.channelId),p(o.onSuccess,!0)):(n.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,o,n){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,n,this.channelId,o).then((function(o){var n=o.code,r=o.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(u(e))})),p(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(n,",keyword:").concat(e)),I(s.onError,n))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,o,n){var a=this;void 0===o&&(o=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,o,n).then((function(o){var n=o.code,r=o.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(u(e))})),p(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(n,",keyword:").concat(e)),I(s.onError,n))}))},e.prototype.searchMessageByContent=function(e,s,o,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(o)),this._context.searchMessageByContent(e,s,o,n,a,r,this.channelId).then((function(e){var o=e.code,n=e.data,a=[];if(o===t.ErrorCode.SUCCESS){var r=n=n||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(C(e))})),p(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(o,",targetId:").concat(s)),I(c.onError,o)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,o,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(o,", timestamp: ").concat(n,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,o,n,a).then((function(e){var o=e.code,n=e.data,a=[];if(o===t.ErrorCode.SUCCESS){var i=n=n||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(C(e))})),p(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(o,",targetId:").concat(s)),I(r.onError,o)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,o,n,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(o,", startTime: ").concat(n,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,o,n,a,r,c).then((function(e){var o=e.code,n=e.data,a=[];o===t.ErrorCode.SUCCESS?((n=n||{}).messages.forEach((function(e){a.push(C(e))})),p(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(o,",targetId:").concat(s)),I(i.onError,o))}))},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 C(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,o,n){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),I(n.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,o){var n=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?p(o.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,o){var n=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?p(o.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),I(o.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var o=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),I(s.onError,a))}))},e}(),E=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},M=function(){function e(e,s,o,n){this._context=e,this._options=s,this.logger=o,this._storage=n,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new m(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,o){if(!this._isCPPMode)return null==o||o.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 m(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.16.0"}},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,o){return this._defaultChannelClient.setConversationStatus(e,t,s,o)},e.prototype.sendMessage=function(e,t,s,o,n,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,o,n,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,o)},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.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,o,n,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,o,n,a,r)},e.prototype.joinChatRoom=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",o,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";n.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var o=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 n=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),n),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),n),a===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),I(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,o,n){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",o,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,o).then((function(s){var o=s.code,r=s.data;o===t.ErrorCode.SUCCESS?p(n.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(o,",chatRoomId:").concat(e)),I(n.onError,o))}))},e.prototype.setChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,o){var n=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",o,t.AssertRules.CALLBACK),s.entries.length>10)I(o.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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),I(o.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,o){var n=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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),I(o.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,r||""):(n.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),I(o.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var o=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(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),I(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,o,n,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",o,t.AssertRules.NUMBER,!0),t.assert("callback",n,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,o,a).then((function(s){var o=s.code,a=s.data;if(o===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return C(e)}));p(n.onSuccess,g,i)}else p(n.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(o,",chatRoomId:").concat(e)),I(n.onError,o)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,o,n,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",o,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(o,",queryString:").concat(r)),this._context.getFileToken(e,o,n,r).then((function(e){s.onSuccess(a(a({},e),{bos:""}))})).catch(s.onError)},e.prototype.getFileUrl=function(e,s,o,n,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",o,t.AssertRules.STRING),t.assert("callback",n,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)),a?n.onSuccess(a):this._context.getFileUrl(e,s,r||t.UploadMethod.QINIU,o).then(n.onSuccess).catch(n.onError)},e.prototype.createTag=function(e,s){var o=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(n){var a=n.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(n){o.logger.warn(t.LogTagId.O,"createTag ->code:".concat(n,",tagId:").concat(e.tagId)),s.onError(n)}))},e.prototype.removeTag=function(e,s){var o=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(n){var a=n.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){o.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(n,",tagId:").concat(e)),s.onError(n)}))},e.prototype.updateTag=function(e,s){var o=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(n){var a=n.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(n){o.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(n,",tagId:").concat(e.tagId)),s.onError(n)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(o){var n=o.code,a=o.data;n===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(n)),e.onError(n))})).catch((function(o){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(o)),e.onError(o)}))},e.prototype.getTagsForConversation=function(e,s){var o=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(E(e)).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(o.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(n)),s.onError(n))})).catch((function(e){o.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,o){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",o,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 E(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?o.onSuccess():(n.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(s){n.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,o){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",o,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 E(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?o.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(s){n.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,o){var n=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",o,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(E(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?o.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),o.onError(a))})).catch((function(e){n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),o.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,o,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",o,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,o,s).then((function(s){var o=s.code,r=s.data,c=[];o===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,o=e.targetId,n=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?C(a):null,d=g||{},l=d.messageType,u=d.sentTime,h=d.receivedStatus;return{channelId:t||"",conversationType:s,targetId:o,unreadMessageCount:n,latestMessage:g,isTopInTag:i,latestMessageId:d.messageId,objectName:l,sentTime:u,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),n.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(o,",tagId:").concat(e)),n.onError(o))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,o){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,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;n.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?o.onSuccess(r||0):(n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(s){n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,o,n){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==o?void 0:o.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,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,E(s),o).then((function(s){var o=s.code;s.data,o===t.ErrorCode.SUCCESS?n.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(o,",tagId:").concat(e)),n.onError(o))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.callExtra=function(e,s){for(var o,n=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(o=this._context).callExtra.apply(o,function(e,t,s){if(s||2===arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}([e],function(e,t){var s="function"==typeof Symbol&&e[Symbol.iterator];if(!s)return e;var o,n,a=s.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)r.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return r}(a),!1)).then((function(o){var a=o.code,r=o.data;if(a!==t.ErrorCode.SUCCESS)n.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&I(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?C(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return C(e)}));return void p(s.onSuccess,d,g)}s.onSuccess&&p(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(){p(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var o=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){o._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var o=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(){o._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?p(s.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),I(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var o=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(){o._context.getUserStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),I(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var o=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(){o._context.addToBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(n,",useerId:").concat(e)),I(s.onError,n))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var o=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(){o._context.removeFromBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(n,",useerId:").concat(e)),I(s.onError,n))}))}),"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(o){var n=o.code,a=o.data;n===t.ErrorCode.SUCCESS?p(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(n)),I(e.onError,n))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var o=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(){o._context.getBlacklistStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),I(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,o,n,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",o.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",o.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",o.objectName,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(o.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,o,n,a)}),"insertMessage",n)},e.prototype.batchInsertMessage=function(e,s,o){var n,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",o,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===(n=e[c])||void 0===n?void 0:n.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,o)}),"batchInsertMessage",o)},e.prototype.getMessageCount=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.getMessageCount(e,s,o)}),"getMessageCount",o)},e.prototype.getRemoteHistoryMessages=function(e,s,o,n,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",o,t.AssertRules.NUMBER,!0),t.assert("count",n,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,o,n,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,o,n){var a=this;t.assert("messageIds",o,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(o)),this.assertCPPMode((function(){a._context.deleteMessages(o).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(o)),I(n.onError,e))}))}),"deleteLocalMessages",n)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,o,n,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",n,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,o,n,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.clearMessages(e,s,o)}),"clearMessages",o)},e.prototype.getMessage=function(e,s){var o=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._context.getLocalMessage(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,C(r)):(o.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),I(s.onError,a))}))}),"getMessage",s)},e.prototype.setMessageSentStatus=function(e,s,o){var n=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(){n._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?p(o.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),I(o.onError,s))}))}),"setMessageSentStatus",o)},e.prototype.setMessageReceivedStatus=function(e,s,o){var n=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(){n._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?p(o.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),I(o.onError,s))}))}),"setMessageReceivedStatus",o)},e.prototype.setMessageContent=function(e,s,o,n){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",o,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:o})),a._context.setMessageContent(e,s,o).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess,!0):I(n.onError,e)}))}),"setMessageContent",n)},e.prototype.setMessageSearchField=function(e,s,o){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(o)),this.assertCPPMode((function(){n._context.setMessageSearchField(e,s,o)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,o,n){var a=this;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.searchConversationByContent(e,s,o,n)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,o,n){var a=this;void 0===o&&(o=[]),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.searchConversationByContentWithAllChannel(e,s,o,n)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,o,n,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",o,t.AssertRules.STRING,!0),t.assert("timestamp",n,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,o,n,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,o,n,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",o,t.AssertRules.STRING,!0),t.assert("timestamp",n,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,o,n,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,o,n,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",o,t.AssertRules.STRING,!0),t.assert("startTime",n,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,o,n,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,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,o,n)}),"clearUnreadCountByTimestamp",n)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){n._defaultChannelClient.getConversationNotificationStatus(e,s,o)}),"getConversationNotificationStatus",o)},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}(),y=1;t.VersionManage.add("imlib-v2-adapter","5.16.0");var A,L,O=null,N={init:function(e,s,o){var n;void 0===o&&(o={}),t.assert("appkey",e,t.AssertRules.STRING,!0),A=new t.AppStorage("API-V2"),S=t.APIContext.init({appkey:e,navigators:o.navi?[o.navi]:[],miniCMPProxy:[],logOutputLevel:o.logOutputLevel,typingExpireTime:o.typingExpireTime,httpInMainProcess:!!o.httpInMainProcess,logExpireTime:o.logExpireTime,environment:null!==(n=o.environment)&&void 0!==n?n:"default"}),O=S.logger,y=Math.min(15,Math.max(o.readReceiptTimeout||1,1)),T=new M(S,{readReceiptTimeout:y},O,A),t.logger.init(O)},getInstance:function(){return T},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){S.assignWatcher({connection:function(s,o){try{e.onChanged(s,o)}catch(e){null==O||O.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){S.assignWatcher({message:function(s,o,n){try{var a=C(s),r=S.getCurrentUserId(),c=S.getConnectedTime();h(a,r,c,y,A),a=function(e,t,s,o,n){var a=new Date(s-1e3*o*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=[],l=0;l<c.length;l++)i="".concat(t).concat(c[l],"SENT"),(g=n.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[l]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[l]]=g.count,n.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(a,r,c,y,A),t.usingCppEngine()||g.set(s),e.onReceived(a,void 0,n)}catch(e){null==O||O.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){S.assignWatcher({conversationState:function(s){try{var o=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,n=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&o.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:n,channelId:a||"",updatedTime:r.time})})),o.length>0&&e.onChanged(o)}catch(e){null==O||O.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){S.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){S.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){S.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){S.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==O||O.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){S.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==O||O.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){S.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){S.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){S.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){S.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==O||O.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,o){return r(this,void 0,void 0,(function(){var n,a,r;return c(this,(function(c){switch(c.label){case 0:return n=null==O?void 0:O.createTraceId(),null==O||O.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),n),[4,S.connect(e,!!o,n)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==O||O[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),n),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(S.getConnectedTime()-1e3*y*60*60*24).getTime(),A.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=A.get(e).dealtime;t&&i-t>0&&A.remove(e)}else if(/RECEIVED$/.test(e)){var s=A.get(e),o=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!==o&&(0===s.length?A.remove(e):A.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}var i}))}))},reconnect:function(e,s,o){var n=null==O?void 0:O.createTraceId();null==O||O.info(t.LogTagId.A_RECONNECT_T,null,n),S.reconnect(o).then((function(s){var o=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==O||O[o](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),n),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==O||O.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:l,getMessageObjectName:function(e){var t=a(a({},d),l);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,o){this.RegisterMessage[e]=f(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,S.registerMessageType(t,s.isPersited,s.isCounted,o)}},U=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},_=function(e,t){this.isCounted=e,this.isPersited=t},B=f("TextMessage","RC:TxtMsg"),x=f("LocationMessage","RC:LBSMsg"),b=f("TypingStatusMessage","RC:TypSts"),P=f("ImageMessage","RC:ImgMsg"),w=f("RichContentMessage","RC:ImgTextMsg"),k=f("VoiceMessage","RC:VcMsg"),G=f("HQVoiceMessage","RC:HQVCMsg"),D=f("FileMessage","RC:FileMsg"),K=f("SightMessage","RC:SightMsg"),F=f("GIFMessage","RC:GIFMsg"),j=f("ReadReceiptMessage","RC:ReadNtf"),V=f("ReadReceiptRequestMessage","RC:RRReqMsg"),H=f("RCCombineMessage","RC:CombineMsg"),W=function(e,t,s,o,n,a,r,c,i,g,d,l,u,C,h,p,I,R){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=o,this.objectName=n,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=l,this.receivedStatus=u,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=I,this.disableNotification=R};exports.VoIPMediaType=void 0,(L=exports.VoIPMediaType||(exports.VoIPMediaType={}))[L.MEDIA_AUDIO=1]="MEDIA_AUDIO",L[L.MEDIA_VEDIO=2]="MEDIA_VEDIO",L[L.MEDIA_VIDEO=2]="MEDIA_VIDEO";var J,Y=f("AcceptMessage","RC:VCAccept"),q=f("RingingMessage","RC:VCRinging"),Q=f("SummaryMessage","RC:VCSummary"),X=f("HungupMessage","RC:VCHangup"),$=f("InviteMessage","RC:VCInvite"),z=f("MediaModifyMessage","RC:VCModifyMedia"),Z=f("MemberModifyMessage","RC:VCModifyMem"),ee=f("lastMessageSendTime","RC:SRSMsg"),te=f("ReferenceMessage","RC:ReferenceMsg"),se=f("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),oe=f("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(J||(J={}));var ne=J;window&&(window.RongIMClient=N),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),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=Y,exports.BaseMessage=R,exports.ChannelClient=m,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=D,exports.GIFMessage=F,exports.GetChatRoomType=n,exports.HQVoiceMessage=G,exports.HungupMessage=X,exports.IMClient=M,exports.ImageMessage=P,exports.InviteMessage=$,exports.LocationMessage=x,exports.MediaModifyMessage=z,exports.MemberModifyMessage=Z,exports.MentionedInfo=U,exports.MentionedType=ne,exports.Message=W,exports.MessageTag=_,exports.PublicServiceMultiRichContentMessage=oe,exports.PublicServiceRichContentMessage=se,exports.RCCombineMessage=H,exports.ReadReceiptMessage=j,exports.ReadReceiptRequestMessage=V,exports.ReadReceiptResponseMessage=v,exports.ReferenceMessage=te,exports.RichContentMessage=w,exports.RingingMessage=q,exports.RongIMClient=N,exports.SentStatus=o,exports.SightMessage=K,exports.SummaryMessage=Q,exports.SyncReadStatusMessage=ee,exports.TextMessage=B,exports.TypingStatusMessage=b,exports.VoiceMessage=k;
|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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,o=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var n=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,o=arguments.length;s<o;s++)for(var n in t=arguments[s])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function r(e,t,s,o){return new(s||(s=Promise))((function(n,a){function r(e){try{i(o.next(e))}catch(e){a(e)}}function c(e){try{i(o.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function c(e,t){var s,o,n,a,r={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(a){return function(c){return function(a){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,o&&(n=2&a[0]?o.return:a[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,a[1])).done)return n;switch(o=0,n&&(a=[2&a[0],n.value]),a[0]){case 0:case 1:n=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,o=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==a[0]&&2!==a[0])){r=0;continue}if(3===a[0]&&(!n||a[1]>n[0]&&a[1]<n[3])){r.label=a[1];break}if(6===a[0]&&r.label<n[1]){r.label=n[1],n=a;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(a);break}n[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(e){a=[6,e],o=0}finally{s=n=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function i(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var g=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 o=e.get(s.conversationType,s.targetId,s.channelId||"");if(!o||o.sentTime<s.sentTime){var n=i(s.conversationType,s.targetId,s.channelId||"");e.map[n]=s}}},e.get=function(t,s,o){var n=i(t,s,o);return e.map[n]||null},e.remove=function(t,s,o){var n=i(t,s,o);delete e.map[n]},e.clear=function(){e.map={}},e.map={},e}(),d={"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","RC:RcNtf":"NotificationMessage"},l={};function u(e){var s=e.channelId,o=e.conversationType,n=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,d=e.matchCount;if(!t.usingCppEngine()){var l=g.get(o,n,s||"");(!r||l&&r.sentTime<l.sentTime)&&(r=l)}var u=r?C(r):null;return{channelId:s||"",conversationType:o,targetId:n,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:d}}function C(e){var s=e.conversationType,n=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,u=e.isOffLineMessage,C=e.sentTime,h=e.receivedStatus,p=e.receivedTime,I=e.canIncludeExpansion,R=e.disableNotification,f=e.expansion,T=e.messageId,S=e.sentStatus,v=e.channelId,m=e.readReceiptInfo,E=e.pushConfig,M="";return c in d?M=d[c]:c in l?M=l[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},M="UnknownMessage"),h||(h=t.ReceivedStatus.UNREAD),void 0===T&&(T=~~(16777215*Math.random())),{channelId:v||"",conversationType:s,targetId:n,senderUserId:a,content:r,messageType:M,messageUId:i,messageDirection:g,offLineMessage:u,sentTime:C,receivedStatus:h,receivedTime:p,objectName:c,messageId:T,sentStatus:S||o.SENT,disableNotification:R,canIncludeExpansion:I,expansion:f,readReceiptInfo:m,pushConfig:E}}function h(e,s,o,n,a){var r=new Date(o-1e3*n*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"),l=a.get(d);if(l){if(e.senderUserId in l)return void(l[e.senderUserId].uIds&&-1===l[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(l[e.senderUserId].uIds.push(e.content.messageUId),l[e.senderUserId].dealtime=e.sentTime,l[e.senderUserId].isResponse=!1,a.set(d,l)));var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return l[e.senderUserId]=u,void a.set(d,l)}var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(d,C)}}function p(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function I(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var R=function(e,t,s,o,n){void 0===o&&(o=!0),void 0===n&&(n=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=o,this.isCounted=n};function f(e,t,s,o){void 0===s&&(s=!0),void 0===o&&(o=!0);var n=function(n){return new R(e,t,n,s,o)};return n.MessageType=e,n.ObjectName=t,n}var T,S,v=f("ReadReceiptResponseMessage","RC:RRRspMsg"),m=function(){function e(e,t,s,o,n,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=o,this._readReceiptTimeout=n,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,o){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",o,t.AssertRules.NUMBER),this._context.getConversationList(o,void 0,0,0,this.channelId).then((function(o){var a=o.code,r=o.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(u(e))})):r.forEach((function(e){c.push(u(e))})),p(e.onSuccess,c)):(n.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),I(e.onError,a))}))},e.prototype.getConversation=function(e,s,o){var n=this;t.assert("callback",o,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(n,void 0,void 0,(function(){var n,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return n=c.sent(),a=n.code,r=n.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),o.onError(a),[2]):(o.onSuccess(r?u(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?(n._isCPPMode||g.remove(e,s,n.channelId),p(o.onSuccess)):(n.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&((this._draftMap[n]=this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=o,!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 o=this._context.getCurrentUserId();if(o)return(this._draftMap[o]||{})["".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 o=this._context.getCurrentUserId();return!!o&&delete(this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,o){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,o).then((function(s){var o=s.code,a=s.data;o===t.ErrorCode.SUCCESS?p(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(o)),I(e.onError,o))}))},e.prototype.getUnreadCount=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.clearConversations=function(e,s){var o=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?p(e.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),I(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),I(o.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(o){o===t.ErrorCode.SUCCESS?p(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(o)),I(e.onError,o))}))},e.prototype.getFirstUnreadMessage=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,e.data?C(e.data):null):(n.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),I(o.onError,e.code))}))},e.prototype.setConversationStatus=function(e,s,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("status",o,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(o));var r=o.isTop,c=o.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),I(n.onError,e))}))},e.prototype.sendMessage=function(e,s,n,r,c,i,d,l){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",n,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",d,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==l?void 0:l.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==l?void 0:l.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==l?void 0:l.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==l?void 0:l.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==l?void 0:l.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==l?void 0:l.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==l?void 0:l.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var R=!(!(null==l?void 0:l.isStatusMessage)&&!(null==l?void 0:l.isStatus)),f=function(e,t,s){var o,n=e||{},a=n.userIds,r=n.isVoipPush,c=n.disableNotification,i=n.isFilerWhiteBlacklist,g=n.expansion,d=n.canIncludeExpansion,l=n.pushConfig,u=n.resendMessageId,C=[];if(t){var h=(s||{}).content.mentionedInfo;C=h.userIdList,o=h.type}return{mentionedType:o,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:l,messageId:u}}(l,c,n);i=i||"",d=d||"";var T=Object.assign(n,a(a({isMentioned:c,pushContent:i,pushData:d},f),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:R})),S=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:T.messageType,conversationType:e,targetId:s,channelId:this.channelId}),v),this._context.sendMessage(e,s,T,r.onBefore,v).then((function(a){var c=a.code,i=a.data,d=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[d](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),v),c===t.ErrorCode.SUCCESS){u._isCPPMode||g.set(i);var f=C(i);h(f,S,u._context.getConnectedTime(),u._readReceiptTimeout,u._storage),p(r.onSuccess,f)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),I(r.onError,c,C({isMentioned:!!T.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==l?void 0:l.disableNotification),canIncludeExpansion:!!(null==l?void 0:l.canIncludeExpansion),expansion:(null==l?void 0:l.expansion)||null,conversationType:e,targetId:s,senderUserId:S,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:R,receivedStatus:t.ReceivedStatus.UNREAD,receivedStatusInfo:t.transformReceivedStatusInfo(t.ReceivedStatus.UNREAD),messageId:null==i?void 0:i.messageId,sentStatus:o.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,o){var n=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==o?void 0:o.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==o?void 0:o.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==o?void 0:o.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,d=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var l={conversationType:r,targetId:c,channelId:this.channelId},u=a({messageUId:i,sentTime:d},o);this._context.recallMessage(l,u).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?(n._isCPPMode||g.set(a),p(s.onSuccess,C(a))):(n.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(o,",targetId:").concat(c,",messageUId:").concat(i)),I(s.onError,o))}))},e.prototype.sendTypingStatusMessage=function(e,s,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",o,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:o},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 o=e.code,r=e.data,i=o===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:o,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),o===t.ErrorCode.SUCCESS?p(n.onSuccess,C(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(o,",targetId:").concat(s)),I(n.onError,o))}))},e.prototype.sendReceiptResponse=function(e,s,o){var n=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 o.onSuccess(null);var l=setInterval((function(){1===i.length&&clearInterval(l);var a=i.splice(0,1)[0],g=new v({receiptMessageDic:a});n.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,n._storage.set(r,c),p(o.onSuccess,e)},onError:function(e){n.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),I(o.onError,e)}})}),200)}else o.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,o){var n,a,r=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));try{for(var c=function(e){var t="function"==typeof Symbol&&Symbol.iterator,s=t&&e[t],o=0;if(s)return s.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(e),i=c.next();!i.done;i=c.next()){var g=i.value;t.assert("messageUId",g,t.AssertRules.STRING)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(a=c.return)&&a.call(c)}finally{if(n)throw n.error}}this._context.sendReadReceiptMessage(s,e,this.channelId).then((function(n){var a=n.code;a===t.ErrorCode.SUCCESS?o.onSuccess():(r.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),o.onError(a))})).catch((function(n){r.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(n,",targetId:").concat(s,",messageUIds:").concat(e)),o.onError(n)}))},e.prototype.getMessageReader=function(e,s,o){var n=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?o.onSuccess(c):(n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),o.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),o.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,o){var n=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,d=s.objectName;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({messageType:d,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),I(o.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,o){var n=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,g=s.objectName;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,messageType:g}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),I(o.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,o,n,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",o,t.AssertRules.NUMBER,!0),t.assert("count",n,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(o));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:o,count:n}),g),this._context.getHistoryMessage(e,s,o,n,c,this.channelId,r,g).then((function(e){var s=e.code,o=e.data;if(s===t.ErrorCode.SUCCESS)if(o){var n=o.list,r=o.hasMore,c=[],d=n.map((function(e){return c.push(e.messageUId),C(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),p(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),p(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),I(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",o,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,o,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=g.get(e,s,a.channelId);c&&o.forEach((function(t){c.messageUId===t.messageUId&&g.remove(e,s,a.channelId)}))}p(n.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),I(n.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var o=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 n=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(n)),this._context.deleteRemoteMessageByTimestamp(n,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),I(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var o=s.code,n=s.data;o===t.ErrorCode.SUCCESS?p(e.onSuccess,n.map(u)):I(e.onError,o)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,o){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",o,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,o).then((function(s){var o=s.code,n=s.data;o===t.ErrorCode.SUCCESS?p(e.onSuccess,n.map(u)):I(e.onError,o)}))},e.prototype.insertMessage=function(e,s,o,n,a){var r=this;void 0===a&&(a={});var c=o.senderUserId,i=o.objectName,g=o.content,d=o.messageDirection,l=o.canIncludeExpansion,u=o.expansion,h=o.disableNotification,R=o.sentTime,f=o.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var T=a.isUnread,S={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:R,sentStatus:f,searchContent:a.searchContent,isUnread:T,messageUId:"",disableNotification:h,canIncludeExpansion:l,expansionMsg:JSON.stringify(u),channelId:this.channelId};this._context.insertMessage(e,s,S).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?p(n.onSuccess,C(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(o,",targetId:").concat(s)),I(n.onError,o))}))},e.prototype.batchInsertMessage=function(e,s,o){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,n=e.data;s===t.ErrorCode.SUCCESS?p(o.onSuccess,n):I(o.onError,s)}))},e.prototype.getMessageCount=function(e,s,o){this._context.getMessageCount(e,s).then((function(e){var s=e.code,n=e.data;s===t.ErrorCode.SUCCESS?p(o.onSuccess,n):I(o.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,o,n,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(o)),this._context.deleteMessagesByTimestamp(e,s,o,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),I(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,o,n,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,o,n,i,this.channelId).then((function(e){var o=e.code,n=e.data;if(o===t.ErrorCode.SUCCESS)if(n){var r=n.list,i=n.hasMore,g=r.map((function(e){return C(e)}));p(a.onSuccess,g,i)}else p(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(o,",targetId:").concat(s)),I(a.onError,o)}))},e.prototype.clearMessages=function(e,s,o){var n=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?(n._isCPPMode||g.remove(e,s,n.channelId),p(o.onSuccess,!0)):(n.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,o,n){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,n,this.channelId,o).then((function(o){var n=o.code,r=o.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(u(e))})),p(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(n,",keyword:").concat(e)),I(s.onError,n))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,o,n){var a=this;void 0===o&&(o=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,o,n).then((function(o){var n=o.code,r=o.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(u(e))})),p(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(n,",keyword:").concat(e)),I(s.onError,n))}))},e.prototype.searchMessageByContent=function(e,s,o,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(o)),this._context.searchMessageByContent(e,s,o,n,a,r,this.channelId).then((function(e){var o=e.code,n=e.data,a=[];if(o===t.ErrorCode.SUCCESS){var r=n=n||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(C(e))})),p(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(o,",targetId:").concat(s)),I(c.onError,o)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,o,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(o,", timestamp: ").concat(n,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,o,n,a).then((function(e){var o=e.code,n=e.data,a=[];if(o===t.ErrorCode.SUCCESS){var i=n=n||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(C(e))})),p(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(o,",targetId:").concat(s)),I(r.onError,o)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,o,n,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(o,", startTime: ").concat(n,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,o,n,a,r,c).then((function(e){var o=e.code,n=e.data,a=[];o===t.ErrorCode.SUCCESS?((n=n||{}).messages.forEach((function(e){a.push(C(e))})),p(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(o,",targetId:").concat(s)),I(i.onError,o))}))},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 C(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,o,n){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),I(n.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,o){var n=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?p(o.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),I(o.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,o){var n=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?p(o.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),I(o.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var o=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),I(s.onError,a))}))},e}(),E=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},M=function(){function e(e,s,o,n){this._context=e,this._options=s,this.logger=o,this._storage=n,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new m(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,o){if(!this._isCPPMode)return null==o||o.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 m(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.16.0"}},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,o){return this._defaultChannelClient.setConversationStatus(e,t,s,o)},e.prototype.sendMessage=function(e,t,s,o,n,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,o,n,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,o)},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.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,o,n,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,o,n,a,r)},e.prototype.joinChatRoom=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",o,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";n.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var o=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 n=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),n),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),n),a===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),I(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,o,n){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",o,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,o).then((function(s){var o=s.code,r=s.data;o===t.ErrorCode.SUCCESS?p(n.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(o,",chatRoomId:").concat(e)),I(n.onError,o))}))},e.prototype.setChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,o){var n=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",o,t.AssertRules.CALLBACK),s.entries.length>10)I(o.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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),I(o.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,o){var n=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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),I(o.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",o,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?p(o.onSuccess):(n.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),I(o.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,o){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",o,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?p(o.onSuccess,r||""):(n.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),I(o.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var o=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(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),I(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,o,n,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",o,t.AssertRules.NUMBER,!0),t.assert("callback",n,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,o,a).then((function(s){var o=s.code,a=s.data;if(o===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return C(e)}));p(n.onSuccess,g,i)}else p(n.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(o,",chatRoomId:").concat(e)),I(n.onError,o)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,o,n,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",o,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(o,",queryString:").concat(r)),this._context.getFileToken(e,o,n,r).then((function(e){s.onSuccess(a(a({},e),{bos:""}))})).catch(s.onError)},e.prototype.getFileUrl=function(e,s,o,n,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",o,t.AssertRules.STRING),t.assert("callback",n,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)),a?n.onSuccess(a):this._context.getFileUrl(e,s,r||t.UploadMethod.QINIU,o).then(n.onSuccess).catch(n.onError)},e.prototype.createTag=function(e,s){var o=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(n){var a=n.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(n){o.logger.warn(t.LogTagId.O,"createTag ->code:".concat(n,",tagId:").concat(e.tagId)),s.onError(n)}))},e.prototype.removeTag=function(e,s){var o=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(n){var a=n.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(n){o.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(n,",tagId:").concat(e)),s.onError(n)}))},e.prototype.updateTag=function(e,s){var o=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(n){var a=n.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(o.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(n){o.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(n,",tagId:").concat(e.tagId)),s.onError(n)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(o){var n=o.code,a=o.data;n===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(n)),e.onError(n))})).catch((function(o){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(o)),e.onError(o)}))},e.prototype.getTagsForConversation=function(e,s){var o=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(E(e)).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(o.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(n)),s.onError(n))})).catch((function(e){o.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,o){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",o,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 E(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?o.onSuccess():(n.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(s){n.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,o){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",o,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 E(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?o.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(s){n.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,o){var n=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",o,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(E(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?o.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),o.onError(a))})).catch((function(e){n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),o.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,o,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",o,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,o,s).then((function(s){var o=s.code,r=s.data,c=[];o===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,o=e.targetId,n=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?C(a):null,d=g||{},l=d.messageType,u=d.sentTime,h=d.receivedStatus;return{channelId:t||"",conversationType:s,targetId:o,unreadMessageCount:n,latestMessage:g,isTopInTag:i,latestMessageId:d.messageId,objectName:l,sentTime:u,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),n.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(o,",tagId:").concat(e)),n.onError(o))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,o){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,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;n.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?o.onSuccess(r||0):(n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(s){n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,o,n){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==o?void 0:o.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,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,E(s),o).then((function(s){var o=s.code;s.data,o===t.ErrorCode.SUCCESS?n.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(o,",tagId:").concat(e)),n.onError(o))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.callExtra=function(e,s){for(var o,n=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(o=this._context).callExtra.apply(o,function(e,t,s){if(s||2===arguments.length)for(var o,n=0,a=t.length;n<a;n++)!o&&n in t||(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}([e],function(e,t){var s="function"==typeof Symbol&&e[Symbol.iterator];if(!s)return e;var o,n,a=s.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=a.next()).done;)r.push(o.value)}catch(e){n={error:e}}finally{try{o&&!o.done&&(s=a.return)&&s.call(a)}finally{if(n)throw n.error}}return r}(a),!1)).then((function(o){var a=o.code,r=o.data;if(a!==t.ErrorCode.SUCCESS)n.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&I(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?C(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return C(e)}));return void p(s.onSuccess,d,g)}s.onSuccess&&p(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(){p(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var o=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){o._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var o=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(){o._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?p(s.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),I(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var o=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(){o._context.getUserStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),I(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var o=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(){o._context.addToBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(n,",useerId:").concat(e)),I(s.onError,n))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var o=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(){o._context.removeFromBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?p(s.onSuccess):(o.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(n,",useerId:").concat(e)),I(s.onError,n))}))}),"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(o){var n=o.code,a=o.data;n===t.ErrorCode.SUCCESS?p(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(n)),I(e.onError,n))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var o=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(){o._context.getBlacklistStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),I(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,o,n,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",o.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",o.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",o.objectName,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(o.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,o,n,a)}),"insertMessage",n)},e.prototype.batchInsertMessage=function(e,s,o){var n,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",o,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===(n=e[c])||void 0===n?void 0:n.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,o)}),"batchInsertMessage",o)},e.prototype.getMessageCount=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.getMessageCount(e,s,o)}),"getMessageCount",o)},e.prototype.getRemoteHistoryMessages=function(e,s,o,n,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",o,t.AssertRules.NUMBER,!0),t.assert("count",n,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,o,n,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,o,n){var a=this;t.assert("messageIds",o,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(o)),this.assertCPPMode((function(){a._context.deleteMessages(o).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(o)),I(n.onError,e))}))}),"deleteLocalMessages",n)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,o,n,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",n,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,o,n,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.clearMessages(e,s,o)}),"clearMessages",o)},e.prototype.getMessage=function(e,s){var o=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._context.getLocalMessage(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?p(s.onSuccess,C(r)):(o.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),I(s.onError,a))}))}),"getMessage",s)},e.prototype.setMessageSentStatus=function(e,s,o){var n=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(){n._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?p(o.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),I(o.onError,s))}))}),"setMessageSentStatus",o)},e.prototype.setMessageReceivedStatus=function(e,s,o){var n=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(){n._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?p(o.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),I(o.onError,s))}))}),"setMessageReceivedStatus",o)},e.prototype.setMessageContent=function(e,s,o,n){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",o,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:o})),a._context.setMessageContent(e,s,o).then((function(e){e===t.ErrorCode.SUCCESS?p(n.onSuccess,!0):I(n.onError,e)}))}),"setMessageContent",n)},e.prototype.setMessageSearchField=function(e,s,o){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(o)),this.assertCPPMode((function(){n._context.setMessageSearchField(e,s,o)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,o,n){var a=this;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.searchConversationByContent(e,s,o,n)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,o,n){var a=this;void 0===o&&(o=[]),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.searchConversationByContentWithAllChannel(e,s,o,n)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,o,n,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",o,t.AssertRules.STRING,!0),t.assert("timestamp",n,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,o,n,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,o,n,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",o,t.AssertRules.STRING,!0),t.assert("timestamp",n,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,o,n,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,o,n,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",o,t.AssertRules.STRING,!0),t.assert("startTime",n,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,o,n,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,o,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,o,n)}),"clearUnreadCountByTimestamp",n)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,o){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){n._defaultChannelClient.getConversationNotificationStatus(e,s,o)}),"getConversationNotificationStatus",o)},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}(),y=1;t.VersionManage.add("imlib-v2-adapter","5.16.0");var A,L,O=null,N={init:function(e,s,o){var n;void 0===o&&(o={}),t.assert("appkey",e,t.AssertRules.STRING,!0),A=new t.AppStorage("API-V2"),S=t.APIContext.init({appkey:e,navigators:o.navi?[o.navi]:[],miniCMPProxy:[],logOutputLevel:o.logOutputLevel,typingExpireTime:o.typingExpireTime,httpInMainProcess:!!o.httpInMainProcess,logExpireTime:o.logExpireTime,environment:null!==(n=o.environment)&&void 0!==n?n:"default"}),O=S.logger,y=Math.min(15,Math.max(o.readReceiptTimeout||1,1)),T=new M(S,{readReceiptTimeout:y},O,A),t.logger.init(O)},getInstance:function(){return T},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){S.assignWatcher({connection:function(s,o){try{e.onChanged(s,o)}catch(e){null==O||O.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){S.assignWatcher({message:function(s,o,n){try{var a=C(s),r=S.getCurrentUserId(),c=S.getConnectedTime();h(a,r,c,y,A),a=function(e,t,s,o,n){var a=new Date(s-1e3*o*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=[],l=0;l<c.length;l++)i="".concat(t).concat(c[l],"SENT"),(g=n.get(i))&&!(e.senderUserId in g.userIds)&&(d.push(c[l]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[l]]=g.count,n.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(a,r,c,y,A),t.usingCppEngine()||g.set(s),e.onReceived(a,void 0,n)}catch(e){null==O||O.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){S.assignWatcher({conversationState:function(s){try{var o=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,n=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&o.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:n,channelId:a||"",updatedTime:r.time})})),o.length>0&&e.onChanged(o)}catch(e){null==O||O.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){S.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){S.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){S.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==O||O.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){S.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==O||O.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){S.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==O||O.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){S.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){S.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){S.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==O||O.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){S.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==O||O.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,o){return r(this,void 0,void 0,(function(){var n,a,r;return c(this,(function(c){switch(c.label){case 0:return n=null==O?void 0:O.createTraceId(),null==O||O.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),n),[4,S.connect(e,!!o,n)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==O||O[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),n),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(S.getConnectedTime()-1e3*y*60*60*24).getTime(),A.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=A.get(e).dealtime;t&&i-t>0&&A.remove(e)}else if(/RECEIVED$/.test(e)){var s=A.get(e),o=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!==o&&(0===s.length?A.remove(e):A.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==O||O.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}var i}))}))},reconnect:function(e,s,o){var n=null==O?void 0:O.createTraceId();null==O||O.info(t.LogTagId.A_RECONNECT_T,null,n),S.reconnect(o).then((function(s){var o=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==O||O[o](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),n),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==O||O.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:l,getMessageObjectName:function(e){var t=a(a({},d),l);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,o){this.RegisterMessage[e]=f(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,S.registerMessageType(t,s.isPersited,s.isCounted,o)}},U=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},_=function(e,t){this.isCounted=e,this.isPersited=t},B=f("TextMessage","RC:TxtMsg"),x=f("LocationMessage","RC:LBSMsg"),b=f("TypingStatusMessage","RC:TypSts"),P=f("ImageMessage","RC:ImgMsg"),w=f("RichContentMessage","RC:ImgTextMsg"),k=f("VoiceMessage","RC:VcMsg"),G=f("HQVoiceMessage","RC:HQVCMsg"),D=f("FileMessage","RC:FileMsg"),K=f("SightMessage","RC:SightMsg"),F=f("GIFMessage","RC:GIFMsg"),j=f("ReadReceiptMessage","RC:ReadNtf"),V=f("ReadReceiptRequestMessage","RC:RRReqMsg"),H=f("RCCombineMessage","RC:CombineMsg"),W=function(e,t,s,o,n,a,r,c,i,g,d,l,u,C,h,p,I,R){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=o,this.objectName=n,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=l,this.receivedStatus=u,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=I,this.disableNotification=R};exports.VoIPMediaType=void 0,(L=exports.VoIPMediaType||(exports.VoIPMediaType={}))[L.MEDIA_AUDIO=1]="MEDIA_AUDIO",L[L.MEDIA_VEDIO=2]="MEDIA_VEDIO",L[L.MEDIA_VIDEO=2]="MEDIA_VIDEO";var J,Y=f("AcceptMessage","RC:VCAccept"),q=f("RingingMessage","RC:VCRinging"),Q=f("SummaryMessage","RC:VCSummary"),X=f("HungupMessage","RC:VCHangup"),$=f("InviteMessage","RC:VCInvite"),z=f("MediaModifyMessage","RC:VCModifyMedia"),Z=f("MemberModifyMessage","RC:VCModifyMem"),ee=f("lastMessageSendTime","RC:SRSMsg"),te=f("ReferenceMessage","RC:ReferenceMsg"),se=f("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),oe=f("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(J||(J={}));var ne=J;window&&(window.RongIMClient=N),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),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=Y,exports.BaseMessage=R,exports.ChannelClient=m,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=D,exports.GIFMessage=F,exports.GetChatRoomType=n,exports.HQVoiceMessage=G,exports.HungupMessage=X,exports.IMClient=M,exports.ImageMessage=P,exports.InviteMessage=$,exports.LocationMessage=x,exports.MediaModifyMessage=z,exports.MemberModifyMessage=Z,exports.MentionedInfo=U,exports.MentionedType=ne,exports.Message=W,exports.MessageTag=_,exports.PublicServiceMultiRichContentMessage=oe,exports.PublicServiceRichContentMessage=se,exports.RCCombineMessage=H,exports.ReadReceiptMessage=j,exports.ReadReceiptRequestMessage=V,exports.ReadReceiptResponseMessage=v,exports.ReferenceMessage=te,exports.RichContentMessage=w,exports.RingingMessage=q,exports.RongIMClient=N,exports.SentStatus=o,exports.SightMessage=K,exports.SummaryMessage=Q,exports.SyncReadStatusMessage=ee,exports.TextMessage=B,exports.TypingStatusMessage=b,exports.VoiceMessage=k;
|