@rongcloud/imlib-next 5.2.1 → 5.2.2
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/dist/index.esm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -12,4 +12,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
12
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var y=function(e,t){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},y(e,t)};var R=function(){return R=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},R.apply(this,arguments)};function N(e,t,n,o){return new(n||(n=Promise))((function(a,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function i(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}c((o=o.apply(e,t||[])).next())}))}function U(e,t){var n,o,a,r,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(r){return function(i){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(a=2&r[0]?o.return:r[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,r[1])).done)return a;switch(o=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){s.label=r[1];break}if(6===r[0]&&s.label<a[1]){s.label=a[1],a=r;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(r);break}a[2]&&s.ops.pop(),s.trys.pop();continue}r=t.call(e,s)}catch(e){r=[6,e],o=0}finally{n=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,i])}}}var O=new e("RCIM"),M=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},_=M();var w,A={tag:"browser",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,r=e.headers,s=e.query,i=e.body,c=a(e.url,s);return new Promise((function(e){var o,a=(o="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&o?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),s="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(t,c),r&&a.setRequestHeader)for(var d in r)a.setRequestHeader(d,r[d]);if(s){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var u="object"==typeof i?JSON.stringify(i):i;a.send(u)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){return e({status:a.status||0})}),n),a.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||O.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:_,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close(e,t)}}},createDataChannel:function(e,o){return this.isSupportSocket()&&"websocket"===o?new t(this,e):new n(this,e)}},x=M(),b=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){O.error(e)}}},P={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},L={tag:"wechat",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,s=e.headers,i=e.query,c=e.body,d=a(e.url,i);return new Promise((function(e){wx.request({url:d,method:t,headers:s,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:P,sessionStorage:P,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:x,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},G=M(),D=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return my[e].apply(my,t)}catch(e){O.error(e)}}},k={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},H={tag:"alipay",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,s=e.headers,i=e.query,c=e.body,d=a(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:t,headers:s,timeout:n,data:c,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:k,sessionStorage:k,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:G,createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},B=M(),F=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("tt",tt),tt[e].apply(tt,t)}catch(e){O.error(e)}}},q={setItem:F("setStorageSync"),getItem:F("getStorageSync"),removeItem:F("removeStorageSync"),clear:F("clearStorageSync")},V={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:B,localStorage:q,sessionStorage:q,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},z=M(),K=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("swan",swan),swan[e].apply(swan,t)}catch(e){O.error(e)}}},X={setItem:K("setStorageSync"),getItem:K("getStorageSync"),removeItem:K("removeStorageSync"),clear:K("clearStorageSync")},j={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:z,localStorage:X,sessionStorage:X,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},J=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){O.error(e)}}},W={setItem:J("setStorageSync"),getItem:J("getStorageSync"),removeItem:J("removeStorageSync"),clear:J("clearStorageSync")},Y={tag:"uniapp",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,s=e.headers,i=e.query,c=e.body,d=a(e.url,i);return new Promise((function(e){uni.request({url:d,method:t,headers:s,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:W,sessionStorage:W,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},Q=function(e){return e&&e.canIUse&&e.getSystemInfo},$="undefined"!=typeof uni&&Q(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return Y;case"mp-baidu":return j;case"mp-toutiao":return V;case"mp-alipay":return H;case"mp-weixin":return L;default:return A}}():"undefined"!=typeof wx&&Q(wx)?L:"undefined"!=typeof my&&Q(my)?H:"undefined"!=typeof tt&&Q(tt)?V:"undefined"!=typeof swan&&Q(swan)?j:A;function Z(e){var t=e.conversationType,n=e.channelId,o=e.messageType,a=e.content,r=e.senderUserId,c=e.targetId,d=e.sentTime,u=e.receivedTime,l=e.messageUId,g=e.messageDirection,f=e.isPersited,m=e.isCounted,p=e.isOffLineMessage,h=e.canIncludeExpansion,v=e.expansion,I=e.receivedStatus,S=e.disableNotification,C=e.isMentioned,T=e.isStatusMessage,E=e.readReceiptInfo,y=e.pushConfig,R=e.messageId,N=e.isInterrupt,U=e.isModifyMessage;I||(I=i.UNREAD);var O={messageType:o,channelId:n||"",content:a,senderUserId:r,targetId:c,conversationType:t,sentTime:d,receivedTime:u,messageUId:l,messageDirection:g,isPersited:f,isCounted:m,isMentioned:C,disableNotification:S,isStatusMessage:T,canIncludeExpansion:h,expansion:v,receivedStatus:I,readReceiptInfo:E,pushConfig:y,messageId:R,isInterrupt:N,isModifyMessage:U};return t!==s.ULTRA_GROUP&&(O.isOffLineMessage=p),O}!function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",e.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",e.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",e.CONVERSATION="CONVERSATION",e.CHATROOM="CHATROOM",e.EXPANSION="EXPANSION",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.TAG="TAG",e.CONVERSATION_TAG="CONVERSATION_TAG",e.TYPING_STATUS="TYPING_STATUS",e.MESSAGE_BLOCKED="MESSAGE_BLOCKED",e.ULTRA_GROUP_ENABLE="ULTRA_GROUP_ENABLE",e.OPERATE_STATUS="OPERATE_STATUS",e.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED="ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED",e.ULTRA_GROUP_MESSAGE_MODIFIED="ULTRA_GROUP_MESSAGE_MODIFIED",e.ULTRA_GROUP_MESSAGE_RECALLED="ULTRA_GROUP_MESSAGE_RECALLED"}(w||(w={}));var ee,te=function(e){function t(n){var o=e.call(this)||this;if(t.imClient)return O.error("Please do not repeatedly perform the init method"),t.imClient;c("options.navigators",n.navigators,(function(e){return d(e)&&(0===e.length||e.every(u))}));var a=null==n?void 0:n.connectType;return a?l.WEBSOCKET!==a&&l.COMET!==a&&(O.warn("RongIMLib connectionType must be "+l.WEBSOCKET+" or "+l.COMET),a=l.WEBSOCKET):a=l.WEBSOCKET,o._context=g.init($,{appkey:n.appkey,apiVersion:"5.2.1",navigators:n.navigators||[],miniCMPProxy:n.customCMP||[],connectionType:a,logLevel:n.logLevel,logStdout:n.logStdout,indexDBSwitch:n.indexDBSwitch,checkCA:n.checkCA}),o.watch(),t.imClient=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,t={onConnecting:function(){e.emit(w.CONNECTING)},onConnected:function(){e.emit(w.CONNECTED)},onDisconnect:function(t){e.emit(w.DISCONNECT,t)},onSuspend:function(t){e.emit(w.SUSPEND,t)},batchMessage:function(t){e.emit(w.MESSAGES,{messages:t.map((function(e){return Z(e)}))})},typingState:function(t){e.emit(w.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,o){e.emit(w.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:o})},messageReceiptRequest:function(t,n,o){e.emit(w.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n,senderUserId:o})},messageReceiptResponse:function(t,n,o){e.emit(w.MESSAGE_RECEIPT_RESPONSE,{conversation:t,receivedUserId:n,messageUIdList:o})},conversationState:function(t){var n=t.map((function(e){var t=e.conversationType;return t===s.ULTRA_GROUP?{conversation:{conversationType:t,latestMessage:e.latestMessage?Z(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,unreadMentionedCount:e.unreadMentionedCount,versionTime:e.versionTime,notificationStatus:e.notificationStatus,lastUnreadTime:e.lastUnreadTime,channelId:e.channelId}}:{conversation:{conversationType:t,latestMessage:e.latestMessage?Z(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,hasMentioned:e.hasMentioned,mentionedInfo:e.mentionedInfo,lastUnreadTime:e.lastUnreadTime,notificationStatus:e.notificationStatus,isTop:e.isTop,channelId:e.channelId,unreadMentionedCount:e.unreadMentionedCount},updatedItems:e.updatedItems}}));e.emit(w.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(w.CHATROOM,t)},expansion:function(t){e.emit(w.EXPANSION,t)},pullFinished:function(){e.emit(w.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(w.TAG)},conversationTagChanged:function(){e.emit(w.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(w.MESSAGE_BLOCKED,t)},ultraGroupEnable:function(t){e.emit(w.ULTRA_GROUP_ENABLE,t)},operateStatus:function(t){e.emit(w.OPERATE_STATUS,t)},ultraGroupMessageExpansionUpdated:function(t){e.emit(w.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED,t)},ultraGroupMessageModified:function(t){e.emit(w.ULTRA_GROUP_MESSAGE_MODIFIED,t)},ultraGroupMessageRecalled:function(t){e.emit(w.ULTRA_GROUP_MESSAGE_RECALLED,t)}};this.context.assignWatcher(t)},t}(f),ne={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:r.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},oe={},ae={};for(var re in ne){var se=ne[re],ie=se.code;oe[ie]=re,ae[ie]=se}ne.ROAMING_SERVICE_UNAVAILABLE.code;var ce=function(e){ee=ee||new te(e)};function de(e,t){return null==ee?void 0:ee.context.install(e,t)}function ue(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("token",e,p.STRING,!0),O.warn("RongIMLib Version: 5.2.1, Commit: 5f3d7b5af1e6e31d4545ef0973b990837060617b"),[4,ee.context.connect(e,!1,t)];case 1:return(n=o.sent()).code===r.SUCCESS?[2,{code:n.code,data:{userId:n.userId}}]:[2,{code:n.code,msg:oe[n.code]}]}}))}))}function le(){return ee.context.disconnect()}function ge(){return ee.context.getConnectionStatus()}function fe(){return ee.context.getServerTime()}function me(){return ee.context.getCurrentUserId()}function pe(e,t,n){ee.on(e,t,n)}function he(e,t,n){ee.once(e,t,n)}function ve(e,t,n){ee.off(e,t,n)}function Ie(e){ee.removeAll(e)}function Se(){ee.clear()}function Ce(e,t){m.add(e,t)}function Te(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return O.debug("get conversation list ->"),[4,te.imClient.context.getConversationList(null==e?void 0:e.count,void 0,null==e?void 0:e.startTime,null==e?void 0:e.order,t)];case 1:return n=i.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?(s=a.map((function(e){return function(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,a=e.unreadMessageCount,r=e.hasMentioned,s=e.mentionedInfo,i=e.lastUnreadTime,c=e.notificationStatus,d=e.isTop,u=e.channelId,l=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&Z(o),unreadMessageCount:a,hasMentioned:r,mentionedInfo:r?{type:null==s?void 0:s.type,userIdList:null==s?void 0:s.userIdList}:void 0,lastUnreadTime:i,notificationStatus:c,isTop:d,channelId:u,unreadMentionedCount:l}}(e)})),[2,{code:0,data:s}]):(O.warn("get conversation list fail ->"+o+":"+oe[o]),[2,{code:o,msg:oe[o]}])}}))}))}function Ee(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.removeConversation(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("destroy conversation ->"+n),t!==r.SUCCESS?(O.warn("destroy conversation fail ->"+t+":"+oe[t]+","+n),[2,{code:t,msg:oe[t]}]):[2,{code:t}]}}))}))}function ye(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return U(this,(function(s){switch(s.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.getConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return t=s.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get draft ->"+a),n===r.SUCCESS?[2,{code:n,data:o||""}]:(O.warn("get draft fail ->"+n+":"+oe[n]+","+a),[2,{code:n,msg:oe[n]}])}}))}))}function Re(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("draft",t,p.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set draft ->"+n),[4,te.imClient.context.saveConversationMessageDraft(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(O.warn("set draft fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}])}}))}))}function Ne(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),t="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("delete draft ->"+t),[4,te.imClient.context.clearConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("delete draft fail ->"+n+":"+oe[n]+","+t),[2,{code:n,msg:oe[n]}])}}))}))}function Ue(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d;return U(this,(function(u){switch(u.label){case 0:if(O.debug("get total unread count -> ConversationType:"+JSON.stringify(t)+" includeMuted:"+e),c("includeMuted",e,p.BOOLEAN,!1),c("conversationTypes",t,p.ARRAY,!1),t)for(n=0,o=t;n<o.length;n++)a=o[n],c("conversationType",a,h);return[4,te.imClient.context.getTotalUnreadCount("",t,e)];case 1:return s=u.sent(),i=s.code,d=s.data,i===r.SUCCESS?[2,{code:i,data:d}]:(O.warn("getTotalUnreadCount fail ->"+i+":"+oe[i]),[2,{code:i,msg:oe[i]}])}}))}))}function Oe(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return U(this,(function(s){switch(s.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.getUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=s.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get unreadCount ->"+a),n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("get unreadCount fail ->"+n+":"+oe[n]+","+a),[2,{code:n,msg:oe[n]}])}}))}))}function Me(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.clearUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("clear unreadMsgNum ->"+n),t!==r.SUCCESS?(O.warn("clear unreadMsgNum fail ->"+t+":"+oe[t]+","+n),[2,{code:t,msg:oe[t]}]):[2,{code:t}]}}))}))}function _e(){return N(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,te.imClient.context.clearAllUnreadCount()];case 1:return[2,{code:e.sent()}]}}))}))}function we(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("notificationStatus",t,(function(e){return 1===e||2===e}),!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set conversation status ->"+n),[4,te.imClient.context.setConversationStatus(e.conversationType,e.targetId,void 0,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set conversation status fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Ae(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),O.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.getConversationNotificationStatus(e.conversationType,e.targetId,e.channelId)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("getConversationNotificationStatus ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function xe(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function be(e,t){return void 0===t&&(t=!0),N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.type",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set conversation status ->"+n),[4,te.imClient.context.setConversationStatus(e.conversationType,e.targetId,t,void 0,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set conversation status fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Pe(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function Le(e){return N(this,void 0,void 0,(function(){return U(this,(function(t){return c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),O.debug("getUnreadMentionedCount"+e.targetId+",channelId:"+e.channelId),[2,te.imClient.context.getUnreadMentionedCount(e)]}))}))}function Ge(){return N(this,void 0,void 0,(function(){return U(this,(function(e){return O.debug("getAllUnreadMentionedCount"),[2,te.imClient.context.getAllUnreadMentionedCount()]}))}))}function De(){return N(this,void 0,void 0,(function(){return U(this,(function(e){return[2,te.imClient.context.getAllConversationState()]}))}))}function ke(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getUltraGroupList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("get ultragroup ->"+t+":"+oe[t]),[2,{code:t,msg:oe[t]}])}}))}))}function He(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getBlockUltraGroupList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("get block ultragroup ->"+t+":"+oe[t]),[2,{code:t,msg:oe[t]}])}}))}))}function Be(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("options.conversationType",e.conversationType,h,!0),[4,te.imClient.context.sendUltraGroupTypingStatus(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("send ultraGroup OperateStatus ->"+t+":"+oe[t]),[2,{code:t,msg:oe[t]}])}}))}))}function Fe(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l;return U(this,(function(g){switch(g.label){case 0:return c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("options.conversationType",e.conversationType,h,!0),c("msgs",t,p.ARRAY,!0),n=e.targetId,o=e.conversationType,a=e.channelId,s=[],t.forEach((function(e){var t=e.sendTime,n=e.messageUId;s.push({sendTime:t,messageUId:n,channelId:a})})),i={targetId:n,conversationType:o,messages:s},[4,te.imClient.context.getUltraGroupMessageListByMessageUId(i)];case 1:return d=g.sent(),u=d.code,l=d.data,u===r.SUCCESS?[2,{code:r.SUCCESS,data:l}]:(O.warn("get UltraGroup MessageList by messageUId ->"+u+":"+oe[u]),[2,{code:u,msg:oe[u]}])}}))}))}function qe(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l,g;return U(this,(function(f){switch(f.label){case 0:return c("expansion",e,p.OBJECT,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.sentTime,i=t.canIncludeExpansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",channelId:"+d+",messageUId:"+a,O.debug("update expansion for ultragroup message ->"+u),l={targetId:o,channelId:d,conversationType:n,sendTime:s,canIncludeExpansion:i,messageUId:a,expansion:e},[4,te.imClient.context.expandUltraMessage(l)];case 1:return(g=f.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("update expansion for ultragroup message ->"+g+":"+oe[g]),[2,{code:g,msg:oe[g]}])}}))}))}function Ve(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l,g;return U(this,(function(f){switch(f.label){case 0:return c("expansion",e,p.ARRAY,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.sentTime,i=t.canIncludeExpansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",channelId:"+d+",messageUId:"+a,O.debug("remove expansion for ultragroup message ->"+u),l={targetId:o,channelId:d,conversationType:n,sendTime:s,canIncludeExpansion:i,messageUId:a,keys:e},[4,te.imClient.context.expandUltraMessage(l)];case 1:return(g=f.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("remove expansion for ultraGroup message ->"+g+":"+oe[g]),[2,{code:g,msg:oe[g]}])}}))}))}function ze(e){return N(this,void 0,void 0,(function(){var t,n,o,a,s,i,d,u,l;return U(this,(function(g){switch(g.label){case 0:return c("message",e,p.OBJECT,!0),t=e.conversationType,n=e.targetId,o=e.messageUId,a=e.sentTime,s=e.canIncludeExpansion,i=e.channelId,d="conversationType:"+t+",targetId:"+n+",channelId:"+i+",messageUId:"+o,O.debug("remove all expansion for ultraGroup message ->"+d),u={targetId:n,channelId:i,conversationType:t,sendTime:a,canIncludeExpansion:s,messageUId:o,removeAll:!0},[4,te.imClient.context.expandUltraMessage(u)];case 1:return(l=g.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("remove all expansion for ultraGroup message ->"+l+":"+oe[l]),[2,{code:l,msg:oe[l]}])}}))}))}function Ke(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l,g,f;return U(this,(function(m){switch(m.label){case 0:return c("content",e,p.OBJECT,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.senderUserId,i=t.sentTime,d=t.canIncludeExpansion,u=t.channelId,l="conversationType:"+n+",targetId:"+o+",channelId:"+u+",messageUId:"+a,O.debug("update ultragroup message expansion ->"+l),g={targetId:o,channelId:u,conversationType:n,fromUserId:s,sendTime:i,canIncludeExpansion:d,messageUId:a,content:e},[4,te.imClient.context.modifyMessage(g)];case 1:return(f=m.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("modify ultraGroup message ->"+f+":"+oe[f]),[2,{code:f,msg:oe[f]}])}}))}))}function Xe(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return c("cotargetIdntent",e,p.STRING,!0),O.debug("get UltraGroup unreadMentionedCount by targetId:"+e),[4,te.imClient.context.getUltraGroupUnreadMentionedCountByTargetId(e)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:r.SUCCESS,data:o}]:(O.warn("get UltraGroup unreadMentionedCount by targetId error ->"+n+":"+oe[n]),[2,{code:n,msg:oe[n]}])}}))}))}var je=function(e){c("options.key",e.key,p.STRING,!0),c("options.value",e.value,p.STRING,!0),c("options.isAutoDelete",e.isAutoDelete,p.BOOLEAN),c("options.isSendNotification",e.isSendNotification,p.BOOLEAN),c("options.notificationExtra",e.notificationExtra,p.STRING)},Je=function(e){c("options.key",e.key,p.STRING,!0),c("options.isSendNotification",e.isSendNotification,p.BOOLEAN),c("options.notificationExtra",e.notificationExtra,p.STRING)};function We(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.count",t.count,p.NUMBER,!0),n="id:"+e,O.debug("join chatroom ->"+n),[4,te.imClient.context.joinChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("join chatroom fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Ye(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.count",t.count,p.NUMBER,!0),n="id:"+e,O.debug("join exist chatroom ->"+n),[4,te.imClient.context.joinExistChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("join exist chatroom fail ->code:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Qe(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return t="id:"+e,O.debug("quit chatroom ->"+t),[4,te.imClient.context.quitChatroom(e)];case 1:return(n=o.sent())!==r.SUCCESS?(O.warn("quit chatroom fail ->code+:"+oe[n]+","+t),[2,{code:n,msg:oe[n]}]):[2,{code:n}]}}))}))}function $e(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("options.count",t.count,p.NUMBER),c("options.order",t.order,(function(e){return[0,1,2].includes(e)})),n="id:"+e,O.debug("get chatroom info ->"+n),[4,te.imClient.context.getChatroomInfo(e,t.count,t.order)];case 1:return o=i.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?[2,{code:a,data:s}]:(O.warn("get chatroom info fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function Ze(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),je(t),n="id:"+e,O.debug("set chatroom entry->"+n),[4,te.imClient.context.setChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function et(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("targetId",e,p.STRING,!0),function(e){e.entries.forEach((function(e){c("entry.key",e.key,p.STRING,!0),c("entry.value",e.value,p.STRING,!0)})),c("options.isAutoDelete",e.isAutoDelete,p.BOOLEAN),c("options.notificationExtra",e.notificationExtra,p.STRING)}(t),t.entries.length>10?[2,ne.CHATROOM_KV_STORE_OUT_LIMIT]:(n="id:"+e,O.debug("set chatroom entry->"+n),[4,te.imClient.context.setChatroomEntries(e,t)]);case 1:return o=i.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(O.warn("set chatroom entry fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a],data:s}]):[2,{code:a}]}}))}))}function nt(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),je(t),n="id:"+e,O.debug("force set chatroom entry ->"+n),[4,te.imClient.context.forceSetChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("force set chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function ot(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),Je(t),n="id:"+e,O.debug("remove chatroom entry->"+n),[4,te.imClient.context.removeChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("remove chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function at(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("targetId",e,p.STRING,!0),function(e){e.entries.forEach((function(e){c("key",e,p.STRING,!0)})),c("options.notificationExtra",e.notificationExtra,p.STRING)}(t),n="id:"+e,O.debug("remove chatroom entry->"+n),(o=Object.assign({},t)).entries=t.entries.map((function(e){return{key:e}})),[4,te.imClient.context.removeChatroomEntries(e,o)];case 1:return a=d.sent(),s=a.code,i=a.data,s!==r.SUCCESS?(O.warn("remove chatroom entry fail ->code+:"+oe[s]+","+n),[2,{code:s,msg:oe[s],data:i}]):[2,{code:s}]}}))}))}function rt(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),Je(t),n="id:"+e,O.debug("force remove chatroom entry ->"+n),[4,te.imClient.context.forceRemoveChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("force remove chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function st(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("key",t,(function(e){return v(e)&&/[\w+=-]+/.test(e)&&e.length<=128}),!0),n="id:"+e,O.debug("get chatroom entry->"+n),[4,te.imClient.context.getChatroomEntry(e,t)];case 1:return o=i.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?[2,{code:a,data:s}]:(O.warn("get chatroom entry fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function it(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return U(this,(function(s){switch(s.label){case 0:return t="id:"+e,O.debug("get all chatroom entries->"+t),[4,te.imClient.context.getAllChatroomEntries(e)];case 1:return n=s.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?[2,{code:o,data:a}]:(O.warn("get all chatroom entries fail ->code+:"+oe[o]+","+t),[2,{code:o,msg:oe[o]}])}}))}))}function ct(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.timestamp",t.timestamp,p.NUMBER),c("options.count",t.count,p.NUMBER),c("options.order",t.order,(function(e){return 0===e||1===e})),n="id:"+e,O.debug("get chatroom history message->"+n),[4,te.imClient.context.getChatRoomHistoryMessages(e,t.count,t.order,t.timestamp)];case 1:return o=d.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?(i=s.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:i,hasMore:!!s.hasMore}}]):(O.warn("get chatroom history message fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function dt(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return[4,te.imClient.context.bindRTCRoomForChatroom(e)];case 1:return[2,{code:t=n.sent(),msg:oe[t]}]}}))}))}var ut=function(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=o};function lt(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new ut(e,o,t,n)}}var gt,ft,mt=lt("RC:ImgMsg"),pt=lt("RC:HQVCMsg"),ht=lt("RC:SightMsg"),vt=lt("RC:TxtMsg"),It=lt("RC:CombineMsg"),St=lt("RC:FileMsg"),Ct=lt("RC:GIFMsg"),Tt=lt("RC:VcMsg"),Et=lt("RC:LBSMsg"),yt=lt("RC:ReferenceMsg"),Rt=lt("RC:ImgTextMsg"),Nt={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=_t()+Ut[0][1]||r,Ut.shift();var s=new XMLHttpRequest;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});s.onreadystatechange=function(){if(4===s.readyState){var a=s.responseText||"{}";(a=JSON.parse(a)).filename=t.uniqueValue,a.uploadMethod=I?I.QINIU:"",200===s.status?n.onCompleted(a):Ut.length?Nt[Ut[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";Mt(t,(function(e,t){"token"!==e&&(n+=(n?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t))})),n&&(e+=(e.indexOf("?")>0?"&":"?")+n);return e}(a+="/mkblk/"+e.size,t.multi_parmas));s.open(t.method,a,!0),n.onOpen(s),t.stream&&s.setRequestHeader("authorization","UpToken "+t.multi_parmas.token);Mt(t.headers,(function(e,t){s.setRequestHeader(e,t)})),s.send(e)},baidu:function(e,t,n,o){if(console.log(o,t),o.size>Ot)throw new Error("the file size is over 5GB!");var a=t||{};t=t||ft;var r=new XMLHttpRequest,s=_t();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var i=s+Ut[0][1]+a.bosUploadPath;Ut.shift();var c=a.bosHeader||{},d={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:i,isBosRes:!0};r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).filename=t.uniqueValue,200===r.status){n.onCompleted(d,!0)}else Ut.length?Nt[Ut[0][0]](e,t,n,o):n.onError("upload fail")}},r.open(t.method,i,!0),r.setRequestHeader("authorization",c.bosToken),r.setRequestHeader("x-bce-date",c.bosDate),r.send(o)},aliyun:function(e,t,n,o){if(o.size>Ot)throw new Error("the file size is over 5GB!");const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token"));const r=Ut[0][1];Ut.shift(),e=e||gt,t=(t=t||{})||ft;var s=new XMLHttpRequest,i=_t()+t.ossBucketName+"."+r;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});s.onreadystatechange=function(){if(4===s.readyState){var e=s.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=I?I.ALI:"",200===s.status?n.onCompleted(e):Ut.length?Nt[Ut[0][0]](a,t,n,o):n.onError("upload fail")}},s.open(t.method,i,!0),console.log("ali:url",i);var c=t.aliHeader||{};e.set("OSSAccessKeyId",c.osskeyId),e.set("policy",c.ossPolicy),e.set("Signature",c.ossSign),e.set("success_action_status",200),e.delete("key"),e.append("key",t.uploadFileName),e.delete("file"),e.append("file",o),s.send(e)},s3:function(e,t,n,o){var a=new FormData,r=new XMLHttpRequest,s=_t();const i=Ut[0][1];var c=s+t.s3BucketName+"."+i;console.log("uploadS3:url",c),Ut.shift(),r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).name=t.uniqueValue,a.filename=t.uploadFileName,a.uploadMethod=I.AWS,console.log("UploadMethod:",I),200===r.status||204===r.status)n.onCompleted(a);else if(Ut.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),Nt[Ut[0][0]](a,t,n,o)}else n.onError("upload fail")}},r.open(t.method,c,!0);var d=t?t.s3Header:{},u=o&&o.type;"text/html"===u?a.set("Content-Disposition","inline;"):a.set("Content-Disposition","attachment;");a.set("Content-Type",u),a.set("x-amz-credential",d.s3Credential),a.set("x-amz-algorithm",d.s3Algorithm),a.set("x-amz-date",d.s3Date),a.set("policy",d.s3Policy),a.set("x-amz-signature",d.s3Signature),a.set("key",t.uploadFileName),a.set("file",o),r.send(a)},stc:function(e,t,n,o){new FormData;var a=new XMLHttpRequest;_t();var r="https://"+Ut[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;Ut.shift(),a.upload&&t.support_options&&(a.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});a.onreadystatechange=function(){if(4===a.readyState){var r=a.responseText||"{}";if((r=JSON.parse(r)).name=t.uniqueValue,r.filename=t.uploadFileName,r.uploadMethod=I?I.STC:"",200===a.status||204===a.status)n.onCompleted(r);else if(Ut.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),Nt[Ut[0][0]](a,t,n,o)}else n.onError("upload fail")}},a.open("PUT",r,!0);var s=t?t.stcHeader:{};a.setRequestHeader("Content-Type",o.type),"text/html"===o.type?a.setRequestHeader("Content-Disposition","inline;"):a.setRequestHeader("Content-Disposition","attachment;");a.setRequestHeader("Authorization",s.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",s.stcContentSha256),a.setRequestHeader("x-amz-date",s.stcDate),a.send(o)}},Ut=[],Ot=5368709120;function Mt(e,t){for(var n in e)t(n,e[n])}function _t(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function wt(e,t,n){var o,a,r=e&&e.type||"text/plain",s=r.indexOf("image")>-1?1:4,i=Math.ceil(e.size/t.stc_chunk_size),c=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(c)||(c=[]);var d=c.find((e=>Object.keys(e).includes("stc"))),u="uploads";te.imClient.getFileToken(s,o,"POST",u).then((function(e){o=e.fileName,a="https://"+d.stc+"/"+t.stcBucketName+"/"+o,console.log("uploadStcMultipart:url",a);var s=new XMLHttpRequest;s.open("POST",a+"?"+u,!0),"text/html"===r?s.setRequestHeader("Content-Disposition","inline;"):s.setRequestHeader("Content-Disposition","attacshment;"),s.setRequestHeader("Authorization",e&&e.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),s.setRequestHeader("x-amz-date",e&&e.stcDate),s.setRequestHeader("Content-Type",r),s.send(),s.onreadystatechange=function(e){if(4===s.readyState){var t=s.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===s.status||204===s.status?function(e){for(var t=[],n=1;n<=i;n++)t.push(m(e,n));f(e,t)}(Array.isArray(t)&&t[1]):n.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){n.onError("uploadStcMultipart:"+e)}));var l=[],g=new Map;function f(c,d){d&&Array.isArray(d)&&0!==d.length&&Promise.all(d).then((()=>{var d="uploadId="+c;if(g.size===i)te.imClient.context.getFileToken(s,o,"POST",d).then((function(o){console.log("onSuccess",o),console.log("onSuccess:uploadId",c);var s=new XMLHttpRequest;s.open("POST",a+"?"+d,!0),s.setRequestHeader("Authorization",o&&o.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",o&&o.stcContentSha256),s.setRequestHeader("x-amz-date",o&&o.stcDate),s.setRequestHeader("Content-Type",r);var i="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",u=Array.from(g.keys()||[]).sort(((e,t)=>e-t));console.log("keys",u),u.map((e=>{i+=`<Part><ETag>${g.get(e)}</ETag><PartNumber>${e}</PartNumber></Part>`})),i+="</CompleteMultipartUpload>",s.send(i),console.log("xml",i),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var o={};o.name=e.name,o.filename=t.uploadFileName,o.uploadMethod=I.STC,n.onCompleted(o)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var u=[];for(var p of l)u.push(m(c,p));f(c,u)}}),(e=>{console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t=[];for(var o of l)t.push(m(c,o));f(c,t)}))}function m(n,i){return new Promise(((c,d)=>{var u="partNumber="+i+"&uploadId="+n;te.imClient.context.getFileToken(s,o,"PUT",u).then((function(n){console.log("signature "+i+" onSuccess",n);var o=e&&e.slice((i-1)*t.stc_chunk_size,i*t.stc_chunk_size);console.log("fileChunk:size",o.size);var s=new XMLHttpRequest;s.open("PUT",a+"?"+u,!0),s.setRequestHeader("Authorization",n&&n.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),s.setRequestHeader("x-amz-date",n&&n.stcDate),s.setRequestHeader("Content-Type",r),s.send(o),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var e=s.getResponseHeader("etag");console.log("etag:"+i,e),g.set(i,e),c(e)}else l.includes(i)||l.push(i),d(i)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(i)||l.push(i),d(i)}))}))}}var At={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=xt()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),bt(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=xt()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,bt(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function xt(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function bt(e,t){for(var n in e)t(n,e[n])}var Pt,Lt=0;function Gt(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:At.form,genUId:xt};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e),this.setOptions=function(e){var t=this;bt(e,(function(e,n){t.options[e]=n}))},console.log("options",e),this.upload=function(e,t){if(e){var n=this;!function(e,t,n){if(gt=e,ft=t,Ut=[],t.ossConfig){const e=JSON.parse(t.ossConfig);let n,o,a="";const r=[];e.forEach((e=>{const t=Number(e.p)-1;for(const s in e)"aliyun"===s&&(a=e[s]),"s3"===s&&(n=e[s]),"stc"===s&&(o=e[s]),"p"!==s&&(r[t]=[s,e[s]])})),r.forEach((function(e){e&&Ut.push(e)})),e.length!==Ut.length&&(Ut=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else Ut=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];var o;if(t.ossConfig){var a=t&&JSON.parse(t.ossConfig);Array.isArray(a)||(a=[]),o=a.find((e=>Object.keys(e).includes("stc")))}if(o&&1===parseInt(o.p)&&e.size>=4194304)wt(e,t,n);else{var r=t.data(e,t);Nt[Ut[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Pt=e,o){Pt=Lt+e/n*(n-Lt)}else Lt=Pt;t.onProgress(Pt,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var Dt={init:function(e){return new Gt(e)},dataType:At,resize:function(e,t,n){e.type;var o=document.createElement("canvas"),a=new FileReader;a.readAsDataURL(e),a.onload=function(e){var a=e.target.result,r=new Image;r.src=a;var s=r.width,i=r.height,c=function(e,t){var n=1,o=e.width,a=t.maxWidth||0;a>0&&o>a&&(n=a/o);var r=e.height,s=t.maxHeight||0;if(s>0&&r>s){var i=s/r;n=Math.min(n,i)}var c=t.maxSize||0,d=Math.ceil(e.size/1e3);if(d>c){var u=c/d;n=Math.min(n,u)}return n}({width:s,height:i,size:e.total},t),d=a;c<1&&(d=function(e,t,n){o.width=t,o.height=n,o.getContext("2d").drawImage(e,0,0,t,n);var a="image/jpg";return o.toDataURL(a)}(r,s*c,i*c)),n(d)}}};const kt=function(e,t,n){var o=document.createElement("canvas"),a=o.getContext("2d"),r=new Image;r.onload=function(){var s=function(e,t,n){var o,a,r,s=e<t,i=0,c=0;return(s?t/e:e/t)>n.scale?(s?(a=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,i=((a=e/(o=t/100))-n.maxWidth)/2),{w:a,h:r,x:-i,y:-c}):(s?(o=t/n.maxHeight,r=n.maxHeight,a=e/o):(o=e/n.maxWidth,a=n.maxWidth,r=t/o),{w:a,h:r,x:-i,y:-c})}(r.width,r.height,t);o.width=s.w>t.maxWidth?t.maxWidth:s.w,o.height=s.h>t.maxHeight?t.maxHeight:s.h,a.drawImage(r,s.x,s.y,s.w,s.h);try{var i=o.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");i=i.replace(c,""),n(i)}catch(e){throw new Error(e)}},r.src="string"==typeof e?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)},Ht=function(e,t){var n=e.file,o=e.compress;kt(n,o,t)},Bt=function(e,t){if(e.getToken)e.getToken((function(n,o){o=o||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=o.bos,e.ossConfig=o.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=o.bosDate,e.bosHeader.bosToken=o.bosToken,e.bosUploadPath=o.path,e.aliHeader={},e.aliHeader.osskeyId=o.osskeyId,e.aliHeader.ossPolicy=o.ossPolicy,e.aliHeader.ossSign=o.ossSign,e.ossBucketName=o.ossBucketName,e.uploadFileName=o.fileName,e.s3Header={},e.s3Header.s3Credential=o.s3Credential,e.s3Header.s3Algorithm=o.s3Algorithm,e.s3Header.s3Date=o.s3Date,e.s3Header.s3Policy=o.s3Policy,e.s3Header.s3Signature=o.s3Signature,e.s3BucketName=o.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=o.stcAuthorization,e.stcHeader.stcContentSha256=o.stcContentSha256,e.stcHeader.stcDate=o.stcDate,e.stcBucketName=o.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n),console.log("data",o);var a=Dt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Dt.init(e);t(n)}};var Ft,qt,Vt=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var o=e.compressThumbnail||Ht;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},zt=function(e){var t=this;this.instance=e,this.upload=function(e,n){Vt({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},Kt=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};Vt(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Xt=function(e,t){Bt(e,(function(n){var o={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},a=new Kt(n,o);t(a)}))},jt=function(e,t){Bt(e,(function(e){var n=new zt(e);t(n)}))},Jt=Xt;Dt.dataType;function Wt(e){return Ft=Ft||new AudioContext,new Promise((function(t,n){Ft.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Yt(e,t,n,o){return new Promise((function(a){te.imClient.context.getFileToken(e,t,n,o).then((function(e){a({code:r.SUCCESS,data:e})})).catch((function(e){a({code:e,msg:oe[e]})}))}))}function Qt(e,t,n,o,a){return c("fileType",e,C,!0),c("filename",t,p.STRING),c("saveName",n,p.STRING),c("serverType",a,p.NUMBER),new Promise((function(s){te.imClient.context.getFileUrl(e,t,n,o,a).then((function(e){s({code:r.SUCCESS,data:e})})).catch((function(e){s({code:e})}))}))}function $t(e,t,n){return N(this,void 0,void 0,(function(){var o,a,d,u,l,g,f,m,h,v;return U(this,(function(I){switch(I.label){case 0:return n=n||{},t instanceof ut==!1?(O.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,ne.ILLGAL_PARAMS]):(c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),o=e.conversationType,a=e.targetId,d=e.channelId,u="conversationType:"+o+",targetId:"+a,O.debug("send message ->"+u),(l=Object.assign(n,t)).channelId=d||"",[4,te.imClient.context.sendMessage(o,a,l)]);case 1:return g=I.sent(),f=g.code,m=g.data,f===r.SUCCESS?(h=Z(m),[2,{code:f,data:h}]):(O.warn("send message fail ->"+f+":"+oe[f]+","+u),v={isMentioned:!!n.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(null==n?void 0:n.disableNotification),canIncludeExpansion:!!(null==n?void 0:n.canIncludeExpansion),expansion:(null==n?void 0:n.expansion)||null,conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,senderUserId:te.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:E.SEND,sentTime:(null==m?void 0:m.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD,isOffLineMessage:!1},o!==s.ULTRA_GROUP&&(v.isOffLineMessage=!1),[2,{code:f,msg:oe[f],data:Z(v)}])}}))}))}function Zt(e,t,n){return $t(e,new vt(t),n)}function en(e,t){return function(n,o,a,s){return new Promise((function(i){var c;!function(e,t,n,o){var a,r=this;if(void 0===t&&(t=S.FILE),a=t===S.IMAGE?S.IMAGE:S.FILE,!qt){qt="upload.qiniup.com";var s=te.imClient.context.getInfoFromCache();if(s&&s.ossConfig)try{var i=JSON.parse(s.ossConfig).find((function(e){return void 0!==e.qiniu}));i&&(qt=i.qiniu)}catch(e){}}var c=R({domain:qt,getToken:function(e){te.imClient.context.getFileToken(a).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},o);(a===S.IMAGE?Jt:jt)(c,(function(o){o.upload(e,{onProgress:function(e,t){var o,a=Math.floor(e/t*100);null===(o=n.onProgress)||void 0===o||o.call(n,a)},onCompleted:function(o){return N(r,void 0,void 0,(function(){var r=this;return U(this,(function(s){return Qt(a,o.filename,o.name,o,o.uploadMethod).then((function(s){return N(r,void 0,void 0,(function(){var r,i;return U(this,(function(c){return 0!==s.code?(n.onFail(s),[2]):((r=s.data).type=e.type,r.name=o.name||o.filename,t===S.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Wt).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):((i=new FileReader).onload=function(){i.result?Wt(i.result).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):n.onSuccess(r)},i.onerror=function(){r.duration=0,n.onSuccess(r)},i.readAsArrayBuffer(e)),[2]):(a===S.IMAGE&&(r.thumbnail=o.thumbnail),n.onSuccess(r),[2]))}))}))})).catch((function(e){n.onFail(e)})),[2]}))}))},onError:function(e){n.onFail(e)}})}))}(o.file,e,{onProgress:null==a?void 0:a.onProgress,onSuccess:function(e){var r,c=(null===(r=null==a?void 0:a.onComplete)||void 0===r?void 0:r.call(a,{url:e.downloadUrl}))||t(e,o);$t(n,c,s).then(i)},onFail:function(e){i({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}},(null===(c=s)||void 0===c?void 0:c.thumbnailConfig)||{})}))}}var tn=en(S.FILE,(function(e,t){return new St({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),nn=en(S.IMAGE,(function(e,t){return new mt({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),on=en(S.AUDIO,(function(e,t){return new pt({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),an=en(S.SIGHT,(function(e,t){return new ht({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})}));function rn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.timestamp",null==t?void 0:t.timestamp,p.NUMBER),c("options.count",null==t?void 0:t.count,p.NUMBER),c("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get history message ->"+n),[4,te.imClient.context.getHistoryMessage(e.conversationType,e.targetId,null==t?void 0:t.timestamp,null==t?void 0:t.count,null==t?void 0:t.order,null==e?void 0:e.channelId)];case 1:return o=d.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?(i=s.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:i,hasMore:s.hasMore}}]):(O.warn("get history message fail ->"+a+":"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function sn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.timestamp",null==t?void 0:t.timestamp,p.NUMBER),c("options.count",null==t?void 0:t.count,p.NUMBER),c("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get history message ->"+n),[4,te.imClient.context.getRemoteHistoryMessages(e.conversationType,e.targetId,(null==t?void 0:t.timestamp)||0,(null==t?void 0:t.count)||20,(null==t?void 0:t.order)||0,e.channelId||"")];case 1:return o=d.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?(i=s.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:i,hasMore:s.hasMore}}]):(O.warn("get history message fail ->"+a+":"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function cn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,r,i,c,d;return U(this,(function(u){switch(u.label){case 0:return a={targetId:e,conversationType:s.PRIVATE,channelId:o},r=new ut("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,$t(a,r)];case 1:return i=u.sent(),c=i.code,d=i.msg,0===c?[2,{code:c}]:[2,{code:c,msg:d}]}}))}))}function dn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,r,i,d;return U(this,(function(u){switch(u.label){case 0:return c("messageUId",t,p.STRING,!0),c("channelId",n,p.CHANNEL_ID),o="messageUId:"+t+",targetId:"+e,O.debug("send read receipt message ->"+o),a=new ut("RC:RRReqMsg",{messageUId:t}),[4,$t({targetId:e,conversationType:s.GROUP,channelId:n},a)];case 1:return r=u.sent(),i=r.code,d=r.msg,0===i?[2,{code:i}]:[2,{code:i,msg:d}]}}))}))}function un(e,t,n){return N(this,void 0,void 0,(function(){return U(this,(function(e){throw new Error("This method is deprecated, please use method sendReadReceiptResponseV2.")}))}))}function ln(e,t,n){return N(this,void 0,void 0,(function(){var o,a,i,d,u,l,g;return U(this,(function(f){switch(f.label){case 0:return c("targetId",e,p.STRING,!0),c("messageList",t,p.OBJECT,!0),c("channelId",n,p.CHANNEL_ID),Object.keys(t).forEach((function(e){c(e,t[e],p.ARRAY)})),o={targetId:e,conversationType:s.GROUP,channelId:n},i=te.imClient.context.getInfoFromCache(),0!==(d=(null==i?void 0:i.grpRRVer)||0)?[3,2]:(u=new ut("RC:RRRspMsg",{receiptMessageDic:t}),[4,$t(o,u)]);case 1:return a=f.sent(),[3,4];case 2:return 1!==d?[3,4]:(l=[],Object.keys(t).forEach((function(e){t[e].forEach((function(e){-1===l.indexOf(e)&&l.push(e)}))})),l.length?[4,te.imClient.context.sendReadReceiptMessage(e,l,n)]:(O.warn("Error in parameter messageList."),[2,{code:r.PARAMETER_ERROR}]));case 3:a=f.sent(),f.label=4;case 4:return(g=a.code)===r.SUCCESS?[2,{code:g}]:(O.warn("send read receipt message fail ->"+g+":"+oe[g]),[2,{code:g,msg:oe[g]}])}}))}))}function gn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,r;return U(this,(function(s){switch(s.label){case 0:return c("conversation.type",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("lastMessageSendTime",t,p.NUMBER,!0),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n=new ut("RC:SRSMsg",{lastMessageSendTime:t}),[4,$t(e,n)];case 1:return o=s.sent(),a=o.code,r=o.msg,0===a?[2,{code:a}]:[2,{code:a,msg:r}]}}))}))}function fn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.messageUId",t.messageUId,p.STRING,!0),c("options.sentTime",t.sentTime,p.NUMBER,!0),c("options.disableNotification",null==t?void 0:t.disableNotification,p.BOOLEAN),c("options.pushConfig",null==t?void 0:t.pushConfig,p.OBJECT),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n={user:t.user,channelId:e.channelId||"",disableNotification:null==t?void 0:t.disableNotification,pushConfig:null==t?void 0:t.pushConfig},o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+t.messageUId,O.debug("recall message ->"+o),[4,te.imClient.context.recallMessage(e.conversationType,e.targetId,t.messageUId,t.sentTime,n)];case 1:return a=d.sent(),s=a.code,i=a.data,s===r.SUCCESS&&i?[2,{code:s,data:Z(i)}]:s===r.SUCCESS?[2,{code:s}]:(O.warn("recall message fail ->"+s+":"+oe[s]+","+o),[2,{code:s,msg:oe[s]}])}}))}))}function mn(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options",t,(function(e){return d(e)&&e.length}),!0),t.forEach((function(e){c("options.messageUId",e.messageUId,p.STRING,!0),c("options.sentTime",e.sentTime,p.NUMBER,!0),c("options.messageDirection",e.messageDirection,(function(e){return 1===e||2===e}),!0)})),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("delete messages ->"+n),[4,te.imClient.context.deleteRemoteMessage(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("delete message fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:r.SUCCESS}]}}))}))}function pn(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.timestamp",t,p.NUMBER,!0),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("clear message ->"+n),[4,te.imClient.context.deleteRemoteMessageByTimestamp(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("clear message ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:r.SUCCESS}]}}))}))}function hn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l;return U(this,(function(g){switch(g.label){case 0:return c("expansion",e,p.OBJECT,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.canIncludeExpansion,i=t.expansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",messageUId:"+a,O.debug("update message expansion ->"+u),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,expansion:e,canIncludeExpansion:s,originExpansion:i,channelId:d})];case 1:return(l=g.sent().code)!==r.SUCCESS?(O.warn("update message expansion fail ->"+l+":"+oe[l]+","+u),[2,{code:l,msg:oe[l]}]):[2,{code:l}]}}))}))}function vn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u;return U(this,(function(l){switch(l.label){case 0:return c("keys",e,p.ARRAY,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.canIncludeExpansion,i=t.channelId,d="conversationType:"+n+",targetId:"+o+",messageUId:"+a,O.debug("remove message expansion ->"+d),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:s,keys:e,channelId:i})];case 1:return(u=l.sent().code)!==r.SUCCESS?(O.warn("remove message expansion fail ->"+u+":"+oe[u]+","+d),[2,{code:u,msg:oe[u]}]):[2,{code:u}]}}))}))}function In(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("typingContentType",t,p.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("send typing status message ->"+n),o={messageType:"RC:TypSts",content:{typingContentType:t},isStatusMessage:!0,channelId:e.channelId},[4,te.imClient.context.sendMessage(e.conversationType,e.targetId,o)];case 1:return a=d.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:Z(i)}]:(O.warn("send typing status message fail ->"+s+":"+oe[s]+","+n),[2,{code:s,msg:oe[s]}])}}))}))}function Sn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("messageUId",t,p.STRING,!0),o="messageUId:"+t+",targetId:"+e,O.debug("get message reader ->"+o),[4,te.imClient.context.getMessageReader(e,t,n)];case 1:return a=d.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:i}]:(O.warn("get message reader fail ->"+s+":"+oe[s]+","+o),[2,{code:s,msg:oe[s]}])}}))}))}function Cn(e,t,n,o,a){return c("messageType",e,p.STRING,!0),c("isPersited",t,p.BOOLEAN,!0),c("isCounted",n,p.BOOLEAN,!0),c("isStatusMessage",a,p.BOOLEAN,!1),te.imClient.context.registerMessageType(e,t,n,o,a),lt(e,t,n)}function Tn(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return T()?(c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),[4,te.imClient.context.getFirstUnreadMessage(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("insertMessage ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function En(e,t,n){return void 0===n&&(n={}),N(this,void 0,void 0,(function(){var o,a,s,i,c,d,u,l,g,f,m,p,h,v,I,S;return U(this,(function(C){switch(C.label){case 0:return T()?(o=t.senderUserId,a=t.messageType,s=t.content,i=t.messageDirection,c=t.messageUId,d=t.canIncludeExpansion,u=t.expansion,l=t.disableNotification,g=t.sentTime,f=t.sentStatus,O.info("insertMessage ->targetId:"+e.targetId+",conversationType:"+e.conversationType),m=n.isUnread,p=n.searchContent,h={senderUserId:o,messageType:a,content:s,messageDirection:i,sentTime:g,sentStatus:f,searchContent:p,isUnread:m,messageUId:c,disableNotification:l,canIncludeExpansion:d,expansionMsg:JSON.stringify(u),channelId:e.channelId||""},[4,te.imClient.context.insertMessage(e.conversationType,e.targetId,h)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return v=C.sent(),I=v.code,S=v.data,I===r.SUCCESS?[2,{code:I,data:Z(S)}]:(O.warn("insertMessage ->code:"+I+",targetId:"+e.targetId),[2,{code:I,msg:oe[I]}])}}))}))}function yn(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return T()?[4,te.imClient.context.getMessage(e)]:[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:Z(o)}]:(O.warn("getMessage ->code:"+n+",messageId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Rn(e){if(!T())return{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]};c("conversationType",e.conversationType,p.NUMBER,!0),c("targetId",e.targetId,p.STRING,!0);var t=te.imClient.context.getUnreadMentionedMessages(e.conversationType,e.targetId),n=[];return t&&t.length&&t.forEach((function(e){return n.push(Z(e))})),{code:r.SUCCESS,data:n}}function Nn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,s,i,d;return U(this,(function(u){switch(u.label){case 0:return T()?(c("conversationType",e.conversationType,p.NUMBER,!0),c("targetId",e.targetId,p.STRING,!0),c("keyword",t,p.STRING,!0),c("timestamp",n,p.NUMBER),c("count",o,p.NUMBER),1,[4,te.imClient.context.searchMessageByContent(e.conversationType,e.targetId,t,n,o,1,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return a=u.sent(),s=a.code,i=a.data,s===r.SUCCESS?(d=[],(null==i?void 0:i.messages)&&i.messages.length&&i.messages.forEach((function(e){return d.push(Z(e))})),[2,{code:s,data:{messages:d,count:null==i?void 0:i.count}}]):(O.warn("searchMessages ->code:"+s+",targetId:"+e.targetId),[2,{code:s,msg:oe[s]}])}}))}))}function Un(e,t,n){return N(this,void 0,void 0,(function(){var o;return U(this,(function(a){switch(a.label){case 0:return T()?(c("conversationType",e.conversationType,p.NUMBER,!0),c("targetId",e.targetId,p.STRING,!0),c("timestamp",t,p.NUMBER,!0),c("cleanSpace",n,p.BOOLEAN),[4,te.imClient.context.deleteMessagesByTimestamp(e.conversationType,e.targetId,t,n,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(O.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+e.targetId),[2,{code:o,msg:oe[o]}])}}))}))}function On(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return T()?(O.info("clearMessages ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.clearMessages(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(t=n.sent())===r.SUCCESS?[2,{code:t}]:(O.warn("clearMessages ->code:"+t+",targetId:"+e.targetId),[2,{code:t,msg:oe[t]}])}}))}))}function Mn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,s,i;return U(this,(function(c){switch(c.label){case 0:return T()?(O.info("searchConversationByContent ->keyword:"+e),[4,te.imClient.context.searchConversationByContent(e,n,o,t)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return a=c.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:i}]:(O.warn("searchConversationByContent ->code:"+s+",keyword:"+e),[2,{code:s,msg:oe[s]}])}}))}))}function _n(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return T()?(O.info("clearUnreadCountByTimestamp ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.clearUnreadCountByTimestamp(e.conversationType,e.targetId,t,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("clearUnreadCountByTimestamp ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function wn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return T()?(c("messageId",e,p.NUMBER,!0),c("receivedStatus",t,p.NUMBER,!0),O.info("setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),[4,te.imClient.context.setMessageReceivedStatus(e,t)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("setMessageReceivedStatus ->code:"+n+",messageId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function An(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("tag.tagId",e.tagId,p.STRING,!0),c("tag.tagId",e.tagId,(function(e){return e.length<=10})),c("tag.tagName",e.tagName,(function(e){return e.length<=15})),c("tag.tagName",e.tagName,p.STRING,!0),O.info("createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,te.imClient.context.createTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("createTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:oe[t]}])}}))}))}function xn(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("tagId",e,p.STRING,!0),O.info("removeTag ->tagId:"+e),[4,te.imClient.context.removeTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("removeTag ->code:"+t+",tagId:"+e),[2,{code:t,msg:oe[t]}])}}))}))}function bn(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("tag.tagId",e.tagId,p.STRING,!0),c("tag.tagName",e.tagName,p.STRING,!0),c("tag.tagName",e.tagName,(function(e){return e.length<=15})),O.info("updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,te.imClient.context.updateTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("updateTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:oe[t]}])}}))}))}function Pn(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getTagList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("getTagList ->code:"+t),[2,{code:t,msg:oe[t]}])}}))}))}function Ln(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return c("conversationType",e.conversationType,p.NUMBER),c("targetId",e.targetId,p.STRING),c("channelId",e.channelId,p.CHANNEL_ID),O.info("getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.getTagsForConversation(e)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:[2,{code:n,msg:oe[n]}]}}))}))}function Gn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("tagId",e,p.STRING,!0),c("conversations",t,p.ARRAY,!0),t.forEach((function(e){c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID)})),O.info("addTagForConversations ->tagId:"+e),[4,te.imClient.context.addTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("addTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Dn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("tagId",e,p.STRING,!0),c("conversations",t,p.ARRAY,!0),t.forEach((function(e){c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID)})),O.info("removeTagForConversations ->tagId:"+e),[4,te.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function kn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID),c("tagIds",t,p.ARRAY,!0),t.forEach((function(e){c("tagId",e,p.STRING,!0)})),O.info("removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.removeTagsForConversation(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagsForConversation ->code:"+n+",tagIds:"+t),[2,{code:n,msg:oe[n]}])}}))}))}function Hn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("tagId",e,p.STRING,!0),c("conversations",t,p.ARRAY,!0),t.forEach((function(e){c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID)})),O.info("removeTagForConversations ->tagId:"+e),[4,te.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Bn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("tagId",e,p.STRING,!0),c("count",t,p.NUMBER,!0),c("startTime",n,p.NUMBER,!0),O.info("getConversationListByTag ->tagId:"+e),[4,te.imClient.context.getConversationListByTag(e,n,t)];case 1:return o=i.sent(),a=o.code,s=o.data,a===r.SUCCESS?[2,{code:a,data:s}]:(O.warn("getConversationListByTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:oe[a]}])}}))}))}function Fn(e,t){return N(this,void 0,void 0,(function(){var n,o,a;return U(this,(function(s){switch(s.label){case 0:return c("tagId",e,p.STRING,!0),c("containMuted",t,p.BOOLEAN,!0),O.info("getUnreadCountByTag ->tagId:"+e),[4,te.imClient.context.getUnreadCountByTag(e,t)];case 1:return n=s.sent(),o=n.code,a=n.data,O.info(o,a),o===r.SUCCESS?[2,{code:o,data:a}]:(O.warn("getUnreadCountByTag ->code:"+o+",tagId:"+e),[2,{code:o,msg:oe[o]}])}}))}))}function qn(e,t,n){return N(this,void 0,void 0,(function(){var o,a;return U(this,(function(s){switch(s.label){case 0:return c("tagId",e,p.STRING,!0),c("conversation.targetId",t.targetId,p.STRING,!0),c("conversation.conversationType",t.conversationType,p.NUMBER,!0),c("conversation.channelId",t.channelId,p.CHANNEL_ID),c("status.isTop",n,p.BOOLEAN,!0),O.info("setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",conversationType"+t.conversationType),[4,te.imClient.context.setConversationStatusInTag(e,t,{isTop:n})];case 1:return o=s.sent(),(a=o.code)===r.SUCCESS?[2,{code:a}]:(O.warn("setConversationStatusInTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:oe[a]}])}}))}))}en(S.COMBINE_HTML,(function(e,t){return new It({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var Vn={COMET:"comet",WEBSOCKET:"websocket"},zn={TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL_MESSAGE_TYPE:"RC:RcCmd"};m.add("imlib","5.2.1"),m.validEngine("5.2.1")||O.error("The current engine version '"+m.getInfo().engine+"' error,imlib required engine version at least '5.2.1'.");export{ut as BaseMessage,It as CombineMessage,Vn as ConnectType,w as Events,St as FileMessage,Ct as GIFMessage,pt as HQVoiceMessage,mt as ImageMessage,Et as LocationMessage,zn as MessageType,yt as ReferenceMessage,Rt as RichContentMessage,ht as SightMessage,vt as TextMessage,Tt as VoiceMessage,Ce as __addSDKVersion,Gn as addConversationsToTag,pe as addEventListener,An as addTag,dt as bindRTCRoomForChatroom,_e as clearAllMessagesUnreadStatus,Se as clearEventListeners,pn as clearHistoryMessages,On as clearMessages,Me as clearMessagesUnreadStatus,Ne as clearTextMessageDraft,_n as clearUnreadCountByTimestamp,ue as connect,Un as deleteLocalMessagesByTimestamp,mn as deleteMessages,le as disconnect,rt as forceRemoveChatRoomEntry,nt as forceSetChatRoomEntry,it as getAllChatRoomEntries,De as getAllConversationState,Ge as getAllUnreadMentionedCount,He as getBlockUltraGroupList,xe as getBlockedConversationList,st as getChatRoomEntry,$e as getChatRoomInfo,ct as getChatroomHistoryMessages,ge as getConnectionStatus,Te as getConversationList,Ae as getConversationNotificationStatus,Bn as getConversationsFromTagByPage,me as getCurrentUserId,Yt as getFileToken,Qt as getFileUrl,Tn as getFirstUnreadMessage,rn as getHistoryMessages,yn as getMessage,Sn as getMessageReader,sn as getRemoteHistoryMessages,fe as getServerTime,Pn as getTags,Ln as getTagsFromConversation,ye as getTextMessageDraft,Pe as getTopConversationList,Ue as getTotalUnreadCount,ke as getUltraGroupList,Fe as getUltraGroupMessageListByMessageUId,Xe as getUltraGroupUnreadMentionedCountByTargetId,Oe as getUnreadCount,Fn as getUnreadCountByTag,Le as getUnreadMentionedCount,Rn as getUnreadMentionedMessages,ce as init,En as insertMessage,de as installPlugin,We as joinChatRoom,Ye as joinExistChatRoom,Ke as modifyMessage,he as onceEventListener,Qe as quitChatRoom,fn as recallMessage,Cn as registerMessageType,ze as removeAllExpansionForUltraGroupMessage,at as removeChatRoomEntries,ot as removeChatRoomEntry,Ee as removeConversation,Dn as removeConversationsFromTag,ve as removeEventListener,Ie as removeEventListeners,Ve as removeExpansionForUltraGroupMessage,vn as removeMessageExpansionForKey,xn as removeTag,Hn as removeTagFromConversations,kn as removeTagsFromConversation,Re as saveTextMessageDraft,Mn as searchConversationByContent,Nn as searchMessages,tn as sendFileMessage,on as sendHQVoiceMessage,nn as sendImageMessage,$t as sendMessage,cn as sendReadReceiptMessage,dn as sendReadReceiptRequest,un as sendReadReceiptResponse,ln as sendReadReceiptResponseV2,an as sendSightMessage,gn as sendSyncReadStatusMessage,Zt as sendTextMessage,In as sendTypingStatusMessage,Be as sendUltraGroupTypingStatus,et as setChatRoomEntries,Ze as setChatRoomEntry,we as setConversationNotificationStatus,be as setConversationToTop,qn as setConversationToTopInTag,wn as setMessageReceivedStatus,qe as updateExpansionForUltraGroupMessage,hn as updateMessageExpansion,bn as updateTag};
|
|
15
|
+
***************************************************************************** */var y=function(e,t){return y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},y(e,t)};var R=function(){return R=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},R.apply(this,arguments)};function N(e,t,n,o){return new(n||(n=Promise))((function(a,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function i(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,i)}c((o=o.apply(e,t||[])).next())}))}function U(e,t){var n,o,a,r,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[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(r){return function(i){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,o&&(a=2&r[0]?o.return:r[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,r[1])).done)return a;switch(o=0,a&&(r=[2&r[0],a.value]),r[0]){case 0:case 1:a=r;break;case 4:return s.label++,{value:r[1],done:!1};case 5:s.label++,o=r[1],r=[0];continue;case 7:r=s.ops.pop(),s.trys.pop();continue;default:if(!(a=s.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){s=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){s.label=r[1];break}if(6===r[0]&&s.label<a[1]){s.label=a[1],a=r;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(r);break}a[2]&&s.ops.pop(),s.trys.pop();continue}r=t.call(e,s)}catch(e){r=[6,e],o=0}finally{n=a=0}if(5&r[0])throw r[1];return{value:r[0]?r[1]:void 0,done:!0}}([r,i])}}}var O=new e("RCIM"),M=function(){return!("undefined"==typeof uni||!function(e){for(var t=["canIUse","getSystemInfo"],n=0,o=t.length;n<o;n++)if(!e[t[n]])return!1;return!0}(uni))},_=M();var w,A={tag:"browser",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,r=e.headers,s=e.query,i=e.body,c=a(e.url,s);return new Promise((function(e){var o,a=(o="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,"undefined"!=typeof XMLHttpRequest&&o?new XMLHttpRequest:"undefined"!=typeof XDomainRequest?new XDomainRequest:new ActiveXObject("Microsoft.XMLHTTP")),s="[object XDomainRequest]"===Object.prototype.toString.call(a);if(a.open(t,c),r&&a.setRequestHeader)for(var d in r)a.setRequestHeader(d,r[d]);if(s){a.timeout=n,a.onload=function(){e({data:a.responseText,status:a.status||200})},a.onerror=function(){e({status:a.status||0})},a.ontimeout=function(){e({status:a.status||0})};var u="object"==typeof i?JSON.stringify(i):i;a.send(u)}else a.onreadystatechange=function(){4===a.readyState&&e({data:a.responseText,status:a.status})},a.onerror=function(){e({status:a.status||0})},setTimeout((function(){return e({status:a.status||0})}),n),a.send(i)}))},localStorage:null===window||void 0===window?void 0:window.localStorage,sessionStorage:null===window||void 0===window?void 0:window.sessionStorage,isSupportSocket:function(){var e="undefined"!=typeof WebSocket;return e||O.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:_,createWebSocket:function(e,t){var n=new WebSocket(e,t);return n.binaryType="arraybuffer",{onClose:function(e){n.onclose=function(t){var n=t.code,o=t.reason;e(n,o)}},onError:function(e){n.onerror=e},onMessage:function(e){n.onmessage=function(t){e(t.data)}},onOpen:function(e){n.onopen=e},send:function(e){n.send(e)},close:function(e,t){n.close(e,t)}}},createDataChannel:function(e,o){return this.isSupportSocket()&&"websocket"===o?new t(this,e):new n(this,e)}},x=M(),b=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){O.error(e)}}},P={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},L={tag:"wechat",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,s=e.headers,i=e.query,c=e.body,d=a(e.url,i);return new Promise((function(e){wx.request({url:d,method:t,headers:s,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:P,sessionStorage:P,isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:x,createWebSocket:function(e,t){var n=wx.connectSocket({url:e,protocols:t});return{onClose:function(e){n.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){e(t.data)}))},onOpen:function(e){n.onOpen(e)},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},G=M(),D=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return my[e].apply(my,t)}catch(e){O.error(e)}}},k={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},H={tag:"alipay",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,s=e.headers,i=e.query,c=e.body,d=a(e.url,i),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:t,headers:s,timeout:n,data:c,dataType:u,success:function(t){e({data:t.data,status:t.status})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:k,sessionStorage:k,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:G,createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},B=M(),F=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("tt",tt),tt[e].apply(tt,t)}catch(e){O.error(e)}}},q={setItem:F("setStorageSync"),getItem:F("getStorageSync"),removeItem:F("removeStorageSync"),clear:F("clearStorageSync")},V={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:B,localStorage:q,sessionStorage:q,httpReq:function(e){return new Promise((function(t,n){tt.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errMsg),n({data:e.errMsg})}})}))},createWebSocket:function(e,t){var n=tt.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},z=M(),K=function(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{return console.log("swan",swan),swan[e].apply(swan,t)}catch(e){O.error(e)}}},X={setItem:K("setStorageSync"),getItem:K("getStorageSync"),removeItem:K("removeStorageSync"),clear:K("clearStorageSync")},j={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:z,localStorage:X,sessionStorage:X,httpReq:function(e){return new Promise((function(t,n){swan.request({url:e.url,data:e.body,header:e.headers,method:e.method,success:function(e){console.log("调用成功",e.data);var n=(null==e?void 0:e.data)||{},o={data:JSON.stringify(n),status:e.statusCode};t(o)},fail:function(e){console.log("调用失败",e.errorCode),n({data:e.errorCode})}})}))},createWebSocket:function(e,t){var n=swan.connectSocket({url:e,protocols:t});return{onOpen:function(e){n.onOpen(e)},onClose:function(e){n.onClose((function(t){return e(t.code,t.reason)}))},onError:function(e){n.onError((function(t){return e(t.errMsg)}))},onMessage:function(e){n.onMessage((function(t){return e(t.data)}))},send:function(e){n.send({data:e})},close:function(e,t){n.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},J=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){O.error(e)}}},W={setItem:J("setStorageSync"),getItem:J("getStorageSync"),removeItem:J("removeStorageSync"),clear:J("clearStorageSync")},Y={tag:"uniapp",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,s=e.headers,i=e.query,c=e.body,d=a(e.url,i);return new Promise((function(e){uni.request({url:d,method:t,headers:s,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:W,sessionStorage:W,isSupportSocket:function(){return!0},useNavi:!0,connectPlatform:"",isFromUniapp:!0,createWebSocket:function(e,t){var n={complete:function(){},url:e,protocols:t},o=uni.connectSocket(n);return{onClose:function(e){o.onClose((function(t){e(t.code,t.reason)}))},onError:function(e){o.onError((function(t){e(t.errMsg)}))},onMessage:function(e){o.onMessage((function(t){e(t.data)}))},onOpen:function(e){o.onOpen(e)},send:function(e){o.send({data:e})},close:function(e,t){o.close({code:e,reason:t})}}},createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},Q=function(e){return e&&e.canIUse&&e.getSystemInfo},$="undefined"!=typeof uni&&Q(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return Y;case"mp-baidu":return j;case"mp-toutiao":return V;case"mp-alipay":return H;case"mp-weixin":return L;default:return A}}():"undefined"!=typeof my&&Q(my)?H:"undefined"!=typeof tt&&Q(tt)?V:"undefined"!=typeof swan&&Q(swan)?j:"undefined"!=typeof wx&&Q(wx)?L:A;function Z(e){var t=e.conversationType,n=e.channelId,o=e.messageType,a=e.content,r=e.senderUserId,c=e.targetId,d=e.sentTime,u=e.receivedTime,l=e.messageUId,g=e.messageDirection,f=e.isPersited,m=e.isCounted,p=e.isOffLineMessage,h=e.canIncludeExpansion,v=e.expansion,I=e.receivedStatus,S=e.disableNotification,C=e.isMentioned,T=e.isStatusMessage,E=e.readReceiptInfo,y=e.pushConfig,R=e.messageId,N=e.isInterrupt,U=e.isModifyMessage;I||(I=i.UNREAD);var O={messageType:o,channelId:n||"",content:a,senderUserId:r,targetId:c,conversationType:t,sentTime:d,receivedTime:u,messageUId:l,messageDirection:g,isPersited:f,isCounted:m,isMentioned:C,disableNotification:S,isStatusMessage:T,canIncludeExpansion:h,expansion:v,receivedStatus:I,readReceiptInfo:E,pushConfig:y,messageId:R,isInterrupt:N,isModifyMessage:U};return t!==s.ULTRA_GROUP&&(O.isOffLineMessage=p),O}!function(e){e.CONNECTING="CONNECTING",e.CONNECTED="CONNECTED",e.DISCONNECT="DISCONNECT",e.SUSPEND="SUSPEND",e.MESSAGES="MESSAGES",e.READ_RECEIPT_RECEIVED="READ_RECEIPT_RECEIVED",e.MESSAGE_RECEIPT_REQUEST="MESSAGE_RECEIPT_REQUEST",e.MESSAGE_RECEIPT_RESPONSE="MESSAGE_RECEIPT_RESPONSE",e.CONVERSATION="CONVERSATION",e.CHATROOM="CHATROOM",e.EXPANSION="EXPANSION",e.PULL_OFFLINE_MESSAGE_FINISHED="PULL_OFFLINE_MESSAGE_FINISHED",e.TAG="TAG",e.CONVERSATION_TAG="CONVERSATION_TAG",e.TYPING_STATUS="TYPING_STATUS",e.MESSAGE_BLOCKED="MESSAGE_BLOCKED",e.ULTRA_GROUP_ENABLE="ULTRA_GROUP_ENABLE",e.OPERATE_STATUS="OPERATE_STATUS",e.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED="ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED",e.ULTRA_GROUP_MESSAGE_MODIFIED="ULTRA_GROUP_MESSAGE_MODIFIED",e.ULTRA_GROUP_MESSAGE_RECALLED="ULTRA_GROUP_MESSAGE_RECALLED"}(w||(w={}));var ee,te=function(e){function t(n){var o=e.call(this)||this;if(t.imClient)return O.error("Please do not repeatedly perform the init method"),t.imClient;c("options.navigators",n.navigators,(function(e){return d(e)&&(0===e.length||e.every(u))}));var a=null==n?void 0:n.connectType;return a?l.WEBSOCKET!==a&&l.COMET!==a&&(O.warn("RongIMLib connectionType must be "+l.WEBSOCKET+" or "+l.COMET),a=l.WEBSOCKET):a=l.WEBSOCKET,o._context=g.init($,{appkey:n.appkey,apiVersion:"5.2.2",navigators:n.navigators||[],miniCMPProxy:n.customCMP||[],connectionType:a,logLevel:n.logLevel,logStdout:n.logStdout,indexDBSwitch:n.indexDBSwitch,checkCA:n.checkCA}),o.watch(),t.imClient=o,o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}y(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t.prototype,"context",{get:function(){if(!this._context)throw new Error("Please perform the init method!");return this._context},enumerable:!1,configurable:!0}),t.prototype.watch=function(){var e=this,t={onConnecting:function(){e.emit(w.CONNECTING)},onConnected:function(){e.emit(w.CONNECTED)},onDisconnect:function(t){e.emit(w.DISCONNECT,t)},onSuspend:function(t){e.emit(w.SUSPEND,t)},batchMessage:function(t){e.emit(w.MESSAGES,{messages:t.map((function(e){return Z(e)}))})},typingState:function(t){e.emit(w.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,o){e.emit(w.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:o})},messageReceiptRequest:function(t,n,o){e.emit(w.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n,senderUserId:o})},messageReceiptResponse:function(t,n,o){e.emit(w.MESSAGE_RECEIPT_RESPONSE,{conversation:t,receivedUserId:n,messageUIdList:o})},conversationState:function(t){var n=t.map((function(e){var t=e.conversationType;return t===s.ULTRA_GROUP?{conversation:{conversationType:t,latestMessage:e.latestMessage?Z(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,unreadMentionedCount:e.unreadMentionedCount,versionTime:e.versionTime,notificationStatus:e.notificationStatus,lastUnreadTime:e.lastUnreadTime,channelId:e.channelId}}:{conversation:{conversationType:t,latestMessage:e.latestMessage?Z(e.latestMessage):null,targetId:e.targetId,unreadMessageCount:e.unreadMessageCount,hasMentioned:e.hasMentioned,mentionedInfo:e.mentionedInfo,lastUnreadTime:e.lastUnreadTime,notificationStatus:e.notificationStatus,isTop:e.isTop,channelId:e.channelId,unreadMentionedCount:e.unreadMentionedCount},updatedItems:e.updatedItems}}));e.emit(w.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(w.CHATROOM,t)},expansion:function(t){e.emit(w.EXPANSION,t)},pullFinished:function(){e.emit(w.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(w.TAG)},conversationTagChanged:function(){e.emit(w.CONVERSATION_TAG)},messageBlocked:function(t){e.emit(w.MESSAGE_BLOCKED,t)},ultraGroupEnable:function(t){e.emit(w.ULTRA_GROUP_ENABLE,t)},operateStatus:function(t){e.emit(w.OPERATE_STATUS,t)},ultraGroupMessageExpansionUpdated:function(t){e.emit(w.ULTRA_GROUP_MESSAGE_EXPANSION_UPDATED,t)},ultraGroupMessageModified:function(t){e.emit(w.ULTRA_GROUP_MESSAGE_MODIFIED,t)},ultraGroupMessageRecalled:function(t){e.emit(w.ULTRA_GROUP_MESSAGE_RECALLED,t)}};this.context.assignWatcher(t)},t}(f),ne={TIMEOUT:{code:-1,msg:"Network timeout"},SDK_INTERNAL_ERROR:{code:-2,msg:"SDK internal error"},PARAMETER_ERROR:{code:-3,msg:"Please check the parameters, the {param} expected a value of {expect} but received {current}"},REJECTED_BY_BLACKLIST:{code:405,msg:"Blacklisted by the other party"},SEND_TOO_FAST:{code:20604,msg:"Sending messages too quickly"},NOT_IN_GROUP:{code:22406,msg:"Not in group"},FORBIDDEN_IN_GROUP:{code:22408,msg:"Forbbiden from speaking in the group"},NOT_IN_CHATROOM:{code:23406,msg:"Not in chatRoom"},FORBIDDEN_IN_CHATROOM:{code:23408,msg:"Forbbiden from speaking in the chatRoom"},KICKED_FROM_CHATROOM:{code:23409,msg:"Kicked out and forbbiden from joining the chatRoom"},CHATROOM_NOT_EXIST:{code:23410,msg:"ChatRoom does not exist"},CHATROOM_IS_FULL:{code:23411,msg:"ChatRoom members exceeded"},PARAMETER_INVALID_CHATROOM:{code:23412,msg:"Invalid chatRoom parameters"},ROAMING_SERVICE_UNAVAILABLE_CHATROOM:{code:23414,msg:"ChatRoom message roaming service is not open, Please go to the developer to open this service"},RECALLMESSAGE_PARAMETER_INVALID:{code:25101,msg:"Invalid recall message parameter"},ROAMING_SERVICE_UNAVAILABLE_MESSAGE:{code:25102,msg:"Single group chat roaming service is not open, Please go to the developer to open this service"},PUSHSETTING_PARAMETER_INVALID:{code:26001,msg:"Invalid push parameter"},OPERATION_BLOCKED:{code:20605,msg:"Operation is blocked"},OPERATION_NOT_SUPPORT:{code:20606,msg:"Operation is not supported"},MSG_BLOCKED_SENSITIVE_WORD:{code:21501,msg:"The sent message contains sensitive words"},REPLACED_SENSITIVE_WORD:{code:21502,msg:"Sensitive words in the message have been replaced"},NOT_CONNECTED:{code:30001,msg:"Please connect successfully first"},NAVI_REQUEST_ERROR:{code:30007,msg:"Navigation http request failed"},CMP_REQUEST_ERROR:{code:30010,msg:"CMP sniff http request failed"},CONN_APPKEY_FAKE:{code:31002,msg:"Your appkey is fake"},CONN_MINI_SERVICE_NOT_OPEN:{code:31003,msg:"Mini program service is not open, Please go to the developer to open this service"},CONN_ACK_TIMEOUT:{code:31e3,msg:"Connection ACK timeout"},CONN_TOKEN_INCORRECT:{code:31004,msg:"Your token is not valid or expired"},CONN_NOT_AUTHRORIZED:{code:31005,msg:"AppKey and Token do not match"},CONN_REDIRECTED:{code:31006,msg:"Connection redirection"},CONN_APP_BLOCKED_OR_DELETED:{code:31008,msg:"AppKey is banned or deleted"},CONN_USER_BLOCKED:{code:31009,msg:"User blocked"},CONN_DOMAIN_INCORRECT:{code:31012,msg:"Connect domain error, Please check the set security domain"},ROAMING_SERVICE_UNAVAILABLE:{code:33007,msg:"Roaming service cloud is not open, Please go to the developer to open this service"},RC_CONNECTION_EXIST:{code:34001,msg:"Connection already exists"},CHATROOM_KV_EXCEED:{code:23423,msg:"ChatRoom KV setting exceeds maximum"},CHATROOM_KV_OVERWRITE_INVALID:{code:23424,msg:"ChatRoom KV already exists"},CHATROOM_KV_STORE_NOT_OPEN:{code:23426,msg:"ChatRoom KV storage service is not open, Please go to the developer to open this service"},CHATROOM_KEY_NOT_EXIST:{code:23427,msg:"ChatRoom key does not exist"},MSG_KV_NOT_SUPPORT:{code:34008,msg:"The message cannot be extended"},SEND_MESSAGE_KV_FAIL:{code:34009,msg:"Sending RC expansion message fail"},EXPANSION_LIMIT_EXCEET:{code:34010,msg:"The message expansion size is beyond the limit"},ILLGAL_PARAMS:{code:33003,msg:"Incorrect parameters passed in while calling the interface"},UPLOAD_FILE_FAILED:{code:35020,msg:"File upload failed"},CHATROOM_KV_STORE_NOT_ALL_SUCCESS:{code:23428,msg:"Chatroom kv store not all success"},CHATROOM_KV_STORE_OUT_LIMIT:{code:23429,msg:"Chatroom kv's length is out of limit"},TAG_EXISTS:{code:33101,msg:"The tag already exists"},TAG_NOT_EXIST:{code:33100,msg:"The tag does not exist"},NOT_SUPPORT:{code:r.NOT_SUPPORT,msg:"The method is not supported in a browser!"}},oe={},ae={};for(var re in ne){var se=ne[re],ie=se.code;oe[ie]=re,ae[ie]=se}ne.ROAMING_SERVICE_UNAVAILABLE.code;var ce=function(e){ee=ee||new te(e)};function de(e,t){return null==ee?void 0:ee.context.install(e,t)}function ue(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("token",e,p.STRING,!0),O.warn("RongIMLib Version: 5.2.2, Commit: d991446842981f34601cc384035e8d77fa7b6e41"),[4,ee.context.connect(e,!1,t)];case 1:return(n=o.sent()).code===r.SUCCESS?[2,{code:n.code,data:{userId:n.userId}}]:[2,{code:n.code,msg:oe[n.code]}]}}))}))}function le(){return ee.context.disconnect()}function ge(){return ee.context.getConnectionStatus()}function fe(){return ee.context.getServerTime()}function me(){return ee.context.getCurrentUserId()}function pe(e,t,n){ee.on(e,t,n)}function he(e,t,n){ee.once(e,t,n)}function ve(e,t,n){ee.off(e,t,n)}function Ie(e){ee.removeAll(e)}function Se(){ee.clear()}function Ce(e,t){m.add(e,t)}function Te(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return O.debug("get conversation list ->"),[4,te.imClient.context.getConversationList(null==e?void 0:e.count,void 0,null==e?void 0:e.startTime,null==e?void 0:e.order,t)];case 1:return n=i.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?(s=a.map((function(e){return function(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,a=e.unreadMessageCount,r=e.hasMentioned,s=e.mentionedInfo,i=e.lastUnreadTime,c=e.notificationStatus,d=e.isTop,u=e.channelId,l=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&Z(o),unreadMessageCount:a,hasMentioned:r,mentionedInfo:r?{type:null==s?void 0:s.type,userIdList:null==s?void 0:s.userIdList}:void 0,lastUnreadTime:i,notificationStatus:c,isTop:d,channelId:u,unreadMentionedCount:l}}(e)})),[2,{code:0,data:s}]):(O.warn("get conversation list fail ->"+o+":"+oe[o]),[2,{code:o,msg:oe[o]}])}}))}))}function Ee(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.removeConversation(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("destroy conversation ->"+n),t!==r.SUCCESS?(O.warn("destroy conversation fail ->"+t+":"+oe[t]+","+n),[2,{code:t,msg:oe[t]}]):[2,{code:t}]}}))}))}function ye(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return U(this,(function(s){switch(s.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.getConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return t=s.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get draft ->"+a),n===r.SUCCESS?[2,{code:n,data:o||""}]:(O.warn("get draft fail ->"+n+":"+oe[n]+","+a),[2,{code:n,msg:oe[n]}])}}))}))}function Re(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("draft",t,p.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set draft ->"+n),[4,te.imClient.context.saveConversationMessageDraft(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(O.warn("set draft fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}])}}))}))}function Ne(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),t="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("delete draft ->"+t),[4,te.imClient.context.clearConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("delete draft fail ->"+n+":"+oe[n]+","+t),[2,{code:n,msg:oe[n]}])}}))}))}function Ue(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d;return U(this,(function(u){switch(u.label){case 0:if(O.debug("get total unread count -> ConversationType:"+JSON.stringify(t)+" includeMuted:"+e),c("includeMuted",e,p.BOOLEAN,!1),c("conversationTypes",t,p.ARRAY,!1),t)for(n=0,o=t;n<o.length;n++)a=o[n],c("conversationType",a,h);return[4,te.imClient.context.getTotalUnreadCount("",t,e)];case 1:return s=u.sent(),i=s.code,d=s.data,i===r.SUCCESS?[2,{code:i,data:d}]:(O.warn("getTotalUnreadCount fail ->"+i+":"+oe[i]),[2,{code:i,msg:oe[i]}])}}))}))}function Oe(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return U(this,(function(s){switch(s.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.getUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=s.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get unreadCount ->"+a),n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("get unreadCount fail ->"+n+":"+oe[n]+","+a),[2,{code:n,msg:oe[n]}])}}))}))}function Me(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),[4,te.imClient.context.clearUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("clear unreadMsgNum ->"+n),t!==r.SUCCESS?(O.warn("clear unreadMsgNum fail ->"+t+":"+oe[t]+","+n),[2,{code:t,msg:oe[t]}]):[2,{code:t}]}}))}))}function _e(){return N(this,void 0,void 0,(function(){return U(this,(function(e){switch(e.label){case 0:return[4,te.imClient.context.clearAllUnreadCount()];case 1:return[2,{code:e.sent()}]}}))}))}function we(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("notificationStatus",t,(function(e){return 1===e||2===e}),!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set conversation status ->"+n),[4,te.imClient.context.setConversationStatus(e.conversationType,e.targetId,void 0,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set conversation status fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Ae(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.conversationType",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),O.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.getConversationNotificationStatus(e.conversationType,e.targetId,e.channelId)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("getConversationNotificationStatus ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function xe(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function be(e,t){return void 0===t&&(t=!0),N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.type",e.conversationType,h,!0),c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("set conversation status ->"+n),[4,te.imClient.context.setConversationStatus(e.conversationType,e.targetId,t,void 0,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set conversation status fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Pe(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function Le(e){return N(this,void 0,void 0,(function(){return U(this,(function(t){return c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),O.debug("getUnreadMentionedCount"+e.targetId+",channelId:"+e.channelId),[2,te.imClient.context.getUnreadMentionedCount(e)]}))}))}function Ge(){return N(this,void 0,void 0,(function(){return U(this,(function(e){return O.debug("getAllUnreadMentionedCount"),[2,te.imClient.context.getAllUnreadMentionedCount()]}))}))}function De(){return N(this,void 0,void 0,(function(){return U(this,(function(e){return[2,te.imClient.context.getAllConversationState()]}))}))}function ke(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getUltraGroupList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("get ultragroup ->"+t+":"+oe[t]),[2,{code:t,msg:oe[t]}])}}))}))}function He(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getBlockUltraGroupList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("get block ultragroup ->"+t+":"+oe[t]),[2,{code:t,msg:oe[t]}])}}))}))}function Be(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("options.conversationType",e.conversationType,h,!0),[4,te.imClient.context.sendUltraGroupTypingStatus(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("send ultraGroup OperateStatus ->"+t+":"+oe[t]),[2,{code:t,msg:oe[t]}])}}))}))}function Fe(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l;return U(this,(function(g){switch(g.label){case 0:return c("options.targetId",e.targetId,p.STRING,!0),c("options.channelId",e.channelId,p.CHANNEL_ID),c("options.conversationType",e.conversationType,h,!0),c("msgs",t,p.ARRAY,!0),n=e.targetId,o=e.conversationType,a=e.channelId,s=[],t.forEach((function(e){var t=e.sendTime,n=e.messageUId;s.push({sendTime:t,messageUId:n,channelId:a})})),i={targetId:n,conversationType:o,messages:s},[4,te.imClient.context.getUltraGroupMessageListByMessageUId(i)];case 1:return d=g.sent(),u=d.code,l=d.data,u===r.SUCCESS?[2,{code:r.SUCCESS,data:l}]:(O.warn("get UltraGroup MessageList by messageUId ->"+u+":"+oe[u]),[2,{code:u,msg:oe[u]}])}}))}))}function qe(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l,g;return U(this,(function(f){switch(f.label){case 0:return c("expansion",e,p.OBJECT,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.sentTime,i=t.canIncludeExpansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",channelId:"+d+",messageUId:"+a,O.debug("update expansion for ultragroup message ->"+u),l={targetId:o,channelId:d,conversationType:n,sendTime:s,canIncludeExpansion:i,messageUId:a,expansion:e},[4,te.imClient.context.expandUltraMessage(l)];case 1:return(g=f.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("update expansion for ultragroup message ->"+g+":"+oe[g]),[2,{code:g,msg:oe[g]}])}}))}))}function Ve(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l,g;return U(this,(function(f){switch(f.label){case 0:return c("expansion",e,p.ARRAY,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.sentTime,i=t.canIncludeExpansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",channelId:"+d+",messageUId:"+a,O.debug("remove expansion for ultragroup message ->"+u),l={targetId:o,channelId:d,conversationType:n,sendTime:s,canIncludeExpansion:i,messageUId:a,keys:e},[4,te.imClient.context.expandUltraMessage(l)];case 1:return(g=f.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("remove expansion for ultraGroup message ->"+g+":"+oe[g]),[2,{code:g,msg:oe[g]}])}}))}))}function ze(e){return N(this,void 0,void 0,(function(){var t,n,o,a,s,i,d,u,l;return U(this,(function(g){switch(g.label){case 0:return c("message",e,p.OBJECT,!0),t=e.conversationType,n=e.targetId,o=e.messageUId,a=e.sentTime,s=e.canIncludeExpansion,i=e.channelId,d="conversationType:"+t+",targetId:"+n+",channelId:"+i+",messageUId:"+o,O.debug("remove all expansion for ultraGroup message ->"+d),u={targetId:n,channelId:i,conversationType:t,sendTime:a,canIncludeExpansion:s,messageUId:o,removeAll:!0},[4,te.imClient.context.expandUltraMessage(u)];case 1:return(l=g.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("remove all expansion for ultraGroup message ->"+l+":"+oe[l]),[2,{code:l,msg:oe[l]}])}}))}))}function Ke(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l,g,f;return U(this,(function(m){switch(m.label){case 0:return c("content",e,p.OBJECT,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.senderUserId,i=t.sentTime,d=t.canIncludeExpansion,u=t.channelId,l="conversationType:"+n+",targetId:"+o+",channelId:"+u+",messageUId:"+a,O.debug("update ultragroup message expansion ->"+l),g={targetId:o,channelId:u,conversationType:n,fromUserId:s,sendTime:i,canIncludeExpansion:d,messageUId:a,content:e},[4,te.imClient.context.modifyMessage(g)];case 1:return(f=m.sent().code)===r.SUCCESS?[2,{code:r.SUCCESS}]:(O.warn("modify ultraGroup message ->"+f+":"+oe[f]),[2,{code:f,msg:oe[f]}])}}))}))}function Xe(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return c("cotargetIdntent",e,p.STRING,!0),O.debug("get UltraGroup unreadMentionedCount by targetId:"+e),[4,te.imClient.context.getUltraGroupUnreadMentionedCountByTargetId(e)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:r.SUCCESS,data:o}]:(O.warn("get UltraGroup unreadMentionedCount by targetId error ->"+n+":"+oe[n]),[2,{code:n,msg:oe[n]}])}}))}))}var je=function(e){c("options.key",e.key,p.STRING,!0),c("options.value",e.value,p.STRING,!0),c("options.isAutoDelete",e.isAutoDelete,p.BOOLEAN),c("options.isSendNotification",e.isSendNotification,p.BOOLEAN),c("options.notificationExtra",e.notificationExtra,p.STRING)},Je=function(e){c("options.key",e.key,p.STRING,!0),c("options.isSendNotification",e.isSendNotification,p.BOOLEAN),c("options.notificationExtra",e.notificationExtra,p.STRING)};function We(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.count",t.count,p.NUMBER,!0),n="id:"+e,O.debug("join chatroom ->"+n),[4,te.imClient.context.joinChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("join chatroom fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Ye(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.count",t.count,p.NUMBER,!0),n="id:"+e,O.debug("join exist chatroom ->"+n),[4,te.imClient.context.joinExistChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("join exist chatroom fail ->code:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function Qe(e){return N(this,void 0,void 0,(function(){var t,n;return U(this,(function(o){switch(o.label){case 0:return t="id:"+e,O.debug("quit chatroom ->"+t),[4,te.imClient.context.quitChatroom(e)];case 1:return(n=o.sent())!==r.SUCCESS?(O.warn("quit chatroom fail ->code+:"+oe[n]+","+t),[2,{code:n,msg:oe[n]}]):[2,{code:n}]}}))}))}function $e(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("options.count",t.count,p.NUMBER),c("options.order",t.order,(function(e){return[0,1,2].includes(e)})),n="id:"+e,O.debug("get chatroom info ->"+n),[4,te.imClient.context.getChatroomInfo(e,t.count,t.order)];case 1:return o=i.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?[2,{code:a,data:s}]:(O.warn("get chatroom info fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function Ze(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),je(t),n="id:"+e,O.debug("set chatroom entry->"+n),[4,te.imClient.context.setChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("set chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function et(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("targetId",e,p.STRING,!0),function(e){e.entries.forEach((function(e){c("entry.key",e.key,p.STRING,!0),c("entry.value",e.value,p.STRING,!0)})),c("options.isAutoDelete",e.isAutoDelete,p.BOOLEAN),c("options.notificationExtra",e.notificationExtra,p.STRING)}(t),t.entries.length>10?[2,ne.CHATROOM_KV_STORE_OUT_LIMIT]:(n="id:"+e,O.debug("set chatroom entry->"+n),[4,te.imClient.context.setChatroomEntries(e,t)]);case 1:return o=i.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(O.warn("set chatroom entry fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a],data:s}]):[2,{code:a}]}}))}))}function nt(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),je(t),n="id:"+e,O.debug("force set chatroom entry ->"+n),[4,te.imClient.context.forceSetChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("force set chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function ot(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),Je(t),n="id:"+e,O.debug("remove chatroom entry->"+n),[4,te.imClient.context.removeChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("remove chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function at(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("targetId",e,p.STRING,!0),function(e){e.entries.forEach((function(e){c("key",e,p.STRING,!0)})),c("options.notificationExtra",e.notificationExtra,p.STRING)}(t),n="id:"+e,O.debug("remove chatroom entry->"+n),(o=Object.assign({},t)).entries=t.entries.map((function(e){return{key:e}})),[4,te.imClient.context.removeChatroomEntries(e,o)];case 1:return a=d.sent(),s=a.code,i=a.data,s!==r.SUCCESS?(O.warn("remove chatroom entry fail ->code+:"+oe[s]+","+n),[2,{code:s,msg:oe[s],data:i}]):[2,{code:s}]}}))}))}function rt(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("targetId",e,p.STRING,!0),Je(t),n="id:"+e,O.debug("force remove chatroom entry ->"+n),[4,te.imClient.context.forceRemoveChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("force remove chatroom entry fail ->code+:"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:o}]}}))}))}function st(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("key",t,(function(e){return v(e)&&/[\w+=-]+/.test(e)&&e.length<=128}),!0),n="id:"+e,O.debug("get chatroom entry->"+n),[4,te.imClient.context.getChatroomEntry(e,t)];case 1:return o=i.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?[2,{code:a,data:s}]:(O.warn("get chatroom entry fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function it(e){return N(this,void 0,void 0,(function(){var t,n,o,a;return U(this,(function(s){switch(s.label){case 0:return t="id:"+e,O.debug("get all chatroom entries->"+t),[4,te.imClient.context.getAllChatroomEntries(e)];case 1:return n=s.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?[2,{code:o,data:a}]:(O.warn("get all chatroom entries fail ->code+:"+oe[o]+","+t),[2,{code:o,msg:oe[o]}])}}))}))}function ct(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.timestamp",t.timestamp,p.NUMBER),c("options.count",t.count,p.NUMBER),c("options.order",t.order,(function(e){return 0===e||1===e})),n="id:"+e,O.debug("get chatroom history message->"+n),[4,te.imClient.context.getChatRoomHistoryMessages(e,t.count,t.order,t.timestamp)];case 1:return o=d.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?(i=s.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:i,hasMore:!!s.hasMore}}]):(O.warn("get chatroom history message fail ->code+:"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function dt(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return[4,te.imClient.context.bindRTCRoomForChatroom(e)];case 1:return[2,{code:t=n.sent(),msg:oe[t]}]}}))}))}var ut=function(e,t,n,o){void 0===n&&(n=!0),void 0===o&&(o=!0),this.messageType=e,this.content=t,this.isPersited=n,this.isCounted=o};function lt(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new ut(e,o,t,n)}}var gt,ft,mt=lt("RC:ImgMsg"),pt=lt("RC:HQVCMsg"),ht=lt("RC:SightMsg"),vt=lt("RC:TxtMsg"),It=lt("RC:CombineMsg"),St=lt("RC:FileMsg"),Ct=lt("RC:GIFMsg"),Tt=lt("RC:VcMsg"),Et=lt("RC:LBSMsg"),yt=lt("RC:ReferenceMsg"),Rt=lt("RC:ImgTextMsg"),Nt={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=_t()+Ut[0][1]||r,Ut.shift();var s=new XMLHttpRequest;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});s.onreadystatechange=function(){if(4===s.readyState){var a=s.responseText||"{}";(a=JSON.parse(a)).filename=t.uniqueValue,a.uploadMethod=I?I.QINIU:"",200===s.status?n.onCompleted(a):Ut.length?Nt[Ut[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";Mt(t,(function(e,t){"token"!==e&&(n+=(n?"&":"")+encodeURIComponent(e)+"="+encodeURIComponent(t))})),n&&(e+=(e.indexOf("?")>0?"&":"?")+n);return e}(a+="/mkblk/"+e.size,t.multi_parmas));s.open(t.method,a,!0),n.onOpen(s),t.stream&&s.setRequestHeader("authorization","UpToken "+t.multi_parmas.token);Mt(t.headers,(function(e,t){s.setRequestHeader(e,t)})),s.send(e)},baidu:function(e,t,n,o){if(console.log(o,t),o.size>Ot)throw new Error("the file size is over 5GB!");var a=t||{};t=t||ft;var r=new XMLHttpRequest,s=_t();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var i=s+Ut[0][1]+a.bosUploadPath;Ut.shift();var c=a.bosHeader||{},d={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:i,isBosRes:!0};r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total,!0)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).filename=t.uniqueValue,200===r.status){n.onCompleted(d,!0)}else Ut.length?Nt[Ut[0][0]](e,t,n,o):n.onError("upload fail")}},r.open(t.method,i,!0),r.setRequestHeader("authorization",c.bosToken),r.setRequestHeader("x-bce-date",c.bosDate),r.send(o)},aliyun:function(e,t,n,o){if(o.size>Ot)throw new Error("the file size is over 5GB!");const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token"));const r=Ut[0][1];Ut.shift(),e=e||gt,t=(t=t||{})||ft;var s=new XMLHttpRequest,i=_t()+t.ossBucketName+"."+r;s.upload&&t.support_options&&(s.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});s.onreadystatechange=function(){if(4===s.readyState){var e=s.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=I?I.ALI:"",200===s.status?n.onCompleted(e):Ut.length?Nt[Ut[0][0]](a,t,n,o):n.onError("upload fail")}},s.open(t.method,i,!0),console.log("ali:url",i);var c=t.aliHeader||{};e.set("OSSAccessKeyId",c.osskeyId),e.set("policy",c.ossPolicy),e.set("Signature",c.ossSign),e.set("success_action_status",200),e.delete("key"),e.append("key",t.uploadFileName),e.delete("file"),e.append("file",o),s.send(e)},s3:function(e,t,n,o){var a=new FormData,r=new XMLHttpRequest,s=_t();const i=Ut[0][1];var c=s+t.s3BucketName+"."+i;console.log("uploadS3:url",c),Ut.shift(),r.upload&&t.support_options&&(r.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});r.onreadystatechange=function(){if(4===r.readyState){var a=r.responseText||"{}";if((a=JSON.parse(a)).name=t.uniqueValue,a.filename=t.uploadFileName,a.uploadMethod=I.AWS,console.log("UploadMethod:",I),200===r.status||204===r.status)n.onCompleted(a);else if(Ut.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),Nt[Ut[0][0]](a,t,n,o)}else n.onError("upload fail")}},r.open(t.method,c,!0);var d=t?t.s3Header:{},u=o&&o.type;"text/html"===u?a.set("Content-Disposition","inline;"):a.set("Content-Disposition","attachment;");a.set("Content-Type",u),a.set("x-amz-credential",d.s3Credential),a.set("x-amz-algorithm",d.s3Algorithm),a.set("x-amz-date",d.s3Date),a.set("policy",d.s3Policy),a.set("x-amz-signature",d.s3Signature),a.set("key",t.uploadFileName),a.set("file",o),r.send(a)},stc:function(e,t,n,o){new FormData;var a=new XMLHttpRequest;_t();var r="https://"+Ut[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;Ut.shift(),a.upload&&t.support_options&&(a.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});a.onreadystatechange=function(){if(4===a.readyState){var r=a.responseText||"{}";if((r=JSON.parse(r)).name=t.uniqueValue,r.filename=t.uploadFileName,r.uploadMethod=I?I.STC:"",200===a.status||204===a.status)n.onCompleted(r);else if(Ut.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),Nt[Ut[0][0]](a,t,n,o)}else n.onError("upload fail")}},a.open("PUT",r,!0);var s=t?t.stcHeader:{};a.setRequestHeader("Content-Type",o.type),"text/html"===o.type?a.setRequestHeader("Content-Disposition","inline;"):a.setRequestHeader("Content-Disposition","attachment;");a.setRequestHeader("Authorization",s.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",s.stcContentSha256),a.setRequestHeader("x-amz-date",s.stcDate),a.send(o)}},Ut=[],Ot=5368709120;function Mt(e,t){for(var n in e)t(n,e[n])}function _t(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function wt(e,t,n){var o,a,r=e&&e.type||"text/plain",s=r.indexOf("image")>-1?1:4,i=Math.ceil(e.size/t.stc_chunk_size),c=t&&JSON.parse(t.ossConfig?t.ossConfig:"");Array.isArray(c)||(c=[]);var d=c.find((e=>Object.keys(e).includes("stc"))),u="uploads";te.imClient.getFileToken(s,o,"POST",u).then((function(e){o=e.fileName,a="https://"+d.stc+"/"+t.stcBucketName+"/"+o,console.log("uploadStcMultipart:url",a);var s=new XMLHttpRequest;s.open("POST",a+"?"+u,!0),"text/html"===r?s.setRequestHeader("Content-Disposition","inline;"):s.setRequestHeader("Content-Disposition","attacshment;"),s.setRequestHeader("Authorization",e&&e.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),s.setRequestHeader("x-amz-date",e&&e.stcDate),s.setRequestHeader("Content-Type",r),s.send(),s.onreadystatechange=function(e){if(4===s.readyState){var t=s.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===s.status||204===s.status?function(e){for(var t=[],n=1;n<=i;n++)t.push(m(e,n));f(e,t)}(Array.isArray(t)&&t[1]):n.onError("uploadStcMultipart:did not get uploadId")}}}),(function(e){n.onError("uploadStcMultipart:"+e)}));var l=[],g=new Map;function f(c,d){d&&Array.isArray(d)&&0!==d.length&&Promise.all(d).then((()=>{var d="uploadId="+c;if(g.size===i)te.imClient.context.getFileToken(s,o,"POST",d).then((function(o){console.log("onSuccess",o),console.log("onSuccess:uploadId",c);var s=new XMLHttpRequest;s.open("POST",a+"?"+d,!0),s.setRequestHeader("Authorization",o&&o.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",o&&o.stcContentSha256),s.setRequestHeader("x-amz-date",o&&o.stcDate),s.setRequestHeader("Content-Type",r);var i="<CompleteMultipartUpload xmlns='http://s3.amazonaws.com/doc/2006-03-01/'>",u=Array.from(g.keys()||[]).sort(((e,t)=>e-t));console.log("keys",u),u.map((e=>{i+=`<Part><ETag>${g.get(e)}</ETag><PartNumber>${e}</PartNumber></Part>`})),i+="</CompleteMultipartUpload>",s.send(i),console.log("xml",i),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var o={};o.name=e.name,o.filename=t.uploadFileName,o.uploadMethod=I.STC,n.onCompleted(o)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var u=[];for(var p of l)u.push(m(c,p));f(c,u)}}),(e=>{console.error(e),n.onError("uploadStcMultipart: chunkFiles upload failed and those will reupload");var t=[];for(var o of l)t.push(m(c,o));f(c,t)}))}function m(n,i){return new Promise(((c,d)=>{var u="partNumber="+i+"&uploadId="+n;te.imClient.context.getFileToken(s,o,"PUT",u).then((function(n){console.log("signature "+i+" onSuccess",n);var o=e&&e.slice((i-1)*t.stc_chunk_size,i*t.stc_chunk_size);console.log("fileChunk:size",o.size);var s=new XMLHttpRequest;s.open("PUT",a+"?"+u,!0),s.setRequestHeader("Authorization",n&&n.stcAuthorization),s.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),s.setRequestHeader("x-amz-date",n&&n.stcDate),s.setRequestHeader("Content-Type",r),s.send(o),s.onreadystatechange=function(){if(4===s.readyState)if(200===s.status||204===s.status){var e=s.getResponseHeader("etag");console.log("etag:"+i,e),g.set(i,e),c(e)}else l.includes(i)||l.push(i),d(i)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(i)||l.push(i),d(i)}))}))}}var At={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=xt()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),bt(t.multi_parmas,(function(e,t){n.append(e,t)})),n},json:function(e,t){var n={};if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=xt()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,bt(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function xt(){var e=(new Date).getTime();return"xxxxxx4xxxyxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))}function bt(e,t){for(var n in e)t(n,e[n])}var Pt,Lt=0;function Gt(e){this.options=function(e){var t={domain:"",method:"POST",file_data_name:"file",unique_key:"key",base64_size:4194304,chunk_size:4194304,bos_chunk_size:4294967296,stc_chunk_size:10485760,headers:{},multi_parmas:{},query:{},support_options:!0,data:At.form,genUId:xt};if(!e||!e.domain)throw new Error("domain is null");for(var n in e)t[n]=e[n];return t}(e),this.setOptions=function(e){var t=this;bt(e,(function(e,n){t.options[e]=n}))},console.log("options",e),this.upload=function(e,t){if(e){var n=this;!function(e,t,n){if(gt=e,ft=t,Ut=[],t.ossConfig){const e=JSON.parse(t.ossConfig);let n,o,a="";const r=[];e.forEach((e=>{const t=Number(e.p)-1;for(const s in e)"aliyun"===s&&(a=e[s]),"s3"===s&&(n=e[s]),"stc"===s&&(o=e[s]),"p"!==s&&(r[t]=[s,e[s]])})),r.forEach((function(e){e&&Ut.push(e)})),e.length!==Ut.length&&(Ut=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else Ut=[["qiniu",t.domain],["baidu",t.uploadHost.bos]];var o;if(t.ossConfig){var a=t&&JSON.parse(t.ossConfig);Array.isArray(a)||(a=[]),o=a.find((e=>Object.keys(e).includes("stc")))}if(o&&1===parseInt(o.p)&&e.size>=4194304)wt(e,t,n);else{var r=t.data(e,t);Nt[Ut[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Pt=e,o){Pt=Lt+e/n*(n-Lt)}else Lt=Pt;t.onProgress(Pt,n)},onCompleted:function(e){t.onCompleted(e)},onError:function(e){t.onError(e)},onOpen:function(e){n.xhr=e}})}else t.onError("upload file is null.")},this.cancel=function(){this.xhr&&this.xhr.abort()}}var Dt={init:function(e){return new Gt(e)},dataType:At,resize:function(e,t,n){e.type;var o=document.createElement("canvas"),a=new FileReader;a.readAsDataURL(e),a.onload=function(e){var a=e.target.result,r=new Image;r.src=a;var s=r.width,i=r.height,c=function(e,t){var n=1,o=e.width,a=t.maxWidth||0;a>0&&o>a&&(n=a/o);var r=e.height,s=t.maxHeight||0;if(s>0&&r>s){var i=s/r;n=Math.min(n,i)}var c=t.maxSize||0,d=Math.ceil(e.size/1e3);if(d>c){var u=c/d;n=Math.min(n,u)}return n}({width:s,height:i,size:e.total},t),d=a;c<1&&(d=function(e,t,n){o.width=t,o.height=n,o.getContext("2d").drawImage(e,0,0,t,n);var a="image/jpg";return o.toDataURL(a)}(r,s*c,i*c)),n(d)}}};const kt=function(e,t,n){var o=document.createElement("canvas"),a=o.getContext("2d"),r=new Image;r.onload=function(){var s=function(e,t,n){var o,a,r,s=e<t,i=0,c=0;return(s?t/e:e/t)>n.scale?(s?(a=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,i=((a=e/(o=t/100))-n.maxWidth)/2),{w:a,h:r,x:-i,y:-c}):(s?(o=t/n.maxHeight,r=n.maxHeight,a=e/o):(o=e/n.maxWidth,a=n.maxWidth,r=t/o),{w:a,h:r,x:-i,y:-c})}(r.width,r.height,t);o.width=s.w>t.maxWidth?t.maxWidth:s.w,o.height=s.h>t.maxHeight?t.maxHeight:s.h,a.drawImage(r,s.x,s.y,s.w,s.h);try{var i=o.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");i=i.replace(c,""),n(i)}catch(e){throw new Error(e)}},r.src="string"==typeof e?"data:image/jpg;base64,"+e:function(e){var t=window.URL||window.webkitURL;return t?t.createObjectURL(e):""}(e)},Ht=function(e,t){var n=e.file,o=e.compress;kt(n,o,t)},Bt=function(e,t){if(e.getToken)e.getToken((function(n,o){o=o||{},e.multi_parmas||(e.multi_parmas={}),e.multi_parmas.token=n,e.uploadHost||(e.uploadHost={}),e.uploadHost.bos=o.bos,e.ossConfig=o.ossConfig,e.bosHeader||(e.bosHeader={}),e.bosHeader.bosDate=o.bosDate,e.bosHeader.bosToken=o.bosToken,e.bosUploadPath=o.path,e.aliHeader={},e.aliHeader.osskeyId=o.osskeyId,e.aliHeader.ossPolicy=o.ossPolicy,e.aliHeader.ossSign=o.ossSign,e.ossBucketName=o.ossBucketName,e.uploadFileName=o.fileName,e.s3Header={},e.s3Header.s3Credential=o.s3Credential,e.s3Header.s3Algorithm=o.s3Algorithm,e.s3Header.s3Date=o.s3Date,e.s3Header.s3Policy=o.s3Policy,e.s3Header.s3Signature=o.s3Signature,e.s3BucketName=o.s3BucketName,e.stcHeader={},e.stcHeader.stcAuthorization=o.stcAuthorization,e.stcHeader.stcContentSha256=o.stcContentSha256,e.stcHeader.stcDate=o.stcDate,e.stcBucketName=o.stcBucketName,e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream",e.headers.Authorization="UpToken "+n),console.log("data",o);var a=Dt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Dt.init(e);t(n)}};var Ft,qt,Vt=function(e,t,n){t.upload(e.file,{onError:function(e){n.onError(e)},onProgress:function(e,t){n.onProgress(e,t)},onCompleted:function(t){t.filename||(t.filename=t.hash);var o=e.compressThumbnail||Ht;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},zt=function(e){var t=this;this.instance=e,this.upload=function(e,n){Vt({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},Kt=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};Vt(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},Xt=function(e,t){Bt(e,(function(n){var o={maxHeight:e.maxHeight||160,maxWidth:e.maxWidth||160,quality:e.quality||.5,scale:e.scale||2.4},a=new Kt(n,o);t(a)}))},jt=function(e,t){Bt(e,(function(e){var n=new zt(e);t(n)}))},Jt=Xt;Dt.dataType;function Wt(e){return Ft=Ft||new AudioContext,new Promise((function(t,n){Ft.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Yt(e,t,n,o){return new Promise((function(a){te.imClient.context.getFileToken(e,t,n,o).then((function(e){a({code:r.SUCCESS,data:e})})).catch((function(e){a({code:e,msg:oe[e]})}))}))}function Qt(e,t,n,o,a){return c("fileType",e,C,!0),c("filename",t,p.STRING),c("saveName",n,p.STRING),c("serverType",a,p.NUMBER),new Promise((function(s){te.imClient.context.getFileUrl(e,t,n,o,a).then((function(e){s({code:r.SUCCESS,data:e})})).catch((function(e){s({code:e})}))}))}function $t(e,t,n){return N(this,void 0,void 0,(function(){var o,a,d,u,l,g,f,m,h,v;return U(this,(function(I){switch(I.label){case 0:return n=n||{},t instanceof ut==!1?(O.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,ne.ILLGAL_PARAMS]):(c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),o=e.conversationType,a=e.targetId,d=e.channelId,u="conversationType:"+o+",targetId:"+a,O.debug("send message ->"+u),(l=Object.assign(n,t)).channelId=d||"",[4,te.imClient.context.sendMessage(o,a,l)]);case 1:return g=I.sent(),f=g.code,m=g.data,f===r.SUCCESS?(h=Z(m),[2,{code:f,data:h}]):(O.warn("send message fail ->"+f+":"+oe[f]+","+u),v={isMentioned:!!n.isMentioned,content:t.content,messageType:t.messageType,isPersited:t.isPersited||!1,isCounted:t.isCounted||!1,disableNotification:!!(null==n?void 0:n.disableNotification),canIncludeExpansion:!!(null==n?void 0:n.canIncludeExpansion),expansion:(null==n?void 0:n.expansion)||null,conversationType:e.conversationType,targetId:e.targetId,channelId:e.channelId,senderUserId:te.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:E.SEND,sentTime:(null==m?void 0:m.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD,isOffLineMessage:!1},o!==s.ULTRA_GROUP&&(v.isOffLineMessage=!1),[2,{code:f,msg:oe[f],data:Z(v)}])}}))}))}function Zt(e,t,n){return $t(e,new vt(t),n)}function en(e,t){return function(n,o,a,s){return new Promise((function(i){var c;!function(e,t,n,o){var a,r=this;if(void 0===t&&(t=S.FILE),a=t===S.IMAGE?S.IMAGE:S.FILE,!qt){qt="upload.qiniup.com";var s=te.imClient.context.getInfoFromCache();if(s&&s.ossConfig)try{var i=JSON.parse(s.ossConfig).find((function(e){return void 0!==e.qiniu}));i&&(qt=i.qiniu)}catch(e){}}var c=R({domain:qt,getToken:function(e){te.imClient.context.getFileToken(a).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}},o);(a===S.IMAGE?Jt:jt)(c,(function(o){o.upload(e,{onProgress:function(e,t){var o,a=Math.floor(e/t*100);null===(o=n.onProgress)||void 0===o||o.call(n,a)},onCompleted:function(o){return N(r,void 0,void 0,(function(){var r=this;return U(this,(function(s){return Qt(a,o.filename,o.name,o,o.uploadMethod).then((function(s){return N(r,void 0,void 0,(function(){var r,i;return U(this,(function(c){return 0!==s.code?(n.onFail(s),[2]):((r=s.data).type=e.type,r.name=o.name||o.filename,t===S.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Wt).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):((i=new FileReader).onload=function(){i.result?Wt(i.result).then((function(e){Object.assign(r,e),n.onSuccess(r)}),(function(){n.onSuccess(r)})):n.onSuccess(r)},i.onerror=function(){r.duration=0,n.onSuccess(r)},i.readAsArrayBuffer(e)),[2]):(a===S.IMAGE&&(r.thumbnail=o.thumbnail),n.onSuccess(r),[2]))}))}))})).catch((function(e){n.onFail(e)})),[2]}))}))},onError:function(e){n.onFail(e)}})}))}(o.file,e,{onProgress:null==a?void 0:a.onProgress,onSuccess:function(e){var r,c=(null===(r=null==a?void 0:a.onComplete)||void 0===r?void 0:r.call(a,{url:e.downloadUrl}))||t(e,o);$t(n,c,s).then(i)},onFail:function(e){i({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}},(null===(c=s)||void 0===c?void 0:c.thumbnailConfig)||{})}))}}var tn=en(S.FILE,(function(e,t){return new St({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),nn=en(S.IMAGE,(function(e,t){return new mt({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),on=en(S.AUDIO,(function(e,t){return new pt({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),an=en(S.SIGHT,(function(e,t){return new ht({sightUrl:e.downloadUrl,content:t.thumbnail,duration:t.duration,size:t.file.size||e.size,name:t.name||e.name,user:t.user,extra:t.extra})}));function rn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.timestamp",null==t?void 0:t.timestamp,p.NUMBER),c("options.count",null==t?void 0:t.count,p.NUMBER),c("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get history message ->"+n),[4,te.imClient.context.getHistoryMessage(e.conversationType,e.targetId,null==t?void 0:t.timestamp,null==t?void 0:t.count,null==t?void 0:t.order,null==e?void 0:e.channelId)];case 1:return o=d.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?(i=s.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:i,hasMore:s.hasMore}}]):(O.warn("get history message fail ->"+a+":"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function sn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.timestamp",null==t?void 0:t.timestamp,p.NUMBER),c("options.count",null==t?void 0:t.count,p.NUMBER),c("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("get history message ->"+n),[4,te.imClient.context.getRemoteHistoryMessages(e.conversationType,e.targetId,(null==t?void 0:t.timestamp)||0,(null==t?void 0:t.count)||20,(null==t?void 0:t.order)||0,e.channelId||"")];case 1:return o=d.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?(i=s.list.map((function(e){return Z(e)})),[2,{code:a,data:{list:i,hasMore:s.hasMore}}]):(O.warn("get history message fail ->"+a+":"+oe[a]+","+n),[2,{code:a,msg:oe[a]}])}}))}))}function cn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,r,i,c,d;return U(this,(function(u){switch(u.label){case 0:return a={targetId:e,conversationType:s.PRIVATE,channelId:o},r=new ut("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,$t(a,r)];case 1:return i=u.sent(),c=i.code,d=i.msg,0===c?[2,{code:c}]:[2,{code:c,msg:d}]}}))}))}function dn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,r,i,d;return U(this,(function(u){switch(u.label){case 0:return c("messageUId",t,p.STRING,!0),c("channelId",n,p.CHANNEL_ID),o="messageUId:"+t+",targetId:"+e,O.debug("send read receipt message ->"+o),a=new ut("RC:RRReqMsg",{messageUId:t}),[4,$t({targetId:e,conversationType:s.GROUP,channelId:n},a)];case 1:return r=u.sent(),i=r.code,d=r.msg,0===i?[2,{code:i}]:[2,{code:i,msg:d}]}}))}))}function un(e,t,n){return N(this,void 0,void 0,(function(){return U(this,(function(e){throw new Error("This method is deprecated, please use method sendReadReceiptResponseV2.")}))}))}function ln(e,t,n){return N(this,void 0,void 0,(function(){var o,a,i,d,u,l,g;return U(this,(function(f){switch(f.label){case 0:return c("targetId",e,p.STRING,!0),c("messageList",t,p.OBJECT,!0),c("channelId",n,p.CHANNEL_ID),Object.keys(t).forEach((function(e){c(e,t[e],p.ARRAY)})),o={targetId:e,conversationType:s.GROUP,channelId:n},i=te.imClient.context.getInfoFromCache(),0!==(d=(null==i?void 0:i.grpRRVer)||0)?[3,2]:(u=new ut("RC:RRRspMsg",{receiptMessageDic:t}),[4,$t(o,u)]);case 1:return a=f.sent(),[3,4];case 2:return 1!==d?[3,4]:(l=[],Object.keys(t).forEach((function(e){t[e].forEach((function(e){-1===l.indexOf(e)&&l.push(e)}))})),l.length?[4,te.imClient.context.sendReadReceiptMessage(e,l,n)]:(O.warn("Error in parameter messageList."),[2,{code:r.PARAMETER_ERROR}]));case 3:a=f.sent(),f.label=4;case 4:return(g=a.code)===r.SUCCESS?[2,{code:g}]:(O.warn("send read receipt message fail ->"+g+":"+oe[g]),[2,{code:g,msg:oe[g]}])}}))}))}function gn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,r;return U(this,(function(s){switch(s.label){case 0:return c("conversation.type",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("lastMessageSendTime",t,p.NUMBER,!0),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n=new ut("RC:SRSMsg",{lastMessageSendTime:t}),[4,$t(e,n)];case 1:return o=s.sent(),a=o.code,r=o.msg,0===a?[2,{code:a}]:[2,{code:a,msg:r}]}}))}))}function fn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("options.messageUId",t.messageUId,p.STRING,!0),c("options.sentTime",t.sentTime,p.NUMBER,!0),c("options.disableNotification",null==t?void 0:t.disableNotification,p.BOOLEAN),c("options.pushConfig",null==t?void 0:t.pushConfig,p.OBJECT),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n={user:t.user,channelId:e.channelId||"",disableNotification:null==t?void 0:t.disableNotification,pushConfig:null==t?void 0:t.pushConfig},o="conversationType:"+e.conversationType+",targetId:"+e.targetId+",messageUId:"+t.messageUId,O.debug("recall message ->"+o),[4,te.imClient.context.recallMessage(e.conversationType,e.targetId,t.messageUId,t.sentTime,n)];case 1:return a=d.sent(),s=a.code,i=a.data,s===r.SUCCESS&&i?[2,{code:s,data:Z(i)}]:s===r.SUCCESS?[2,{code:s}]:(O.warn("recall message fail ->"+s+":"+oe[s]+","+o),[2,{code:s,msg:oe[s]}])}}))}))}function mn(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options",t,(function(e){return d(e)&&e.length}),!0),t.forEach((function(e){c("options.messageUId",e.messageUId,p.STRING,!0),c("options.sentTime",e.sentTime,p.NUMBER,!0),c("options.messageDirection",e.messageDirection,(function(e){return 1===e||2===e}),!0)})),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("delete messages ->"+n),[4,te.imClient.context.deleteRemoteMessage(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("delete message fail ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:r.SUCCESS}]}}))}))}function pn(e,t){return N(this,void 0,void 0,(function(){var n,o;return U(this,(function(a){switch(a.label){case 0:return c("options.timestamp",t,p.NUMBER,!0),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("clear message ->"+n),[4,te.imClient.context.deleteRemoteMessageByTimestamp(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(O.warn("clear message ->"+o+":"+oe[o]+","+n),[2,{code:o,msg:oe[o]}]):[2,{code:r.SUCCESS}]}}))}))}function hn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u,l;return U(this,(function(g){switch(g.label){case 0:return c("expansion",e,p.OBJECT,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.canIncludeExpansion,i=t.expansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",messageUId:"+a,O.debug("update message expansion ->"+u),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,expansion:e,canIncludeExpansion:s,originExpansion:i,channelId:d})];case 1:return(l=g.sent().code)!==r.SUCCESS?(O.warn("update message expansion fail ->"+l+":"+oe[l]+","+u),[2,{code:l,msg:oe[l]}]):[2,{code:l}]}}))}))}function vn(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i,d,u;return U(this,(function(l){switch(l.label){case 0:return c("keys",e,p.ARRAY,!0),c("message",t,p.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.canIncludeExpansion,i=t.channelId,d="conversationType:"+n+",targetId:"+o+",messageUId:"+a,O.debug("remove message expansion ->"+d),[4,te.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:s,keys:e,channelId:i})];case 1:return(u=l.sent().code)!==r.SUCCESS?(O.warn("remove message expansion fail ->"+u+":"+oe[u]+","+d),[2,{code:u,msg:oe[u]}]):[2,{code:u}]}}))}))}function In(e,t){return N(this,void 0,void 0,(function(){var n,o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("typingContentType",t,p.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,O.debug("send typing status message ->"+n),o={messageType:"RC:TypSts",content:{typingContentType:t},isStatusMessage:!0,channelId:e.channelId},[4,te.imClient.context.sendMessage(e.conversationType,e.targetId,o)];case 1:return a=d.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:Z(i)}]:(O.warn("send typing status message fail ->"+s+":"+oe[s]+","+n),[2,{code:s,msg:oe[s]}])}}))}))}function Sn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,s,i;return U(this,(function(d){switch(d.label){case 0:return c("messageUId",t,p.STRING,!0),o="messageUId:"+t+",targetId:"+e,O.debug("get message reader ->"+o),[4,te.imClient.context.getMessageReader(e,t,n)];case 1:return a=d.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:i}]:(O.warn("get message reader fail ->"+s+":"+oe[s]+","+o),[2,{code:s,msg:oe[s]}])}}))}))}function Cn(e,t,n,o,a){return c("messageType",e,p.STRING,!0),c("isPersited",t,p.BOOLEAN,!0),c("isCounted",n,p.BOOLEAN,!0),c("isStatusMessage",a,p.BOOLEAN,!1),te.imClient.context.registerMessageType(e,t,n,o,a),lt(e,t,n)}function Tn(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return T()?(c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",null==e?void 0:e.channelId,p.CHANNEL_ID),[4,te.imClient.context.getFirstUnreadMessage(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(O.warn("insertMessage ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function En(e,t,n){return void 0===n&&(n={}),N(this,void 0,void 0,(function(){var o,a,s,i,c,d,u,l,g,f,m,p,h,v,I,S;return U(this,(function(C){switch(C.label){case 0:return T()?(o=t.senderUserId,a=t.messageType,s=t.content,i=t.messageDirection,c=t.messageUId,d=t.canIncludeExpansion,u=t.expansion,l=t.disableNotification,g=t.sentTime,f=t.sentStatus,O.info("insertMessage ->targetId:"+e.targetId+",conversationType:"+e.conversationType),m=n.isUnread,p=n.searchContent,h={senderUserId:o,messageType:a,content:s,messageDirection:i,sentTime:g,sentStatus:f,searchContent:p,isUnread:m,messageUId:c,disableNotification:l,canIncludeExpansion:d,expansionMsg:JSON.stringify(u),channelId:e.channelId||""},[4,te.imClient.context.insertMessage(e.conversationType,e.targetId,h)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return v=C.sent(),I=v.code,S=v.data,I===r.SUCCESS?[2,{code:I,data:Z(S)}]:(O.warn("insertMessage ->code:"+I+",targetId:"+e.targetId),[2,{code:I,msg:oe[I]}])}}))}))}function yn(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return T()?[4,te.imClient.context.getMessage(e)]:[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:Z(o)}]:(O.warn("getMessage ->code:"+n+",messageId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Rn(e){if(!T())return{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]};c("conversationType",e.conversationType,p.NUMBER,!0),c("targetId",e.targetId,p.STRING,!0);var t=te.imClient.context.getUnreadMentionedMessages(e.conversationType,e.targetId),n=[];return t&&t.length&&t.forEach((function(e){return n.push(Z(e))})),{code:r.SUCCESS,data:n}}function Nn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,s,i,d;return U(this,(function(u){switch(u.label){case 0:return T()?(c("conversationType",e.conversationType,p.NUMBER,!0),c("targetId",e.targetId,p.STRING,!0),c("keyword",t,p.STRING,!0),c("timestamp",n,p.NUMBER),c("count",o,p.NUMBER),1,[4,te.imClient.context.searchMessageByContent(e.conversationType,e.targetId,t,n,o,1,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return a=u.sent(),s=a.code,i=a.data,s===r.SUCCESS?(d=[],(null==i?void 0:i.messages)&&i.messages.length&&i.messages.forEach((function(e){return d.push(Z(e))})),[2,{code:s,data:{messages:d,count:null==i?void 0:i.count}}]):(O.warn("searchMessages ->code:"+s+",targetId:"+e.targetId),[2,{code:s,msg:oe[s]}])}}))}))}function Un(e,t,n){return N(this,void 0,void 0,(function(){var o;return U(this,(function(a){switch(a.label){case 0:return T()?(c("conversationType",e.conversationType,p.NUMBER,!0),c("targetId",e.targetId,p.STRING,!0),c("timestamp",t,p.NUMBER,!0),c("cleanSpace",n,p.BOOLEAN),[4,te.imClient.context.deleteMessagesByTimestamp(e.conversationType,e.targetId,t,n,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(O.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+e.targetId),[2,{code:o,msg:oe[o]}])}}))}))}function On(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return T()?(O.info("clearMessages ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.clearMessages(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(t=n.sent())===r.SUCCESS?[2,{code:t}]:(O.warn("clearMessages ->code:"+t+",targetId:"+e.targetId),[2,{code:t,msg:oe[t]}])}}))}))}function Mn(e,t,n,o){return N(this,void 0,void 0,(function(){var a,s,i;return U(this,(function(c){switch(c.label){case 0:return T()?(O.info("searchConversationByContent ->keyword:"+e),[4,te.imClient.context.searchConversationByContent(e,n,o,t)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return a=c.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:i}]:(O.warn("searchConversationByContent ->code:"+s+",keyword:"+e),[2,{code:s,msg:oe[s]}])}}))}))}function _n(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return T()?(O.info("clearUnreadCountByTimestamp ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.clearUnreadCountByTimestamp(e.conversationType,e.targetId,t,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("clearUnreadCountByTimestamp ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:oe[n]}])}}))}))}function wn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return T()?(c("messageId",e,p.NUMBER,!0),c("receivedStatus",t,p.NUMBER,!0),O.info("setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),[4,te.imClient.context.setMessageReceivedStatus(e,t)]):[2,{code:r.NOT_SUPPORT,msg:oe[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(O.warn("setMessageReceivedStatus ->code:"+n+",messageId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function An(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("tag.tagId",e.tagId,p.STRING,!0),c("tag.tagId",e.tagId,(function(e){return e.length<=10})),c("tag.tagName",e.tagName,(function(e){return e.length<=15})),c("tag.tagName",e.tagName,p.STRING,!0),O.info("createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,te.imClient.context.createTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("createTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:oe[t]}])}}))}))}function xn(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("tagId",e,p.STRING,!0),O.info("removeTag ->tagId:"+e),[4,te.imClient.context.removeTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("removeTag ->code:"+t+",tagId:"+e),[2,{code:t,msg:oe[t]}])}}))}))}function bn(e){return N(this,void 0,void 0,(function(){var t;return U(this,(function(n){switch(n.label){case 0:return c("tag.tagId",e.tagId,p.STRING,!0),c("tag.tagName",e.tagName,p.STRING,!0),c("tag.tagName",e.tagName,(function(e){return e.length<=15})),O.info("updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,te.imClient.context.updateTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(O.warn("updateTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:oe[t]}])}}))}))}function Pn(){return N(this,void 0,void 0,(function(){var e,t,n;return U(this,(function(o){switch(o.label){case 0:return[4,te.imClient.context.getTagList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(O.warn("getTagList ->code:"+t),[2,{code:t,msg:oe[t]}])}}))}))}function Ln(e){return N(this,void 0,void 0,(function(){var t,n,o;return U(this,(function(a){switch(a.label){case 0:return c("conversationType",e.conversationType,p.NUMBER),c("targetId",e.targetId,p.STRING),c("channelId",e.channelId,p.CHANNEL_ID),O.info("getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.getTagsForConversation(e)];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:[2,{code:n,msg:oe[n]}]}}))}))}function Gn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("tagId",e,p.STRING,!0),c("conversations",t,p.ARRAY,!0),t.forEach((function(e){c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID)})),O.info("addTagForConversations ->tagId:"+e),[4,te.imClient.context.addTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("addTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Dn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("tagId",e,p.STRING,!0),c("conversations",t,p.ARRAY,!0),t.forEach((function(e){c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID)})),O.info("removeTagForConversations ->tagId:"+e),[4,te.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function kn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID),c("tagIds",t,p.ARRAY,!0),t.forEach((function(e){c("tagId",e,p.STRING,!0)})),O.info("removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,te.imClient.context.removeTagsForConversation(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagsForConversation ->code:"+n+",tagIds:"+t),[2,{code:n,msg:oe[n]}])}}))}))}function Hn(e,t){return N(this,void 0,void 0,(function(){var n;return U(this,(function(o){switch(o.label){case 0:return c("tagId",e,p.STRING,!0),c("conversations",t,p.ARRAY,!0),t.forEach((function(e){c("conversation.conversationType",e.conversationType,p.NUMBER,!0),c("conversation.targetId",e.targetId,p.STRING,!0),c("conversation.channelId",e.channelId,p.CHANNEL_ID)})),O.info("removeTagForConversations ->tagId:"+e),[4,te.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(O.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:oe[n]}])}}))}))}function Bn(e,t,n){return N(this,void 0,void 0,(function(){var o,a,s;return U(this,(function(i){switch(i.label){case 0:return c("tagId",e,p.STRING,!0),c("count",t,p.NUMBER,!0),c("startTime",n,p.NUMBER,!0),O.info("getConversationListByTag ->tagId:"+e),[4,te.imClient.context.getConversationListByTag(e,n,t)];case 1:return o=i.sent(),a=o.code,s=o.data,a===r.SUCCESS?[2,{code:a,data:s}]:(O.warn("getConversationListByTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:oe[a]}])}}))}))}function Fn(e,t){return N(this,void 0,void 0,(function(){var n,o,a;return U(this,(function(s){switch(s.label){case 0:return c("tagId",e,p.STRING,!0),c("containMuted",t,p.BOOLEAN,!0),O.info("getUnreadCountByTag ->tagId:"+e),[4,te.imClient.context.getUnreadCountByTag(e,t)];case 1:return n=s.sent(),o=n.code,a=n.data,O.info(o,a),o===r.SUCCESS?[2,{code:o,data:a}]:(O.warn("getUnreadCountByTag ->code:"+o+",tagId:"+e),[2,{code:o,msg:oe[o]}])}}))}))}function qn(e,t,n){return N(this,void 0,void 0,(function(){var o,a;return U(this,(function(s){switch(s.label){case 0:return c("tagId",e,p.STRING,!0),c("conversation.targetId",t.targetId,p.STRING,!0),c("conversation.conversationType",t.conversationType,p.NUMBER,!0),c("conversation.channelId",t.channelId,p.CHANNEL_ID),c("status.isTop",n,p.BOOLEAN,!0),O.info("setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",conversationType"+t.conversationType),[4,te.imClient.context.setConversationStatusInTag(e,t,{isTop:n})];case 1:return o=s.sent(),(a=o.code)===r.SUCCESS?[2,{code:a}]:(O.warn("setConversationStatusInTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:oe[a]}])}}))}))}en(S.COMBINE_HTML,(function(e,t){return new It({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var Vn={COMET:"comet",WEBSOCKET:"websocket"},zn={TEXT:"RC:TxtMsg",VOICE:"RC:VcMsg",HQ_VOICE:"RC:HQVCMsg",IMAGE:"RC:ImgMsg",GIF:"RC:GIFMsg",RICH_CONTENT:"RC:ImgTextMsg",LOCATION:"RC:LBSMsg",FILE:"RC:FileMsg",SIGHT:"RC:SightMsg",COMBINE:"RC:CombineMsg",CHRM_KV_NOTIFY:"RC:chrmKVNotiMsg",LOG_COMMAND:"RC:LogCmdMsg",EXPANSION_NOTIFY:"RC:MsgExMsg",REFERENCE:"RC:ReferenceMsg",RECALL_MESSAGE_TYPE:"RC:RcCmd"};m.add("imlib","5.2.2"),m.validEngine("5.2.2")||O.error("The current engine version '"+m.getInfo().engine+"' error,imlib required engine version at least '5.2.2'.");export{ut as BaseMessage,It as CombineMessage,Vn as ConnectType,w as Events,St as FileMessage,Ct as GIFMessage,pt as HQVoiceMessage,mt as ImageMessage,Et as LocationMessage,zn as MessageType,yt as ReferenceMessage,Rt as RichContentMessage,ht as SightMessage,vt as TextMessage,Tt as VoiceMessage,Ce as __addSDKVersion,Gn as addConversationsToTag,pe as addEventListener,An as addTag,dt as bindRTCRoomForChatroom,_e as clearAllMessagesUnreadStatus,Se as clearEventListeners,pn as clearHistoryMessages,On as clearMessages,Me as clearMessagesUnreadStatus,Ne as clearTextMessageDraft,_n as clearUnreadCountByTimestamp,ue as connect,Un as deleteLocalMessagesByTimestamp,mn as deleteMessages,le as disconnect,rt as forceRemoveChatRoomEntry,nt as forceSetChatRoomEntry,it as getAllChatRoomEntries,De as getAllConversationState,Ge as getAllUnreadMentionedCount,He as getBlockUltraGroupList,xe as getBlockedConversationList,st as getChatRoomEntry,$e as getChatRoomInfo,ct as getChatroomHistoryMessages,ge as getConnectionStatus,Te as getConversationList,Ae as getConversationNotificationStatus,Bn as getConversationsFromTagByPage,me as getCurrentUserId,Yt as getFileToken,Qt as getFileUrl,Tn as getFirstUnreadMessage,rn as getHistoryMessages,yn as getMessage,Sn as getMessageReader,sn as getRemoteHistoryMessages,fe as getServerTime,Pn as getTags,Ln as getTagsFromConversation,ye as getTextMessageDraft,Pe as getTopConversationList,Ue as getTotalUnreadCount,ke as getUltraGroupList,Fe as getUltraGroupMessageListByMessageUId,Xe as getUltraGroupUnreadMentionedCountByTargetId,Oe as getUnreadCount,Fn as getUnreadCountByTag,Le as getUnreadMentionedCount,Rn as getUnreadMentionedMessages,ce as init,En as insertMessage,de as installPlugin,We as joinChatRoom,Ye as joinExistChatRoom,Ke as modifyMessage,he as onceEventListener,Qe as quitChatRoom,fn as recallMessage,Cn as registerMessageType,ze as removeAllExpansionForUltraGroupMessage,at as removeChatRoomEntries,ot as removeChatRoomEntry,Ee as removeConversation,Dn as removeConversationsFromTag,ve as removeEventListener,Ie as removeEventListeners,Ve as removeExpansionForUltraGroupMessage,vn as removeMessageExpansionForKey,xn as removeTag,Hn as removeTagFromConversations,kn as removeTagsFromConversation,Re as saveTextMessageDraft,Mn as searchConversationByContent,Nn as searchMessages,tn as sendFileMessage,on as sendHQVoiceMessage,nn as sendImageMessage,$t as sendMessage,cn as sendReadReceiptMessage,dn as sendReadReceiptRequest,un as sendReadReceiptResponse,ln as sendReadReceiptResponseV2,an as sendSightMessage,gn as sendSyncReadStatusMessage,Zt as sendTextMessage,In as sendTypingStatusMessage,Be as sendUltraGroupTypingStatus,et as setChatRoomEntries,Ze as setChatRoomEntry,we as setConversationNotificationStatus,be as setConversationToTop,qn as setConversationToTopInTag,wn as setMessageReceivedStatus,qe as updateExpansionForUltraGroupMessage,hn as updateMessageExpansion,bn as updateTag};
|