@rongcloud/imlib-next 5.0.0 → 5.0.1-custom-qihoo.4
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.d.ts +38 -13
- package/dist/index.esm.js +2 -2
- package/dist/index.js +1 -1
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -298,7 +298,14 @@ interface IAReceivedConversation {
|
|
|
298
298
|
* 会话是否置顶
|
|
299
299
|
*/
|
|
300
300
|
isTop?: boolean;
|
|
301
|
+
/**
|
|
302
|
+
* 多组织 ID
|
|
303
|
+
*/
|
|
301
304
|
channelId?: string;
|
|
305
|
+
/**
|
|
306
|
+
* @ 消息未读数
|
|
307
|
+
*/
|
|
308
|
+
unreadMentionedCount?: number;
|
|
302
309
|
}
|
|
303
310
|
interface ISendMessageOptions {
|
|
304
311
|
/**
|
|
@@ -362,6 +369,10 @@ interface ISendMessageOptions {
|
|
|
362
369
|
* 移动端推送配置
|
|
363
370
|
*/
|
|
364
371
|
pushConfig?: IPushConfig;
|
|
372
|
+
/**
|
|
373
|
+
* 消息的客户端标识
|
|
374
|
+
*/
|
|
375
|
+
messageId?: string;
|
|
365
376
|
}
|
|
366
377
|
interface IInsertOptions {
|
|
367
378
|
/**
|
|
@@ -385,12 +396,17 @@ interface IUserInfo {
|
|
|
385
396
|
name?: string;
|
|
386
397
|
/**
|
|
387
398
|
* 用户头像地址
|
|
399
|
+
* @deprecated
|
|
388
400
|
*/
|
|
389
401
|
portraitUri?: string;
|
|
390
402
|
/**
|
|
391
403
|
* user info 中附加信息
|
|
392
404
|
*/
|
|
393
405
|
extra?: string;
|
|
406
|
+
/**
|
|
407
|
+
* 用户头像地址
|
|
408
|
+
*/
|
|
409
|
+
portrait?: string;
|
|
394
410
|
};
|
|
395
411
|
}
|
|
396
412
|
interface IExtraData {
|
|
@@ -492,6 +508,15 @@ declare function setConversationToTop(options: IConversationOption, isTop?: bool
|
|
|
492
508
|
* 获取置顶会话
|
|
493
509
|
*/
|
|
494
510
|
declare function getTopConversationList(): Promise<IAsyncRes<IBaseConversationInfo[]>>;
|
|
511
|
+
/**
|
|
512
|
+
* 获取单个群会话 @ 消息未读数
|
|
513
|
+
* @param targetId 目标 ID
|
|
514
|
+
*/
|
|
515
|
+
declare function getUnreadMentionedCount(options: IConversationOption): Promise<IAsyncRes<number>>;
|
|
516
|
+
/**
|
|
517
|
+
* 获取所有群会话 @ 消息未读数
|
|
518
|
+
*/
|
|
519
|
+
declare function getAllUnreadMentionedCount(): Promise<IAsyncRes<number>>;
|
|
495
520
|
|
|
496
521
|
/**
|
|
497
522
|
* 加入聊天室
|
|
@@ -592,7 +617,7 @@ declare class BaseMessage<T = any> {
|
|
|
592
617
|
readonly isCounted: boolean;
|
|
593
618
|
constructor(messageType: string, content: T, isPersited?: boolean, isCounted?: boolean);
|
|
594
619
|
}
|
|
595
|
-
declare type
|
|
620
|
+
declare type MessageConstructor<T> = new (content: T) => BaseMessage<T>;
|
|
596
621
|
|
|
597
622
|
/**
|
|
598
623
|
* 群组内的消息包含的 @ 数据
|
|
@@ -624,7 +649,7 @@ interface IImageMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
|
624
649
|
*/
|
|
625
650
|
imageUri: string;
|
|
626
651
|
}
|
|
627
|
-
declare const _default$a:
|
|
652
|
+
declare const _default$a: MessageConstructor<IImageMessageBody>;
|
|
628
653
|
|
|
629
654
|
interface IHQVoiceMessageBody extends IUserInfo, IExtraData, IMentionedInfo {
|
|
630
655
|
/**
|
|
@@ -640,7 +665,7 @@ interface IHQVoiceMessageBody extends IUserInfo, IExtraData, IMentionedInfo {
|
|
|
640
665
|
*/
|
|
641
666
|
duration: number;
|
|
642
667
|
}
|
|
643
|
-
declare const _default$9:
|
|
668
|
+
declare const _default$9: MessageConstructor<IHQVoiceMessageBody>;
|
|
644
669
|
|
|
645
670
|
interface ISightMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
646
671
|
/**
|
|
@@ -665,7 +690,7 @@ interface ISightMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
|
665
690
|
*/
|
|
666
691
|
name: string;
|
|
667
692
|
}
|
|
668
|
-
declare const _default$8:
|
|
693
|
+
declare const _default$8: MessageConstructor<ISightMessageBody>;
|
|
669
694
|
|
|
670
695
|
/**
|
|
671
696
|
* 文本消息
|
|
@@ -676,7 +701,7 @@ interface ITextMessageBody extends IUserInfo, IExtraData, IMentionedInfo {
|
|
|
676
701
|
*/
|
|
677
702
|
content: string;
|
|
678
703
|
}
|
|
679
|
-
declare const _default$7:
|
|
704
|
+
declare const _default$7: MessageConstructor<ITextMessageBody>;
|
|
680
705
|
|
|
681
706
|
interface ICombineMessageBody extends IExtraData, IUserInfo {
|
|
682
707
|
/**
|
|
@@ -696,7 +721,7 @@ interface ICombineMessageBody extends IExtraData, IUserInfo {
|
|
|
696
721
|
*/
|
|
697
722
|
conversationType: ConversationType;
|
|
698
723
|
}
|
|
699
|
-
declare const _default$6:
|
|
724
|
+
declare const _default$6: MessageConstructor<ICombineMessageBody>;
|
|
700
725
|
|
|
701
726
|
interface IFileMessageBody extends IExtraData, IUserInfo {
|
|
702
727
|
/**
|
|
@@ -716,7 +741,7 @@ interface IFileMessageBody extends IExtraData, IUserInfo {
|
|
|
716
741
|
*/
|
|
717
742
|
fileUrl: string;
|
|
718
743
|
}
|
|
719
|
-
declare const _default$5:
|
|
744
|
+
declare const _default$5: MessageConstructor<IFileMessageBody>;
|
|
720
745
|
|
|
721
746
|
interface IGIFMessageBody extends IExtraData, IUserInfo {
|
|
722
747
|
/**
|
|
@@ -736,14 +761,14 @@ interface IGIFMessageBody extends IExtraData, IUserInfo {
|
|
|
736
761
|
*/
|
|
737
762
|
height: number;
|
|
738
763
|
}
|
|
739
|
-
declare const _default$4:
|
|
764
|
+
declare const _default$4: MessageConstructor<IGIFMessageBody>;
|
|
740
765
|
|
|
741
766
|
interface IVoiceMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
742
767
|
content: string;
|
|
743
768
|
duration: number;
|
|
744
769
|
extra: string;
|
|
745
770
|
}
|
|
746
|
-
declare const _default$3:
|
|
771
|
+
declare const _default$3: MessageConstructor<IVoiceMessageBody>;
|
|
747
772
|
|
|
748
773
|
interface ILocationMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
749
774
|
/**
|
|
@@ -763,7 +788,7 @@ interface ILocationMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
|
763
788
|
*/
|
|
764
789
|
content: string;
|
|
765
790
|
}
|
|
766
|
-
declare const _default$2:
|
|
791
|
+
declare const _default$2: MessageConstructor<ILocationMessageBody>;
|
|
767
792
|
|
|
768
793
|
interface IReferenceMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
769
794
|
/**
|
|
@@ -783,7 +808,7 @@ interface IReferenceMessageBody extends IExtraData, IMentionedInfo, IUserInfo {
|
|
|
783
808
|
*/
|
|
784
809
|
objName: string;
|
|
785
810
|
}
|
|
786
|
-
declare const _default$1:
|
|
811
|
+
declare const _default$1: MessageConstructor<IReferenceMessageBody>;
|
|
787
812
|
|
|
788
813
|
interface IArticle {
|
|
789
814
|
title: string;
|
|
@@ -793,7 +818,7 @@ interface IArticle {
|
|
|
793
818
|
}
|
|
794
819
|
interface IRichContentMessageBody extends IArticle, IExtraData, IMentionedInfo, IUserInfo {
|
|
795
820
|
}
|
|
796
|
-
declare const _default:
|
|
821
|
+
declare const _default: MessageConstructor<IRichContentMessageBody>;
|
|
797
822
|
|
|
798
823
|
/**
|
|
799
824
|
* 发送消息
|
|
@@ -1203,4 +1228,4 @@ declare const MessageType: {
|
|
|
1203
1228
|
RECALL_MESSAGE_TYPE: string;
|
|
1204
1229
|
};
|
|
1205
1230
|
|
|
1206
|
-
export { BaseMessage, _default$6 as CombineMessage, ConnectType, Events, _default$5 as FileMessage, _default$4 as GIFMessage, GetHistoryMessageOption, GetHistoryMessageResult, _default$9 as HQVoiceMessage, IAReceivedConversation, IAReceivedMessage, ICombineMessageBody, IConversationUpdateItem, IFileMessageBody, IGIFMessageBody, IHQVoiceMessageBody, IImageMessageBody, IInitOption, ILocationMessageBody, IReceivedUpdateConversation, IReferenceMessageBody, IRichContentMessageBody, ISendMessageOptions, ISightMessageBody, ITextMessageBody, IVoiceMessageBody, _default$a as ImageMessage, _default$2 as LocationMessage, MentionedInfo$1 as MentionedInfo, MessageType, _default$1 as ReferenceMessage, _default as RichContentMessage, _default$8 as SightMessage, _default$7 as TextMessage, _default$3 as VoiceMessage, addConversationsToTag, addEventListener, addTag, clearEventListeners, clearHistoryMessages, clearMessages, clearMessagesUnreadStatus, clearTextMessageDraft, clearUnreadCountByTimestamp, connect, deleteLocalMessagesByTimestamp, deleteMessages, disconnect, forceRemoveChatRoomEntry, forceSetChatRoomEntry, getAllChatRoomEntries, getBlockedConversationList, getChatRoomEntry, getChatRoomInfo, getChatroomHistoryMessages, getConnectionStatus, getConversationList, getConversationNotificationStatus, getConversationsFromTagByPage, getCurrentUserId, getFileToken, getFileUrl, getFirstUnreadMessage, getHistoryMessages, getMessage, getMessageReader, getRemoteHistoryMessages, getServerTime, getTags, getTagsFromConversation, getTextMessageDraft, getTopConversationList, getTotalUnreadCount, getUnreadCount, getUnreadCountByTag, getUnreadMentionedMessages, init, insertMessage, installPlugin, joinChatRoom, joinExistChatRoom, onceEventListener, quitChatRoom, recallMessage, registerMessageType, removeChatRoomEntries, removeChatRoomEntry, removeConversation, removeConversationsFromTag, removeEventListener, removeEventListeners, removeMessageExpansionForKey, removeTag, removeTagFromConversations, removeTagsFromConversation, saveTextMessageDraft, searchConversationByContent, searchMessages, sendFileMessage, sendHQVoiceMessage, sendImageMessage, sendMessage, sendReadReceiptMessage, sendReadReceiptRequest, sendReadReceiptResponse, sendSightMessage, sendSyncReadStatusMessage, sendTextMessage, sendTypingStatusMessage, setChatRoomEntries, setChatRoomEntry, setConversationNotificationStatus, setConversationToTop, setConversationToTopInTag, setMessageReceivedStatus, updateMessageExpansion, updateTag };
|
|
1231
|
+
export { BaseMessage, _default$6 as CombineMessage, ConnectType, Events, _default$5 as FileMessage, _default$4 as GIFMessage, GetHistoryMessageOption, GetHistoryMessageResult, _default$9 as HQVoiceMessage, IAReceivedConversation, IAReceivedMessage, ICombineMessageBody, IConversationUpdateItem, IFileMessageBody, IGIFMessageBody, IHQVoiceMessageBody, IImageMessageBody, IInitOption, ILocationMessageBody, IReceivedUpdateConversation, IReferenceMessageBody, IRichContentMessageBody, ISendMessageOptions, ISightMessageBody, ITextMessageBody, IVoiceMessageBody, _default$a as ImageMessage, _default$2 as LocationMessage, MentionedInfo$1 as MentionedInfo, MessageConstructor, MessageType, _default$1 as ReferenceMessage, _default as RichContentMessage, _default$8 as SightMessage, _default$7 as TextMessage, _default$3 as VoiceMessage, addConversationsToTag, addEventListener, addTag, clearEventListeners, clearHistoryMessages, clearMessages, clearMessagesUnreadStatus, clearTextMessageDraft, clearUnreadCountByTimestamp, connect, deleteLocalMessagesByTimestamp, deleteMessages, disconnect, forceRemoveChatRoomEntry, forceSetChatRoomEntry, getAllChatRoomEntries, getAllUnreadMentionedCount, getBlockedConversationList, getChatRoomEntry, getChatRoomInfo, getChatroomHistoryMessages, getConnectionStatus, getConversationList, getConversationNotificationStatus, getConversationsFromTagByPage, getCurrentUserId, getFileToken, getFileUrl, getFirstUnreadMessage, getHistoryMessages, getMessage, getMessageReader, getRemoteHistoryMessages, getServerTime, getTags, getTagsFromConversation, getTextMessageDraft, getTopConversationList, getTotalUnreadCount, getUnreadCount, getUnreadCountByTag, getUnreadMentionedCount, getUnreadMentionedMessages, init, insertMessage, installPlugin, joinChatRoom, joinExistChatRoom, onceEventListener, quitChatRoom, recallMessage, registerMessageType, removeChatRoomEntries, removeChatRoomEntry, removeConversation, removeConversationsFromTag, removeEventListener, removeEventListeners, removeMessageExpansionForKey, removeTag, removeTagFromConversations, removeTagsFromConversation, saveTextMessageDraft, searchConversationByContent, searchMessages, sendFileMessage, sendHQVoiceMessage, sendImageMessage, sendMessage, sendReadReceiptMessage, sendReadReceiptRequest, sendReadReceiptResponse, sendSightMessage, sendSyncReadStatusMessage, sendTextMessage, sendTypingStatusMessage, setChatRoomEntries, setChatRoomEntry, setConversationNotificationStatus, setConversationToTop, setConversationToTopInTag, setMessageReceivedStatus, updateMessageExpansion, updateTag };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Logger as e,WebSocketChannel as t,CometChannel as n,HttpMethod as o,appendUrl as a,ErrorCode as r,ReceivedStatus as
|
|
1
|
+
import{Logger as e,WebSocketChannel as t,CometChannel as n,HttpMethod as o,appendUrl as a,ErrorCode as r,ReceivedStatus as i,assert as s,isArray as c,isHttpUrl as d,CONNECTION_TYPE as u,APIContext as l,EventEmitter as g,AssertRules as f,isValidConversationType as m,usingCppEngine as h,isString as p,UploadMethod as v,FileType as I,isValidFileType as S,MessageDirection as C,ConversationType as T,VersionManage as E}from"@rongcloud/engine";export{ConnectionStatus,ConversationType,ErrorCode,LogLevel,MentionedType,MessageDirection,NotificationStatus,ReceivedStatus,UploadMethod}from"@rongcloud/engine";
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -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)};function R(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 N(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 w=new e("RCIM"),O=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=O();var U,_={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||w.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:M,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=O(),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){w.error(e)}}},A={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},P={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:A,sessionStorage:A,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)}},L=O(),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){w.error(e)}}},H={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},k={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:H,sessionStorage:H,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},G=O(),B=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){w.error(e)}}},q={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},F={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:G,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)}},V=O(),z=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){w.error(e)}}},K={setItem:z("setStorageSync"),getItem:z("getStorageSync"),removeItem:z("removeStorageSync"),clear:z("clearStorageSync")},X={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:V,localStorage:K,sessionStorage:K,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){w.error(e)}}},W={setItem:j("setStorageSync"),getItem:j("getStorageSync"),removeItem:j("removeStorageSync"),clear:j("clearStorageSync")},J={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)}},Y=function(e){return e&&e.canIUse&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return J;case"mp-baidu":return X;case"mp-toutiao":return F;case"mp-alipay":return k;case"mp-weixin":return P;default:return _}}():"undefined"!=typeof wx&&Y(wx)?P:"undefined"!=typeof my&&Y(my)?k:"undefined"!=typeof tt&&Y(tt)?F:"undefined"!=typeof swan&&Y(swan)?X:_;function $(e){var t=e.conversationType,n=e.channelId,o=e.messageType,a=e.content,r=e.senderUserId,i=e.targetId,c=e.sentTime,d=e.receivedTime,u=e.messageUId,l=e.messageDirection,g=e.isPersited,f=e.isCounted,m=e.isOffLineMessage,p=e.canIncludeExpansion,h=e.expansion,v=e.receivedStatus,I=e.disableNotification,S=e.isMentioned,C=e.isStatusMessage,T=e.readReceiptInfo,E=e.pushConfig,y=e.messageId;return v||(v=s.UNREAD),{messageType:o,channelId:n||"",content:a,senderUserId:r,targetId:i,conversationType:t,sentTime:c,receivedTime:d,messageUId:u,messageDirection:l,isPersited:g,isCounted:f,isOffLineMessage:m,isMentioned:S,disableNotification:I,isStatusMessage:C,canIncludeExpansion:p,expansion:h,receivedStatus:v,readReceiptInfo:T,pushConfig:E,messageId:y}}!function(e){e.CONNECTING="connecting",e.CONNECTED="connected",e.DISCONNECT="disconnect",e.SUSPEND="suspend",e.MESSAGES="messages",e.READ_RECEIPT_RECEIVED="readReceiptReceived",e.MESSAGE_RECEIPT_REQUEST="messageReceiptRequest",e.MESSAGE_RECEIPT_RESPONSE="messageReceiptResponse",e.CONVERSATION="conversation",e.CHATROOM="chatroom",e.EXPANSION="expansion",e.PULL_OFFLINE_MESSAGE_FINISHED="pullOfflineMessageFinished",e.TAG="tag",e.CONVERSATION_TAG="conversationTag",e.TYPING_STATUS="typingStatus"}(U||(U={}));var Z,ee=function(e){function t(n){var o=e.call(this)||this;if(t.imClient)return w.error("Please do not repeatedly perform the init method"),t.imClient;i("options.navigators",n.navigators,(function(e){return c(e)&&(0===e.length||e.every(d))}));var a=null==n?void 0:n.connectType;return a?u.WEBSOCKET!==a&&u.COMET!==a&&(w.warn("RongIMLib connectionType must be "+u.WEBSOCKET+" or "+u.COMET),a=u.WEBSOCKET):a=u.WEBSOCKET,o._context=l.init(Q,{appkey:n.appkey,apiVersion:"5.0.0",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(U.CONNECTING)},onConnected:function(){e.emit(U.CONNECTED)},onDisconnect:function(){e.emit(U.DISCONNECT)},onSuspend:function(){e.emit(U.SUSPEND)},batchMessage:function(t){e.emit(U.MESSAGES,{messages:t.map((function(e){return $(e)}))})},typingState:function(t){e.emit(U.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,o){e.emit(U.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:o})},messageReceiptRequest:function(t,n){e.emit(U.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n})},messageReceiptResponse:function(t,n,o){e.emit(U.MESSAGE_RECEIPT_RESPONSE,{conversation:t,messageUId:n,responseUserIdList:o})},conversationState:function(t){var n=t.map((function(e){return{conversation:{conversationType:e.conversationType,latestMessage:e.latestMessage?$(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},updatedItems:e.updatedItems}}));e.emit(U.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(U.CHATROOM,t)},expansion:function(t){e.emit(U.EXPANSION,t)},pullFinished:function(){e.emit(U.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(U.TAG)},conversationTagChanged:function(){e.emit(U.CONVERSATION_TAG)}};this.context.assignWatcher(t)},t}(g),te={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!"}},ne={},oe={};for(var ae in te){var re=te[ae],se=re.code;ne[se]=ae,oe[se]=re}te.ROAMING_SERVICE_UNAVAILABLE.code;var ie=function(e){Z=Z||new ee(e)};function ce(e,t){return null==Z?void 0:Z.context.install(e,t)}function de(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return i("token",e,f.STRING,!0),w.warn("RongIMLib Version: 5.0.0, Commit: 019e19653dc18624c42c1461cffbcf70dcb5c317"),[4,Z.context.connect(e,!0)];case 1:return(t=n.sent()).code===r.SUCCESS?[2,{code:t.code,data:{userId:t.userId}}]:[2,{code:t.code,msg:ne[t.code]}]}}))}))}function ue(){return Z.context.disconnect()}function le(){return Z.context.getConnectionStatus()}function ge(){return Z.context.getServerTime()}function fe(){return Z.context.getCurrentUserId()}function me(e,t,n){Z.on(e,t,n)}function pe(e,t,n){Z.once(e,t,n)}function he(e,t,n){Z.off(e,t,n)}function ve(e){Z.removeAll(e)}function Ie(){Z.clear()}function Se(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s;return N(this,(function(i){switch(i.label){case 0:return w.debug("get conversation list ->"),[4,ee.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;return{conversationType:t,targetId:n,latestMessage:o&&$(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}}(e)})),[2,{code:0,data:s}]):(w.warn("get conversation list fail ->"+o+":"+ne[o]),[2,{code:o,msg:ne[o]}])}}))}))}function Ce(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.removeConversation(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("destroy conversation ->"+n),t!==r.SUCCESS?(w.warn("destroy conversation fail ->"+t+":"+ne[t]+","+n),[2,{code:t,msg:ne[t]}]):[2,{code:t}]}}))}))}function Te(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return N(this,(function(s){switch(s.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.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,w.debug("get draft ->"+a),n===r.SUCCESS?[2,{code:n,data:o||""}]:(w.warn("get draft fail ->"+n+":"+ne[n]+","+a),[2,{code:n,msg:ne[n]}])}}))}))}function Ee(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),i("draft",t,f.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set draft ->"+n),[4,ee.imClient.context.saveConversationMessageDraft(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(w.warn("set draft fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}])}}))}))}function ye(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),t="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("delete draft ->"+t),[4,ee.imClient.context.clearConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("delete draft fail ->"+n+":"+ne[n]+","+t),[2,{code:n,msg:ne[n]}])}}))}))}function Re(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c,d;return N(this,(function(u){switch(u.label){case 0:if(w.debug("get total unread count -> ConversationType:"+JSON.stringify(t)+" includeMuted:"+e),i("includeMuted",e,f.BOOLEAN,!1),i("conversationTypes",t,f.ARRAY,!1),t)for(n=0,o=t;n<o.length;n++)a=o[n],i("conversationType",a,m);return[4,ee.imClient.context.getTotalUnreadCount("",t,e)];case 1:return s=u.sent(),c=s.code,d=s.data,c===r.SUCCESS?[2,{code:c,data:d}]:(w.warn("getTotalUnreadCount fail ->"+c+":"+ne[c]),[2,{code:c,msg:ne[c]}])}}))}))}function Ne(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return N(this,(function(s){switch(s.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.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,w.debug("get unreadCount ->"+a),n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("get unreadCount fail ->"+n+":"+ne[n]+","+a),[2,{code:n,msg:ne[n]}])}}))}))}function we(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.clearUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("clear unreadMsgNum ->"+n),t!==r.SUCCESS?(w.warn("clear unreadMsgNum fail ->"+t+":"+ne[t]+","+n),[2,{code:t,msg:ne[t]}]):[2,{code:t}]}}))}))}function Oe(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),i("notificationStatus",t,(function(e){return 1===e||2===e}),!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set conversation status ->"+n),[4,ee.imClient.context.setConversationStatus(e.conversationType,e.targetId,void 0,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set conversation status fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Me(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return p()?(i("options.conversationType",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),w.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.getConversationNotificationStatus(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("getConversationNotificationStatus ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function Ue(){return R(this,void 0,void 0,(function(){var e,t,n;return N(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function _e(e,t){return void 0===t&&(t=!0),R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options.type",e.conversationType,m,!0),i("options.targetId",e.targetId,f.STRING,!0),i("options.channelId",e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set conversation status ->"+n),[4,ee.imClient.context.setConversationStatus(e.conversationType,e.targetId,t,void 0,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set conversation status fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function xe(){return R(this,void 0,void 0,(function(){var e,t,n;return N(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}var be=function(e){i("options.key",e.key,f.STRING,!0),i("options.value",e.value,f.STRING,!0),i("options.isAutoDelete",e.isAutoDelete,f.BOOLEAN),i("options.isSendNotification",e.isSendNotification,f.BOOLEAN),i("options.notificationExtra",e.notificationExtra,f.STRING)},Ae=function(e){i("options.key",e.key,f.STRING,!0),i("options.isSendNotification",e.isSendNotification,f.BOOLEAN),i("options.notificationExtra",e.notificationExtra,f.STRING)};function Pe(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options.count",t.count,f.NUMBER,!0),n="id:"+e,w.debug("join chatroom ->"+n),[4,ee.imClient.context.joinChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("join chatroom fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Le(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options.count",t.count,f.NUMBER,!0),n="id:"+e,w.debug("join exist chatroom ->"+n),[4,ee.imClient.context.joinExistChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("join exist chatroom fail ->code:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function De(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return t="id:"+e,w.debug("quit chatroom ->"+t),[4,ee.imClient.context.quitChatroom(e)];case 1:return(n=o.sent())!==r.SUCCESS?(w.warn("quit chatroom fail ->code+:"+ne[n]+","+t),[2,{code:n,msg:ne[n]}]):[2,{code:n}]}}))}))}function He(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s;return N(this,(function(c){switch(c.label){case 0:return i("options.count",t.count,f.NUMBER),i("options.order",t.order,(function(e){return[0,1,2].includes(e)})),n="id:"+e,w.debug("get chatroom info ->"+n),[4,ee.imClient.context.getChatroomInfo(e,t.count,t.order)];case 1:return o=c.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?[2,{code:a,data:s}]:(w.warn("get chatroom info fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function ke(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("targetId",e,f.STRING,!0),be(t),n="id:"+e,w.debug("set chatroom entry->"+n),[4,ee.imClient.context.setChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Ge(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s;return N(this,(function(c){switch(c.label){case 0:return i("targetId",e,f.STRING,!0),function(e){e.entries.forEach((function(e){i("entry.key",e.key,f.STRING,!0),i("entry.value",e.value,f.STRING,!0)})),i("options.isAutoDelete",e.isAutoDelete,f.BOOLEAN),i("options.notificationExtra",e.notificationExtra,f.STRING)}(t),t.entries.length>10?[2,te.CHATROOM_KV_STORE_OUT_LIMIT]:(n="id:"+e,w.debug("set chatroom entry->"+n),[4,ee.imClient.context.setChatroomEntries(e,t)]);case 1:return o=c.sent(),a=o.code,s=o.data,a!==r.SUCCESS?(w.warn("set chatroom entry fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a],data:s}]):[2,{code:a}]}}))}))}function Be(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("targetId",e,f.STRING,!0),be(t),n="id:"+e,w.debug("force set chatroom entry ->"+n),[4,ee.imClient.context.forceSetChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("force set chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function qe(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("targetId",e,f.STRING,!0),Ae(t),n="id:"+e,w.debug("remove chatroom entry->"+n),[4,ee.imClient.context.removeChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("remove chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Fe(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("targetId",e,f.STRING,!0),function(e){e.entries.forEach((function(e){i("key",e,f.STRING,!0)})),i("options.notificationExtra",e.notificationExtra,f.STRING)}(t),n="id:"+e,w.debug("remove chatroom entry->"+n),(o=Object.assign({},t)).entries=t.entries.map((function(e){return{key:e}})),[4,ee.imClient.context.removeChatroomEntries(e,o)];case 1:return a=d.sent(),s=a.code,c=a.data,s!==r.SUCCESS?(w.warn("remove chatroom entry fail ->code+:"+ne[s]+","+n),[2,{code:s,msg:ne[s],data:c}]):[2,{code:s}]}}))}))}function Ve(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("targetId",e,f.STRING,!0),Ae(t),n="id:"+e,w.debug("force remove chatroom entry ->"+n),[4,ee.imClient.context.forceRemoveChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("force remove chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function ze(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s;return N(this,(function(c){switch(c.label){case 0:return i("key",t,(function(e){return h(e)&&/[\w+=-]+/.test(e)&&e.length<=128}),!0),n="id:"+e,w.debug("get chatroom entry->"+n),[4,ee.imClient.context.getChatroomEntry(e,t)];case 1:return o=c.sent(),a=o.code,s=o.data,a===r.SUCCESS&&s?[2,{code:a,data:s}]:(w.warn("get chatroom entry fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function Ke(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return N(this,(function(s){switch(s.label){case 0:return t="id:"+e,w.debug("get all chatroom entries->"+t),[4,ee.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}]:(w.warn("get all chatroom entries fail ->code+:"+ne[o]+","+t),[2,{code:o,msg:ne[o]}])}}))}))}function Xe(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("options.timestamp",t.timestamp,f.NUMBER),i("options.count",t.count,f.NUMBER),i("options.order",t.order,(function(e){return 0===e||1===e})),n="id:"+e,w.debug("get chatroom history message->"+n),[4,ee.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?(c=s.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:!!s.hasMore}}]):(w.warn("get chatroom history message fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}var je=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 We(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new je(e,o,t,n)}}var Je,Ye,Qe=We("RC:ImgMsg"),$e=We("RC:HQVCMsg"),Ze=We("RC:SightMsg"),et=We("RC:TxtMsg"),nt=We("RC:CombineMsg"),ot=We("RC:FileMsg"),at=We("RC:GIFMsg"),rt=We("RC:VcMsg"),st=We("RC:LBSMsg"),it=We("RC:ReferenceMsg"),ct=We("RC:ImgTextMsg"),dt={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=ft()+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=v?v.QINIU:"",200===s.status?n.onCompleted(a):ut.length?dt[ut[0][0]](e,t,n,o):n.onError("upload fail")}},t.isChunk&&(a=function(e,t){var n="";gt(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);gt(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>lt)throw new Error("the file size is over 5GB!");var a=t||{};t=t||Ye;var r=new XMLHttpRequest,s=ft();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?dt[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>lt)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||Je,t=(t=t||{})||Ye;var s=new XMLHttpRequest,i=ft()+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=v?v.ALI:"",200===s.status?n.onCompleted(e):ut.length?dt[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=ft();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=v.AWS,console.log("UploadMethod:",v),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")),dt[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;ft();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=v?v.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")),dt[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=[],lt=5368709120;function gt(e,t){for(var n in e)t(n,e[n])}function ft(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function mt(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";ee.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)ee.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=v.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;ee.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 pt={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=ht()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),vt(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=ht()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,vt(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function ht(){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 vt(e,t){for(var n in e)t(n,e[n])}var It,St=0;function Ct(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:pt.form,genUId:ht};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;vt(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(Je=e,Ye=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)mt(e,t,n);else{var r=t.data(e,t);dt[ut[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(It=e,o){It=St+e/n*(n-St)}else St=It;t.onProgress(It,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 Tt={init:function(e){return new Ct(e)},dataType:pt,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 Et=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)},yt=function(e,t){var n=e.file,o=e.compress;Et(n,o,t)},Rt=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=Tt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=Tt.init(e);t(n)}};var Nt,wt,Ot=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||yt;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},Mt=function(e){var t=this;this.instance=e,this.upload=function(e,n){Ot({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},Ut=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};Ot(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},_t=function(e,t){Rt(e,(function(n){var o={maxHeight:e.height||160,maxWidth:e.width||160,quality:e.quality||.5,scale:e.scale||2.4},a=new Ut(n,o);t(a)}))},xt=function(e,t){Rt(e,(function(e){var n=new Mt(e);t(n)}))},bt=_t;Tt.dataType;function At(e){return Nt=Nt||new AudioContext,new Promise((function(t,n){Nt.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Pt(e,t,n,o){return new Promise((function(a){ee.imClient.context.getFileToken(e,t,n,o).then((function(e){a({code:r.SUCCESS,data:e})})).catch((function(e){a({code:e,msg:ne[e]})}))}))}function Lt(e,t,n,o,a){return i("fileType",e,S,!0),i("filename",t,f.STRING),i("saveName",n,f.STRING),i("serverType",a,f.NUMBER),new Promise((function(s){ee.imClient.context.getFileUrl(e,t,n,o,a).then((function(e){s({code:r.SUCCESS,data:e})})).catch((function(e){s({code:e})}))}))}function Dt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,c,d,u,l;return N(this,(function(g){switch(g.label){case 0:return n=n||{},t instanceof je==!1?(w.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,te.ILLGAL_PARAMS]):(i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),o="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("send message ->"+o),(a=Object.assign(n,t)).channelId=e.channelId?e.channelId:a.channelId,[4,ee.imClient.context.sendMessage(e.conversationType,e.targetId,a)]);case 1:return c=g.sent(),d=c.code,u=c.data,d===r.SUCCESS?(l=$(u),[2,{code:d,data:l}]):(w.warn("send message fail ->"+d+":"+ne[d]+","+o),[2,{code:d,msg:ne[d],data:$({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:ee.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:C.SEND,isOffLineMessage:!1,sentTime:(null==u?void 0:u.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:s.UNREAD})}])}}))}))}function Ht(e,t,n){return Dt(e,new et(t),n)}function kt(e,t){return function(n,o,a,s){return new Promise((function(i){!function(e,t,n){var o,a=this;if(void 0===t&&(t=I.FILE),o=t===I.IMAGE?I.IMAGE:I.FILE,!wt){wt="upload.qiniup.com";var r=ee.imClient.context.getInfoFromCache();if(r&&r.ossConfig)try{var s=JSON.parse(r.ossConfig).find((function(e){return void 0!==e.qiniu}));s&&(wt=s.qiniu)}catch(e){}}var i={domain:wt,getToken:function(e){ee.imClient.context.getFileToken(o).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}};(o===I.IMAGE?bt:xt)(i,(function(r){r.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(r){return R(a,void 0,void 0,(function(){var a=this;return N(this,(function(s){return Lt(o,r.filename,r.name,r,r.uploadMethod).then((function(s){return R(a,void 0,void 0,(function(){var a,i;return N(this,(function(c){return 0!==s.code?(n.onFail(s),[2]):((a=s.data).type=e.type,a.name=r.name||r.filename,t===I.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(At).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):((i=new FileReader).onload=function(){i.result?At(i.result).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):n.onSuccess(a)},i.onerror=function(){a.duration=0,n.onSuccess(a)},i.readAsArrayBuffer(e)),[2]):(o===I.IMAGE&&(a.thumbnail=r.thumbnail),n.onSuccess(a),[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);Dt(n,c,s).then(i)},onFail:function(e){i({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}})}))}}var Gt=kt(I.FILE,(function(e,t){return new ot({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),Bt=kt(I.IMAGE,(function(e,t){return new Qe({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),qt=kt(I.AUDIO,(function(e,t){return new $e({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),Ft=kt(I.SIGHT,(function(e,t){return new Ze({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 Vt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("options.timestamp",null==t?void 0:t.timestamp,f.NUMBER),i("options.count",null==t?void 0:t.count,f.NUMBER),i("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get history message ->"+n),[4,ee.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?(c=s.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:s.hasMore}}]):(w.warn("get history message fail ->"+a+":"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function zt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("options.timestamp",null==t?void 0:t.timestamp,f.NUMBER),i("options.count",null==t?void 0:t.count,f.NUMBER),i("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get history message ->"+n),[4,ee.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?(c=s.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:s.hasMore}}]):(w.warn("get history message fail ->"+a+":"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function Kt(e,t,n,o){return R(this,void 0,void 0,(function(){var a,r,s,i,c;return N(this,(function(d){switch(d.label){case 0:return a={targetId:e,conversationType:T.PRIVATE,channelId:o},r=new je("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,Dt(a,r)];case 1:return s=d.sent(),i=s.code,c=s.msg,0===i?[2,{code:i}]:[2,{code:i,msg:c}]}}))}))}function Xt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,r,s,c;return N(this,(function(d){switch(d.label){case 0:return i("messageUId",t,f.STRING,!0),i("channelId",n,f.CHANNEL_ID),o="messageUId:"+t+",targetId:"+e,w.debug("send read receipt message ->"+o),a=new je("RC:RRReqMsg",{messageUId:t}),[4,Dt({targetId:e,conversationType:T.GROUP,channelId:n},a)];case 1:return r=d.sent(),s=r.code,c=r.msg,0===s?[2,{code:s}]:[2,{code:s,msg:c}]}}))}))}function jt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,s,c,d,u,l,g;return N(this,(function(m){switch(m.label){case 0:return i("targetId",e,f.STRING,!0),i("messageUIds",t,f.ARRAY,!0),i("channelId",n,f.CHANNEL_ID),o={targetId:e,conversationType:T.GROUP,channelId:n},s=ee.imClient.context.getInfoFromCache(),0!==(c=(null==s?void 0:s.grpRRVer)||0)?[3,2]:(d=ee.imClient.context.getCurrentUserId(),u=new je("RC:RRRspMsg",{receiptMessageDic:(g={},g[d]=t,g)}),[4,Dt(o,u)]);case 1:return a=m.sent(),[3,4];case 2:return 1!==c?[3,4]:[4,ee.imClient.context.sendReadReceiptMessage(e,t,n)];case 3:a=m.sent(),m.label=4;case 4:return(l=a.code)===r.SUCCESS?[2,{code:l}]:(w.warn("send read receipt message fail ->"+l+":"+ne[l]),[2,{code:l,msg:ne[l]}])}}))}))}function Wt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,r;return N(this,(function(s){switch(s.label){case 0:return i("conversation.type",e.conversationType,f.NUMBER,!0),i("conversation.targetId",e.targetId,f.STRING,!0),i("lastMessageSendTime",t,f.NUMBER,!0),i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n=new je("RC:SRSMsg",{lastMessageSendTime:t}),[4,Dt(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 Jt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("options.messageUId",t.messageUId,f.STRING,!0),i("options.sentTime",t.sentTime,f.NUMBER,!0),i("options.disableNotification",null==t?void 0:t.disableNotification,f.BOOLEAN),i("options.pushConfig",null==t?void 0:t.pushConfig,f.OBJECT),i("conversation.channelId",null==e?void 0:e.channelId,f.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,w.debug("recall message ->"+o),[4,ee.imClient.context.recallMessage(e.conversationType,e.targetId,t.messageUId,t.sentTime,n)];case 1:return a=d.sent(),s=a.code,c=a.data,s===r.SUCCESS&&c?[2,{code:s,data:$(c)}]:(w.warn("recall message fail ->"+s+":"+ne[s]+","+o),[2,{code:s,msg:ne[s]}])}}))}))}function Yt(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options",t,(function(e){return c(e)&&e.length}),!0),t.forEach((function(e){i("options.messageUId",e.messageUId,f.STRING,!0),i("options.sentTime",e.sentTime,f.NUMBER,!0),i("options.messageDirection",e.messageDirection,(function(e){return 1===e||2===e}),!0)})),i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("delete messages ->"+n),[4,ee.imClient.context.deleteRemoteMessage(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("delete message fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:r.SUCCESS}]}}))}))}function Qt(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return i("options.timestamp",t,f.NUMBER,!0),i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("clear message ->"+n),[4,ee.imClient.context.deleteRemoteMessageByTimestamp(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("clear message ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:r.SUCCESS}]}}))}))}function $t(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c,d,u,l;return N(this,(function(g){switch(g.label){case 0:return i("expansion",e,f.OBJECT,!0),i("message",t,f.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.canIncludeExpansion,c=t.expansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",messageUId:"+a,w.debug("update message expansion ->"+u),[4,ee.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,expansion:e,canIncludeExpansion:s,originExpansion:c,channelId:d})];case 1:return(l=g.sent().code)!==r.SUCCESS?(w.warn("update message expansion fail ->"+l+":"+ne[l]+","+u),[2,{code:l,msg:ne[l]}]):[2,{code:l}]}}))}))}function Zt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c,d,u;return N(this,(function(l){switch(l.label){case 0:return i("keys",e,f.ARRAY,!0),i("message",t,f.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,s=t.canIncludeExpansion,c=t.channelId,d="conversationType:"+n+",targetId:"+o+",messageUId:"+a,w.debug("remove message expansion ->"+d),[4,ee.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:s,keys:e,channelId:c})];case 1:return(u=l.sent().code)!==r.SUCCESS?(w.warn("remove message expansion fail ->"+u+":"+ne[u]+","+d),[2,{code:u,msg:ne[u]}]):[2,{code:u}]}}))}))}function en(e,t){return R(this,void 0,void 0,(function(){var n,o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("typingContentType",t,f.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("send typing status message ->"+n),o={messageType:"RC:TypSts",content:{typingContentType:t},isStatusMessage:!0,channelId:e.channelId},[4,ee.imClient.context.sendMessage(e.conversationType,e.targetId,o)];case 1:return a=d.sent(),s=a.code,c=a.data,s===r.SUCCESS?[2,{code:s,data:$(c)}]:(w.warn("send typing status message fail ->"+s+":"+ne[s]+","+n),[2,{code:s,msg:ne[s]}])}}))}))}function tn(e,t,n){return R(this,void 0,void 0,(function(){var o,a,s,c;return N(this,(function(d){switch(d.label){case 0:return i("messageUId",t,f.STRING,!0),o="messageUId:"+t+",targetId:"+e,w.debug("get message reader ->"+o),[4,ee.imClient.context.getMessageReader(e,t,n)];case 1:return a=d.sent(),s=a.code,c=a.data,s===r.SUCCESS?[2,{code:s,data:c}]:(w.warn("get message reader fail ->"+s+":"+ne[s]+","+o),[2,{code:s,msg:ne[s]}])}}))}))}function nn(e,t,n,o){return i("messageType",e,f.STRING,!0),i("isPersited",t,f.BOOLEAN,!0),i("isCounted",n,f.BOOLEAN,!0),ee.imClient.context.registerMessageType(e,t,n,o),We(e,t,n)}function on(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return p()?(i("conversation.conversationType",e.conversationType,f.NUMBER,!0),i("conversation.targetId",e.targetId,f.STRING,!0),i("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getFirstUnreadMessage(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("insertMessage ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function an(e,t,n){return void 0===n&&(n={}),R(this,void 0,void 0,(function(){var o,a,s,i,c,d,u,l,g,f,m,h,v,I,S,C;return N(this,(function(T){switch(T.label){case 0:return p()?(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,w.info("insertMessage ->targetId:"+e.targetId+",conversationType:"+e.conversationType),m=n.isUnread,h=n.searchContent,v={senderUserId:o,messageType:a,content:s,messageDirection:i,sentTime:g,sentStatus:f,searchContent:h,isUnread:m,messageUId:c,disableNotification:l,canIncludeExpansion:d,expansionMsg:JSON.stringify(u),channelId:e.channelId||""},[4,ee.imClient.context.insertMessage(e.conversationType,e.targetId,v)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return I=T.sent(),S=I.code,C=I.data,S===r.SUCCESS?[2,{code:S,data:$(C)}]:(w.warn("insertMessage ->code:"+S+",targetId:"+e.targetId),[2,{code:S,msg:ne[S]}])}}))}))}function rn(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return p()?[4,ee.imClient.context.getMessage(e)]:[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:$(o)}]:(w.warn("getMessage ->code:"+n+",messageId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function sn(e){if(!p())return{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]};i("conversationType",e.conversationType,f.NUMBER,!0),i("targetId",e.targetId,f.STRING,!0);var t=ee.imClient.context.getUnreadMentionedMessages(e.conversationType,e.targetId),n=[];return t&&t.length&&t.forEach((function(e){return n.push($(e))})),{code:r.SUCCESS,data:n}}function cn(e,t,n,o){return R(this,void 0,void 0,(function(){var a,s,c,d;return N(this,(function(u){switch(u.label){case 0:return p()?(i("conversationType",e.conversationType,f.NUMBER,!0),i("targetId",e.targetId,f.STRING,!0),i("keyword",t,f.STRING,!0),i("timestamp",n,f.NUMBER),i("count",o,f.NUMBER),1,[4,ee.imClient.context.searchMessageByContent(e.conversationType,e.targetId,t,n,o,1,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return a=u.sent(),s=a.code,c=a.data,s===r.SUCCESS?(d=[],(null==c?void 0:c.messages)&&c.messages.length&&c.messages.forEach((function(e){return d.push($(e))})),[2,{code:s,data:{messages:d,count:null==c?void 0:c.count}}]):(w.warn("searchMessages ->code:"+s+",targetId:"+e.targetId),[2,{code:s,msg:ne[s]}])}}))}))}function dn(e,t,n){return R(this,void 0,void 0,(function(){var o;return N(this,(function(a){switch(a.label){case 0:return p()?(i("conversationType",e.conversationType,f.NUMBER,!0),i("targetId",e.targetId,f.STRING,!0),i("timestamp",t,f.NUMBER,!0),i("cleanSpace",n,f.BOOLEAN),[4,ee.imClient.context.deleteMessagesByTimestamp(e.conversationType,e.targetId,t,n,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(w.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+e.targetId),[2,{code:o,msg:ne[o]}])}}))}))}function un(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return p()?(w.info("clearMessages ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.clearMessages(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(t=n.sent())===r.SUCCESS?[2,{code:t}]:(w.warn("clearMessages ->code:"+t+",targetId:"+e.targetId),[2,{code:t,msg:ne[t]}])}}))}))}function ln(e,t,n,o){return R(this,void 0,void 0,(function(){var a,s,i;return N(this,(function(c){switch(c.label){case 0:return p()?(w.info("searchConversationByContent ->keyword:"+e),[4,ee.imClient.context.searchConversationByContent(e,n,o,t)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return a=c.sent(),s=a.code,i=a.data,s===r.SUCCESS?[2,{code:s,data:i}]:(w.warn("searchConversationByContent ->code:"+s+",keyword:"+e),[2,{code:s,msg:ne[s]}])}}))}))}function gn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return p()?(w.info("clearUnreadCountByTimestamp ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.clearUnreadCountByTimestamp(e.conversationType,e.targetId,t,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("clearUnreadCountByTimestamp ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function fn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return p()?(i("messageId",e,f.NUMBER,!0),i("receivedStatus",t,f.NUMBER,!0),w.info("setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),[4,ee.imClient.context.setMessageReceivedStatus(e,t)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("setMessageReceivedStatus ->code:"+n+",messageId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function mn(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return i("tag.tagId",e.tagId,f.STRING,!0),i("tag.tagId",e.tagId,(function(e){return e.length<=10})),i("tag.tagName",e.tagName,(function(e){return e.length<=15})),i("tag.tagName",e.tagName,f.STRING,!0),w.info("createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,ee.imClient.context.createTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("createTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:ne[t]}])}}))}))}function pn(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return i("tagId",e,f.STRING,!0),w.info("removeTag ->tagId:"+e),[4,ee.imClient.context.removeTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("removeTag ->code:"+t+",tagId:"+e),[2,{code:t,msg:ne[t]}])}}))}))}function hn(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return i("tag.tagId",e.tagId,f.STRING,!0),i("tag.tagName",e.tagName,f.STRING,!0),i("tag.tagName",e.tagName,(function(e){return e.length<=15})),w.info("updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,ee.imClient.context.updateTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("updateTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:ne[t]}])}}))}))}function vn(){return R(this,void 0,void 0,(function(){var e,t,n;return N(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getTagList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(w.warn("getTagList ->code:"+t),[2,{code:t,msg:ne[t]}])}}))}))}function In(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return i("conversationType",e.conversationType,f.NUMBER),i("targetId",e.targetId,f.STRING),i("channelId",e.channelId,f.CHANNEL_ID),w.info("getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.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:ne[n]}]}}))}))}function Sn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return i("tagId",e,f.STRING,!0),i("conversations",t,f.ARRAY,!0),t.forEach((function(e){i("conversation.conversationType",e.conversationType,f.NUMBER,!0),i("conversation.targetId",e.targetId,f.STRING,!0),i("conversation.channelId",e.channelId,f.CHANNEL_ID)})),w.info("addTagForConversations ->tagId:"+e),[4,ee.imClient.context.addTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("addTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function Cn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return i("tagId",e,f.STRING,!0),i("conversations",t,f.ARRAY,!0),t.forEach((function(e){i("conversation.conversationType",e.conversationType,f.NUMBER,!0),i("conversation.targetId",e.targetId,f.STRING,!0),i("conversation.channelId",e.channelId,f.CHANNEL_ID)})),w.info("removeTagForConversations ->tagId:"+e),[4,ee.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function Tn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return i("conversation.conversationType",e.conversationType,f.NUMBER,!0),i("conversation.targetId",e.targetId,f.STRING,!0),i("conversation.channelId",e.channelId,f.CHANNEL_ID),i("tagIds",t,f.ARRAY,!0),t.forEach((function(e){i("tagId",e,f.STRING,!0)})),w.info("removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.removeTagsForConversation(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagsForConversation ->code:"+n+",tagIds:"+t),[2,{code:n,msg:ne[n]}])}}))}))}function En(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return i("tagId",e,f.STRING,!0),i("conversations",t,f.ARRAY,!0),t.forEach((function(e){i("conversation.conversationType",e.conversationType,f.NUMBER,!0),i("conversation.targetId",e.targetId,f.STRING,!0),i("conversation.channelId",e.channelId,f.CHANNEL_ID)})),w.info("removeTagForConversations ->tagId:"+e),[4,ee.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function yn(e,t,n){return R(this,void 0,void 0,(function(){var o,a,s;return N(this,(function(c){switch(c.label){case 0:return i("tagId",e,f.STRING,!0),i("count",t,f.NUMBER,!0),i("startTime",n,f.NUMBER,!0),w.info("getConversationListByTag ->tagId:"+e),[4,ee.imClient.context.getConversationListByTag(e,n,t)];case 1:return o=c.sent(),a=o.code,s=o.data,a===r.SUCCESS?[2,{code:a,data:s}]:(w.warn("getConversationListByTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:ne[a]}])}}))}))}function Rn(e,t){return R(this,void 0,void 0,(function(){var n,o,a;return N(this,(function(s){switch(s.label){case 0:return i("tagId",e,f.STRING,!0),i("containMuted",t,f.BOOLEAN,!0),w.info("getUnreadCountByTag ->tagId:"+e),[4,ee.imClient.context.getUnreadCountByTag(e,t)];case 1:return n=s.sent(),o=n.code,a=n.data,w.info(o,a),o===r.SUCCESS?[2,{code:o,data:a}]:(w.warn("getUnreadCountByTag ->code:"+o+",tagId:"+e),[2,{code:o,msg:ne[o]}])}}))}))}function Nn(e,t,n){return R(this,void 0,void 0,(function(){var o,a;return N(this,(function(s){switch(s.label){case 0:return i("tagId",e,f.STRING,!0),i("conversation.targetId",t.targetId,f.STRING,!0),i("conversation.conversationType",t.conversationType,f.NUMBER,!0),i("conversation.channelId",t.channelId,f.CHANNEL_ID),i("status.isTop",n,f.BOOLEAN,!0),w.info("setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",conversationType"+t.conversationType),[4,ee.imClient.context.setConversationStatusInTag(e,t,{isTop:n})];case 1:return o=s.sent(),(a=o.code)===r.SUCCESS?[2,{code:a}]:(w.warn("setConversationStatusInTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:ne[a]}])}}))}))}kt(I.COMBINE_HTML,(function(e,t){return new nt({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var wn={COMET:"comet",WEBSOCKET:"websocket"},On={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"};E.add("imlib","5.0.0"),E.validEngine("~5.0.0")||w.error("The current engine version '"+E.getInfo().engine+"' error,imlib required engine version at least '~5.0.0'.");export{je as BaseMessage,nt as CombineMessage,wn as ConnectType,U as Events,ot as FileMessage,at as GIFMessage,$e as HQVoiceMessage,Qe as ImageMessage,st as LocationMessage,On as MessageType,it as ReferenceMessage,ct as RichContentMessage,Ze as SightMessage,et as TextMessage,rt as VoiceMessage,Sn as addConversationsToTag,me as addEventListener,mn as addTag,Ie as clearEventListeners,Qt as clearHistoryMessages,un as clearMessages,we as clearMessagesUnreadStatus,ye as clearTextMessageDraft,gn as clearUnreadCountByTimestamp,de as connect,dn as deleteLocalMessagesByTimestamp,Yt as deleteMessages,ue as disconnect,Ve as forceRemoveChatRoomEntry,Be as forceSetChatRoomEntry,Ke as getAllChatRoomEntries,Ue as getBlockedConversationList,ze as getChatRoomEntry,He as getChatRoomInfo,Xe as getChatroomHistoryMessages,le as getConnectionStatus,Se as getConversationList,Me as getConversationNotificationStatus,yn as getConversationsFromTagByPage,fe as getCurrentUserId,Pt as getFileToken,Lt as getFileUrl,on as getFirstUnreadMessage,Vt as getHistoryMessages,rn as getMessage,tn as getMessageReader,zt as getRemoteHistoryMessages,ge as getServerTime,vn as getTags,In as getTagsFromConversation,Te as getTextMessageDraft,xe as getTopConversationList,Re as getTotalUnreadCount,Ne as getUnreadCount,Rn as getUnreadCountByTag,sn as getUnreadMentionedMessages,ie as init,an as insertMessage,ce as installPlugin,Pe as joinChatRoom,Le as joinExistChatRoom,pe as onceEventListener,De as quitChatRoom,Jt as recallMessage,nn as registerMessageType,Fe as removeChatRoomEntries,qe as removeChatRoomEntry,Ce as removeConversation,Cn as removeConversationsFromTag,he as removeEventListener,ve as removeEventListeners,Zt as removeMessageExpansionForKey,pn as removeTag,En as removeTagFromConversations,Tn as removeTagsFromConversation,Ee as saveTextMessageDraft,ln as searchConversationByContent,cn as searchMessages,Gt as sendFileMessage,qt as sendHQVoiceMessage,Bt as sendImageMessage,Dt as sendMessage,Kt as sendReadReceiptMessage,Xt as sendReadReceiptRequest,jt as sendReadReceiptResponse,Ft as sendSightMessage,Wt as sendSyncReadStatusMessage,Ht as sendTextMessage,en as sendTypingStatusMessage,Ge as setChatRoomEntries,ke as setChatRoomEntry,Oe as setConversationNotificationStatus,_e as setConversationToTop,Nn as setConversationToTopInTag,fn as setMessageReceivedStatus,$t as updateMessageExpansion,hn 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)};function R(e,t,n,o){return new(n||(n=Promise))((function(a,r){function i(e){try{c(o.next(e))}catch(e){r(e)}}function s(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(i,s)}c((o=o.apply(e,t||[])).next())}))}function N(e,t){var n,o,a,r,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return r={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function s(r){return function(s){return function(r){if(n)throw new TypeError("Generator is already executing.");for(;i;)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 i.label++,{value:r[1],done:!1};case 5:i.label++,o=r[1],r=[0];continue;case 7:r=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==r[0]&&2!==r[0])){i=0;continue}if(3===r[0]&&(!a||r[1]>a[0]&&r[1]<a[3])){i.label=r[1];break}if(6===r[0]&&i.label<a[1]){i.label=a[1],a=r;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(r);break}a[2]&&i.ops.pop(),i.trys.pop();continue}r=t.call(e,i)}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,s])}}}var w=new e("RCIM"),O=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=O();var U,_={tag:"browser",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,r=e.headers,i=e.query,s=e.body,c=a(e.url,i);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")),i="[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(i){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 s?JSON.stringify(s):s;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(s)}))},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||w.warn("websocket not support"),e},useNavi:!0,connectPlatform:"",isFromUniapp:M,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=O(),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){w.error(e)}}},A={setItem:b("setStorageSync"),getItem:b("getStorageSync"),removeItem:b("removeStorageSync"),clear:b("clearStorageSync")},P={tag:"wechat",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,d=a(e.url,s);return new Promise((function(e){wx.request({url:d,method:t,headers:i,timeout:n,data:c,success:function(t){e({data:t.data,status:t.statusCode})},fail:function(){e({status:r.RC_HTTP_REQ_TIMEOUT})}})}))},localStorage:A,sessionStorage:A,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)}},L=O(),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){w.error(e)}}},H={setItem:D("setStorageSync"),getItem:D("getStorageSync"),removeItem:D("removeStorageSync"),clear:D("clearStorageSync")},k={tag:"alipay",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,d=a(e.url,s),u=e.dataType||"json";return new Promise((function(e){my.request({url:d,method:t,headers:i,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:H,sessionStorage:H,isSupportSocket:function(){return!1},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:L,createDataChannel:function(e,o){return"websocket"===o?new t(this,e):new n(this,e)}},G=O(),B=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){w.error(e)}}},q={setItem:B("setStorageSync"),getItem:B("getStorageSync"),removeItem:B("removeStorageSync"),clear:B("clearStorageSync")},F={tag:"toutiao",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:G,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)}},V=O(),z=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){w.error(e)}}},K={setItem:z("setStorageSync"),getItem:z("getStorageSync"),removeItem:z("removeStorageSync"),clear:z("clearStorageSync")},X={tag:"baidu",isSupportSocket:function(){return!0},useNavi:!1,connectPlatform:"MiniProgram",isFromUniapp:V,localStorage:K,sessionStorage:K,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){w.error(e)}}},W={setItem:j("setStorageSync"),getItem:j("getStorageSync"),removeItem:j("removeStorageSync"),clear:j("clearStorageSync")},J={tag:"uniapp",httpReq:function(e){var t=e.method||o.GET,n=e.timeout||6e4,i=e.headers,s=e.query,c=e.body,d=a(e.url,s);return new Promise((function(e){uni.request({url:d,method:t,headers:i,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)}},Y=function(e){return e&&e.canIUse&&e.getSystemInfo},Q="undefined"!=typeof uni&&Y(uni)?function(){switch(process.env.VUE_APP_PLATFORM){case"app-plus":return J;case"mp-baidu":return X;case"mp-toutiao":return F;case"mp-alipay":return k;case"mp-weixin":return P;default:return _}}():"undefined"!=typeof wx&&Y(wx)?P:"undefined"!=typeof my&&Y(my)?k:"undefined"!=typeof tt&&Y(tt)?F:"undefined"!=typeof swan&&Y(swan)?X:_;function $(e){var t=e.conversationType,n=e.channelId,o=e.messageType,a=e.content,r=e.senderUserId,s=e.targetId,c=e.sentTime,d=e.receivedTime,u=e.messageUId,l=e.messageDirection,g=e.isPersited,f=e.isCounted,m=e.isOffLineMessage,h=e.canIncludeExpansion,p=e.expansion,v=e.receivedStatus,I=e.disableNotification,S=e.isMentioned,C=e.isStatusMessage,T=e.readReceiptInfo,E=e.pushConfig,y=e.messageId;return v||(v=i.UNREAD),{messageType:o,channelId:n||"",content:a,senderUserId:r,targetId:s,conversationType:t,sentTime:c,receivedTime:d,messageUId:u,messageDirection:l,isPersited:g,isCounted:f,isOffLineMessage:m,isMentioned:S,disableNotification:I,isStatusMessage:C,canIncludeExpansion:h,expansion:p,receivedStatus:v,readReceiptInfo:T,pushConfig:E,messageId:y}}!function(e){e.CONNECTING="connecting",e.CONNECTED="connected",e.DISCONNECT="disconnect",e.SUSPEND="suspend",e.MESSAGES="messages",e.READ_RECEIPT_RECEIVED="readReceiptReceived",e.MESSAGE_RECEIPT_REQUEST="messageReceiptRequest",e.MESSAGE_RECEIPT_RESPONSE="messageReceiptResponse",e.CONVERSATION="conversation",e.CHATROOM="chatroom",e.EXPANSION="expansion",e.PULL_OFFLINE_MESSAGE_FINISHED="pullOfflineMessageFinished",e.TAG="tag",e.CONVERSATION_TAG="conversationTag",e.TYPING_STATUS="typingStatus"}(U||(U={}));var Z,ee=function(e){function t(n){var o=e.call(this)||this;if(t.imClient)return w.error("Please do not repeatedly perform the init method"),t.imClient;s("options.navigators",n.navigators,(function(e){return c(e)&&(0===e.length||e.every(d))}));var a=null==n?void 0:n.connectType;return a?u.WEBSOCKET!==a&&u.COMET!==a&&(w.warn("RongIMLib connectionType must be "+u.WEBSOCKET+" or "+u.COMET),a=u.WEBSOCKET):a=u.WEBSOCKET,o._context=l.init(Q,{appkey:n.appkey,apiVersion:"5.0.1-custom-qihoo.4",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(U.CONNECTING)},onConnected:function(){e.emit(U.CONNECTED)},onDisconnect:function(){e.emit(U.DISCONNECT)},onSuspend:function(){e.emit(U.SUSPEND)},batchMessage:function(t){e.emit(U.MESSAGES,{messages:t.map((function(e){return $(e)}))})},typingState:function(t){e.emit(U.TYPING_STATUS,{status:t})},readReceiptReceived:function(t,n,o){e.emit(U.READ_RECEIPT_RECEIVED,{conversation:t,messageUId:n,sentTime:o})},messageReceiptRequest:function(t,n){e.emit(U.MESSAGE_RECEIPT_REQUEST,{conversation:t,messageUId:n})},messageReceiptResponse:function(t,n,o){e.emit(U.MESSAGE_RECEIPT_RESPONSE,{conversation:t,messageUId:n,responseUserIdList:o})},conversationState:function(t){var n=t.map((function(e){return{conversation:{conversationType:e.conversationType,latestMessage:e.latestMessage?$(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(U.CONVERSATION,{conversationList:n})},chatroomState:function(t){e.emit(U.CHATROOM,t)},expansion:function(t){e.emit(U.EXPANSION,t)},pullFinished:function(){e.emit(U.PULL_OFFLINE_MESSAGE_FINISHED)},tag:function(){e.emit(U.TAG)},conversationTagChanged:function(){e.emit(U.CONVERSATION_TAG)}};this.context.assignWatcher(t)},t}(g),te={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!"}},ne={},oe={};for(var ae in te){var re=te[ae],ie=re.code;ne[ie]=ae,oe[ie]=re}te.ROAMING_SERVICE_UNAVAILABLE.code;var se=function(e){Z=Z||new ee(e)};function ce(e,t){return null==Z?void 0:Z.context.install(e,t)}function de(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return s("token",e,f.STRING,!0),w.warn("RongIMLib Version: 5.0.1-custom-qihoo.4, Commit: 69ef4403654954d4a4b628a368da020aa8ee9bfd"),[4,Z.context.connect(e,!0)];case 1:return(t=n.sent()).code===r.SUCCESS?[2,{code:t.code,data:{userId:t.userId}}]:[2,{code:t.code,msg:ne[t.code]}]}}))}))}function ue(){return Z.context.disconnect()}function le(){return Z.context.getConnectionStatus()}function ge(){return Z.context.getServerTime()}function fe(){return Z.context.getCurrentUserId()}function me(e,t,n){Z.on(e,t,n)}function he(e,t,n){Z.once(e,t,n)}function pe(e,t,n){Z.off(e,t,n)}function ve(e){Z.removeAll(e)}function Ie(){Z.clear()}function Se(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return N(this,(function(s){switch(s.label){case 0:return w.debug("get conversation list ->"),[4,ee.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=s.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?(i=a.map((function(e){return function(e){var t=e.conversationType,n=e.targetId,o=e.latestMessage,a=e.unreadMessageCount,r=e.hasMentioned,i=e.mentionedInfo,s=e.lastUnreadTime,c=e.notificationStatus,d=e.isTop,u=e.channelId,l=e.unreadMentionedCount;return{conversationType:t,targetId:n,latestMessage:o&&$(o),unreadMessageCount:a,hasMentioned:r,mentionedInfo:r?{type:null==i?void 0:i.type,userIdList:null==i?void 0:i.userIdList}:void 0,lastUnreadTime:s,notificationStatus:c,isTop:d,channelId:u,unreadMentionedCount:l}}(e)})),[2,{code:0,data:i}]):(w.warn("get conversation list fail ->"+o+":"+ne[o]),[2,{code:o,msg:ne[o]}])}}))}))}function Ce(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.removeConversation(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("destroy conversation ->"+n),t!==r.SUCCESS?(w.warn("destroy conversation fail ->"+t+":"+ne[t]+","+n),[2,{code:t,msg:ne[t]}]):[2,{code:t}]}}))}))}function Te(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return N(this,(function(i){switch(i.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return t=i.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get draft ->"+a),n===r.SUCCESS?[2,{code:n,data:o||""}]:(w.warn("get draft fail ->"+n+":"+ne[n]+","+a),[2,{code:n,msg:ne[n]}])}}))}))}function Ee(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),s("draft",t,f.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set draft ->"+n),[4,ee.imClient.context.saveConversationMessageDraft(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(w.warn("set draft fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}])}}))}))}function ye(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),t="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("delete draft ->"+t),[4,ee.imClient.context.clearConversationMessageDraft(e.conversationType,e.targetId,e.channelId)];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("delete draft fail ->"+n+":"+ne[n]+","+t),[2,{code:n,msg:ne[n]}])}}))}))}function Re(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,d;return N(this,(function(u){switch(u.label){case 0:if(w.debug("get total unread count -> ConversationType:"+JSON.stringify(t)+" includeMuted:"+e),s("includeMuted",e,f.BOOLEAN,!1),s("conversationTypes",t,f.ARRAY,!1),t)for(n=0,o=t;n<o.length;n++)a=o[n],s("conversationType",a,m);return[4,ee.imClient.context.getTotalUnreadCount("",t,e)];case 1:return i=u.sent(),c=i.code,d=i.data,c===r.SUCCESS?[2,{code:c,data:d}]:(w.warn("getTotalUnreadCount fail ->"+c+":"+ne[c]),[2,{code:c,msg:ne[c]}])}}))}))}function Ne(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return N(this,(function(i){switch(i.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=i.sent(),n=t.code,o=t.data,a="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get unreadCount ->"+a),n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("get unreadCount fail ->"+n+":"+ne[n]+","+a),[2,{code:n,msg:ne[n]}])}}))}))}function we(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.clearUnreadCount(e.conversationType,e.targetId,e.channelId)];case 1:return t=o.sent(),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("clear unreadMsgNum ->"+n),t!==r.SUCCESS?(w.warn("clear unreadMsgNum fail ->"+t+":"+ne[t]+","+n),[2,{code:t,msg:ne[t]}]):[2,{code:t}]}}))}))}function Oe(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),s("notificationStatus",t,(function(e){return 1===e||2===e}),!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set conversation status ->"+n),[4,ee.imClient.context.setConversationStatus(e.conversationType,e.targetId,void 0,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set conversation status fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Me(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return h()?(s("options.conversationType",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),w.info("getConversationNotificationStatus ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.getConversationNotificationStatus(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("getConversationNotificationStatus ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function Ue(){return R(this,void 0,void 0,(function(){var e,t,n;return N(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getBlockConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function _e(e,t){return void 0===t&&(t=!0),R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options.type",e.conversationType,m,!0),s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("set conversation status ->"+n),[4,ee.imClient.context.setConversationStatus(e.conversationType,e.targetId,t,void 0,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set conversation status fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function xe(){return R(this,void 0,void 0,(function(){var e,t,n;return N(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getTopConversationList()];case 1:return e=o.sent(),t=e.code,n=e.data,[2,{code:t,data:n}]}}))}))}function be(e){return R(this,void 0,void 0,(function(){return N(this,(function(t){return s("options.targetId",e.targetId,f.STRING,!0),s("options.channelId",e.channelId,f.CHANNEL_ID),w.debug("getUnreadMentionedCount"+e.targetId+",channelId:"+e.channelId),[2,ee.imClient.context.getUnreadMentionedCount(e)]}))}))}function Ae(){return R(this,void 0,void 0,(function(){return N(this,(function(e){return w.debug("getAllUnreadMentionedCount"),[2,ee.imClient.context.getAllUnreadMentionedCount()]}))}))}var Pe=function(e){s("options.key",e.key,f.STRING,!0),s("options.value",e.value,f.STRING,!0),s("options.isAutoDelete",e.isAutoDelete,f.BOOLEAN),s("options.isSendNotification",e.isSendNotification,f.BOOLEAN),s("options.notificationExtra",e.notificationExtra,f.STRING)},Le=function(e){s("options.key",e.key,f.STRING,!0),s("options.isSendNotification",e.isSendNotification,f.BOOLEAN),s("options.notificationExtra",e.notificationExtra,f.STRING)};function De(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options.count",t.count,f.NUMBER,!0),n="id:"+e,w.debug("join chatroom ->"+n),[4,ee.imClient.context.joinChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("join chatroom fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function He(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options.count",t.count,f.NUMBER,!0),n="id:"+e,w.debug("join exist chatroom ->"+n),[4,ee.imClient.context.joinExistChatroom(e,t.count)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("join exist chatroom fail ->code:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function ke(e){return R(this,void 0,void 0,(function(){var t,n;return N(this,(function(o){switch(o.label){case 0:return t="id:"+e,w.debug("quit chatroom ->"+t),[4,ee.imClient.context.quitChatroom(e)];case 1:return(n=o.sent())!==r.SUCCESS?(w.warn("quit chatroom fail ->code+:"+ne[n]+","+t),[2,{code:n,msg:ne[n]}]):[2,{code:n}]}}))}))}function Ge(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return N(this,(function(c){switch(c.label){case 0:return s("options.count",t.count,f.NUMBER),s("options.order",t.order,(function(e){return[0,1,2].includes(e)})),n="id:"+e,w.debug("get chatroom info ->"+n),[4,ee.imClient.context.getChatroomInfo(e,t.count,t.order)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?[2,{code:a,data:i}]:(w.warn("get chatroom info fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function Be(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Pe(t),n="id:"+e,w.debug("set chatroom entry->"+n),[4,ee.imClient.context.setChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("set chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function qe(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return N(this,(function(c){switch(c.label){case 0:return s("targetId",e,f.STRING,!0),function(e){e.entries.forEach((function(e){s("entry.key",e.key,f.STRING,!0),s("entry.value",e.value,f.STRING,!0)})),s("options.isAutoDelete",e.isAutoDelete,f.BOOLEAN),s("options.notificationExtra",e.notificationExtra,f.STRING)}(t),t.entries.length>10?[2,te.CHATROOM_KV_STORE_OUT_LIMIT]:(n="id:"+e,w.debug("set chatroom entry->"+n),[4,ee.imClient.context.setChatroomEntries(e,t)]);case 1:return o=c.sent(),a=o.code,i=o.data,a!==r.SUCCESS?(w.warn("set chatroom entry fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a],data:i}]):[2,{code:a}]}}))}))}function Fe(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Pe(t),n="id:"+e,w.debug("force set chatroom entry ->"+n),[4,ee.imClient.context.forceSetChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("force set chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Ve(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Le(t),n="id:"+e,w.debug("remove chatroom entry->"+n),[4,ee.imClient.context.removeChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("remove chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function ze(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("targetId",e,f.STRING,!0),function(e){e.entries.forEach((function(e){s("key",e,f.STRING,!0)})),s("options.notificationExtra",e.notificationExtra,f.STRING)}(t),n="id:"+e,w.debug("remove chatroom entry->"+n),(o=Object.assign({},t)).entries=t.entries.map((function(e){return{key:e}})),[4,ee.imClient.context.removeChatroomEntries(e,o)];case 1:return a=d.sent(),i=a.code,c=a.data,i!==r.SUCCESS?(w.warn("remove chatroom entry fail ->code+:"+ne[i]+","+n),[2,{code:i,msg:ne[i],data:c}]):[2,{code:i}]}}))}))}function Ke(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("targetId",e,f.STRING,!0),Le(t),n="id:"+e,w.debug("force remove chatroom entry ->"+n),[4,ee.imClient.context.forceRemoveChatroomEntry(e,t)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("force remove chatroom entry fail ->code+:"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:o}]}}))}))}function Xe(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i;return N(this,(function(c){switch(c.label){case 0:return s("key",t,(function(e){return p(e)&&/[\w+=-]+/.test(e)&&e.length<=128}),!0),n="id:"+e,w.debug("get chatroom entry->"+n),[4,ee.imClient.context.getChatroomEntry(e,t)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?[2,{code:a,data:i}]:(w.warn("get chatroom entry fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function je(e){return R(this,void 0,void 0,(function(){var t,n,o,a;return N(this,(function(i){switch(i.label){case 0:return t="id:"+e,w.debug("get all chatroom entries->"+t),[4,ee.imClient.context.getAllChatroomEntries(e)];case 1:return n=i.sent(),o=n.code,a=n.data,o===r.SUCCESS&&a?[2,{code:o,data:a}]:(w.warn("get all chatroom entries fail ->code+:"+ne[o]+","+t),[2,{code:o,msg:ne[o]}])}}))}))}function We(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("options.timestamp",t.timestamp,f.NUMBER),s("options.count",t.count,f.NUMBER),s("options.order",t.order,(function(e){return 0===e||1===e})),n="id:"+e,w.debug("get chatroom history message->"+n),[4,ee.imClient.context.getChatRoomHistoryMessages(e,t.count,t.order,t.timestamp)];case 1:return o=d.sent(),a=o.code,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:!!i.hasMore}}]):(w.warn("get chatroom history message fail ->code+:"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}var Je=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 Ye(e,t,n){void 0===t&&(t=!0),void 0===n&&(n=!0);return function(o){return new Je(e,o,t,n)}}var Qe,$e,Ze=Ye("RC:ImgMsg"),et=Ye("RC:HQVCMsg"),nt=Ye("RC:SightMsg"),ot=Ye("RC:TxtMsg"),at=Ye("RC:CombineMsg"),rt=Ye("RC:FileMsg"),it=Ye("RC:GIFMsg"),st=Ye("RC:VcMsg"),ct=Ye("RC:LBSMsg"),dt=Ye("RC:ReferenceMsg"),ut=Ye("RC:ImgTextMsg"),lt={qiniu:function(e,t,n,o){var a,r="https://"+t.uploadHost.qiniu;a=ht()+gt[0][1]||r,gt.shift();var i=new XMLHttpRequest;i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var a=i.responseText||"{}";(a=JSON.parse(a)).filename=t.uniqueValue,a.uploadMethod=v?v.QINIU:"",200===i.status?n.onCompleted(a):gt.length?lt[gt[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));i.open(t.method,a,!0),n.onOpen(i),t.stream&&i.setRequestHeader("authorization","UpToken "+t.multi_parmas.token);mt(t.headers,(function(e,t){i.setRequestHeader(e,t)})),i.send(e)},baidu:function(e,t,n,o){if(console.log(o,t),o.size>ft)throw new Error("the file size is over 5GB!");var a=t||{};t=t||$e;var r=new XMLHttpRequest,i=ht();if(!a.uploadHost.bos&&!a.bosUploadPath)return;var s=i+gt[0][1]+a.bosUploadPath;gt.shift();var c=a.bosHeader||{},d={filename:t.uniqueValue||o.uniqueName,name:o.name,downloadUrl:s,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 gt.length?lt[gt[0][0]](e,t,n,o):n.onError("upload fail")}},r.open(t.method,s,!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>ft)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=gt[0][1];gt.shift(),e=e||Qe,t=(t=t||{})||$e;var i=new XMLHttpRequest,s=ht()+t.ossBucketName+"."+r;i.upload&&t.support_options&&(i.upload.onprogress=function(e){n.onProgress(e.loaded,e.total)});i.onreadystatechange=function(){if(4===i.readyState){var e=i.responseText||"{}";(e=JSON.parse(e)).name=t.uniqueValue,e.filename=t.uploadFileName,e.uploadMethod=v?v.ALI:"",200===i.status?n.onCompleted(e):gt.length?lt[gt[0][0]](a,t,n,o):n.onError("upload fail")}},i.open(t.method,s,!0),console.log("ali:url",s);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),i.send(e)},s3:function(e,t,n,o){var a=new FormData,r=new XMLHttpRequest,i=ht();const s=gt[0][1];var c=i+t.s3BucketName+"."+s;console.log("uploadS3:url",c),gt.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=v.AWS,console.log("UploadMethod:",v),200===r.status||204===r.status)n.onCompleted(a);else if(gt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),lt[gt[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;ht();var r="https://"+gt[0][1]+"/"+t.stcBucketName+"/"+t.uploadFileName;gt.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=v?v.STC:"",200===a.status||204===a.status)n.onCompleted(r);else if(gt.length){const a=new FormData;a.set("file",e.get("file")),a.set("key",e.get("key")),a.set("token",e.get("token")),lt[gt[0][0]](a,t,n,o)}else n.onError("upload fail")}},a.open("PUT",r,!0);var i=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",i.stcAuthorization),a.setRequestHeader("x-amz-content-sha256",i.stcContentSha256),a.setRequestHeader("x-amz-date",i.stcDate),a.send(o)}},gt=[],ft=5368709120;function mt(e,t){for(var n in e)t(n,e[n])}function ht(){var e="https://";return"http:"!==location.protocol&&"file:"!==location.protocol||(e="http://"),e}function pt(e,t,n){var o,a,r=e&&e.type||"text/plain",i=r.indexOf("image")>-1?1:4,s=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";ee.imClient.getFileToken(i,o,"POST",u).then((function(e){o=e.fileName,a="https://"+d.stc+"/"+t.stcBucketName+"/"+o,console.log("uploadStcMultipart:url",a);var i=new XMLHttpRequest;i.open("POST",a+"?"+u,!0),"text/html"===r?i.setRequestHeader("Content-Disposition","inline;"):i.setRequestHeader("Content-Disposition","attacshment;"),i.setRequestHeader("Authorization",e&&e.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",e&&e.stcContentSha256),i.setRequestHeader("x-amz-date",e&&e.stcDate),i.setRequestHeader("Content-Type",r),i.send(),i.onreadystatechange=function(e){if(4===i.readyState){var t=i.response.match(/(?:<UploadId>)(\S*?)(?:<\/UploadId>)/);console.log("uploadId",t),200===i.status||204===i.status?function(e){for(var t=[],n=1;n<=s;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===s)ee.imClient.context.getFileToken(i,o,"POST",d).then((function(o){console.log("onSuccess",o),console.log("onSuccess:uploadId",c);var i=new XMLHttpRequest;i.open("POST",a+"?"+d,!0),i.setRequestHeader("Authorization",o&&o.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",o&&o.stcContentSha256),i.setRequestHeader("x-amz-date",o&&o.stcDate),i.setRequestHeader("Content-Type",r);var s="<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=>{s+=`<Part><ETag>${g.get(e)}</ETag><PartNumber>${e}</PartNumber></Part>`})),s+="</CompleteMultipartUpload>",i.send(s),console.log("xml",s),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var o={};o.name=e.name,o.filename=t.uploadFileName,o.uploadMethod=v.STC,n.onCompleted(o)}else n.onError("uploadStcMultipart:upload does not end")}}),(function(e){n.onError("uploadStcMultipart:"+e)}));else{var u=[];for(var h of l)u.push(m(c,h));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,s){return new Promise(((c,d)=>{var u="partNumber="+s+"&uploadId="+n;ee.imClient.context.getFileToken(i,o,"PUT",u).then((function(n){console.log("signature "+s+" onSuccess",n);var o=e&&e.slice((s-1)*t.stc_chunk_size,s*t.stc_chunk_size);console.log("fileChunk:size",o.size);var i=new XMLHttpRequest;i.open("PUT",a+"?"+u,!0),i.setRequestHeader("Authorization",n&&n.stcAuthorization),i.setRequestHeader("x-amz-content-sha256",n&&n.stcContentSha256),i.setRequestHeader("x-amz-date",n&&n.stcDate),i.setRequestHeader("Content-Type",r),i.send(o),i.onreadystatechange=function(){if(4===i.readyState)if(200===i.status||204===i.status){var e=i.getResponseHeader("etag");console.log("etag:"+s,e),g.set(s,e),c(e)}else l.includes(s)||l.push(s),d(s)}}),(function(e){console.log("getETags:签名验证失败"),l.includes(s)||l.push(s),d(s)}))}))}}var vt={form:function(e,t){var n=new FormData;if(t.unique_key){var o=e.name.substr(e.name.lastIndexOf(".")),a=It()+o;n.append(t.unique_key,a),t.uniqueValue=a}return n.append(t.file_data_name,e),St(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=It()+o;n[t.unique_key]=a,t.uniqueValue=a}return n[t.file_data_name]=e,St(t.multi_parmas,(function(e,t){n[e]=t})),JSON.stringify(n)},data:function(e,t){return e}};function It(){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 St(e,t){for(var n in e)t(n,e[n])}var Ct,Tt=0;function Et(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:vt.form,genUId:It};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;St(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(Qe=e,$e=t,gt=[],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 i in e)"aliyun"===i&&(a=e[i]),"s3"===i&&(n=e[i]),"stc"===i&&(o=e[i]),"p"!==i&&(r[t]=[i,e[i]])})),r.forEach((function(e){e&>.push(e)})),e.length!==gt.length&&(gt=[["qiniu",t.domain],["baidu",t.uploadHost.bos],["aliyun",a],["s3",n],["stc",o]])}else gt=[["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)pt(e,t,n);else{var r=t.data(e,t);lt[gt[0][0]](r,t,n,e)}}(e,this.options,{onProgress:function(e,n,o){if(Ct=e,o){Ct=Tt+e/n*(n-Tt)}else Tt=Ct;t.onProgress(Ct,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 yt={init:function(e){return new Et(e)},dataType:vt,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 i=r.width,s=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,i=t.maxHeight||0;if(i>0&&r>i){var s=i/r;n=Math.min(n,s)}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:i,height:s,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,i*c,s*c)),n(d)}}};const Rt=function(e,t,n){var o=document.createElement("canvas"),a=o.getContext("2d"),r=new Image;r.onload=function(){var i=function(e,t,n){var o,a,r,i=e<t,s=0,c=0;return(i?t/e:e/t)>n.scale?(i?(a=100,c=((r=t/(o=e/100))-n.maxHeight)/2):(r=100,s=((a=e/(o=t/100))-n.maxWidth)/2),{w:a,h:r,x:-s,y:-c}):(i?(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:-s,y:-c})}(r.width,r.height,t);o.width=i.w>t.maxWidth?t.maxWidth:i.w,o.height=i.h>t.maxHeight?t.maxHeight:i.h,a.drawImage(r,i.x,i.y,i.w,i.h);try{var s=o.toDataURL(e.type,t.quality),c=new RegExp("^data:image/[^;]+;base64,");s=s.replace(c,""),n(s)}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)},Nt=function(e,t){var n=e.file,o=e.compress;Rt(n,o,t)},wt=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=yt.init(e);t(a)}));else{e.headers||(e.headers={}),e.base64&&(e.headers["Content-type"]="application/octet-stream");var n=yt.init(e);t(n)}};var Ot,Mt,Ut=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||Nt;e.compress?o(e,(function(e){t.thumbnail=e,n.onCompleted(t)})):n.onCompleted(t)}})},_t=function(e){var t=this;this.instance=e,this.upload=function(e,n){Ut({file:e},t.instance,n)},this.cancel=function(){t.instance.cancel()}},xt=function(e,t){var n=this;this.cfg=t,this.instance=e,this.upload=function(e,t){var o={file:e,compress:n.cfg};Ut(o,n.instance,t)},this.cancel=function(){n.instance.cancel()}},bt=function(e,t){wt(e,(function(n){var o={maxHeight:e.height||160,maxWidth:e.width||160,quality:e.quality||.5,scale:e.scale||2.4},a=new xt(n,o);t(a)}))},At=function(e,t){wt(e,(function(e){var n=new _t(e);t(n)}))},Pt=bt;yt.dataType;function Lt(e){return Ot=Ot||new AudioContext,new Promise((function(t,n){Ot.decodeAudioData(e,(function(e){t({duration:e.duration,length:e.length})}),n)}))}function Dt(e,t,n,o){return new Promise((function(a){ee.imClient.context.getFileToken(e,t,n,o).then((function(e){a({code:r.SUCCESS,data:e})})).catch((function(e){a({code:e,msg:ne[e]})}))}))}function Ht(e,t,n,o,a){return s("fileType",e,S,!0),s("filename",t,f.STRING),s("saveName",n,f.STRING),s("serverType",a,f.NUMBER),new Promise((function(i){ee.imClient.context.getFileUrl(e,t,n,o,a).then((function(e){i({code:r.SUCCESS,data:e})})).catch((function(e){i({code:e})}))}))}function kt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,c,d,u,l;return N(this,(function(g){switch(g.label){case 0:return n=n||{},t instanceof Je==!1?(w.warn("send message fail -> message parameter is not an instance of BaseMessage"),[2,te.ILLGAL_PARAMS]):(s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),o="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("send message ->"+o),(a=Object.assign(n,t)).channelId=e.channelId?e.channelId:a.channelId,[4,ee.imClient.context.sendMessage(e.conversationType,e.targetId,a)]);case 1:return c=g.sent(),d=c.code,u=c.data,d===r.SUCCESS?(l=$(u),[2,{code:d,data:l}]):(w.warn("send message fail ->"+d+":"+ne[d]+","+o),[2,{code:d,msg:ne[d],data:$({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:ee.imClient.context.getCurrentUserId(),messageUId:"",messageDirection:C.SEND,isOffLineMessage:!1,sentTime:(null==u?void 0:u.sentTime)||0,receivedTime:0,isStatusMessage:n.isStatusMessage||!1,receivedStatus:i.UNREAD})}])}}))}))}function Gt(e,t,n){return kt(e,new ot(t),n)}function Bt(e,t){return function(n,o,a,i){return new Promise((function(s){!function(e,t,n){var o,a=this;if(void 0===t&&(t=I.FILE),o=t===I.IMAGE?I.IMAGE:I.FILE,!Mt){Mt="upload.qiniup.com";var r=ee.imClient.context.getInfoFromCache();if(r&&r.ossConfig)try{var i=JSON.parse(r.ossConfig).find((function(e){return void 0!==e.qiniu}));i&&(Mt=i.qiniu)}catch(e){}}var s={domain:Mt,getToken:function(e){ee.imClient.context.getFileToken(o).then((function(t){e(t.token,t)})).catch((function(e){n.onFail(e)}))}};(o===I.IMAGE?Pt:At)(s,(function(r){r.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(r){return R(a,void 0,void 0,(function(){var a=this;return N(this,(function(i){return Ht(o,r.filename,r.name,r,r.uploadMethod).then((function(i){return R(a,void 0,void 0,(function(){var a,s;return N(this,(function(c){return 0!==i.code?(n.onFail(i),[2]):((a=i.data).type=e.type,a.name=r.name||r.filename,t===I.AUDIO?("function"==typeof e.arrayBuffer?e.arrayBuffer().then(Lt).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):((s=new FileReader).onload=function(){s.result?Lt(s.result).then((function(e){Object.assign(a,e),n.onSuccess(a)}),(function(){n.onSuccess(a)})):n.onSuccess(a)},s.onerror=function(){a.duration=0,n.onSuccess(a)},s.readAsArrayBuffer(e)),[2]):(o===I.IMAGE&&(a.thumbnail=r.thumbnail),n.onSuccess(a),[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);kt(n,c,i).then(s)},onFail:function(e){s({code:r.UPLOAD_FILE_FAILED,msg:e||r[r.UPLOAD_FILE_FAILED]})}})}))}}var qt=Bt(I.FILE,(function(e,t){return new rt({name:e.name,size:t.file.size,type:t.file.type,fileUrl:e.downloadUrl,user:t.user,extra:t.extra})})),Ft=Bt(I.IMAGE,(function(e,t){return new Ze({content:e.thumbnail,imageUri:e.downloadUrl,user:t.user,extra:t.extra})})),Vt=Bt(I.AUDIO,(function(e,t){return new et({remoteUrl:e.downloadUrl,duration:e.duration,type:e.type,user:t.user,extra:t.extra})})),zt=Bt(I.SIGHT,(function(e,t){return new nt({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 Kt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("options.timestamp",null==t?void 0:t.timestamp,f.NUMBER),s("options.count",null==t?void 0:t.count,f.NUMBER),s("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get history message ->"+n),[4,ee.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,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:i.hasMore}}]):(w.warn("get history message fail ->"+a+":"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function Xt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("options.timestamp",null==t?void 0:t.timestamp,f.NUMBER),s("options.count",null==t?void 0:t.count,f.NUMBER),s("options.order",null==t?void 0:t.order,(function(e){return 0===e||1===e})),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("get history message ->"+n),[4,ee.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,i=o.data,a===r.SUCCESS&&i?(c=i.list.map((function(e){return $(e)})),[2,{code:a,data:{list:c,hasMore:i.hasMore}}]):(w.warn("get history message fail ->"+a+":"+ne[a]+","+n),[2,{code:a,msg:ne[a]}])}}))}))}function jt(e,t,n,o){return R(this,void 0,void 0,(function(){var a,r,i,s,c;return N(this,(function(d){switch(d.label){case 0:return a={targetId:e,conversationType:T.PRIVATE,channelId:o},r=new Je("RC:ReadNtf",{messageUId:t,lastMessageSendTime:n,type:1}),[4,kt(a,r)];case 1:return i=d.sent(),s=i.code,c=i.msg,0===s?[2,{code:s}]:[2,{code:s,msg:c}]}}))}))}function Wt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,r,i,c;return N(this,(function(d){switch(d.label){case 0:return s("messageUId",t,f.STRING,!0),s("channelId",n,f.CHANNEL_ID),o="messageUId:"+t+",targetId:"+e,w.debug("send read receipt message ->"+o),a=new Je("RC:RRReqMsg",{messageUId:t}),[4,kt({targetId:e,conversationType:T.GROUP,channelId:n},a)];case 1:return r=d.sent(),i=r.code,c=r.msg,0===i?[2,{code:i}]:[2,{code:i,msg:c}]}}))}))}function Jt(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i,c,d,u,l,g;return N(this,(function(m){switch(m.label){case 0:return s("targetId",e,f.STRING,!0),s("messageUIds",t,f.ARRAY,!0),s("channelId",n,f.CHANNEL_ID),o={targetId:e,conversationType:T.GROUP,channelId:n},i=ee.imClient.context.getInfoFromCache(),0!==(c=(null==i?void 0:i.grpRRVer)||0)?[3,2]:(d=ee.imClient.context.getCurrentUserId(),u=new Je("RC:RRRspMsg",{receiptMessageDic:(g={},g[d]=t,g)}),[4,kt(o,u)]);case 1:return a=m.sent(),[3,4];case 2:return 1!==c?[3,4]:[4,ee.imClient.context.sendReadReceiptMessage(e,t,n)];case 3:a=m.sent(),m.label=4;case 4:return(l=a.code)===r.SUCCESS?[2,{code:l}]:(w.warn("send read receipt message fail ->"+l+":"+ne[l]),[2,{code:l,msg:ne[l]}])}}))}))}function Yt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,r;return N(this,(function(i){switch(i.label){case 0:return s("conversation.type",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("lastMessageSendTime",t,f.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n=new Je("RC:SRSMsg",{lastMessageSendTime:t}),[4,kt(e,n)];case 1:return o=i.sent(),a=o.code,r=o.msg,0===a?[2,{code:a}]:[2,{code:a,msg:r}]}}))}))}function Qt(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("options.messageUId",t.messageUId,f.STRING,!0),s("options.sentTime",t.sentTime,f.NUMBER,!0),s("options.disableNotification",null==t?void 0:t.disableNotification,f.BOOLEAN),s("options.pushConfig",null==t?void 0:t.pushConfig,f.OBJECT),s("conversation.channelId",null==e?void 0:e.channelId,f.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,w.debug("recall message ->"+o),[4,ee.imClient.context.recallMessage(e.conversationType,e.targetId,t.messageUId,t.sentTime,n)];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS&&c?[2,{code:i,data:$(c)}]:(w.warn("recall message fail ->"+i+":"+ne[i]+","+o),[2,{code:i,msg:ne[i]}])}}))}))}function $t(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options",t,(function(e){return c(e)&&e.length}),!0),t.forEach((function(e){s("options.messageUId",e.messageUId,f.STRING,!0),s("options.sentTime",e.sentTime,f.NUMBER,!0),s("options.messageDirection",e.messageDirection,(function(e){return 1===e||2===e}),!0)})),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("delete messages ->"+n),[4,ee.imClient.context.deleteRemoteMessage(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("delete message fail ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:r.SUCCESS}]}}))}))}function Zt(e,t){return R(this,void 0,void 0,(function(){var n,o;return N(this,(function(a){switch(a.label){case 0:return s("options.timestamp",t,f.NUMBER,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("clear message ->"+n),[4,ee.imClient.context.deleteRemoteMessageByTimestamp(e.conversationType,e.targetId,t,e.channelId)];case 1:return(o=a.sent())!==r.SUCCESS?(w.warn("clear message ->"+o+":"+ne[o]+","+n),[2,{code:o,msg:ne[o]}]):[2,{code:r.SUCCESS}]}}))}))}function en(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,d,u,l;return N(this,(function(g){switch(g.label){case 0:return s("expansion",e,f.OBJECT,!0),s("message",t,f.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.canIncludeExpansion,c=t.expansion,d=t.channelId,u="conversationType:"+n+",targetId:"+o+",messageUId:"+a,w.debug("update message expansion ->"+u),[4,ee.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,expansion:e,canIncludeExpansion:i,originExpansion:c,channelId:d})];case 1:return(l=g.sent().code)!==r.SUCCESS?(w.warn("update message expansion fail ->"+l+":"+ne[l]+","+u),[2,{code:l,msg:ne[l]}]):[2,{code:l}]}}))}))}function tn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c,d,u;return N(this,(function(l){switch(l.label){case 0:return s("keys",e,f.ARRAY,!0),s("message",t,f.OBJECT,!0),n=t.conversationType,o=t.targetId,a=t.messageUId,i=t.canIncludeExpansion,c=t.channelId,d="conversationType:"+n+",targetId:"+o+",messageUId:"+a,w.debug("remove message expansion ->"+d),[4,ee.imClient.context.sendExpansionMessage({conversationType:n,targetId:o,messageUId:a,canIncludeExpansion:i,keys:e,channelId:c})];case 1:return(u=l.sent().code)!==r.SUCCESS?(w.warn("remove message expansion fail ->"+u+":"+ne[u]+","+d),[2,{code:u,msg:ne[u]}]):[2,{code:u}]}}))}))}function nn(e,t){return R(this,void 0,void 0,(function(){var n,o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("typingContentType",t,f.STRING,!0),n="conversationType:"+e.conversationType+",targetId:"+e.targetId,w.debug("send typing status message ->"+n),o={messageType:"RC:TypSts",content:{typingContentType:t},isStatusMessage:!0,channelId:e.channelId},[4,ee.imClient.context.sendMessage(e.conversationType,e.targetId,o)];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS?[2,{code:i,data:$(c)}]:(w.warn("send typing status message fail ->"+i+":"+ne[i]+","+n),[2,{code:i,msg:ne[i]}])}}))}))}function on(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i,c;return N(this,(function(d){switch(d.label){case 0:return s("messageUId",t,f.STRING,!0),o="messageUId:"+t+",targetId:"+e,w.debug("get message reader ->"+o),[4,ee.imClient.context.getMessageReader(e,t,n)];case 1:return a=d.sent(),i=a.code,c=a.data,i===r.SUCCESS?[2,{code:i,data:c}]:(w.warn("get message reader fail ->"+i+":"+ne[i]+","+o),[2,{code:i,msg:ne[i]}])}}))}))}function an(e,t,n,o){return s("messageType",e,f.STRING,!0),s("isPersited",t,f.BOOLEAN,!0),s("isCounted",n,f.BOOLEAN,!0),ee.imClient.context.registerMessageType(e,t,n,o),Ye(e,t,n)}function rn(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return h()?(s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",null==e?void 0:e.channelId,f.CHANNEL_ID),[4,ee.imClient.context.getFirstUnreadMessage(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:o}]:(w.warn("insertMessage ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function sn(e,t,n){return void 0===n&&(n={}),R(this,void 0,void 0,(function(){var o,a,i,s,c,d,u,l,g,f,m,p,v,I,S,C;return N(this,(function(T){switch(T.label){case 0:return h()?(o=t.senderUserId,a=t.messageType,i=t.content,s=t.messageDirection,c=t.messageUId,d=t.canIncludeExpansion,u=t.expansion,l=t.disableNotification,g=t.sentTime,f=t.sentStatus,w.info("insertMessage ->targetId:"+e.targetId+",conversationType:"+e.conversationType),m=n.isUnread,p=n.searchContent,v={senderUserId:o,messageType:a,content:i,messageDirection:s,sentTime:g,sentStatus:f,searchContent:p,isUnread:m,messageUId:c,disableNotification:l,canIncludeExpansion:d,expansionMsg:JSON.stringify(u),channelId:e.channelId||""},[4,ee.imClient.context.insertMessage(e.conversationType,e.targetId,v)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return I=T.sent(),S=I.code,C=I.data,S===r.SUCCESS?[2,{code:S,data:$(C)}]:(w.warn("insertMessage ->code:"+S+",targetId:"+e.targetId),[2,{code:S,msg:ne[S]}])}}))}))}function cn(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return h()?[4,ee.imClient.context.getMessage(e)]:[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return t=a.sent(),n=t.code,o=t.data,n===r.SUCCESS?[2,{code:n,data:$(o)}]:(w.warn("getMessage ->code:"+n+",messageId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function dn(e){if(!h())return{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]};s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.STRING,!0);var t=ee.imClient.context.getUnreadMentionedMessages(e.conversationType,e.targetId),n=[];return t&&t.length&&t.forEach((function(e){return n.push($(e))})),{code:r.SUCCESS,data:n}}function un(e,t,n,o){return R(this,void 0,void 0,(function(){var a,i,c,d;return N(this,(function(u){switch(u.label){case 0:return h()?(s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.STRING,!0),s("keyword",t,f.STRING,!0),s("timestamp",n,f.NUMBER),s("count",o,f.NUMBER),1,[4,ee.imClient.context.searchMessageByContent(e.conversationType,e.targetId,t,n,o,1,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return a=u.sent(),i=a.code,c=a.data,i===r.SUCCESS?(d=[],(null==c?void 0:c.messages)&&c.messages.length&&c.messages.forEach((function(e){return d.push($(e))})),[2,{code:i,data:{messages:d,count:null==c?void 0:c.count}}]):(w.warn("searchMessages ->code:"+i+",targetId:"+e.targetId),[2,{code:i,msg:ne[i]}])}}))}))}function ln(e,t,n){return R(this,void 0,void 0,(function(){var o;return N(this,(function(a){switch(a.label){case 0:return h()?(s("conversationType",e.conversationType,f.NUMBER,!0),s("targetId",e.targetId,f.STRING,!0),s("timestamp",t,f.NUMBER,!0),s("cleanSpace",n,f.BOOLEAN),[4,ee.imClient.context.deleteMessagesByTimestamp(e.conversationType,e.targetId,t,n,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(o=a.sent())===r.SUCCESS?[2,{code:o}]:(w.warn("deleteLocalMessagesByTimestamp ->code:"+o+",targetId:"+e.targetId),[2,{code:o,msg:ne[o]}])}}))}))}function gn(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return h()?(w.info("clearMessages ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.clearMessages(e.conversationType,e.targetId,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(t=n.sent())===r.SUCCESS?[2,{code:t}]:(w.warn("clearMessages ->code:"+t+",targetId:"+e.targetId),[2,{code:t,msg:ne[t]}])}}))}))}function fn(e,t,n,o){return R(this,void 0,void 0,(function(){var a,i,s;return N(this,(function(c){switch(c.label){case 0:return h()?(w.info("searchConversationByContent ->keyword:"+e),[4,ee.imClient.context.searchConversationByContent(e,n,o,t)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return a=c.sent(),i=a.code,s=a.data,i===r.SUCCESS?[2,{code:i,data:s}]:(w.warn("searchConversationByContent ->code:"+i+",keyword:"+e),[2,{code:i,msg:ne[i]}])}}))}))}function mn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return h()?(w.info("clearUnreadCountByTimestamp ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.clearUnreadCountByTimestamp(e.conversationType,e.targetId,t,e.channelId)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("clearUnreadCountByTimestamp ->code:"+n+",targetId:"+e.targetId),[2,{code:n,msg:ne[n]}])}}))}))}function hn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return h()?(s("messageId",e,f.NUMBER,!0),s("receivedStatus",t,f.NUMBER,!0),w.info("setMessageReceivedStatus ->messageId:"+e+",receivedStatus:"+t),[4,ee.imClient.context.setMessageReceivedStatus(e,t)]):[2,{code:r.NOT_SUPPORT,msg:ne[r.NOT_SUPPORT]}];case 1:return(n=o.sent())===r.SUCCESS?[2,{code:n}]:(w.warn("setMessageReceivedStatus ->code:"+n+",messageId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function pn(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return s("tag.tagId",e.tagId,f.STRING,!0),s("tag.tagId",e.tagId,(function(e){return e.length<=10})),s("tag.tagName",e.tagName,(function(e){return e.length<=15})),s("tag.tagName",e.tagName,f.STRING,!0),w.info("createTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,ee.imClient.context.createTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("createTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:ne[t]}])}}))}))}function vn(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return s("tagId",e,f.STRING,!0),w.info("removeTag ->tagId:"+e),[4,ee.imClient.context.removeTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("removeTag ->code:"+t+",tagId:"+e),[2,{code:t,msg:ne[t]}])}}))}))}function In(e){return R(this,void 0,void 0,(function(){var t;return N(this,(function(n){switch(n.label){case 0:return s("tag.tagId",e.tagId,f.STRING,!0),s("tag.tagName",e.tagName,f.STRING,!0),s("tag.tagName",e.tagName,(function(e){return e.length<=15})),w.info("updateTag ->tagId:"+e.tagId+",tagName:"+e.tagName),[4,ee.imClient.context.updateTag(e)];case 1:return(t=n.sent().code)===r.SUCCESS?[2,{code:t}]:(w.warn("updateTag ->code:"+t+",tagId:"+e.tagId),[2,{code:t,msg:ne[t]}])}}))}))}function Sn(){return R(this,void 0,void 0,(function(){var e,t,n;return N(this,(function(o){switch(o.label){case 0:return[4,ee.imClient.context.getTagList()];case 1:return e=o.sent(),t=e.code,n=e.data,t===r.SUCCESS?[2,{code:r.SUCCESS,data:n}]:(w.warn("getTagList ->code:"+t),[2,{code:t,msg:ne[t]}])}}))}))}function Cn(e){return R(this,void 0,void 0,(function(){var t,n,o;return N(this,(function(a){switch(a.label){case 0:return s("conversationType",e.conversationType,f.NUMBER),s("targetId",e.targetId,f.STRING),s("channelId",e.channelId,f.CHANNEL_ID),w.info("getTagsForConversation ->targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.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:ne[n]}]}}))}))}function Tn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return s("tagId",e,f.STRING,!0),s("conversations",t,f.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID)})),w.info("addTagForConversations ->tagId:"+e),[4,ee.imClient.context.addTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("addTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function En(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return s("tagId",e,f.STRING,!0),s("conversations",t,f.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID)})),w.info("removeTagForConversations ->tagId:"+e),[4,ee.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function yn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID),s("tagIds",t,f.ARRAY,!0),t.forEach((function(e){s("tagId",e,f.STRING,!0)})),w.info("removeTagsForConversation ->tagIds:"+t+",targetId:"+e.targetId+",conversationType:"+e.conversationType),[4,ee.imClient.context.removeTagsForConversation(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagsForConversation ->code:"+n+",tagIds:"+t),[2,{code:n,msg:ne[n]}])}}))}))}function Rn(e,t){return R(this,void 0,void 0,(function(){var n;return N(this,(function(o){switch(o.label){case 0:return s("tagId",e,f.STRING,!0),s("conversations",t,f.ARRAY,!0),t.forEach((function(e){s("conversation.conversationType",e.conversationType,f.NUMBER,!0),s("conversation.targetId",e.targetId,f.STRING,!0),s("conversation.channelId",e.channelId,f.CHANNEL_ID)})),w.info("removeTagForConversations ->tagId:"+e),[4,ee.imClient.context.removeTagForConversations(e,t)];case 1:return(n=o.sent().code)===r.SUCCESS?[2,{code:n}]:(w.warn("removeTagForConversations ->code:"+n+",tagId:"+e),[2,{code:n,msg:ne[n]}])}}))}))}function Nn(e,t,n){return R(this,void 0,void 0,(function(){var o,a,i;return N(this,(function(c){switch(c.label){case 0:return s("tagId",e,f.STRING,!0),s("count",t,f.NUMBER,!0),s("startTime",n,f.NUMBER,!0),w.info("getConversationListByTag ->tagId:"+e),[4,ee.imClient.context.getConversationListByTag(e,n,t)];case 1:return o=c.sent(),a=o.code,i=o.data,a===r.SUCCESS?[2,{code:a,data:i}]:(w.warn("getConversationListByTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:ne[a]}])}}))}))}function wn(e,t){return R(this,void 0,void 0,(function(){var n,o,a;return N(this,(function(i){switch(i.label){case 0:return s("tagId",e,f.STRING,!0),s("containMuted",t,f.BOOLEAN,!0),w.info("getUnreadCountByTag ->tagId:"+e),[4,ee.imClient.context.getUnreadCountByTag(e,t)];case 1:return n=i.sent(),o=n.code,a=n.data,w.info(o,a),o===r.SUCCESS?[2,{code:o,data:a}]:(w.warn("getUnreadCountByTag ->code:"+o+",tagId:"+e),[2,{code:o,msg:ne[o]}])}}))}))}function On(e,t,n){return R(this,void 0,void 0,(function(){var o,a;return N(this,(function(i){switch(i.label){case 0:return s("tagId",e,f.STRING,!0),s("conversation.targetId",t.targetId,f.STRING,!0),s("conversation.conversationType",t.conversationType,f.NUMBER,!0),s("conversation.channelId",t.channelId,f.CHANNEL_ID),s("status.isTop",n,f.BOOLEAN,!0),w.info("setConversationStatusInTag ->tagId:"+e+",targetId:"+t.targetId+",conversationType"+t.conversationType),[4,ee.imClient.context.setConversationStatusInTag(e,t,{isTop:n})];case 1:return o=i.sent(),(a=o.code)===r.SUCCESS?[2,{code:a}]:(w.warn("setConversationStatusInTag ->code:"+a+",tagId:"+e),[2,{code:a,msg:ne[a]}])}}))}))}Bt(I.COMBINE_HTML,(function(e,t){return new at({remoteUrl:e.downloadUrl,nameList:t.nameList,summaryList:t.summaryList,conversationType:t.conversationType,user:t.user,extra:t.extra})}));var Mn={COMET:"comet",WEBSOCKET:"websocket"},Un={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"};E.add("imlib","5.0.1-custom-qihoo.4"),E.validEngine("5.0.1-custom-qihoo.4")||w.error("The current engine version '"+E.getInfo().engine+"' error,imlib required engine version at least '5.0.1-custom-qihoo.4'.");export{Je as BaseMessage,at as CombineMessage,Mn as ConnectType,U as Events,rt as FileMessage,it as GIFMessage,et as HQVoiceMessage,Ze as ImageMessage,ct as LocationMessage,Un as MessageType,dt as ReferenceMessage,ut as RichContentMessage,nt as SightMessage,ot as TextMessage,st as VoiceMessage,Tn as addConversationsToTag,me as addEventListener,pn as addTag,Ie as clearEventListeners,Zt as clearHistoryMessages,gn as clearMessages,we as clearMessagesUnreadStatus,ye as clearTextMessageDraft,mn as clearUnreadCountByTimestamp,de as connect,ln as deleteLocalMessagesByTimestamp,$t as deleteMessages,ue as disconnect,Ke as forceRemoveChatRoomEntry,Fe as forceSetChatRoomEntry,je as getAllChatRoomEntries,Ae as getAllUnreadMentionedCount,Ue as getBlockedConversationList,Xe as getChatRoomEntry,Ge as getChatRoomInfo,We as getChatroomHistoryMessages,le as getConnectionStatus,Se as getConversationList,Me as getConversationNotificationStatus,Nn as getConversationsFromTagByPage,fe as getCurrentUserId,Dt as getFileToken,Ht as getFileUrl,rn as getFirstUnreadMessage,Kt as getHistoryMessages,cn as getMessage,on as getMessageReader,Xt as getRemoteHistoryMessages,ge as getServerTime,Sn as getTags,Cn as getTagsFromConversation,Te as getTextMessageDraft,xe as getTopConversationList,Re as getTotalUnreadCount,Ne as getUnreadCount,wn as getUnreadCountByTag,be as getUnreadMentionedCount,dn as getUnreadMentionedMessages,se as init,sn as insertMessage,ce as installPlugin,De as joinChatRoom,He as joinExistChatRoom,he as onceEventListener,ke as quitChatRoom,Qt as recallMessage,an as registerMessageType,ze as removeChatRoomEntries,Ve as removeChatRoomEntry,Ce as removeConversation,En as removeConversationsFromTag,pe as removeEventListener,ve as removeEventListeners,tn as removeMessageExpansionForKey,vn as removeTag,Rn as removeTagFromConversations,yn as removeTagsFromConversation,Ee as saveTextMessageDraft,fn as searchConversationByContent,un as searchMessages,qt as sendFileMessage,Vt as sendHQVoiceMessage,Ft as sendImageMessage,kt as sendMessage,jt as sendReadReceiptMessage,Wt as sendReadReceiptRequest,Jt as sendReadReceiptResponse,zt as sendSightMessage,Yt as sendSyncReadStatusMessage,Gt as sendTextMessage,nn as sendTypingStatusMessage,qe as setChatRoomEntries,Be as setChatRoomEntry,Oe as setConversationNotificationStatus,_e as setConversationToTop,On as setConversationToTopInTag,hn as setMessageReceivedStatus,en as updateMessageExpansion,In as updateTag};
|