@rongcloud/imlib-v2-adapter 5.9.5 → 5.9.6

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{httpRequest as e,NetworkType as t,HttpMethod as n,HTTP_TIMEOUT as o,appendUrl as a,ErrorCode as s,SEND_MESSAGE_TYPE_OPTION as r,ReceivedStatus as c,MessageDirection as i,usingCppEngine as g,assert as u,AssertRules as d,LogTagId as l,transformReceivedStatusInfo as h,isArray as C,ConversationType as f,VersionManage as p,AppStorage as S,APIContext as v,logger as I}from"@rongcloud/engine";export{AreaCode,ChatroomEntryType,ChatroomSyncStatusReason,ChatroomUserChangeType,ChrmMemBanType,ChrmMemOperateType,ChrmSyncStatus,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RCConnectionStatus,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 y,R=m;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(y||(y={}));var T=y,M=function(){return M=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},M.apply(this,arguments)};function E(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 N(e,t){var n,o,a,s,r={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(c){return function(i){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(r=0)),r;)try{if(n=1,o&&(a=2&c[0]?o.return:c[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,c[1])).done)return a;switch(o=0,a&&(c=[2&c[0],a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,o=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(a=r.trys,(a=a.length>0&&a[a.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(6===c[0]&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],o=0}finally{n=a=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var 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 _=null,A=function(e){return E(void 0,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return[4,L.getNetworkType()];case 1:return t=n.sent(),_({status:"online"===e.type,type:t}),[2]}}))}))};var L={tag:"browser",httpReq:function(t){return e(t).result()},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",{id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.UNKONWN},n=e.type,o=e.effectiveType,a=n||o||t.UNKONWN;return Promise.resolve(a)},setNetworkStatusListener:function(e){_=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",A),window.addEventListener("online",A))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",A),window.removeEventListener("online",A)),_=null}},B=O(),w=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)}}},k={setItem:w("setStorageSync"),getItem:w("getStorageSync"),removeItem:w("removeStorageSync"),clear:w("clearStorageSync")},x=null,P=function(e){var t=e.isConnected,n=e.networkType;x({status:t,type:n})};var b={tag:"wechat",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){wx.request({url:u,method:t,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:k,sessionStorage:k,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:B,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){x=e,wx.onNetworkStatusChange(P)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(P),x=null}},G=O(),D=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:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},F=null,W=function(e){var t=e.isConnected,n=e.networkType;F({status:t,type:n})};var H={tag:"alipay",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i),d=e.dataType||"json";return new Promise((function(e){my.request({url:u,method:t,headers:c,timeout:r,data:g,dataType:d,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:K,sessionStorage:K,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:G,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){F=e,my.onNetworkStatusChange(W)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(W),F=null}},V=O(),j=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){}}},J={setItem:j("setStorageSync"),getItem:j("getStorageSync"),removeItem:j("removeStorageSync"),clear:j("clearStorageSync")},q=null,Y=function(e){var t=e.isConnected,n=e.networkType;q({status:t,type:n})};var Q={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:V,localStorage:J,sessionStorage:J,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:s.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){q=e,tt.onNetworkStatusChange(Y)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(Y),q=null}},z=O(),X=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){}}},$={setItem:X("setStorageSync"),getItem:X("getStorageSync"),removeItem:X("removeStorageSync"),clear:X("clearStorageSync")},Z=null,ee=function(e){var t=e.isConnected,n=e.networkType;Z({status:t,type:n})};var te={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:z,localStorage:$,sessionStorage:$,httpReq:function(e){return new Promise((function(t){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:s.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return E(this,void 0,void 0,(function(){return N(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){Z=e,swan.onNetworkStatusChange(ee)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(ee),Z=null}},ne=O(),oe=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)}}},ae={setItem:oe("setStorageSync"),getItem:oe("getStorageSync"),removeItem:oe("removeStorageSync"),clear:oe("clearStorageSync")},se=null,re=function(e){var t=e.isConnected,n=e.networkType;se({status:t,type:n})};var ce={tag:"jingdong",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){jd.request({url:u,method:t,headers:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:ae,sessionStorage:ae,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:ne,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){se=e,jd.onNetworkStatusChange(re)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(re),se=null}},ie=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)}}},ge={setItem:ie("setStorageSync"),getItem:ie("getStorageSync"),removeItem:ie("removeStorageSync"),clear:ie("clearStorageSync")},ue=null,de=function(e){var t=e.isConnected,n=e.networkType;ue({status:t,type:n})};var le={tag:"uniapp",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,c=e.headers,i=e.query,g=e.body,u=a(e.url,i);return new Promise((function(e){uni.request({url:u,method:t,header:c,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:s.RC_HTTP_REQ_FAIL})}})}))},localStorage:ge,sessionStorage:ge,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{id:Date.now(),onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ue=e,uni.onNetworkStatusChange(de)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(de),ue=null}},he=function(e){return e&&e.request&&e.getSystemInfo},Ce="undefined"!=typeof uni&&he(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return le;case"mp-jd":return ce;case"mp-baidu":return te;case"mp-toutiao":return Q;case"mp-alipay":return H;case"mp-weixin":return b;default:return L}}():"undefined"!=typeof jd&&he(jd)?ce:"undefined"!=typeof my&&he(my)?H:"undefined"!=typeof tt&&he(tt)?Q:"undefined"!=typeof swan&&he(swan)?te:"undefined"!=typeof wx&&he(wx)?b:L;function fe(e,t,n){return"".concat(e,"_").concat(t,"_").concat(n)}var pe=function(){function e(){}return e.set=function(t){if(r[t.messageType]&&r[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=fe(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var a=fe(t,n,o);return e.map[a]||null},e.remove=function(t,n,o){var a=fe(t,n,o);delete e.map[a]},e.clear=function(){e.map={}},e.map={},e}(),Se={"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"},ve={};function Ie(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 u=pe.get(n,o,t||"");(!s||u&&s.sentTime<u.sentTime)&&(s=u)}var d=s?me(s):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:r,notificationStatus:c,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:i}}function me(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,u=e.sentTime,d=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,C=e.disableNotification,f=e.expansion,p=e.messageId,S=e.sentStatus,v=e.channelId,I=e.readReceiptInfo,m=e.pushConfig,y="";return s in Se?y=Se[s]:s in ve?y=ve[s]:(a={message:{content:a,objectName:s},messageName:"UnknownMessage"},y="UnknownMessage"),d||(d=c.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:v||"",conversationType:t,targetId:n,senderUserId:o,content:a,messageType:y,messageUId:r,messageDirection:i,offLineMessage:g,sentTime:u,receivedStatus:d,receivedTime:l,objectName:s,messageId:p,sentStatus:S||R.SENT,disableNotification:C,canIncludeExpansion:h,expansion:f,readReceiptInfo:I,pushConfig:m}}function ye(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,r=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===r&&s&&c===i.SEND){var g="".concat(t).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&s){var u="".concat(t).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=a.get(u);if(d){if(e.senderUserId in d)return void(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,a.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void a.set(u,d)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(u,h)}}function Re(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function Te(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var Me=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 Ee(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var a=function(a){return new Me(e,t,a,n,o)};return a.MessageType=e,a.ObjectName=t,a}var Ne,Oe,Ue=Ee("ReadReceiptResponseMessage","RC:RRRspMsg"),_e=function(){function e(e,t,n,o,a,s){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=a,this._storage=s,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;u("callback",e,d.CALLBACK),u("conversationTypes",t,d.ARRAY),u("count",n,d.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===s.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&c.push(Ie(e))})):r.forEach((function(e){c.push(Ie(e))})),Re(e.onSuccess,c)):(o.logger.warn(l.O,"getConversationList -> code:".concat(a)),Te(e.onError,a))}))},e.prototype.getConversation=function(e,t,n){var o=this;u("callback",n,d.CALLBACK),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:".concat(t,",conversationType:").concat(e)),E(o,void 0,void 0,(function(){var o,a,r;return N(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==s.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:".concat(a,",targetId:").concat(t)),n.onError(a),[2]):(n.onSuccess(r?Ie(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:".concat(t,",conversationType:").concat(e)),this._context.removeConversation(e,t,this.channelId).then((function(a){a===s.SUCCESS?(o._isCPPMode||pe.remove(e,t,o.channelId),Re(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:".concat(a,",targetId:").concat(t)),Te(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,t,n){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("draftText",n,d.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){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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;u("callback",e,d.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:".concat(t)),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,a=t.data;n===s.SUCCESS?Re(e.onSuccess,a):(o.logger.warn(l.O,"getTotalUnreadCount ->code:".concat(n)),Te(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var a=e.code,r=e.data;a===s.SUCCESS?Re(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(t)),Te(n.onError,a))}))},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===s.SUCCESS?Re(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:".concat(t)),Te(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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:".concat(t,",conversationType:").concat(e)),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===s.SUCCESS?Re(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(t)),Te(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;u("callback",e,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===s.SUCCESS?Re(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:".concat(n)),Te(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.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===s.SUCCESS?Re(n.onSuccess,e.data?me(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(t)),Te(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",o,d.CALLBACK),u("status",n,d.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===s.SUCCESS?Re(o.onSuccess):(a.logger.warn(l.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(t)),Te(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,a,r,g,C){var f=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("msg",n,d.OBJECT,!0),u("callback",o,d.CALLBACK),u("isMentioned",a,d.BOOLEAN),u("pushContent",r,d.ONLY_STRING),u("pushData",g,d.ONLY_STRING),u("options.userIds",null==C?void 0:C.userIds,d.ARRAY),u("options.isVoipPush",null==C?void 0:C.isVoipPush,d.BOOLEAN),u("options.disableNotification",null==C?void 0:C.disableNotification,d.BOOLEAN),u("options.canIncludeExpansion",null==C?void 0:C.canIncludeExpansion,d.BOOLEAN),u("options.expansion",null==C?void 0:C.expansion,d.OBJECT),u("options.pushConfig",null==C?void 0:C.pushConfig,d.OBJECT),u("options.resendMessageId",null==C?void 0:C.resendMessageId,d.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:".concat(t,",conversationType:").concat(e));var p=!(!(null==C?void 0:C.isStatusMessage)&&!(null==C?void 0:C.isStatus)),S=function(e,t,n){var o,a=e||{},s=a.userIds,r=a.isVoipPush,c=a.disableNotification,i=a.isFilerWhiteBlacklist,g=a.expansion,u=a.canIncludeExpansion,d=a.pushConfig,l=a.resendMessageId,h=[];if(t){var C=(n||{}).content.mentionedInfo;h=C.userIdList,o=C.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:s,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(C,a,n);r=r||"",g=g||"";var v=Object.assign(n,M(M({isMentioned:a,pushContent:r,pushData:g},S),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:p})),I=this._context.getCurrentUserId(),m=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:v.messageType,conversationType:e,targetId:t,channelId:this.channelId}),m),this._context.sendMessage(e,t,v,o.onBefore,m).then((function(a){var r=a.code,g=a.data,u=r===s.SUCCESS?"info":"warn";if(f.logger[u](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),m),r===s.SUCCESS){f._isCPPMode||pe.set(g);var d=me(g);ye(d,I,f._context.getConnectedTime(),f._readReceiptTimeout,f._storage),Re(o.onSuccess,d)}else f.logger.warn(l.O,"sendMessage ->code:".concat(r,",targetId:").concat(t)),Te(o.onError,r,me({isMentioned:!!v.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==C?void 0:C.disableNotification),canIncludeExpansion:!!(null==C?void 0:C.canIncludeExpansion),expansion:(null==C?void 0:C.expansion)||null,conversationType:e,targetId:t,senderUserId:I,messageUId:"",messageDirection:i.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:p,receivedStatus:c.UNREAD,receivedStatusInfo:h(c.UNREAD),messageId:null==g?void 0:g.messageId,sentStatus:R.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;u("message.conversationType",e.conversationType,d.NUMBER,!0),u("message.targetId",e.targetId,d.STRING,!0),u("message.messageUId",e.messageUId,d.STRING,!0),u("message.sentTime",e.sentTime,d.NUMBER,!0),u("callback",t,d.CALLBACK),u("options.disableNotification",null==n?void 0:n.disableNotification,d.BOOLEAN),u("options.pushConfig",null==n?void 0:n.pushConfig,d.OBJECT),u("options.extra",null==n?void 0:n.extra,d.STRING);var a=e.conversationType,r=e.targetId,c=e.messageUId,i=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:".concat(r,",conversationType:").concat(a,",messageUId:").concat(c));var g=M({channelId:this.channelId},n);this._context.recallMessage(a,r,c,i,g).then((function(e){var n=e.code,a=e.data;n===s.SUCCESS?(o._isCPPMode||pe.set(a),Re(t.onSuccess,me(a))):(o.logger.warn(l.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(r,",messageUId:").concat(c)),Te(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("typingContentType",n,d.STRING,!0),u("callback",o,d.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===s.SUCCESS?"info":"warn";a.logger[i](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===s.SUCCESS?Re(o.onSuccess,me(r)):(a.logger.warn(l.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(t)),Te(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 u=setInterval((function(){1===c.length&&clearInterval(u);var a=c.splice(0,1)[0],i=new Ue({receiptMessageDic:a});o.sendMessage(e,t,i,{onSuccess:function(e){var t=Object.keys(a)[0];r[t].isResponse=!0,o._storage.set(s,r),Re(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(t)),Te(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;u("messageUIds",e,d.ARRAY,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:".concat(t,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];u("messageUId",c,d.STRING)}this._context.sendReadReceiptMessage(t,e,this.channelId).then((function(a){var r=a.code;r===s.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;u("messageUId",e,d.STRING,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:".concat(t,",messageUId:").concat(e)),this._context.getMessageReader(t,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===s.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;u("expansion",e,d.OBJECT,!0),u("message",t,d.OBJECT,!0);var a=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(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),Te(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;u("keys",e,d.ARRAY,!0),u("message",t,d.OBJECT,!0);var a=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(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:".concat(t,",targetId:").concat(r,",messageUId:").concat(c)),Te(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,a,r,c){var i=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",a,d.CALLBACK,!0),u("order",c,d.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===s.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],u=o.map((function(e){return c.push(e.messageUId),me(e)}));i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:c.join(",")}),g),Re(a.onSuccess,u,r)}else i.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),Re(a.onSuccess,[],!1);else i.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),Te(a.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("messages",n,d.ARRAY,!0),u("callback",o,d.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===s.SUCCESS){if(!a._isCPPMode){var c=pe.get(e,t,a.channelId);c&&n.forEach((function(n){c.messageUId===n.messageUId&&pe.remove(e,t,a.channelId)}))}Re(o.onSuccess)}else a.logger.warn(l.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(t)),Te(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;u("param.conversationType",e.conversationType,d.NUMBER,!0),u("param.targetId",e.targetId,d.STRING,!0),u("param.timestamp",e.timestamp,d.NUMBER,!0),u("callback",t,d.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===s.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:".concat(e)),Te(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){u("callback",e,d.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===s.SUCCESS?Re(e.onSuccess,o.map(Ie)):Te(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){u("callback",e,d.CALLBACK),u("index",t,d.NUMBER),u("limit",n,d.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===s.SUCCESS?Re(e.onSuccess,o.map(Ie)):Te(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,h=n.expansion,C=n.disableNotification,f=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:".concat(t,",conversationType:").concat(e));var S=a.isUnread,v={senderUserId:c,messageType:i,content:g,messageDirection:u,sentTime:f,sentStatus:p,searchContent:a.searchContent,isUnread:S,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,v).then((function(e){var n=e.code,a=e.data;n===s.SUCCESS?Re(o.onSuccess,me(a)):(r.logger.warn(l.O,"insertMessage ->code:".concat(n,",targetId:").concat(t)),Te(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===s.SUCCESS?Re(n.onSuccess,o):Te(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===s.SUCCESS?Re(n.onSuccess,o):Te(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){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===s.SUCCESS?Re(a.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(t)),Te(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,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===s.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return me(e)}));Re(a.onSuccess,g,i)}else Re(a.onSuccess,[],!1);else c.logger.warn(l.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(t)),Te(a.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(a){a===s.SUCCESS?(o._isCPPMode||pe.remove(e,t,o.channelId),Re(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:".concat(a,",targetId:").concat(t)),Te(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var a=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===s.SUCCESS?(r.forEach((function(e){c.push(Ie(e))})),Re(t.onSuccess,c)):(a.logger.warn(l.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),Te(t.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=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===s.SUCCESS?(r.forEach((function(e){c.push(Ie(e))})),Re(t.onSuccess,c)):(a.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),Te(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,a,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,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===s.SUCCESS){var r=o=o||{},g=r.messages,u=r.count;g.forEach((function(e){a.push(me(e))})),Re(c.onSuccess,a,u)}else i.logger.warn(l.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(t)),Te(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,r){var c=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(t," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,t,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===s.SUCCESS){var i=o=o||{},g=i.messages,u=i.count;g.forEach((function(e){a.push(me(e))})),Re(r.onSuccess,a,u)}else c.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(t)),Te(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,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(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===s.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(me(e))})),Re(i.onSuccess,a)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(t)),Te(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 me(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var a=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===s.SUCCESS?Re(o.onSuccess,!0):(a.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(t)),Te(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 a=e.code,r=e.data;a===s.SUCCESS?Re(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(t)),Te(n.onError,a))}))},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 a=e.code,r=e.data;a===s.SUCCESS?Re(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(t)),Te(n.onError,a))}))},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 a=o.code,r=o.data;a===s.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),Te(t.onError,a))}))},e}(),Ae=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},Le=function(){function e(e,t,n,o){this._context=e,this._options=t,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new _e(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(s.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(u("channelId",e,d.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 _e(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;u("channelIds",e,d.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.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.9.5"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return E(this,void 0,void 0,(function(){return N(this,(function(t){switch(t.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(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;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(l.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:t,joinExist:!1}),a),this._context.joinChatroom(e,t,a).then((function(t){var r=t===s.SUCCESS?"info":"warn";o.logger[r](l.A_JOIN_CHATROOM_R,JSON.stringify({code:t,timestamp:(new Date).getTime()}),a),t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:".concat(t,",chatRoomId:").concat(e)),Te(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.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(a){var r=a===s.SUCCESS?"info":"warn";n.logger[r](l.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===s.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),Te(t.onError,a))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var a=this;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.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===s.SUCCESS?Re(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(l.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),Te(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,t).then((function(t){t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Te(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("entry.key",e.key,d.STRING,!0),u("entry.value",e.value,d.STRING,!0)})),u("options.isAutoDelete",e.isAutoDelete,d.BOOLEAN)}(t),u("callback",n,d.CALLBACK),t.entries.length>10)Te(n.onError,s.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(l.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:".concat(t,",").concat(a)),Te(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,t).then((function(t){t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Te(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,t).then((function(t){t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Te(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("key",e,d.STRING,!0)}))}(t);var a="id:".concat(e);this.logger.debug(l.O,"remove chatroom entry->".concat(a));var r=M({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:".concat(t,",").concat(a)),Te(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===s.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:".concat(t,",chatRoomId:").concat(e)),Te(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("key",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(t)),this._context.getChatroomEntry(e,t).then((function(t){var a=t.code,r=t.data;a===s.SUCCESS?Re(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),Te(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),Te(t.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,a){var r=this;void 0===a&&(a=0),u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.CALLBACK),u("timestamp",a,d.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,t,n,a).then((function(t){var n=t.code,a=t.data;if(n===s.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return me(e)}));Re(o.onSuccess,g,i)}else Re(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),Te(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){u("fileType",e,d.NUMBER,!0),u("fileName",n,d.STRING),u("callback",t,d.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){u("fileType",e,d.NUMBER,!0),u("fileName",t,d.STRING,!0),u("saveName",n,d.STRING),u("callback",o,d.CALLBACK),u("serverType",s,d.NUMBER),u("uploadRes",a,d.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;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagId",e.tagId,(function(e){return e.length<=10})),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("tag.tagName",e.tagName,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).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;u("tagId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),t.onError(a))})).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;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagName",e.tagName,d.STRING,!0),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("callback",t,d.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===s.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),t.onError(a))})).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;u("callback",e,d.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===s.SUCCESS?e.onSuccess(a||[]):(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;u("conversationType",e.type,d.NUMBER),u("targetId",e.targetId,d.STRING),u("channelId",e.channelId,d.ONLY_STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(Ae(e)).then((function(e){var o=e.code,a=e.data;o===s.SUCCESS?t.onSuccess(a||[]):(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;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,t.map((function(e){return Ae(e)}))).then((function(t){var a=t.code;t.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,t.map((function(e){return Ae(e)}))).then((function(t){var a=t.code;t.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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;u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING),u("tagIds",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("tagId",e,d.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:".concat(t,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(Ae(e),t).then((function(e){var a=e.code;e.data,a===s.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(t)),n.onError(a))})).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 a=this;u("tagId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("startTime",n,d.NUMBER,!0),u("callback",o,d.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===s.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?me(s):null,u=g||{},d=u.messageType,l=u.sentTime,h=u.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:g,isTopInTag:i,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:c,receivedStatus:h}}(e))})),o.onSuccess(c)):(a.logger.warn(l.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){a.logger.warn(l.O,"getConversationListByTag ->reason:".concat(t,",tagId:").concat(e)),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;u("tagId",e,d.STRING,!0),u("containMuted",t,d.BOOLEAN,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,t).then((function(t){var a=t.code,r=t.data;o.logger.info(l.O,JSON.stringify({code:a,data:r})),a===s.SUCCESS?n.onSuccess(r||0):(o.logger.warn(l.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).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 a=this;u("tagId",e,d.STRING,!0),u("conversation.targetId",t.targetId,d.STRING,!0),u("conversation.type",t.type,d.NUMBER,!0),u("conversation.channelId",t.channelId,d.ONLY_STRING),u("status.isTop",null==n?void 0:n.isTop,d.BOOLEAN,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(t.targetId,",type").concat(t.type)),this._context.setConversationStatusInTag(e,Ae(t),n).then((function(t){var n=t.code;t.data,n===s.SUCCESS?o.onSuccess():(a.logger.warn(l.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(t){a.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,a=[],r=2;r<arguments.length;r++)a[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],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==s.SUCCESS)o.logger.warn(l.O,"callExtra ->code:".concat(a)),t.onError&&Te(t.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?me(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,u=i.map((function(e){return me(e)}));return void Re(t.onSuccess,u,g)}t.onSuccess&&Re(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){u("callback",t,d.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){Re(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(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;u("status",e,d.NUMBER),u("callback",t,d.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===s.SUCCESS?Re(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:".concat(e)),Te(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),Te(t.onError,a))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===s.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),Te(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===s.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),Te(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;u("callback",e,d.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===s.SUCCESS?Re(e.onSuccess,a):(t.logger.warn(l.O,"getBlacklist ->code:".concat(o)),Te(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),Te(t.onError,a))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,a){var s=this;void 0===a&&(a={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("content.senderUserId",n.senderUserId,d.STRING,!0),u("content.messageDirection",n.messageDirection,d.NUMBER,!0),u("content.objectName",n.objectName,d.STRING,!0),u("callback",o,d.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.batchInsertMessage=function(e,t,n){var o,a,s=this;for(var r in u("messages",e,(function(t){return C(t)&&!(e.length<=0||e.length>=500)}),!0),u("checkDuplicate",t,d.BOOLEAN),u("callback",n,d.CALLBACK),e)u("message",e[r],d.OBJECT,!0),u("message.conversationType",e[r].conversationType,(function(e){return[f.PRIVATE,f.DISCUSSION,f.GROUP,f.CUSTOMER_SERVICE,f.SYSTEM,f.APP_PUBLIC_SERVICE,f.PUBLIC_SERVICE].includes(e)}),!0),u("message.targetId",e[r].targetId,d.STRING,!0),u("message.senderUserId",e[r].senderUserId,d.STRING,!0),u("message.messageType",e[r].messageType,d.STRING,!0),u("message.content",e[r].content,d.OBJECT,!0),u("message.messageDirection",e[r].messageDirection,d.NUMBER,!0),u("message.canIncludeExpansion",e[r].canIncludeExpansion,d.BOOLEAN),u("message.expansion",e[r].expansion,d.OBJECT),u("message.disableNotification",e[r].disableNotification,d.BOOLEAN),u("message.sentTime",e[r].sentTime,d.NUMBER),u("message.sentStatus",e[r].sentStatus,d.NUMBER),u("options.isUnread",null===(o=e[r])||void 0===o?void 0:o.isUnread,d.BOOLEAN),u("options.searchContent",null===(a=e[r])||void 0===a?void 0:a.searchContent,d.STRING);this.assertCPPMode((function(){s._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,a,s){var r=this;void 0===s&&(s={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",a,d.CALLBACK),u("options.order",s.order,d.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,a,s)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,t,n,o){var a=this;u("messageIds",n,d.ARRAY,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===s.SUCCESS?Re(o.onSuccess,!0):(a.logger.warn(l.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),Te(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,a){var s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("cleanSpace",o,d.BOOLEAN),u("callback",a,d.CALLBACK),this.assertCPPMode((function(){s._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;u("callback",t,d.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===s.SUCCESS?Re(t.onSuccess,me(r)):(n.logger.warn(l.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),Te(t.onError,a))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("sentStatus",t,d.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===s.SUCCESS?Re(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:".concat(t,",messageId:").concat(e)),Te(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("receivedStatus",t,d.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===s.SUCCESS?Re(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:".concat(t,",messageId:").concat(e)),Te(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var a=this;u("messageId",e,d.NUMBER,!0),u("objectName",n,d.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(l.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,t,n).then((function(e){e===s.SUCCESS?Re(o.onSuccess,!0):Te(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("searchFiles",n,d.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;u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",n,d.ARRAY),u("customMessageType",o,d.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var a=this;void 0===n&&(n=[]),u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",o,d.ARRAY),u("customMessageType",n,d.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,a,s,r){var c=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",a,d.NUMBER),u("total",s,d.NUMBER),u("callback",r,d.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,t,n,o,a,s,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,a,s){var r=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",a,d.NUMBER),u("callback",s,d.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,a,s)}),"searchMessageByContentWithAllChannel",s)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,a,s,r,c){var i=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("startTime",o,d.NUMBER),u("endTime",a,d.NUMBER),u("offset",s,d.NUMBER),u("limit",r,d.NUMBER),u("callback",c,d.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,a,s,r,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,t,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,n){return this._defaultChannelClient.getFirstUnreadMessage(e,t,n)},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Be=1;p.add("imlib-v2-adapter","5.9.5");var we,ke,xe=null,Pe={init:function(e,t,n){var o;void 0===n&&(n={}),u("appkey",e,d.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||Ce;we=new S(a,"API-V2"),Oe=v.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(xe=Oe.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),xe.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Be=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),Ne=new Le(Oe,{readReceiptTimeout:Be},xe,we),I.init(xe)},getInstance:function(){return Ne},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){Oe.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==xe||xe.error(l.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){Oe.assignWatcher({message:function(t,n,o){try{var a=me(t),s=Oe.getCurrentUserId(),r=Oe.getConnectedTime();ye(a,s,r,Be,we),a=function(e,t,n,o,a){var s=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!s)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var u=[],d=0;d<c.length;d++)i="".concat(t).concat(c[d],"SENT"),(g=a.get(i))&&!(e.senderUserId in g.userIds)&&(u.push(c[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[d]]=g.count,a.set(i,g));r.receiptMessageDic[t]=u,e.content=r}return e}(a,s,r,Be,we),g()||pe.set(t),e.onReceived(a,void 0,o)}catch(e){null==xe||xe.error(l.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){Oe.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==xe||xe.error(l.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){Oe.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==xe||xe.error(l.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){Oe.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==xe||xe.error(l.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){Oe.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==xe||xe.error(l.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){Oe.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==xe||xe.error(l.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){Oe.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==xe||xe.error(l.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){Oe.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Oe.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Oe.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==xe||xe.error(l.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){Oe.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==xe||xe.error(l.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,t,n){return E(this,void 0,void 0,(function(){var o,a,r;return N(this,(function(c){switch(c.label){case 0:return o=null==xe?void 0:xe.createTraceId(),null==xe||xe.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,Oe.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===s.SUCCESS?"info":"warn",null==xe||xe[r](l.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===s.SUCCESS?(t.onSuccess(a.userId),i=new Date(Oe.getConnectedTime()-1e3*Be*60*60*24).getTime(),we.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=we.get(e).dealtime;t&&i-t>0&&we.remove(e)}else if(/RECEIVED$/.test(e)){var n=we.get(e),o=Object.keys(n).length;Object.keys(n).forEach((function(e){var t=n[e].dealtime;t&&i-t>0&&delete n[e]})),Object.keys(n).length!==o&&(0===n.length?we.remove(e):we.set(e,n))}}))):a.code===s.RC_CONN_TOKEN_INCORRECT?(null==xe||xe.warn(l.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onTokenIncorrect()):(null==xe||xe.warn(l.O,"connect ->code:".concat(a.code,",token:").concat(e)),t.onError(a.code)),[2]}var i}))}))},reconnect:function(e,t,n){var o=null==xe?void 0:xe.createTraceId();null==xe||xe.info(l.A_RECONNECT_T,null,o),Oe.reconnect(n).then((function(t){var n=t.code===s.SUCCESS?"info":"warn";null==xe||xe[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===s.SUCCESS?e.onSuccess(t.userId):(null==xe||xe.warn(l.O,"reconnect ->code:".concat(t.code)),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:ve,getMessageObjectName:function(e){var t=M(M({},Se),ve);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=Ee(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,Oe.registerMessageType(t,n.isPersited,n.isCounted,o)}},be=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},Ge=function(e,t){this.isCounted=e,this.isPersited=t},De=Ee("TextMessage","RC:TxtMsg"),Ke=Ee("LocationMessage","RC:LBSMsg"),Fe=Ee("TypingStatusMessage","RC:TypSts"),We=Ee("ImageMessage","RC:ImgMsg"),He=Ee("RichContentMessage","RC:ImgTextMsg"),Ve=Ee("VoiceMessage","RC:VcMsg"),je=Ee("HQVoiceMessage","RC:HQVCMsg"),Je=Ee("FileMessage","RC:FileMsg"),qe=Ee("SightMessage","RC:SightMsg"),Ye=Ee("GIFMessage","RC:GIFMsg"),Qe=Ee("ReadReceiptMessage","RC:ReadNtf"),ze=Ee("ReadReceiptRequestMessage","RC:RRReqMsg"),Xe=Ee("RCCombineMessage","RC:CombineMsg"),$e=function(e,t,n,o,a,s,r,c,i,g,u,d,l,h,C,f,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=a,this.messageType=s,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=h,this.canIncludeExpansion=C,this.expansion=f,this.receiptResponse=p,this.disableNotification=S};!function(e){e[e.MEDIA_AUDIO=1]="MEDIA_AUDIO",e[e.MEDIA_VEDIO=2]="MEDIA_VEDIO",e[e.MEDIA_VIDEO=2]="MEDIA_VIDEO"}(ke||(ke={}));var Ze,et=Ee("AcceptMessage","RC:VCAccept"),nt=Ee("RingingMessage","RC:VCRinging"),ot=Ee("SummaryMessage","RC:VCSummary"),at=Ee("HungupMessage","RC:VCHangup"),st=Ee("InviteMessage","RC:VCInvite"),rt=Ee("MediaModifyMessage","RC:VCModifyMedia"),ct=Ee("MemberModifyMessage","RC:VCModifyMem"),it=Ee("lastMessageSendTime","RC:SRSMsg"),gt=Ee("ReferenceMessage","RC:ReferenceMsg"),ut=Ee("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),dt=Ee("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Ze||(Ze={}));var lt=Ze,ht={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=Pe);export{et as AcceptMessage,Me as BaseMessage,_e as ChannelClient,ht as ConnectionState,Je as FileMessage,Ye as GIFMessage,T as GetChatRoomType,je as HQVoiceMessage,at as HungupMessage,Le as IMClient,We as ImageMessage,st as InviteMessage,Ke as LocationMessage,rt as MediaModifyMessage,ct as MemberModifyMessage,be as MentionedInfo,lt as MentionedType,$e as Message,Ge as MessageTag,dt as PublicServiceMultiRichContentMessage,ut as PublicServiceRichContentMessage,Xe as RCCombineMessage,Qe as ReadReceiptMessage,ze as ReadReceiptRequestMessage,Ue as ReadReceiptResponseMessage,gt as ReferenceMessage,He as RichContentMessage,nt as RingingMessage,Pe as RongIMClient,R as SentStatus,qe as SightMessage,ot as SummaryMessage,it as SyncReadStatusMessage,De as TextMessage,Fe as TypingStatusMessage,ke as VoIPMediaType,Ve as VoiceMessage};
1
+ import{httpRequest as e,NetworkType as t,HttpMethod as n,HTTP_TIMEOUT as o,appendUrl as s,ErrorCode as a,SEND_MESSAGE_TYPE_OPTION as r,ReceivedStatus as i,MessageDirection as c,usingCppEngine as g,assert as u,AssertRules as d,LogTagId as l,transformReceivedStatusInfo as h,isArray as f,ConversationType as C,VersionManage as p,AppStorage as S,APIContext as v,logger as I}from"@rongcloud/engine";export{AreaCode,ChatroomEntryType,ChatroomSyncStatusReason,ChatroomUserChangeType,ChrmMemBanType,ChrmMemOperateType,ChrmSyncStatus,ConnectionStatus,ConversationType,ErrorCode,FileType,LogL,LogLevel,LogSource,LogTagId,MessageBlockType,MessageDirection,NotificationStatus,RCConnectionStatus,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 y,R=m;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(y||(y={}));var T=y,M=function(){return M=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},M.apply(this,arguments)};function E(e,t,n,o){return new(n||(n=Promise))((function(s,a){function r(e){try{c(o.next(e))}catch(e){a(e)}}function i(e){try{c(o.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,i)}c((o=o.apply(e,t||[])).next())}))}function N(e,t){var n,o,s,a,r={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(n=1,o&&(s=2&i[0]?o.return:i[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,i[1])).done)return s;switch(o=0,s&&(i=[2&i[0],s.value]),i[0]){case 0:case 1:s=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(!(s=r.trys,(s=s.length>0&&s[s.length-1])||6!==i[0]&&2!==i[0])){r=0;continue}if(3===i[0]&&(!s||i[1]>s[0]&&i[1]<s[3])){r.label=i[1];break}if(6===i[0]&&r.label<s[1]){r.label=s[1],s=i;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(i);break}s[2]&&r.ops.pop(),r.trys.pop();continue}i=t.call(e,r)}catch(e){i=[6,e],o=0}finally{n=s=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}"function"==typeof SuppressedError&&SuppressedError;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 _=null,A=function(e){return E(void 0,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return[4,L.getNetworkType()];case 1:return t=n.sent(),_({status:"online"===e.type,type:t}),[2]}}))}))};var L={tag:"browser",httpReq:function(t){return e(t).result()},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",{id:Date.now(),onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.UNKONWN},n=e.type,o=e.effectiveType,s=n||o||t.UNKONWN;return Promise.resolve(s)},setNetworkStatusListener:function(e){_=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",A),window.addEventListener("online",A))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",A),window.removeEventListener("online",A)),_=null}},B=O(),w=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)}}},k={setItem:w("setStorageSync"),getItem:w("getStorageSync"),removeItem:w("removeStorageSync"),clear:w("clearStorageSync")},x=null,P=function(e){var t=e.isConnected,n=e.networkType;x({status:t,type:n})};var b={tag:"wechat",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,i=e.headers,c=e.query,g=e.body,u=s(e.url,c);return new Promise((function(e){wx.request({url:u,method:t,header:i,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:k,sessionStorage:k,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:B,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){x=e,wx.onNetworkStatusChange(P)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(P),x=null}},G=O(),D=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:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},F=null,W=function(e){var t=e.isConnected,n=e.networkType;F({status:t,type:n})};var H={tag:"alipay",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,i=e.headers,c=e.query,g=e.body,u=s(e.url,c),d=e.dataType||"json";return new Promise((function(e){my.request({url:u,method:t,headers:i,timeout:r,data:g,dataType:d,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:G,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){F=e,my.onNetworkStatusChange(W)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(W),F=null}},V=O(),j=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){}}},J={setItem:j("setStorageSync"),getItem:j("getStorageSync"),removeItem:j("removeStorageSync"),clear:j("clearStorageSync")},q=null,Y=function(e){var t=e.isConnected,n=e.networkType;q({status:t,type:n})};var Q={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:V,localStorage:J,sessionStorage:J,httpReq:function(e){return new Promise((function(t){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){q=e,tt.onNetworkStatusChange(Y)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(Y),q=null}},z=O(),X=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){}}},$={setItem:X("setStorageSync"),getItem:X("getStorageSync"),removeItem:X("removeStorageSync"),clear:X("clearStorageSync")},Z=null,ee=function(e){var t=e.isConnected,n=e.networkType;Z({status:t,type:n})};var te={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:z,localStorage:$,sessionStorage:$,httpReq:function(e){return new Promise((function(t){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){t({status:a.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return E(this,void 0,void 0,(function(){return N(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){Z=e,swan.onNetworkStatusChange(ee)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(ee),Z=null}},ne=O(),oe=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)}}},se={setItem:oe("setStorageSync"),getItem:oe("getStorageSync"),removeItem:oe("removeStorageSync"),clear:oe("clearStorageSync")},ae=null,re=function(e){var t=e.isConnected,n=e.networkType;ae({status:t,type:n})};var ie={tag:"jingdong",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,i=e.headers,c=e.query,g=e.body,u=s(e.url,c);return new Promise((function(e){jd.request({url:u,method:t,header:i,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:se,sessionStorage:se,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:ne,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ae=e,jd.onNetworkStatusChange(re)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(re),ae=null}},ce=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)}}},ge={setItem:ce("setStorageSync"),getItem:ce("getStorageSync"),removeItem:ce("removeStorageSync"),clear:ce("clearStorageSync")},ue=null,de=function(e){var t=e.isConnected,n=e.networkType;ue({status:t,type:n})};var le={tag:"uniapp",httpReq:function(e){var t=e.method||n.GET,r=e.timeout||o,i=e.headers,c=e.query,g=e.body,u=s(e.url,c);return new Promise((function(e){uni.request({url:u,method:t,header:i,timeout:r,data:g,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:a.RC_HTTP_REQ_FAIL})}})}))},localStorage:ge,sessionStorage:ge,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{id:Date.now(),onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var n=t.networkType;e(n)},fail:function(){e(t.UNKONWN)}})}))},setNetworkStatusListener:function(e){ue=e,uni.onNetworkStatusChange(de)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(de),ue=null}},he=function(e){return e&&e.request&&e.getSystemInfo},fe="undefined"!=typeof uni&&he(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return le;case"mp-jd":return ie;case"mp-baidu":return te;case"mp-toutiao":return Q;case"mp-alipay":return H;case"mp-weixin":return b;default:return L}}():"undefined"!=typeof jd&&he(jd)?ie:"undefined"!=typeof my&&he(my)?H:"undefined"!=typeof tt&&he(tt)?Q:"undefined"!=typeof swan&&he(swan)?te:"undefined"!=typeof wx&&he(wx)?b:L;function Ce(e,t,n){return e+"_"+t+"_"+n}var pe=function(){function e(){}return e.set=function(t){if(r[t.messageType]&&r[t.messageType].isPersited){var n=e.get(t.conversationType,t.targetId,t.channelId||"");if(!n||n.sentTime<t.sentTime){var o=Ce(t.conversationType,t.targetId,t.channelId||"");e.map[o]=t}}},e.get=function(t,n,o){var s=Ce(t,n,o);return e.map[s]||null},e.remove=function(t,n,o){var s=Ce(t,n,o);delete e.map[s]},e.clear=function(){e.map={}},e.map={},e}(),Se={"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"},ve={};function Ie(e){var t=e.channelId,n=e.conversationType,o=e.targetId,s=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,i=e.notificationStatus,c=e.matchCount;if(!g()){var u=pe.get(n,o,t||"");(!a||u&&a.sentTime<u.sentTime)&&(a=u)}var d=a?me(a):null;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:s,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:r,notificationStatus:i,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:c}}function me(e){var t=e.conversationType,n=e.targetId,o=e.senderUserId,s=e.content,a=e.messageType,r=e.messageUId,c=e.messageDirection,g=e.isOffLineMessage,u=e.sentTime,d=e.receivedStatus,l=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,C=e.expansion,p=e.messageId,S=e.sentStatus,v=e.channelId,I=e.readReceiptInfo,m=e.pushConfig,y="";return a in Se?y=Se[a]:a in ve?y=ve[a]:(s={message:{content:s,objectName:a},messageName:"UnknownMessage"},y="UnknownMessage"),d||(d=i.UNREAD),void 0===p&&(p=~~(16777215*Math.random())),{channelId:v||"",conversationType:t,targetId:n,senderUserId:o,content:s,messageType:y,messageUId:r,messageDirection:c,offLineMessage:g,sentTime:u,receivedStatus:d,receivedTime:l,objectName:a,messageId:p,sentStatus:S||R.SENT,disableNotification:f,canIncludeExpansion:h,expansion:C,readReceiptInfo:I,pushConfig:m}}function ye(e,t,n,o,s){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,r=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===r&&a&&i===c.SEND){var g=""+t+e.content.messageUId+"SENT";s.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===r&&a){var u=""+t+e.conversationType+e.targetId+"RECEIVED",d=s.get(u);if(d){if(e.senderUserId in d)return void(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,s.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void s.set(u,d)}var h={};h[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},s.set(u,h)}}function Re(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}function Te(e,t,n){try{e(t,n)}catch(e){null===console||void 0===console||console.error(e)}}var Me=function(e,t,n,o,s){void 0===o&&(o=!0),void 0===s&&(s=!0),this.messageType=e,this.objectName=t,this.content=n,this.isPersited=o,this.isCounted=s};function Ee(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0);var s=function(s){return new Me(e,t,s,n,o)};return s.MessageType=e,s.ObjectName=t,s}var Ne,Oe,Ue=Ee("ReadReceiptResponseMessage","RC:RRRspMsg"),_e=function(){function e(e,t,n,o,s,a){this.logger=e,this._context=t,this.channelId=n,this._isCPPMode=o,this._readReceiptTimeout=s,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,t,n){var o=this;u("callback",e,d.CALLBACK),u("conversationTypes",t,d.ARRAY),u("count",n,d.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var s=n.code,r=n.data,i=[];r=r||[],s===a.SUCCESS?(t?r.forEach((function(e){t.indexOf(e.conversationType)>-1&&i.push(Ie(e))})):r.forEach((function(e){i.push(Ie(e))})),Re(e.onSuccess,i)):(o.logger.warn(l.O,"getConversationList -> code:"+s),Te(e.onError,s))}))},e.prototype.getConversation=function(e,t,n){var o=this;u("callback",n,d.CALLBACK),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getConversation ->targetId:"+t+",conversationType:"+e),E(o,void 0,void 0,(function(){var o,s,r;return N(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation(e,t,this.channelId)];case 1:return o=i.sent(),s=o.code,r=o.data,s!==a.SUCCESS?(this.logger.warn(l.O,"getConversation ->code:"+s+",targetId:"+t),n.onError(s),[2]):(n.onSuccess(r?Ie(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeConversation ->targetId:"+t+",conversationType:"+e),this._context.removeConversation(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||pe.remove(e,t,o.channelId),Re(n.onSuccess)):(o.logger.warn(l.O,"removeConversation ->code:"+s+",targetId:"+t),Te(n.onError,s))}))},e.prototype.saveTextMessageDraft=function(e,t,n){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("draftText",n,d.STRING,!0),this.logger.info(l.O,"saveTextMessageDraft ->targetId:"+t+",conversationType:"+e);var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})[e+"_"+t+"_"+this.channelId]=n,!0)},e.prototype.getTextMessageDraft=function(e,t){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getTextMessageDraft ->targetId:"+t+",conversationType:"+e);var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})[e+"_"+t+"_"+this.channelId]},e.prototype.clearTextMessageDraft=function(e,t){u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"clearTextMessageDraft ->targetId:"+t+",conversationType:"+e);var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})[e+"_"+t+"_"+this.channelId]},e.prototype.getTotalUnreadCount=function(e,t,n){var o=this;u("callback",e,d.CALLBACK),this.logger.info(l.O,"getTotalUnreadCount ->conversationTypes:"+t),this._context.getTotalUnreadCount(this.channelId,t,n).then((function(t){var n=t.code,s=t.data;n===a.SUCCESS?Re(e.onSuccess,s):(o.logger.warn(l.O,"getTotalUnreadCount ->code:"+n),Te(e.onError,n))}))},e.prototype.getUnreadCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCount ->targetId:"+t+",conversationType:"+e),this._context.getUnreadCount(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?Re(n.onSuccess,r):(o.logger.warn(l.O,"getUnreadCount ->code:"+s+",targetId:"+t),Te(n.onError,s))}))},e.prototype.clearConversations=function(e,t){var n=this;this.logger.info(l.O,"clearConversations -> conversationTypes:"+t),this._isCPPMode?this._context.clearConversations(t,this.channelId).then((function(t){t===a.SUCCESS?Re(e.onSuccess,!0):(n.logger.warn(l.O,"clearConversations ->code:"+t),Te(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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->targetId:"+t+",conversationType:"+e),this._context.clearUnreadCount(e,t,this.channelId).then((function(e){e===a.SUCCESS?Re(n.onSuccess,!0):(o.logger.warn(l.O,"clearUnreadCount ->code:"+e+",targetId:"+t),Te(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var t=this;u("callback",e,d.CALLBACK),this.logger.info(l.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===a.SUCCESS?Re(e.onSuccess,!0):(t.logger.warn(l.O,"clearUnreadCount ->code:"+n),Te(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getFirstUnreadMessage ->targetId:"+t+",conversationType:"+e),this._context.getFirstUnreadMessage(e,t,this.channelId).then((function(e){e.code===a.SUCCESS?Re(n.onSuccess,e.data?me(e.data):null):(o.logger.warn(l.O,"getFirstUnreadMessage ->code:"+e.code+",targetId:"+t),Te(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,t,n,o){var s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",o,d.CALLBACK),u("status",n,d.OBJECT,!0),this.logger.info(l.O,"setConversationStatus ->targetId:"+t+",status:"+n);var r=n.isTop,i=n.notificationStatus;this._context.setConversationStatus(e,t,r,i,this.channelId).then((function(e){e===a.SUCCESS?Re(o.onSuccess):(s.logger.warn(l.O,"setConversationStatus ->code:"+e+",targetId:"+t),Te(o.onError,e))}))},e.prototype.sendMessage=function(e,t,n,o,s,r,g,f){var C=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("msg",n,d.OBJECT,!0),u("callback",o,d.CALLBACK),u("isMentioned",s,d.BOOLEAN),u("pushContent",r,d.ONLY_STRING),u("pushData",g,d.ONLY_STRING),u("options.userIds",null==f?void 0:f.userIds,d.ARRAY),u("options.isVoipPush",null==f?void 0:f.isVoipPush,d.BOOLEAN),u("options.disableNotification",null==f?void 0:f.disableNotification,d.BOOLEAN),u("options.canIncludeExpansion",null==f?void 0:f.canIncludeExpansion,d.BOOLEAN),u("options.expansion",null==f?void 0:f.expansion,d.OBJECT),u("options.pushConfig",null==f?void 0:f.pushConfig,d.OBJECT),u("options.resendMessageId",null==f?void 0:f.resendMessageId,d.NUMBER),this.logger.info(l.O,"sendMessage ->targetId:"+t+",conversationType:"+e);var p=!(!(null==f?void 0:f.isStatusMessage)&&!(null==f?void 0:f.isStatus)),S=function(e,t,n){var o,s=e||{},a=s.userIds,r=s.isVoipPush,i=s.disableNotification,c=s.isFilerWhiteBlacklist,g=s.expansion,u=s.canIncludeExpansion,d=s.pushConfig,l=s.resendMessageId,h=[];if(t){var f=(n||{}).content.mentionedInfo;h=f.userIdList,o=f.type}return{mentionedType:o,mentionedUserIdList:h,directionalUserIdList:a,isVoipPush:r,disableNotification:i,isFilerWhiteBlacklist:c,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(f,s,n);r=r||"",g=g||"";var v=Object.assign(n,M(M({isMentioned:s,pushContent:r,pushData:g},S),{messageType:n.objectName,channelId:this.channelId,isStatusMessage:p})),I=this._context.getCurrentUserId(),m=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:v.messageType,conversationType:e,targetId:t,channelId:this.channelId}),m),this._context.sendMessage(e,t,v,o.onBefore,m).then((function(s){var r=s.code,g=s.data,u=r===a.SUCCESS?"info":"warn";if(C.logger[u](l.A_SEND_MSG_R,JSON.stringify({code:r,messageUId:g?g.messageUId:"",messageId:g?g.messageId:""}),m),r===a.SUCCESS){C._isCPPMode||pe.set(g);var d=me(g);ye(d,I,C._context.getConnectedTime(),C._readReceiptTimeout,C._storage),Re(o.onSuccess,d)}else C.logger.warn(l.O,"sendMessage ->code:"+r+",targetId:"+t),Te(o.onError,r,me({isMentioned:!!v.isMentioned,content:n.content,messageType:n.messageType,isPersited:n.isPersited,isCounted:n.isCounted,disableNotification:!!(null==f?void 0:f.disableNotification),canIncludeExpansion:!!(null==f?void 0:f.canIncludeExpansion),expansion:(null==f?void 0:f.expansion)||null,conversationType:e,targetId:t,senderUserId:I,messageUId:"",messageDirection:c.SEND,isOffLineMessage:!1,sentTime:(null==g?void 0:g.sentTime)||0,receivedTime:0,isStatusMessage:p,receivedStatus:i.UNREAD,receivedStatusInfo:h(i.UNREAD),messageId:null==g?void 0:g.messageId,sentStatus:R.FAILED}))}))},e.prototype.sendRecallMessage=function(e,t,n){var o=this;u("message.conversationType",e.conversationType,d.NUMBER,!0),u("message.targetId",e.targetId,d.STRING,!0),u("message.messageUId",e.messageUId,d.STRING,!0),u("message.sentTime",e.sentTime,d.NUMBER,!0),u("callback",t,d.CALLBACK),u("options.disableNotification",null==n?void 0:n.disableNotification,d.BOOLEAN),u("options.pushConfig",null==n?void 0:n.pushConfig,d.OBJECT),u("options.extra",null==n?void 0:n.extra,d.STRING);var s=e.conversationType,r=e.targetId,i=e.messageUId,c=e.sentTime;this.logger.info(l.O,"sendRecallMessage ->targetId:"+r+",conversationType:"+s+",messageUId:"+i);var g=M({channelId:this.channelId},n);this._context.recallMessage(s,r,i,c,g).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?(o._isCPPMode||pe.set(s),Re(t.onSuccess,me(s))):(o.logger.warn(l.O,"sendRecallMessage ->code:"+n+",targetId:"+r+",messageUId:"+i),Te(t.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,t,n,o){var s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("typingContentType",n,d.STRING,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"sendTypingStatusMessage ->targetId:"+t+",conversationType:"+e);var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},i=this.logger.createTraceId();this.logger.info(l.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:t,channelId:r.channelId}),i),this._context.sendMessage(e,t,r,void 0,i).then((function(e){var n=e.code,r=e.data,c=n===a.SUCCESS?"info":"warn";s.logger[c](l.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),i),n===a.SUCCESS?Re(o.onSuccess,me(r)):(s.logger.warn(l.O,"sendTypingStatusMessage ->code:"+n+",targetId:"+t),Te(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,t,n){var o=this;this.logger.info(l.O,"sendReceiptResponse ->targetId:"+t+",conversationType:"+e);var s=""+this._context.getCurrentUserId()+e+t+"RECEIVED",a=this._storage.get(s);if(a){var r=[];for(var i in a){var c={};c[i]=a[i].uIds,a[i].isResponse||r.push(c)}if(0===r.length)return void n.onSuccess(null);var g=setInterval((function(){1===r.length&&clearInterval(g);var i=r.splice(0,1)[0],c=new Ue({receiptMessageDic:i});o.sendMessage(e,t,c,{onSuccess:function(e){var t=Object.keys(i)[0];a[t].isResponse=!0,o._storage.set(s,a),Re(n.onSuccess,e)},onError:function(e){o.logger.warn(l.O,"sendReceiptResponse ->code:"+e+",targetId:"+t),Te(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,t,n){var o=this;u("messageUIds",e,d.ARRAY,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"sendReadReceiptMessage ->targetId:"+t+",messageUIds:"+e);for(var s=0,r=e;s<r.length;s++){var i=r[s];u("messageUId",i,d.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:"+r+",targetId:"+t+",messageUIds:"+e),n.onError(r))})).catch((function(s){o.logger.warn(l.O,"sendReadReceiptMessage ->code:"+s+",targetId:"+t+",messageUIds:"+e),n.onError(s)}))},e.prototype.getMessageReader=function(e,t,n){var o=this;u("messageUId",e,d.STRING,!0),u("targetId",t,d.STRING,!0),this.logger.info(l.O,"getMessageReader ->targetId:"+t+",messageUId:"+e),this._context.getMessageReader(t,e,this.channelId).then((function(s){var r=s.code,i=s.data;r===a.SUCCESS?n.onSuccess(i):(o.logger.warn(l.O,"getMessageReader ->code:"+r+",targetId:"+t+",messageUId:"+e),n.onError(r))})).catch((function(s){o.logger.warn(l.O,"getMessageReader ->code:"+s+",targetId:"+t+",messageUId:"+e),n.onError(s)}))},e.prototype.updateMessageExpansion=function(e,t,n){var o=this;u("expansion",e,d.OBJECT,!0),u("message",t,d.OBJECT,!0);var s=t.conversationType,r=t.targetId,i=t.messageUId,c=t.canIncludeExpansion,g=t.expansion;this.logger.info(l.O,"updateMessageExpansion ->targetId:"+r+",messageUId:"+i+",conversationType:"+s),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:i,canIncludeExpansion:c,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"updateMessageExpansion ->code:"+t+",targetId:"+r+",messageUId:"+i),Te(n.onError,t))}))},e.prototype.removeMessageExpansionForKey=function(e,t,n){var o=this;u("keys",e,d.ARRAY,!0),u("message",t,d.OBJECT,!0);var s=t.conversationType,r=t.targetId,i=t.messageUId,c=t.canIncludeExpansion;this.logger.info(l.O,"removeMessageExpansionForKey ->targetId:"+r+",messageUId:"+i+",conversationType:"+s),this._context.sendExpansionMessage({conversationType:s,targetId:r,messageUId:i,canIncludeExpansion:c,keys:e,channelId:this.channelId}).then((function(e){var t=e.code;t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"removeMessageExpansionForKey ->code:"+t+",targetId:"+r+",messageUId:"+i),Te(n.onError,t))}))},e.prototype.getHistoryMessages=function(e,t,n,o,s,r,i){var c=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",s,d.CALLBACK,!0),u("order",i,d.NUMBER),this.logger.info(l.O,"getHistoryMessages ->targetId:"+t+",conversationType:"+e+",timestamp:"+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,i,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,i=[],u=o.map((function(e){return i.push(e.messageUId),me(e)}));c.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:i.join(",")}),g),Re(s.onSuccess,u,r)}else c.logger.info(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),Re(s.onSuccess,[],!1);else c.logger.warn(l.A_GET_HISTORY_MSG_R,JSON.stringify({code:t,messageUIds:""}),g),Te(s.onError,t)}))},e.prototype.deleteRemoteMessages=function(e,t,n,o){var s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("messages",n,d.ARRAY,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"deleteRemoteMessages ->targetId:"+t+",conversationType:"+e),this._context.deleteRemoteMessage(e,t,n,this.channelId).then((function(r){if(r===a.SUCCESS){if(!s._isCPPMode){var i=pe.get(e,t,s.channelId);i&&n.forEach((function(n){i.messageUId===n.messageUId&&pe.remove(e,t,s.channelId)}))}Re(o.onSuccess)}else s.logger.warn(l.O,"deleteRemoteMessages ->code:"+r+",targetId:"+t),Te(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,t){var n=this;u("param.conversationType",e.conversationType,d.NUMBER,!0),u("param.targetId",e.targetId,d.STRING,!0),u("param.timestamp",e.timestamp,d.NUMBER,!0),u("callback",t,d.CALLBACK);var o=e.conversationType,s=e.targetId,r=e.timestamp;this.logger.info(l.O,"clearRemoteHistoryMessages ->targetId:"+s+",conversationType:"+o),this._context.deleteRemoteMessageByTimestamp(o,s,r,this.channelId).then((function(e){e===a.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"clearRemoteHistoryMessages ->code:"+e),Te(t.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){u("callback",e,d.CALLBACK),this._context.getConversationListWithAllChannel().then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?Re(e.onSuccess,o.map(Ie)):Te(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){u("callback",e,d.CALLBACK),u("index",t,d.NUMBER),u("limit",n,d.NUMBER),this._context.getConversationListWithAllChannelByPage(t,n).then((function(t){var n=t.code,o=t.data;n===a.SUCCESS?Re(e.onSuccess,o.map(Ie)):Te(e.onError,n)}))},e.prototype.insertMessage=function(e,t,n,o,s){var r=this;void 0===s&&(s={});var i=n.senderUserId,c=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,h=n.expansion,f=n.disableNotification,C=n.sentTime,p=n.sentStatus;this.logger.info(l.O,"insertMessage ->targetId:"+t+",conversationType:"+e);var S=s.isUnread,v={senderUserId:i,messageType:c,content:g,messageDirection:u,sentTime:C,sentStatus:p,searchContent:s.searchContent,isUnread:S,messageUId:"",disableNotification:f,canIncludeExpansion:d,expansionMsg:JSON.stringify(h),channelId:this.channelId};this._context.insertMessage(e,t,v).then((function(e){var n=e.code,s=e.data;n===a.SUCCESS?Re(o.onSuccess,me(s)):(r.logger.warn(l.O,"insertMessage ->code:"+n+",targetId:"+t),Te(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,t,n){this._context.batchInsertMessage(e,t).then((function(e){var t=e.code,o=e.data;t===a.SUCCESS?Re(n.onSuccess,o):Te(n.onError,t)}))},e.prototype.getMessageCount=function(e,t,n){this._context.getMessageCount(e,t).then((function(e){var t=e.code,o=e.data;t===a.SUCCESS?Re(n.onSuccess,o):Te(n.onError,t)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var r=this;this.logger.info(l.O,"deleteLocalMessagesByTimestamp ->targetId:"+t+",conversationType:"+e+",timestamp:"+n),this._context.deleteMessagesByTimestamp(e,t,n,o,this.channelId).then((function(e){e===a.SUCCESS?Re(s.onSuccess,!0):(r.logger.warn(l.O,"deleteLocalMessagesByTimestamp ->code:"+e+",targetId:"+t),Te(s.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,r){var i=this;this.logger.info(l.O,"getRemoteHistoryMessages ->targetId:"+t+",conversationType:"+e);var c=r.order||0;this._context.getRemoteHistoryMessages(e,t,n,o,c,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===a.SUCCESS)if(o){var r=o.list,c=o.hasMore,g=r.map((function(e){return me(e)}));Re(s.onSuccess,g,c)}else Re(s.onSuccess,[],!1);else i.logger.warn(l.O,"getRemoteHistoryMessages ->code:"+n+",targetId:"+t),Te(s.onError,n)}))},e.prototype.clearMessages=function(e,t,n){var o=this;this.logger.info(l.O,"clearMessages ->targetId:"+t+",conversationType:"+e),this._context.clearMessages(e,t,this.channelId).then((function(s){s===a.SUCCESS?(o._isCPPMode||pe.remove(e,t,o.channelId),Re(n.onSuccess,!0)):(o.logger.warn(l.O,"clearMessages ->code:"+s+",targetId:"+t),Te(n.onError,s))}))},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;this.logger.info(l.O,"searchConversationByContent ->keyword:"+e),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,i=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){i.push(Ie(e))})),Re(t.onSuccess,i)):(s.logger.warn(l.O,"searchConversationByContent ->code:"+o+",keyword:"+e),Te(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:"+e),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,i=[];r=r||[],o===a.SUCCESS?(r.forEach((function(e){i.push(Ie(e))})),Re(t.onSuccess,i)):(s.logger.warn(l.O,"searchConversationByContentWithAllChannel ->code:"+o+",keyword:"+e),Te(t.onError,o))}))},e.prototype.searchMessageByContent=function(e,t,n,o,s,r,i){var c=this;this.logger.info(l.O,"searchMessageByContent ->targetId:"+t+",conversationType:"+e+",keyword:"+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,u=r.count;g.forEach((function(e){s.push(me(e))})),Re(i.onSuccess,s,u)}else c.logger.warn(l.O,"searchMessageByContent ->code:"+n+",targetId:"+t),Te(i.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,r){var i=this;this.logger.info(l.O,"searchMessageByContentWithAllChannel ->targetId: "+t+" ,conversationType: "+e+" ,keyword: "+n+", timestamp: "+o+", count: "+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 c=o=o||{},g=c.messages,u=c.count;g.forEach((function(e){s.push(me(e))})),Re(r.onSuccess,s,u)}else i.logger.warn(l.O,"searchMessageByContentWithAllChannel ->code:"+n+",targetId:"+t),Te(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,r,i,c){var g=this;this.logger.info(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: "+t+" ,conversationType: "+e+" ,keyword: "+n+", startTime: "+o+", endTime: "+s+", offset: "+r+", limit: "+i),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,r,i).then((function(e){var n=e.code,o=e.data,s=[];n===a.SUCCESS?((o=o||{}).messages.forEach((function(e){s.push(me(e))})),Re(c.onSuccess,s)):(g.logger.warn(l.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:"+n+",targetId:"+t),Te(c.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,t){return this.logger.info(l.O,"getUnreadMentionedMessages ->targetId:"+t+",conversationType:"+e),this._context.getUnreadMentionedMessages(e,t,this.channelId).map((function(e){return me(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,t,n,o){var s=this;this.logger.info(l.O,"clearUnreadCountByTimestamp ->targetId:"+t+",conversationType:"+e),this._context.clearUnreadCountByTimestamp(e,t,n,this.channelId).then((function(e){e===a.SUCCESS?Re(o.onSuccess,!0):(s.logger.warn(l.O,"clearUnreadCountByTimestamp ->code:"+e+",targetId:"+t),Te(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,t,n){var o=this;this.logger.info(l.O,"getConversationNotificationStatus ->targetId:"+t+",conversationType:"+e),this._context.getConversationNotificationStatus(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?Re(n.onSuccess,r):(o.logger.warn(l.O,"getConversationNotificationStatus ->code:"+s+",targetId:"+t),Te(n.onError,s))}))},e.prototype.getGroupMessageDeliverList=function(e,t,n){var o=this;this.logger.info(l.O,"getGroupMessageDeliverList ->targetId:"+e+"',messageUId:"+t),this._context.getGroupMessageDeliverList(e,t,this.channelId).then((function(e){var s=e.code,r=e.data;s===a.SUCCESS?Re(n.onSuccess,r):(o.logger.warn(l.O,"getGroupMessageDeliverList ->code:"+s+",messageUId:"+t),Te(n.onError,s))}))},e.prototype.getPrivateMessageDeliverTime=function(e,t){var n=this;this.logger.info(l.O,"getPrivateMessageDeliverTime -> messageUId:"+e),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getPrivateMessageDeliverTime ->code:"+s+",messageUId:"+e),Te(t.onError,s))}))},e}(),Ae=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},Le=function(){function e(e,t,n,o){this._context=e,this._options=t,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=g(),this._defaultChannelClient=new _e(this.logger,e,"",this._isCPPMode,t.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,t,n){if(!this._isCPPMode)return null==n||n.onError(a.NOT_SUPPORT),void this.logger.error(l.O,"'"+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:"+e),!this._isCPPMode)return this.logger.error(l.O,"getChannel method is only available in protocol stack mode"),null;if(u("channelId",e,d.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 _e(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=t,t},e.prototype.deleteChannels=function(e){var t=this;u("channelIds",e,d.ARRAY,!0),this.logger.info(l.O,"deleteChannels ->channelIds:"+e),this.assertCPPMode((function(){e.forEach((function(e){delete t._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.9.6"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return E(this,void 0,void 0,(function(){return N(this,(function(t){switch(t.label){case 0:return this.logger.info(l.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,n){this._defaultChannelClient.getConversationList(e,t,n)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,n){void 0===n&&(n=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,n)},e.prototype.getConversation=function(e,t,n){return this._defaultChannelClient.getConversation(e,t,n)},e.prototype.removeConversation=function(e,t,n){return this._defaultChannelClient.removeConversation(e,t,n)},e.prototype.saveTextMessageDraft=function(e,t,n){return this._defaultChannelClient.saveTextMessageDraft(e,t,n)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,n){return this._defaultChannelClient.getTotalUnreadCount(e,t,n)},e.prototype.getUnreadCount=function(e,t,n){return this._defaultChannelClient.getUnreadCount(e,t,n)},e.prototype.getConversationUnreadCount=function(e,t){this.logger.error(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,s,a,r,i,c){return this._defaultChannelClient.sendMessage(e,t,n,o,s,a,r,c)},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,s,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,n,o,s,a,r)},e.prototype.joinChatRoom=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"joinChatRoom ->chatRoomId:"+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?Re(n.onSuccess):(o.logger.warn(l.O,"joinChatRoom ->code:"+t+",chatRoomId:"+e),Te(n.onError,t))}))},e.prototype.quitChatRoom=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"quitChatRoom ->chatRoomId:"+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?Re(t.onSuccess):(n.logger.warn(l.O,"quitChatRoom ->code:"+s+",chatRoomId:"+e),Te(t.onError,s))}))},e.prototype.getChatRoomInfo=function(e,t,n,o){var s=this;u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"getChatRoomInfo ->chatRoomId:"+e),this._context.getChatroomInfo(e,t,n).then((function(t){var n=t.code,r=t.data;n===a.SUCCESS?Re(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(s.logger.warn(l.O,"getChatRoomInfo ->code:"+n+",chatRoomId:"+e),Te(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"setChatroomEntry ->chatRoomId:"+e),this._context.setChatroomEntry(e,t).then((function(t){t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"setChatroomEntry ->code:"+t+",chatRoomId:"+e),Te(n.onError,t))}))},e.prototype.setChatRoomEntries=function(e,t,n){var o=this;if(u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("entry.key",e.key,d.STRING,!0),u("entry.value",e.value,d.STRING,!0)})),u("options.isAutoDelete",e.isAutoDelete,d.BOOLEAN)}(t),u("callback",n,d.CALLBACK),t.entries.length>10)Te(n.onError,a.CHATROOM_KV_STORE_OUT_LIMIT);else{var s="id:"+e;this.logger.info(l.O,"set chatroom entry->"+s),this._context.setChatroomEntries(e,t).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"set chatroom entry fail ->code+:"+t+","+s),Te(n.onError,t,r))}))}},e.prototype.forceSetChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceSetChatroomEntry ->chatRoomId:"+e),this._context.forceSetChatroomEntry(e,t).then((function(t){t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"forceSetChatroomEntry ->code:"+t+",chatRoomId:"+e),Te(n.onError,t))}))},e.prototype.removeChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"removeChatroomEntry ->chatRoomId:"+e),this._context.removeChatroomEntry(e,t).then((function(t){t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"removeChatroomEntry ->code:"+t+",chatRoomId:"+e),Te(n.onError,t))}))},e.prototype.removeChatRoomEntries=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),function(e){e.entries.forEach((function(e){u("key",e,d.STRING,!0)}))}(t);var s="id:"+e;this.logger.debug(l.O,"remove chatroom entry->"+s);var r=M({},t);r.entries=t.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,r).then((function(e){var t=e.code,r=e.data;t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"remove chatroom entry fail ->code+:"+t+","+s),Te(n.onError,t,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("chatroomEntry",t,d.OBJECT,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"forceRemoveChatroomEntry ->chatRoomId:"+e),this._context.forceRemoveChatroomEntry(e,t).then((function(t){t===a.SUCCESS?Re(n.onSuccess):(o.logger.warn(l.O,"forceRemoveChatroomEntry ->code:"+t+",chatRoomId:"+e),Te(n.onError,t))}))},e.prototype.getChatroomEntry=function(e,t,n){var o=this;u("chatRoomId",e,d.STRING,!0),u("key",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getChatroomEntry ->chatRoomId:"+e+",key:"+t),this._context.getChatroomEntry(e,t).then((function(t){var s=t.code,r=t.data;s===a.SUCCESS?Re(n.onSuccess,r||""):(o.logger.warn(l.O,"getChatroomEntry ->code:"+s+",chatRoomId:"+e),Te(n.onError,s))}))},e.prototype.getAllChatroomEntries=function(e,t){var n=this;u("chatRoomId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getAllChatroomEntries ->chatRoomId:"+e),this._context.getAllChatroomEntries(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getAllChatroomEntries ->code:"+s+",chatRoomId:"+e),Te(t.onError,s))}))},e.prototype.getChatRoomHistoryMessages=function(e,t,n,o,s){var r=this;void 0===s&&(s=0),u("chatRoomId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("order",n,d.NUMBER,!0),u("callback",o,d.CALLBACK),u("timestamp",s,d.NUMBER),this.logger.info(l.O,"getChatRoomHistoryMessages ->chatRoomId:"+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 i=s.list,c=s.hasMore,g=i.map((function(e){return me(e)}));Re(o.onSuccess,g,c)}else Re(o.onSuccess,[],!1);else r.logger.warn(l.O,"getChatRoomHistoryMessages ->code:"+n+",chatRoomId:"+e),Te(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,s){u("fileType",e,d.NUMBER,!0),u("fileName",n,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getFileToken ->fileType:"+e+",fileName:"+n+",queryString:"+s),this._context.getFileToken(e,n,o,s).then(t.onSuccess).catch(t.onError)},e.prototype.getFileUrl=function(e,t,n,o,s,a){u("fileType",e,d.NUMBER,!0),u("fileName",t,d.STRING,!0),u("saveName",n,d.STRING),u("callback",o,d.CALLBACK),u("serverType",a,d.NUMBER),u("uploadRes",s,d.OBJECT),this.logger.info(l.O,"getFileUrl ->fileType:"+e+",fileName:"+t),this._context.getFileUrl(e,t,n,s,a).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,t){var n=this;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagId",e.tagId,(function(e){return e.length<=10})),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("tag.tagName",e.tagName,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"createTag ->tagId:"+e.tagId+",tagName:"+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:"+s+",tagId:"+e.tagId),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"createTag ->code:"+o+",tagId:"+e.tagId),t.onError(o)}))},e.prototype.removeTag=function(e,t){var n=this;u("tagId",e,d.STRING,!0),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeTag ->tagId:"+e),this._context.removeTag(e).then((function(o){var s=o.code;s===a.SUCCESS?t.onSuccess():(n.logger.warn(l.O,"removeTag ->code:"+s+",tagId:"+e),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"removeTag ->code:"+o+",tagId:"+e),t.onError(o)}))},e.prototype.updateTag=function(e,t){var n=this;u("tag.tagId",e.tagId,d.STRING,!0),u("tag.tagName",e.tagName,d.STRING,!0),u("tag.tagName",e.tagName,(function(e){return e.length<=15})),u("callback",t,d.CALLBACK),this.logger.info(l.O,"updateTag ->tagId:"+e.tagId+",tagName:"+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:"+s+",tagId:"+e.tagId),t.onError(s))})).catch((function(o){n.logger.warn(l.O,"updateTag ->reason:"+o+",tagId:"+e.tagId),t.onError(o)}))},e.prototype.getTagList=function(e){var t=this;u("callback",e,d.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?e.onSuccess(s||[]):(t.logger.warn(l.O,"getTagList ->code:"+o),e.onError(o))})).catch((function(n){t.logger.warn(l.O,"getTagList ->reason:"+n),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,t){var n=this;u("conversationType",e.type,d.NUMBER),u("targetId",e.targetId,d.STRING),u("channelId",e.channelId,d.ONLY_STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.type),this._context.getTagsForConversation(Ae(e)).then((function(e){var o=e.code,s=e.data;o===a.SUCCESS?t.onSuccess(s||[]):(n.logger.warn(l.O,"getTagsForConversation ->code:"+o),t.onError(o))})).catch((function(e){n.logger.warn(l.O,"getTagsForConversation ->reason:"+e),t.onError(e)}))},e.prototype.addTagForConversations=function(e,t,n){var o=this;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"addTagForConversations ->tagId:"+e),this._context.addTagForConversations(e,t.map((function(e){return Ae(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"addTagForConversations ->code:"+s+",tagId:"+e),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"addTagForConversations ->reason:"+t+",tagId:"+e),n.onError(t)}))},e.prototype.removeTagForConversations=function(e,t,n){var o=this;u("tagId",e,d.STRING,!0),u("conversations",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING)})),this.logger.info(l.O,"removeTagForConversations ->tagId:"+e),this._context.removeTagForConversations(e,t.map((function(e){return Ae(e)}))).then((function(t){var s=t.code;t.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagForConversations ->code:"+s+",tagId:"+e),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"removeTagForConversations ->reason:"+t+",tagId:"+e),n.onError(t)}))},e.prototype.removeTagsForConversation=function(e,t,n){var o=this;u("conversation.type",e.type,d.NUMBER,!0),u("conversation.targetId",e.targetId,d.STRING,!0),u("conversation.channelId",e.channelId,d.ONLY_STRING),u("tagIds",t,d.ARRAY,!0),u("callback",n,d.CALLBACK),t.forEach((function(e){u("tagId",e,d.STRING,!0)})),this.logger.info(l.O,"removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",type:"+e.type),this._context.removeTagsForConversation(Ae(e),t).then((function(e){var s=e.code;e.data,s===a.SUCCESS?n.onSuccess():(o.logger.warn(l.O,"removeTagsForConversation ->code:"+s+",tagIds:"+t),n.onError(s))})).catch((function(e){o.logger.warn(l.O,"removeTagsForConversation ->reason:"+e+",tagIds:"+t),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,t,n,o){var s=this;u("tagId",e,d.STRING,!0),u("count",t,d.NUMBER,!0),u("startTime",n,d.NUMBER,!0),u("callback",o,d.CALLBACK,!0),this.logger.info(l.O,"getConversationListByTag ->tagId:"+e),this._context.getConversationListByTag(e,n,t).then((function(t){var n=t.code,r=t.data,i=[];n===a.SUCCESS?((r=r||[]).forEach((function(e){i.push(function(e){var t=e.channelId,n=e.conversationType,o=e.targetId,s=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,i=e.notificationStatus,c=e.isTopInTag,g=a?me(a):null,u=g||{},d=u.messageType,l=u.sentTime,h=u.receivedStatus;return{channelId:t||"",conversationType:n,targetId:o,unreadMessageCount:s,latestMessage:g,isTopInTag:c,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:i,receivedStatus:h}}(e))})),o.onSuccess(i)):(s.logger.warn(l.O,"getConversationListByTag ->code:"+n+",tagId:"+e),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"getConversationListByTag ->reason:"+t+",tagId:"+e),o.onError(t)}))},e.prototype.getUnreadCountByTag=function(e,t,n){var o=this;u("tagId",e,d.STRING,!0),u("containMuted",t,d.BOOLEAN,!0),u("callback",n,d.CALLBACK),this.logger.info(l.O,"getUnreadCountByTag ->tagId:"+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:"+s+",tagId:"+e),n.onError(s))})).catch((function(t){o.logger.warn(l.O,"getUnreadCountByTag ->reason:"+t+",tagId:"+e),n.onError(t)}))},e.prototype.setConversationStatusInTag=function(e,t,n,o){var s=this;u("tagId",e,d.STRING,!0),u("conversation.targetId",t.targetId,d.STRING,!0),u("conversation.type",t.type,d.NUMBER,!0),u("conversation.channelId",t.channelId,d.ONLY_STRING),u("status.isTop",null==n?void 0:n.isTop,d.BOOLEAN,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",type"+t.type),this._context.setConversationStatusInTag(e,Ae(t),n).then((function(t){var n=t.code;t.data,n===a.SUCCESS?o.onSuccess():(s.logger.warn(l.O,"setConversationStatusInTag ->code:"+n+",tagId:"+e),o.onError(n))})).catch((function(t){s.logger.warn(l.O,"setConversationStatusInTag ->reason:"+t+",tagId:"+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:"+e),(n=this._context).callExtra.apply(n,function(e,t,n){if(n||2===arguments.length)for(var o,s=0,a=t.length;s<a;s++)!o&&s in t||(o||(o=Array.prototype.slice.call(t,0,s)),o[s]=t[s]);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:"+s),t.onError&&Te(t.onError,s);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?me(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var i=r,c=i.list,g=i.hasMore,u=c.map((function(e){return me(e)}));return void Re(t.onSuccess,u,g)}t.onSuccess&&Re(t.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,t){u("callback",t,d.CALLBACK),this.logger.info(l.O,"hasRemoteUnreadMessages ->token:"+e),this.assertCPPMode((function(){Re(t.onSuccess,!1)}),"hasRemoteUnreadMessages",t)},e.prototype.setUserStatusListener=function(e,t){var n=this;this.logger.info(l.O,"setUserStatusListener ->userIds:"+e.userIds),this.assertCPPMode((function(){n._context.setUserStatusListener(e,t)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,t){var n=this;u("status",e,d.NUMBER),u("callback",t,d.CALLBACK),this.logger.info(l.O,"setUserStatus ->status:"+e),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===a.SUCCESS?Re(t.onSuccess,!0):(n.logger.warn(l.O,"setUserStatus ->code:"+e),Te(t.onError,e))}))}),"setUserStatus",t)},e.prototype.getUserStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getUserStatus ->userId:"+e),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getUserStatus ->code:"+s+",useerId:"+e),Te(t.onError,s))}))}),"getUserStatus",t)},e.prototype.addToBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"addToBlacklist ->userId:"+e),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===a.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"addToBlacklist ->code:"+o+",useerId:"+e),Te(t.onError,o))}))}),"addToBlacklist",t)},e.prototype.removeFromBlacklist=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"removeFromBlacklist ->userId:"+e),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===a.SUCCESS?Re(t.onSuccess):(n.logger.warn(l.O,"removeFromBlacklist ->code:"+o+",useerId:"+e),Te(t.onError,o))}))}),"removeFromBlacklist",t)},e.prototype.getBlacklist=function(e){var t=this;u("callback",e,d.CALLBACK),this.assertCPPMode((function(){t._context.getBlacklist().then((function(n){var o=n.code,s=n.data;o===a.SUCCESS?Re(e.onSuccess,s):(t.logger.warn(l.O,"getBlacklist ->code:"+o),Te(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,t){var n=this;u("userId",e,d.STRING),u("callback",t,d.CALLBACK),this.logger.info(l.O,"getBlacklistStatus ->userId:"+e),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?Re(t.onSuccess,r):(n.logger.warn(l.O,"getBlacklistStatus ->code:"+s+",userId:"+e),Te(t.onError,s))}))}),"getBlacklistStatus",t)},e.prototype.insertMessage=function(e,t,n,o,s){var a=this;void 0===s&&(s={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("content.senderUserId",n.senderUserId,d.STRING,!0),u("content.messageDirection",n.messageDirection,d.NUMBER,!0),u("content.objectName",n.objectName,d.STRING,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"insertMessage ->targetId:"+t+",conversationType:"+e+",senderUserId:"+n.senderUserId),this.assertCPPMode((function(){a._defaultChannelClient.insertMessage(e,t,n,o,s)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,t,n){var o,s,a=this;for(var r in u("messages",e,(function(t){return f(t)&&!(e.length<=0||e.length>=500)}),!0),u("checkDuplicate",t,d.BOOLEAN),u("callback",n,d.CALLBACK),e)u("message",e[r],d.OBJECT,!0),u("message.conversationType",e[r].conversationType,(function(e){return[C.PRIVATE,C.DISCUSSION,C.GROUP,C.CUSTOMER_SERVICE,C.SYSTEM,C.APP_PUBLIC_SERVICE,C.PUBLIC_SERVICE].includes(e)}),!0),u("message.targetId",e[r].targetId,d.STRING,!0),u("message.senderUserId",e[r].senderUserId,d.STRING,!0),u("message.messageType",e[r].messageType,d.STRING,!0),u("message.content",e[r].content,d.OBJECT,!0),u("message.messageDirection",e[r].messageDirection,d.NUMBER,!0),u("message.canIncludeExpansion",e[r].canIncludeExpansion,d.BOOLEAN),u("message.expansion",e[r].expansion,d.OBJECT),u("message.disableNotification",e[r].disableNotification,d.BOOLEAN),u("message.sentTime",e[r].sentTime,d.NUMBER),u("message.sentStatus",e[r].sentStatus,d.NUMBER),u("options.isUnread",null===(o=e[r])||void 0===o?void 0:o.isUnread,d.BOOLEAN),u("options.searchContent",null===(s=e[r])||void 0===s?void 0:s.searchContent,d.STRING);this.assertCPPMode((function(){a._defaultChannelClient.batchInsertMessage(e,t,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,t,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,t,n,o,s,a){var r=this;void 0===a&&(a={}),u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("count",o,d.NUMBER,!0),u("callback",s,d.CALLBACK),u("options.order",a.order,d.NUMBER),this.assertCPPMode((function(){r._defaultChannelClient.getRemoteHistoryMessages(e,t,n,o,s,a)}),"getRemoteHistoryMessages",s)},e.prototype.deleteLocalMessages=function(e,t,n,o){var s=this;u("messageIds",n,d.ARRAY,!0),u("callback",o,d.CALLBACK),this.logger.info(l.O,"deleteLocalMessages ->messageIds:"+n),this.assertCPPMode((function(){s._context.deleteMessages(n).then((function(e){e===a.SUCCESS?Re(o.onSuccess,!0):(s.logger.warn(l.O,"deleteLocalMessages ->code:"+e+",messageIds:"+n),Te(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,t,n,o,s){var a=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),u("cleanSpace",o,d.BOOLEAN),u("callback",s,d.CALLBACK),this.assertCPPMode((function(){a._defaultChannelClient.deleteLocalMessagesByTimestamp(e,t,n,o,s)}),"deleteLocalMessagesByTimestamp",s)},e.prototype.clearMessages=function(e,t,n){var o=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("callback",n,d.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,t,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,t){var n=this;u("callback",t,d.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var s=o.code,r=o.data;s===a.SUCCESS?Re(t.onSuccess,me(r)):(n.logger.warn(l.O,"getMessage ->code:"+s+",messageId:"+e),Te(t.onError,s))}))}),"getMessage",t)},e.prototype.setMessageSentStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("sentStatus",t,d.NUMBER,!0),this.logger.info(l.O,"setMessageSentStatus ->messageId:"+e+",sentStatus:"+t),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,t).then((function(t){t===a.SUCCESS?Re(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageSentStatus ->code:"+t+",messageId:"+e),Te(n.onError,t))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("receivedStatus",t,d.NUMBER,!0),this.logger.info(l.O,"setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,t).then((function(t){t===a.SUCCESS?Re(n.onSuccess,!0):(o.logger.warn(l.O,"setMessageReceivedStatus ->code:"+t+",messageId:"+e),Te(n.onError,t))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,t,n,o){var s=this;u("messageId",e,d.NUMBER,!0),u("objectName",n,d.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?Re(o.onSuccess,!0):Te(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,t,n){var o=this;u("messageId",e,d.NUMBER,!0),u("searchFiles",n,d.STRING,!0),this.logger.info(l.O,"setMessageSearchField ->messageId:"+e+",searchFiles:"+n),this.assertCPPMode((function(){o._context.setMessageSearchField(e,t,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,t,n,o){var s=this;u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",n,d.ARRAY),u("customMessageType",o,d.ARRAY),this.assertCPPMode((function(){s._defaultChannelClient.searchConversationByContent(e,t,n,o)}),"searchConversationByContent",t)},e.prototype.searchConversationByContentWithAllChannel=function(e,t,n,o){var s=this;void 0===n&&(n=[]),u("keyword",e,d.STRING,!0),u("callback",t,d.CALLBACK),u("conversationTypes",o,d.ARRAY),u("customMessageType",n,d.ARRAY),this.assertCPPMode((function(){s._defaultChannelClient.searchConversationByContentWithAllChannel(e,t,n,o)}),"searchConversationByContentWithAllChannel",t)},e.prototype.searchMessageByContent=function(e,t,n,o,s,a,r){var i=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",s,d.NUMBER),u("total",a,d.NUMBER),u("callback",r,d.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContent(e,t,n,o,s,a,r)}),"searchMessageByContent",r)},e.prototype.searchMessageByContentWithAllChannel=function(e,t,n,o,s,a){var r=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("timestamp",o,d.NUMBER),u("count",s,d.NUMBER),u("callback",a,d.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.searchMessageByContentWithAllChannel(e,t,n,o,s,a)}),"searchMessageByContentWithAllChannel",a)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,t,n,o,s,a,r,i){var c=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("keyword",n,d.STRING,!0),u("startTime",o,d.NUMBER),u("endTime",s,d.NUMBER),u("offset",a,d.NUMBER),u("limit",r,d.NUMBER),u("callback",i,d.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,t,n,o,s,a,r,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,t){return this._isCPPMode?(u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.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 s=this;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),u("timestamp",n,d.NUMBER,!0),this.assertCPPMode((function(){s._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;u("conversationType",e,d.NUMBER,!0),u("targetId",t,d.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,t,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,n){this._defaultChannelClient.getGroupMessageDeliverList(e,t,n)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Be=1;p.add("imlib-v2-adapter","5.9.6");var we,ke,xe=null,Pe={init:function(e,t,n){var o;void 0===n&&(n={}),u("appkey",e,d.STRING,!0);var s=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||fe;we=new S(s,"API-V2"),Oe=v.init(s,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(xe=Oe.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),xe.info(l.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Be=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),Ne=new Le(Oe,{readReceiptTimeout:Be},xe,we),I.init(xe)},getInstance:function(){return Ne},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){Oe.assignWatcher({connection:function(t,n){try{e.onChanged(t,n)}catch(e){null==xe||xe.error(l.A_CALLBACK_E,"onConnectionStatusChange -> "+e.stack)}}})},setOnReceiveMessageListener:function(e){Oe.assignWatcher({message:function(t,n,o){try{var s=me(t),a=Oe.getCurrentUserId(),r=Oe.getConnectedTime();ye(s,a,r,Be,we),s=function(e,t,n,o,s){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var r=e.content,i=((r=r||{}).receiptMessageDic||{})[t],c="",g={};if(e.receiptResponse=e.receiptResponse||{},i){for(var u=[],d=0;d<i.length;d++)c=""+t+i[d]+"SENT",(g=s.get(c))&&!(e.senderUserId in g.userIds)&&(u.push(i[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[i[d]]=g.count,s.set(c,g));r.receiptMessageDic[t]=u,e.content=r}return e}(s,a,r,Be,we),g()||pe.set(t),e.onReceived(s,void 0,o)}catch(e){null==xe||xe.error(l.A_CALLBACK_E,"setOnReceiveMessageListener -> "+e.stack)}}})},setConversationStatusListener:function(e){Oe.assignWatcher({conversationState:function(t){try{var n=[];t.forEach((function(e){var t=e.updatedItems,o=e.conversationType,s=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,i=t.isTop;r&&i&&n.push({notificationStatus:r.val,isTop:i.val,conversationType:o,targetId:s,channelId:a||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==xe||xe.error(l.O,"setConversationStatusListener ->error:"+e)}}})},setMessageExpansionListener:function(e){Oe.assignWatcher({expansion:function(t){try{t.updatedExpansion&&e.onUpdated(t.updatedExpansion),t.deletedExpansion&&e.onDeleted(t.deletedExpansion)}catch(e){null==xe||xe.error(l.O,"setMessageExpansionListener ->error:"+e)}}})},setTagListener:function(e){Oe.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==xe||xe.error(l.O,"setTagListener ->error:"+e)}}})},setConversationTagListener:function(e){Oe.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==xe||xe.error(l.O,"setConversationTagListener ->error:"+e)}}})},setPullOffLineFinished:function(e){Oe.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==xe||xe.error(l.O,"setPullOffLineFinished ->error:"+e)}}})},setTypingStatusListener:function(e){Oe.assignWatcher({typingState:function(t){try{e.onChanged(t)}catch(e){null==xe||xe.error(l.O,"setTypingStatusListener ->error:"+e)}}})},setMessageBlockedListener:function(e){Oe.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){Oe.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){Oe.assignWatcher({messageDelivered:function(t){try{e.onDelivered(t)}catch(e){null==xe||xe.error(l.O,"setMessageDeliveredListener ->error:"+e)}}})},setGroupMessageDeliveredStatusListener:function(e){Oe.assignWatcher({groupMessageDeliveredStatus:function(t){try{e.onDelivered(t)}catch(e){null==xe||xe.error(l.O,"setGroupMessageDeliveredStatusListener ->error:"+e)}}})},connect:function(e,t,n){return E(this,void 0,void 0,(function(){var o,s,r;return N(this,(function(i){switch(i.label){case 0:return o=null==xe?void 0:xe.createTraceId(),null==xe||xe.info(l.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,Oe.connect(e,!!n,o)];case 1:return s=i.sent(),r=s.code===a.SUCCESS?"info":"warn",null==xe||xe[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(Oe.getConnectedTime()-1e3*Be*60*60*24).getTime(),we.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=we.get(e).dealtime;t&&c-t>0&&we.remove(e)}else if(/RECEIVED$/.test(e)){var n=we.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?we.remove(e):we.set(e,n))}}))):s.code===a.RC_CONN_TOKEN_INCORRECT?(null==xe||xe.warn(l.O,"connect ->code:"+s.code+",token:"+e),t.onTokenIncorrect()):(null==xe||xe.warn(l.O,"connect ->code:"+s.code+",token:"+e),t.onError(s.code)),[2]}var c}))}))},reconnect:function(e,t,n){var o=null==xe?void 0:xe.createTraceId();null==xe||xe.info(l.A_RECONNECT_T,null,o),Oe.reconnect(n).then((function(t){var n=t.code===a.SUCCESS?"info":"warn";null==xe||xe[n](l.A_RECONNECT_R,JSON.stringify({code:t.code,userId:t.userId}),o),t.code===a.SUCCESS?e.onSuccess(t.userId):(null==xe||xe.warn(l.O,"reconnect ->code:"+t.code),e.onError(t.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:ve,getMessageObjectName:function(e){var t=M(M({},Se),ve);return Object.keys(t).find((function(n){return t[n]===e}))||e},registerMessageType:function(e,t,n,o){this.RegisterMessage[e]=Ee(e,t,n.isPersited,n.isCounted),this.RegisterMessageTypeMapping[t]=e,Oe.registerMessageType(t,n.isPersited,n.isCounted,o)}},be=function(e,t,n){this.type=e,this.userIdList=t,this.mentionedContent=n},Ge=function(e,t){this.isCounted=e,this.isPersited=t},De=Ee("TextMessage","RC:TxtMsg"),Ke=Ee("LocationMessage","RC:LBSMsg"),Fe=Ee("TypingStatusMessage","RC:TypSts"),We=Ee("ImageMessage","RC:ImgMsg"),He=Ee("RichContentMessage","RC:ImgTextMsg"),Ve=Ee("VoiceMessage","RC:VcMsg"),je=Ee("HQVoiceMessage","RC:HQVCMsg"),Je=Ee("FileMessage","RC:FileMsg"),qe=Ee("SightMessage","RC:SightMsg"),Ye=Ee("GIFMessage","RC:GIFMsg"),Qe=Ee("ReadReceiptMessage","RC:ReadNtf"),ze=Ee("ReadReceiptRequestMessage","RC:RRReqMsg"),Xe=Ee("RCCombineMessage","RC:CombineMsg"),$e=function(e,t,n,o,s,a,r,i,c,g,u,d,l,h,f,C,p,S){this.conversationType=e,this.targetId=t,this.senderUserId=n,this.content=o,this.objectName=s,this.messageType=a,this.messageId=r,this.messageUId=i,this.messageDirection=c,this.offLineMessage=g,this.sentStatus=u,this.sentTime=d,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"}(ke||(ke={}));var Ze,et=Ee("AcceptMessage","RC:VCAccept"),nt=Ee("RingingMessage","RC:VCRinging"),ot=Ee("SummaryMessage","RC:VCSummary"),st=Ee("HungupMessage","RC:VCHangup"),at=Ee("InviteMessage","RC:VCInvite"),rt=Ee("MediaModifyMessage","RC:VCModifyMedia"),it=Ee("MemberModifyMessage","RC:VCModifyMem"),ct=Ee("lastMessageSendTime","RC:SRSMsg"),gt=Ee("ReferenceMessage","RC:ReferenceMsg"),ut=Ee("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),dt=Ee("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(Ze||(Ze={}));var lt=Ze,ht={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20};window&&(window.RongIMClient=Pe);export{et as AcceptMessage,Me as BaseMessage,_e as ChannelClient,ht as ConnectionState,Je as FileMessage,Ye as GIFMessage,T as GetChatRoomType,je as HQVoiceMessage,st as HungupMessage,Le as IMClient,We as ImageMessage,at as InviteMessage,Ke as LocationMessage,rt as MediaModifyMessage,it as MemberModifyMessage,be as MentionedInfo,lt as MentionedType,$e as Message,Ge as MessageTag,dt as PublicServiceMultiRichContentMessage,ut as PublicServiceRichContentMessage,Xe as RCCombineMessage,Qe as ReadReceiptMessage,ze as ReadReceiptRequestMessage,Ue as ReadReceiptResponseMessage,gt as ReferenceMessage,He as RichContentMessage,nt as RingingMessage,Pe as RongIMClient,R as SentStatus,qe as SightMessage,ot as SummaryMessage,ct as SyncReadStatusMessage,De as TextMessage,Fe as TypingStatusMessage,ke as VoIPMediaType,Ve as VoiceMessage};
package/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var s,n=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var o=s,a=function(){return a=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},a.apply(this,arguments)};function r(e,t,s,n){return new(s||(s=Promise))((function(o,a){function r(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,c)}i((n=n.apply(e,t||[])).next())}))}function c(e,t){var s,n,o,a,r={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(i){return function(c){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(r=0)),r;)try{if(s=1,n&&(o=2&c[0]?n.return:c[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,c[1])).done)return o;switch(n=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(!(o=r.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){r=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){r.label=c[1];break}if(6===c[0]&&r.label<o[1]){r.label=o[1],o=c;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(c);break}o[2]&&r.ops.pop(),r.trys.pop();continue}c=t.call(e,r)}catch(e){c=[6,e],n=0}finally{s=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,i])}}}var i=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],s=0,n=t.length;s<n;s++)if(!e[t[s]])return!1;return!0}(uni))},g=i();var u=null,d=function(e){return r(void 0,void 0,void 0,(function(){var t;return c(this,(function(s){switch(s.label){case 0:return[4,l.getNetworkType()];case 1:return t=s.sent(),u({status:"online"===e.type,type:t}),[2]}}))}))};var l={tag:"browser",httpReq:function(e){return t.httpRequest(e).result()},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var s=new WebSocket(e,t);return s.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){s.onclose=function(t){var s=t.code,n=t.reason;e(s,n)}},onError:function(e){s.onerror=e},onMessage:function(e){s.onmessage=function(t){e(t.data)}},onOpen:function(e){s.onopen=e},send:function(e){s.send(e)},close:function(e,t){s.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.NetworkType.UNKONWN},s=e.type,n=e.effectiveType,o=s||n||t.NetworkType.UNKONWN;return Promise.resolve(o)},setNetworkStatusListener:function(e){u=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",d),window.addEventListener("online",d))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",d),window.removeEventListener("online",d)),u=null}},C=i(),h=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},f={setItem:h("setStorageSync"),getItem:h("getStorageSync"),removeItem:h("removeStorageSync"),clear:h("clearStorageSync")},p=null,I=function(e){var t=e.isConnected,s=e.networkType;p({status:t,type:s})};var R={tag:"wechat",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){wx.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:f,sessionStorage:f,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:C,createWebSocket:function(e,t){var s=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){p=e,wx.onNetworkStatusChange(I)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(I),p=null}},T=i(),S=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var n=my[e]({key:t[0]}).data;return n?JSON.stringify(n):n}catch(e){}}},v={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},m=null,y=function(e){var t=e.isConnected,s=e.networkType;m({status:t,type:s})};var E={tag:"alipay",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a),i=e.dataType||"json";return new Promise((function(e){my.request({url:c,method:s,headers:o,timeout:n,data:r,dataType:i,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:v,sessionStorage:v,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){m=e,my.onNetworkStatusChange(y)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(y),m=null}},M=i(),A=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return tt[e].apply(tt,t)}catch(e){}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},N=null,O=function(e){var t=e.isConnected,s=e.networkType;N({status:t,type:s})};var U={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:M,localStorage:L,sessionStorage:L,httpReq:function(e){return new Promise((function(s){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){N=e,tt.onNetworkStatusChange(O)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(O),N=null}},_=i(),B=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return swan[e].apply(swan,t)}catch(e){}}},x={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},w=null,P=function(e){var t=e.isConnected,s=e.networkType;w({status:t,type:s})};var k={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,localStorage:x,sessionStorage:x,httpReq:function(e){return new Promise((function(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)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return r(this,void 0,void 0,(function(){return c(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){w=e,swan.onNetworkStatusChange(P)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(P),w=null}},b=i(),G=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},D={setItem:G("setStorageSync"),getItem:G("getStorageSync"),removeItem:G("removeStorageSync"),clear:G("clearStorageSync")},K=null,F=function(e){var t=e.isConnected,s=e.networkType;K({status:t,type:s})};var j={tag:"jingdong",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){jd.request({url:c,method:s,headers:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:D,sessionStorage:D,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){K=e,jd.onNetworkStatusChange(F)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(F),K=null}},H=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},W={setItem:H("setStorageSync"),getItem:H("getStorageSync"),removeItem:H("removeStorageSync"),clear:H("clearStorageSync")},V=null,J=function(e){var t=e.isConnected,s=e.networkType;V({status:t,type:s})};var q={tag:"uniapp",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,a=e.query,r=e.body,c=t.appendUrl(e.url,a);return new Promise((function(e){uni.request({url:c,method:s,header:o,timeout:n,data:r,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:W,sessionStorage:W,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var s={complete:function(){},url:e,protocols:t},n=uni.connectSocket(s);return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){V=e,uni.onNetworkStatusChange(J)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(J),V=null}},Y=function(e){return e&&e.request&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return q;case"mp-jd":return j;case"mp-baidu":return k;case"mp-toutiao":return U;case"mp-alipay":return E;case"mp-weixin":return R;default:return l}}():"undefined"!=typeof jd&&Y(jd)?j:"undefined"!=typeof my&&Y(my)?E:"undefined"!=typeof tt&&Y(tt)?U:"undefined"!=typeof swan&&Y(swan)?k:"undefined"!=typeof wx&&Y(wx)?R:l;function z(e,t,s){return"".concat(e,"_").concat(t,"_").concat(s)}var X=function(){function e(){}return e.set=function(s){if(t.SEND_MESSAGE_TYPE_OPTION[s.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[s.messageType].isPersited){var n=e.get(s.conversationType,s.targetId,s.channelId||"");if(!n||n.sentTime<s.sentTime){var o=z(s.conversationType,s.targetId,s.channelId||"");e.map[o]=s}}},e.get=function(t,s,n){var o=z(t,s,n);return e.map[o]||null},e.remove=function(t,s,n){var o=z(t,s,n);delete e.map[o]},e.clear=function(){e.map={}},e.map={},e}(),$={"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"},Z={};function ee(e){var s=e.channelId,n=e.conversationType,o=e.targetId,a=e.unreadMessageCount,r=e.latestMessage,c=e.isTop,i=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var u=X.get(n,o,s||"");(!r||u&&r.sentTime<u.sentTime)&&(r=u)}var d=r?te(r):null;return{channelId:s||"",conversationType:n,targetId:o,unreadMessageCount:a,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:c,notificationStatus:i,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:g}}function te(e){var s=e.conversationType,o=e.targetId,a=e.senderUserId,r=e.content,c=e.messageType,i=e.messageUId,g=e.messageDirection,u=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,f=e.disableNotification,p=e.expansion,I=e.messageId,R=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,v=e.pushConfig,m="";return c in $?m=$[c]:c in Z?m=Z[c]:(r={message:{content:r,objectName:c},messageName:"UnknownMessage"},m="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===I&&(I=~~(16777215*Math.random())),{channelId:T||"",conversationType:s,targetId:o,senderUserId:a,content:r,messageType:m,messageUId:i,messageDirection:g,offLineMessage:u,sentTime:d,receivedStatus:l,receivedTime:C,objectName:c,messageId:I,sentStatus:R||n.SENT,disableNotification:f,canIncludeExpansion:h,expansion:p,readReceiptInfo:S,pushConfig:v}}function se(e,s,n,o,a){var r=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,c=e.messageType,i=e.messageDirection;if("ReadReceiptRequestMessage"===c&&r&&i===t.MessageDirection.SEND){var g="".concat(s).concat(e.content.messageUId,"SENT");a.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===c&&r){var u="".concat(s).concat(e.conversationType).concat(e.targetId,"RECEIVED"),d=a.get(u);if(d){if(e.senderUserId in d)return void(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,a.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void a.set(u,d)}var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},a.set(u,C)}}function ne(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function oe(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var ae=function(e,t,s,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=n,this.isCounted=o};function re(e,t,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0);var o=function(o){return new ae(e,t,o,s,n)};return o.MessageType=e,o.ObjectName=t,o}var ce,ie,ge=re("ReadReceiptResponseMessage","RC:RRRspMsg"),ue=function(){function e(e,t,s,n,o,a){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=n,this._readReceiptTimeout=o,this._storage=a,this._draftMap={}}return e.prototype.getConversationList=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",n,t.AssertRules.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var a=n.code,r=n.data,c=[];r=r||[],a===t.ErrorCode.SUCCESS?(s?r.forEach((function(e){s.indexOf(e.conversationType)>-1&&c.push(ee(e))})):r.forEach((function(e){c.push(ee(e))})),ne(e.onSuccess,c)):(o.logger.warn(t.LogTagId.O,"getConversationList -> code:".concat(a)),oe(e.onError,a))}))},e.prototype.getConversation=function(e,s,n){var o=this;t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:".concat(s,",conversationType:").concat(e)),r(o,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return o=c.sent(),a=o.code,r=o.data,a!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:".concat(a,",targetId:").concat(s)),n.onError(a),[2]):(n.onSuccess(r?ee(r):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:".concat(s,",conversationType:").concat(e)),this._context.removeConversation(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess)):(o.logger.warn(t.LogTagId.O,"removeConversation ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.saveTextMessageDraft=function(e,s,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]=n,!0)},e.prototype.getTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.clearTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:".concat(s,",conversationType:").concat(e));var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})["".concat(e,"_").concat(s,"_").concat(this.channelId)]},e.prototype.getTotalUnreadCount=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:".concat(s)),this._context.getTotalUnreadCount(this.channelId,s,n).then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:".concat(n)),oe(e.onError,n))}))},e.prototype.getUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadCount(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getUnreadCount ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.clearConversations=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:".concat(s)),this._isCPPMode?this._context.clearConversations(s,this.channelId).then((function(s){s===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearConversations ->code:".concat(s)),oe(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCount(e,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(e,",targetId:").concat(s)),oe(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:".concat(n)),oe(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getFirstUnreadMessage(e,s,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?ne(n.onSuccess,e.data?te(e.data):null):(o.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:".concat(e.code,",targetId:").concat(s)),oe(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("status",n,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:".concat(s,",status:").concat(n));var r=n.isTop,c=n.notificationStatus;this._context.setConversationStatus(e,s,r,c,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess):(a.logger.warn(t.LogTagId.O,"setConversationStatus ->code:".concat(e,",targetId:").concat(s)),oe(o.onError,e))}))},e.prototype.sendMessage=function(e,s,o,r,c,i,g,u){var d=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",o,t.AssertRules.OBJECT,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("isMentioned",c,t.AssertRules.BOOLEAN),t.assert("pushContent",i,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==u?void 0:u.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==u?void 0:u.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==u?void 0:u.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==u?void 0:u.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==u?void 0:u.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==u?void 0:u.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==u?void 0:u.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:".concat(s,",conversationType:").concat(e));var l=!(!(null==u?void 0:u.isStatusMessage)&&!(null==u?void 0:u.isStatus)),C=function(e,t,s){var n,o=e||{},a=o.userIds,r=o.isVoipPush,c=o.disableNotification,i=o.isFilerWhiteBlacklist,g=o.expansion,u=o.canIncludeExpansion,d=o.pushConfig,l=o.resendMessageId,C=[];if(t){var h=(s||{}).content.mentionedInfo;C=h.userIdList,n=h.type}return{mentionedType:n,mentionedUserIdList:C,directionalUserIdList:a,isVoipPush:r,disableNotification:c,isFilerWhiteBlacklist:i,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(u,c,o);i=i||"",g=g||"";var h=Object.assign(o,a(a({isMentioned:c,pushContent:i,pushData:g},C),{messageType:o.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:s,channelId:this.channelId}),p),this._context.sendMessage(e,s,h,r.onBefore,p).then((function(a){var c=a.code,i=a.data,g=c===t.ErrorCode.SUCCESS?"info":"warn";if(d.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){d._isCPPMode||X.set(i);var C=te(i);se(C,f,d._context.getConnectedTime(),d._readReceiptTimeout,d._storage),ne(r.onSuccess,C)}else d.logger.warn(t.LogTagId.O,"sendMessage ->code:".concat(c,",targetId:").concat(s)),oe(r.onError,c,te({isMentioned:!!h.isMentioned,content:o.content,messageType:o.messageType,isPersited:o.isPersited,isCounted:o.isCounted,disableNotification:!!(null==u?void 0:u.disableNotification),canIncludeExpansion:!!(null==u?void 0:u.canIncludeExpansion),expansion:(null==u?void 0:u.expansion)||null,conversationType:e,targetId:s,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,receivedStatusInfo:t.transformReceivedStatusInfo(t.ReceivedStatus.UNREAD),messageId:null==i?void 0:i.messageId,sentStatus:n.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,n){var o=this;t.assert("message.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("message.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("message.messageUId",e.messageUId,t.AssertRules.STRING,!0),t.assert("message.sentTime",e.sentTime,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==n?void 0:n.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==n?void 0:n.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==n?void 0:n.extra,t.AssertRules.STRING);var r=e.conversationType,c=e.targetId,i=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:".concat(c,",conversationType:").concat(r,",messageUId:").concat(i));var u=a({channelId:this.channelId},n);this._context.recallMessage(r,c,i,g,u).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?(o._isCPPMode||X.set(a),ne(s.onSuccess,te(a))):(o.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:".concat(n,",targetId:").concat(c,",messageUId:").concat(i)),oe(s.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",n,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:".concat(s,",conversationType:").concat(e));var r={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},c=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:r.messageType,conversationType:e,targetId:s,channelId:r.channelId}),c),this._context.sendMessage(e,s,r,void 0,c).then((function(e){var n=e.code,r=e.data,i=n===t.ErrorCode.SUCCESS?"info":"warn";a.logger[i](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:r?r.messageUId:"",messageId:r?r.messageId:""}),c),n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(r)):(a.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:".concat(n,",targetId:").concat(s)),oe(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:".concat(s,",conversationType:").concat(e));var a=this._context.getCurrentUserId(),r="".concat(a).concat(e).concat(s,"RECEIVED"),c=this._storage.get(r);if(c){var i=[];for(var g in c){var u={};u[g]=c[g].uIds,c[g].isResponse||i.push(u)}if(0===i.length)return void n.onSuccess(null);var d=setInterval((function(){1===i.length&&clearInterval(d);var a=i.splice(0,1)[0],g=new ge({receiptMessageDic:a});o.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(a)[0];c[t].isResponse=!0,o._storage.set(r,c),ne(n.onSuccess,e)},onError:function(e){o.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:".concat(e,",targetId:").concat(s)),oe(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,n){var o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:".concat(s,",messageUIds:").concat(e));for(var a=0,r=e;a<r.length;a++){var c=r[a];t.assert("messageUId",c,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(s,e,this.channelId).then((function(a){var r=a.code;r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(r,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:".concat(a,",targetId:").concat(s,",messageUIds:").concat(e)),n.onError(a)}))},e.prototype.getMessageReader=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:".concat(s,",messageUId:").concat(e)),this._context.getMessageReader(s,e,this.channelId).then((function(a){var r=a.code,c=a.data;r===t.ErrorCode.SUCCESS?n.onSuccess(c):(o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(r,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(r))})).catch((function(a){o.logger.warn(t.LogTagId.O,"getMessageReader ->code:".concat(a,",targetId:").concat(s,",messageUId:").concat(e)),n.onError(a)}))},e.prototype.updateMessageExpansion=function(e,s,n){var o=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion,g=s.expansion;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),oe(n.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,n){var o=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var a=s.conversationType,r=s.targetId,c=s.messageUId,i=s.canIncludeExpansion;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:".concat(r,",messageUId:").concat(c,",conversationType:").concat(a)),this._context.sendExpansionMessage({conversationType:a,targetId:r,messageUId:c,canIncludeExpansion:i,keys:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:".concat(s,",targetId:").concat(r,",messageUId:").concat(c)),oe(n.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK,!0),t.assert("order",c,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n));var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,s,n,o,c,this.channelId,r,g).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var o=n.list,r=n.hasMore,c=[],u=o.map((function(e){return c.push(e.messageUId),te(e)}));i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:c.join(",")}),g),ne(a.onSuccess,u,r)}else i.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),ne(a.onSuccess,[],!1);else i.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),oe(a.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.deleteRemoteMessage(e,s,n,this.channelId).then((function(r){if(r===t.ErrorCode.SUCCESS){if(!a._isCPPMode){var c=X.get(e,s,a.channelId);c&&n.forEach((function(t){c.messageUId===t.messageUId&&X.remove(e,s,a.channelId)}))}ne(o.onSuccess)}else a.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:".concat(r,",targetId:").concat(s)),oe(o.onError,r)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var n=this;t.assert("param.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("param.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("param.timestamp",e.timestamp,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK);var o=e.conversationType,a=e.targetId,r=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:".concat(a,",conversationType:").concat(o)),this._context.deleteRemoteMessageByTimestamp(o,a,r,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:".concat(e)),oe(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,n){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",n,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,n).then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={});var c=n.senderUserId,i=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,l=n.expansion,C=n.disableNotification,h=n.sentTime,f=n.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e));var p=a.isUnread,I={senderUserId:c,messageType:i,content:g,messageDirection:u,sentTime:h,sentStatus:f,searchContent:a.searchContent,isUnread:p,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,s,I).then((function(e){var n=e.code,a=e.data;n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(a)):(r.logger.warn(t.LogTagId.O,"insertMessage ->code:".concat(n,",targetId:").concat(s)),oe(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,s,n){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.getMessageCount=function(e,s,n){this._context.getMessageCount(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:".concat(s,",conversationType:").concat(e,",timestamp:").concat(n)),this._context.deleteMessagesByTimestamp(e,s,n,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(a.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:".concat(e,",targetId:").concat(s)),oe(a.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:".concat(s,",conversationType:").concat(e));var i=r.order||0;this._context.getRemoteHistoryMessages(e,s,n,o,i,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===t.ErrorCode.SUCCESS)if(o){var r=o.list,i=o.hasMore,g=r.map((function(e){return te(e)}));ne(a.onSuccess,g,i)}else ne(a.onSuccess,[],!1);else c.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:".concat(n,",targetId:").concat(s)),oe(a.onError,n)}))},e.prototype.clearMessages=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearMessages(e,s,this.channelId).then((function(a){a===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess,!0)):(o.logger.warn(t.LogTagId.O,"clearMessages ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:".concat(e)),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(ee(e))})),ne(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:".concat(o,",keyword:").concat(e)),oe(s.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:".concat(e)),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,r=n.data,c=[];r=r||[],o===t.ErrorCode.SUCCESS?(r.forEach((function(e){c.push(ee(e))})),ne(s.onSuccess,c)):(a.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:".concat(o,",keyword:").concat(e)),oe(s.onError,o))}))},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:".concat(s,",conversationType:").concat(e,",keyword:").concat(n)),this._context.searchMessageByContent(e,s,n,o,a,r,this.channelId).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var r=o=o||{},g=r.messages,u=r.count;g.forEach((function(e){a.push(te(e))})),ne(c.onSuccess,a,u)}else i.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:".concat(n,",targetId:").concat(s)),oe(c.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", timestamp: ").concat(o,", count: ").concat(a)),this._context.searchMessageByContentWithAllChannel(e,s,n,o,a).then((function(e){var n=e.code,o=e.data,a=[];if(n===t.ErrorCode.SUCCESS){var i=o=o||{},g=i.messages,u=i.count;g.forEach((function(e){a.push(te(e))})),ne(r.onSuccess,a,u)}else c.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:".concat(n,",targetId:").concat(s)),oe(r.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: ".concat(s," ,conversationType: ").concat(e," ,keyword: ").concat(n,", startTime: ").concat(o,", endTime: ").concat(a,", offset: ").concat(r,", limit: ").concat(c)),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c).then((function(e){var n=e.code,o=e.data,a=[];n===t.ErrorCode.SUCCESS?((o=o||{}).messages.forEach((function(e){a.push(te(e))})),ne(i.onSuccess,a)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:".concat(n,",targetId:").concat(s)),oe(i.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,s){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getUnreadMentionedMessages(e,s,this.channelId).map((function(e){return te(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:".concat(s,",conversationType:").concat(e)),this._context.clearUnreadCountByTimestamp(e,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:".concat(e,",targetId:").concat(s)),oe(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:".concat(s,",conversationType:").concat(e)),this._context.getConversationNotificationStatus(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:".concat(a,",targetId:").concat(s)),oe(n.onError,a))}))},e.prototype.getGroupMessageDeliverList=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:".concat(e,"',messageUId:").concat(s)),this._context.getGroupMessageDeliverList(e,s,this.channelId).then((function(e){var a=e.code,r=e.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:".concat(a,",messageUId:").concat(s)),oe(n.onError,a))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:".concat(e)),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:".concat(a,",messageUId:").concat(e)),oe(s.onError,a))}))},e}(),de=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},le=function(){function e(e,s,n,o){this._context=e,this._options=s,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new ue(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,n){if(!this._isCPPMode)return null==n||n.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'".concat(s,"' is unusable!"));e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(t.LogTagId.O,"getChannel ->channelId:".concat(e)),!this._isCPPMode)return this.logger.error(t.LogTagId.O,"getChannel method is only available in protocol stack mode"),null;if(t.assert("channelId",e,t.AssertRules.STRING,!0),e.length>20)return this.logger.error(t.LogTagId.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(t.LogTagId.O,"Only 1000 channels can be obtained"),null;var s=new ue(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=s,s},e.prototype.deleteChannels=function(e){var s=this;t.assert("channelIds",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"deleteChannels ->channelIds:".concat(e)),this.assertCPPMode((function(){e.forEach((function(e){delete s._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.9.5"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return r(this,void 0,void 0,(function(){return c(this,(function(s){switch(s.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return s.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,s){this._defaultChannelClient.getConversationList(e,t,s)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,s){void 0===s&&(s=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,s)},e.prototype.getConversation=function(e,t,s){return this._defaultChannelClient.getConversation(e,t,s)},e.prototype.removeConversation=function(e,t,s){return this._defaultChannelClient.removeConversation(e,t,s)},e.prototype.saveTextMessageDraft=function(e,t,s){return this._defaultChannelClient.saveTextMessageDraft(e,t,s)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,s){return this._defaultChannelClient.getTotalUnreadCount(e,t,s)},e.prototype.getUnreadCount=function(e,t,s){return this._defaultChannelClient.getUnreadCount(e,t,s)},e.prototype.getConversationUnreadCount=function(e,s){this.logger.error(t.LogTagId.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,s){this._defaultChannelClient.clearUnreadCount(e,t,s)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,s,n){return this._defaultChannelClient.setConversationStatus(e,t,s,n)},e.prototype.sendMessage=function(e,t,s,n,o,a,r,c,i){return this._defaultChannelClient.sendMessage(e,t,s,n,o,a,r,i)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,n){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,n)},e.prototype.sendReceiptResponse=function(e,t,s){return this._defaultChannelClient.sendReceiptResponse(e,t,s)},e.prototype.sendReadReceiptMessage=function(e,t,s){return this._defaultChannelClient.sendReadReceiptMessage(e,t,s)},e.prototype.getMessageReader=function(e,t,s){this._defaultChannelClient.getMessageReader(e,t,s)},e.prototype.updateMessageExpansion=function(e,t,s){this._defaultChannelClient.updateMessageExpansion(e,t,s)},e.prototype.removeMessageExpansionForKey=function(e,t,s){this._defaultChannelClient.removeMessageExpansionForKey(e,t,s)},e.prototype.getHistoryMessages=function(e,t,s,n,o,a,r){return this._defaultChannelClient.getHistoryMessages(e,t,s,n,o,a,r)},e.prototype.joinChatRoom=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"joinChatRoom ->chatRoomId:".concat(e));var a=this.logger.createTraceId();this.logger.info(t.LogTagId.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:s,joinExist:!1}),a),this._context.joinChatroom(e,s,a).then((function(s){var r=s===t.ErrorCode.SUCCESS?"info":"warn";o.logger[r](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),a),s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"joinChatRoom ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:".concat(e));var o=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(a){var r=a===t.ErrorCode.SUCCESS?"info":"warn";n.logger[r](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:a}),o),a===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"quitChatRoom ->code:".concat(a,",chatRoomId:").concat(e)),oe(s.onError,a))}))},e.prototype.getChatRoomInfo=function(e,s,n,o){var a=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:".concat(e)),this._context.getChatroomInfo(e,s,n).then((function(s){var n=s.code,r=s.data;n===t.ErrorCode.SUCCESS?ne(o.onSuccess,{userInfos:(null==r?void 0:r.userInfos)||[],userTotalNums:(null==r?void 0:r.userCount)||0}):(a.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:".concat(n,",chatRoomId:").concat(e)),oe(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:".concat(e)),this._context.setChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,n){var o=this;if(t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("entry.key",e.key,t.AssertRules.STRING,!0),t.assert("entry.value",e.value,t.AssertRules.STRING,!0)})),t.assert("options.isAutoDelete",e.isAutoDelete,t.AssertRules.BOOLEAN)}(s),t.assert("callback",n,t.AssertRules.CALLBACK),s.entries.length>10)oe(n.onError,t.ErrorCode.CHATROOM_KV_STORE_OUT_LIMIT);else{var a="id:".concat(e);this.logger.info(t.LogTagId.O,"set chatroom entry->".concat(a)),this._context.setChatroomEntries(e,s).then((function(e){var s=e.code,r=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:".concat(s,",").concat(a)),oe(n.onError,s,r))}))}},e.prototype.forceSetChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:".concat(e)),this._context.forceSetChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:".concat(e)),this._context.removeChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(s);var r="id:".concat(e);this.logger.debug(t.LogTagId.O,"remove chatroom entry->".concat(r));var c=a({},s);c.entries=s.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,c).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:".concat(s,",").concat(r)),oe(n.onError,s,a))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:".concat(e)),this._context.forceRemoveChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:".concat(s,",chatRoomId:").concat(e)),oe(n.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:".concat(e,",key:").concat(s)),this._context.getChatroomEntry(e,s).then((function(s){var a=s.code,r=s.data;a===t.ErrorCode.SUCCESS?ne(n.onSuccess,r||""):(o.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:".concat(a,",chatRoomId:").concat(e)),oe(n.onError,a))}))},e.prototype.getAllChatroomEntries=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:".concat(e)),this._context.getAllChatroomEntries(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:".concat(a,",chatRoomId:").concat(e)),oe(s.onError,a))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,n,o,a){var r=this;void 0===a&&(a=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("timestamp",a,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:".concat(e)),this._context.getChatRoomHistoryMessages(e,s,n,a).then((function(s){var n=s.code,a=s.data;if(n===t.ErrorCode.SUCCESS)if(a){var c=a.list,i=a.hasMore,g=c.map((function(e){return te(e)}));ne(o.onSuccess,g,i)}else ne(o.onSuccess,[],!1);else r.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:".concat(n,",chatRoomId:").concat(e)),oe(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,n){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,n)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,n,o,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:".concat(e,",fileName:").concat(n,",queryString:").concat(a)),this._context.getFileToken(e,n,o,a).then(s.onSuccess).catch(s.onError)},e.prototype.getFileUrl=function(e,s,n,o,a,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",n,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("serverType",r,t.AssertRules.NUMBER),t.assert("uploadRes",a,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:".concat(e,",fileName:").concat(s)),this._context.getFileUrl(e,s,n,a,r).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagId",e.tagId,(function(e){return e.length<=10})),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.createTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"createTag ->code:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.removeTag=function(e,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:".concat(e)),this._context.removeTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(a,",tagId:").concat(e)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTag ->code:".concat(o,",tagId:").concat(e)),s.onError(o)}))},e.prototype.updateTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:".concat(e.tagId,",tagName:").concat(e.tagName)),this._context.updateTag(e).then((function(o){var a=o.code;a===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"updateTag ->code:".concat(a,",tagId:").concat(e.tagId)),s.onError(a))})).catch((function(o){n.logger.warn(t.LogTagId.O,"updateTag ->reason:".concat(o,",tagId:").concat(e.tagId)),s.onError(o)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?e.onSuccess(a||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:".concat(o)),e.onError(o))})).catch((function(n){s.logger.warn(t.LogTagId.O,"getTagList ->reason:".concat(n)),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,s){var n=this;t.assert("conversationType",e.type,t.AssertRules.NUMBER),t.assert("targetId",e.targetId,t.AssertRules.STRING),t.assert("channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:".concat(e.targetId,",conversationType:").concat(e.type)),this._context.getTagsForConversation(de(e)).then((function(e){var o=e.code,a=e.data;o===t.ErrorCode.SUCCESS?s.onSuccess(a||[]):(n.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:".concat(o)),s.onError(o))})).catch((function(e){n.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:".concat(e)),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"addTagForConversations ->tagId:".concat(e)),this._context.addTagForConversations(e,s.map((function(e){return de(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"addTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"removeTagForConversations ->tagId:".concat(e)),this._context.removeTagForConversations(e,s.map((function(e){return de(e)}))).then((function(s){var a=s.code;s.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,n){var o=this;t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("tagIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:".concat(s,",targetId:").concat(e.targetId,",type:").concat(e.type)),this._context.removeTagsForConversation(de(e),s).then((function(e){var a=e.code;e.data,a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:".concat(a,",tagIds:").concat(s)),n.onError(a))})).catch((function(e){o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:".concat(e,",tagIds:").concat(s)),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:".concat(e)),this._context.getConversationListByTag(e,n,s).then((function(s){var n=s.code,r=s.data,c=[];n===t.ErrorCode.SUCCESS?((r=r||[]).forEach((function(e){c.push(function(e){var t=e.channelId,s=e.conversationType,n=e.targetId,o=e.unreadMessageCount,a=e.latestMessage,r=e.isTop,c=e.notificationStatus,i=e.isTopInTag,g=a?te(a):null,u=g||{},d=u.messageType,l=u.sentTime,C=u.receivedStatus;return{channelId:t||"",conversationType:s,targetId:n,unreadMessageCount:o,latestMessage:g,isTopInTag:i,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:r,notificationStatus:c,receivedStatus:C}}(e))})),o.onSuccess(c)):(a.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:".concat(e)),this._context.getUnreadCountByTag(e,s).then((function(s){var a=s.code,r=s.data;o.logger.info(t.LogTagId.O,JSON.stringify({code:a,data:r})),a===t.ErrorCode.SUCCESS?n.onSuccess(r||0):(o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:".concat(a,",tagId:").concat(e)),n.onError(a))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:".concat(s,",tagId:").concat(e)),n.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,n,o){var a=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",s.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",s.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",s.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==n?void 0:n.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:".concat(e,",targetId:").concat(s.targetId,",type").concat(s.type)),this._context.setConversationStatusInTag(e,de(s),n).then((function(s){var n=s.code;s.data,n===t.ErrorCode.SUCCESS?o.onSuccess():(a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:".concat(n,",tagId:").concat(e)),o.onError(n))})).catch((function(s){a.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:".concat(s,",tagId:").concat(e)),o.onError(s)}))},e.prototype.callExtra=function(e,s){for(var n,o=this,a=[],r=2;r<arguments.length;r++)a[r-2]=arguments[r];this.logger.info(t.LogTagId.O,"callExtra ->method:".concat(e)),(n=this._context).callExtra.apply(n,function(e,t,s){if(s||2===arguments.length)for(var n,o=0,a=t.length;o<a;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],a,!1)).then((function(n){var a=n.code,r=n.data;if(a!==t.ErrorCode.SUCCESS)o.logger.warn(t.LogTagId.O,"callExtra ->code:".concat(a)),s.onError&&oe(s.onError,a);else{if("getConversationsByPage"===e&&r.forEach((function(e){e.latestMessage=e.latestMessage?te(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var c=r,i=c.list,g=c.hasMore,u=i.map((function(e){return te(e)}));return void ne(s.onSuccess,u,g)}s.onSuccess&&ne(s.onSuccess,r)}}))},e.prototype.hasRemoteUnreadMessages=function(e,s){t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:".concat(e)),this.assertCPPMode((function(){ne(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:".concat(e.userIds)),this.assertCPPMode((function(){n._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var n=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:".concat(e)),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setUserStatus ->code:".concat(e)),oe(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getUserStatus ->code:".concat(a,",useerId:").concat(e)),oe(s.onError,a))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"addToBlacklist ->code:".concat(o,",useerId:").concat(e)),oe(s.onError,o))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:".concat(e)),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:".concat(o,",useerId:").concat(e)),oe(s.onError,o))}))}),"removeFromBlacklist",s)},e.prototype.getBlacklist=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getBlacklist().then((function(n){var o=n.code,a=n.data;o===t.ErrorCode.SUCCESS?ne(e.onSuccess,a):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:".concat(o)),oe(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:".concat(e)),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,r):(n.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:".concat(a,",userId:").concat(e)),oe(s.onError,a))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,n,o,a){var r=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("content.senderUserId",n.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",n.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",n.objectName,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:".concat(s,",conversationType:").concat(e,",senderUserId:").concat(n.senderUserId)),this.assertCPPMode((function(){r._defaultChannelClient.insertMessage(e,s,n,o,a)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,s,n){var o,a,r=this;for(var c in t.assert("messages",e,(function(s){return t.isArray(s)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",s,t.AssertRules.BOOLEAN),t.assert("callback",n,t.AssertRules.CALLBACK),e)t.assert("message",e[c],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[c].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[c].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[c].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[c].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[c].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[c].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[c].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[c].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[c].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[c].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[c].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(o=e[c])||void 0===o?void 0:o.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(a=e[c])||void 0===a?void 0:a.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){r._defaultChannelClient.batchInsertMessage(e,s,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,s,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,a,r){var c=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("options.order",r.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){c._defaultChannelClient.getRemoteHistoryMessages(e,s,n,o,a,r)}),"getRemoteHistoryMessages",a)},e.prototype.deleteLocalMessages=function(e,s,n,o){var a=this;t.assert("messageIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:".concat(n)),this.assertCPPMode((function(){a._context.deleteMessages(n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:".concat(e,",messageIds:").concat(n)),oe(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,a){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",o,t.AssertRules.BOOLEAN),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){r._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,n,o,a)}),"deleteLocalMessagesByTimestamp",a)},e.prototype.clearMessages=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,s,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var a=o.code,r=o.data;a===t.ErrorCode.SUCCESS?ne(s.onSuccess,te(r)):(n.logger.warn(t.LogTagId.O,"getMessage ->code:".concat(a,",messageId:").concat(e)),oe(s.onError,a))}))}),"getMessage",s)},e.prototype.setMessageSentStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:".concat(e,",sentStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:".concat(s,",messageId:").concat(e)),oe(n.onError,s))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:".concat(e,",receivedStatus:").concat(s)),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:".concat(s,",messageId:").concat(e)),oe(n.onError,s))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,s,n,o){var a=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",n,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){a.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),a._context.setMessageContent(e,s,n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):oe(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:".concat(e,",searchFiles:").concat(n)),this.assertCPPMode((function(){o._context.setMessageSearchField(e,s,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,n,o){var a=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",o,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContent(e,s,n,o)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var a=this;void 0===n&&(n=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){a._defaultChannelClient.searchConversationByContentWithAllChannel(e,s,n,o)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,n,o,a,r,c){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("total",r,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContent(e,s,n,o,a,r,c)}),"searchMessageByContent",c)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,a,r){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",a,t.AssertRules.NUMBER),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContentWithAllChannel(e,s,n,o,a,r)}),"searchMessageByContentWithAllChannel",r)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,a,r,c,i){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("startTime",o,t.AssertRules.NUMBER),t.assert("endTime",a,t.AssertRules.NUMBER),t.assert("offset",r,t.AssertRules.NUMBER),t.assert("limit",c,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,a,r,c,i)}),"searchMessageByContentInTimeRangeWithAllChannel",i)},e.prototype.getUnreadMentionedMessages=function(e,s){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,s)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){a._defaultChannelClient.clearUnreadCountByTimestamp(e,s,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,s,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,s){this._defaultChannelClient.getGroupMessageDeliverList(e,t,s)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Ce=1;t.VersionManage.add("imlib-v2-adapter","5.9.5");var he,fe,pe=null,Ie={init:function(e,s,n){var o;void 0===n&&(n={}),t.assert("appkey",e,t.AssertRules.STRING,!0);var a=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||Q;he=new t.AppStorage(a,"API-V2"),ie=t.APIContext.init(a,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(pe=ie.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),pe.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Ce=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ce=new le(ie,{readReceiptTimeout:Ce},pe,he),t.logger.init(pe)},getInstance:function(){return ce},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){ie.assignWatcher({connection:function(s,n){try{e.onChanged(s,n)}catch(e){null==pe||pe.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> ".concat(e.stack))}}})},setOnReceiveMessageListener:function(e){ie.assignWatcher({message:function(s,n,o){try{var a=te(s),r=ie.getCurrentUserId(),c=ie.getConnectedTime();se(a,r,c,Ce,he),a=function(e,t,s,n,o){var a=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!a)return e;var r=e.content,c=((r=r||{}).receiptMessageDic||{})[t],i="",g={};if(e.receiptResponse=e.receiptResponse||{},c){for(var u=[],d=0;d<c.length;d++)i="".concat(t).concat(c[d],"SENT"),(g=o.get(i))&&!(e.senderUserId in g.userIds)&&(u.push(c[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[c[d]]=g.count,o.set(i,g));r.receiptMessageDic[t]=u,e.content=r}return e}(a,r,c,Ce,he),t.usingCppEngine()||X.set(s),e.onReceived(a,void 0,o)}catch(e){null==pe||pe.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> ".concat(e.stack))}}})},setConversationStatusListener:function(e){ie.assignWatcher({conversationState:function(s){try{var n=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,o=e.targetId,a=e.channelId,r=(t=t||{}).notificationStatus,c=t.isTop;r&&c&&n.push({notificationStatus:r.val,isTop:c.val,conversationType:s,targetId:o,channelId:a||"",updatedTime:r.time})})),n.length>0&&e.onChanged(n)}catch(e){null==pe||pe.error(t.LogTagId.O,"setConversationStatusListener ->error:".concat(e))}}})},setMessageExpansionListener:function(e){ie.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==pe||pe.error(t.LogTagId.O,"setMessageExpansionListener ->error:".concat(e))}}})},setTagListener:function(e){ie.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==pe||pe.error(t.LogTagId.O,"setTagListener ->error:".concat(e))}}})},setConversationTagListener:function(e){ie.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==pe||pe.error(t.LogTagId.O,"setConversationTagListener ->error:".concat(e))}}})},setPullOffLineFinished:function(e){ie.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==pe||pe.error(t.LogTagId.O,"setPullOffLineFinished ->error:".concat(e))}}})},setTypingStatusListener:function(e){ie.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==pe||pe.error(t.LogTagId.O,"setTypingStatusListener ->error:".concat(e))}}})},setMessageBlockedListener:function(e){ie.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ie.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ie.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==pe||pe.error(t.LogTagId.O,"setMessageDeliveredListener ->error:".concat(e))}}})},setGroupMessageDeliveredStatusListener:function(e){ie.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==pe||pe.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:".concat(e))}}})},connect:function(e,s,n){return r(this,void 0,void 0,(function(){var o,a,r;return c(this,(function(c){switch(c.label){case 0:return o=null==pe?void 0:pe.createTraceId(),null==pe||pe.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ie.connect(e,!!n,o)];case 1:return a=c.sent(),r=a.code===t.ErrorCode.SUCCESS?"info":"warn",null==pe||pe[r](t.LogTagId.A_CONNECT_R,JSON.stringify({code:a.code,userId:a.userId}),o),a.code===t.ErrorCode.SUCCESS?(s.onSuccess(a.userId),i=new Date(ie.getConnectedTime()-1e3*Ce*60*60*24).getTime(),he.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=he.get(e).dealtime;t&&i-t>0&&he.remove(e)}else if(/RECEIVED$/.test(e)){var s=he.get(e),n=Object.keys(s).length;Object.keys(s).forEach((function(e){var t=s[e].dealtime;t&&i-t>0&&delete s[e]})),Object.keys(s).length!==n&&(0===s.length?he.remove(e):he.set(e,s))}}))):a.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==pe||pe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onTokenIncorrect()):(null==pe||pe.warn(t.LogTagId.O,"connect ->code:".concat(a.code,",token:").concat(e)),s.onError(a.code)),[2]}var i}))}))},reconnect:function(e,s,n){var o=null==pe?void 0:pe.createTraceId();null==pe||pe.info(t.LogTagId.A_RECONNECT_T,null,o),ie.reconnect(n).then((function(s){var n=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==pe||pe[n](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==pe||pe.warn(t.LogTagId.O,"reconnect ->code:".concat(s.code)),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Z,getMessageObjectName:function(e){var t=a(a({},$),Z);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,n){this.RegisterMessage[e]=re(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,ie.registerMessageType(t,s.isPersited,s.isCounted,n)}},Re=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},Te=function(e,t){this.isCounted=e,this.isPersited=t},Se=re("TextMessage","RC:TxtMsg"),ve=re("LocationMessage","RC:LBSMsg"),me=re("TypingStatusMessage","RC:TypSts"),ye=re("ImageMessage","RC:ImgMsg"),Ee=re("RichContentMessage","RC:ImgTextMsg"),Me=re("VoiceMessage","RC:VcMsg"),Ae=re("HQVoiceMessage","RC:HQVCMsg"),Le=re("FileMessage","RC:FileMsg"),Ne=re("SightMessage","RC:SightMsg"),Oe=re("GIFMessage","RC:GIFMsg"),Ue=re("ReadReceiptMessage","RC:ReadNtf"),_e=re("ReadReceiptRequestMessage","RC:RRReqMsg"),Be=re("RCCombineMessage","RC:CombineMsg"),xe=function(e,t,s,n,o,a,r,c,i,g,u,d,l,C,h,f,p,I){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=n,this.objectName=o,this.messageType=a,this.messageId=r,this.messageUId=c,this.messageDirection=i,this.offLineMessage=g,this.sentStatus=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=f,this.receiptResponse=p,this.disableNotification=I};exports.VoIPMediaType=void 0,(fe=exports.VoIPMediaType||(exports.VoIPMediaType={}))[fe.MEDIA_AUDIO=1]="MEDIA_AUDIO",fe[fe.MEDIA_VEDIO=2]="MEDIA_VEDIO",fe[fe.MEDIA_VIDEO=2]="MEDIA_VIDEO";var we,Pe=re("AcceptMessage","RC:VCAccept"),ke=re("RingingMessage","RC:VCRinging"),be=re("SummaryMessage","RC:VCSummary"),Ge=re("HungupMessage","RC:VCHangup"),De=re("InviteMessage","RC:VCInvite"),Ke=re("MediaModifyMessage","RC:VCModifyMedia"),Fe=re("MemberModifyMessage","RC:VCModifyMem"),je=re("lastMessageSendTime","RC:SRSMsg"),He=re("ReferenceMessage","RC:ReferenceMsg"),We=re("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ve=re("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(we||(we={}));var Je=we;window&&(window.RongIMClient=Ie),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=Pe,exports.BaseMessage=ae,exports.ChannelClient=ue,exports.ConnectionState={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20},exports.FileMessage=Le,exports.GIFMessage=Oe,exports.GetChatRoomType=o,exports.HQVoiceMessage=Ae,exports.HungupMessage=Ge,exports.IMClient=le,exports.ImageMessage=ye,exports.InviteMessage=De,exports.LocationMessage=ve,exports.MediaModifyMessage=Ke,exports.MemberModifyMessage=Fe,exports.MentionedInfo=Re,exports.MentionedType=Je,exports.Message=xe,exports.MessageTag=Te,exports.PublicServiceMultiRichContentMessage=Ve,exports.PublicServiceRichContentMessage=We,exports.RCCombineMessage=Be,exports.ReadReceiptMessage=Ue,exports.ReadReceiptRequestMessage=_e,exports.ReadReceiptResponseMessage=ge,exports.ReferenceMessage=He,exports.RichContentMessage=Ee,exports.RingingMessage=ke,exports.RongIMClient=Ie,exports.SentStatus=n,exports.SightMessage=Ne,exports.SummaryMessage=be,exports.SyncReadStatusMessage=je,exports.TextMessage=Se,exports.TypingStatusMessage=me,exports.VoiceMessage=Me;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("@rongcloud/engine");!function(e){e[e.SENDING=10]="SENDING",e[e.FAILED=20]="FAILED",e[e.SENT=30]="SENT",e[e.RECEIVED=40]="RECEIVED",e[e.READ=50]="READ",e[e.DESTROYED=60]="DESTROYED"}(e||(e={}));var s,n=e;!function(e){e[e.NONE=0]="NONE",e[e.SQQUENCE=1]="SQQUENCE",e[e.REVERSE=2]="REVERSE"}(s||(s={}));var o=s,r=function(){return r=Object.assign||function(e){for(var t,s=1,n=arguments.length;s<n;s++)for(var o in t=arguments[s])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},r.apply(this,arguments)};function a(e,t,s,n){return new(s||(s=Promise))((function(o,r){function a(e){try{c(n.next(e))}catch(e){r(e)}}function i(e){try{c(n.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(a,i)}c((n=n.apply(e,t||[])).next())}))}function i(e,t){var s,n,o,r,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return r={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function i(i){return function(c){return function(i){if(s)throw new TypeError("Generator is already executing.");for(;r&&(r=0,i[0]&&(a=0)),a;)try{if(s=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{s=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}"function"==typeof SuppressedError&&SuppressedError;var c=function(){return!("undefined"==typeof uni||!function(e){for(var t=["request","getSystemInfo"],s=0,n=t.length;s<n;s++)if(!e[t[s]])return!1;return!0}(uni))},g=c();var u=null,d=function(e){return a(void 0,void 0,void 0,(function(){var t;return i(this,(function(s){switch(s.label){case 0:return[4,l.getNetworkType()];case 1:return t=s.sent(),u({status:"online"===e.type,type:t}),[2]}}))}))};var l={tag:"browser",httpReq:function(e){return t.httpRequest(e).result()},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,useNavi:!0,connectPlatform:"",isFromUniapp:g,createWebSocket:function(e,t){var s=new WebSocket(e,t);return s.binaryType="arraybuffer",{id:Date.now(),onClose:function(e){s.onclose=function(t){var s=t.code,n=t.reason;e(s,n)}},onError:function(e){s.onerror=e},onMessage:function(e){s.onmessage=function(t){e(t.data)}},onOpen:function(e){s.onopen=e},send:function(e){s.send(e)},close:function(e,t){s.close()}}},getNetworkType:function(){var e=navigator.connection||navigator.mozConnection||navigator.webkitConnection||{effectiveType:t.NetworkType.UNKONWN},s=e.type,n=e.effectiveType,o=s||n||t.NetworkType.UNKONWN;return Promise.resolve(o)},setNetworkStatusListener:function(e){u=e,"undefined"!=typeof window&&window&&(window.addEventListener("offline",d),window.addEventListener("online",d))},removeNetworkStatusListener:function(){"undefined"!=typeof window&&window&&(window.removeEventListener("offline",d),window.removeEventListener("online",d)),u=null}},C=c(),h=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return wx[e].apply(wx,t)}catch(e){null===console||void 0===console||console.error(e)}}},p={setItem:h("setStorageSync"),getItem:h("getStorageSync"),removeItem:h("removeStorageSync"),clear:h("clearStorageSync")},f=null,I=function(e){var t=e.isConnected,s=e.networkType;f({status:t,type:s})};var R={tag:"wechat",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,r=e.query,a=e.body,i=t.appendUrl(e.url,r);return new Promise((function(e){wx.request({url:i,method:s,header:o,timeout:n,data:a,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:p,sessionStorage:p,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:C,createWebSocket:function(e,t){var s=wx.connectSocket({url:e,protocols:t});return{id:Date.now(),onClose:function(e){s.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){e(t.data)}))},onOpen:function(e){s.onOpen(e)},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){wx.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){f=e,wx.onNetworkStatusChange(I)},removeNetworkStatusListener:function(){wx.offNetworkStatusChange(I),f=null}},T=c(),S=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{if("setStorageSync"===e)return my[e]({key:t[0],data:JSON.parse(t[1])});if("clearStorageSync"===e)return my[e]();if("removeStorageSync"===e)return my[e]({key:t[0]});var n=my[e]({key:t[0]}).data;return n?JSON.stringify(n):n}catch(e){}}},v={setItem:S("setStorageSync"),getItem:S("getStorageSync"),removeItem:S("removeStorageSync"),clear:S("clearStorageSync")},m=null,y=function(e){var t=e.isConnected,s=e.networkType;m({status:t,type:s})};var E={tag:"alipay",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,r=e.query,a=e.body,i=t.appendUrl(e.url,r),c=e.dataType||"json";return new Promise((function(e){my.request({url:i,method:s,headers:o,timeout:n,data:a,dataType:c,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:v,sessionStorage:v,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:T,createWebSocket:function(e){var t=my.connectSocket({url:e,multiple:!0});return{id:Date.now(),onClose:function(e){t.onClose(e)},onError:function(e){t.onError((function(t){e(t.errMsg)}))},onMessage:function(e){t.onMessage((function(t){t.data.isBuffer?e(my.base64ToArrayBuffer(t.data.data)):e(t.data.data)}))},onOpen:function(e){t.onOpen(e)},send:function(e){t.send({data:my.arrayBufferToBase64(e),isBuffer:!0})},close:function(){t.close()}}},getNetworkType:function(){return new Promise((function(e){my.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){m=e,my.onNetworkStatusChange(y)},removeNetworkStatusListener:function(){my.offNetworkStatusChange(y),m=null}},M=c(),A=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return tt[e].apply(tt,t)}catch(e){}}},L={setItem:A("setStorageSync"),getItem:A("getStorageSync"),removeItem:A("removeStorageSync"),clear:A("clearStorageSync")},N=null,O=function(e){var t=e.isConnected,s=e.networkType;N({status:t,type:s})};var U={tag:"toutiao",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:M,localStorage:L,sessionStorage:L,httpReq:function(e){return new Promise((function(s){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){var t=(null==e?void 0:e.data)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=tt.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){tt.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){N=e,tt.onNetworkStatusChange(O)},removeNetworkStatusListener:function(){tt.offNetworkStatusChange(O),N=null}},_=c(),B=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return swan[e].apply(swan,t)}catch(e){}}},x={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},w=null,P=function(e){var t=e.isConnected,s=e.networkType;w({status:t,type:s})};var k={tag:"baidu",useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:_,localStorage:x,sessionStorage:x,httpReq:function(e){return new Promise((function(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)||{},n={data:JSON.stringify(t),status:e.statusCode};s(n)},fail:function(e){s({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},createWebSocket:function(e,t){var s=swan.connectSocket({url:e,protocols:t});return{id:Date.now(),onOpen:function(e){s.onOpen(e)},onClose:function(e){s.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){s.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){s.onMessage((function(t){return e(t.data)}))},send:function(e){s.send({data:e})},close:function(e,t){s.close({code:e,reason:t})}}},getNetworkType:function(){return a(this,void 0,void 0,(function(){return i(this,(function(e){return[2,new Promise((function(e){swan.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))]}))}))},setNetworkStatusListener:function(e){w=e,swan.onNetworkStatusChange(P)},removeNetworkStatusListener:function(){swan.offNetworkStatusChange(P),w=null}},b=c(),G=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return jd[e].apply(jd,t)}catch(e){null===console||void 0===console||console.error(e)}}},D={setItem:G("setStorageSync"),getItem:G("getStorageSync"),removeItem:G("removeStorageSync"),clear:G("clearStorageSync")},K=null,F=function(e){var t=e.isConnected,s=e.networkType;K({status:t,type:s})};var j={tag:"jingdong",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,r=e.query,a=e.body,i=t.appendUrl(e.url,r);return new Promise((function(e){jd.request({url:i,method:s,header:o,timeout:n,data:a,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:D,sessionStorage:D,useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:b,createWebSocket:function(e,t){return jd.connectSocket({url:e,protocols:t}),{id:Date.now(),onClose:function(e){jd.onSocketClose((function(t){e(t.code,t.reason)}))},onError:function(e){jd.onSocketError((function(t){e(t.errMsg)}))},onMessage:function(e){jd.onSocketMessage((function(t){e(t.data)}))},onOpen:function(e){jd.onSocketOpen(e)},send:function(e){jd.sendSocketMessage({data:e})},close:function(e,t){jd.closeSocket({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){jd.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){K=e,jd.onNetworkStatusChange(F)},removeNetworkStatusListener:function(){jd.offNetworkStatusChange(F),K=null}},H=function(e){return function(){for(var t=[],s=0;s<arguments.length;s++)t[s]=arguments[s];try{return uni[e].apply(uni,t)}catch(e){null===console||void 0===console||console.error(e)}}},W={setItem:H("setStorageSync"),getItem:H("getStorageSync"),removeItem:H("removeStorageSync"),clear:H("clearStorageSync")},V=null,J=function(e){var t=e.isConnected,s=e.networkType;V({status:t,type:s})};var q={tag:"uniapp",httpReq:function(e){var s=e.method||t.HttpMethod.GET,n=e.timeout||t.HTTP_TIMEOUT,o=e.headers,r=e.query,a=e.body,i=t.appendUrl(e.url,r);return new Promise((function(e){uni.request({url:i,method:s,header:o,timeout:n,data:a,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:t.ErrorCode.RC_HTTP_REQ_FAIL})}})}))},localStorage:W,sessionStorage:W,useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var s={complete:function(){},url:e,protocols:t},n=uni.connectSocket(s);return{id:Date.now(),onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},getNetworkType:function(){return new Promise((function(e){uni.getNetworkType({success:function(t){var s=t.networkType;e(s)},fail:function(){e(t.NetworkType.UNKONWN)}})}))},setNetworkStatusListener:function(e){V=e,uni.onNetworkStatusChange(J)},removeNetworkStatusListener:function(){uni.offNetworkStatusChange(J),V=null}},Y=function(e){return e&&e.request&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return q;case"mp-jd":return j;case"mp-baidu":return k;case"mp-toutiao":return U;case"mp-alipay":return E;case"mp-weixin":return R;default:return l}}():"undefined"!=typeof jd&&Y(jd)?j:"undefined"!=typeof my&&Y(my)?E:"undefined"!=typeof tt&&Y(tt)?U:"undefined"!=typeof swan&&Y(swan)?k:"undefined"!=typeof wx&&Y(wx)?R:l;function z(e,t,s){return e+"_"+t+"_"+s}var X=function(){function e(){}return e.set=function(s){if(t.SEND_MESSAGE_TYPE_OPTION[s.messageType]&&t.SEND_MESSAGE_TYPE_OPTION[s.messageType].isPersited){var n=e.get(s.conversationType,s.targetId,s.channelId||"");if(!n||n.sentTime<s.sentTime){var o=z(s.conversationType,s.targetId,s.channelId||"");e.map[o]=s}}},e.get=function(t,s,n){var o=z(t,s,n);return e.map[o]||null},e.remove=function(t,s,n){var o=z(t,s,n);delete e.map[o]},e.clear=function(){e.map={}},e.map={},e}(),$={"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"},Z={};function ee(e){var s=e.channelId,n=e.conversationType,o=e.targetId,r=e.unreadMessageCount,a=e.latestMessage,i=e.isTop,c=e.notificationStatus,g=e.matchCount;if(!t.usingCppEngine()){var u=X.get(n,o,s||"");(!a||u&&a.sentTime<u.sentTime)&&(a=u)}var d=a?te(a):null;return{channelId:s||"",conversationType:n,targetId:o,unreadMessageCount:r,latestMessage:d,latestMessageId:null==d?void 0:d.messageId,objectName:null==d?void 0:d.messageType,sentTime:null==d?void 0:d.sentTime,isTop:i,notificationStatus:c,receivedStatus:null==d?void 0:d.receivedStatus,matchCount:g}}function te(e){var s=e.conversationType,o=e.targetId,r=e.senderUserId,a=e.content,i=e.messageType,c=e.messageUId,g=e.messageDirection,u=e.isOffLineMessage,d=e.sentTime,l=e.receivedStatus,C=e.receivedTime,h=e.canIncludeExpansion,p=e.disableNotification,f=e.expansion,I=e.messageId,R=e.sentStatus,T=e.channelId,S=e.readReceiptInfo,v=e.pushConfig,m="";return i in $?m=$[i]:i in Z?m=Z[i]:(a={message:{content:a,objectName:i},messageName:"UnknownMessage"},m="UnknownMessage"),l||(l=t.ReceivedStatus.UNREAD),void 0===I&&(I=~~(16777215*Math.random())),{channelId:T||"",conversationType:s,targetId:o,senderUserId:r,content:a,messageType:m,messageUId:c,messageDirection:g,offLineMessage:u,sentTime:d,receivedStatus:l,receivedTime:C,objectName:i,messageId:I,sentStatus:R||n.SENT,disableNotification:p,canIncludeExpansion:h,expansion:f,readReceiptInfo:S,pushConfig:v}}function se(e,s,n,o,r){var a=new Date(n-1e3*o*60*60*24).getTime()-e.sentTime<0,i=e.messageType,c=e.messageDirection;if("ReadReceiptRequestMessage"===i&&a&&c===t.MessageDirection.SEND){var g=""+s+e.content.messageUId+"SENT";r.set(g,{count:0,dealtime:e.sentTime,userIds:{}})}else if("ReadReceiptRequestMessage"===i&&a){var u=""+s+e.conversationType+e.targetId+"RECEIVED",d=r.get(u);if(d){if(e.senderUserId in d)return void(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,r.set(u,d)));var l={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1};return d[e.senderUserId]=l,void r.set(u,d)}var C={};C[e.senderUserId]={uIds:[e.content.messageUId],dealtime:e.sentTime,isResponse:!1},r.set(u,C)}}function ne(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}function oe(e,t,s){try{e(t,s)}catch(e){null===console||void 0===console||console.error(e)}}var re=function(e,t,s,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.objectName=t,this.content=s,this.isPersited=n,this.isCounted=o};function ae(e,t,s,n){void 0===s&&(s=!0),void 0===n&&(n=!0);var o=function(o){return new re(e,t,o,s,n)};return o.MessageType=e,o.ObjectName=t,o}var ie,ce,ge=ae("ReadReceiptResponseMessage","RC:RRRspMsg"),ue=function(){function e(e,t,s,n,o,r){this.logger=e,this._context=t,this.channelId=s,this._isCPPMode=n,this._readReceiptTimeout=o,this._storage=r,this._draftMap={}}return e.prototype.getConversationList=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("conversationTypes",s,t.AssertRules.ARRAY),t.assert("count",n,t.AssertRules.NUMBER),this._context.getConversationList(n,void 0,0,0,this.channelId).then((function(n){var r=n.code,a=n.data,i=[];a=a||[],r===t.ErrorCode.SUCCESS?(s?a.forEach((function(e){s.indexOf(e.conversationType)>-1&&i.push(ee(e))})):a.forEach((function(e){i.push(ee(e))})),ne(e.onSuccess,i)):(o.logger.warn(t.LogTagId.O,"getConversationList -> code:"+r),oe(e.onError,r))}))},e.prototype.getConversation=function(e,s,n){var o=this;t.assert("callback",n,t.AssertRules.CALLBACK),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getConversation ->targetId:"+s+",conversationType:"+e),a(o,void 0,void 0,(function(){var o,r,a;return i(this,(function(i){switch(i.label){case 0:return[4,this._context.getConversation(e,s,this.channelId)];case 1:return o=i.sent(),r=o.code,a=o.data,r!==t.ErrorCode.SUCCESS?(this.logger.warn(t.LogTagId.O,"getConversation ->code:"+r+",targetId:"+s),n.onError(r),[2]):(n.onSuccess(a?ee(a):null),[2])}}))}))},e.prototype.removeConversation=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeConversation ->targetId:"+s+",conversationType:"+e),this._context.removeConversation(e,s,this.channelId).then((function(r){r===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess)):(o.logger.warn(t.LogTagId.O,"removeConversation ->code:"+r+",targetId:"+s),oe(n.onError,r))}))},e.prototype.saveTextMessageDraft=function(e,s,n){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("draftText",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"saveTextMessageDraft ->targetId:"+s+",conversationType:"+e);var o=this._context.getCurrentUserId();return!!o&&((this._draftMap[o]=this._draftMap[o]||{})[e+"_"+s+"_"+this.channelId]=n,!0)},e.prototype.getTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getTextMessageDraft ->targetId:"+s+",conversationType:"+e);var n=this._context.getCurrentUserId();if(n)return(this._draftMap[n]||{})[e+"_"+s+"_"+this.channelId]},e.prototype.clearTextMessageDraft=function(e,s){t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"clearTextMessageDraft ->targetId:"+s+",conversationType:"+e);var n=this._context.getCurrentUserId();return!!n&&delete(this._draftMap[n]||{})[e+"_"+s+"_"+this.channelId]},e.prototype.getTotalUnreadCount=function(e,s,n){var o=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTotalUnreadCount ->conversationTypes:"+s),this._context.getTotalUnreadCount(this.channelId,s,n).then((function(s){var n=s.code,r=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,r):(o.logger.warn(t.LogTagId.O,"getTotalUnreadCount ->code:"+n),oe(e.onError,n))}))},e.prototype.getUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCount ->targetId:"+s+",conversationType:"+e),this._context.getUnreadCount(e,s,this.channelId).then((function(e){var r=e.code,a=e.data;r===t.ErrorCode.SUCCESS?ne(n.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getUnreadCount ->code:"+r+",targetId:"+s),oe(n.onError,r))}))},e.prototype.clearConversations=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"clearConversations -> conversationTypes:"+s),this._isCPPMode?this._context.clearConversations(s,this.channelId).then((function(s){s===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"clearConversations ->code:"+s),oe(e.onError,s))})):this.logger.error(t.LogTagId.O,"Method is only available in cppProtocol mode")},e.prototype.clearUnreadCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->targetId:"+s+",conversationType:"+e),this._context.clearUnreadCount(e,s,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:"+e+",targetId:"+s),oe(n.onError,e))}))},e.prototype.clearAllUnreadCount=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"clearUnreadCount ->"),this._context.clearAllUnreadCount().then((function(n){n===t.ErrorCode.SUCCESS?ne(e.onSuccess,!0):(s.logger.warn(t.LogTagId.O,"clearUnreadCount ->code:"+n),oe(e.onError,n))}))},e.prototype.getFirstUnreadMessage=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFirstUnreadMessage ->targetId:"+s+",conversationType:"+e),this._context.getFirstUnreadMessage(e,s,this.channelId).then((function(e){e.code===t.ErrorCode.SUCCESS?ne(n.onSuccess,e.data?te(e.data):null):(o.logger.warn(t.LogTagId.O,"getFirstUnreadMessage ->code:"+e.code+",targetId:"+s),oe(n.onError,e.code))}))},e.prototype.setConversationStatus=function(e,s,n,o){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("status",n,t.AssertRules.OBJECT,!0),this.logger.info(t.LogTagId.O,"setConversationStatus ->targetId:"+s+",status:"+n);var a=n.isTop,i=n.notificationStatus;this._context.setConversationStatus(e,s,a,i,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess):(r.logger.warn(t.LogTagId.O,"setConversationStatus ->code:"+e+",targetId:"+s),oe(o.onError,e))}))},e.prototype.sendMessage=function(e,s,o,a,i,c,g,u){var d=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("msg",o,t.AssertRules.OBJECT,!0),t.assert("callback",a,t.AssertRules.CALLBACK),t.assert("isMentioned",i,t.AssertRules.BOOLEAN),t.assert("pushContent",c,t.AssertRules.ONLY_STRING),t.assert("pushData",g,t.AssertRules.ONLY_STRING),t.assert("options.userIds",null==u?void 0:u.userIds,t.AssertRules.ARRAY),t.assert("options.isVoipPush",null==u?void 0:u.isVoipPush,t.AssertRules.BOOLEAN),t.assert("options.disableNotification",null==u?void 0:u.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.canIncludeExpansion",null==u?void 0:u.canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("options.expansion",null==u?void 0:u.expansion,t.AssertRules.OBJECT),t.assert("options.pushConfig",null==u?void 0:u.pushConfig,t.AssertRules.OBJECT),t.assert("options.resendMessageId",null==u?void 0:u.resendMessageId,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"sendMessage ->targetId:"+s+",conversationType:"+e);var l=!(!(null==u?void 0:u.isStatusMessage)&&!(null==u?void 0:u.isStatus)),C=function(e,t,s){var n,o=e||{},r=o.userIds,a=o.isVoipPush,i=o.disableNotification,c=o.isFilerWhiteBlacklist,g=o.expansion,u=o.canIncludeExpansion,d=o.pushConfig,l=o.resendMessageId,C=[];if(t){var h=(s||{}).content.mentionedInfo;C=h.userIdList,n=h.type}return{mentionedType:n,mentionedUserIdList:C,directionalUserIdList:r,isVoipPush:a,disableNotification:i,isFilerWhiteBlacklist:c,expansion:g,canIncludeExpansion:u,pushConfig:d,messageId:l}}(u,i,o);c=c||"",g=g||"";var h=Object.assign(o,r(r({isMentioned:i,pushContent:c,pushData:g},C),{messageType:o.objectName,channelId:this.channelId,isStatusMessage:l})),p=this._context.getCurrentUserId(),f=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:h.messageType,conversationType:e,targetId:s,channelId:this.channelId}),f),this._context.sendMessage(e,s,h,a.onBefore,f).then((function(r){var i=r.code,c=r.data,g=i===t.ErrorCode.SUCCESS?"info":"warn";if(d.logger[g](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:i,messageUId:c?c.messageUId:"",messageId:c?c.messageId:""}),f),i===t.ErrorCode.SUCCESS){d._isCPPMode||X.set(c);var C=te(c);se(C,p,d._context.getConnectedTime(),d._readReceiptTimeout,d._storage),ne(a.onSuccess,C)}else d.logger.warn(t.LogTagId.O,"sendMessage ->code:"+i+",targetId:"+s),oe(a.onError,i,te({isMentioned:!!h.isMentioned,content:o.content,messageType:o.messageType,isPersited:o.isPersited,isCounted:o.isCounted,disableNotification:!!(null==u?void 0:u.disableNotification),canIncludeExpansion:!!(null==u?void 0:u.canIncludeExpansion),expansion:(null==u?void 0:u.expansion)||null,conversationType:e,targetId:s,senderUserId:p,messageUId:"",messageDirection:t.MessageDirection.SEND,isOffLineMessage:!1,sentTime:(null==c?void 0:c.sentTime)||0,receivedTime:0,isStatusMessage:l,receivedStatus:t.ReceivedStatus.UNREAD,receivedStatusInfo:t.transformReceivedStatusInfo(t.ReceivedStatus.UNREAD),messageId:null==c?void 0:c.messageId,sentStatus:n.FAILED}))}))},e.prototype.sendRecallMessage=function(e,s,n){var o=this;t.assert("message.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("message.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("message.messageUId",e.messageUId,t.AssertRules.STRING,!0),t.assert("message.sentTime",e.sentTime,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("options.disableNotification",null==n?void 0:n.disableNotification,t.AssertRules.BOOLEAN),t.assert("options.pushConfig",null==n?void 0:n.pushConfig,t.AssertRules.OBJECT),t.assert("options.extra",null==n?void 0:n.extra,t.AssertRules.STRING);var a=e.conversationType,i=e.targetId,c=e.messageUId,g=e.sentTime;this.logger.info(t.LogTagId.O,"sendRecallMessage ->targetId:"+i+",conversationType:"+a+",messageUId:"+c);var u=r({channelId:this.channelId},n);this._context.recallMessage(a,i,c,g,u).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?(o._isCPPMode||X.set(r),ne(s.onSuccess,te(r))):(o.logger.warn(t.LogTagId.O,"sendRecallMessage ->code:"+n+",targetId:"+i+",messageUId:"+c),oe(s.onError,n))}))},e.prototype.sendTypingStatusMessage=function(e,s,n,o){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("typingContentType",n,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"sendTypingStatusMessage ->targetId:"+s+",conversationType:"+e);var a={messageType:"RC:TypSts",content:{typingContentType:n},isStatusMessage:!0,channelId:this.channelId},i=this.logger.createTraceId();this.logger.info(t.LogTagId.A_SEND_MSG_T,JSON.stringify({messageType:a.messageType,conversationType:e,targetId:s,channelId:a.channelId}),i),this._context.sendMessage(e,s,a,void 0,i).then((function(e){var n=e.code,a=e.data,c=n===t.ErrorCode.SUCCESS?"info":"warn";r.logger[c](t.LogTagId.A_SEND_MSG_R,JSON.stringify({code:n,messageUId:a?a.messageUId:"",messageId:a?a.messageId:""}),i),n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(a)):(r.logger.warn(t.LogTagId.O,"sendTypingStatusMessage ->code:"+n+",targetId:"+s),oe(o.onError,n))}))},e.prototype.sendReceiptResponse=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"sendReceiptResponse ->targetId:"+s+",conversationType:"+e);var r=""+this._context.getCurrentUserId()+e+s+"RECEIVED",a=this._storage.get(r);if(a){var i=[];for(var c in a){var g={};g[c]=a[c].uIds,a[c].isResponse||i.push(g)}if(0===i.length)return void n.onSuccess(null);var u=setInterval((function(){1===i.length&&clearInterval(u);var c=i.splice(0,1)[0],g=new ge({receiptMessageDic:c});o.sendMessage(e,s,g,{onSuccess:function(e){var t=Object.keys(c)[0];a[t].isResponse=!0,o._storage.set(r,a),ne(n.onSuccess,e)},onError:function(e){o.logger.warn(t.LogTagId.O,"sendReceiptResponse ->code:"+e+",targetId:"+s),oe(n.onError,e)}})}),200)}else n.onSuccess(null)},e.prototype.sendReadReceiptMessage=function(e,s,n){var o=this;t.assert("messageUIds",e,t.AssertRules.ARRAY,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"sendReadReceiptMessage ->targetId:"+s+",messageUIds:"+e);for(var r=0,a=e;r<a.length;r++){var i=a[r];t.assert("messageUId",i,t.AssertRules.STRING)}this._context.sendReadReceiptMessage(s,e,this.channelId).then((function(r){var a=r.code;a===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:"+a+",targetId:"+s+",messageUIds:"+e),n.onError(a))})).catch((function(r){o.logger.warn(t.LogTagId.O,"sendReadReceiptMessage ->code:"+r+",targetId:"+s+",messageUIds:"+e),n.onError(r)}))},e.prototype.getMessageReader=function(e,s,n){var o=this;t.assert("messageUId",e,t.AssertRules.STRING,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"getMessageReader ->targetId:"+s+",messageUId:"+e),this._context.getMessageReader(s,e,this.channelId).then((function(r){var a=r.code,i=r.data;a===t.ErrorCode.SUCCESS?n.onSuccess(i):(o.logger.warn(t.LogTagId.O,"getMessageReader ->code:"+a+",targetId:"+s+",messageUId:"+e),n.onError(a))})).catch((function(r){o.logger.warn(t.LogTagId.O,"getMessageReader ->code:"+r+",targetId:"+s+",messageUId:"+e),n.onError(r)}))},e.prototype.updateMessageExpansion=function(e,s,n){var o=this;t.assert("expansion",e,t.AssertRules.OBJECT,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var r=s.conversationType,a=s.targetId,i=s.messageUId,c=s.canIncludeExpansion,g=s.expansion;this.logger.info(t.LogTagId.O,"updateMessageExpansion ->targetId:"+a+",messageUId:"+i+",conversationType:"+r),this._context.sendExpansionMessage({conversationType:r,targetId:a,messageUId:i,canIncludeExpansion:c,originExpansion:g,expansion:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"updateMessageExpansion ->code:"+s+",targetId:"+a+",messageUId:"+i),oe(n.onError,s))}))},e.prototype.removeMessageExpansionForKey=function(e,s,n){var o=this;t.assert("keys",e,t.AssertRules.ARRAY,!0),t.assert("message",s,t.AssertRules.OBJECT,!0);var r=s.conversationType,a=s.targetId,i=s.messageUId,c=s.canIncludeExpansion;this.logger.info(t.LogTagId.O,"removeMessageExpansionForKey ->targetId:"+a+",messageUId:"+i+",conversationType:"+r),this._context.sendExpansionMessage({conversationType:r,targetId:a,messageUId:i,canIncludeExpansion:c,keys:e,channelId:this.channelId}).then((function(e){var s=e.code;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeMessageExpansionForKey ->code:"+s+",targetId:"+a+",messageUId:"+i),oe(n.onError,s))}))},e.prototype.getHistoryMessages=function(e,s,n,o,r,a,i){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK,!0),t.assert("order",i,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getHistoryMessages ->targetId:"+s+",conversationType:"+e+",timestamp:"+n);var g=this.logger.createTraceId();this.logger.info(t.LogTagId.A_GET_HISTORY_MSG_T,JSON.stringify({targetId:s,conversationType:e,channelId:"",timestamp:n,count:o}),g),this._context.getHistoryMessage(e,s,n,o,i,this.channelId,a,g).then((function(e){var s=e.code,n=e.data;if(s===t.ErrorCode.SUCCESS)if(n){var o=n.list,a=n.hasMore,i=[],u=o.map((function(e){return i.push(e.messageUId),te(e)}));c.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:i.join(",")}),g),ne(r.onSuccess,u,a)}else c.logger.info(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),ne(r.onSuccess,[],!1);else c.logger.warn(t.LogTagId.A_GET_HISTORY_MSG_R,JSON.stringify({code:s,messageUIds:""}),g),oe(r.onError,s)}))},e.prototype.deleteRemoteMessages=function(e,s,n,o){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("messages",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteRemoteMessages ->targetId:"+s+",conversationType:"+e),this._context.deleteRemoteMessage(e,s,n,this.channelId).then((function(a){if(a===t.ErrorCode.SUCCESS){if(!r._isCPPMode){var i=X.get(e,s,r.channelId);i&&n.forEach((function(t){i.messageUId===t.messageUId&&X.remove(e,s,r.channelId)}))}ne(o.onSuccess)}else r.logger.warn(t.LogTagId.O,"deleteRemoteMessages ->code:"+a+",targetId:"+s),oe(o.onError,a)}))},e.prototype.clearRemoteHistoryMessages=function(e,s){var n=this;t.assert("param.conversationType",e.conversationType,t.AssertRules.NUMBER,!0),t.assert("param.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("param.timestamp",e.timestamp,t.AssertRules.NUMBER,!0),t.assert("callback",s,t.AssertRules.CALLBACK);var o=e.conversationType,r=e.targetId,a=e.timestamp;this.logger.info(t.LogTagId.O,"clearRemoteHistoryMessages ->targetId:"+r+",conversationType:"+o),this._context.deleteRemoteMessageByTimestamp(o,r,a,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"clearRemoteHistoryMessages ->code:"+e),oe(s.onError,e))}))},e.prototype.getConversationListWithAllChannel=function(e){t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getConversationListWithAllChannel().then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.getConversationListWithAllChannelByPage=function(e,s,n){t.assert("callback",e,t.AssertRules.CALLBACK),t.assert("index",s,t.AssertRules.NUMBER),t.assert("limit",n,t.AssertRules.NUMBER),this._context.getConversationListWithAllChannelByPage(s,n).then((function(s){var n=s.code,o=s.data;n===t.ErrorCode.SUCCESS?ne(e.onSuccess,o.map(ee)):oe(e.onError,n)}))},e.prototype.insertMessage=function(e,s,n,o,r){var a=this;void 0===r&&(r={});var i=n.senderUserId,c=n.objectName,g=n.content,u=n.messageDirection,d=n.canIncludeExpansion,l=n.expansion,C=n.disableNotification,h=n.sentTime,p=n.sentStatus;this.logger.info(t.LogTagId.O,"insertMessage ->targetId:"+s+",conversationType:"+e);var f=r.isUnread,I={senderUserId:i,messageType:c,content:g,messageDirection:u,sentTime:h,sentStatus:p,searchContent:r.searchContent,isUnread:f,messageUId:"",disableNotification:C,canIncludeExpansion:d,expansionMsg:JSON.stringify(l),channelId:this.channelId};this._context.insertMessage(e,s,I).then((function(e){var n=e.code,r=e.data;n===t.ErrorCode.SUCCESS?ne(o.onSuccess,te(r)):(a.logger.warn(t.LogTagId.O,"insertMessage ->code:"+n+",targetId:"+s),oe(o.onError,n))}))},e.prototype.batchInsertMessage=function(e,s,n){this._context.batchInsertMessage(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.getMessageCount=function(e,s,n){this._context.getMessageCount(e,s).then((function(e){var s=e.code,o=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess,o):oe(n.onError,s)}))},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,r){var a=this;this.logger.info(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->targetId:"+s+",conversationType:"+e+",timestamp:"+n),this._context.deleteMessagesByTimestamp(e,s,n,o,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(r.onSuccess,!0):(a.logger.warn(t.LogTagId.O,"deleteLocalMessagesByTimestamp ->code:"+e+",targetId:"+s),oe(r.onError,e))}))},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,r,a){var i=this;this.logger.info(t.LogTagId.O,"getRemoteHistoryMessages ->targetId:"+s+",conversationType:"+e);var c=a.order||0;this._context.getRemoteHistoryMessages(e,s,n,o,c,this.channelId).then((function(e){var n=e.code,o=e.data;if(n===t.ErrorCode.SUCCESS)if(o){var a=o.list,c=o.hasMore,g=a.map((function(e){return te(e)}));ne(r.onSuccess,g,c)}else ne(r.onSuccess,[],!1);else i.logger.warn(t.LogTagId.O,"getRemoteHistoryMessages ->code:"+n+",targetId:"+s),oe(r.onError,n)}))},e.prototype.clearMessages=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"clearMessages ->targetId:"+s+",conversationType:"+e),this._context.clearMessages(e,s,this.channelId).then((function(r){r===t.ErrorCode.SUCCESS?(o._isCPPMode||X.remove(e,s,o.channelId),ne(n.onSuccess,!0)):(o.logger.warn(t.LogTagId.O,"clearMessages ->code:"+r+",targetId:"+s),oe(n.onError,r))}))},e.prototype.searchConversationByContent=function(e,s,n,o){var r=this;this.logger.info(t.LogTagId.O,"searchConversationByContent ->keyword:"+e),this._context.searchConversationByContent(e,o,this.channelId,n).then((function(n){var o=n.code,a=n.data,i=[];a=a||[],o===t.ErrorCode.SUCCESS?(a.forEach((function(e){i.push(ee(e))})),ne(s.onSuccess,i)):(r.logger.warn(t.LogTagId.O,"searchConversationByContent ->code:"+o+",keyword:"+e),oe(s.onError,o))}))},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var r=this;void 0===n&&(n=[]),this.logger.info(t.LogTagId.O,"searchConversationByContentWithAllChannel ->keyword:"+e),this._context.searchConversationByContentWithAllChannel(e,n,o).then((function(n){var o=n.code,a=n.data,i=[];a=a||[],o===t.ErrorCode.SUCCESS?(a.forEach((function(e){i.push(ee(e))})),ne(s.onSuccess,i)):(r.logger.warn(t.LogTagId.O,"searchConversationByContentWithAllChannel ->code:"+o+",keyword:"+e),oe(s.onError,o))}))},e.prototype.searchMessageByContent=function(e,s,n,o,r,a,i){var c=this;this.logger.info(t.LogTagId.O,"searchMessageByContent ->targetId:"+s+",conversationType:"+e+",keyword:"+n),this._context.searchMessageByContent(e,s,n,o,r,a,this.channelId).then((function(e){var n=e.code,o=e.data,r=[];if(n===t.ErrorCode.SUCCESS){var a=o=o||{},g=a.messages,u=a.count;g.forEach((function(e){r.push(te(e))})),ne(i.onSuccess,r,u)}else c.logger.warn(t.LogTagId.O,"searchMessageByContent ->code:"+n+",targetId:"+s),oe(i.onError,n)}))},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,r,a){var i=this;this.logger.info(t.LogTagId.O,"searchMessageByContentWithAllChannel ->targetId: "+s+" ,conversationType: "+e+" ,keyword: "+n+", timestamp: "+o+", count: "+r),this._context.searchMessageByContentWithAllChannel(e,s,n,o,r).then((function(e){var n=e.code,o=e.data,r=[];if(n===t.ErrorCode.SUCCESS){var c=o=o||{},g=c.messages,u=c.count;g.forEach((function(e){r.push(te(e))})),ne(a.onSuccess,r,u)}else i.logger.warn(t.LogTagId.O,"searchMessageByContentWithAllChannel ->code:"+n+",targetId:"+s),oe(a.onError,n)}))},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,r,a,i,c){var g=this;this.logger.info(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->targetId: "+s+" ,conversationType: "+e+" ,keyword: "+n+", startTime: "+o+", endTime: "+r+", offset: "+a+", limit: "+i),this._context.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,r,a,i).then((function(e){var n=e.code,o=e.data,r=[];n===t.ErrorCode.SUCCESS?((o=o||{}).messages.forEach((function(e){r.push(te(e))})),ne(c.onSuccess,r)):(g.logger.warn(t.LogTagId.O,"searchMessageByContentInTimeRangeWithAllChannel ->code:"+n+",targetId:"+s),oe(c.onError,n))}))},e.prototype.getUnreadMentionedMessages=function(e,s){return this.logger.info(t.LogTagId.O,"getUnreadMentionedMessages ->targetId:"+s+",conversationType:"+e),this._context.getUnreadMentionedMessages(e,s,this.channelId).map((function(e){return te(e)}))},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var r=this;this.logger.info(t.LogTagId.O,"clearUnreadCountByTimestamp ->targetId:"+s+",conversationType:"+e),this._context.clearUnreadCountByTimestamp(e,s,n,this.channelId).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"clearUnreadCountByTimestamp ->code:"+e+",targetId:"+s),oe(o.onError,e))}))},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getConversationNotificationStatus ->targetId:"+s+",conversationType:"+e),this._context.getConversationNotificationStatus(e,s,this.channelId).then((function(e){var r=e.code,a=e.data;r===t.ErrorCode.SUCCESS?ne(n.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getConversationNotificationStatus ->code:"+r+",targetId:"+s),oe(n.onError,r))}))},e.prototype.getGroupMessageDeliverList=function(e,s,n){var o=this;this.logger.info(t.LogTagId.O,"getGroupMessageDeliverList ->targetId:"+e+"',messageUId:"+s),this._context.getGroupMessageDeliverList(e,s,this.channelId).then((function(e){var r=e.code,a=e.data;r===t.ErrorCode.SUCCESS?ne(n.onSuccess,a):(o.logger.warn(t.LogTagId.O,"getGroupMessageDeliverList ->code:"+r+",messageUId:"+s),oe(n.onError,r))}))},e.prototype.getPrivateMessageDeliverTime=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"getPrivateMessageDeliverTime -> messageUId:"+e),this._context.getPrivateMessageDeliverTime(e,this.channelId).then((function(o){var r=o.code,a=o.data;r===t.ErrorCode.SUCCESS?ne(s.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getPrivateMessageDeliverTime ->code:"+r+",messageUId:"+e),oe(s.onError,r))}))},e}(),de=function(e){return{targetId:e.targetId,channelId:e.channelId,conversationType:e.type}},le=function(){function e(e,s,n,o){this._context=e,this._options=s,this.logger=n,this._storage=o,this._channelClient={},this._isCPPMode=t.usingCppEngine(),this._defaultChannelClient=new ue(this.logger,e,"",this._isCPPMode,s.readReceiptTimeout,this._storage)}return e.prototype.assertCPPMode=function(e,s,n){if(!this._isCPPMode)return null==n||n.onError(t.ErrorCode.NOT_SUPPORT),void this.logger.error(t.LogTagId.O,"'"+s+"' is unusable!");e()},e.prototype.install=function(e,t){return this._context.install(e,t)},e.prototype.getChannel=function(e){if(this.logger.info(t.LogTagId.O,"getChannel ->channelId:"+e),!this._isCPPMode)return this.logger.error(t.LogTagId.O,"getChannel method is only available in protocol stack mode"),null;if(t.assert("channelId",e,t.AssertRules.STRING,!0),e.length>20)return this.logger.error(t.LogTagId.O,"The channelId cannot exceed 20 characters"),null;if(e in this._channelClient)return this._channelClient[e];if(Object.keys(this._channelClient).length>1e3)return this.logger.error(t.LogTagId.O,"Only 1000 channels can be obtained"),null;var s=new ue(this.logger,this._context,e,this._isCPPMode,this._options.readReceiptTimeout,this._storage);return this._channelClient[e]=s,s},e.prototype.deleteChannels=function(e){var s=this;t.assert("channelIds",e,t.AssertRules.ARRAY,!0),this.logger.info(t.LogTagId.O,"deleteChannels ->channelIds:"+e),this.assertCPPMode((function(){e.forEach((function(e){delete s._channelClient[e]}))}),"deleteChannels")},e.prototype.getNavi=function(){return this._context.getNaviInfoFromCache()||{}},e.prototype.getSDKInfo=function(){return{version:"5.9.6"}},e.prototype.getAppInfo=function(){return{appKey:this._context.appkey}},e.prototype.getCurrentUserId=function(){return this._context.getCurrentUserId()},e.prototype.disconnect=function(e){return a(this,void 0,void 0,(function(){return i(this,(function(s){switch(s.label){case 0:return this.logger.info(t.LogTagId.A_DISCONNECT_O),[4,this._context.disconnect(e)];case 1:return s.sent(),[2]}}))}))},e.prototype.logout=function(){return this.disconnect()},e.prototype.clearCache=function(){},e.prototype.getDeviceId=function(){return this._context.getDeviceId()},e.prototype.getConversationList=function(e,t,s){this._defaultChannelClient.getConversationList(e,t,s)},e.prototype.getConversationListWithAllChannel=function(e){this._defaultChannelClient.getConversationListWithAllChannel(e)},e.prototype.getConversationListWithAllChannelByPage=function(e,t,s){void 0===s&&(s=30),this._defaultChannelClient.getConversationListWithAllChannelByPage(e,t,s)},e.prototype.getConversation=function(e,t,s){return this._defaultChannelClient.getConversation(e,t,s)},e.prototype.removeConversation=function(e,t,s){return this._defaultChannelClient.removeConversation(e,t,s)},e.prototype.saveTextMessageDraft=function(e,t,s){return this._defaultChannelClient.saveTextMessageDraft(e,t,s)},e.prototype.getTextMessageDraft=function(e,t){return this._defaultChannelClient.getTextMessageDraft(e,t)},e.prototype.clearTextMessageDraft=function(e,t){return this._defaultChannelClient.clearTextMessageDraft(e,t)},e.prototype.getTotalUnreadCount=function(e,t,s){return this._defaultChannelClient.getTotalUnreadCount(e,t,s)},e.prototype.getUnreadCount=function(e,t,s){return this._defaultChannelClient.getUnreadCount(e,t,s)},e.prototype.getConversationUnreadCount=function(e,s){this.logger.error(t.LogTagId.O,"Method is deprecated")},e.prototype.clearConversations=function(e,t){return this._defaultChannelClient.clearConversations(e,t)},e.prototype.clearUnreadCount=function(e,t,s){this._defaultChannelClient.clearUnreadCount(e,t,s)},e.prototype.clearAllUnreadCount=function(e){this._defaultChannelClient.clearAllUnreadCount(e)},e.prototype.setConversationStatus=function(e,t,s,n){return this._defaultChannelClient.setConversationStatus(e,t,s,n)},e.prototype.sendMessage=function(e,t,s,n,o,r,a,i,c){return this._defaultChannelClient.sendMessage(e,t,s,n,o,r,a,c)},e.prototype.sendRecallMessage=function(e,t,s){return this._defaultChannelClient.sendRecallMessage(e,t,s)},e.prototype.sendTypingStatusMessage=function(e,t,s,n){return this._defaultChannelClient.sendTypingStatusMessage(e,t,s,n)},e.prototype.sendReceiptResponse=function(e,t,s){return this._defaultChannelClient.sendReceiptResponse(e,t,s)},e.prototype.sendReadReceiptMessage=function(e,t,s){return this._defaultChannelClient.sendReadReceiptMessage(e,t,s)},e.prototype.getMessageReader=function(e,t,s){this._defaultChannelClient.getMessageReader(e,t,s)},e.prototype.updateMessageExpansion=function(e,t,s){this._defaultChannelClient.updateMessageExpansion(e,t,s)},e.prototype.removeMessageExpansionForKey=function(e,t,s){this._defaultChannelClient.removeMessageExpansionForKey(e,t,s)},e.prototype.getHistoryMessages=function(e,t,s,n,o,r,a){return this._defaultChannelClient.getHistoryMessages(e,t,s,n,o,r,a)},e.prototype.joinChatRoom=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"joinChatRoom ->chatRoomId:"+e);var r=this.logger.createTraceId();this.logger.info(t.LogTagId.A_JOIN_CHATROOM_T,JSON.stringify({chatroomId:e,count:s,joinExist:!1}),r),this._context.joinChatroom(e,s,r).then((function(s){var a=s===t.ErrorCode.SUCCESS?"info":"warn";o.logger[a](t.LogTagId.A_JOIN_CHATROOM_R,JSON.stringify({code:s,timestamp:(new Date).getTime()}),r),s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"joinChatRoom ->code:"+s+",chatRoomId:"+e),oe(n.onError,s))}))},e.prototype.quitChatRoom=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"quitChatRoom ->chatRoomId:"+e);var o=this.logger.createTraceId();this.logger.info(t.LogTagId.A_QUIT_CHATROOM_T,JSON.stringify({chatroomId:e}),o),this._context.quitChatroom(e).then((function(r){var a=r===t.ErrorCode.SUCCESS?"info":"warn";n.logger[a](t.LogTagId.A_QUIT_CHATROOM_R,JSON.stringify({code:r}),o),r===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"quitChatRoom ->code:"+r+",chatRoomId:"+e),oe(s.onError,r))}))},e.prototype.getChatRoomInfo=function(e,s,n,o){var r=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatRoomInfo ->chatRoomId:"+e),this._context.getChatroomInfo(e,s,n).then((function(s){var n=s.code,a=s.data;n===t.ErrorCode.SUCCESS?ne(o.onSuccess,{userInfos:(null==a?void 0:a.userInfos)||[],userTotalNums:(null==a?void 0:a.userCount)||0}):(r.logger.warn(t.LogTagId.O,"getChatRoomInfo ->code:"+n+",chatRoomId:"+e),oe(o.onError,n))}))},e.prototype.setChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setChatroomEntry ->chatRoomId:"+e),this._context.setChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"setChatroomEntry ->code:"+s+",chatRoomId:"+e),oe(n.onError,s))}))},e.prototype.setChatRoomEntries=function(e,s,n){var o=this;if(t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("entry.key",e.key,t.AssertRules.STRING,!0),t.assert("entry.value",e.value,t.AssertRules.STRING,!0)})),t.assert("options.isAutoDelete",e.isAutoDelete,t.AssertRules.BOOLEAN)}(s),t.assert("callback",n,t.AssertRules.CALLBACK),s.entries.length>10)oe(n.onError,t.ErrorCode.CHATROOM_KV_STORE_OUT_LIMIT);else{var r="id:"+e;this.logger.info(t.LogTagId.O,"set chatroom entry->"+r),this._context.setChatroomEntries(e,s).then((function(e){var s=e.code,a=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"set chatroom entry fail ->code+:"+s+","+r),oe(n.onError,s,a))}))}},e.prototype.forceSetChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceSetChatroomEntry ->chatRoomId:"+e),this._context.forceSetChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceSetChatroomEntry ->code:"+s+",chatRoomId:"+e),oe(n.onError,s))}))},e.prototype.removeChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeChatroomEntry ->chatRoomId:"+e),this._context.removeChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"removeChatroomEntry ->code:"+s+",chatRoomId:"+e),oe(n.onError,s))}))},e.prototype.removeChatRoomEntries=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),function(e){e.entries.forEach((function(e){t.assert("key",e,t.AssertRules.STRING,!0)}))}(s);var a="id:"+e;this.logger.debug(t.LogTagId.O,"remove chatroom entry->"+a);var i=r({},s);i.entries=s.entries.map((function(e){return{key:e}})),this._context.removeChatroomEntries(e,i).then((function(e){var s=e.code,r=e.data;s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"remove chatroom entry fail ->code+:"+s+","+a),oe(n.onError,s,r))}))},e.prototype.forceRemoveChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("chatroomEntry",s,t.AssertRules.OBJECT,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"forceRemoveChatroomEntry ->chatRoomId:"+e),this._context.forceRemoveChatroomEntry(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess):(o.logger.warn(t.LogTagId.O,"forceRemoveChatroomEntry ->code:"+s+",chatRoomId:"+e),oe(n.onError,s))}))},e.prototype.getChatroomEntry=function(e,s,n){var o=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("key",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getChatroomEntry ->chatRoomId:"+e+",key:"+s),this._context.getChatroomEntry(e,s).then((function(s){var r=s.code,a=s.data;r===t.ErrorCode.SUCCESS?ne(n.onSuccess,a||""):(o.logger.warn(t.LogTagId.O,"getChatroomEntry ->code:"+r+",chatRoomId:"+e),oe(n.onError,r))}))},e.prototype.getAllChatroomEntries=function(e,s){var n=this;t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getAllChatroomEntries ->chatRoomId:"+e),this._context.getAllChatroomEntries(e).then((function(o){var r=o.code,a=o.data;r===t.ErrorCode.SUCCESS?ne(s.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getAllChatroomEntries ->code:"+r+",chatRoomId:"+e),oe(s.onError,r))}))},e.prototype.getChatRoomHistoryMessages=function(e,s,n,o,r){var a=this;void 0===r&&(r=0),t.assert("chatRoomId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("order",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("timestamp",r,t.AssertRules.NUMBER),this.logger.info(t.LogTagId.O,"getChatRoomHistoryMessages ->chatRoomId:"+e),this._context.getChatRoomHistoryMessages(e,s,n,r).then((function(s){var n=s.code,r=s.data;if(n===t.ErrorCode.SUCCESS)if(r){var i=r.list,c=r.hasMore,g=i.map((function(e){return te(e)}));ne(o.onSuccess,g,c)}else ne(o.onSuccess,[],!1);else a.logger.warn(t.LogTagId.O,"getChatRoomHistoryMessages ->code:"+n+",chatRoomId:"+e),oe(o.onError,n)}))},e.prototype.setDeviceInfo=function(e){},e.prototype.getCurrentConnectionStatus=function(){return this._context.getConnectionStatus()},e.prototype.deleteRemoteMessages=function(e,t,s,n){return this._defaultChannelClient.deleteRemoteMessages(e,t,s,n)},e.prototype.clearRemoteHistoryMessages=function(e,t){return this._defaultChannelClient.clearRemoteHistoryMessages(e,t)},e.prototype.getFileToken=function(e,s,n,o,r){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",n,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getFileToken ->fileType:"+e+",fileName:"+n+",queryString:"+r),this._context.getFileToken(e,n,o,r).then(s.onSuccess).catch(s.onError)},e.prototype.getFileUrl=function(e,s,n,o,r,a){t.assert("fileType",e,t.AssertRules.NUMBER,!0),t.assert("fileName",s,t.AssertRules.STRING,!0),t.assert("saveName",n,t.AssertRules.STRING),t.assert("callback",o,t.AssertRules.CALLBACK),t.assert("serverType",a,t.AssertRules.NUMBER),t.assert("uploadRes",r,t.AssertRules.OBJECT),this.logger.info(t.LogTagId.O,"getFileUrl ->fileType:"+e+",fileName:"+s),this._context.getFileUrl(e,s,n,r,a).then(o.onSuccess).catch(o.onError)},e.prototype.createTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagId",e.tagId,(function(e){return e.length<=10})),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),this._context.createTag(e).then((function(o){var r=o.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"createTag ->code:"+r+",tagId:"+e.tagId),s.onError(r))})).catch((function(o){n.logger.warn(t.LogTagId.O,"createTag ->code:"+o+",tagId:"+e.tagId),s.onError(o)}))},e.prototype.removeTag=function(e,s){var n=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeTag ->tagId:"+e),this._context.removeTag(e).then((function(o){var r=o.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"removeTag ->code:"+r+",tagId:"+e),s.onError(r))})).catch((function(o){n.logger.warn(t.LogTagId.O,"removeTag ->code:"+o+",tagId:"+e),s.onError(o)}))},e.prototype.updateTag=function(e,s){var n=this;t.assert("tag.tagId",e.tagId,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,t.AssertRules.STRING,!0),t.assert("tag.tagName",e.tagName,(function(e){return e.length<=15})),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),this._context.updateTag(e).then((function(o){var r=o.code;r===t.ErrorCode.SUCCESS?s.onSuccess():(n.logger.warn(t.LogTagId.O,"updateTag ->code:"+r+",tagId:"+e.tagId),s.onError(r))})).catch((function(o){n.logger.warn(t.LogTagId.O,"updateTag ->reason:"+o+",tagId:"+e.tagId),s.onError(o)}))},e.prototype.getTagList=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this._context.getTagList().then((function(n){var o=n.code,r=n.data;o===t.ErrorCode.SUCCESS?e.onSuccess(r||[]):(s.logger.warn(t.LogTagId.O,"getTagList ->code:"+o),e.onError(o))})).catch((function(n){s.logger.warn(t.LogTagId.O,"getTagList ->reason:"+n),e.onError(n)}))},e.prototype.getTagsForConversation=function(e,s){var n=this;t.assert("conversationType",e.type,t.AssertRules.NUMBER),t.assert("targetId",e.targetId,t.AssertRules.STRING),t.assert("channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.type),this._context.getTagsForConversation(de(e)).then((function(e){var o=e.code,r=e.data;o===t.ErrorCode.SUCCESS?s.onSuccess(r||[]):(n.logger.warn(t.LogTagId.O,"getTagsForConversation ->code:"+o),s.onError(o))})).catch((function(e){n.logger.warn(t.LogTagId.O,"getTagsForConversation ->reason:"+e),s.onError(e)}))},e.prototype.addTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"addTagForConversations ->tagId:"+e),this._context.addTagForConversations(e,s.map((function(e){return de(e)}))).then((function(s){var r=s.code;s.data,r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"addTagForConversations ->code:"+r+",tagId:"+e),n.onError(r))})).catch((function(s){o.logger.warn(t.LogTagId.O,"addTagForConversations ->reason:"+s+",tagId:"+e),n.onError(s)}))},e.prototype.removeTagForConversations=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversations",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING)})),this.logger.info(t.LogTagId.O,"removeTagForConversations ->tagId:"+e),this._context.removeTagForConversations(e,s.map((function(e){return de(e)}))).then((function(s){var r=s.code;s.data,r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagForConversations ->code:"+r+",tagId:"+e),n.onError(r))})).catch((function(s){o.logger.warn(t.LogTagId.O,"removeTagForConversations ->reason:"+s+",tagId:"+e),n.onError(s)}))},e.prototype.removeTagsForConversation=function(e,s,n){var o=this;t.assert("conversation.type",e.type,t.AssertRules.NUMBER,!0),t.assert("conversation.targetId",e.targetId,t.AssertRules.STRING,!0),t.assert("conversation.channelId",e.channelId,t.AssertRules.ONLY_STRING),t.assert("tagIds",s,t.AssertRules.ARRAY,!0),t.assert("callback",n,t.AssertRules.CALLBACK),s.forEach((function(e){t.assert("tagId",e,t.AssertRules.STRING,!0)})),this.logger.info(t.LogTagId.O,"removeTagsForConversation ->tagIds:"+s+",targetId:"+e.targetId+",type:"+e.type),this._context.removeTagsForConversation(de(e),s).then((function(e){var r=e.code;e.data,r===t.ErrorCode.SUCCESS?n.onSuccess():(o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->code:"+r+",tagIds:"+s),n.onError(r))})).catch((function(e){o.logger.warn(t.LogTagId.O,"removeTagsForConversation ->reason:"+e+",tagIds:"+s),n.onError(e)}))},e.prototype.getConversationListByTag=function(e,s,n,o){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("count",s,t.AssertRules.NUMBER,!0),t.assert("startTime",n,t.AssertRules.NUMBER,!0),t.assert("callback",o,t.AssertRules.CALLBACK,!0),this.logger.info(t.LogTagId.O,"getConversationListByTag ->tagId:"+e),this._context.getConversationListByTag(e,n,s).then((function(s){var n=s.code,a=s.data,i=[];n===t.ErrorCode.SUCCESS?((a=a||[]).forEach((function(e){i.push(function(e){var t=e.channelId,s=e.conversationType,n=e.targetId,o=e.unreadMessageCount,r=e.latestMessage,a=e.isTop,i=e.notificationStatus,c=e.isTopInTag,g=r?te(r):null,u=g||{},d=u.messageType,l=u.sentTime,C=u.receivedStatus;return{channelId:t||"",conversationType:s,targetId:n,unreadMessageCount:o,latestMessage:g,isTopInTag:c,latestMessageId:u.messageId,objectName:d,sentTime:l,isTop:a,notificationStatus:i,receivedStatus:C}}(e))})),o.onSuccess(i)):(r.logger.warn(t.LogTagId.O,"getConversationListByTag ->code:"+n+",tagId:"+e),o.onError(n))})).catch((function(s){r.logger.warn(t.LogTagId.O,"getConversationListByTag ->reason:"+s+",tagId:"+e),o.onError(s)}))},e.prototype.getUnreadCountByTag=function(e,s,n){var o=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("containMuted",s,t.AssertRules.BOOLEAN,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUnreadCountByTag ->tagId:"+e),this._context.getUnreadCountByTag(e,s).then((function(s){var r=s.code,a=s.data;o.logger.info(t.LogTagId.O,JSON.stringify({code:r,data:a})),r===t.ErrorCode.SUCCESS?n.onSuccess(a||0):(o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->code:"+r+",tagId:"+e),n.onError(r))})).catch((function(s){o.logger.warn(t.LogTagId.O,"getUnreadCountByTag ->reason:"+s+",tagId:"+e),n.onError(s)}))},e.prototype.setConversationStatusInTag=function(e,s,n,o){var r=this;t.assert("tagId",e,t.AssertRules.STRING,!0),t.assert("conversation.targetId",s.targetId,t.AssertRules.STRING,!0),t.assert("conversation.type",s.type,t.AssertRules.NUMBER,!0),t.assert("conversation.channelId",s.channelId,t.AssertRules.ONLY_STRING),t.assert("status.isTop",null==n?void 0:n.isTop,t.AssertRules.BOOLEAN,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setConversationStatusInTag ->tagId:"+e+",targetId:"+s.targetId+",type"+s.type),this._context.setConversationStatusInTag(e,de(s),n).then((function(s){var n=s.code;s.data,n===t.ErrorCode.SUCCESS?o.onSuccess():(r.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->code:"+n+",tagId:"+e),o.onError(n))})).catch((function(s){r.logger.warn(t.LogTagId.O,"setConversationStatusInTag ->reason:"+s+",tagId:"+e),o.onError(s)}))},e.prototype.callExtra=function(e,s){for(var n,o=this,r=[],a=2;a<arguments.length;a++)r[a-2]=arguments[a];this.logger.info(t.LogTagId.O,"callExtra ->method:"+e),(n=this._context).callExtra.apply(n,function(e,t,s){if(s||2===arguments.length)for(var n,o=0,r=t.length;o<r;o++)!n&&o in t||(n||(n=Array.prototype.slice.call(t,0,o)),n[o]=t[o]);return e.concat(n||Array.prototype.slice.call(t))}([e],r,!1)).then((function(n){var r=n.code,a=n.data;if(r!==t.ErrorCode.SUCCESS)o.logger.warn(t.LogTagId.O,"callExtra ->code:"+r),s.onError&&oe(s.onError,r);else{if("getConversationsByPage"===e&&a.forEach((function(e){e.latestMessage=e.latestMessage?te(e.latestMessage):null})),"getHistoryMessagesByObjectNames"===e){var i=a,c=i.list,g=i.hasMore,u=c.map((function(e){return te(e)}));return void ne(s.onSuccess,u,g)}s.onSuccess&&ne(s.onSuccess,a)}}))},e.prototype.hasRemoteUnreadMessages=function(e,s){t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"hasRemoteUnreadMessages ->token:"+e),this.assertCPPMode((function(){ne(s.onSuccess,!1)}),"hasRemoteUnreadMessages",s)},e.prototype.setUserStatusListener=function(e,s){var n=this;this.logger.info(t.LogTagId.O,"setUserStatusListener ->userIds:"+e.userIds),this.assertCPPMode((function(){n._context.setUserStatusListener(e,s)}),"setUserStatusListener")},e.prototype.setUserStatus=function(e,s){var n=this;t.assert("status",e,t.AssertRules.NUMBER),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"setUserStatus ->status:"+e),this.assertCPPMode((function(){n._context.setUserStatus(e).then((function(e){e===t.ErrorCode.SUCCESS?ne(s.onSuccess,!0):(n.logger.warn(t.LogTagId.O,"setUserStatus ->code:"+e),oe(s.onError,e))}))}),"setUserStatus",s)},e.prototype.getUserStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getUserStatus ->userId:"+e),this.assertCPPMode((function(){n._context.getUserStatus(e).then((function(o){var r=o.code,a=o.data;r===t.ErrorCode.SUCCESS?ne(s.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getUserStatus ->code:"+r+",useerId:"+e),oe(s.onError,r))}))}),"getUserStatus",s)},e.prototype.addToBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"addToBlacklist ->userId:"+e),this.assertCPPMode((function(){n._context.addToBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"addToBlacklist ->code:"+o+",useerId:"+e),oe(s.onError,o))}))}),"addToBlacklist",s)},e.prototype.removeFromBlacklist=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"removeFromBlacklist ->userId:"+e),this.assertCPPMode((function(){n._context.removeFromBlacklist(e).then((function(o){o===t.ErrorCode.SUCCESS?ne(s.onSuccess):(n.logger.warn(t.LogTagId.O,"removeFromBlacklist ->code:"+o+",useerId:"+e),oe(s.onError,o))}))}),"removeFromBlacklist",s)},e.prototype.getBlacklist=function(e){var s=this;t.assert("callback",e,t.AssertRules.CALLBACK),this.assertCPPMode((function(){s._context.getBlacklist().then((function(n){var o=n.code,r=n.data;o===t.ErrorCode.SUCCESS?ne(e.onSuccess,r):(s.logger.warn(t.LogTagId.O,"getBlacklist ->code:"+o),oe(e.onError,o))}))}),"getBlacklist",e)},e.prototype.getBlacklistStatus=function(e,s){var n=this;t.assert("userId",e,t.AssertRules.STRING),t.assert("callback",s,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"getBlacklistStatus ->userId:"+e),this.assertCPPMode((function(){n._context.getBlacklistStatus(e).then((function(o){var r=o.code,a=o.data;r===t.ErrorCode.SUCCESS?ne(s.onSuccess,a):(n.logger.warn(t.LogTagId.O,"getBlacklistStatus ->code:"+r+",userId:"+e),oe(s.onError,r))}))}),"getBlacklistStatus",s)},e.prototype.insertMessage=function(e,s,n,o,r){var a=this;void 0===r&&(r={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("content.senderUserId",n.senderUserId,t.AssertRules.STRING,!0),t.assert("content.messageDirection",n.messageDirection,t.AssertRules.NUMBER,!0),t.assert("content.objectName",n.objectName,t.AssertRules.STRING,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"insertMessage ->targetId:"+s+",conversationType:"+e+",senderUserId:"+n.senderUserId),this.assertCPPMode((function(){a._defaultChannelClient.insertMessage(e,s,n,o,r)}),"insertMessage",o)},e.prototype.batchInsertMessage=function(e,s,n){var o,r,a=this;for(var i in t.assert("messages",e,(function(s){return t.isArray(s)&&!(e.length<=0||e.length>=500)}),!0),t.assert("checkDuplicate",s,t.AssertRules.BOOLEAN),t.assert("callback",n,t.AssertRules.CALLBACK),e)t.assert("message",e[i],t.AssertRules.OBJECT,!0),t.assert("message.conversationType",e[i].conversationType,(function(e){return[t.ConversationType.PRIVATE,t.ConversationType.DISCUSSION,t.ConversationType.GROUP,t.ConversationType.CUSTOMER_SERVICE,t.ConversationType.SYSTEM,t.ConversationType.APP_PUBLIC_SERVICE,t.ConversationType.PUBLIC_SERVICE].includes(e)}),!0),t.assert("message.targetId",e[i].targetId,t.AssertRules.STRING,!0),t.assert("message.senderUserId",e[i].senderUserId,t.AssertRules.STRING,!0),t.assert("message.messageType",e[i].messageType,t.AssertRules.STRING,!0),t.assert("message.content",e[i].content,t.AssertRules.OBJECT,!0),t.assert("message.messageDirection",e[i].messageDirection,t.AssertRules.NUMBER,!0),t.assert("message.canIncludeExpansion",e[i].canIncludeExpansion,t.AssertRules.BOOLEAN),t.assert("message.expansion",e[i].expansion,t.AssertRules.OBJECT),t.assert("message.disableNotification",e[i].disableNotification,t.AssertRules.BOOLEAN),t.assert("message.sentTime",e[i].sentTime,t.AssertRules.NUMBER),t.assert("message.sentStatus",e[i].sentStatus,t.AssertRules.NUMBER),t.assert("options.isUnread",null===(o=e[i])||void 0===o?void 0:o.isUnread,t.AssertRules.BOOLEAN),t.assert("options.searchContent",null===(r=e[i])||void 0===r?void 0:r.searchContent,t.AssertRules.STRING);this.assertCPPMode((function(){a._defaultChannelClient.batchInsertMessage(e,s,n)}),"batchInsertMessage",n)},e.prototype.getMessageCount=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.getMessageCount(e,s,n)}),"getMessageCount",n)},e.prototype.getRemoteHistoryMessages=function(e,s,n,o,r,a){var i=this;void 0===a&&(a={}),t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("count",o,t.AssertRules.NUMBER,!0),t.assert("callback",r,t.AssertRules.CALLBACK),t.assert("options.order",a.order,t.AssertRules.NUMBER),this.assertCPPMode((function(){i._defaultChannelClient.getRemoteHistoryMessages(e,s,n,o,r,a)}),"getRemoteHistoryMessages",r)},e.prototype.deleteLocalMessages=function(e,s,n,o){var r=this;t.assert("messageIds",n,t.AssertRules.ARRAY,!0),t.assert("callback",o,t.AssertRules.CALLBACK),this.logger.info(t.LogTagId.O,"deleteLocalMessages ->messageIds:"+n),this.assertCPPMode((function(){r._context.deleteMessages(n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):(r.logger.warn(t.LogTagId.O,"deleteLocalMessages ->code:"+e+",messageIds:"+n),oe(o.onError,e))}))}),"deleteLocalMessages",o)},e.prototype.deleteLocalMessagesByTimestamp=function(e,s,n,o,r){var a=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),t.assert("cleanSpace",o,t.AssertRules.BOOLEAN),t.assert("callback",r,t.AssertRules.CALLBACK),this.assertCPPMode((function(){a._defaultChannelClient.deleteLocalMessagesByTimestamp(e,s,n,o,r)}),"deleteLocalMessagesByTimestamp",r)},e.prototype.clearMessages=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("callback",n,t.AssertRules.CALLBACK),this.assertCPPMode((function(){o._defaultChannelClient.clearMessages(e,s,n)}),"clearMessages",n)},e.prototype.getMessage=function(e,s){var n=this;t.assert("callback",s,t.AssertRules.CALLBACK),this.assertCPPMode((function(){n._context.getMessage(e).then((function(o){var r=o.code,a=o.data;r===t.ErrorCode.SUCCESS?ne(s.onSuccess,te(a)):(n.logger.warn(t.LogTagId.O,"getMessage ->code:"+r+",messageId:"+e),oe(s.onError,r))}))}),"getMessage",s)},e.prototype.setMessageSentStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("sentStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageSentStatus ->messageId:"+e+",sentStatus:"+s),this.assertCPPMode((function(){o._context.setMessageSentStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageSentStatus ->code:"+s+",messageId:"+e),oe(n.onError,s))}))}),"setMessageSentStatus",n)},e.prototype.setMessageReceivedStatus=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("receivedStatus",s,t.AssertRules.NUMBER,!0),this.logger.info(t.LogTagId.O,"setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+s),this.assertCPPMode((function(){o._context.setMessageReceivedStatus(e,s).then((function(s){s===t.ErrorCode.SUCCESS?ne(n.onSuccess,!0):(o.logger.warn(t.LogTagId.O,"setMessageReceivedStatus ->code:"+s+",messageId:"+e),oe(n.onError,s))}))}),"setMessageReceivedStatus",n)},e.prototype.setMessageContent=function(e,s,n,o){var r=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("objectName",n,t.AssertRules.ONLY_STRING,!0),this.assertCPPMode((function(){r.logger.info(t.LogTagId.A_SET_MSG_CONTENT_O,JSON.stringify({messageId:e,objectName:n})),r._context.setMessageContent(e,s,n).then((function(e){e===t.ErrorCode.SUCCESS?ne(o.onSuccess,!0):oe(o.onError,e)}))}),"setMessageContent",o)},e.prototype.setMessageSearchField=function(e,s,n){var o=this;t.assert("messageId",e,t.AssertRules.NUMBER,!0),t.assert("searchFiles",n,t.AssertRules.STRING,!0),this.logger.info(t.LogTagId.O,"setMessageSearchField ->messageId:"+e+",searchFiles:"+n),this.assertCPPMode((function(){o._context.setMessageSearchField(e,s,n)}),"setMessageSearchField")},e.prototype.searchConversationByContent=function(e,s,n,o){var r=this;t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",n,t.AssertRules.ARRAY),t.assert("customMessageType",o,t.AssertRules.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContent(e,s,n,o)}),"searchConversationByContent",s)},e.prototype.searchConversationByContentWithAllChannel=function(e,s,n,o){var r=this;void 0===n&&(n=[]),t.assert("keyword",e,t.AssertRules.STRING,!0),t.assert("callback",s,t.AssertRules.CALLBACK),t.assert("conversationTypes",o,t.AssertRules.ARRAY),t.assert("customMessageType",n,t.AssertRules.ARRAY),this.assertCPPMode((function(){r._defaultChannelClient.searchConversationByContentWithAllChannel(e,s,n,o)}),"searchConversationByContentWithAllChannel",s)},e.prototype.searchMessageByContent=function(e,s,n,o,r,a,i){var c=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",r,t.AssertRules.NUMBER),t.assert("total",a,t.AssertRules.NUMBER),t.assert("callback",i,t.AssertRules.CALLBACK),this.assertCPPMode((function(){c._defaultChannelClient.searchMessageByContent(e,s,n,o,r,a,i)}),"searchMessageByContent",i)},e.prototype.searchMessageByContentWithAllChannel=function(e,s,n,o,r,a){var i=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("timestamp",o,t.AssertRules.NUMBER),t.assert("count",r,t.AssertRules.NUMBER),t.assert("callback",a,t.AssertRules.CALLBACK),this.assertCPPMode((function(){i._defaultChannelClient.searchMessageByContentWithAllChannel(e,s,n,o,r,a)}),"searchMessageByContentWithAllChannel",a)},e.prototype.searchMessageByContentInTimeRangeWithAllChannel=function(e,s,n,o,r,a,i,c){var g=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("keyword",n,t.AssertRules.STRING,!0),t.assert("startTime",o,t.AssertRules.NUMBER),t.assert("endTime",r,t.AssertRules.NUMBER),t.assert("offset",a,t.AssertRules.NUMBER),t.assert("limit",i,t.AssertRules.NUMBER),t.assert("callback",c,t.AssertRules.CALLBACK),this.assertCPPMode((function(){g._defaultChannelClient.searchMessageByContentInTimeRangeWithAllChannel(e,s,n,o,r,a,i,c)}),"searchMessageByContentInTimeRangeWithAllChannel",c)},e.prototype.getUnreadMentionedMessages=function(e,s){return this._isCPPMode?(t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this._defaultChannelClient.getUnreadMentionedMessages(e,s)):(this.logger.error(t.LogTagId.O,"getUnreadMentionedMessages method is not supported in a browser!"),null)},e.prototype.clearUnreadCountByTimestamp=function(e,s,n,o){var r=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),t.assert("timestamp",n,t.AssertRules.NUMBER,!0),this.assertCPPMode((function(){r._defaultChannelClient.clearUnreadCountByTimestamp(e,s,n,o)}),"clearUnreadCountByTimestamp",o)},e.prototype.getFirstUnreadMessage=function(e,t,s){return this._defaultChannelClient.getFirstUnreadMessage(e,t,s)},e.prototype.getConversationNotificationStatus=function(e,s,n){var o=this;t.assert("conversationType",e,t.AssertRules.NUMBER,!0),t.assert("targetId",s,t.AssertRules.STRING,!0),this.assertCPPMode((function(){o._defaultChannelClient.getConversationNotificationStatus(e,s,n)}),"getConversationNotificationStatus",n)},e.prototype.getServerTime=function(){return this._context.getServerTime()},e.prototype.getGroupMessageDeliverList=function(e,t,s){this._defaultChannelClient.getGroupMessageDeliverList(e,t,s)},e.prototype.getPrivateMessageDeliverTime=function(e,t){this._defaultChannelClient.getPrivateMessageDeliverTime(e,t)},e}(),Ce=1;t.VersionManage.add("imlib-v2-adapter","5.9.6");var he,pe,fe=null,Ie={init:function(e,s,n){var o;void 0===n&&(n={}),t.assert("appkey",e,t.AssertRules.STRING,!0);var r=(null===(o=n.__runtimeCreator__)||void 0===o?void 0:o.call(n))||Q;he=new t.AppStorage(r,"API-V2"),ce=t.APIContext.init(r,{appkey:e,navigators:n.navi?[n.navi]:[],miniCMPProxy:[],logOutputLevel:n.logOutputLevel,typingExpireTime:n.typingExpireTime,httpInMainProcess:!!n.httpInMainProcess,logExpireTime:n.logExpireTime}),(fe=ce.createLogger("RC-IM","IM")).setOutputLevel(n.logOutputLevel),fe.info(t.LogTagId.A_INIT_O,JSON.stringify({appkey:e,navigators:n.navi?[n.navi]:[],typingExpireTime:n.typingExpireTime})),Ce=Math.min(15,Math.max(n.readReceiptTimeout||1,1)),ie=new le(ce,{readReceiptTimeout:Ce},fe,he),t.logger.init(fe)},getInstance:function(){return ie},setConnectionStatusListener:function(e){throw new Error("Please use `onConnectionStatusChange()` instead of `setConnectionStatusListener()`")},onConnectionStatusChange:function(e){ce.assignWatcher({connection:function(s,n){try{e.onChanged(s,n)}catch(e){null==fe||fe.error(t.LogTagId.A_CALLBACK_E,"onConnectionStatusChange -> "+e.stack)}}})},setOnReceiveMessageListener:function(e){ce.assignWatcher({message:function(s,n,o){try{var r=te(s),a=ce.getCurrentUserId(),i=ce.getConnectedTime();se(r,a,i,Ce,he),r=function(e,t,s,n,o){var r=new Date(s-1e3*n*60*60*24).getTime()-e.sentTime<0;if("ReadReceiptResponseMessage"!==e.messageType||!r)return e;var a=e.content,i=((a=a||{}).receiptMessageDic||{})[t],c="",g={};if(e.receiptResponse=e.receiptResponse||{},i){for(var u=[],d=0;d<i.length;d++)c=""+t+i[d]+"SENT",(g=o.get(c))&&!(e.senderUserId in g.userIds)&&(u.push(i[d]),g.count+=1,g.userIds[e.senderUserId]=e.sentTime,e.receiptResponse[i[d]]=g.count,o.set(c,g));a.receiptMessageDic[t]=u,e.content=a}return e}(r,a,i,Ce,he),t.usingCppEngine()||X.set(s),e.onReceived(r,void 0,o)}catch(e){null==fe||fe.error(t.LogTagId.A_CALLBACK_E,"setOnReceiveMessageListener -> "+e.stack)}}})},setConversationStatusListener:function(e){ce.assignWatcher({conversationState:function(s){try{var n=[];s.forEach((function(e){var t=e.updatedItems,s=e.conversationType,o=e.targetId,r=e.channelId,a=(t=t||{}).notificationStatus,i=t.isTop;a&&i&&n.push({notificationStatus:a.val,isTop:i.val,conversationType:s,targetId:o,channelId:r||"",updatedTime:a.time})})),n.length>0&&e.onChanged(n)}catch(e){null==fe||fe.error(t.LogTagId.O,"setConversationStatusListener ->error:"+e)}}})},setMessageExpansionListener:function(e){ce.assignWatcher({expansion:function(s){try{s.updatedExpansion&&e.onUpdated(s.updatedExpansion),s.deletedExpansion&&e.onDeleted(s.deletedExpansion)}catch(e){null==fe||fe.error(t.LogTagId.O,"setMessageExpansionListener ->error:"+e)}}})},setTagListener:function(e){ce.assignWatcher({tag:function(){try{e.onChanged()}catch(e){null==fe||fe.error(t.LogTagId.O,"setTagListener ->error:"+e)}}})},setConversationTagListener:function(e){ce.assignWatcher({conversationTagChanged:function(){try{e.onChanged()}catch(e){null==fe||fe.error(t.LogTagId.O,"setConversationTagListener ->error:"+e)}}})},setPullOffLineFinished:function(e){ce.assignWatcher({pullFinished:function(){try{e.onFinished()}catch(e){null==fe||fe.error(t.LogTagId.O,"setPullOffLineFinished ->error:"+e)}}})},setTypingStatusListener:function(e){ce.assignWatcher({typingState:function(s){try{e.onChanged(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setTypingStatusListener ->error:"+e)}}})},setMessageBlockedListener:function(e){ce.assignWatcher({messageBlocked:function(t){e.onReceived(t)}})},setChatRoomStatusListener:function(e){ce.assignWatcher({chatroomState:function(t){e.onChanged(t)}})},setMessageDeliveredListener:function(e){ce.assignWatcher({messageDelivered:function(s){try{e.onDelivered(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setMessageDeliveredListener ->error:"+e)}}})},setGroupMessageDeliveredStatusListener:function(e){ce.assignWatcher({groupMessageDeliveredStatus:function(s){try{e.onDelivered(s)}catch(e){null==fe||fe.error(t.LogTagId.O,"setGroupMessageDeliveredStatusListener ->error:"+e)}}})},connect:function(e,s,n){return a(this,void 0,void 0,(function(){var o,r,a;return i(this,(function(i){switch(i.label){case 0:return o=null==fe?void 0:fe.createTraceId(),null==fe||fe.info(t.LogTagId.A_CONNECT_T,JSON.stringify({token:e,reconnectKickEnable:!1}),o),[4,ce.connect(e,!!n,o)];case 1:return r=i.sent(),a=r.code===t.ErrorCode.SUCCESS?"info":"warn",null==fe||fe[a](t.LogTagId.A_CONNECT_R,JSON.stringify({code:r.code,userId:r.userId}),o),r.code===t.ErrorCode.SUCCESS?(s.onSuccess(r.userId),c=new Date(ce.getConnectedTime()-1e3*Ce*60*60*24).getTime(),he.getKeys().forEach((function(e){if(/SENT$/.test(e)){var t=he.get(e).dealtime;t&&c-t>0&&he.remove(e)}else if(/RECEIVED$/.test(e)){var s=he.get(e),n=Object.keys(s).length;Object.keys(s).forEach((function(e){var t=s[e].dealtime;t&&c-t>0&&delete s[e]})),Object.keys(s).length!==n&&(0===s.length?he.remove(e):he.set(e,s))}}))):r.code===t.ErrorCode.RC_CONN_TOKEN_INCORRECT?(null==fe||fe.warn(t.LogTagId.O,"connect ->code:"+r.code+",token:"+e),s.onTokenIncorrect()):(null==fe||fe.warn(t.LogTagId.O,"connect ->code:"+r.code+",token:"+e),s.onError(r.code)),[2]}var c}))}))},reconnect:function(e,s,n){var o=null==fe?void 0:fe.createTraceId();null==fe||fe.info(t.LogTagId.A_RECONNECT_T,null,o),ce.reconnect(n).then((function(s){var n=s.code===t.ErrorCode.SUCCESS?"info":"warn";null==fe||fe[n](t.LogTagId.A_RECONNECT_R,JSON.stringify({code:s.code,userId:s.userId}),o),s.code===t.ErrorCode.SUCCESS?e.onSuccess(s.userId):(null==fe||fe.warn(t.LogTagId.O,"reconnect ->code:"+s.code),e.onError(s.code))})).catch((function(t){e.onError(t)}))},RegisterMessage:{},RegisterMessageTypeMapping:Z,getMessageObjectName:function(e){var t=r(r({},$),Z);return Object.keys(t).find((function(s){return t[s]===e}))||e},registerMessageType:function(e,t,s,n){this.RegisterMessage[e]=ae(e,t,s.isPersited,s.isCounted),this.RegisterMessageTypeMapping[t]=e,ce.registerMessageType(t,s.isPersited,s.isCounted,n)}},Re=function(e,t,s){this.type=e,this.userIdList=t,this.mentionedContent=s},Te=function(e,t){this.isCounted=e,this.isPersited=t},Se=ae("TextMessage","RC:TxtMsg"),ve=ae("LocationMessage","RC:LBSMsg"),me=ae("TypingStatusMessage","RC:TypSts"),ye=ae("ImageMessage","RC:ImgMsg"),Ee=ae("RichContentMessage","RC:ImgTextMsg"),Me=ae("VoiceMessage","RC:VcMsg"),Ae=ae("HQVoiceMessage","RC:HQVCMsg"),Le=ae("FileMessage","RC:FileMsg"),Ne=ae("SightMessage","RC:SightMsg"),Oe=ae("GIFMessage","RC:GIFMsg"),Ue=ae("ReadReceiptMessage","RC:ReadNtf"),_e=ae("ReadReceiptRequestMessage","RC:RRReqMsg"),Be=ae("RCCombineMessage","RC:CombineMsg"),xe=function(e,t,s,n,o,r,a,i,c,g,u,d,l,C,h,p,f,I){this.conversationType=e,this.targetId=t,this.senderUserId=s,this.content=n,this.objectName=o,this.messageType=r,this.messageId=a,this.messageUId=i,this.messageDirection=c,this.offLineMessage=g,this.sentStatus=u,this.sentTime=d,this.receivedStatus=l,this.receivedTime=C,this.canIncludeExpansion=h,this.expansion=p,this.receiptResponse=f,this.disableNotification=I};exports.VoIPMediaType=void 0,(pe=exports.VoIPMediaType||(exports.VoIPMediaType={}))[pe.MEDIA_AUDIO=1]="MEDIA_AUDIO",pe[pe.MEDIA_VEDIO=2]="MEDIA_VEDIO",pe[pe.MEDIA_VIDEO=2]="MEDIA_VIDEO";var we,Pe=ae("AcceptMessage","RC:VCAccept"),ke=ae("RingingMessage","RC:VCRinging"),be=ae("SummaryMessage","RC:VCSummary"),Ge=ae("HungupMessage","RC:VCHangup"),De=ae("InviteMessage","RC:VCInvite"),Ke=ae("MediaModifyMessage","RC:VCModifyMedia"),Fe=ae("MemberModifyMessage","RC:VCModifyMem"),je=ae("lastMessageSendTime","RC:SRSMsg"),He=ae("ReferenceMessage","RC:ReferenceMsg"),We=ae("PublicServiceRichContentMessage","RC:PSImgTxtMsg"),Ve=ae("PublicServiceMultiRichContentMessage","RC:PSMultiImgTxtMsg");!function(e){e[e.ALL=1]="ALL",e[e.PART=2]="PART"}(we||(we={}));var Je=we;window&&(window.RongIMClient=Ie),Object.defineProperty(exports,"AreaCode",{enumerable:!0,get:function(){return t.AreaCode}}),Object.defineProperty(exports,"ChatroomEntryType",{enumerable:!0,get:function(){return t.ChatroomEntryType}}),Object.defineProperty(exports,"ChatroomSyncStatusReason",{enumerable:!0,get:function(){return t.ChatroomSyncStatusReason}}),Object.defineProperty(exports,"ChatroomUserChangeType",{enumerable:!0,get:function(){return t.ChatroomUserChangeType}}),Object.defineProperty(exports,"ChrmMemBanType",{enumerable:!0,get:function(){return t.ChrmMemBanType}}),Object.defineProperty(exports,"ChrmMemOperateType",{enumerable:!0,get:function(){return t.ChrmMemOperateType}}),Object.defineProperty(exports,"ChrmSyncStatus",{enumerable:!0,get:function(){return t.ChrmSyncStatus}}),Object.defineProperty(exports,"ConnectionStatus",{enumerable:!0,get:function(){return t.ConnectionStatus}}),Object.defineProperty(exports,"ConversationType",{enumerable:!0,get:function(){return t.ConversationType}}),Object.defineProperty(exports,"ErrorCode",{enumerable:!0,get:function(){return t.ErrorCode}}),Object.defineProperty(exports,"FileType",{enumerable:!0,get:function(){return t.FileType}}),Object.defineProperty(exports,"LogL",{enumerable:!0,get:function(){return t.LogL}}),Object.defineProperty(exports,"LogLevel",{enumerable:!0,get:function(){return t.LogLevel}}),Object.defineProperty(exports,"LogSource",{enumerable:!0,get:function(){return t.LogSource}}),Object.defineProperty(exports,"LogTagId",{enumerable:!0,get:function(){return t.LogTagId}}),Object.defineProperty(exports,"MessageBlockType",{enumerable:!0,get:function(){return t.MessageBlockType}}),Object.defineProperty(exports,"MessageDirection",{enumerable:!0,get:function(){return t.MessageDirection}}),Object.defineProperty(exports,"NotificationStatus",{enumerable:!0,get:function(){return t.NotificationStatus}}),Object.defineProperty(exports,"RCConnectionStatus",{enumerable:!0,get:function(){return t.RCConnectionStatus}}),Object.defineProperty(exports,"RTCApiType",{enumerable:!0,get:function(){return t.RTCApiType}}),Object.defineProperty(exports,"RTCMode",{enumerable:!0,get:function(){return t.RTCMode}}),Object.defineProperty(exports,"ReceivedStatus",{enumerable:!0,get:function(){return t.ReceivedStatus}}),Object.defineProperty(exports,"UploadMethod",{enumerable:!0,get:function(){return t.UploadMethod}}),Object.defineProperty(exports,"logger",{enumerable:!0,get:function(){return t.logger}}),exports.AcceptMessage=Pe,exports.BaseMessage=re,exports.ChannelClient=ue,exports.ConnectionState={ACCEPTED:0,UNACCEPTABLE_PROTOCOL_VERSION:1,IDENTIFIER_REJECTED:2,SERVER_UNAVAILABLE:3,TOKEN_INCORRECT:4,NOT_AUTHORIZED:5,REDIRECT:6,PACKAGE_ERROR:7,APP_BLOCK_OR_DELETE:8,BLOCK:9,TOKEN_EXPIRE:10,DEVICE_ERROR:11,HOSTNAME_ERROR:12,HASOHTERSAMECLIENTONLINE:13,OUT_OF_LIMIT:14,IN_OTHER_CLUSTER:15,APP_AUTH_NOT_PASS:16,OTP_USED:17,PLATFORM_ERROR:18,USER_LOGOUT:19,ACCOUNT_CANCELLATION:19,LICENSE_EXPIRED:20},exports.FileMessage=Le,exports.GIFMessage=Oe,exports.GetChatRoomType=o,exports.HQVoiceMessage=Ae,exports.HungupMessage=Ge,exports.IMClient=le,exports.ImageMessage=ye,exports.InviteMessage=De,exports.LocationMessage=ve,exports.MediaModifyMessage=Ke,exports.MemberModifyMessage=Fe,exports.MentionedInfo=Re,exports.MentionedType=Je,exports.Message=xe,exports.MessageTag=Te,exports.PublicServiceMultiRichContentMessage=Ve,exports.PublicServiceRichContentMessage=We,exports.RCCombineMessage=Be,exports.ReadReceiptMessage=Ue,exports.ReadReceiptRequestMessage=_e,exports.ReadReceiptResponseMessage=ge,exports.ReferenceMessage=He,exports.RichContentMessage=Ee,exports.RingingMessage=ke,exports.RongIMClient=Ie,exports.SentStatus=n,exports.SightMessage=Ne,exports.SummaryMessage=be,exports.SyncReadStatusMessage=je,exports.TextMessage=Se,exports.TypingStatusMessage=me,exports.VoiceMessage=Me;
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.9.5",
13
+ "version": "5.9.6",
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.9.5"
24
+ "@rongcloud/engine": "=5.9.6"
25
25
  }
26
26
  }