@rongcloud/imlib-v2-adapter 5.6.1 → 5.6.2-alpha.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
@@ -1 +1 @@
1
- import{NetworkType as e,HttpMethod as t,HTTP_TIMEOUT as n,appendUrl as o,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as s,AppStorage as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as d,AssertRules as u,LogTagId as l,todo as h,RTCApiType as f,VersionManage as C,APIContext as p,ConnectResultCode as S}from"@rongcloud/engine";export{ChatroomEntryType,ChatroomUserChangeType,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var m;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(m||(m={}));var v,I=m;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(v||(v={}));var R=v,y=function(){return y=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},y.apply(this,arguments)};function M(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function T(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(a=2&c[0]?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(6===c[0]&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],o=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}function E(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))}var O=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},U=O();var N={tag:"browser",httpReq:function(e){var a=e.method||t.GET,s=e.timeout||n,r=e.headers,c=e.query,i=e.body,g=o(e.url,c);return new Promise((function(e){var t,n=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),o="[object XDomainRequest]"===Object.prototype.toString.call(n);if(n.open(a,g),r&&n.setRequestHeader)for(var c in r)n.setRequestHeader(c,r[c]);if(o){n.timeout=s,n.onload=function(){e({data:n.responseText,status:n.status||200})},n.onerror=function(){e({status:n.status||0})},n.ontimeout=function(){e({status:n.status||0})};var d="object"==typeof i?JSON.stringify(i):i;n.send(d)}else n.onreadystatechange=function(){4===n.readyState&&e({data:n.responseText,status:n.status})},n.onerror=function(){e({status:n.status||0})},setTimeout((function(){n.abort(),e({status:n.status||0})}),s),n.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:U,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,a=n||o||e.UNKONWN;return new Promise((function(e){e(a)}))}},_=O(),A=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},B={tag:"wechat",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){wx.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:L,sessionStorage:L,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},w=O(),x=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var o=my[e]({key:t[0]}).data;return o?JSON.stringify(o):o}catch(e){}}},k={setItem:x("setStorageSync"),getItem:x("getStorageSync"),removeItem:x("removeStorageSync"),clear:x("clearStorageSync")},P={tag:"alipay",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:s,headers:c,timeout:r,data:g,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:k,sessionStorage:k,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:w,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},b=O(),D=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,t)}catch(e){}}},G={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},F={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,localStorage:G,sessionStorage:G,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},K=O(),W=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,t)}catch(e){}}},H={setItem:W("setStorageSync"),getItem:W("getStorageSync"),removeItem:W("removeStorageSync"),clear:W("clearStorageSync")},j={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:K,localStorage:H,sessionStorage:H,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return M(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))]}))}))}},V=O(),J=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},q={setItem:J("setStorageSync"),getItem:J("getStorageSync"),removeItem:J("removeStorageSync"),clear:J("clearStorageSync")},Y={tag:"jingdong",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){jd.request({url:d,method:s,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:q,sessionStorage:q,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:V,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){jd.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},Q=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},X={setItem:Q("setStorageSync"),getItem:Q("getStorageSync"),removeItem:Q("removeStorageSync"),clear:Q("clearStorageSync")},z={tag:"uniapp",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){uni.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:X,sessionStorage:X,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},$=function(e){return e&&e.request&&e.getSystemInfo},Z="undefined"!=typeof uni&&$(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return z;case"mp-jd":return Y;case"mp-baidu":return j;case"mp-toutiao":return F;case"mp-alipay":return P;case"mp-weixin":return B;default:return N}}():"undefined"!=typeof jd&&$(jd)?Y:"undefined"!=typeof my&&$(my)?P:"undefined"!=typeof tt&&$(tt)?F:"undefined"!=typeof swan&&$(swan)?j:"undefined"!=typeof wx&&$(wx)?B:N;function ee(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var te=function(){function e(){}return e.set=function(t){if(s[t.messageType]&&s[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=ee(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=ee(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=ee(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),ne={"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"},oe={},ae=new r(Z,"API-V2");function se(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.matchCount;if(!g()){var d=te.get(n,o,t||"");s?d&&s.sentTime<d.sentTime&&(s=d):s=d}var u=s?re(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:i}}function re(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,a=e.content,s=e.messageType,r=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,u=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,C=e.expansion,p=e.messageId,S=e.sentStatus,m=e.channelId,v=e.readReceiptInfo,R=e.pushConfig,y="";return s in ne?y=ne[s]:s in oe?y=oe[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},y="UnknownMessage"),u||(u=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:m||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:y,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:u,receivedTime:l,objectName:s,messageId:p,sentStatus:S||I.SENT,disableNotification:f,canIncludeExpansion:h,expansion:C,readReceiptInfo:v,pushConfig:R}}function ce(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,s=e.messageType,r=e.messageDirection;if("ReadReceiptRequestMessage"===s&&a&&r===i.SEND){var c="".concat(t).concat(e.content.messageUId,"SENT");ae.set(c,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===s&&a){var g="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=ae.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,ae.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,ae.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},ae.set(g,l)}}}function ie(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function ge(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var de=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 ue(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new de(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var le,he,fe=ue("ReadReceiptResponseMessage","RC:RRRspMsg"),Ce=function(){function e(e,t,n,o,a){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=ae,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;d("callback",e,u.CALLBACK),d("conversationTypes",t,u.ARRAY),d("count",n,u.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,c=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(se(e))})):r.forEach((function(e){c.push(se(e))})),ie(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(s)),ge(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;d("callback",n,u.CALLBACK),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,s,r;return T(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(s,",targetId:").concat(t)),n.onError(s),[2]):(n.onSuccess(r?se(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||te.remove(e,t,o.channelId),ie(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(s,",targetId:").concat(t)),ge(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("draftText",n,u.STRING,!0),this.logger.info(l.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){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.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){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.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;d("callback",e,u.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?ie(e.onSuccess,s):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),ge(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ie(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(s,",targetId:").concat(t)),ge(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(l.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?ie(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),ge(e.onError,t))})):this.logger.error(l.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?ie(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),ge(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;d("callback",e,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?ie(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),ge(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?ie(n.onSuccess,e.data?re(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),ge(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",o,u.CALLBACK),d("status",n,u.OBJECT,!0),this.logger.info(l.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,t,r,c,this.channelId).then((function(e){e===a.SUCCESS?ie(o.onSuccess):(s.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),ge(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,s,r,g,h){var f=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("msg",n,u.OBJECT,!0),d("callback",o,u.CALLBACK),d("isMentioned",s,u.BOOLEAN),d("pushContent",r,u.ONLY_STRING),d("pushData",g,u.ONLY_STRING),d("options.userIds",null==h?void 0:h.userIds,u.ARRAY),d("options.isVoipPush",null==h?void 0:h.isVoipPush,u.BOOLEAN),d("options.disableNotification",null==h?void 0:h.disableNotification,u.BOOLEAN),d("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,u.BOOLEAN),d("options.expansion",null==h?void 0:h.expansion,u.OBJECT),d("options.pushConfig",null==h?void 0:h.pushConfig,u.OBJECT),d("options.resendMessageId",null==h?void 0:h.resendMessageId,u.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var C=!(!(null==h?void 0:h.isStatusMessage)&&!(null==h?void 0:h.isStatus)),p=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,u=a.pushConfig,l=a.resendMessageId,h=[];if(t){var f=(n||{}).content.mentionedInfo;h=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(h,s,n),S=Object.assign(n,y(y({isMentioned:s,pushContent:r,pushData:g},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:C})),m=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),v),this._context.sendMessage(e,t,S,o.onBefore,v).then((function(s){var r=s.code,g=s.data,d=r===a.SUCCESS?"info":"warn";if(f.logger[d](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),v),r===a.SUCCESS){f._isCPPMode||te.set(g);var u=re(g);ce(u,m,f._context.getConnectedTime(),f._readReceiptTimeout),ie(o.onSuccess,u)}else f.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),ge(o.onError,r,re({isMentioned:!!S.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==h?void 0:h.disableNotification),canIncludeExpansion:!!(null==h?void 0:h.canIncludeExpansion),expansion:(null==h?void 0:h.expansion)||null,conversationType:e,targetId:t,senderUserId:m,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:C,receivedStatus:c.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:I.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;d("message.conversationType",e.conversationType,u.NUMBER,!0),d("message.targetId",e.targetId,u.STRING,!0),d("message.messageUId",e.messageUId,u.STRING,!0),d("message.sentTime",e.sentTime,u.NUMBER,!0),d("callback",t,u.CALLBACK),d("options.disableNotification",null==n?void 0:n.disableNotification,u.BOOLEAN),d("options.pushConfig",null==n?void 0:n.pushConfig,u.OBJECT),d("options.extra",null==n?void 0:n.extra,u.STRING);var s=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(s,",messageUId:").concat(c));var g=y({channelId:this.channelId},n);this._context.recallMessage(s,r,c,i,g).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||te.set(s),ie(t.onSuccess,re(s))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),ge(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("typingContentType",n,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),c),this._context.sendMessage(e,t,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===a.SUCCESS?"info":"warn";s.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===a.SUCCESS?ie(o.onSuccess,re(r)):(s.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),ge(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(l.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var c=[];for(var i in r){var g={};g[i]=r[i].uIds,r[i].isResponse||c.push(g)}if(0===c.length)return void n.onSuccess(null);var d=setInterval((function(){1===c.length&&clearInterval(d);var a=c.splice(0,1)[0],i=new fe({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),ie(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),ge(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;d("messageUIds",e,u.ARRAY,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var s=0,r=e;s<r.length;s++){var c=r[s];d("messageUId",c,u.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(s){var r=s.code;r===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;d("messageUId",e,u.STRING,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(l.O,"getMessageReader ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;d("expansion",e,u.OBJECT,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion,g=t.expansion;this.logger.info(l.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ge(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;d("keys",e,u.ARRAY,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion;this.logger.info(l.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ge(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",s,u.CALLBACK,!0),d("order",c,u.NUMBER),this.logger.info(l.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(l.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,t,n,o,c,this.channelId,r,g).then((function(e){var t=e.code,n=e.data;if(t===a.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],d=o.map((function(e){return c.push(e.messageUId),re(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),ie(s.onSuccess,d,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ie(s.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ge(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("messages",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var c=te.get(e,t,s.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&te.remove(e,t,s.channelId)}))}ie(o.onSuccess)}else s.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),ge(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;d("param.conversationType",e.conversationType,u.NUMBER,!0),d("param.targetId",e.targetId,u.STRING,!0),d("param.timestamp",e.timestamp,u.NUMBER,!0),d("callback",t,u.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?ie(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),ge(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){d("callback",e,u.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ie(e.onSuccess,o.map(se)):ge(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){d("callback",e,u.CALLBACK),d("index",t,u.NUMBER),d("limit",n,u.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ie(e.onSuccess,o.map(se)):ge(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var u=n.canIncludeExpansion,h=n.expansion,f=n.disableNotification,C=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=s.isUnread,m={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:C,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:f,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,m).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?ie(o.onSuccess,re(s)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),ge(o.onError,n))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?ie(s.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),ge(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return re(e)}));ie(s.onSuccess,g,i)}else ie(s.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),ge(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(l.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||te.remove(e,t,o.channelId),ie(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(s,",targetId:").concat(t)),ge(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(l.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(se(e))})),ie(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),ge(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),this.logger.info(l.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(se(e))})),ie(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),ge(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,s,r,this.channelId).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){s.push(re(e))})),ie(c.onSuccess,s,d)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),ge(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(s)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,s).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){s.push(re(e))})),ie(r.onSuccess,s,d)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ge(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,c,i){var g=this;this.logger.info(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(s,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,c).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(re(e))})),ie(i.onSuccess,s)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ge(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(l.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return re(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(l.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?ie(o.onSuccess,!0):(s.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),ge(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(l.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ie(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(s,",targetId:").concat(t)),ge(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(l.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ie(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(s,",messageUId:").concat(t)),ge(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(l.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ie(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(s,",messageUId:").concat(e)),ge(t.onError,s))}))},e}(),pe=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},Se=function(){function e(e,t,n){this._context=e,this._options=t,this.logger=n,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new Ce(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(l.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(l.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(l.O,"getChannel method is only available in protocol stack mode"),null;if(d("channelId",e,u.STRING,!0),e.length>20)return this.logger.error(l.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(l.O,"Only 1000 channels can be obtained"),null;var t=new Ce(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;d("channelIds",e,u.ARRAY,!0),this.logger.info(l.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return M(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.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(l.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;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var s=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),s),this._context.joinChatroom(e,t,s).then((function(t){var r=t===a.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),s),t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),ge(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(l.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(s){var r=s===a.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:s}),o),s===a.SUCCESS?ie(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),ge(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?ie(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),ge(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ge(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("entry.key",e.key,u.STRING,!0),d("entry.value",e.value,u.STRING,!0)})),d("options.isAutoDelete",e.isAutoDelete,u.BOOLEAN)}(t),d("callback",n,u.CALLBACK),t.entries.length>10)ge(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(s)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(s)),ge(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ge(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ge(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("key",e,u.STRING,!0)}))}(t);var s="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(s));var r=y({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(s)),ge(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ie(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ge(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("key",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?ie(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),ge(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ie(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(s,",chatRoomId:").concat(e)),ge(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),d("timestamp",s,u.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,s).then((function(t){var n=t.code,s=t.data;if(n===a.SUCCESS)if(s){var c=s.list,i=s.hasMore,g=c.map((function(e){return re(e)}));ie(o.onSuccess,g,i)}else ie(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),ge(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,a){d("fileType",e,u.NUMBER,!0),d("fileName",n,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,a,s){d("fileType",e,u.NUMBER,!0),d("fileName",t,u.STRING,!0),d("saveName",n,u.STRING),d("callback",o,u.CALLBACK),d("serverType",s,u.NUMBER),d("uploadRes",a,u.OBJECT),this.logger.info(l.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,a,s).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagId",e.tagId,(function(e){return e.length<=10})),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("tag.tagName",e.tagName,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;d("tagId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(s,",tagId:").concat(e)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagName",e.tagName,u.STRING,!0),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("callback",t,u.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;d("callback",e,u.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(l.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(l.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;d("conversationType",e.type,u.NUMBER),d("targetId",e.targetId,u.STRING),d("channelId",e.channelId,u.ONLY_STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(pe(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(l.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(l.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return pe(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return pe(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING),d("tagIds",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("tagId",e,u.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(pe(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(s,",tagIds:").concat(t)),n.onError(s))})).catch((function(e){o.logger.warn(l.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("startTime",n,u.NUMBER,!0),d("callback",o,u.CALLBACK,!0),this.logger.info(l.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,c=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?re(s):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(s.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("containMuted",t,u.BOOLEAN,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var s=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:s,data:r})),s===a.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("conversation.targetId",t.targetId,u.STRING,!0),d("conversation.type",t.type,u.NUMBER,!0),d("conversation.channelId",t.channelId,u.ONLY_STRING),d("status.isTop",null==n?void 0:n.isTop,u.BOOLEAN,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,pe(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];this.logger.info(l.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,E([e],s,!1)).then((function(n){var s=n.code,r=n.data;if(s!==a.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(s)),t.onError&&ge(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?re(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return re(e)}));return void ie(t.onSuccess,d,g)}t.onSuccess&&ie(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){d("callback",t,u.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ie(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(l.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;d("status",e,u.NUMBER),d("callback",t,u.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?ie(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),ge(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ie(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(s,",useerId:").concat(e)),ge(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?ie(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),ge(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?ie(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),ge(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;d("callback",e,u.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?ie(e.onSuccess,s):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),ge(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ie(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(s,",userId:").concat(e)),ge(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("content.senderUserId",n.senderUserId,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){s._defaultChannelClient.insertMessage(e,t,n,o,a)}),"insertMessage",o)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",a,u.CALLBACK),d("options.order",s.order,u.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;d("messageIds",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?ie(o.onSuccess,!0):(s.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),ge(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("cleanSpace",o,u.BOOLEAN),d("callback",a,u.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;d("callback",t,u.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ie(t.onSuccess,re(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(s,",messageId:").concat(e)),ge(t.onError,s))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("sentStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?ie(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),ge(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("receivedStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?ie(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),ge(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;d("messageId",e,u.NUMBER,!0),d("objectName",n,u.ONLY_STRING,!0),this.assertCPPMode((function(){s.logger.info(l.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),s._context.setMessageContent(e,t,n).then((function(e){e===a.SUCCESS?ie(o.onSuccess,!0):ge(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("searchFiles",n,u.STRING,!0),this.logger.info(l.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",n,u.ARRAY),d("customMessageType",o,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",o,u.ARRAY),d("customMessageType",n,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("total",s,u.NUMBER),d("callback",r,u.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("callback",s,u.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("startTime",o,u.NUMBER),d("endTime",a,u.NUMBER),d("offset",s,u.NUMBER),d("limit",r,u.NUMBER),d("callback",c,u.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(l.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.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.prototype.getRTCUserInfoList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(o){var s=o.code,r=o.data;if(s!==a.SUCCESS)n.logger.warn(l.O,"getRTCUserInfoList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s);else{var c=null==r?void 0:r.users;t.onSuccess(c)}})).catch((function(o){n.logger.warn(l.O,"getRTCUserInfoList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.getRTCUserList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCUserList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCUserList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(t||{}))),this._context.setRTCUserInfo(e.id,t.key,t.value).then((function(s){s!==a.SUCCESS?(o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(s,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(s)):n.onSuccess(!0)})).catch((function(a){o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(t.keys)),this._context.removeRTCUserInfo(e.id,t.keys).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"removeRTCUserInfo ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"removeRTCUserInfo ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e.prototype.getRTCRoomInfo=function(e,t){var n=this;this.logger.info(l.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCRoomInfo ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCRoomInfo ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCRoomInfo=function(e,t,n){throw h("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,t,n){throw h("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"joinRTCRoom ->roomId:".concat(e.id));var o=e.mode||0;this._context.joinRTCRoom(e.id,o).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"joinRTCRoom ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"joinRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.quitRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(o){o!==a.SUCCESS?(n.logger.warn(l.O,"quitRTCRoom ->code:".concat(o,",roomId:").concat(e.id)),t.onError(o)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"quitRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.RTCPing=function(e,t){var n=this;this.logger.info(l.O,"RTCPing ->roomId:".concat(e.id));var o=e.mode||0;this._context.rtcPing(e.id,o).then((function(o){var s=o.code;s!==a.SUCCESS?(n.logger.warn(l.O,"RTCPing ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"RTCPing ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCData=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"setRTCData ->roomId:".concat(e,",key:").concat(t)),this._context.setRTCData(e,t,n,o,s,c).then((function(t){t!==a.SUCCESS?(i.logger.warn(l.O,"setRTCData ->code:".concat(t,",roomId:").concat(e)),r.onError(t)):r.onSuccess(!0)})).catch((function(t){i.logger.warn(l.O,"setRTCData ->error:".concat(t,",roomId:").concat(e)),r.onError(t)}))},e.prototype.getRTCData=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"getRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.getRTCData(e,t,n,o).then((function(t){var n=t.code,o=t.data;n!==a.SUCCESS?(r.logger.warn(l.O,"getRTCData ->code:".concat(n,",roomId:").concat(e)),s.onError(n)):s.onSuccess(o)})).catch((function(t){r.logger.warn(l.O,"setRTCUserInfo ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.removeRTCData=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.removeRTCData(e,t,n,o,r).then((function(t){t!==a.SUCCESS?(c.logger.warn(l.O,"removeRTCData ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){c.logger.warn(l.O,"removeRTCData ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.setRTCUserData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.PERSON,a,s)},e.prototype.setRTCUserTotalRes=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,t,n,o).then((function(t){t!==a.SUCCESS?(r.logger.warn(l.O,"setRTCUserTotalRes ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){r.logger.warn(l.O,"setRTCUserTotalRes ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.getRTCUserData=function(e,t,n,o){this.getRTCData(e,t,n,f.PERSON,o)},e.prototype.removeRTCUserData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.PERSON,o,a)},e.prototype.setRTCRoomData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.ROOM,a,s)},e.prototype.getRTCRoomData=function(e,t,n,o){this.getRTCData(e,t,n,f.ROOM,o)},e.prototype.removeRTCRoomData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.ROOM,o,a)},e.prototype.setRTCOutData=function(e,t,n,o,a){throw h("setRTCOutData")},e.prototype.getRTCOutData=function(e,t,n){throw h("getRTCOutData")},e.prototype.getRTCToken=function(e,t){var n=this;this.logger.info(l.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCToken ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCToken ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCState=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,t.report).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"setRTCState ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"setRTCState ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e}(),me=[],ve=[],Ie={message:function(e){me.forEach((function(t){return t(re(e))}))},status:function(e){ve.forEach((function(t){return t(e)}))}},Re=1;C.add("imlib-v2-adapter","5.6.1");var ye,Me=null,Te={init:function(e,t,n){void 0===n&&(n={}),d("appkey",e,u.STRING,!0),he=p.init(Z,{appkey:e,apiVersion:"5.6.1",navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,checkCA:n.checkCA,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(Me=he.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),Me.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Re=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),le=new Se(he,{readReceiptTimeout:Re},Me)},getInstance:function(){return le},setConnectionStatusListener:function(e){null==Me||Me.createTraceId(),he.assignWatcher({connectionState:function(t){te.clear(),e.onChanged(t)}})},setOnReceiveMessageListener:function(e){he.assignWatcher({message:function(t,n,o){try{var a=re(t),s=he.getCurrentUserId(),r=he.getConnectedTime();ce(a,s,r,Re),a=function(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var s=e.content,r=((s=s||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=ae.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,ae.set(c,i));s.receiptMessageDic[t]=g,e.content=s}return e}(a,s,r,Re),g()||te.set(t),e.onReceived(a,void 0,o)}catch(e){null==Me||Me.error(l.O,"setOnReceiveMessageListener -> error:".concat(e))}}})},setConversationStatusListener:function(e){he.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==Me||Me.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){he.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==Me||Me.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){he.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==Me||Me.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){he.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==Me||Me.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){he.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==Me||Me.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){he.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==Me||Me.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){he.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){he.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){he.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==Me||Me.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){he.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==Me||Me.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,s,r,c;return T(this,(function(i){switch(i.label){case 0:return o=null==Me?void 0:Me.createTraceId(),null==Me||Me.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,he.connect(e,!1,n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==Me||Me[r](l.A_CONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===a.SUCCESS?(t.onSuccess(s.userId),c=new Date(he.getConnectedTime()-1e3*Re*60*60*24).getTime(),ae.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=ae.get(e).dealtime;t&&c-t>0&&ae.remove(e)}else if(/RECEIVED$/.test(e)){var n=ae.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&c-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?ae.remove(e):ae.set(e,n))}}))):s.code===a.RC_CONN_USER_OR_PASSWD_ERROR?(null==Me||Me.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onTokenIncorrect()):(null==Me||Me.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onError(s.code)),[2]}}))}))},reconnect:function(e,t,n){var o=null==Me?void 0:Me.createTraceId();null==Me||Me.info(l.A_RECONNECT_T,null,o),he.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==Me||Me[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==Me||Me.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:oe,getMessageObjectName:function(e){var t=y(y({},ne),oe);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=ue(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,he.registerMessageType(t,n.isPersited,n.isCounted,o)},messageWatch:function(e){var t=this;me.push((function(n){var o,a;null==Me||Me.info(l.O,"messageWatch ->message:".concat(JSON.stringify(n||{})));try{e(n),null===(a=(o=t._voipProvider).onReceived)||void 0===a||a.call(o,n)}catch(e){null==Me||Me.error(l.O,"messageWatch ->error:".concat(e))}})),he.assignWatcher({rtcInnerWatcher:Ie})},statusWatch:function(e){ve.push((function(t){null==Me||Me.info(l.O,"statusWatch ->status:".concat(t));try{e(t)}catch(e){null==Me||Me.error(l.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},Ee=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},Oe=function(e,t){this.isCounted=e,this.isPersited=t},Ue=ue("TextMessage","RC:TxtMsg"),Ne=ue("LocationMessage","RC:LBSMsg"),_e=ue("TypingStatusMessage","RC:TypSts"),Ae=ue("ImageMessage","RC:ImgMsg"),Le=ue("RichContentMessage","RC:ImgTextMsg"),Be=ue("VoiceMessage","RC:VcMsg"),we=ue("HQVoiceMessage","RC:HQVCMsg"),xe=ue("FileMessage","RC:FileMsg"),ke=ue("SightMessage","RC:SightMsg"),Pe=ue("GIFMessage","RC:GIFMsg"),be=ue("ReadReceiptMessage","RC:ReadNtf"),De=ue("ReadReceiptRequestMessage","RC:RRReqMsg"),Ge=ue("RCCombineMessage","RC:CombineMsg"),Fe=function(e,t,n,o,a,s,r,c,i,g,d,u,l,h,f,C,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=f,this.expansion=C,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(ye||(ye={}));var Ke,We=ue("AcceptMessage","RC:VCAccept"),He=ue("RingingMessage","RC:VCRinging"),je=ue("SummaryMessage","RC:VCSummary"),Ve=ue("HungupMessage","RC:VCHangup"),Je=ue("InviteMessage","RC:VCInvite"),qe=ue("MediaModifyMessage","RC:VCModifyMedia"),Ye=ue("MemberModifyMessage","RC:VCModifyMem"),Qe=ue("lastMessageSendTime","RC:SRSMsg"),Xe=ue("ReferenceMessage","RC:ReferenceMsg"),ze=ue("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),$e=ue("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Ke||(Ke={}));var Ze=Ke,et=S;window&&(window.RongIMClient=Te);export{We as AcceptMessage,de as BaseMessage,Ce as ChannelClient,et as ConnectionState,xe as FileMessage,Pe as GIFMessage,R as GetChatRoomType,we as HQVoiceMessage,Ve as HungupMessage,Se as IMClient,Ae as ImageMessage,Je as InviteMessage,Ne as LocationMessage,qe as MediaModifyMessage,Ye as MemberModifyMessage,Ee as MentionedInfo,Ze as MentionedType,Fe as Message,Oe as MessageTag,$e as PublicServiceMultiRichContentMessage,ze as PublicServiceRichContentMessage,Ge as RCCombineMessage,be as ReadReceiptMessage,De as ReadReceiptRequestMessage,fe as ReadReceiptResponseMessage,Xe as ReferenceMessage,Le as RichContentMessage,He as RingingMessage,Te as RongIMClient,I as SentStatus,ke as SightMessage,je as SummaryMessage,Qe as SyncReadStatusMessage,Ue as TextMessage,_e as TypingStatusMessage,ye as VoIPMediaType,Be as VoiceMessage};
1
+ import{NetworkType as e,HttpMethod as t,HTTP_TIMEOUT as n,appendUrl as o,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as s,AppStorage as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as d,AssertRules as u,LogTagId as l,todo as h,RTCApiType as f,VersionManage as C,APIContext as p,ConnectResultCode as S}from"@rongcloud/engine";export{ChatroomEntryType,ChatroomUserChangeType,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RTCApiType,RTCMode,ReceivedStatus,UploadMethod,logger}from"@rongcloud/engine";var m;!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(m||(m={}));var v,I=m;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(v||(v={}));var R=v,y=function(){return y=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},y.apply(this,arguments)};function M(e,t,n,o){return new(n||(n=Promise))((function(a,s){function r(e){try{i(o.next(e))}catch(e){s(e)}}function c(e){try{i(o.throw(e))}catch(e){s(e)}}function i(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,c)}i((o=o.apply(e,t||[])).next())}))}function T(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(a=2&c[0]?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(6===c[0]&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],o=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}"function"==typeof SuppressedError&&SuppressedError;var E=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},O=E();var U={tag:"browser",httpReq:function(e){var a=e.method||t.GET,s=e.timeout||n,r=e.headers,c=e.query,i=e.body,g=o(e.url,c);return new Promise((function(e){var t,n=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),o="[object XDomainRequest]"===Object.prototype.toString.call(n);if(n.open(a,g),r&&n.setRequestHeader)for(var c in r)n.setRequestHeader(c,r[c]);if(o){n.timeout=s,n.onload=function(){e({data:n.responseText,status:n.status||200})},n.onerror=function(){e({status:n.status||0})},n.ontimeout=function(){e({status:n.status||0})};var d="object"==typeof i?JSON.stringify(i):i;n.send(d)}else n.onreadystatechange=function(){4===n.readyState&&e({data:n.responseText,status:n.status})},n.onerror=function(){e({status:n.status||0})},setTimeout((function(){n.abort(),e({status:n.status||0})}),s),n.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:O,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var t=navigator.connection||navigator.mozConnection||navigator.webkitConnection,n=t.type,o=t.effectiveType,a=n||o||e.UNKONWN;return new Promise((function(e){e(a)}))}},N=E(),_=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},A={setItem:_("setStorageSync"),getItem:_("getStorageSync"),removeItem:_("removeStorageSync"),clear:_("clearStorageSync")},L={tag:"wechat",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){wx.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:A,sessionStorage:A,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:N,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){wx.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},B=E(),w=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var o=my[e]({key:t[0]}).data;return o?JSON.stringify(o):o}catch(e){}}},x={setItem:w("setStorageSync"),getItem:w("getStorageSync"),removeItem:w("removeStorageSync"),clear:w("clearStorageSync")},k={tag:"alipay",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:s,headers:c,timeout:r,data:g,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:x,sessionStorage:x,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:B,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(t){my.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},P=E(),b=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return tt[e].apply(tt,t)}catch(e){}}},D={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},G={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:P,localStorage:D,sessionStorage:D,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){tt.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},F=E(),K=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return swan[e].apply(swan,t)}catch(e){}}},W={setItem:K("setStorageSync"),getItem:K("getStorageSync"),removeItem:K("removeStorageSync"),clear:K("clearStorageSync")},H={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:F,localStorage:W,sessionStorage:W,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return M(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new Promise((function(t){swan.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))]}))}))}},j=E(),V=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},J={setItem:V("setStorageSync"),getItem:V("getStorageSync"),removeItem:V("removeStorageSync"),clear:V("clearStorageSync")},q={tag:"jingdong",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){jd.request({url:d,method:s,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:J,sessionStorage:J,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:j,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){jd.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},Y=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},Q={setItem:Y("setStorageSync"),getItem:Y("getStorageSync"),removeItem:Y("removeStorageSync"),clear:Y("clearStorageSync")},X={tag:"uniapp",httpReq:function(e){var s=e.method||t.GET,r=e.timeout||n,c=e.headers,i=e.query,g=e.body,d=o(e.url,i);return new Promise((function(e){uni.request({url:d,method:s,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:Q,sessionStorage:Q,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(t){uni.getNetworkType({success:function(e){var n=e.networkType;t(n)},fail:function(){t(e.UNKONWN)}})}))}},z=function(e){return e&&e.request&&e.getSystemInfo},$="undefined"!=typeof uni&&z(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return X;case"mp-jd":return q;case"mp-baidu":return H;case"mp-toutiao":return G;case"mp-alipay":return k;case"mp-weixin":return L;default:return U}}():"undefined"!=typeof jd&&z(jd)?q:"undefined"!=typeof my&&z(my)?k:"undefined"!=typeof tt&&z(tt)?G:"undefined"!=typeof swan&&z(swan)?H:"undefined"!=typeof wx&&z(wx)?L:U;function Z(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var ee=function(){function e(){}return e.set=function(t){if(s[t.messageType]&&s[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=Z(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=Z(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=Z(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),te={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},ne={},oe=new r($,"API-V2");function ae(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.matchCount;if(!g()){var d=ee.get(n,o,t||"");s?d&&s.sentTime<d.sentTime&&(s=d):s=d}var u=s?se(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:u,latestMessageId:null==u?void 0:u.messageId,objectName:null==u?void 0:u.messageType,sentTime:null==u?void 0:u.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==u?void 0:u.receivedStatus,matchCount:i}}function se(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,a=e.content,s=e.messageType,r=e.messageUId,i=e.messageDirection,g=e.isOffLineMessage,d=e.sentTime,u=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,C=e.expansion,p=e.messageId,S=e.sentStatus,m=e.channelId,v=e.readReceiptInfo,R=e.pushConfig,y="";return s in te?y=te[s]:s in ne?y=ne[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},y="UnknownMessage"),u||(u=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:m||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:y,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:d,receivedStatus:u,receivedTime:l,objectName:s,messageId:p,sentStatus:S||I.SENT,disableNotification:f,canIncludeExpansion:h,expansion:C,readReceiptInfo:v,pushConfig:R}}function re(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,s=e.messageType,r=e.messageDirection;if("ReadReceiptRequestMessage"===s&&a&&r===i.SEND){var c="".concat(t).concat(e.content.messageUId,"SENT");oe.set(c,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===s&&a){var g="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=oe.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,oe.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,oe.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},oe.set(g,l)}}}function ce(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function ie(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var ge=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 de(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new ge(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var ue,le,he=de("ReadReceiptResponseMessage","RC:RRRspMsg"),fe=function(){function e(e,t,n,o,a){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=oe,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;d("callback",e,u.CALLBACK),d("conversationTypes",t,u.ARRAY),d("count",n,u.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,c=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(ae(e))})):r.forEach((function(e){c.push(ae(e))})),ce(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(s)),ie(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;d("callback",n,u.CALLBACK),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),M(o,void 0,void 0,(function(){var o,s,r;return T(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(s,",targetId:").concat(t)),n.onError(s),[2]):(n.onSuccess(r?ae(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||ee.remove(e,t,o.channelId),ce(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(s,",targetId:").concat(t)),ie(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("draftText",n,u.STRING,!0),this.logger.info(l.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){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.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){d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.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;d("callback",e,u.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?ce(e.onSuccess,s):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),ie(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ce(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(s,",targetId:").concat(t)),ie(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(l.O,"clearConversations -> conversationTypes:".concat(t)),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?ce(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),ie(e.onError,t))})):this.logger.error(l.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?ce(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),ie(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;d("callback",e,u.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?ce(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),ie(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getFirstUnreadMessage ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?ce(n.onSuccess,e.data?se(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),ie(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",o,u.CALLBACK),d("status",n,u.OBJECT,!0),this.logger.info(l.O,"setConversationStatus ->targetId:".concat(t,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,t,r,c,this.channelId).then((function(e){e===a.SUCCESS?ce(o.onSuccess):(s.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),ie(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,s,r,g,h){var f=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("msg",n,u.OBJECT,!0),d("callback",o,u.CALLBACK),d("isMentioned",s,u.BOOLEAN),d("pushContent",r,u.ONLY_STRING),d("pushData",g,u.ONLY_STRING),d("options.userIds",null==h?void 0:h.userIds,u.ARRAY),d("options.isVoipPush",null==h?void 0:h.isVoipPush,u.BOOLEAN),d("options.disableNotification",null==h?void 0:h.disableNotification,u.BOOLEAN),d("options.canIncludeExpansion",null==h?void 0:h.canIncludeExpansion,u.BOOLEAN),d("options.expansion",null==h?void 0:h.expansion,u.OBJECT),d("options.pushConfig",null==h?void 0:h.pushConfig,u.OBJECT),d("options.resendMessageId",null==h?void 0:h.resendMessageId,u.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var C=!(!(null==h?void 0:h.isStatusMessage)&&!(null==h?void 0:h.isStatus)),p=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,d=a.canIncludeExpansion,u=a.pushConfig,l=a.resendMessageId,h=[];if(t){var f=(n||{}).content.mentionedInfo;h=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(h,s,n),S=Object.assign(n,y(y({isMentioned:s,pushContent:r,pushData:g},p),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:C})),m=this._context.getCurrentUserId(),v=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:S.messageType,conversationType:e,targetId:t,channelId:this.channelId}),v),this._context.sendMessage(e,t,S,o.onBefore,v).then((function(s){var r=s.code,g=s.data,d=r===a.SUCCESS?"info":"warn";if(f.logger[d](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),v),r===a.SUCCESS){f._isCPPMode||ee.set(g);var u=se(g);re(u,m,f._context.getConnectedTime(),f._readReceiptTimeout),ce(o.onSuccess,u)}else f.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),ie(o.onError,r,se({isMentioned:!!S.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==h?void 0:h.disableNotification),canIncludeExpansion:!!(null==h?void 0:h.canIncludeExpansion),expansion:(null==h?void 0:h.expansion)||null,conversationType:e,targetId:t,senderUserId:m,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:C,receivedStatus:c.UNREAD,messageId:null==g?void 0:g.messageId,sentStatus:I.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;d("message.conversationType",e.conversationType,u.NUMBER,!0),d("message.targetId",e.targetId,u.STRING,!0),d("message.messageUId",e.messageUId,u.STRING,!0),d("message.sentTime",e.sentTime,u.NUMBER,!0),d("callback",t,u.CALLBACK),d("options.disableNotification",null==n?void 0:n.disableNotification,u.BOOLEAN),d("options.pushConfig",null==n?void 0:n.pushConfig,u.OBJECT),d("options.extra",null==n?void 0:n.extra,u.STRING);var s=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(s,",messageUId:").concat(c));var g=y({channelId:this.channelId},n);this._context.recallMessage(s,r,c,i,g).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||ee.set(s),ce(t.onSuccess,se(s))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),ie(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("typingContentType",n,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"sendTypingStatusMessage ->targetId:".concat(t,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),c),this._context.sendMessage(e,t,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===a.SUCCESS?"info":"warn";s.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===a.SUCCESS?ce(o.onSuccess,se(r)):(s.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),ie(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(l.O,"sendReceiptResponse ->targetId:".concat(t,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),s="".concat(a).concat(e).concat(t,"RECEIVED"),r=this._storage.get(s);if(r){var c=[];for(var i in r){var g={};g[i]=r[i].uIds,r[i].isResponse||c.push(g)}if(0===c.length)return void n.onSuccess(null);var d=setInterval((function(){1===c.length&&clearInterval(d);var a=c.splice(0,1)[0],i=new he({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),ce(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),ie(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;d("messageUIds",e,u.ARRAY,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var s=0,r=e;s<r.length;s++){var c=r[s];d("messageUId",c,u.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(s){var r=s.code;r===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(t,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;d("messageUId",e,u.STRING,!0),d("targetId",t,u.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,c=s.data;r===a.SUCCESS?n.onSuccess(c):(o.logger.warn(l.O,"getMessageReader ->code:".concat(r,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(l.O,"getMessageReader ->code:".concat(a,",targetId:").concat(t,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;d("expansion",e,u.OBJECT,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion,g=t.expansion;this.logger.info(l.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ie(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;d("keys",e,u.ARRAY,!0),d("message",t,u.OBJECT,!0);var s=t.conversationType,r=t.targetId,c=t.messageUId,i=t.canIncludeExpansion;this.logger.info(l.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(s)),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),ie(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",s,u.CALLBACK,!0),d("order",c,u.NUMBER),this.logger.info(l.O,"getHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(l.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:t,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,t,n,o,c,this.channelId,r,g).then((function(e){var t=e.code,n=e.data;if(t===a.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],d=o.map((function(e){return c.push(e.messageUId),se(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),ce(s.onSuccess,d,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ce(s.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),ie(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("messages",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteRemoteMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var c=ee.get(e,t,s.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&ee.remove(e,t,s.channelId)}))}ce(o.onSuccess)}else s.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),ie(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;d("param.conversationType",e.conversationType,u.NUMBER,!0),d("param.targetId",e.targetId,u.STRING,!0),d("param.timestamp",e.timestamp,u.NUMBER,!0),d("callback",t,u.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?ce(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),ie(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){d("callback",e,u.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ce(e.onSuccess,o.map(ae)):ie(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){d("callback",e,u.CALLBACK),d("index",t,u.NUMBER),d("limit",n,u.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?ce(e.onSuccess,o.map(ae)):ie(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var c=n.senderUserId,i=n.objectName,g=n.content,d=n.messageDirection;n.messageUId;var u=n.canIncludeExpansion,h=n.expansion,f=n.disableNotification,C=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=s.isUnread,m={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:C,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:f,canIncludeExpansion:u,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,m).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?ce(o.onSuccess,se(s)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),ie(o.onError,n))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(t,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?ce(s.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),ie(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"getRemoteHistoryMessages ->targetId:".concat(t,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return se(e)}));ce(s.onSuccess,g,i)}else ce(s.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),ie(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(l.O,"clearMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||ee.remove(e,t,o.channelId),ce(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(s,",targetId:").concat(t)),ie(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(l.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(ae(e))})),ce(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),ie(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),this.logger.info(l.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){c.push(ae(e))})),ce(t.onSuccess,c)):(s.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),ie(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"searchMessageByContent ->targetId:".concat(t,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,t,n,o,s,r,this.channelId).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var r=o=o||{},g=r.messages,d=r.count;g.forEach((function(e){s.push(se(e))})),ce(c.onSuccess,s,d)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),ie(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(s)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,s).then((function(e){var n=e.code,o=e.data,s=[];if(n===a.SUCCESS){var i=o=o||{},g=i.messages,d=i.count;g.forEach((function(e){s.push(se(e))})),ce(r.onSuccess,s,d)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ie(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,c,i){var g=this;this.logger.info(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(s,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,c).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(se(e))})),ce(i.onSuccess,s)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),ie(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(l.O,"getUnreadMentionedMessages ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return se(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(l.O,"clearUnreadCountByTimestamp ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?ce(o.onSuccess,!0):(s.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),ie(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(l.O,"getConversationNotificationStatus ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ce(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(s,",targetId:").concat(t)),ie(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(l.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(t)),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?ce(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(s,",messageUId:").concat(t)),ie(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(l.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ce(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(s,",messageUId:").concat(e)),ie(t.onError,s))}))},e}(),Ce=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},pe=function(){function e(e,t,n){this._context=e,this._options=t,this.logger=n,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new fe(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(l.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(l.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(l.O,"getChannel method is only available in protocol stack mode"),null;if(d("channelId",e,u.STRING,!0),e.length>20)return this.logger.error(l.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(l.O,"Only 1000 channels can be obtained"),null;var t=new fe(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;d("channelIds",e,u.ARRAY,!0),this.logger.info(l.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return M(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.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(l.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;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var s=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),s),this._context.joinChatroom(e,t,s).then((function(t){var r=t===a.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),s),t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),ie(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(l.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(s){var r=s===a.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:s}),o),s===a.SUCCESS?ce(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),ie(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?ce(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),ie(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ie(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("entry.key",e.key,u.STRING,!0),d("entry.value",e.value,u.STRING,!0)})),d("options.isAutoDelete",e.isAutoDelete,u.BOOLEAN)}(t),d("callback",n,u.CALLBACK),t.entries.length>10)ie(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(s)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(s)),ie(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ie(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ie(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),function(e){e.entries.forEach((function(e){d("key",e,u.STRING,!0)}))}(t);var s="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(s));var r=y({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(s)),ie(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("chatroomEntry",t,u.OBJECT,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?ce(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),ie(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;d("chatRoomId",e,u.STRING,!0),d("key",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?ce(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),ie(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;d("chatRoomId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ce(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(s,",chatRoomId:").concat(e)),ie(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),d("chatRoomId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("order",n,u.NUMBER,!0),d("callback",o,u.CALLBACK),d("timestamp",s,u.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,s).then((function(t){var n=t.code,s=t.data;if(n===a.SUCCESS)if(s){var c=s.list,i=s.hasMore,g=c.map((function(e){return se(e)}));ce(o.onSuccess,g,i)}else ce(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),ie(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,n,o){return this._defaultChannelClient.deleteRemoteMessages(e,t,n,o)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,t,n,o,a){d("fileType",e,u.NUMBER,!0),d("fileName",n,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,a,s){d("fileType",e,u.NUMBER,!0),d("fileName",t,u.STRING,!0),d("saveName",n,u.STRING),d("callback",o,u.CALLBACK),d("serverType",s,u.NUMBER),d("uploadRes",a,u.OBJECT),this.logger.info(l.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(t)),this._context.getFileUrl(e,t,n,a,s).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagId",e.tagId,(function(e){return e.length<=10})),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("tag.tagName",e.tagName,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;d("tagId",e,u.STRING,!0),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(s,",tagId:").concat(e)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;d("tag.tagId",e.tagId,u.STRING,!0),d("tag.tagName",e.tagName,u.STRING,!0),d("tag.tagName",e.tagName,(function(e){return e.length<=15})),d("callback",t,u.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(s,",tagId:").concat(e.tagId)),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;d("callback",e,u.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(l.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){t.logger.warn(l.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;d("conversationType",e.type,u.NUMBER),d("targetId",e.targetId,u.STRING),d("channelId",e.channelId,u.ONLY_STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Ce(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(l.O,"getTagsForConversation ->code:".concat(o)),t.onError(o))})).catch((function(e){n.logger.warn(l.O,"getTagsForConversation ->reason:".concat(e)),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return Ce(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"addTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("conversations",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return Ce(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"removeTagForConversations ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;d("conversation.type",e.type,u.NUMBER,!0),d("conversation.targetId",e.targetId,u.STRING,!0),d("conversation.channelId",e.channelId,u.ONLY_STRING),d("tagIds",t,u.ARRAY,!0),d("callback",n,u.CALLBACK),t.forEach((function(e){d("tagId",e,u.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Ce(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(s,",tagIds:").concat(t)),n.onError(s))})).catch((function(e){o.logger.warn(l.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(t)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("count",t,u.NUMBER,!0),d("startTime",n,u.NUMBER,!0),d("callback",o,u.CALLBACK,!0),this.logger.info(l.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,c=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,s=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=s?se(s):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),o.onSuccess(c)):(s.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;d("tagId",e,u.STRING,!0),d("containMuted",t,u.BOOLEAN,!0),d("callback",n,u.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var s=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:s,data:r})),s===a.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"getUnreadCountByTag ->reason:".concat(t,",tagId:").concat(e)),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;d("tagId",e,u.STRING,!0),d("conversation.targetId",t.targetId,u.STRING,!0),d("conversation.type",t.type,u.NUMBER,!0),d("conversation.channelId",t.channelId,u.ONLY_STRING),d("status.isTop",null==n?void 0:n.isTop,u.BOOLEAN,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,Ce(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"setConversationStatusInTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.callExtra=function(e,t){for(var n,o=this,s=[],r=2;r<arguments.length;r++)s[r-2]=arguments[r];this.logger.info(l.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,a=0,s=t.length;a<s;a++)!o&&a in t||(o||(o=Array.prototype.slice.call(t,0,a)),o[a]=t[a]);return e.concat(o||Array.prototype.slice.call(t))}([e],s,!1)).then((function(n){var s=n.code,r=n.data;if(s!==a.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(s)),t.onError&&ie(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?se(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return se(e)}));return void ce(t.onSuccess,d,g)}t.onSuccess&&ce(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){d("callback",t,u.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ce(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(l.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;d("status",e,u.NUMBER),d("callback",t,u.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?ce(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),ie(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ce(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(s,",useerId:").concat(e)),ie(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?ce(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),ie(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?ce(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),ie(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;d("callback",e,u.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?ce(e.onSuccess,s):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),ie(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;d("userId",e,u.STRING),d("callback",t,u.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ce(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(s,",userId:").concat(e)),ie(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("content.senderUserId",n.senderUserId,u.STRING,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){s._defaultChannelClient.insertMessage(e,t,n,o,a)}),"insertMessage",o)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("count",o,u.NUMBER,!0),d("callback",a,u.CALLBACK),d("options.order",s.order,u.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;d("messageIds",n,u.ARRAY,!0),d("callback",o,u.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?ce(o.onSuccess,!0):(s.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),ie(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),d("cleanSpace",o,u.BOOLEAN),d("callback",a,u.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("callback",n,u.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;d("callback",t,u.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?ce(t.onSuccess,se(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(s,",messageId:").concat(e)),ie(t.onError,s))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("sentStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?ce(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),ie(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("receivedStatus",t,u.NUMBER,!0),this.logger.info(l.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(t)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?ce(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),ie(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;d("messageId",e,u.NUMBER,!0),d("objectName",n,u.ONLY_STRING,!0),this.assertCPPMode((function(){s.logger.info(l.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),s._context.setMessageContent(e,t,n).then((function(e){e===a.SUCCESS?ce(o.onSuccess,!0):ie(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;d("messageId",e,u.NUMBER,!0),d("searchFiles",n,u.STRING,!0),this.logger.info(l.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var a=this;d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",n,u.ARRAY),d("customMessageType",o,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),d("keyword",e,u.STRING,!0),d("callback",t,u.CALLBACK),d("conversationTypes",o,u.ARRAY),d("customMessageType",n,u.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("total",s,u.NUMBER),d("callback",r,u.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("timestamp",o,u.NUMBER),d("count",a,u.NUMBER),d("callback",s,u.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("keyword",n,u.STRING,!0),d("startTime",o,u.NUMBER),d("endTime",a,u.NUMBER),d("offset",s,u.NUMBER),d("limit",r,u.NUMBER),d("callback",c,u.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,t)):(this.logger.error(l.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.STRING,!0),d("timestamp",n,u.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;d("conversationType",e,u.NUMBER,!0),d("targetId",t,u.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.prototype.getRTCUserInfoList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(o){var s=o.code,r=o.data;if(s!==a.SUCCESS)n.logger.warn(l.O,"getRTCUserInfoList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s);else{var c=null==r?void 0:r.users;t.onSuccess(c)}})).catch((function(o){n.logger.warn(l.O,"getRTCUserInfoList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.getRTCUserList=function(e,t){var n=this;this.logger.info(l.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCUserList ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCUserList ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(t||{}))),this._context.setRTCUserInfo(e.id,t.key,t.value).then((function(s){s!==a.SUCCESS?(o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(s,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(s)):n.onSuccess(!0)})).catch((function(a){o.logger.warn(l.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(t.key,",value:").concat(t.value)),n.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,t,n){var o=this;this.logger.info(l.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(t.keys)),this._context.removeRTCUserInfo(e.id,t.keys).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"removeRTCUserInfo ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"removeRTCUserInfo ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e.prototype.getRTCRoomInfo=function(e,t){var n=this;this.logger.info(l.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCRoomInfo ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCRoomInfo ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCRoomInfo=function(e,t,n){throw h("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,t,n){throw h("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"joinRTCRoom ->roomId:".concat(e.id));var o=e.mode||0;this._context.joinRTCRoom(e.id,o).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"joinRTCRoom ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"joinRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.quitRTCRoom=function(e,t){var n=this;this.logger.info(l.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(o){o!==a.SUCCESS?(n.logger.warn(l.O,"quitRTCRoom ->code:".concat(o,",roomId:").concat(e.id)),t.onError(o)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"quitRTCRoom ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.RTCPing=function(e,t){var n=this;this.logger.info(l.O,"RTCPing ->roomId:".concat(e.id));var o=e.mode||0;this._context.rtcPing(e.id,o).then((function(o){var s=o.code;s!==a.SUCCESS?(n.logger.warn(l.O,"RTCPing ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(!0)})).catch((function(o){n.logger.warn(l.O,"RTCPing ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCData=function(e,t,n,o,s,r,c){var i=this;this.logger.info(l.O,"setRTCData ->roomId:".concat(e,",key:").concat(t)),this._context.setRTCData(e,t,n,o,s,c).then((function(t){t!==a.SUCCESS?(i.logger.warn(l.O,"setRTCData ->code:".concat(t,",roomId:").concat(e)),r.onError(t)):r.onSuccess(!0)})).catch((function(t){i.logger.warn(l.O,"setRTCData ->error:".concat(t,",roomId:").concat(e)),r.onError(t)}))},e.prototype.getRTCData=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"getRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.getRTCData(e,t,n,o).then((function(t){var n=t.code,o=t.data;n!==a.SUCCESS?(r.logger.warn(l.O,"getRTCData ->code:".concat(n,",roomId:").concat(e)),s.onError(n)):s.onSuccess(o)})).catch((function(t){r.logger.warn(l.O,"setRTCUserInfo ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.removeRTCData=function(e,t,n,o,s,r){var c=this;this.logger.info(l.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(t)),this._context.removeRTCData(e,t,n,o,r).then((function(t){t!==a.SUCCESS?(c.logger.warn(l.O,"removeRTCData ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){c.logger.warn(l.O,"removeRTCData ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.setRTCUserData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.PERSON,a,s)},e.prototype.setRTCUserTotalRes=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,t,n,o).then((function(t){t!==a.SUCCESS?(r.logger.warn(l.O,"setRTCUserTotalRes ->code:".concat(t,",roomId:").concat(e)),s.onError(t)):s.onSuccess(!0)})).catch((function(t){r.logger.warn(l.O,"setRTCUserTotalRes ->error:".concat(t,",roomId:").concat(e)),s.onError(t)}))},e.prototype.getRTCUserData=function(e,t,n,o){this.getRTCData(e,t,n,f.PERSON,o)},e.prototype.removeRTCUserData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.PERSON,o,a)},e.prototype.setRTCRoomData=function(e,t,n,o,a,s){this.setRTCData(e,t,n,o,f.ROOM,a,s)},e.prototype.getRTCRoomData=function(e,t,n,o){this.getRTCData(e,t,n,f.ROOM,o)},e.prototype.removeRTCRoomData=function(e,t,n,o,a){this.removeRTCData(e,t,n,f.ROOM,o,a)},e.prototype.setRTCOutData=function(e,t,n,o,a){throw h("setRTCOutData")},e.prototype.getRTCOutData=function(e,t,n){throw h("getRTCOutData")},e.prototype.getRTCToken=function(e,t){var n=this;this.logger.info(l.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(o){var s=o.code,r=o.data;s!==a.SUCCESS?(n.logger.warn(l.O,"getRTCToken ->code:".concat(s,",roomId:").concat(e.id)),t.onError(s)):t.onSuccess(r)})).catch((function(o){n.logger.warn(l.O,"getRTCToken ->error:".concat(o,",roomId:").concat(e.id)),t.onError(o)}))},e.prototype.setRTCState=function(e,t,n){var o=this;this.logger.info(l.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,t.report).then((function(t){t!==a.SUCCESS?(o.logger.warn(l.O,"setRTCState ->code:".concat(t,",roomId:").concat(e.id)),n.onError(t)):n.onSuccess(!0)})).catch((function(t){o.logger.warn(l.O,"setRTCState ->error:".concat(t,",roomId:").concat(e.id)),n.onError(t)}))},e}(),Se=[],me=[],ve={message:function(e){Se.forEach((function(t){return t(se(e))}))},status:function(e){me.forEach((function(t){return t(e)}))}},Ie=1;C.add("imlib-v2-adapter","5.6.2-alpha.1");var Re,ye=null,Me={init:function(e,t,n){void 0===n&&(n={}),d("appkey",e,u.STRING,!0),le=p.init($,{appkey:e,apiVersion:"5.6.2-alpha.1",navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,checkCA:n.checkCA,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(ye=le.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),ye.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Ie=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ue=new pe(le,{readReceiptTimeout:Ie},ye)},getInstance:function(){return ue},setConnectionStatusListener:function(e){null==ye||ye.createTraceId(),le.assignWatcher({connectionState:function(t){ee.clear(),e.onChanged(t)}})},setOnReceiveMessageListener:function(e){le.assignWatcher({message:function(t,n,o){try{var a=se(t),s=le.getCurrentUserId(),r=le.getConnectedTime();re(a,s,r,Ie),a=function(e,t,n,o){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var s=e.content,r=((s=s||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=oe.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,oe.set(c,i));s.receiptMessageDic[t]=g,e.content=s}return e}(a,s,r,Ie),g()||ee.set(t),e.onReceived(a,void 0,o)}catch(e){null==ye||ye.error(l.O,"setOnReceiveMessageListener -> error:".concat(e))}}})},setConversationStatusListener:function(e){le.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==ye||ye.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){le.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==ye||ye.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){le.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ye||ye.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){le.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ye||ye.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){le.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ye||ye.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){le.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==ye||ye.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){le.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){le.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){le.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==ye||ye.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){le.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==ye||ye.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return M(this,void 0,void 0,(function(){var o,s,r,c;return T(this,(function(i){switch(i.label){case 0:return o=null==ye?void 0:ye.createTraceId(),null==ye||ye.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,le.connect(e,!1,n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==ye||ye[r](l.A_CONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===a.SUCCESS?(t.onSuccess(s.userId),c=new Date(le.getConnectedTime()-1e3*Ie*60*60*24).getTime(),oe.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=oe.get(e).dealtime;t&&c-t>0&&oe.remove(e)}else if(/RECEIVED$/.test(e)){var n=oe.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&c-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?oe.remove(e):oe.set(e,n))}}))):s.code===a.RC_CONN_USER_OR_PASSWD_ERROR?(null==ye||ye.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onTokenIncorrect()):(null==ye||ye.warn(l.O,"connect ->code:".concat(s.code,",token:").concat(e)),t.onError(s.code)),[2]}}))}))},reconnect:function(e,t,n){var o=null==ye?void 0:ye.createTraceId();null==ye||ye.info(l.A_RECONNECT_T,null,o),le.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==ye||ye[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==ye||ye.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:ne,getMessageObjectName:function(e){var t=y(y({},te),ne);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=de(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,le.registerMessageType(t,n.isPersited,n.isCounted,o)},messageWatch:function(e){var t=this;Se.push((function(n){var o,a;null==ye||ye.info(l.O,"messageWatch ->message:".concat(JSON.stringify(n||{})));try{e(n),null===(a=(o=t._voipProvider).onReceived)||void 0===a||a.call(o,n)}catch(e){null==ye||ye.error(l.O,"messageWatch ->error:".concat(e))}})),le.assignWatcher({rtcInnerWatcher:ve})},statusWatch:function(e){me.push((function(t){null==ye||ye.info(l.O,"statusWatch ->status:".concat(t));try{e(t)}catch(e){null==ye||ye.error(l.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},Te=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},Ee=function(e,t){this.isCounted=e,this.isPersited=t},Oe=de("TextMessage","RC:TxtMsg"),Ue=de("LocationMessage","RC:LBSMsg"),Ne=de("TypingStatusMessage","RC:TypSts"),_e=de("ImageMessage","RC:ImgMsg"),Ae=de("RichContentMessage","RC:ImgTextMsg"),Le=de("VoiceMessage","RC:VcMsg"),Be=de("HQVoiceMessage","RC:HQVCMsg"),we=de("FileMessage","RC:FileMsg"),xe=de("SightMessage","RC:SightMsg"),ke=de("GIFMessage","RC:GIFMsg"),Pe=de("ReadReceiptMessage","RC:ReadNtf"),be=de("ReadReceiptRequestMessage","RC:RRReqMsg"),De=de("RCCombineMessage","RC:CombineMsg"),Ge=function(e,t,n,o,a,s,r,c,i,g,d,u,l,h,f,C,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=f,this.expansion=C,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(Re||(Re={}));var Fe,Ke=de("AcceptMessage","RC:VCAccept"),We=de("RingingMessage","RC:VCRinging"),He=de("SummaryMessage","RC:VCSummary"),je=de("HungupMessage","RC:VCHangup"),Ve=de("InviteMessage","RC:VCInvite"),Je=de("MediaModifyMessage","RC:VCModifyMedia"),qe=de("MemberModifyMessage","RC:VCModifyMem"),Ye=de("lastMessageSendTime","RC:SRSMsg"),Qe=de("ReferenceMessage","RC:ReferenceMsg"),Xe=de("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),ze=de("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Fe||(Fe={}));var $e=Fe,Ze=S;window&&(window.RongIMClient=Me);export{Ke as AcceptMessage,ge as BaseMessage,fe as ChannelClient,Ze as ConnectionState,we as FileMessage,ke as GIFMessage,R as GetChatRoomType,Be as HQVoiceMessage,je as HungupMessage,pe as IMClient,_e as ImageMessage,Ve as InviteMessage,Ue as LocationMessage,Je as MediaModifyMessage,qe as MemberModifyMessage,Te as MentionedInfo,$e as MentionedType,Ge as Message,Ee as MessageTag,ze as PublicServiceMultiRichContentMessage,Xe as PublicServiceRichContentMessage,De as RCCombineMessage,Pe as ReadReceiptMessage,be as ReadReceiptRequestMessage,he as ReadReceiptResponseMessage,Qe as ReferenceMessage,Ae as RichContentMessage,We as RingingMessage,Me as RongIMClient,I as SentStatus,xe as SightMessage,He as SummaryMessage,Ye as SyncReadStatusMessage,Oe as TextMessage,Ne as TypingStatusMessage,Re as VoIPMediaType,Le as VoiceMessage};
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var o,s=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(o||(o={}));var n=o,a=function(){return a=Object.assign||function(e){for(var t,o=1,s=arguments.length;o<s;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function r(e,t,o,s){return new(o||(o=Promise))((function(n,a){function r(e){try{i(s.next(e))}catch(e){a(e)}}function c(e){try{i(s.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}i((s=s.apply(e,t||[])).next())}))}function c(e,t){var o,s,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(c){return function(i){return function(c){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(o=1,s&&(n=2&c[0]?s.return:c[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,c[1])).done)return n;switch(s=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){r.label=c[1];break}if(6===c[0]&&r.label<n[1]){r.label=n[1],n=c;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(c);break}n[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],s=0}finally{o=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}function i(e,t,o){if(o||2===arguments.length)for(var s,n=0,a=t.length;n<a;n++)!s&&n in t||(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}var g=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],o=0,s=t.length;o<s;o++)if(!e[t[o]])return!1;return!0}(uni))},d=g();var u={tag:"browser",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){var t,a=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(o,c),n&&a.setRequestHeader)for(var g in n)a.setRequestHeader(g,n[g]);if(i){a.timeout=s,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==typeof r?JSON.stringify(r):r;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){a.abort(),e({status:a.status||0})}),s),a.send(r)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:d,createWebSocket:function(e,t){var o=new WebSocket(e,t);return o.binaryType="arraybuffer",{onClose:function(e){o.onclose=function(t){var o=t.code,s=t.reason;e(o,s)}},onError:function(e){o.onerror=e},onMessage:function(e){o.onmessage=function(t){e(t.data)}},onOpen:function(e){o.onopen=e},send:function(e){o.send(e)},close:function(e,t){o.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection,o=e.type,s=e.effectiveType,n=o||s||t.NetworkType.UNKONWN;return new Promise((function(e){e(n)}))}},l=g(),C=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},h={setItem:C("setStorageSync"),getItem:C("getStorageSync"),removeItem:C("removeStorageSync"),clear:C("clearStorageSync")},f={tag:"wechat",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:h,sessionStorage:h,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:l,createWebSocket:function(e,t){var o=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},p=g(),R=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var s=my[e]({key:t[0]}).data;return s?JSON.stringify(s):s}catch(e){}}},I={setItem:R("setStorageSync"),getItem:R("getStorageSync"),removeItem:R("removeStorageSync"),clear:R("clearStorageSync")},T={tag:"alipay",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:o,headers:n,timeout:s,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:I,sessionStorage:I,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:p,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},S=g(),m=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return tt[e].apply(tt,t)}catch(e){}}},v={setItem:m("setStorageSync"),getItem:m("getStorageSync"),removeItem:m("removeStorageSync"),clear:m("clearStorageSync")},y={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:S,localStorage:v,sessionStorage:v,httpReq:function(e){return new Promise((function(o){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},M=g(),E=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return swan[e].apply(swan,t)}catch(e){}}},A={setItem:E("setStorageSync"),getItem:E("getStorageSync"),removeItem:E("removeStorageSync"),clear:E("clearStorageSync")},L={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:M,localStorage:A,sessionStorage:A,httpReq:function(e){return new Promise((function(o,s){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))}},O=g(),U=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},N={setItem:U("setStorageSync"),getItem:U("getStorageSync"),removeItem:U("removeStorageSync"),clear:U("clearStorageSync")},_={tag:"jingdong",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:o,headers:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:N,sessionStorage:N,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:O,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},x=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},B={setItem:x("setStorageSync"),getItem:x("getStorageSync"),removeItem:x("removeStorageSync"),clear:x("clearStorageSync")},w={tag:"uniapp",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:B,sessionStorage:B,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var o={complete:function(){},url:e,protocols:t},s=uni.connectSocket(o);return{onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},P=function(e){return e&&e.request&&e.getSystemInfo},k="undefined"!=typeof uni&&P(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return w;case"mp-jd":return _;case"mp-baidu":return L;case"mp-toutiao":return y;case"mp-alipay":return T;case"mp-weixin":return f;default:return u}}():"undefined"!=typeof jd&&P(jd)?_:"undefined"!=typeof my&&P(my)?T:"undefined"!=typeof tt&&P(tt)?y:"undefined"!=typeof swan&&P(swan)?L:"undefined"!=typeof wx&&P(wx)?f:u;function b(e,t,o){return"".concat(e,"_").concat(t,"_").concat(o)}var D=function(){function e(){}return e.set=function(o){if(t.SEND_MESSAGE_TYPE_OPTION[o.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[o.messageType].isPersited){var s=e.get(o.conversationType,o.targetId,o.channelId||"");if(!s||s.sentTime<o.sentTime){var n=b(o.conversationType,o.targetId,o.channelId||"");e.map[n]=o}}},e.get=function(t,o,s){var n=b(t,o,s);return e.map[n]||null},e.remove=function(t,o,s){var n=b(t,o,s);delete e.map[n]},e.clear=function(){e.map={}},e.map={},e}(),G={"RC:TxtMsg":"TextMessage","RC:ImgMsg":"ImageMessage","RC:VcMsg":"VoiceMessage","RC:ImgTextMsg":"RichContentMessage","RC:ReferenceMsg":"ReferenceMessage","RC:FileMsg":"FileMessage","RC:HQVCMsg":"HQVoiceMessage","RC:GIFMsg":"GIFMessage","RC:SightMsg":"SightMessage","RC:LBSMsg":"LocationMessage","RC:InfoNtf":"InformationNotificationMessage","RC:ContactNtf":"ContactNotificationMessage","RC:ProfileNtf":"ProfileNotificationMessage","RC:CmdNtf":"CommandNotificationMessage","RC:DizNtf":"DiscussionNotificationMessage","RC:CmdMsg":"CommandMessage","RC:TypSts":"TypingStatusMessage","RC:CsChaR":"ChangeModeResponseMessage","RC:CsHsR":"HandShakeResponseMessage","RC:CsEnd":"TerminateMessage","RC:CsSp":"SuspendMessage","RC:CsUpdate":"CustomerStatusUpdateMessage","RC:ReadNtf":"ReadReceiptMessage","RC:VCAccept":"AcceptMessage","RC:VCRinging":"RingingMessage","RC:VCSummary":"SummaryMessage","RC:VCHangup":"HungupMessage","RC:VCInvite":"InviteMessage","RC:VCModifyMedia":"MediaModifyMessage","RC:VCModifyMem":"MemberModifyMessage","RC:CsContact":"CustomerContact","RC:PSImgTxtMsg":"PublicServiceRichContentMessage","RC:PSMultiImgTxtMsg":"PublicServiceMultiRichContentMessage","RC:GrpNtf":"GroupNotificationMessage","RC:PSCmd":"PublicServiceCommandMessage","RC:RcCmd":"RecallCommandMessage","RC:SRSMsg":"SyncReadStatusMessage","RC:RRReqMsg":"ReadReceiptRequestMessage","RC:RRRspMsg":"ReadReceiptResponseMessage","RCJrmf:RpMsg":"JrmfRedPacketMessage","RCJrmf:RpOpendMsg":"JrmfRedPacketOpenedMessage","RC:CombineMsg":"RCCombineMessage","RC:chrmKVNotiMsg":"ChrmKVNotificationMessage","RC:LogCmdMsg":"LogCommandMessage","RC:MsgExMsg":"ExpansionCommandMessage","RC:RRMsg":"GroupReadReceiptResponseMessage"},F={},K=new t.AppStorage(k,"API-V2");function H(e){var o=e.channelId,s=e.conversationType,n=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var d=D.get(s,n,o||"");r?d&&r.sentTime<d.sentTime&&(r=d):r=d}var u=r?j(r):null;return{channelId:o||"",conversationType:s,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:g}}function j(e){var o=e.conversationType,n=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,d=e.isOffLineMessage,u=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,p=e.expansion,R=e.messageId,I=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,m=e.pushConfig,v="";return c in G?v=G[c]:c in F?v=F[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},v="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===R&&(R=~~(16777215*Math.random())),{channelId:T||"",conversationType:o,targetId:n,senderUserId:a,content:r,messageType:v,messageUId:i,messageDirection:g,offLineMessage:d,sentTime:u,receivedStatus:l,receivedTime:C,objectName:c,messageId:R,sentStatus:I||s.SENT,disableNotification:f,canIncludeExpansion:h,expansion:p,readReceiptInfo:S,pushConfig:m}}function W(e,o,s,n){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&a&&c===t.MessageDirection.SEND){var i="".concat(o).concat(e.content.messageUId,"SENT");K.set(i,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&a){var g="".concat(o).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=K.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,K.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,K.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},K.set(g,l)}}}function V(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}function q(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}var J=function(e,t,o,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0),this.messageType=e,this.objectName=t,this.content=o,this.isPersited=s,this.isCounted=n};function Y(e,t,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0);var n=function(n){return new J(e,t,n,o,s)};return n.MessageType=e,n.ObjectName=t,n}var Q,X,z=Y("ReadReceiptResponseMessage","RC:RRRspMsg"),$=function(){function e(e,t,o,s,n){this.logger=e,this._context=t,this.channelId=o,this._isCPPMode=s,this._readReceiptTimeout=n,this._storage=K,this._draftMap={}}return e.prototype.getConversationList=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("count",s,t.AssertRules.NUMBER),this._context.getConversationList(s,void 0,0,0,this.channelId).then((function(s){var a=s.code,r=s.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(o?r.forEach((function(e){o.indexOf(e.conversationType)>-1&&c.push(H(e))})):r.forEach((function(e){c.push(H(e))})),V(e.onSuccess,c)):(n.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),q(e.onError,a))}))},e.prototype.getConversation=function(e,o,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(o,",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,o,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(o)),s.onError(a),[2]):(s.onSuccess(r?H(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(o,",conversationType:").concat(e)),this._context.removeConversation(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||D.remove(e,o,n.channelId),V(s.onSuccess)):(n.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(o)),q(s.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,o,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("draftText",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&((this._draftMap[n]=this._draftMap[n]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]=s,!0)},e.prototype.getTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();if(s)return(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();return!!s&&delete(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(o)),this._context.getTotalUnreadCount(this.channelId,o,s).then((function(o){var s=o.code,a=o.data;s===t.ErrorCode.SUCCESS?V(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(s)),q(e.onError,s))}))},e.prototype.getUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadCount(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?V(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(o)),q(s.onError,a))}))},e.prototype.clearConversations=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(o)),this._isCPPMode?this._context.clearConversations(o,this.channelId).then((function(o){o===t.ErrorCode.SUCCESS?V(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(o)),q(e.onError,o))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCount(e,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?V(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(o)),q(s.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(s){s===t.ErrorCode.SUCCESS?V(e.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(s)),q(e.onError,s))}))},e.prototype.getFirstUnreadMessage=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,o,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?V(s.onSuccess,e.data?j(e.data):null):(n.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(o)),q(s.onError,e.code))}))},e.prototype.setConversationStatus=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("status",s,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(o,",status:").concat(s));var r=s.isTop,c=s.notificationStatus;this._context.setConversationStatus(e,o,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?V(n.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(o)),q(n.onError,e))}))},e.prototype.sendMessage=function(e,o,n,r,c,i,g,d){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,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",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==d?void 0:d.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==d?void 0:d.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==d?void 0:d.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==d?void 0:d.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==d?void 0:d.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==d?void 0:d.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==d?void 0:d.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var l=!(!(null==d?void 0:d.isStatusMessage)&&!(null==d?void 0:d.isStatus)),C=function(e,t,o){var s,n=e||{},a=n.userIds,r=n.isVoipPush,c=n.disableNotification,i=n.isFilerWhiteBlacklist,g=n.expansion,d=n.canIncludeExpansion,u=n.pushConfig,l=n.resendMessageId,C=[];if(t){var h=(o||{}).content.mentionedInfo;C=h.userIdList,s=h.type}return{mentionedType:s,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(d,c,n),h=Object.assign(n,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:l})),f=this._context.getCurrentUserId(),p=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:o,channelId:this.channelId}),p),this._context.sendMessage(e,o,h,r.onBefore,p).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),p),c===t.ErrorCode.SUCCESS){u._isCPPMode||D.set(i);var C=j(i);W(C,f,u._context.getConnectedTime(),u._readReceiptTimeout),V(r.onSuccess,C)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(o)),q(r.onError,c,j({isMentioned:!!h.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==d?void 0:d.disableNotification),canIncludeExpansion:!!(null==d?void 0:d.canIncludeExpansion),expansion:(null==d?void 0:d.expansion)||null,conversationType:e,targetId:o,senderUserId:f,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,messageId:null==i?void 0:i.messageId,sentStatus:s.FAILED}))}))},e.prototype.sendRecallMessage=function(e,o,s){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",o,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==s?void 0:s.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==s?void 0:s.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==s?void 0:s.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var d=a({channelId:this.channelId},s);this._context.recallMessage(r,c,i,g,d).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?(n._isCPPMode||D.set(a),V(o.onSuccess,j(a))):(n.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(s,",targetId:").concat(c,",messageUId:").concat(i)),q(o.onError,s))}))},e.prototype.sendTypingStatusMessage=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("typingContentType",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(o,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:s},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:o,channelId:r.channelId}),c),this._context.sendMessage(e,o,r,void 0,c).then((function(e){var s=e.code,r=e.data,i=s===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),s===t.ErrorCode.SUCCESS?V(n.onSuccess,j(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(s,",targetId:").concat(o)),q(n.onError,s))}))},e.prototype.sendReceiptResponse=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(o,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(o,"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 s.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var a=i.splice(0,1)[0],g=new z({receiptMessageDic:a});n.sendMessage(e,o,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,n._storage.set(r,c),V(s.onSuccess,e)},onError:function(e){n.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(o)),q(s.onError,e)}})}),200)}else s.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,o,s){var n=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(o,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(o,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(a)}))},e.prototype.getMessageReader=function(e,o,s){var n=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(o,",messageUId:").concat(e)),this._context.getMessageReader(o,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?s.onSuccess(c):(n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(a)}))},e.prototype.updateMessageExpansion=function(e,o,s){var n=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.canIncludeExpansion,g=o.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 o=e.code;o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),q(s.onError,o))}))},e.prototype.removeMessageExpansionForKey=function(e,o,s){var n=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.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 o=e.code;o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),q(s.onError,o))}))},e.prototype.getHistoryMessages=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,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(o,",conversationType:").concat(e,",timestamp:").concat(s));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:o,conversationType:e,channelId:"",timestamp:s,count:n}),g),this._context.getHistoryMessage(e,o,s,n,c,this.channelId,r,g).then((function(e){var o=e.code,s=e.data;if(o===t.ErrorCode.SUCCESS)if(s){var n=s.list,r=s.hasMore,c=[],d=n.map((function(e){return c.push(e.messageUId),j(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:c.join(",")}),g),V(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),V(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),q(a.onError,o)}))},e.prototype.deleteRemoteMessages=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("messages",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,o,s,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=D.get(e,o,a.channelId);c&&s.forEach((function(t){c.messageUId===t.messageUId&&D.remove(e,o,a.channelId)}))}V(n.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(o)),q(n.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,o){var s=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",o,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?V(o.onSuccess):(s.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),q(o.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?V(e.onSuccess,n.map(H)):q(e.onError,s)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,o,s){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",o,t.AssertRules.NUMBER),t.assert("limit",s,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(o,s).then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?V(e.onSuccess,n.map(H)):q(e.onError,s)}))},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={});var c=s.senderUserId,i=s.objectName,g=s.content,d=s.messageDirection;s.messageUId;var u=s.canIncludeExpansion,l=s.expansion,C=s.disableNotification,h=s.sentTime,f=s.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e));var p=a.isUnread,R={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:h,sentStatus:f,searchContent:a.searchContent,isUnread:p,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,o,R).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?V(n.onSuccess,j(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(s,",targetId:").concat(o)),q(n.onError,s))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(o,",conversationType:").concat(e,",timestamp:").concat(s)),this._context.deleteMessagesByTimestamp(e,o,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?V(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(o)),q(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(o,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,o,s,n,i,this.channelId).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var r=n.list,i=n.hasMore,g=r.map((function(e){return j(e)}));V(a.onSuccess,g,i)}else V(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(s,",targetId:").concat(o)),q(a.onError,s)}))},e.prototype.clearMessages=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearMessages(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||D.remove(e,o,n.channelId),V(s.onSuccess,!0)):(n.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(o)),q(s.onError,a))}))},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,n,this.channelId,s).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(H(e))})),V(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(n,",keyword:").concat(e)),q(o.onError,n))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,s,n).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(H(e))})),V(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(n,",keyword:").concat(e)),q(o.onError,n))}))},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(o,",conversationType:").concat(e,",keyword:").concat(s)),this._context.searchMessageByContent(e,o,s,n,a,r,this.channelId).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var r=n=n||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(j(e))})),V(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(s,",targetId:").concat(o)),q(c.onError,s)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", timestamp: ").concat(n,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,o,s,n,a).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var i=n=n||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(j(e))})),V(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(s,",targetId:").concat(o)),q(r.onError,s)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", startTime: ").concat(n,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,o,s,n,a,r,c).then((function(e){var s=e.code,n=e.data,a=[];s===t.ErrorCode.SUCCESS?((n=n||{}).messages.forEach((function(e){a.push(j(e))})),V(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(s,",targetId:").concat(o)),q(i.onError,s))}))},e.prototype.getUnreadMentionedMessages=function(e,o){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,o,this.channelId).map((function(e){return j(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,o,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?V(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(o)),q(n.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?V(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(o)),q(s.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(o)),this._context.getGroupMessageDeliverList(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?V(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(o)),q(s.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,o){var s=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?V(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),q(o.onError,a))}))},e}(),Z=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},ee=function(){function e(e,o,s){this._context=e,this._options=o,this.logger=s,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new $(this.logger,e,"",this._isCPPMode,o.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,o,s){if(!this._isCPPMode)return null==s||s.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(o,"' 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 o=new $(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=o,o},e.prototype.deleteChannels=function(e){var o=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 o._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.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,o){this._defaultChannelClient.getConversationList(e,t,o)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,o){void 0===o&&(o=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,o)},e.prototype.getConversation=function(e,t,o){return this._defaultChannelClient.getConversation(e,t,o)},e.prototype.removeConversation=function(e,t,o){return this._defaultChannelClient.removeConversation(e,t,o)},e.prototype.saveTextMessageDraft=function(e,t,o){return this._defaultChannelClient.saveTextMessageDraft(e,t,o)},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,o){return this._defaultChannelClient.getTotalUnreadCount(e,t,o)},e.prototype.getUnreadCount=function(e,t,o){return this._defaultChannelClient.getUnreadCount(e,t,o)},e.prototype.getConversationUnreadCount=function(e,o){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,o){this._defaultChannelClient.clearUnreadCount(e,t,o)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,o,s){return this._defaultChannelClient.setConversationStatus(e,t,o,s)},e.prototype.sendMessage=function(e,t,o,s,n,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,o,s,n,a,r,i)},e.prototype.sendRecallMessage=function(e,t,o){return this._defaultChannelClient.sendRecallMessage(e,t,o)},e.prototype.sendTypingStatusMessage=function(e,t,o,s){return this._defaultChannelClient.sendTypingStatusMessage(e,t,o,s)},e.prototype.sendReceiptResponse=function(e,t,o){return this._defaultChannelClient.sendReceiptResponse(e,t,o)},e.prototype.sendReadReceiptMessage=function(e,t,o){return this._defaultChannelClient.sendReadReceiptMessage(e,t,o)},e.prototype.getMessageReader=function(e,t,o){this._defaultChannelClient.getMessageReader(e,t,o)},e.prototype.updateMessageExpansion=function(e,t,o){this._defaultChannelClient.updateMessageExpansion(e,t,o)},e.prototype.removeMessageExpansionForKey=function(e,t,o){this._defaultChannelClient.removeMessageExpansionForKey(e,t,o)},e.prototype.getHistoryMessages=function(e,t,o,s,n,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,o,s,n,a,r)},e.prototype.joinChatRoom=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",s,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:o,joinExist:!1}),a),this._context.joinChatroom(e,o,a).then((function(o){var r=o===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:o,timestamp:(new Date).getTime()}),a),o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(o,",chatRoomId:").concat(e)),q(s.onError,o))}))},e.prototype.quitChatRoom=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,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";s.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),n),a===t.ErrorCode.SUCCESS?V(o.onSuccess):(s.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),q(o.onError,a))}))},e.prototype.getChatRoomInfo=function(e,o,s,n){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,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,o,s).then((function(o){var s=o.code,r=o.data;s===t.ErrorCode.SUCCESS?V(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(s,",chatRoomId:").concat(e)),q(n.onError,s))}))},e.prototype.setChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),q(s.onError,o))}))},e.prototype.setChatRoomEntries=function(e,o,s){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)}(o),t.assert("callback",s,t.AssertRules.CALLBACK),o.entries.length>10)q(s.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,o).then((function(e){var o=e.code,r=e.data;o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(o,",").concat(a)),q(s.onError,o,r))}))}},e.prototype.forceSetChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),q(s.onError,o))}))},e.prototype.removeChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),q(s.onError,o))}))},e.prototype.removeChatRoomEntries=function(e,o,s){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)}))}(o);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},o);c.entries=o.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(o,",").concat(r)),q(s.onError,o,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?V(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),q(s.onError,o))}))},e.prototype.getChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(o)),this._context.getChatroomEntry(e,o).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?V(s.onSuccess,r||""):(n.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),q(s.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,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?V(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),q(o.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,o,s,n,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,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,o,s,a).then((function(o){var s=o.code,a=o.data;if(s===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return j(e)}));V(n.onSuccess,g,i)}else V(n.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(s,",chatRoomId:").concat(e)),q(n.onError,s)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,o,s){return this._defaultChannelClient.deleteRemoteMessages(e,t,o,s)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,o,s,n,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(s,",queryString:").concat(a)),this._context.getFileToken(e,s,n,a).then(o.onSuccess).catch(o.onError)},e.prototype.getFileUrl=function(e,o,s,n,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",o,t.AssertRules.STRING,!0),t.assert("saveName",s,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(o)),this._context.getFileUrl(e,o,s,a,r).then(n.onSuccess).catch(n.onError)},e.prototype.createTag=function(e,o){var s=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",o,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?o.onSuccess():(s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.removeTag=function(e,o){var s=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",o,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?o.onSuccess():(s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n)}))},e.prototype.updateTag=function(e,o){var s=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",o,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?o.onSuccess():(s.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.getTagList=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(o.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(n)),e.onError(n))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(s)),e.onError(s)}))},e.prototype.getTagsForConversation=function(e,o){var s=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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Z(e)).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?o.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(n)),o.onError(n))})).catch((function(e){s.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),o.onError(e)}))},e.prototype.addTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return Z(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return Z(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagsForConversation=function(e,o,s){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",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(o,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Z(e),o).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(o)),s.onError(a))})).catch((function(e){n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(o)),s.onError(e)}))},e.prototype.getConversationListByTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("startTime",s,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,s,o).then((function(o){var s=o.code,r=o.data,c=[];s===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,o=e.conversationType,s=e.targetId,n=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?j(a):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:o,targetId:s,unreadMessageCount:n,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),n.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.getUnreadCountByTag=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",o,t.AssertRules.BOOLEAN,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,o).then((function(o){var a=o.code,r=o.data;n.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?s.onSuccess(r||0):(n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.setConversationStatusInTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",o.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",o.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",o.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==s?void 0:s.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(o.targetId,",type").concat(o.type)),this._context.setConversationStatusInTag(e,Z(o),s).then((function(o){var s=o.code;o.data,s===t.ErrorCode.SUCCESS?n.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.callExtra=function(e,o){for(var s,n=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(s=this._context).callExtra.apply(s,i([e],a,!1)).then((function(s){var a=s.code,r=s.data;if(a!==t.ErrorCode.SUCCESS)n.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),o.onError&&q(o.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?j(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return j(e)}));return void V(o.onSuccess,d,g)}o.onSuccess&&V(o.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,o){t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){V(o.onSuccess,!1)}),"hasRemoteUnreadMessages",o)},e.prototype.setUserStatusListener=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){s._context.setUserStatusListener(e,o)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,o){var s=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){s._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?V(o.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),q(o.onError,e))}))}),"setUserStatus",o)},e.prototype.getUserStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getUserStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?V(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),q(o.onError,a))}))}),"getUserStatus",o)},e.prototype.addToBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.addToBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?V(o.onSuccess):(s.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(n,",useerId:").concat(e)),q(o.onError,n))}))}),"addToBlacklist",o)},e.prototype.removeFromBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.removeFromBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?V(o.onSuccess):(s.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(n,",useerId:").concat(e)),q(o.onError,n))}))}),"removeFromBlacklist",o)},e.prototype.getBlacklist=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._context.getBlacklist().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?V(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(n)),q(e.onError,n))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getBlacklistStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?V(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),q(o.onError,a))}))}),"getBlacklistStatus",o)},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("content.senderUserId",s.senderUserId,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e,",senderUserId:").concat(s.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,o,s,n,a)}),"insertMessage",n)},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,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,o,s,n,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,o,s,n){var a=this;t.assert("messageIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(s)),this.assertCPPMode((function(){a._context.deleteMessages(s).then((function(e){e===t.ErrorCode.SUCCESS?V(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(s)),q(n.onError,e))}))}),"deleteLocalMessages",n)},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,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,o,s,n,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.clearMessages(e,o,s)}),"clearMessages",s)},e.prototype.getMessage=function(e,o){var s=this;t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getMessage(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?V(o.onSuccess,j(r)):(s.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),q(o.onError,a))}))}),"getMessage",o)},e.prototype.setMessageSentStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageSentStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?V(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(o,",messageId:").concat(e)),q(s.onError,o))}))}),"setMessageSentStatus",s)},e.prototype.setMessageReceivedStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageReceivedStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?V(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(o,",messageId:").concat(e)),q(s.onError,o))}))}),"setMessageReceivedStatus",s)},e.prototype.setMessageContent=function(e,o,s,n){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",s,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:s})),a._context.setMessageContent(e,o,s).then((function(e){e===t.ErrorCode.SUCCESS?V(n.onSuccess,!0):q(n.onError,e)}))}),"setMessageContent",n)},e.prototype.setMessageSearchField=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(s)),this.assertCPPMode((function(){n._context.setMessageSearchField(e,o,s)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,o,s,n)}),"searchConversationByContent",o)},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",s,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,o,s,n)}),"searchConversationByContentWithAllChannel",o)},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,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,o,s,n,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,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,o,s,n,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,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,o,s,n,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,o){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,o)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,o,s,n)}),"clearUnreadCountByTimestamp",n)},e.prototype.getFirstUnreadMessage=function(e,t,o){return this._defaultChannelClient.getFirstUnreadMessage(e,t,o)},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.assertCPPMode((function(){n._defaultChannelClient.getConversationNotificationStatus(e,o,s)}),"getConversationNotificationStatus",s)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,o){this._defaultChannelClient.getGroupMessageDeliverList(e,t,o)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e.prototype.getRTCUserInfoList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a);else{var c=null==r?void 0:r.users;o.onSuccess(c)}})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.getRTCUserList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCUserList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(o||{}))),this._context.setRTCUserInfo(e.id,o.key,o.value).then((function(a){a!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)):s.onSuccess(!0)})).catch((function(a){n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(o.keys)),this._context.removeRTCUserInfo(e.id,o.keys).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e.prototype.getRTCRoomInfo=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCRoomInfo=function(e,o,s){throw t.todo("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,o,s){throw t.todo("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"joinRTCRoom ->roomId:".concat(e.id));var n=e.mode||0;this._context.joinRTCRoom(e.id,n).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"joinRTCRoom ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"joinRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.quitRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(n){n!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"quitRTCRoom ->code:".concat(n,",roomId:").concat(e.id)),o.onError(n)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"quitRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.RTCPing=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"RTCPing ->roomId:".concat(e.id));var n=e.mode||0;this._context.rtcPing(e.id,n).then((function(n){var a=n.code;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"RTCPing ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"RTCPing ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCData=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"setRTCData ->roomId:".concat(e,",key:").concat(o)),this._context.setRTCData(e,o,s,n,a,c).then((function(o){o!==t.ErrorCode.SUCCESS?(i.logger.warn(t.LogTagId.O,"setRTCData ->code:".concat(o,",roomId:").concat(e)),r.onError(o)):r.onSuccess(!0)})).catch((function(o){i.logger.warn(t.LogTagId.O,"setRTCData ->error:".concat(o,",roomId:").concat(e)),r.onError(o)}))},e.prototype.getRTCData=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"getRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.getRTCData(e,o,s,n).then((function(o){var s=o.code,n=o.data;s!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"getRTCData ->code:".concat(s,",roomId:").concat(e)),a.onError(s)):a.onSuccess(n)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserInfo ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.removeRTCData=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.removeRTCData(e,o,s,n,r).then((function(o){o!==t.ErrorCode.SUCCESS?(c.logger.warn(t.LogTagId.O,"removeRTCData ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){c.logger.warn(t.LogTagId.O,"removeRTCData ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.setRTCUserData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.PERSON,a,r)},e.prototype.setRTCUserTotalRes=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,o,s,n).then((function(o){o!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.getRTCUserData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.PERSON,n)},e.prototype.removeRTCUserData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.PERSON,n,a)},e.prototype.setRTCRoomData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.ROOM,a,r)},e.prototype.getRTCRoomData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.ROOM,n)},e.prototype.removeRTCRoomData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.ROOM,n,a)},e.prototype.setRTCOutData=function(e,o,s,n,a){throw t.todo("setRTCOutData")},e.prototype.getRTCOutData=function(e,o,s){throw t.todo("getRTCOutData")},e.prototype.getRTCToken=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCToken ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCToken ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCState=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,o.report).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCState ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"setRTCState ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e}(),te=[],oe=[],se={message:function(e){te.forEach((function(t){return t(j(e))}))},status:function(e){oe.forEach((function(t){return t(e)}))}},ne=1;t.VersionManage.add("imlib-v2-adapter","5.6.1");var ae,re=null,ce={init:function(e,o,s){void 0===s&&(s={}),t.assert("appkey",e,t.AssertRules.STRING,!0),X=t.APIContext.init(k,{appkey:e,apiVersion:"5.6.1",navigators:s.navi?[s.navi]:[],miniCMPProxy:[],logOutputLevel:s.logOutputLevel,typingExpireTime:s.typingExpireTime,checkCA:s.checkCA,httpInMainProcess:!!s.httpInMainProcess,logExpireTime:s.logExpireTime}),(re=X.createLogger("RC-IM","IM")).setOutputLevel(s.logOutputLevel),re.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:s.navi?[s.navi]:[],typingExpireTime:s.typingExpireTime})),ne=Math.min(15,Math.max(s.readReceiptTimeout||1,1)),Q=new ee(X,{readReceiptTimeout:ne},re)},getInstance:function(){return Q},setConnectionStatusListener:function(e){null==re||re.createTraceId(),X.assignWatcher({connectionState:function(t){D.clear(),e.onChanged(t)}})},setOnReceiveMessageListener:function(e){X.assignWatcher({message:function(o,s,n){try{var a=j(o),r=X.getCurrentUserId(),c=X.getConnectedTime();W(a,r,c,ne),a=function(e,t,o,s){var n=new Date(o-1e3*s*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!n)return e;var a=e.content,r=((a=a||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=K.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,K.set(c,i));a.receiptMessageDic[t]=g,e.content=a}return e}(a,r,c,ne),t.usingCppEngine()||D.set(o),e.onReceived(a,void 0,n)}catch(e){null==re||re.error(t.LogTagId.O,"setOnReceiveMessageListener -> error:".concat(e))}}})},setConversationStatusListener:function(e){X.assignWatcher({conversationState:function(o){try{var s=[];o.forEach((function(e){var t=e.updatedItems,o=e.conversationType,n=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&s.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:n,channelId:a||"",updatedTime:r.time})})),s.length>0&&e.onChanged(s)}catch(e){null==re||re.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){X.assignWatcher({expansion:function(o){try{o.updatedExpansion&&e.onUpdated(o.updatedExpansion),o.deletedExpansion&&e.onDeleted(o.deletedExpansion)}catch(e){null==re||re.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){X.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==re||re.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){X.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==re||re.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){X.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==re||re.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){X.assignWatcher({typingState:function(o){try{e.onChanged(o)}catch(e){null==re||re.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){X.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){X.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){X.assignWatcher({messageDelivered:function(o){try{e.onDelivered(o)}catch(e){null==re||re.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){X.assignWatcher({groupMessageDeliveredStatus:function(o){try{e.onDelivered(o)}catch(e){null==re||re.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,o,s){return r(this,void 0,void 0,(function(){var n,a,r,i;return c(this,(function(c){switch(c.label){case 0:return n=null==re?void 0:re.createTraceId(),null==re||re.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),n),[4,X.connect(e,!1,s,n)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==re||re[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),n),a.code===t.ErrorCode.SUCCESS?(o.onSuccess(a.userId),i=new Date(X.getConnectedTime()-1e3*ne*60*60*24).getTime(),K.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=K.get(e).dealtime;t&&i-t>0&&K.remove(e)}else if(/RECEIVED$/.test(e)){var o=K.get(e),s=Object.keys(o).length;Object.keys(o).forEach((function(e){var t=o[e].dealtime;t&&i-t>0&&delete o[e]})),Object.keys(o).length!==s&&(0===o.length?K.remove(e):K.set(e,o))}}))):a.code===t.ErrorCode.RC_CONN_USER_OR_PASSWD_ERROR?(null==re||re.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onTokenIncorrect()):(null==re||re.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onError(a.code)),[2]}}))}))},reconnect:function(e,o,s){var n=null==re?void 0:re.createTraceId();null==re||re.info(t.LogTagId.A_RECONNECT_T,null,n),X.reconnect(s).then((function(o){var s=o.code===t.ErrorCode.SUCCESS?"info":"warn";null==re||re[s](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:o.code,userId:o.userId}),n),o.code===t.ErrorCode.SUCCESS?e.onSuccess(o.userId):(null==re||re.warn(t.LogTagId.O,"reconnect ->code:".concat(o.code)),e.onError(o.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:F,getMessageObjectName:function(e){var t=a(a({},G),F);return Object.keys(t).find((function(o){return t[o]===e}))||e},registerMessageType:function(e,t,o,s){this.RegisterMessage[e]=Y(e,t,o.isPersited,o.isCounted),this.RegisterMessageTypeMapping[t]=e,X.registerMessageType(t,o.isPersited,o.isCounted,s)},messageWatch:function(e){var o=this;te.push((function(s){var n,a;null==re||re.info(t.LogTagId.O,"messageWatch ->message:".concat(JSON.stringify(s||{})));try{e(s),null===(a=(n=o._voipProvider).onReceived)||void 0===a||a.call(n,s)}catch(e){null==re||re.error(t.LogTagId.O,"messageWatch ->error:".concat(e))}})),X.assignWatcher({rtcInnerWatcher:se})},statusWatch:function(e){oe.push((function(o){null==re||re.info(t.LogTagId.O,"statusWatch ->status:".concat(o));try{e(o)}catch(e){null==re||re.error(t.LogTagId.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},ie=function(e,t,o){this.type=e,this.userIdList=t,this.mentionedContent=o},ge=function(e,t){this.isCounted=e,this.isPersited=t},de=Y("TextMessage","RC:TxtMsg"),ue=Y("LocationMessage","RC:LBSMsg"),le=Y("TypingStatusMessage","RC:TypSts"),Ce=Y("ImageMessage","RC:ImgMsg"),he=Y("RichContentMessage","RC:ImgTextMsg"),fe=Y("VoiceMessage","RC:VcMsg"),pe=Y("HQVoiceMessage","RC:HQVCMsg"),Re=Y("FileMessage","RC:FileMsg"),Ie=Y("SightMessage","RC:SightMsg"),Te=Y("GIFMessage","RC:GIFMsg"),Se=Y("ReadReceiptMessage","RC:ReadNtf"),me=Y("ReadReceiptRequestMessage","RC:RRReqMsg"),ve=Y("RCCombineMessage","RC:CombineMsg"),ye=function(e,t,o,s,n,a,r,c,i,g,d,u,l,C,h,f,p,R){this.conversationType=e,this.targetId=t,this.senderUserId=o,this.content=s,this.objectName=n,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=f,this.receiptResponse=p,this.disableNotification=R};exports.VoIPMediaType=void 0,(ae=exports.VoIPMediaType||(exports.VoIPMediaType={}))[ae.MEDIA_AUDIO=1]="MEDIA_AUDIO",ae[ae.MEDIA_VEDIO=2]="MEDIA_VEDIO",ae[ae.MEDIA_VIDEO=2]="MEDIA_VIDEO";var Me,Ee=Y("AcceptMessage","RC:VCAccept"),Ae=Y("RingingMessage","RC:VCRinging"),Le=Y("SummaryMessage","RC:VCSummary"),Oe=Y("HungupMessage","RC:VCHangup"),Ue=Y("InviteMessage","RC:VCInvite"),Ne=Y("MediaModifyMessage","RC:VCModifyMedia"),_e=Y("MemberModifyMessage","RC:VCModifyMem"),xe=Y("lastMessageSendTime","RC:SRSMsg"),Be=Y("ReferenceMessage","RC:ReferenceMsg"),we=Y("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Pe=Y("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Me||(Me={}));var ke=Me,be=t.ConnectResultCode;window&&(window.RongIMClient=ce),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"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=Ee,exports.BaseMessage=J,exports.ChannelClient=$,exports.ConnectionState=be,exports.FileMessage=Re,exports.GIFMessage=Te,exports.GetChatRoomType=n,exports.HQVoiceMessage=pe,exports.HungupMessage=Oe,exports.IMClient=ee,exports.ImageMessage=Ce,exports.InviteMessage=Ue,exports.LocationMessage=ue,exports.MediaModifyMessage=Ne,exports.MemberModifyMessage=_e,exports.MentionedInfo=ie,exports.MentionedType=ke,exports.Message=ye,exports.MessageTag=ge,exports.PublicServiceMultiRichContentMessage=Pe,exports.PublicServiceRichContentMessage=we,exports.RCCombineMessage=ve,exports.ReadReceiptMessage=Se,exports.ReadReceiptRequestMessage=me,exports.ReadReceiptResponseMessage=z,exports.ReferenceMessage=Be,exports.RichContentMessage=he,exports.RingingMessage=Ae,exports.RongIMClient=ce,exports.SentStatus=s,exports.SightMessage=Ie,exports.SummaryMessage=Le,exports.SyncReadStatusMessage=xe,exports.TextMessage=de,exports.TypingStatusMessage=le,exports.VoiceMessage=fe;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var o,s=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(o||(o={}));var n=o,a=function(){return a=Object.assign||function(e){for(var t,o=1,s=arguments.length;o<s;o++)for(var n in t=arguments[o])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function r(e,t,o,s){return new(o||(o=Promise))((function(n,a){function r(e){try{i(s.next(e))}catch(e){a(e)}}function c(e){try{i(s.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,c)}i((s=s.apply(e,t||[])).next())}))}function c(e,t){var o,s,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(c){return function(i){return function(c){if(o)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(o=1,s&&(n=2&c[0]?s.return:c[0]?s.throw||((n=s.return)&&n.call(s),0):s.next)&&!(n=n.call(s,c[1])).done)return n;switch(s=0,n&&(c=[2&c[0],n.value]),c[0]){case 0:case 1:n=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,s=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(n=r.trys,(n=n.length>0&&n[n.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!n||c[1]>n[0]&&c[1]<n[3])){r.label=c[1];break}if(6===c[0]&&r.label<n[1]){r.label=n[1],n=c;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(c);break}n[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],s=0}finally{o=n=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}"function"==typeof SuppressedError&&SuppressedError;var i=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],o=0,s=t.length;o<s;o++)if(!e[t[o]])return!1;return!0}(uni))},g=i();var d={tag:"browser",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){var t,a=(t="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&t?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),i="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(o,c),n&&a.setRequestHeader)for(var g in n)a.setRequestHeader(g,n[g]);if(i){a.timeout=s,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var d="object"==typeof r?JSON.stringify(r):r;a.send(d)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){a.abort(),e({status:a.status||0})}),s),a.send(r)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var o=new WebSocket(e,t);return o.binaryType="arraybuffer",{onClose:function(e){o.onclose=function(t){var o=t.code,s=t.reason;e(o,s)}},onError:function(e){o.onerror=e},onMessage:function(e){o.onmessage=function(t){e(t.data)}},onOpen:function(e){o.onopen=e},send:function(e){o.send(e)},close:function(e,t){o.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection,o=e.type,s=e.effectiveType,n=o||s||t.NetworkType.UNKONWN;return new Promise((function(e){e(n)}))}},u=i(),l=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},C={setItem:l("setStorageSync"),getItem:l("getStorageSync"),removeItem:l("removeStorageSync"),clear:l("clearStorageSync")},h={tag:"wechat",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:C,sessionStorage:C,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:u,createWebSocket:function(e,t){var o=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},f=i(),p=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var s=my[e]({key:t[0]}).data;return s?JSON.stringify(s):s}catch(e){}}},R={setItem:p("setStorageSync"),getItem:p("getStorageSync"),removeItem:p("removeStorageSync"),clear:p("clearStorageSync")},I={tag:"alipay",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:o,headers:n,timeout:s,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:R,sessionStorage:R,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:f,createWebSocket:function(e){return my.connectSocket({url:e}),{onClose:function(e){my.onSocketClose(e)},onError:function(e){my.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){my.onSocketMessage((function(t){t.isBuffer?e(my.base64ToArrayBuffer(t.data)):e(t.data)}))},onOpen:function(e){my.onSocketOpen(e)},send:function(e){my.sendSocketMessage({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){my.closeSocket()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},T=i(),S=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return tt[e].apply(tt,t)}catch(e){}}},m={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},v={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,localStorage:m,sessionStorage:m,httpReq:function(e){return new Promise((function(o){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},y=i(),M=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return swan[e].apply(swan,t)}catch(e){}}},E={setItem:M("setStorageSync"),getItem:M("getStorageSync"),removeItem:M("removeStorageSync"),clear:M("clearStorageSync")},A={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:y,localStorage:E,sessionStorage:E,httpReq:function(e){return new Promise((function(o,s){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},s={data:JSON.stringify(t),status:e.statusCode};o(s)},fail:function(e){o({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var o=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){o.onOpen(e)},onClose:function(e){o.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){return e(t.data)}))},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))}},L=i(),O=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},U={setItem:O("setStorageSync"),getItem:O("getStorageSync"),removeItem:O("removeStorageSync"),clear:O("clearStorageSync")},N={tag:"jingdong",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:o,headers:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:U,sessionStorage:U,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},_=function(e){return function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},x={setItem:_("setStorageSync"),getItem:_("getStorageSync"),removeItem:_("removeStorageSync"),clear:_("clearStorageSync")},B={tag:"uniapp",httpReq:function(e){var o=e.method||t.HttpMethod.GET,s=e.timeout||t.HTTP_TIMEOUT,n=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:o,header:n,timeout:s,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:x,sessionStorage:x,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var o={complete:function(){},url:e,protocols:t},s=uni.connectSocket(o);return{onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var o=t.networkType;e(o)},fail:function(){e(t.NetworkType.UNKONWN)}})}))}},w=function(e){return e&&e.request&&e.getSystemInfo},P="undefined"!=typeof uni&&w(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return B;case"mp-jd":return N;case"mp-baidu":return A;case"mp-toutiao":return v;case"mp-alipay":return I;case"mp-weixin":return h;default:return d}}():"undefined"!=typeof jd&&w(jd)?N:"undefined"!=typeof my&&w(my)?I:"undefined"!=typeof tt&&w(tt)?v:"undefined"!=typeof swan&&w(swan)?A:"undefined"!=typeof wx&&w(wx)?h:d;function k(e,t,o){return"".concat(e,"_").concat(t,"_").concat(o)}var b=function(){function e(){}return e.set=function(o){if(t.SEND_MESSAGE_TYPE_OPTION[o.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[o.messageType].isPersited){var s=e.get(o.conversationType,o.targetId,o.channelId||"");if(!s||s.sentTime<o.sentTime){var n=k(o.conversationType,o.targetId,o.channelId||"");e.map[n]=o}}},e.get=function(t,o,s){var n=k(t,o,s);return e.map[n]||null},e.remove=function(t,o,s){var n=k(t,o,s);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"},G={},F=new t.AppStorage(P,"API-V2");function K(e){var o=e.channelId,s=e.conversationType,n=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var d=b.get(s,n,o||"");r?d&&r.sentTime<d.sentTime&&(r=d):r=d}var u=r?H(r):null;return{channelId:o||"",conversationType:s,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:g}}function H(e){var o=e.conversationType,n=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,d=e.isOffLineMessage,u=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,p=e.expansion,R=e.messageId,I=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,m=e.pushConfig,v="";return c in D?v=D[c]:c in G?v=G[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},v="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===R&&(R=~~(16777215*Math.random())),{channelId:T||"",conversationType:o,targetId:n,senderUserId:a,content:r,messageType:v,messageUId:i,messageDirection:g,offLineMessage:d,sentTime:u,receivedStatus:l,receivedTime:C,objectName:c,messageId:R,sentStatus:I||s.SENT,disableNotification:f,canIncludeExpansion:h,expansion:p,readReceiptInfo:S,pushConfig:m}}function j(e,o,s,n){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&a&&c===t.MessageDirection.SEND){var i="".concat(o).concat(e.content.messageUId,"SENT");F.set(i,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&a){var g="".concat(o).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=F.get(g);if(d)if(e.senderUserId in d)d[e.senderUserId].uIds&&-1===d[e.senderUserId].uIds.indexOf(e.content.messageUId)&&(d[e.senderUserId].uIds.push(e.content.messageUId),d[e.senderUserId].dealtime=e.sentTime,d[e.senderUserId].isResponse=!1,F.set(g,d));else{var u={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};d[e.senderUserId]=u,F.set(g,d)}else{var l={};l[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},F.set(g,l)}}}function W(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}function V(e,t,o){try{e(t,o)}catch(e){null===console||void 0===console||console.error(e)}}var q=function(e,t,o,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0),this.messageType=e,this.objectName=t,this.content=o,this.isPersited=s,this.isCounted=n};function J(e,t,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0);var n=function(n){return new q(e,t,n,o,s)};return n.MessageType=e,n.ObjectName=t,n}var Y,Q,X=J("ReadReceiptResponseMessage","RC:RRRspMsg"),z=function(){function e(e,t,o,s,n){this.logger=e,this._context=t,this.channelId=o,this._isCPPMode=s,this._readReceiptTimeout=n,this._storage=F,this._draftMap={}}return e.prototype.getConversationList=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("count",s,t.AssertRules.NUMBER),this._context.getConversationList(s,void 0,0,0,this.channelId).then((function(s){var a=s.code,r=s.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(o?r.forEach((function(e){o.indexOf(e.conversationType)>-1&&c.push(K(e))})):r.forEach((function(e){c.push(K(e))})),W(e.onSuccess,c)):(n.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),V(e.onError,a))}))},e.prototype.getConversation=function(e,o,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(o,",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,o,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(o)),s.onError(a),[2]):(s.onSuccess(r?K(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(o,",conversationType:").concat(e)),this._context.removeConversation(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||b.remove(e,o,n.channelId),W(s.onSuccess)):(n.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(o)),V(s.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,o,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("draftText",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&((this._draftMap[n]=this._draftMap[n]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]=s,!0)},e.prototype.getTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();if(s)return(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,o){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(o,",conversationType:").concat(e));var s=this._context.getCurrentUserId();return!!s&&delete(this._draftMap[s]||{})["".concat(e,"_").concat(o,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,o,s){var n=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(o)),this._context.getTotalUnreadCount(this.channelId,o,s).then((function(o){var s=o.code,a=o.data;s===t.ErrorCode.SUCCESS?W(e.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(s)),V(e.onError,s))}))},e.prototype.getUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadCount(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?W(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(o)),V(s.onError,a))}))},e.prototype.clearConversations=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(o)),this._isCPPMode?this._context.clearConversations(o,this.channelId).then((function(o){o===t.ErrorCode.SUCCESS?W(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(o)),V(e.onError,o))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCount(e,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?W(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(o)),V(s.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(s){s===t.ErrorCode.SUCCESS?W(e.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(s)),V(e.onError,s))}))},e.prototype.getFirstUnreadMessage=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,o,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?W(s.onSuccess,e.data?H(e.data):null):(n.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(o)),V(s.onError,e.code))}))},e.prototype.setConversationStatus=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("status",s,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(o,",status:").concat(s));var r=s.isTop,c=s.notificationStatus;this._context.setConversationStatus(e,o,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?W(n.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(o)),V(n.onError,e))}))},e.prototype.sendMessage=function(e,o,n,r,c,i,g,d){var u=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,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",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==d?void 0:d.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==d?void 0:d.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==d?void 0:d.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==d?void 0:d.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==d?void 0:d.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==d?void 0:d.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==d?void 0:d.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(o,",conversationType:").concat(e));var l=!(!(null==d?void 0:d.isStatusMessage)&&!(null==d?void 0:d.isStatus)),C=function(e,t,o){var s,n=e||{},a=n.userIds,r=n.isVoipPush,c=n.disableNotification,i=n.isFilerWhiteBlacklist,g=n.expansion,d=n.canIncludeExpansion,u=n.pushConfig,l=n.resendMessageId,C=[];if(t){var h=(o||{}).content.mentionedInfo;C=h.userIdList,s=h.type}return{mentionedType:s,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:d,pushConfig:u,messageId:l}}(d,c,n),h=Object.assign(n,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:l})),f=this._context.getCurrentUserId(),p=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:o,channelId:this.channelId}),p),this._context.sendMessage(e,o,h,r.onBefore,p).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(u.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:c,messageUId:i?i.messageUId:"",messageId:i?i.messageId:""}),p),c===t.ErrorCode.SUCCESS){u._isCPPMode||b.set(i);var C=H(i);j(C,f,u._context.getConnectedTime(),u._readReceiptTimeout),W(r.onSuccess,C)}else u.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(o)),V(r.onError,c,H({isMentioned:!!h.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==d?void 0:d.disableNotification),canIncludeExpansion:!!(null==d?void 0:d.canIncludeExpansion),expansion:(null==d?void 0:d.expansion)||null,conversationType:e,targetId:o,senderUserId:f,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==i?void 0:i.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,messageId:null==i?void 0:i.messageId,sentStatus:s.FAILED}))}))},e.prototype.sendRecallMessage=function(e,o,s){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",o,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==s?void 0:s.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==s?void 0:s.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==s?void 0:s.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var d=a({channelId:this.channelId},s);this._context.recallMessage(r,c,i,g,d).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?(n._isCPPMode||b.set(a),W(o.onSuccess,H(a))):(n.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(s,",targetId:").concat(c,",messageUId:").concat(i)),V(o.onError,s))}))},e.prototype.sendTypingStatusMessage=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("typingContentType",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(o,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:s},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:o,channelId:r.channelId}),c),this._context.sendMessage(e,o,r,void 0,c).then((function(e){var s=e.code,r=e.data,i=s===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:s,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),s===t.ErrorCode.SUCCESS?W(n.onSuccess,H(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(s,",targetId:").concat(o)),V(n.onError,s))}))},e.prototype.sendReceiptResponse=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(o,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(o,"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 s.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var a=i.splice(0,1)[0],g=new X({receiptMessageDic:a});n.sendMessage(e,o,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,n._storage.set(r,c),W(s.onSuccess,e)},onError:function(e){n.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(o)),V(s.onError,e)}})}),200)}else s.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,o,s){var n=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(o,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(o,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(o,",messageUIds:").concat(e)),s.onError(a)}))},e.prototype.getMessageReader=function(e,o,s){var n=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(o,",messageUId:").concat(e)),this._context.getMessageReader(o,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?s.onSuccess(c):(n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(r))})).catch((function(a){n.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(o,",messageUId:").concat(e)),s.onError(a)}))},e.prototype.updateMessageExpansion=function(e,o,s){var n=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.canIncludeExpansion,g=o.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 o=e.code;o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),V(s.onError,o))}))},e.prototype.removeMessageExpansionForKey=function(e,o,s){var n=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",o,t.AssertRules.OBJECT,!0);var a=o.conversationType,r=o.targetId,c=o.messageUId,i=o.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 o=e.code;o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(o,",targetId:").concat(r,",messageUId:").concat(c)),V(s.onError,o))}))},e.prototype.getHistoryMessages=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,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(o,",conversationType:").concat(e,",timestamp:").concat(s));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:o,conversationType:e,channelId:"",timestamp:s,count:n}),g),this._context.getHistoryMessage(e,o,s,n,c,this.channelId,r,g).then((function(e){var o=e.code,s=e.data;if(o===t.ErrorCode.SUCCESS)if(s){var n=s.list,r=s.hasMore,c=[],d=n.map((function(e){return c.push(e.messageUId),H(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:c.join(",")}),g),W(a.onSuccess,d,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),W(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:o,messageUIds:""}),g),V(a.onError,o)}))},e.prototype.deleteRemoteMessages=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("messages",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,o,s,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=b.get(e,o,a.channelId);c&&s.forEach((function(t){c.messageUId===t.messageUId&&b.remove(e,o,a.channelId)}))}W(n.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(o)),V(n.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,o){var s=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",o,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?W(o.onSuccess):(s.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),V(o.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?W(e.onSuccess,n.map(K)):V(e.onError,s)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,o,s){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",o,t.AssertRules.NUMBER),t.assert("limit",s,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(o,s).then((function(o){var s=o.code,n=o.data;s===t.ErrorCode.SUCCESS?W(e.onSuccess,n.map(K)):V(e.onError,s)}))},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={});var c=s.senderUserId,i=s.objectName,g=s.content,d=s.messageDirection;s.messageUId;var u=s.canIncludeExpansion,l=s.expansion,C=s.disableNotification,h=s.sentTime,f=s.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e));var p=a.isUnread,R={senderUserId:c,messageType:i,content:g,messageDirection:d,sentTime:h,sentStatus:f,searchContent:a.searchContent,isUnread:p,messageUId:"",disableNotification:C,canIncludeExpansion:u,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,o,R).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?W(n.onSuccess,H(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(s,",targetId:").concat(o)),V(n.onError,s))}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(o,",conversationType:").concat(e,",timestamp:").concat(s)),this._context.deleteMessagesByTimestamp(e,o,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?W(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(o)),V(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(o,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,o,s,n,i,this.channelId).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var r=n.list,i=n.hasMore,g=r.map((function(e){return H(e)}));W(a.onSuccess,g,i)}else W(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(s,",targetId:").concat(o)),V(a.onError,s)}))},e.prototype.clearMessages=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearMessages(e,o,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(n._isCPPMode||b.remove(e,o,n.channelId),W(s.onSuccess,!0)):(n.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(o)),V(s.onError,a))}))},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,n,this.channelId,s).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(K(e))})),W(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(n,",keyword:").concat(e)),V(o.onError,n))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,s,n).then((function(s){var n=s.code,r=s.data,c=[];r=r||[],n===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(K(e))})),W(o.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(n,",keyword:").concat(e)),V(o.onError,n))}))},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(o,",conversationType:").concat(e,",keyword:").concat(s)),this._context.searchMessageByContent(e,o,s,n,a,r,this.channelId).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var r=n=n||{},g=r.messages,d=r.count;g.forEach((function(e){a.push(H(e))})),W(c.onSuccess,a,d)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(s,",targetId:").concat(o)),V(c.onError,s)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", timestamp: ").concat(n,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,o,s,n,a).then((function(e){var s=e.code,n=e.data,a=[];if(s===t.ErrorCode.SUCCESS){var i=n=n||{},g=i.messages,d=i.count;g.forEach((function(e){a.push(H(e))})),W(r.onSuccess,a,d)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(s,",targetId:").concat(o)),V(r.onError,s)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(o," ,conversationType: ").concat(e," ,keyword: ").concat(s,", startTime: ").concat(n,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,o,s,n,a,r,c).then((function(e){var s=e.code,n=e.data,a=[];s===t.ErrorCode.SUCCESS?((n=n||{}).messages.forEach((function(e){a.push(H(e))})),W(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(s,",targetId:").concat(o)),V(i.onError,s))}))},e.prototype.getUnreadMentionedMessages=function(e,o){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,o,this.channelId).map((function(e){return H(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(o,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,o,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?W(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(o)),V(n.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(o,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?W(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(o)),V(s.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(o)),this._context.getGroupMessageDeliverList(e,o,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?W(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(o)),V(s.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,o){var s=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?W(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),V(o.onError,a))}))},e}(),$=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},Z=function(){function e(e,o,s){this._context=e,this._options=o,this.logger=s,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new z(this.logger,e,"",this._isCPPMode,o.readReceiptTimeout)}return e.prototype.assertCPPMode=function(e,o,s){if(!this._isCPPMode)return null==s||s.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(o,"' 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 o=new z(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout);return this._channelClient[e]=o,o},e.prototype.deleteChannels=function(e){var o=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 o._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:this._context.apiVersion}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){switch(e.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect()];case 1:return e.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,o){this._defaultChannelClient.getConversationList(e,t,o)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,o){void 0===o&&(o=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,o)},e.prototype.getConversation=function(e,t,o){return this._defaultChannelClient.getConversation(e,t,o)},e.prototype.removeConversation=function(e,t,o){return this._defaultChannelClient.removeConversation(e,t,o)},e.prototype.saveTextMessageDraft=function(e,t,o){return this._defaultChannelClient.saveTextMessageDraft(e,t,o)},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,o){return this._defaultChannelClient.getTotalUnreadCount(e,t,o)},e.prototype.getUnreadCount=function(e,t,o){return this._defaultChannelClient.getUnreadCount(e,t,o)},e.prototype.getConversationUnreadCount=function(e,o){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,o){this._defaultChannelClient.clearUnreadCount(e,t,o)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,o,s){return this._defaultChannelClient.setConversationStatus(e,t,o,s)},e.prototype.sendMessage=function(e,t,o,s,n,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,o,s,n,a,r,i)},e.prototype.sendRecallMessage=function(e,t,o){return this._defaultChannelClient.sendRecallMessage(e,t,o)},e.prototype.sendTypingStatusMessage=function(e,t,o,s){return this._defaultChannelClient.sendTypingStatusMessage(e,t,o,s)},e.prototype.sendReceiptResponse=function(e,t,o){return this._defaultChannelClient.sendReceiptResponse(e,t,o)},e.prototype.sendReadReceiptMessage=function(e,t,o){return this._defaultChannelClient.sendReadReceiptMessage(e,t,o)},e.prototype.getMessageReader=function(e,t,o){this._defaultChannelClient.getMessageReader(e,t,o)},e.prototype.updateMessageExpansion=function(e,t,o){this._defaultChannelClient.updateMessageExpansion(e,t,o)},e.prototype.removeMessageExpansionForKey=function(e,t,o){this._defaultChannelClient.removeMessageExpansionForKey(e,t,o)},e.prototype.getHistoryMessages=function(e,t,o,s,n,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,o,s,n,a,r)},e.prototype.joinChatRoom=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",s,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:o,joinExist:!1}),a),this._context.joinChatroom(e,o,a).then((function(o){var r=o===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:o,timestamp:(new Date).getTime()}),a),o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(o,",chatRoomId:").concat(e)),V(s.onError,o))}))},e.prototype.quitChatRoom=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,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";s.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),n),a===t.ErrorCode.SUCCESS?W(o.onSuccess):(s.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),V(o.onError,a))}))},e.prototype.getChatRoomInfo=function(e,o,s,n){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,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,o,s).then((function(o){var s=o.code,r=o.data;s===t.ErrorCode.SUCCESS?W(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(s,",chatRoomId:").concat(e)),V(n.onError,s))}))},e.prototype.setChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),V(s.onError,o))}))},e.prototype.setChatRoomEntries=function(e,o,s){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)}(o),t.assert("callback",s,t.AssertRules.CALLBACK),o.entries.length>10)V(s.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,o).then((function(e){var o=e.code,r=e.data;o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(o,",").concat(a)),V(s.onError,o,r))}))}},e.prototype.forceSetChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),V(s.onError,o))}))},e.prototype.removeChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),V(s.onError,o))}))},e.prototype.removeChatRoomEntries=function(e,o,s){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)}))}(o);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},o);c.entries=o.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(o,",").concat(r)),V(s.onError,o,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",o,t.AssertRules.OBJECT,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,o).then((function(o){o===t.ErrorCode.SUCCESS?W(s.onSuccess):(n.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(o,",chatRoomId:").concat(e)),V(s.onError,o))}))},e.prototype.getChatroomEntry=function(e,o,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(o)),this._context.getChatroomEntry(e,o).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?W(s.onSuccess,r||""):(n.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),V(s.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,o){var s=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",o,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?W(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),V(o.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,o,s,n,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("order",s,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,o,s,a).then((function(o){var s=o.code,a=o.data;if(s===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return H(e)}));W(n.onSuccess,g,i)}else W(n.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(s,",chatRoomId:").concat(e)),V(n.onError,s)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,o,s){return this._defaultChannelClient.deleteRemoteMessages(e,t,o,s)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,o,s,n,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(s,",queryString:").concat(a)),this._context.getFileToken(e,s,n,a).then(o.onSuccess).catch(o.onError)},e.prototype.getFileUrl=function(e,o,s,n,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",o,t.AssertRules.STRING,!0),t.assert("saveName",s,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(o)),this._context.getFileUrl(e,o,s,a,r).then(n.onSuccess).catch(n.onError)},e.prototype.createTag=function(e,o){var s=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",o,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?o.onSuccess():(s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"createTag ->code:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.removeTag=function(e,o){var s=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",o,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?o.onSuccess():(s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n)}))},e.prototype.updateTag=function(e,o){var s=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",o,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?o.onSuccess():(s.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),o.onError(a))})).catch((function(n){s.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(n,",tagId:").concat(e.tagId)),o.onError(n)}))},e.prototype.getTagList=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(o.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(n)),e.onError(n))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(s)),e.onError(s)}))},e.prototype.getTagsForConversation=function(e,o){var s=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",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation($(e)).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?o.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(n)),o.onError(n))})).catch((function(e){s.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),o.onError(e)}))},e.prototype.addTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return $(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagForConversations=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.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,o.map((function(e){return $(e)}))).then((function(o){var a=o.code;o.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.removeTagsForConversation=function(e,o,s){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",o,t.AssertRules.ARRAY,!0),t.assert("callback",s,t.AssertRules.CALLBACK),o.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(o,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation($(e),o).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(o)),s.onError(a))})).catch((function(e){n.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(o)),s.onError(e)}))},e.prototype.getConversationListByTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("startTime",s,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,s,o).then((function(o){var s=o.code,r=o.data,c=[];s===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,o=e.conversationType,s=e.targetId,n=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?H(a):null,d=g||{};return d.messageType,d.sentTime,d.receivedStatus,d.messageId,{channelId:t||"",conversationType:o,targetId:s,unreadMessageCount:n,latestMessage:g,isTopInTag:i,latestMessageId:null==g?void 0:g.messageId,objectName:null==g?void 0:g.messageType,sentTime:null==g?void 0:g.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==g?void 0:g.receivedStatus}}(e))})),n.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.getUnreadCountByTag=function(e,o,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",o,t.AssertRules.BOOLEAN,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,o).then((function(o){var a=o.code,r=o.data;n.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?s.onSuccess(r||0):(n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.setConversationStatusInTag=function(e,o,s,n){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",o.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",o.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",o.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==s?void 0:s.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(o.targetId,",type").concat(o.type)),this._context.setConversationStatusInTag(e,$(o),s).then((function(o){var s=o.code;o.data,s===t.ErrorCode.SUCCESS?n.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(s,",tagId:").concat(e)),n.onError(s))})).catch((function(o){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(o,",tagId:").concat(e)),n.onError(o)}))},e.prototype.callExtra=function(e,o){for(var s,n=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(s=this._context).callExtra.apply(s,function(e,t,o){if(o||2===arguments.length)for(var s,n=0,a=t.length;n<a;n++)!s&&n in t||(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}([e],a,!1)).then((function(s){var a=s.code,r=s.data;if(a!==t.ErrorCode.SUCCESS)n.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),o.onError&&V(o.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?H(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,d=i.map((function(e){return H(e)}));return void W(o.onSuccess,d,g)}o.onSuccess&&W(o.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,o){t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){W(o.onSuccess,!1)}),"hasRemoteUnreadMessages",o)},e.prototype.setUserStatusListener=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){s._context.setUserStatusListener(e,o)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,o){var s=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){s._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?W(o.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),V(o.onError,e))}))}),"setUserStatus",o)},e.prototype.getUserStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getUserStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?W(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),V(o.onError,a))}))}),"getUserStatus",o)},e.prototype.addToBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.addToBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?W(o.onSuccess):(s.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(n,",useerId:").concat(e)),V(o.onError,n))}))}),"addToBlacklist",o)},e.prototype.removeFromBlacklist=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){s._context.removeFromBlacklist(e).then((function(n){n===t.ErrorCode.SUCCESS?W(o.onSuccess):(s.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(n,",useerId:").concat(e)),V(o.onError,n))}))}),"removeFromBlacklist",o)},e.prototype.getBlacklist=function(e){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._context.getBlacklist().then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?W(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(n)),V(e.onError,n))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,o){var s=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){s._context.getBlacklistStatus(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?W(o.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),V(o.onError,a))}))}),"getBlacklistStatus",o)},e.prototype.insertMessage=function(e,o,s,n,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("content.senderUserId",s.senderUserId,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(o,",conversationType:").concat(e,",senderUserId:").concat(s.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,o,s,n,a)}),"insertMessage",n)},e.prototype.getRemoteHistoryMessages=function(e,o,s,n,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,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,o,s,n,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,o,s,n){var a=this;t.assert("messageIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(s)),this.assertCPPMode((function(){a._context.deleteMessages(s).then((function(e){e===t.ErrorCode.SUCCESS?W(n.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(s)),V(n.onError,e))}))}),"deleteLocalMessages",n)},e.prototype.deleteLocalMessagesByTimestamp=function(e,o,s,n,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,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,o,s,n,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._defaultChannelClient.clearMessages(e,o,s)}),"clearMessages",s)},e.prototype.getMessage=function(e,o){var s=this;t.assert("callback",o,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getMessage(e).then((function(n){var a=n.code,r=n.data;a===t.ErrorCode.SUCCESS?W(o.onSuccess,H(r)):(s.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),V(o.onError,a))}))}),"getMessage",o)},e.prototype.setMessageSentStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageSentStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?W(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(o,",messageId:").concat(e)),V(s.onError,o))}))}),"setMessageSentStatus",s)},e.prototype.setMessageReceivedStatus=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",o,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(o)),this.assertCPPMode((function(){n._context.setMessageReceivedStatus(e,o).then((function(o){o===t.ErrorCode.SUCCESS?W(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(o,",messageId:").concat(e)),V(s.onError,o))}))}),"setMessageReceivedStatus",s)},e.prototype.setMessageContent=function(e,o,s,n){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",s,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:s})),a._context.setMessageContent(e,o,s).then((function(e){e===t.ErrorCode.SUCCESS?W(n.onSuccess,!0):V(n.onError,e)}))}),"setMessageContent",n)},e.prototype.setMessageSearchField=function(e,o,s){var n=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(s)),this.assertCPPMode((function(){n._context.setMessageSearchField(e,o,s)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,o,s,n){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,o,s,n)}),"searchConversationByContent",o)},e.prototype.searchConversationByContentWithAllChannel=function(e,o,s,n){var a=this;void 0===s&&(s=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",s,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,o,s,n)}),"searchConversationByContentWithAllChannel",o)},e.prototype.searchMessageByContent=function(e,o,s,n,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,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,o,s,n,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,o,s,n,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,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,o,s,n,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,o,s,n,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("keyword",s,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,o,s,n,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,o){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,o)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,o,s,n){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),t.assert("timestamp",s,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,o,s,n)}),"clearUnreadCountByTimestamp",n)},e.prototype.getFirstUnreadMessage=function(e,t,o){return this._defaultChannelClient.getFirstUnreadMessage(e,t,o)},e.prototype.getConversationNotificationStatus=function(e,o,s){var n=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",o,t.AssertRules.STRING,!0),this.assertCPPMode((function(){n._defaultChannelClient.getConversationNotificationStatus(e,o,s)}),"getConversationNotificationStatus",s)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,o){this._defaultChannelClient.getGroupMessageDeliverList(e,t,o)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e.prototype.getRTCUserInfoList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserInfoList ->roomId:".concat(e.id)),this._context.getRTCUserInfoList(e.id).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a);else{var c=null==r?void 0:r.users;o.onSuccess(c)}})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserInfoList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.getRTCUserList=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCUserList ->roomId:".concat(e.id)),this._context.getRTCUserList(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCUserList ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCUserList ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCUserInfo ->roomId:".concat(e.id,",info:").concat(JSON.stringify(o||{}))),this._context.setRTCUserInfo(e.id,o.key,o.value).then((function(a){a!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)):s.onSuccess(!0)})).catch((function(a){n.logger.warn(t.LogTagId.O,"setRTCUserInfo ->code:".concat(a,",roomId:").concat(e.id,",key:").concat(o.key,",value:").concat(o.value)),s.onError(a)}))},e.prototype.removeRTCUserInfo=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"removeRTCUserInfo ->roomId:".concat(e.id,"keys:").concat(o.keys)),this._context.removeRTCUserInfo(e.id,o.keys).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeRTCUserInfo ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e.prototype.getRTCRoomInfo=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCRoomInfo ->roomId:".concat(e.id)),this._context.getRTCRoomInfo(e.id).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCRoomInfo ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCRoomInfo=function(e,o,s){throw t.todo("setRTCRoomInfo")},e.prototype.removeRTCRoomInfo=function(e,o,s){throw t.todo("removeRTCRoomInfo")},e.prototype.joinRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"joinRTCRoom ->roomId:".concat(e.id));var n=e.mode||0;this._context.joinRTCRoom(e.id,n).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"joinRTCRoom ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"joinRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.quitRTCRoom=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"quitRTCRoom ->roomId:".concat(e.id)),this._context.quitRTCRoom(e.id).then((function(n){n!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"quitRTCRoom ->code:".concat(n,",roomId:").concat(e.id)),o.onError(n)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"quitRTCRoom ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.RTCPing=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"RTCPing ->roomId:".concat(e.id));var n=e.mode||0;this._context.rtcPing(e.id,n).then((function(n){var a=n.code;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"RTCPing ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(!0)})).catch((function(n){s.logger.warn(t.LogTagId.O,"RTCPing ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCData=function(e,o,s,n,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"setRTCData ->roomId:".concat(e,",key:").concat(o)),this._context.setRTCData(e,o,s,n,a,c).then((function(o){o!==t.ErrorCode.SUCCESS?(i.logger.warn(t.LogTagId.O,"setRTCData ->code:".concat(o,",roomId:").concat(e)),r.onError(o)):r.onSuccess(!0)})).catch((function(o){i.logger.warn(t.LogTagId.O,"setRTCData ->error:".concat(o,",roomId:").concat(e)),r.onError(o)}))},e.prototype.getRTCData=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"getRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.getRTCData(e,o,s,n).then((function(o){var s=o.code,n=o.data;s!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"getRTCData ->code:".concat(s,",roomId:").concat(e)),a.onError(s)):a.onSuccess(n)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserInfo ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.removeRTCData=function(e,o,s,n,a,r){var c=this;this.logger.info(t.LogTagId.O,"removeRTCData ->roomId:".concat(e,",keys:").concat(o)),this._context.removeRTCData(e,o,s,n,r).then((function(o){o!==t.ErrorCode.SUCCESS?(c.logger.warn(t.LogTagId.O,"removeRTCData ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){c.logger.warn(t.LogTagId.O,"removeRTCData ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.setRTCUserData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.PERSON,a,r)},e.prototype.setRTCUserTotalRes=function(e,o,s,n,a){var r=this;this.logger.info(t.LogTagId.O,"setRTCUserTotalRes ->roomId:".concat(e)),this._context.setRTCTotalRes(e,o,s,n).then((function(o){o!==t.ErrorCode.SUCCESS?(r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->code:".concat(o,",roomId:").concat(e)),a.onError(o)):a.onSuccess(!0)})).catch((function(o){r.logger.warn(t.LogTagId.O,"setRTCUserTotalRes ->error:".concat(o,",roomId:").concat(e)),a.onError(o)}))},e.prototype.getRTCUserData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.PERSON,n)},e.prototype.removeRTCUserData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.PERSON,n,a)},e.prototype.setRTCRoomData=function(e,o,s,n,a,r){this.setRTCData(e,o,s,n,t.RTCApiType.ROOM,a,r)},e.prototype.getRTCRoomData=function(e,o,s,n){this.getRTCData(e,o,s,t.RTCApiType.ROOM,n)},e.prototype.removeRTCRoomData=function(e,o,s,n,a){this.removeRTCData(e,o,s,t.RTCApiType.ROOM,n,a)},e.prototype.setRTCOutData=function(e,o,s,n,a){throw t.todo("setRTCOutData")},e.prototype.getRTCOutData=function(e,o,s){throw t.todo("getRTCOutData")},e.prototype.getRTCToken=function(e,o){var s=this;this.logger.info(t.LogTagId.O,"getRTCToken ->roomId:".concat(e.id)),this._context.getRTCToken(e.id,e.mode,e.broadcastType).then((function(n){var a=n.code,r=n.data;a!==t.ErrorCode.SUCCESS?(s.logger.warn(t.LogTagId.O,"getRTCToken ->code:".concat(a,",roomId:").concat(e.id)),o.onError(a)):o.onSuccess(r)})).catch((function(n){s.logger.warn(t.LogTagId.O,"getRTCToken ->error:".concat(n,",roomId:").concat(e.id)),o.onError(n)}))},e.prototype.setRTCState=function(e,o,s){var n=this;this.logger.info(t.LogTagId.O,"setRTCState ->roomId:".concat(e.id)),this._context.setRTCState(e.id,o.report).then((function(o){o!==t.ErrorCode.SUCCESS?(n.logger.warn(t.LogTagId.O,"setRTCState ->code:".concat(o,",roomId:").concat(e.id)),s.onError(o)):s.onSuccess(!0)})).catch((function(o){n.logger.warn(t.LogTagId.O,"setRTCState ->error:".concat(o,",roomId:").concat(e.id)),s.onError(o)}))},e}(),ee=[],te=[],oe={message:function(e){ee.forEach((function(t){return t(H(e))}))},status:function(e){te.forEach((function(t){return t(e)}))}},se=1;t.VersionManage.add("imlib-v2-adapter","5.6.2-alpha.1");var ne,ae=null,re={init:function(e,o,s){void 0===s&&(s={}),t.assert("appkey",e,t.AssertRules.STRING,!0),Q=t.APIContext.init(P,{appkey:e,apiVersion:"5.6.2-alpha.1",navigators:s.navi?[s.navi]:[],miniCMPProxy:[],logOutputLevel:s.logOutputLevel,typingExpireTime:s.typingExpireTime,checkCA:s.checkCA,httpInMainProcess:!!s.httpInMainProcess,logExpireTime:s.logExpireTime}),(ae=Q.createLogger("RC-IM","IM")).setOutputLevel(s.logOutputLevel),ae.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:s.navi?[s.navi]:[],typingExpireTime:s.typingExpireTime})),se=Math.min(15,Math.max(s.readReceiptTimeout||1,1)),Y=new Z(Q,{readReceiptTimeout:se},ae)},getInstance:function(){return Y},setConnectionStatusListener:function(e){null==ae||ae.createTraceId(),Q.assignWatcher({connectionState:function(t){b.clear(),e.onChanged(t)}})},setOnReceiveMessageListener:function(e){Q.assignWatcher({message:function(o,s,n){try{var a=H(o),r=Q.getCurrentUserId(),c=Q.getConnectedTime();j(a,r,c,se),a=function(e,t,o,s){var n=new Date(o-1e3*s*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!n)return e;var a=e.content,r=((a=a||{}).receiptMessageDic||{})[t],c="",i={};if(e.receiptResponse=e.receiptResponse||{},r){for(var g=[],d=0;d<r.length;d++)c="".concat(t).concat(r[d],"SENT"),(i=F.get(c))&&!(e.senderUserId in i.userIds)&&(g.push(r[d]),i.count+=1,i.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[r[d]]=i.count,F.set(c,i));a.receiptMessageDic[t]=g,e.content=a}return e}(a,r,c,se),t.usingCppEngine()||b.set(o),e.onReceived(a,void 0,n)}catch(e){null==ae||ae.error(t.LogTagId.O,"setOnReceiveMessageListener -> error:".concat(e))}}})},setConversationStatusListener:function(e){Q.assignWatcher({conversationState:function(o){try{var s=[];o.forEach((function(e){var t=e.updatedItems,o=e.conversationType,n=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&s.push({notificationStatus:r.val,isTop:c.val,conversationType:o,targetId:n,channelId:a||"",updatedTime:r.time})})),s.length>0&&e.onChanged(s)}catch(e){null==ae||ae.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){Q.assignWatcher({expansion:function(o){try{o.updatedExpansion&&e.onUpdated(o.updatedExpansion),o.deletedExpansion&&e.onDeleted(o.deletedExpansion)}catch(e){null==ae||ae.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){Q.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==ae||ae.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){Q.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==ae||ae.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){Q.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==ae||ae.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){Q.assignWatcher({typingState:function(o){try{e.onChanged(o)}catch(e){null==ae||ae.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){Q.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Q.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Q.assignWatcher({messageDelivered:function(o){try{e.onDelivered(o)}catch(e){null==ae||ae.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){Q.assignWatcher({groupMessageDeliveredStatus:function(o){try{e.onDelivered(o)}catch(e){null==ae||ae.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,o,s){return r(this,void 0,void 0,(function(){var n,a,r,i;return c(this,(function(c){switch(c.label){case 0:return n=null==ae?void 0:ae.createTraceId(),null==ae||ae.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),n),[4,Q.connect(e,!1,s,n)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==ae||ae[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),n),a.code===t.ErrorCode.SUCCESS?(o.onSuccess(a.userId),i=new Date(Q.getConnectedTime()-1e3*se*60*60*24).getTime(),F.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=F.get(e).dealtime;t&&i-t>0&&F.remove(e)}else if(/RECEIVED$/.test(e)){var o=F.get(e),s=Object.keys(o).length;Object.keys(o).forEach((function(e){var t=o[e].dealtime;t&&i-t>0&&delete o[e]})),Object.keys(o).length!==s&&(0===o.length?F.remove(e):F.set(e,o))}}))):a.code===t.ErrorCode.RC_CONN_USER_OR_PASSWD_ERROR?(null==ae||ae.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onTokenIncorrect()):(null==ae||ae.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),o.onError(a.code)),[2]}}))}))},reconnect:function(e,o,s){var n=null==ae?void 0:ae.createTraceId();null==ae||ae.info(t.LogTagId.A_RECONNECT_T,null,n),Q.reconnect(s).then((function(o){var s=o.code===t.ErrorCode.SUCCESS?"info":"warn";null==ae||ae[s](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:o.code,userId:o.userId}),n),o.code===t.ErrorCode.SUCCESS?e.onSuccess(o.userId):(null==ae||ae.warn(t.LogTagId.O,"reconnect ->code:".concat(o.code)),e.onError(o.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:G,getMessageObjectName:function(e){var t=a(a({},D),G);return Object.keys(t).find((function(o){return t[o]===e}))||e},registerMessageType:function(e,t,o,s){this.RegisterMessage[e]=J(e,t,o.isPersited,o.isCounted),this.RegisterMessageTypeMapping[t]=e,Q.registerMessageType(t,o.isPersited,o.isCounted,s)},messageWatch:function(e){var o=this;ee.push((function(s){var n,a;null==ae||ae.info(t.LogTagId.O,"messageWatch ->message:".concat(JSON.stringify(s||{})));try{e(s),null===(a=(n=o._voipProvider).onReceived)||void 0===a||a.call(n,s)}catch(e){null==ae||ae.error(t.LogTagId.O,"messageWatch ->error:".concat(e))}})),Q.assignWatcher({rtcInnerWatcher:oe})},statusWatch:function(e){te.push((function(o){null==ae||ae.info(t.LogTagId.O,"statusWatch ->status:".concat(o));try{e(o)}catch(e){null==ae||ae.error(t.LogTagId.O,"statusWatch ->error:".concat(e))}}))},MessageType:{TextMessage:"TextMessage",ImageMessage:"ImageMessage",ReferenceMessage:"ReferenceMessage",DiscussionNotificationMessage:"DiscussionNotificationMessage",VoiceMessage:"VoiceMessage",RichContentMessage:"RichContentMessage",HandshakeMessage:"HandshakeMessage",UnknownMessage:"UnknownMessage",LocationMessage:"LocationMessage",InformationNotificationMessage:"InformationNotificationMessage",ContactNotificationMessage:"ContactNotificationMessage",ProfileNotificationMessage:"ProfileNotificationMessage",CommandNotificationMessage:"CommandNotificationMessage",CommandMessage:"CommandMessage",TypingStatusMessage:"TypingStatusMessage",ChangeModeResponseMessage:"ChangeModeResponseMessage",ChangeModeMessage:"ChangeModeMessage",EvaluateMessage:"EvaluateMessage",HandShakeMessage:"HandShakeMessage",HandShakeResponseMessage:"HandShakeResponseMessage",SuspendMessage:"SuspendMessage",TerminateMessage:"TerminateMessage",CustomerContact:"CustomerContact",CustomerStatusUpdateMessage:"CustomerStatusUpdateMessage",SyncReadStatusMessage:"SyncReadStatusMessage",ReadReceiptRequestMessage:"ReadReceiptRequestMessage",ReadReceiptResponseMessage:"ReadReceiptResponseMessage",FileMessage:"FileMessage",HQVoiceMessage:"HQVoiceMessage",GIFMessage:"GIFMessage",SightMessage:"SightMessage",AcceptMessage:"AcceptMessage",RingingMessage:"RingingMessage",SummaryMessage:"SummaryMessage",HungupMessage:"HungupMessage",InviteMessage:"InviteMessage",MediaModifyMessage:"MediaModifyMessage",MemberModifyMessage:"MemberModifyMessage",JrmfRedPacketMessage:"JrmfRedPacketMessage",JrmfRedPacketOpenedMessage:"JrmfRedPacketOpenedMessage",GroupNotificationMessage:"GroupNotificationMessage",PublicServiceRichContentMessage:"PublicServiceRichContentMessage",PublicServiceMultiRichContentMessage:"PublicServiceMultiRichContentMessage",PublicServiceCommandMessage:"PublicServiceCommandMessage",RecallCommandMessage:"RecallCommandMessage",ReadReceiptMessage:"ReadReceiptMessage",RCCombineMessage:"RCCombineMessage",ChrmKVNotificationMessage:"ChrmKVNotificationMessage",LogCommandMessage:"LogCommandMessage"},_voipProvider:{}},ce=function(e,t,o){this.type=e,this.userIdList=t,this.mentionedContent=o},ie=function(e,t){this.isCounted=e,this.isPersited=t},ge=J("TextMessage","RC:TxtMsg"),de=J("LocationMessage","RC:LBSMsg"),ue=J("TypingStatusMessage","RC:TypSts"),le=J("ImageMessage","RC:ImgMsg"),Ce=J("RichContentMessage","RC:ImgTextMsg"),he=J("VoiceMessage","RC:VcMsg"),fe=J("HQVoiceMessage","RC:HQVCMsg"),pe=J("FileMessage","RC:FileMsg"),Re=J("SightMessage","RC:SightMsg"),Ie=J("GIFMessage","RC:GIFMsg"),Te=J("ReadReceiptMessage","RC:ReadNtf"),Se=J("ReadReceiptRequestMessage","RC:RRReqMsg"),me=J("RCCombineMessage","RC:CombineMsg"),ve=function(e,t,o,s,n,a,r,c,i,g,d,u,l,C,h,f,p,R){this.conversationType=e,this.targetId=t,this.senderUserId=o,this.content=s,this.objectName=n,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=d,this.sentTime=u,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=f,this.receiptResponse=p,this.disableNotification=R};exports.VoIPMediaType=void 0,(ne=exports.VoIPMediaType||(exports.VoIPMediaType={}))[ne.MEDIA_AUDIO=1]="MEDIA_AUDIO",ne[ne.MEDIA_VEDIO=2]="MEDIA_VEDIO",ne[ne.MEDIA_VIDEO=2]="MEDIA_VIDEO";var ye,Me=J("AcceptMessage","RC:VCAccept"),Ee=J("RingingMessage","RC:VCRinging"),Ae=J("SummaryMessage","RC:VCSummary"),Le=J("HungupMessage","RC:VCHangup"),Oe=J("InviteMessage","RC:VCInvite"),Ue=J("MediaModifyMessage","RC:VCModifyMedia"),Ne=J("MemberModifyMessage","RC:VCModifyMem"),_e=J("lastMessageSendTime","RC:SRSMsg"),xe=J("ReferenceMessage","RC:ReferenceMsg"),Be=J("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),we=J("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(ye||(ye={}));var Pe=ye,ke=t.ConnectResultCode;window&&(window.RongIMClient=re),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"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=Me,exports.BaseMessage=q,exports.ChannelClient=z,exports.ConnectionState=ke,exports.FileMessage=pe,exports.GIFMessage=Ie,exports.GetChatRoomType=n,exports.HQVoiceMessage=fe,exports.HungupMessage=Le,exports.IMClient=Z,exports.ImageMessage=le,exports.InviteMessage=Oe,exports.LocationMessage=de,exports.MediaModifyMessage=Ue,exports.MemberModifyMessage=Ne,exports.MentionedInfo=ce,exports.MentionedType=Pe,exports.Message=ve,exports.MessageTag=ie,exports.PublicServiceMultiRichContentMessage=we,exports.PublicServiceRichContentMessage=Be,exports.RCCombineMessage=me,exports.ReadReceiptMessage=Te,exports.ReadReceiptRequestMessage=Se,exports.ReadReceiptResponseMessage=X,exports.ReferenceMessage=xe,exports.RichContentMessage=Ce,exports.RingingMessage=Ee,exports.RongIMClient=re,exports.SentStatus=s,exports.SightMessage=Re,exports.SummaryMessage=Ae,exports.SyncReadStatusMessage=_e,exports.TextMessage=ge,exports.TypingStatusMessage=ue,exports.VoiceMessage=he;
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.6.1",
13
+ "version": "5.6.2-alpha.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.6.1"
24
+ "@rongcloud/engine": "=5.6.2-alpha.1"
25
25
  }
26
26
  }