@rongcloud/imlib-v2-adapter 5.14.0 → 5.14.1

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.esm.js CHANGED
@@ -12,4 +12,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function m(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function R(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&s[0]?o.return:s[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,s[1])).done)return a;switch(o=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(6===s[0]&&r.label<a[1]){r.label=a[1],a=s;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(s);break}a[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],o=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function M(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var y=function(){function t(){}return t.set=function(n){if(e[n.messageType]&&e[n.messageType].isPersited){var o=t.get(n.conversationType,n.targetId,n.channelId||"");if(!o||o.sentTime<n.sentTime){var a=M(n.conversationType,n.targetId,n.channelId||"");t.map[a]=n}}},t.get=function(e,n,o){var a=M(e,n,o);return t.map[a]||null},t.remove=function(e,n,o){var a=M(e,n,o);delete t.map[a]},t.clear=function(){t.map={}},t.map={},t}(),T={"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"},E={};function N(e){var t=e.channelId,n=e.conversationType,a=e.targetId,s=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!o()){var d=y.get(n,a,t||"");(!r||d&&r.sentTime<d.sentTime)&&(r=d)}var l=r?O(r):null;return{channelId:t||"",conversationType:n,targetId:a,unreadMessageCount:s,latestMessage:l,latestMessageId:null==l?void 0:l.messageId,objectName:null==l?void 0:l.messageType,sentTime:null==l?void 0:l.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==l?void 0:l.receivedStatus,matchCount:g}}function O(e){var n=e.conversationType,o=e.targetId,a=e.senderUserId,s=e.content,r=e.messageType,c=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,u=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,p=e.expansion,f=e.messageId,S=e.sentStatus,v=e.channelId,m=e.readReceiptInfo,R=e.pushConfig,M="";return r in T?M=T[r]:r in E?M=E[r]:(s={message:{content:s,objectName:r},messageName:"UnknownMessage"},M="UnknownMessage"),l||(l=t.UNREAD),void 0===f&&(f=~~(16777215*Math.random())),{channelId:v||"",conversationType:n,targetId:o,senderUserId:a,content:s,messageType:M,messageUId:c,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:l,receivedTime:u,objectName:r,messageId:f,sentStatus:S||I.SENT,disableNotification:C,canIncludeExpansion:h,expansion:p,readReceiptInfo:m,pushConfig:R}}function U(e,t,o,a,s){var r=new Date(o-1e3*a*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===n.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");s.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var d="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),l=s.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,s.set(d,l)));var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return l[e.senderUserId]=u,void s.set(d,l)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},s.set(d,h)}}function _(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function A(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var B=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function L(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new B(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var x,P,b=L("ReadReceiptResponseMessage","RC:RRRspMsg"),w=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),a("conversationTypes",t,s.ARRAY),a("count",n,s.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,s=n.data,i=[];s=s||[],a===r.SUCCESS?(t?s.forEach((function(e){t.indexOf(e.conversationType)>-1&&i.push(N(e))})):s.forEach((function(e){i.push(N(e))})),_(e.onSuccess,i)):(o.logger.warn(c.O,"getConversationList -> code:".concat(a)),A(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;a("callback",n,s.CALLBACK),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),m(o,void 0,void 0,(function(){var o,a,s;return R(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=i.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(this.logger.warn(c.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(s?N(s):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||y.remove(e,t,o.channelId),_(n.onSuccess)):(o.logger.warn(c.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("draftText",n,s.STRING,!0),this.logger.info(c.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?_(e.onSuccess,a):(o.logger.warn(c.O,"getTotalUnreadCount ->code:".concat(n)),A(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?_(n.onSuccess,s):(o.logger.warn(c.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(c.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===r.SUCCESS?_(e.onSuccess,!0):(n.logger.warn(c.O,"clearConversations ->code:".concat(t)),A(e.onError,t))})):this.logger.error(c.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===r.SUCCESS?_(n.onSuccess,!0):(o.logger.warn(c.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),A(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===r.SUCCESS?_(e.onSuccess,!0):(t.logger.warn(c.O,"clearUnreadCount ->code:".concat(n)),A(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===r.SUCCESS?_(n.onSuccess,e.data?O(e.data):null):(o.logger.warn(c.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),A(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",o,s.CALLBACK),a("status",n,s.OBJECT,!0),this.logger.info(c.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var g=n.isTop,d=n.notificationStatus;this._context.setConversationStatus(e,t,g,d,this.channelId).then((function(e){e===r.SUCCESS?_(o.onSuccess):(i.logger.warn(c.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),A(o.onError,e))}))},e.prototype.sendMessage=function(e,o,g,d,l,u,h,C){var p=this;a("conversationType",e,s.NUMBER,!0),a("targetId",o,s.STRING,!0),a("msg",g,s.OBJECT,!0),a("callback",d,s.CALLBACK),a("isMentioned",l,s.BOOLEAN),a("pushContent",u,s.ONLY_STRING),a("pushData",h,s.ONLY_STRING),a("options.userIds",null==C?void 0:C.userIds,s.ARRAY),a("options.isVoipPush",null==C?void 0:C.isVoipPush,s.BOOLEAN),a("options.disableNotification",null==C?void 0:C.disableNotification,s.BOOLEAN),a("options.canIncludeExpansion",null==C?void 0:C.canIncludeExpansion,s.BOOLEAN),a("options.expansion",null==C?void 0:C.expansion,s.OBJECT),a("options.pushConfig",null==C?void 0:C.pushConfig,s.OBJECT),a("options.resendMessageId",null==C?void 0:C.resendMessageId,s.NUMBER),this.logger.info(c.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var f=!(!(null==C?void 0:C.isStatusMessage)&&!(null==C?void 0:C.isStatus)),S=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,l=a.pushConfig,u=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:l,messageId:u}}(C,l,g);u=u||"",h=h||"";var m=Object.assign(g,v(v({isMentioned:l,pushContent:u,pushData:h},S),{messageType:g.objectName,channelId:this.channelId,isStatusMessage:f})),R=this._context.getCurrentUserId(),M=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:m.messageType,conversationType:e,targetId:o,channelId:this.channelId}),M),this._context.sendMessage(e,o,m,d.onBefore,M).then((function(a){var s=a.code,l=a.data,u=s===r.SUCCESS?"info":"warn";if(p.logger[u](c.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:l?l.messageUId:"",messageId:l?l.messageId:""}),M),s===r.SUCCESS){p._isCPPMode||y.set(l);var h=O(l);U(h,R,p._context.getConnectedTime(),p._readReceiptTimeout,p._storage),_(d.onSuccess,h)}else p.logger.warn(c.O,"sendMessage ->code:".concat(s,",targetId:").concat(o)),A(d.onError,s,O({isMentioned:!!m.isMentioned,content:g.content,messageType:g.messageType,isPersited:g.isPersited,isCounted:g.isCounted,disableNotification:!!(null==C?void 0:C.disableNotification),canIncludeExpansion:!!(null==C?void 0:C.canIncludeExpansion),expansion:(null==C?void 0:C.expansion)||null,conversationType:e,targetId:o,senderUserId:R,messageUId:"",messageDirection:n.SEND,isOffLineMessage:!1,sentTime:(null==l?void 0:l.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:t.UNREAD,receivedStatusInfo:i(t.UNREAD),messageId:null==l?void 0:l.messageId,sentStatus:I.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;a("message.conversationType",e.conversationType,s.NUMBER,!0),a("message.targetId",e.targetId,s.STRING,!0),a("message.messageUId",e.messageUId,s.STRING,!0),a("message.sentTime",e.sentTime,s.NUMBER,!0),a("callback",t,s.CALLBACK),a("options.disableNotification",null==n?void 0:n.disableNotification,s.BOOLEAN),a("options.pushConfig",null==n?void 0:n.pushConfig,s.OBJECT),a("options.extra",null==n?void 0:n.extra,s.STRING);var i=e.conversationType,g=e.targetId,d=e.messageUId,l=e.sentTime;this.logger.info(c.O,"sendRecallMessage ->targetId:".concat(g,",conversationType:").concat(i,",messageUId:").concat(d));var u=v({channelId:this.channelId},n);this._context.recallMessage(i,g,d,l,u).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?(o._isCPPMode||y.set(a),_(t.onSuccess,O(a))):(o.logger.warn(c.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(g,",messageUId:").concat(d)),A(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("typingContentType",n,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var g={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},d=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:g.messageType,conversationType:e,targetId:t,channelId:g.channelId}),d),this._context.sendMessage(e,t,g,void 0,d).then((function(e){var n=e.code,a=e.data,s=n===r.SUCCESS?"info":"warn";i.logger[s](c.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:a?a.messageUId:"",messageId:a?a.messageId:""}),d),n===r.SUCCESS?_(o.onSuccess,O(a)):(i.logger.warn(c.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),A(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(c.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var i=[];for(var g in r){var d={};d[g]=r[g].uIds,r[g].isResponse||i.push(d)}if(0===i.length)return void n.onSuccess(null);var l=setInterval((function(){1===i.length&&clearInterval(l);var a=i.splice(0,1)[0],g=new b({receiptMessageDic:a});o.sendMessage(e,t,g,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),_(n.onSuccess,e)},onError:function(e){o.logger.warn(c.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),A(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o,i,g=this;a("messageUIds",e,s.ARRAY,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));try{for(var d=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.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),l=d.next();!l.done;l=d.next()){var u=l.value;a("messageUId",u,s.STRING)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(o){var a=o.code;a===r.SUCCESS?n.onSuccess():(g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a))})).catch((function(o){g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(o,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(o)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;a("messageUId",e,s.STRING,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var s=a.code,i=a.data;s===r.SUCCESS?n.onSuccess(i):(o.logger.warn(c.O,"getMessageReader ->code:".concat(s,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(s))})).catch((function(a){o.logger.warn(c.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;a("expansion",e,s.OBJECT,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion,u=t.expansion;this.logger.info(c.O,"updateMessageExpansion ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,originExpansion:u,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),A(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;a("keys",e,s.ARRAY,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion;this.logger.info(c.O,"removeMessageExpansionForKey ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),A(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,i,g,d){var l=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",i,s.CALLBACK,!0),a("order",d,s.NUMBER),this.logger.info(c.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var u=this.logger.createTraceId();this.logger.info(c.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),u),this._context.getHistoryMessage(e,t,n,o,d,this.channelId,g,u).then((function(e){var t=e.code,n=e.data;if(t===r.SUCCESS)if(n){var o=n.list,a=n.hasMore,s=[],g=o.map((function(e){return s.push(e.messageUId),O(e)}));l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:s.join(",")}),u),_(i.onSuccess,g,a)}else l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),_(i.onSuccess,[],!1);else l.logger.warn(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),A(i.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("messages",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(a){if(a===r.SUCCESS){if(!i._isCPPMode){var s=y.get(e,t,i.channelId);s&&n.forEach((function(n){s.messageUId===n.messageUId&&y.remove(e,t,i.channelId)}))}_(o.onSuccess)}else i.logger.warn(c.O,"deleteRemoteMessages ->code:".concat(a,",targetId:").concat(t)),A(o.onError,a)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;a("param.conversationType",e.conversationType,s.NUMBER,!0),a("param.targetId",e.targetId,s.STRING,!0),a("param.timestamp",e.timestamp,s.NUMBER,!0),a("callback",t,s.CALLBACK);var o=e.conversationType,i=e.targetId,g=e.timestamp;this.logger.info(c.O,"clearRemoteHistoryMessages ->targetId:".concat(i,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,i,g,this.channelId).then((function(e){e===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"clearRemoteHistoryMessages ->code:".concat(e)),A(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){a("callback",e,s.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?_(e.onSuccess,o.map(N)):A(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){a("callback",e,s.CALLBACK),a("index",t,s.NUMBER),a("limit",n,s.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?_(e.onSuccess,o.map(N)):A(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={});var i=n.senderUserId,g=n.objectName,d=n.content,l=n.messageDirection,u=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,p=n.sentTime,f=n.sentStatus;this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var I=a.isUnread,S={senderUserId:i,messageType:g,content:d,messageDirection:l,sentTime:p,sentStatus:f,searchContent:a.searchContent,isUnread:I,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,S).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?_(o.onSuccess,O(a)):(s.logger.warn(c.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),A(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?_(n.onSuccess,o):A(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?_(n.onSuccess,o):A(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;this.logger.info(c.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===r.SUCCESS?_(a.onSuccess,!0):(s.logger.warn(c.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),A(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var g=s.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,g,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===r.SUCCESS)if(o){var s=o.list,g=o.hasMore,d=s.map((function(e){return O(e)}));_(a.onSuccess,d,g)}else _(a.onSuccess,[],!1);else i.logger.warn(c.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),A(a.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(c.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||y.remove(e,t,o.channelId),_(n.onSuccess,!0)):(o.logger.warn(c.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;this.logger.info(c.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(N(e))})),_(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),A(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(c.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(N(e))})),_(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),A(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,i){var g=this;this.logger.info(c.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,a,s,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var s=o=o||{},d=s.messages,l=s.count;d.forEach((function(e){a.push(O(e))})),_(i.onSuccess,a,l)}else g.logger.warn(c.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),A(i.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var g=o=o||{},d=g.messages,l=g.count;d.forEach((function(e){a.push(O(e))})),_(s.onSuccess,a,l)}else i.logger.warn(c.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),A(s.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,i,g){var d=this;this.logger.info(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(s,", limit: ").concat(i)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,i).then((function(e){var n=e.code,o=e.data,a=[];n===r.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(O(e))})),_(g.onSuccess,a)):(d.logger.warn(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),A(g.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(c.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return O(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;this.logger.info(c.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===r.SUCCESS?_(o.onSuccess,!0):(a.logger.warn(c.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),A(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(c.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?_(n.onSuccess,s):(o.logger.warn(c.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(c.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?_(n.onSuccess,s):(o.logger.warn(c.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),A(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(c.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),A(t.onError,a))}))},e}(),k=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},G=function(){function e(e,t,n,a){this._context=e,this._options=t,this.logger=n,this._storage=a,this._channelClient={},this._isCPPMode=o(),this._defaultChannelClient=new w(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(r.NOT_SUPPORT),void this.logger.error(c.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(c.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(c.O,"getChannel method is only available in protocol stack mode"),null;if(a("channelId",e,s.STRING,!0),e.length>20)return this.logger.error(c.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(c.O,"Only 1000 channels can be obtained"),null;var t=new w(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;a("channelIds",e,s.ARRAY,!0),this.logger.info(c.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.14.0"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){switch(t.label){case 0:return this.logger.info(c.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(c.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"joinChatRoom ->chatRoomId:".concat(e));var i=this.logger.createTraceId();this.logger.info(c.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),i),this._context.joinChatroom(e,t,i).then((function(t){var a=t===r.SUCCESS?"info":"warn";o.logger[a](c.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),i),t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(c.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var s=a===r.SUCCESS?"info":"warn";n.logger[s](c.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),A(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var i=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?_(o.onSuccess,{userInfos:(null==a?void 0:a.userInfos)||[],userTotalNums:(null==a?void 0:a.userCount)||0}):(i.logger.warn(c.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),A(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("entry.key",e.key,s.STRING,!0),a("entry.value",e.value,s.STRING,!0)})),a("options.isAutoDelete",e.isAutoDelete,s.BOOLEAN)}(t),a("callback",n,s.CALLBACK),t.entries.length>10)A(n.onError,r.CHATROOM_KV_STORE_OUT_LIMIT);else{var i="id:".concat(e);this.logger.info(c.O,"set chatroom entry->".concat(i)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"set chatroom entry fail ->code+:".concat(t,",").concat(i)),A(n.onError,t,a))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("key",e,s.STRING,!0)}))}(t);var i="id:".concat(e);this.logger.debug(c.O,"remove chatroom entry->".concat(i));var g=v({},t);g.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,g).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(i)),A(n.onError,t,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("key",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,s=t.data;a===r.SUCCESS?_(n.onSuccess,s||""):(o.logger.warn(c.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),A(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),A(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,i){var g=this;void 0===i&&(i=0),a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),a("timestamp",i,s.NUMBER),this.logger.info(c.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,i).then((function(t){var n=t.code,a=t.data;if(n===r.SUCCESS)if(a){var s=a.list,i=a.hasMore,d=s.map((function(e){return O(e)}));_(o.onSuccess,d,i)}else _(o.onSuccess,[],!1);else g.logger.warn(c.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),A(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,r){a("fileType",e,s.NUMBER,!0),a("fileName",n,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(r)),this._context.getFileToken(e,n,o,r).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,r,i){a("fileType",e,s.NUMBER,!0),a("fileName",t,s.STRING,!0),a("saveName",n,s.STRING),a("callback",o,s.CALLBACK),a("serverType",i,s.NUMBER),a("uploadRes",r,s.OBJECT),this.logger.info(c.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,r,i).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagId",e.tagId,(function(e){return e.length<=10})),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("tag.tagName",e.tagName,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;a("tagId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagName",e.tagName,s.STRING,!0),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("callback",t,s.CALLBACK),this.logger.info(c.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;a("callback",e,s.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?e.onSuccess(a||[]):(t.logger.warn(c.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(c.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;a("conversationType",e.type,s.NUMBER),a("targetId",e.targetId,s.STRING),a("channelId",e.channelId,s.ONLY_STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(k(e)).then((function(e){var o=e.code,a=e.data;o===r.SUCCESS?t.onSuccess(a||[]):(n.logger.warn(c.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(c.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return k(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return k(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING),a("tagIds",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("tagId",e,s.STRING,!0)})),this.logger.info(c.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(k(e),t).then((function(e){var a=e.code;e.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).catch((function(e){o.logger.warn(c.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("startTime",n,s.NUMBER,!0),a("callback",o,s.CALLBACK,!0),this.logger.info(c.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,a=t.data,s=[];n===r.SUCCESS?((a=a||[]).forEach((function(e){s.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?O(s):null,d=g||{},l=d.messageType,u=d.sentTime,h=d.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:d.messageId,objectName:l,sentTime:u,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(s)):(i.logger.warn(c.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("containMuted",t,s.BOOLEAN,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,s=t.data;o.logger.info(c.O,JSON.stringify({code:a,data:s})),a===r.SUCCESS?n.onSuccess(s||0):(o.logger.warn(c.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("conversation.targetId",t.targetId,s.STRING,!0),a("conversation.type",t.type,s.NUMBER,!0),a("conversation.channelId",t.channelId,s.ONLY_STRING),a("status.isTop",null==n?void 0:n.isTop,s.BOOLEAN,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,k(t),n).then((function(t){var n=t.code;t.data,n===r.SUCCESS?o.onSuccess():(i.logger.warn(c.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];this.logger.info(c.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,a,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)r.push(o.value)}catch(e){a={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return r}(a),!1)).then((function(n){var a=n.code,s=n.data;if(a!==r.SUCCESS)o.logger.warn(c.O,"callExtra ->code:".concat(a)),t.onError&&A(t.onError,a);else{if("getConversationsByPage"===e&&s.forEach((function(e){e.latestMessage=e.latestMessage?O(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var i=s,g=i.list,d=i.hasMore,l=g.map((function(e){return O(e)}));return void _(t.onSuccess,l,d)}t.onSuccess&&_(t.onSuccess,s)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){a("callback",t,s.CALLBACK),this.logger.info(c.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){_(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(c.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;a("status",e,s.NUMBER),a("callback",t,s.CALLBACK),this.logger.info(c.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===r.SUCCESS?_(t.onSuccess,!0):(n.logger.warn(c.O,"setUserStatus ->code:".concat(e)),A(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),A(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),A(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),A(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;a("callback",e,s.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?_(e.onSuccess,a):(t.logger.warn(c.O,"getBlacklist ->code:".concat(o)),A(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),A(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,r){var i=this;void 0===r&&(r={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("content.senderUserId",n.senderUserId,s.STRING,!0),a("content.messageDirection",n.messageDirection,s.NUMBER,!0),a("content.objectName",n.objectName,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){i._defaultChannelClient.insertMessage(e,t,n,o,r)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,r,c=this;for(var i in a("messages",e,(function(t){return g(t)&&!(e.length<=0||e.length>=500)}),!0),a("checkDuplicate",t,s.BOOLEAN),a("callback",n,s.CALLBACK),e)a("message",e[i],s.OBJECT,!0),a("message.conversationType",e[i].conversationType,(function(e){return[d.PRIVATE,d.DISCUSSION,d.GROUP,d.CUSTOMER_SERVICE,d.SYSTEM,d.APP_PUBLIC_SERVICE,d.PUBLIC_SERVICE].includes(e)}),!0),a("message.targetId",e[i].targetId,s.STRING,!0),a("message.senderUserId",e[i].senderUserId,s.STRING,!0),a("message.messageType",e[i].messageType,s.STRING,!0),a("message.content",e[i].content,s.OBJECT,!0),a("message.messageDirection",e[i].messageDirection,s.NUMBER,!0),a("message.canIncludeExpansion",e[i].canIncludeExpansion,s.BOOLEAN),a("message.expansion",e[i].expansion,s.OBJECT),a("message.disableNotification",e[i].disableNotification,s.BOOLEAN),a("message.sentTime",e[i].sentTime,s.NUMBER),a("message.sentStatus",e[i].sentStatus,s.NUMBER),a("options.isUnread",null===(o=e[i])||void 0===o?void 0:o.isUnread,s.BOOLEAN),a("options.searchContent",null===(r=e[i])||void 0===r?void 0:r.searchContent,s.STRING);this.assertCPPMode((function(){c._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,r,c){var i=this;void 0===c&&(c={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",r,s.CALLBACK),a("options.order",c.order,s.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,r,c)}),"getRemoteHistoryMessages",r)},e.prototype.deleteLocalMessages=function(e,t,n,o){var i=this;a("messageIds",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){i._context.deleteMessages(n).then((function(e){e===r.SUCCESS?_(o.onSuccess,!0):(i.logger.warn(c.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),A(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,r){var c=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("cleanSpace",o,s.BOOLEAN),a("callback",r,s.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,r)}),"deleteLocalMessagesByTimestamp",r)},e.prototype.clearMessages=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;a("callback",t,s.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,O(s)):(n.logger.warn(c.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),A(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("sentStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),A(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("receivedStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),A(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var i=this;a("messageId",e,s.NUMBER,!0),a("objectName",n,s.ONLY_STRING,!0),this.assertCPPMode((function(){i.logger.info(c.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),i._context.setMessageContent(e,t,n).then((function(e){e===r.SUCCESS?_(o.onSuccess,!0):A(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("searchFiles",n,s.STRING,!0),this.logger.info(c.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var r=this;a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",n,s.ARRAY),a("customMessageType",o,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var r=this;void 0===n&&(n=[]),a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",o,s.ARRAY),a("customMessageType",n,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,r,c,i){var g=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("total",c,s.NUMBER),a("callback",i,s.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContent(e,t,n,o,r,c,i)}),"searchMessageByContent",i)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,r,c){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("callback",c,s.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,r,c)}),"searchMessageByContentWithAllChannel",c)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,r,c,i,g){var d=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("startTime",o,s.NUMBER),a("endTime",r,s.NUMBER),a("offset",c,s.NUMBER),a("limit",i,s.NUMBER),a("callback",g,s.CALLBACK),this.assertCPPMode((function(){d._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,r,c,i,g)}),"searchMessageByContentInTimeRangeWithAllChannel",g)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(c.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var r=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),this.assertCPPMode((function(){r._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),D=1;l.add("imlib-v2-adapter","5.14.0");var K,F,V=null,H={init:function(e,t,n){var o;void 0===n&&(n={}),a("appkey",e,s.STRING,!0),K=new u("API-V2"),P=h.init({appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime,environment:null!==(o=n.environment)&&void 0!==o?o:"default"}),(V=P.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),V.info(c.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),D=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),x=new G(P,{readReceiptTimeout:D},V,K),C.init(V)},getInstance:function(){return x},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){P.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==V||V.error(c.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){P.assignWatcher({message:function(t,n,a){try{var s=O(t),r=P.getCurrentUserId(),i=P.getConnectedTime();U(s,r,i,D,K),s=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],l=0;l<c.length;l++)i="".concat(t).concat(c[l],"SENT"),(g=a.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,a.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(s,r,i,D,K),o()||y.set(t),e.onReceived(s,void 0,a)}catch(e){null==V||V.error(c.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){P.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==V||V.error(c.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){P.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==V||V.error(c.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){P.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==V||V.error(c.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){P.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==V||V.error(c.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){P.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==V||V.error(c.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){P.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==V||V.error(c.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){P.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){P.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){P.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==V||V.error(c.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){P.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==V||V.error(c.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return m(this,void 0,void 0,(function(){var o,a,s;return R(this,(function(i){switch(i.label){case 0:return o=null==V?void 0:V.createTraceId(),null==V||V.info(c.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,P.connect(e,!!n,o)];case 1:return a=i.sent(),s=a.code===r.SUCCESS?"info":"warn",null==V||V[s](c.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===r.SUCCESS?(t.onSuccess(a.userId),g=new Date(P.getConnectedTime()-1e3*D*60*60*24).getTime(),K.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=K.get(e).dealtime;t&&g-t>0&&K.remove(e)}else if(/RECEIVED$/.test(e)){var n=K.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&g-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?K.remove(e):K.set(e,n))}}))):a.code===r.RC_CONN_TOKEN_INCORRECT?(null==V||V.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==V||V.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var g}))}))},reconnect:function(e,t,n){var o=null==V?void 0:V.createTraceId();null==V||V.info(c.A_RECONNECT_T,null,o),P.reconnect(n).then((function(t){var n=t.code===r.SUCCESS?"info":"warn";null==V||V[n](c.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===r.SUCCESS?e.onSuccess(t.userId):(null==V||V.warn(c.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:E,getMessageObjectName:function(e){var t=v(v({},T),E);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=L(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,P.registerMessageType(t,n.isPersited,n.isCounted,o)}},W=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},J=function(e,t){this.isCounted=e,this.isPersited=t},j=L("TextMessage","RC:TxtMsg"),Y=L("LocationMessage","RC:LBSMsg"),q=L("TypingStatusMessage","RC:TypSts"),Q=L("ImageMessage","RC:ImgMsg"),X=L("RichContentMessage","RC:ImgTextMsg"),$=L("VoiceMessage","RC:VcMsg"),z=L("HQVoiceMessage","RC:HQVCMsg"),Z=L("FileMessage","RC:FileMsg"),ee=L("SightMessage","RC:SightMsg"),te=L("GIFMessage","RC:GIFMsg"),ne=L("ReadReceiptMessage","RC:ReadNtf"),oe=L("ReadReceiptRequestMessage","RC:RRReqMsg"),ae=L("RCCombineMessage","RC:CombineMsg"),se=function(e,t,n,o,a,s,r,c,i,g,d,l,u,h,C,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=l,this.receivedStatus=u,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(F||(F={}));var re,ce=L("AcceptMessage","RC:VCAccept"),ie=L("RingingMessage","RC:VCRinging"),ge=L("SummaryMessage","RC:VCSummary"),de=L("HungupMessage","RC:VCHangup"),le=L("InviteMessage","RC:VCInvite"),ue=L("MediaModifyMessage","RC:VCModifyMedia"),he=L("MemberModifyMessage","RC:VCModifyMem"),Ce=L("lastMessageSendTime","RC:SRSMsg"),pe=L("ReferenceMessage","RC:ReferenceMsg"),fe=L("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ie=L("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(re||(re={}));var Se=re,ve={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=H);export{ce as AcceptMessage,B as BaseMessage,w as ChannelClient,ve as ConnectionState,Z as FileMessage,te as GIFMessage,S as GetChatRoomType,z as HQVoiceMessage,de as HungupMessage,G as IMClient,Q as ImageMessage,le as InviteMessage,Y as LocationMessage,ue as MediaModifyMessage,he as MemberModifyMessage,W as MentionedInfo,Se as MentionedType,se as Message,J as MessageTag,Ie as PublicServiceMultiRichContentMessage,fe as PublicServiceRichContentMessage,ae as RCCombineMessage,ne as ReadReceiptMessage,oe as ReadReceiptRequestMessage,b as ReadReceiptResponseMessage,pe as ReferenceMessage,X as RichContentMessage,ie as RingingMessage,H as RongIMClient,I as SentStatus,ee as SightMessage,ge as SummaryMessage,Ce as SyncReadStatusMessage,j as TextMessage,q as TypingStatusMessage,F as VoIPMediaType,$ as VoiceMessage};
15
+ ***************************************************************************** */function m(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function R(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,o&&(a=2&s[0]?o.return:s[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,s[1])).done)return a;switch(o=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return r.label++,{value:s[1],done:!1};case 5:r.label++,o=s[1],s=[0];continue;case 7:s=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){r=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(6===s[0]&&r.label<a[1]){r.label=a[1],a=s;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(s);break}a[2]&&r.ops.pop(),r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e],o=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function M(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var y=function(){function t(){}return t.set=function(n){if(e[n.messageType]&&e[n.messageType].isPersited){var o=t.get(n.conversationType,n.targetId,n.channelId||"");if(!o||o.sentTime<n.sentTime){var a=M(n.conversationType,n.targetId,n.channelId||"");t.map[a]=n}}},t.get=function(e,n,o){var a=M(e,n,o);return t.map[a]||null},t.remove=function(e,n,o){var a=M(e,n,o);delete t.map[a]},t.clear=function(){t.map={}},t.map={},t}(),T={"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"},E={};function N(e){var t=e.channelId,n=e.conversationType,a=e.targetId,s=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!o()){var d=y.get(n,a,t||"");(!r||d&&r.sentTime<d.sentTime)&&(r=d)}var l=r?O(r):null;return{channelId:t||"",conversationType:n,targetId:a,unreadMessageCount:s,latestMessage:l,latestMessageId:null==l?void 0:l.messageId,objectName:null==l?void 0:l.messageType,sentTime:null==l?void 0:l.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==l?void 0:l.receivedStatus,matchCount:g}}function O(e){var n=e.conversationType,o=e.targetId,a=e.senderUserId,s=e.content,r=e.messageType,c=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,u=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,p=e.expansion,f=e.messageId,S=e.sentStatus,v=e.channelId,m=e.readReceiptInfo,R=e.pushConfig,M="";return r in T?M=T[r]:r in E?M=E[r]:(s={message:{content:s,objectName:r},messageName:"UnknownMessage"},M="UnknownMessage"),l||(l=t.UNREAD),void 0===f&&(f=~~(16777215*Math.random())),{channelId:v||"",conversationType:n,targetId:o,senderUserId:a,content:s,messageType:M,messageUId:c,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:l,receivedTime:u,objectName:r,messageId:f,sentStatus:S||I.SENT,disableNotification:C,canIncludeExpansion:h,expansion:p,readReceiptInfo:m,pushConfig:R}}function U(e,t,o,a,s){var r=new Date(o-1e3*a*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===n.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");s.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var d="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),l=s.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,s.set(d,l)));var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return l[e.senderUserId]=u,void s.set(d,l)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},s.set(d,h)}}function _(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function A(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var B=function(e,t,n,o,a){void 0===o&&(o=!0),void 0===a&&(a=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=a};function L(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new B(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var x,P,b=L("ReadReceiptResponseMessage","RC:RRRspMsg"),w=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),a("conversationTypes",t,s.ARRAY),a("count",n,s.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,s=n.data,i=[];s=s||[],a===r.SUCCESS?(t?s.forEach((function(e){t.indexOf(e.conversationType)>-1&&i.push(N(e))})):s.forEach((function(e){i.push(N(e))})),_(e.onSuccess,i)):(o.logger.warn(c.O,"getConversationList -> code:".concat(a)),A(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;a("callback",n,s.CALLBACK),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),m(o,void 0,void 0,(function(){var o,a,s;return R(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=i.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(this.logger.warn(c.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(s?N(s):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||y.remove(e,t,o.channelId),_(n.onSuccess)):(o.logger.warn(c.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("draftText",n,s.STRING,!0),this.logger.info(c.O,"saveTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,t){a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"clearTextMessageDraft ->targetId:".concat(t,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(t,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?_(e.onSuccess,a):(o.logger.warn(c.O,"getTotalUnreadCount ->code:".concat(n)),A(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?_(n.onSuccess,s):(o.logger.warn(c.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(c.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===r.SUCCESS?_(e.onSuccess,!0):(n.logger.warn(c.O,"clearConversations ->code:".concat(t)),A(e.onError,t))})):this.logger.error(c.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===r.SUCCESS?_(n.onSuccess,!0):(o.logger.warn(c.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),A(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;a("callback",e,s.CALLBACK),this.logger.info(c.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===r.SUCCESS?_(e.onSuccess,!0):(t.logger.warn(c.O,"clearUnreadCount ->code:".concat(n)),A(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===r.SUCCESS?_(n.onSuccess,e.data?O(e.data):null):(o.logger.warn(c.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),A(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",o,s.CALLBACK),a("status",n,s.OBJECT,!0),this.logger.info(c.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var g=n.isTop,d=n.notificationStatus;this._context.setConversationStatus(e,t,g,d,this.channelId).then((function(e){e===r.SUCCESS?_(o.onSuccess):(i.logger.warn(c.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),A(o.onError,e))}))},e.prototype.sendMessage=function(e,o,g,d,l,u,h,C){var p=this;a("conversationType",e,s.NUMBER,!0),a("targetId",o,s.STRING,!0),a("msg",g,s.OBJECT,!0),a("callback",d,s.CALLBACK),a("isMentioned",l,s.BOOLEAN),a("pushContent",u,s.ONLY_STRING),a("pushData",h,s.ONLY_STRING),a("options.userIds",null==C?void 0:C.userIds,s.ARRAY),a("options.isVoipPush",null==C?void 0:C.isVoipPush,s.BOOLEAN),a("options.disableNotification",null==C?void 0:C.disableNotification,s.BOOLEAN),a("options.canIncludeExpansion",null==C?void 0:C.canIncludeExpansion,s.BOOLEAN),a("options.expansion",null==C?void 0:C.expansion,s.OBJECT),a("options.pushConfig",null==C?void 0:C.pushConfig,s.OBJECT),a("options.resendMessageId",null==C?void 0:C.resendMessageId,s.NUMBER),this.logger.info(c.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var f=!(!(null==C?void 0:C.isStatusMessage)&&!(null==C?void 0:C.isStatus)),S=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,l=a.pushConfig,u=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:l,messageId:u}}(C,l,g);u=u||"",h=h||"";var m=Object.assign(g,v(v({isMentioned:l,pushContent:u,pushData:h},S),{messageType:g.objectName,channelId:this.channelId,isStatusMessage:f})),R=this._context.getCurrentUserId(),M=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:m.messageType,conversationType:e,targetId:o,channelId:this.channelId}),M),this._context.sendMessage(e,o,m,d.onBefore,M).then((function(a){var s=a.code,l=a.data,u=s===r.SUCCESS?"info":"warn";if(p.logger[u](c.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:l?l.messageUId:"",messageId:l?l.messageId:""}),M),s===r.SUCCESS){p._isCPPMode||y.set(l);var h=O(l);U(h,R,p._context.getConnectedTime(),p._readReceiptTimeout,p._storage),_(d.onSuccess,h)}else p.logger.warn(c.O,"sendMessage ->code:".concat(s,",targetId:").concat(o)),A(d.onError,s,O({isMentioned:!!m.isMentioned,content:g.content,messageType:g.messageType,isPersited:g.isPersited,isCounted:g.isCounted,disableNotification:!!(null==C?void 0:C.disableNotification),canIncludeExpansion:!!(null==C?void 0:C.canIncludeExpansion),expansion:(null==C?void 0:C.expansion)||null,conversationType:e,targetId:o,senderUserId:R,messageUId:"",messageDirection:n.SEND,isOffLineMessage:!1,sentTime:(null==l?void 0:l.sentTime)||0,receivedTime:0,isStatusMessage:f,receivedStatus:t.UNREAD,receivedStatusInfo:i(t.UNREAD),messageId:null==l?void 0:l.messageId,sentStatus:I.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;a("message.conversationType",e.conversationType,s.NUMBER,!0),a("message.targetId",e.targetId,s.STRING,!0),a("message.messageUId",e.messageUId,s.STRING,!0),a("message.sentTime",e.sentTime,s.NUMBER,!0),a("callback",t,s.CALLBACK),a("options.disableNotification",null==n?void 0:n.disableNotification,s.BOOLEAN),a("options.pushConfig",null==n?void 0:n.pushConfig,s.OBJECT),a("options.extra",null==n?void 0:n.extra,s.STRING);var i=e.conversationType,g=e.targetId,d=e.messageUId,l=e.sentTime;this.logger.info(c.O,"sendRecallMessage ->targetId:".concat(g,",conversationType:").concat(i,",messageUId:").concat(d));var u=v({channelId:this.channelId},n);this._context.recallMessage(i,g,d,l,u).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?(o._isCPPMode||y.set(a),_(t.onSuccess,O(a))):(o.logger.warn(c.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(g,",messageUId:").concat(d)),A(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("typingContentType",n,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var g={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},d=this.logger.createTraceId();this.logger.info(c.A_SEND_MSG_T,JSON.stringify({messageType:g.messageType,conversationType:e,targetId:t,channelId:g.channelId}),d),this._context.sendMessage(e,t,g,void 0,d).then((function(e){var n=e.code,a=e.data,s=n===r.SUCCESS?"info":"warn";i.logger[s](c.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:a?a.messageUId:"",messageId:a?a.messageId:""}),d),n===r.SUCCESS?_(o.onSuccess,O(a)):(i.logger.warn(c.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),A(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(c.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var i=[];for(var g in r){var d={};d[g]=r[g].uIds,r[g].isResponse||i.push(d)}if(0===i.length)return void n.onSuccess(null);var l=setInterval((function(){1===i.length&&clearInterval(l);var a=i.splice(0,1)[0],g=new b({receiptMessageDic:a});o.sendMessage(e,t,g,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),_(n.onSuccess,e)},onError:function(e){o.logger.warn(c.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),A(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o,i,g=this;a("messageUIds",e,s.ARRAY,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));try{for(var d=function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.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),l=d.next();!l.done;l=d.next()){var u=l.value;a("messageUId",u,s.STRING)}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(o){var a=o.code;a===r.SUCCESS?n.onSuccess():(g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a))})).catch((function(o){g.logger.warn(c.O,"sendReadReceiptMessage ->code:".concat(o,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(o)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;a("messageUId",e,s.STRING,!0),a("targetId",t,s.STRING,!0),this.logger.info(c.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var s=a.code,i=a.data;s===r.SUCCESS?n.onSuccess(i):(o.logger.warn(c.O,"getMessageReader ->code:".concat(s,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(s))})).catch((function(a){o.logger.warn(c.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;a("expansion",e,s.OBJECT,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion,u=t.expansion;this.logger.info(c.O,"updateMessageExpansion ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,originExpansion:u,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),A(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;a("keys",e,s.ARRAY,!0),a("message",t,s.OBJECT,!0);var i=t.conversationType,g=t.targetId,d=t.messageUId,l=t.canIncludeExpansion;this.logger.info(c.O,"removeMessageExpansionForKey ->targetId:".concat(g,",messageUId:").concat(d,",conversationType:").concat(i)),this._context.sendExpansionMessage({conversationType:i,targetId:g,messageUId:d,canIncludeExpansion:l,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(g,",messageUId:").concat(d)),A(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,i,g,d){var l=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",i,s.CALLBACK,!0),a("order",d,s.NUMBER),this.logger.info(c.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var u=this.logger.createTraceId();this.logger.info(c.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),u),this._context.getHistoryMessage(e,t,n,o,d,this.channelId,g,u).then((function(e){var t=e.code,n=e.data;if(t===r.SUCCESS)if(n){var o=n.list,a=n.hasMore,s=[],g=o.map((function(e){return s.push(e.messageUId),O(e)}));l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:s.join(",")}),u),_(i.onSuccess,g,a)}else l.logger.info(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),_(i.onSuccess,[],!1);else l.logger.warn(c.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),u),A(i.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("messages",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(a){if(a===r.SUCCESS){if(!i._isCPPMode){var s=y.get(e,t,i.channelId);s&&n.forEach((function(n){s.messageUId===n.messageUId&&y.remove(e,t,i.channelId)}))}_(o.onSuccess)}else i.logger.warn(c.O,"deleteRemoteMessages ->code:".concat(a,",targetId:").concat(t)),A(o.onError,a)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;a("param.conversationType",e.conversationType,s.NUMBER,!0),a("param.targetId",e.targetId,s.STRING,!0),a("param.timestamp",e.timestamp,s.NUMBER,!0),a("callback",t,s.CALLBACK);var o=e.conversationType,i=e.targetId,g=e.timestamp;this.logger.info(c.O,"clearRemoteHistoryMessages ->targetId:".concat(i,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,i,g,this.channelId).then((function(e){e===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"clearRemoteHistoryMessages ->code:".concat(e)),A(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){a("callback",e,s.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?_(e.onSuccess,o.map(N)):A(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){a("callback",e,s.CALLBACK),a("index",t,s.NUMBER),a("limit",n,s.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===r.SUCCESS?_(e.onSuccess,o.map(N)):A(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={});var i=n.senderUserId,g=n.objectName,d=n.content,l=n.messageDirection,u=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,p=n.sentTime,f=n.sentStatus;this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var I=a.isUnread,S={senderUserId:i,messageType:g,content:d,messageDirection:l,sentTime:p,sentStatus:f,searchContent:a.searchContent,isUnread:I,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,S).then((function(e){var n=e.code,a=e.data;n===r.SUCCESS?_(o.onSuccess,O(a)):(s.logger.warn(c.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),A(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?_(n.onSuccess,o):A(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===r.SUCCESS?_(n.onSuccess,o):A(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;this.logger.info(c.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===r.SUCCESS?_(a.onSuccess,!0):(s.logger.warn(c.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),A(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var g=s.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,g,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===r.SUCCESS)if(o){var s=o.list,g=o.hasMore,d=s.map((function(e){return O(e)}));_(a.onSuccess,d,g)}else _(a.onSuccess,[],!1);else i.logger.warn(c.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),A(a.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(c.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(a){a===r.SUCCESS?(o._isCPPMode||y.remove(e,t,o.channelId),_(n.onSuccess,!0)):(o.logger.warn(c.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;this.logger.info(c.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(N(e))})),_(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),A(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(c.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,s=n.data,i=[];s=s||[],o===r.SUCCESS?(s.forEach((function(e){i.push(N(e))})),_(t.onSuccess,i)):(a.logger.warn(c.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),A(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,i){var g=this;this.logger.info(c.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,a,s,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var s=o=o||{},d=s.messages,l=s.count;d.forEach((function(e){a.push(O(e))})),_(i.onSuccess,a,l)}else g.logger.warn(c.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),A(i.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var i=this;this.logger.info(c.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===r.SUCCESS){var g=o=o||{},d=g.messages,l=g.count;d.forEach((function(e){a.push(O(e))})),_(s.onSuccess,a,l)}else i.logger.warn(c.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),A(s.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,i,g){var d=this;this.logger.info(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(s,", limit: ").concat(i)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,i).then((function(e){var n=e.code,o=e.data,a=[];n===r.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(O(e))})),_(g.onSuccess,a)):(d.logger.warn(c.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),A(g.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(c.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return O(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;this.logger.info(c.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===r.SUCCESS?_(o.onSuccess,!0):(a.logger.warn(c.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),A(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(c.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?_(n.onSuccess,s):(o.logger.warn(c.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),A(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(c.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var a=e.code,s=e.data;a===r.SUCCESS?_(n.onSuccess,s):(o.logger.warn(c.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),A(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(c.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),A(t.onError,a))}))},e}(),k=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},G=function(){function e(e,t,n,a){this._context=e,this._options=t,this.logger=n,this._storage=a,this._channelClient={},this._isCPPMode=o(),this._defaultChannelClient=new w(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(r.NOT_SUPPORT),void this.logger.error(c.O,"'".concat(t,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(c.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(c.O,"getChannel method is only available in protocol stack mode"),null;if(a("channelId",e,s.STRING,!0),e.length>20)return this.logger.error(c.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(c.O,"Only 1000 channels can be obtained"),null;var t=new w(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;a("channelIds",e,s.ARRAY,!0),this.logger.info(c.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.14.1"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return m(this,void 0,void 0,(function(){return R(this,(function(t){switch(t.label){case 0:return this.logger.info(c.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(c.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,n){this._defaultChannelClient.clearUnreadCount(e,t,n)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,n,o){return this._defaultChannelClient.setConversationStatus(e,t,n,o)},e.prototype.sendMessage=function(e,t,n,o,a,s,r,c,i){return this._defaultChannelClient.sendMessage(e,t,n,o,a,s,r,i)},e.prototype.sendRecallMessage=function(e,t,n){return this._defaultChannelClient.sendRecallMessage(e,t,n)},e.prototype.sendTypingStatusMessage=function(e,t,n,o){return this._defaultChannelClient.sendTypingStatusMessage(e,t,n,o)},e.prototype.sendReceiptResponse=function(e,t,n){return this._defaultChannelClient.sendReceiptResponse(e,t,n)},e.prototype.sendReadReceiptMessage=function(e,t,n){return this._defaultChannelClient.sendReadReceiptMessage(e,t,n)},e.prototype.getMessageReader=function(e,t,n){this._defaultChannelClient.getMessageReader(e,t,n)},e.prototype.updateMessageExpansion=function(e,t,n){this._defaultChannelClient.updateMessageExpansion(e,t,n)},e.prototype.removeMessageExpansionForKey=function(e,t,n){this._defaultChannelClient.removeMessageExpansionForKey(e,t,n)},e.prototype.getHistoryMessages=function(e,t,n,o,a,s,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,a,s,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"joinChatRoom ->chatRoomId:".concat(e));var i=this.logger.createTraceId();this.logger.info(c.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),i),this._context.joinChatroom(e,t,i).then((function(t){var a=t===r.SUCCESS?"info":"warn";o.logger[a](c.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),i),t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(c.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var s=a===r.SUCCESS?"info":"warn";n.logger[s](c.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),A(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var i=this;a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,a=t.data;n===r.SUCCESS?_(o.onSuccess,{userInfos:(null==a?void 0:a.userInfos)||[],userTotalNums:(null==a?void 0:a.userCount)||0}):(i.logger.warn(c.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),A(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("entry.key",e.key,s.STRING,!0),a("entry.value",e.value,s.STRING,!0)})),a("options.isAutoDelete",e.isAutoDelete,s.BOOLEAN)}(t),a("callback",n,s.CALLBACK),t.entries.length>10)A(n.onError,r.CHATROOM_KV_STORE_OUT_LIMIT);else{var i="id:".concat(e);this.logger.info(c.O,"set chatroom entry->".concat(i)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"set chatroom entry fail ->code+:".concat(t,",").concat(i)),A(n.onError,t,a))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),function(e){e.entries.forEach((function(e){a("key",e,s.STRING,!0)}))}(t);var i="id:".concat(e);this.logger.debug(c.O,"remove chatroom entry->".concat(i));var g=v({},t);g.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,g).then((function(e){var t=e.code,a=e.data;t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(i)),A(n.onError,t,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("chatroomEntry",t,s.OBJECT,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess):(o.logger.warn(c.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),A(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;a("chatRoomId",e,s.STRING,!0),a("key",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,s=t.data;a===r.SUCCESS?_(n.onSuccess,s||""):(o.logger.warn(c.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),A(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;a("chatRoomId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),A(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,i){var g=this;void 0===i&&(i=0),a("chatRoomId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("order",n,s.NUMBER,!0),a("callback",o,s.CALLBACK),a("timestamp",i,s.NUMBER),this.logger.info(c.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,i).then((function(t){var n=t.code,a=t.data;if(n===r.SUCCESS)if(a){var s=a.list,i=a.hasMore,d=s.map((function(e){return O(e)}));_(o.onSuccess,d,i)}else _(o.onSuccess,[],!1);else g.logger.warn(c.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),A(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,r){a("fileType",e,s.NUMBER,!0),a("fileName",n,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(r)),this._context.getFileToken(e,n,o,r).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,r,i){a("fileType",e,s.NUMBER,!0),a("fileName",t,s.STRING,!0),a("saveName",n,s.STRING),a("callback",o,s.CALLBACK),a("serverType",i,s.NUMBER),a("uploadRes",r,s.OBJECT),this.logger.info(c.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,r,i).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagId",e.tagId,(function(e){return e.length<=10})),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("tag.tagName",e.tagName,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;a("tagId",e,s.STRING,!0),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;a("tag.tagId",e.tagId,s.STRING,!0),a("tag.tagName",e.tagName,s.STRING,!0),a("tag.tagName",e.tagName,(function(e){return e.length<=15})),a("callback",t,s.CALLBACK),this.logger.info(c.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===r.SUCCESS?t.onSuccess():(n.logger.warn(c.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).catch((function(o){n.logger.warn(c.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;a("callback",e,s.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?e.onSuccess(a||[]):(t.logger.warn(c.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(c.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;a("conversationType",e.type,s.NUMBER),a("targetId",e.targetId,s.STRING),a("channelId",e.channelId,s.ONLY_STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(k(e)).then((function(e){var o=e.code,a=e.data;o===r.SUCCESS?t.onSuccess(a||[]):(n.logger.warn(c.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(c.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return k(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("conversations",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING)})),this.logger.info(c.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return k(e)}))).then((function(t){var a=t.code;t.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;a("conversation.type",e.type,s.NUMBER,!0),a("conversation.targetId",e.targetId,s.STRING,!0),a("conversation.channelId",e.channelId,s.ONLY_STRING),a("tagIds",t,s.ARRAY,!0),a("callback",n,s.CALLBACK),t.forEach((function(e){a("tagId",e,s.STRING,!0)})),this.logger.info(c.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(k(e),t).then((function(e){var a=e.code;e.data,a===r.SUCCESS?n.onSuccess():(o.logger.warn(c.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).catch((function(e){o.logger.warn(c.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("count",t,s.NUMBER,!0),a("startTime",n,s.NUMBER,!0),a("callback",o,s.CALLBACK,!0),this.logger.info(c.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,a=t.data,s=[];n===r.SUCCESS?((a=a||[]).forEach((function(e){s.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?O(s):null,d=g||{},l=d.messageType,u=d.sentTime,h=d.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:d.messageId,objectName:l,sentTime:u,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(s)):(i.logger.warn(c.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;a("tagId",e,s.STRING,!0),a("containMuted",t,s.BOOLEAN,!0),a("callback",n,s.CALLBACK),this.logger.info(c.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,s=t.data;o.logger.info(c.O,JSON.stringify({code:a,data:s})),a===r.SUCCESS?n.onSuccess(s||0):(o.logger.warn(c.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(t){o.logger.warn(c.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var i=this;a("tagId",e,s.STRING,!0),a("conversation.targetId",t.targetId,s.STRING,!0),a("conversation.type",t.type,s.NUMBER,!0),a("conversation.channelId",t.channelId,s.ONLY_STRING),a("status.isTop",null==n?void 0:n.isTop,s.BOOLEAN,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,k(t),n).then((function(t){var n=t.code;t.data,n===r.SUCCESS?o.onSuccess():(i.logger.warn(c.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){i.logger.warn(c.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,a=[],s=2;s<arguments.length;s++)a[s-2]=arguments[s];this.logger.info(c.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,a,s=n.call(e),r=[];try{for(;(void 0===t||t-- >0)&&!(o=s.next()).done;)r.push(o.value)}catch(e){a={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(a)throw a.error}}return r}(a),!1)).then((function(n){var a=n.code,s=n.data;if(a!==r.SUCCESS)o.logger.warn(c.O,"callExtra ->code:".concat(a)),t.onError&&A(t.onError,a);else{if("getConversationsByPage"===e&&s.forEach((function(e){e.latestMessage=e.latestMessage?O(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var i=s,g=i.list,d=i.hasMore,l=g.map((function(e){return O(e)}));return void _(t.onSuccess,l,d)}t.onSuccess&&_(t.onSuccess,s)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){a("callback",t,s.CALLBACK),this.logger.info(c.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){_(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(c.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;a("status",e,s.NUMBER),a("callback",t,s.CALLBACK),this.logger.info(c.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===r.SUCCESS?_(t.onSuccess,!0):(n.logger.warn(c.O,"setUserStatus ->code:".concat(e)),A(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),A(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),A(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===r.SUCCESS?_(t.onSuccess):(n.logger.warn(c.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),A(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;a("callback",e,s.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===r.SUCCESS?_(e.onSuccess,a):(t.logger.warn(c.O,"getBlacklist ->code:".concat(o)),A(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;a("userId",e,s.STRING),a("callback",t,s.CALLBACK),this.logger.info(c.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,s):(n.logger.warn(c.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),A(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,r){var i=this;void 0===r&&(r={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("content.senderUserId",n.senderUserId,s.STRING,!0),a("content.messageDirection",n.messageDirection,s.NUMBER,!0),a("content.objectName",n.objectName,s.STRING,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){i._defaultChannelClient.insertMessage(e,t,n,o,r)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,r,c=this;for(var i in a("messages",e,(function(t){return g(t)&&!(e.length<=0||e.length>=500)}),!0),a("checkDuplicate",t,s.BOOLEAN),a("callback",n,s.CALLBACK),e)a("message",e[i],s.OBJECT,!0),a("message.conversationType",e[i].conversationType,(function(e){return[d.PRIVATE,d.DISCUSSION,d.GROUP,d.CUSTOMER_SERVICE,d.SYSTEM,d.APP_PUBLIC_SERVICE,d.PUBLIC_SERVICE].includes(e)}),!0),a("message.targetId",e[i].targetId,s.STRING,!0),a("message.senderUserId",e[i].senderUserId,s.STRING,!0),a("message.messageType",e[i].messageType,s.STRING,!0),a("message.content",e[i].content,s.OBJECT,!0),a("message.messageDirection",e[i].messageDirection,s.NUMBER,!0),a("message.canIncludeExpansion",e[i].canIncludeExpansion,s.BOOLEAN),a("message.expansion",e[i].expansion,s.OBJECT),a("message.disableNotification",e[i].disableNotification,s.BOOLEAN),a("message.sentTime",e[i].sentTime,s.NUMBER),a("message.sentStatus",e[i].sentStatus,s.NUMBER),a("options.isUnread",null===(o=e[i])||void 0===o?void 0:o.isUnread,s.BOOLEAN),a("options.searchContent",null===(r=e[i])||void 0===r?void 0:r.searchContent,s.STRING);this.assertCPPMode((function(){c._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,r,c){var i=this;void 0===c&&(c={}),a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("count",o,s.NUMBER,!0),a("callback",r,s.CALLBACK),a("options.order",c.order,s.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,r,c)}),"getRemoteHistoryMessages",r)},e.prototype.deleteLocalMessages=function(e,t,n,o){var i=this;a("messageIds",n,s.ARRAY,!0),a("callback",o,s.CALLBACK),this.logger.info(c.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){i._context.deleteMessages(n).then((function(e){e===r.SUCCESS?_(o.onSuccess,!0):(i.logger.warn(c.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),A(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,r){var c=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),a("cleanSpace",o,s.BOOLEAN),a("callback",r,s.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,r)}),"deleteLocalMessagesByTimestamp",r)},e.prototype.clearMessages=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("callback",n,s.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;a("callback",t,s.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,s=o.data;a===r.SUCCESS?_(t.onSuccess,O(s)):(n.logger.warn(c.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),A(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("sentStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),A(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("receivedStatus",t,s.NUMBER,!0),this.logger.info(c.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===r.SUCCESS?_(n.onSuccess,!0):(o.logger.warn(c.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),A(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var i=this;a("messageId",e,s.NUMBER,!0),a("objectName",n,s.ONLY_STRING,!0),this.assertCPPMode((function(){i.logger.info(c.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),i._context.setMessageContent(e,t,n).then((function(e){e===r.SUCCESS?_(o.onSuccess,!0):A(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;a("messageId",e,s.NUMBER,!0),a("searchFiles",n,s.STRING,!0),this.logger.info(c.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var r=this;a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",n,s.ARRAY),a("customMessageType",o,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var r=this;void 0===n&&(n=[]),a("keyword",e,s.STRING,!0),a("callback",t,s.CALLBACK),a("conversationTypes",o,s.ARRAY),a("customMessageType",n,s.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,r,c,i){var g=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("total",c,s.NUMBER),a("callback",i,s.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContent(e,t,n,o,r,c,i)}),"searchMessageByContent",i)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,r,c){var i=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("timestamp",o,s.NUMBER),a("count",r,s.NUMBER),a("callback",c,s.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,r,c)}),"searchMessageByContentWithAllChannel",c)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,r,c,i,g){var d=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("keyword",n,s.STRING,!0),a("startTime",o,s.NUMBER),a("endTime",r,s.NUMBER),a("offset",c,s.NUMBER),a("limit",i,s.NUMBER),a("callback",g,s.CALLBACK),this.assertCPPMode((function(){d._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,r,c,i,g)}),"searchMessageByContentInTimeRangeWithAllChannel",g)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(c.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var r=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),a("timestamp",n,s.NUMBER,!0),this.assertCPPMode((function(){r._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;a("conversationType",e,s.NUMBER,!0),a("targetId",t,s.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),D=1;l.add("imlib-v2-adapter","5.14.1");var K,F,V=null,H={init:function(e,t,n){var o;void 0===n&&(n={}),a("appkey",e,s.STRING,!0),K=new u("API-V2"),P=h.init({appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime,environment:null!==(o=n.environment)&&void 0!==o?o:"default"}),(V=P.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),V.info(c.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),D=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),x=new G(P,{readReceiptTimeout:D},V,K),C.init(V)},getInstance:function(){return x},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){P.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==V||V.error(c.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){P.assignWatcher({message:function(t,n,a){try{var s=O(t),r=P.getCurrentUserId(),i=P.getConnectedTime();U(s,r,i,D,K),s=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var d=[],l=0;l<c.length;l++)i="".concat(t).concat(c[l],"SENT"),(g=a.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,a.set(i,g));r.receiptMessageDic[t]=d,e.content=r}return e}(s,r,i,D,K),o()||y.set(t),e.onReceived(s,void 0,a)}catch(e){null==V||V.error(c.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){P.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,a=e.targetId,s=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:a,channelId:s||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==V||V.error(c.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){P.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==V||V.error(c.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){P.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==V||V.error(c.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){P.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==V||V.error(c.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){P.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==V||V.error(c.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){P.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==V||V.error(c.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){P.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){P.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){P.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==V||V.error(c.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){P.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==V||V.error(c.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return m(this,void 0,void 0,(function(){var o,a,s;return R(this,(function(i){switch(i.label){case 0:return o=null==V?void 0:V.createTraceId(),null==V||V.info(c.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,P.connect(e,!!n,o)];case 1:return a=i.sent(),s=a.code===r.SUCCESS?"info":"warn",null==V||V[s](c.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===r.SUCCESS?(t.onSuccess(a.userId),g=new Date(P.getConnectedTime()-1e3*D*60*60*24).getTime(),K.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=K.get(e).dealtime;t&&g-t>0&&K.remove(e)}else if(/RECEIVED$/.test(e)){var n=K.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&g-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?K.remove(e):K.set(e,n))}}))):a.code===r.RC_CONN_TOKEN_INCORRECT?(null==V||V.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==V||V.warn(c.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var g}))}))},reconnect:function(e,t,n){var o=null==V?void 0:V.createTraceId();null==V||V.info(c.A_RECONNECT_T,null,o),P.reconnect(n).then((function(t){var n=t.code===r.SUCCESS?"info":"warn";null==V||V[n](c.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===r.SUCCESS?e.onSuccess(t.userId):(null==V||V.warn(c.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:E,getMessageObjectName:function(e){var t=v(v({},T),E);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=L(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,P.registerMessageType(t,n.isPersited,n.isCounted,o)}},W=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},J=function(e,t){this.isCounted=e,this.isPersited=t},j=L("TextMessage","RC:TxtMsg"),Y=L("LocationMessage","RC:LBSMsg"),q=L("TypingStatusMessage","RC:TypSts"),Q=L("ImageMessage","RC:ImgMsg"),X=L("RichContentMessage","RC:ImgTextMsg"),$=L("VoiceMessage","RC:VcMsg"),z=L("HQVoiceMessage","RC:HQVCMsg"),Z=L("FileMessage","RC:FileMsg"),ee=L("SightMessage","RC:SightMsg"),te=L("GIFMessage","RC:GIFMsg"),ne=L("ReadReceiptMessage","RC:ReadNtf"),oe=L("ReadReceiptRequestMessage","RC:RRReqMsg"),ae=L("RCCombineMessage","RC:CombineMsg"),se=function(e,t,n,o,a,s,r,c,i,g,d,l,u,h,C,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=l,this.receivedStatus=u,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(F||(F={}));var re,ce=L("AcceptMessage","RC:VCAccept"),ie=L("RingingMessage","RC:VCRinging"),ge=L("SummaryMessage","RC:VCSummary"),de=L("HungupMessage","RC:VCHangup"),le=L("InviteMessage","RC:VCInvite"),ue=L("MediaModifyMessage","RC:VCModifyMedia"),he=L("MemberModifyMessage","RC:VCModifyMem"),Ce=L("lastMessageSendTime","RC:SRSMsg"),pe=L("ReferenceMessage","RC:ReferenceMsg"),fe=L("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ie=L("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(re||(re={}));var Se=re,ve={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=H);export{ce as AcceptMessage,B as BaseMessage,w as ChannelClient,ve as ConnectionState,Z as FileMessage,te as GIFMessage,S as GetChatRoomType,z as HQVoiceMessage,de as HungupMessage,G as IMClient,Q as ImageMessage,le as InviteMessage,Y as LocationMessage,ue as MediaModifyMessage,he as MemberModifyMessage,W as MentionedInfo,Se as MentionedType,se as Message,J as MessageTag,Ie as PublicServiceMultiRichContentMessage,fe as PublicServiceRichContentMessage,ae as RCCombineMessage,ne as ReadReceiptMessage,oe as ReadReceiptRequestMessage,b as ReadReceiptResponseMessage,pe as ReferenceMessage,X as RichContentMessage,ie as RingingMessage,H as RongIMClient,I as SentStatus,ee as SightMessage,ge as SummaryMessage,Ce as SyncReadStatusMessage,j as TextMessage,q as TypingStatusMessage,F as VoIPMediaType,$ as VoiceMessage};
package/index.js CHANGED
@@ -12,4 +12,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
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=a({channelId:this.channelId},o);this._context.recallMessage(r,c,i,d,l).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;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?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;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?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.14.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,a){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(a)),this._context.getFileToken(e,o,n,a).then(s.onSuccess).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)),this._context.getFileUrl(e,s,o,a,r).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.getMessage(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.14.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.createLogger("RC-IM","IM")).setOutputLevel(o.logOutputLevel),O.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:o.navi?[o.navi]:[],typingExpireTime:o.typingExpireTime})),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;
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=a({channelId:this.channelId},o);this._context.recallMessage(r,c,i,d,l).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;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?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;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?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.14.1"}},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,a){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(a)),this._context.getFileToken(e,o,n,a).then(s.onSuccess).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)),this._context.getFileUrl(e,s,o,a,r).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.getMessage(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.14.1");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.createLogger("RC-IM","IM")).setOutputLevel(o.logOutputLevel),O.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:o.navi?[o.navi]:[],typingExpireTime:o.typingExpireTime})),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/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "types": "index.d.ts",
12
12
  "module": "index.esm.js",
13
- "version": "5.14.0",
13
+ "version": "5.14.1",
14
14
  "author": "pass-web@rongcloud.cn",
15
15
  "license": "LGPL 2.1",
16
16
  "homepage": "https://www.rongcloud.cn",
@@ -21,6 +21,6 @@
21
21
  "globals": "RongIMLib"
22
22
  },
23
23
  "peerDependencies": {
24
- "@rongcloud/engine": "=5.14.0"
24
+ "@rongcloud/engine": "=5.14.1"
25
25
  }
26
26
  }