From 31e0f638569db99546d6e4019177b08430fe852f Mon Sep 17 00:00:00 2001 From: Mayur Bhandari Date: Wed, 31 Mar 2021 21:06:27 +0530 Subject: [PATCH] v2.3.0 --- CometChat.d.ts | 30 +++++++++++++++++++----------- CometChat.js | 2 +- README.md | 4 ++-- package.json | 2 +- 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/CometChat.d.ts b/CometChat.d.ts index 2f3f7e6..1ddef3d 100644 --- a/CometChat.d.ts +++ b/CometChat.d.ts @@ -555,6 +555,17 @@ export namespace CometChat { */ export function getActiveCall(): Call; + /** + * function to fetch participant count of an ongoing call. + * + * @static + * @param {string} sessionId + * @param {string} type + * @returns {Promise} + * @memberof CometChat + */ + export function getCallParticipantCount(sessionId: string, type: string): Promise; + /** * function will inform the server that current outgoing call is timedout for the call with the session id provided as an argument. * and will also add the same in localstorage on success. @@ -803,11 +814,6 @@ export namespace CometChat { constructor(userObj: UserObj | any); getWsChannel(): any; } - - export class RTCUser { - constructor(uid: string, name: string, avatar: string); - } - export class Conversation { setConversationId(conversationId: string): void; setConversationType(conversationType: string): void; @@ -1635,6 +1641,7 @@ export namespace CometChat { onUserLeft?: Function; onCallEnded?: Function; onError?: Function; + onUserListUpdated?: Function; constructor(...args: any[]); } export class LoginListener { @@ -1992,8 +1999,6 @@ export namespace CometChat { getSessionId(): string; isAudioOnlyCall(): boolean; isDefaultLayoutEnabled(): boolean; - getUser(): RTCUser; - getRegion(): string; getCallEventListener(): OngoingCallListener getMode(): string; isEndCallButtonEnabled(): boolean; @@ -2001,14 +2006,14 @@ export namespace CometChat { isMuteAudioButtonEnabled(): boolean; isPauseVideoButtonEnabled(): boolean; isAudioModeButtonEnabled(): boolean; + getStartWithAudioMuted(): boolean; + getStartWithVideoMuted(): boolean; } export class CallSettingsBuilder { sessionID: string; defaultLayout: boolean; isAudioOnly: boolean; - region: string; - user: RTCUser; listener: OngoingCallListener; mode: string; ShowEndCallButton: boolean; @@ -2016,11 +2021,12 @@ export namespace CometChat { ShowMuteAudioButton: boolean; ShowPauseVideoButton: boolean; ShowAudioModeButton: boolean; + StartAudioMuted: boolean; + StartVideoMuted: boolean; + setSessionID(sessionID: string): this; enableDefaultLayout(defaultLayout: boolean): this; setIsAudioOnlyCall(isAudioOnly: boolean): this; - setRegion(region: string): this; - setUser(user: RTCUser): this; setCallEventListener(listener: OngoingCallListener): this; setMode(mode: string): this; showEndCallButton(showEndCallButton: boolean): this; @@ -2028,6 +2034,8 @@ export namespace CometChat { showMuteAudioButton(showMuteAudioButton: boolean): this; showPauseVideoButton(showPauseVideoButton: boolean): this; showAudioModeButton(showAudioModeButton: boolean): this; + startWithAudioMuted(audioMuted: boolean): this; + startWithVideoMuted(videoMuted: boolean): this; build(): CallSettings; } diff --git a/CometChat.js b/CometChat.js index 6ed85d0..11dfbd5 100644 --- a/CometChat.js +++ b/CometChat.js @@ -1 +1 @@ -!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@react-native-async-storage/async-storage"),require("@cometchat-pro/react-native-calls"),require("react"),require("react-native"));else if("function"==typeof define&&define.amd)define(["@react-native-async-storage/async-storage","@cometchat-pro/react-native-calls","react","react-native"],t);else{var n="object"==typeof exports?t(require("@react-native-async-storage/async-storage"),require("@cometchat-pro/react-native-calls"),require("react"),require("react-native")):t(e["@react-native-async-storage/async-storage"],e["@cometchat-pro/react-native-calls"],e.react,e["react-native"]);for(var s in n)("object"==typeof exports?exports:e)[s]=n[s]}}(window,function(n,s,o,r){return function(n){var s={};function o(e){if(s[e])return s[e].exports;var t=s[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=s,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)o.d(n,s,function(e){return t[e]}.bind(null,s));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=43)}([function(e,t,n){"use strict";t.__esModule=!0;var s,o,r,i=n(2);t.constants={DEFAULT_STORE:"cometchat",MSG_VER_PRE:"store-ver-pre",MSG_VER_POST:"store-ver-post"},t.DEFAULT_VALUES={ZERO:0,MSGS_LIMIT:30,MSGS_MAX_LIMIT:100,USERS_LIMIT:30,USERS_MAX_LIMIT:100,GROUPS_LIMIT:30,GROUPS_MAX_LIMIT:100,CONVERSATION_MAX_LIMIT:50,CALL_TIMEOUT:45,DEFAULT_MSG_ID:0,DEFAULT_MAX_TYPING_INDICATOR_LIMIT:5,REGION_DEFAULT:"eu",REGION_DEFAULT_EU:"eu",REGION_DEFAULT_US:"us",REGION_DEFAULT_IN:"in",REGION_DEFAULT_PRIVATE:"private"},(s=t.GroupType||(t.GroupType={})).Public="public",s.Private="private",s.Protected="protected",s.Password="password",t.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(o=t.GroupMemberScope||(t.GroupMemberScope={})).Admin="admin",o.Moderator="moderator",o.Member="member",t.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},t.APPINFO={platform:"REACT_NATIVE",sdkVersion:"v2.2.1",apiVersion:"v2.0",sdkVersionWithUnderScore:"2_2_1"},t.SDKHeader={platform:"react-native",sdkVersion:"2.2.1",sdk:"%s@%s"},t.XMPP={host:"encke.cometchat.com",port:7443,ws_url:"/ws/",bind_url:"/http-bind/",deafult_password:"CometChat",PUBSUB_CHANNEL:"pubsub",jid_string:"[%s]%s@%s/%s",bare_jid_string:"[%s]%s@%s",username_string:"[%s]%s",muc_jid_string:"[%s]%s@%s.%s",pubsub_global_string:"[%s]global_presence",pubsub_default_string:"[%s]default",pubsub_role_string:"[%s]%s",xmpp_resource:"javascripts_"+(new Date).getTime(),CONVERSATION:{TYPE:{CHAT:"chat",GROUP_CHAT:"groupchat"}}},t.ANALYTICS={analyticsHost:"metrics-%s.cometchat.io",analyticsVersion:"v1"},t.LOCAL_STORE={COMMON_STORE:"common_store",MESSAGE_LISTENERS_LIST:"message_listeners_list",USERS_STORE:"users_store",MESSAGES_STORE:"messages_store",KEYS_STORE:"keys_store",STORE_STRING:"%s:%s",KEY_STRING:"%s/%s",KEY_USER:"user",KEY_APP_SETTINGS:"app_settings",KEY_APP_ID:"appId",KEY_DEVICE_ID:"deviceId",KEY_MESSAGE_LISTENER_LIST:"all"},t.ResponseConstants={RESPONSE_KEYS:{KEY_DATA:"data",KEY_META:"meta",KEY_CURSOR:"cursor",KEY_ACTION:"action",KEY_MESSAGE:"message",KEY_ERROR:"error",KEY_ERROR_DETAILS:"details",KEY_ERROR_CODE:"code",KEY_ERROR_MESSAGE:"message",KEY_AUTH_TOKEN:"authToken",KEY_WS_CHANNEL:"wsChannel",KEY_IDENTITY:"identity",KEY_SERVICE:"identity",KEY_ENTITIES:"entities",KEY_ENTITITY:"entity",KEY_ENTITYTYPE:"entityType",KEY_ATTACHMENTS:"attachments",CODE_REQUEST_OK:200,CODE_BAD_REQUEST:401,UNREAD_UNDELIVERED_KEYS:{ENTITY:"entity",ENTITY_TYPE:"entityType",ENTITY_Id:"entityId",COUNT:"count"},GROUP_MEMBERS_RESPONSE:{SUCCESS:"success",ERROR:"error",MESSAGE:"message"},KEY_ENTITY_TYPE:{USER:"user",GROUP:"group"}}},t.DELIVERY_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",RECEIVED:"delivered",DELIVERED_AT:"deliveredAt",ID:"id",TIME:"time",DELIVERED_TO_ME_AT:"deliveredToMeAt"},t.READ_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",READ:"read",READ_AT:"readAt",ID:"id",TIME:"time",READ_BY_ME_AT:"readByMeAt"},t.MessageConstatnts={XMPP_KEYS:{FROM:"from",TO:"to",TYPE:"type",TYPE_USER:"chat",TYPE_GROUP:"groupchat"},TYPE:{TEXT:"text",MEDIA:"media",IMAGE:"image",VIDEO:"video",AUDIO:"audio",FILE:"file",CUSTOM:"custom"},CATEGORY:{MESSAGE:"message",ACTION:"action",CALL:"call",CUSTOM:"custom"},RECEIVER_TYPE:{USER:"user",GROUP:"group"},KEYS:{ATTATCHMENT:"attatchment",ATTATCHMENTS:"attachments",ACTION:"action",TYPE:"type",DATA:"data",ID:"id",MUID:"muid",SENDER:"sender",RECEIVER:"receiver",RECEIVER_ID:"receiverId",CATEGORY:"category",RECEIVER_TYPE:"receiverType",SENT_AT:"sentAt",STATUS:"status",TEXT:"text",URL:"url",METADATA:"metadata",RECEIPTS:"receipts",MY_RECEIPTS:"myReceipt",CUSTOM_DATA:"customData",CUSTOM_SUB_TYPE:"subType",RESOURCE:"resource"},KNOWN_MEDIA_TYPE:{IMAGE:[],VIDEO:[],AUDIO:[],FILE:[]},PAGINATION:{AFFIX:{APPEND:"append",PREPEND:"prepend"},CURSOR_FILEDS:{ID:"id",SENT_AT:"sentAt"},CURSOR_AFFIX_DEFAULT:"prepend",CURSOR_FIELD_DEFAULT:"sentAt",KEYS:{PER_PAGE:"per_page",CURSOR_AFFIX:"cursorAffix",AFFIX:"affix",CURSOR_FIELD:"cursorField",CURSOR_VALUE:"cursorValue",UID:"uid",SENT_AT:"sentAt",ID:"id",CURRENT_PAGE:"page",UNREAD:"unread",HIDE_MESSAGES_FROM_BLOCKED_USER:"hideMessagesFromBlockedUsers",SEARCH_KEY:"searchKey",ONLY_UPDATES:"onlyUpdates",UPDATED_AT:"updatedAt",CATEGORY:"category",CATEGORIES:"categories",TYPE:"type",TYPES:"types",HIDE_REPLIES:"hideReplies"}}},t.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(r=t.MessageCategory||(t.MessageCategory={})).ACTION="action",r.MESSAGE="message",r.CALL="call",r.CUSTOM="custom",t.TYPING_NOTIFICATION={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"receiverType",META:"metadata",KEYS:{TYPING_NOTIFICATION:"typingNotification",TIMESTAMP:"timestamp"},ACTIONS:{STARTED:"started",ENDED:"ended"}},t.ActionConstatnts={ACTION_SUBJECTS:{ACTION_ON:"on",ACTION_BY:"by",ACTION_FOR:"for"},ACTION_ENTITY_TYPE:{GROUP_USER:"groupuser",USER:"user",GROUP:"group",MESSAGE:"message"},ACTION_KEYS:{ACTION_CREATED:"created",ACTION_UPDATED:"updated",ACTION_DELETED:"deleted",ENTITIES:"entities",ENTITY:"entity",ENTITY_TYPE:"entityType",TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_ADDED:"added",ACTION_SCOPE_CHANGED:"scopeChanged",ACTION_TYPE_USER:"user",ACTION_TYPE_GROUP:"group",ACTION_TYPE_GROUP_MEMBER:"groupMember",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",ACTION_TYPE_CALL:"call",EXTRAS:"extras",SCOPE:"scope",NEW:"new",OLD:"old"},ActionMessages:{ACTION_GROUP_JOINED_MESSAGE:"%s joined",ACTION_GROUP_LEFT_MESSAGE:"%s left",ACTION_MEMBER_KICKED_MESSAGE:"%s kicked %s",ACTION_MEMBER_BANNED_MESSAGE:"%s banned %s",ACTION_MEMBER_UNBANNED_MESSAGE:"%s unbanned %s",ACTION_MEMBER_INVITED_MESSAGE:"%s banned %s",ACTION_MESSAGE_EDITED_MESSAGE:" Message Edited",ACTION_MESSAGE_DELETED_MESSAGE:"Message Deleted",ACTION_MEMBER_SCOPE_CHANGED:"%s made %s %s",ACTION_MEMBER_ADDED_TO_GROUP:"%s added %s"},ACTION_TYPE:{TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_SCOPE_CHANGED:"scopeChanged",TYPE_MESSAGE:"message",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",TYPE_MEMBER_ADDED:"added"},ACTIONS:{MEMBER_ADDED:"added",MEMBER_JOINED:"joined",MEMBER_LEFT:"left",MEMBER_KICKED:"kicked",MEMBER_BANNED:"banned",MEMBER_UNBANNED:"unbanned",MEMBER_INVITED:"invited",MEMBER_SCOPE_CHANGED:"scopeChanged",MESSAGE_EDITED:"edited",MESSSAGE_DELETED:"deleted",TYPE_USER:"user",TYPE_GROUP:"group",TYPE_GROUP_MEMBER:"groupMember"}},t.BlockedUsersConstants={REQUEST_KEYS:{DIRECTIONS:{BOTH:"both",HAS_BLOCKED_ME:"hasBlockedMe",BLOCKED_BY_ME:"blockedByMe"}}},t.CallConstants={CALL_MODE:{DEFAULT:"DEFAULT",SPOTLIGHT:"SPOTLIGHT",SINGLE:"SINGLE"},AUDIO_MODE:{SPEAKER:"speaker",EARPIECE:"earpiece"},CALL_TYPE:{AUDIO:"audio",VIDEO:"video"},RECEIVER_TYPE_GROUP:"group",RECEIVER_TYPE_USER:"user",CALL_KEYS:{CALL_DATA:"data",CALL_ID:"id",CALL_SESSION_ID:"sessionid",CALL_RECEIVER:"receiver",CALL_SENDER:"sender",CALL_RECEIVER_TYPE:"receiverType",CALL_STATUS:"status",CALL_TYPE:"type",CALL_INITIATED_AT:"initiatedAt",CALL_JOINED_AT:"joinedAt",CALL_LEFT_AT:"leftAt",CALL_METADATA:"metadata",CALL_ENTITIES:"entities",CALL_ENTITY_TYPE:"entityType",CALL_ENTITY:"entity",CALL_ENTITY_USER:"user",CALL_ENTITY_GROUP:"group"},CALL_STATUS:{INITIATED:"initiated",ONGOING:"ongoing",UNANSWERED:"unanswered",REJECTED:"rejected",BUSY:"busy",CANCELLED:"cancelled",ENDED:"ended"}},t.GroupConstants={KEYS:{NAME:"name",GUID:"guid",TYPE:"type",PASSWORD:"password",ICON:"icon",DESCRIPTION:"description",OWNER:"owner",METADATA:"metadata",CREATED_AT:"createdAt",UPDATED_AT:"updatedAt",HAS_JOINED:"hasJoined",WS_CHANNEL:"wsChannel",TAGS:"tags"}},t.GroupMemersConstans={KEYS:{SCOPE:"scope",UID:"uid",GUID:"guid",USER:"user",NAME:"name"}},t.UserConstants={UID:"uid",NAME:"name",AUTH_TOKEN:"authToken",AVATAR:"avatar",LAST_ACTIVE_AT:"lastActiveAt",LINK:"link",META_DATA:"metadata",ROLE:"role",STATUS:"status",STATUS_MESSAGE:"statusMessage",USER_NAME:"user_name",TAGS:"tags"},t.Errors={ERROR_IO_EXCEPTION:"ERROR_IO_EXCEPTION",ERROR_JSON_EXCEPTION:"ERROR_JSON_EXCEPTION",ERROR_PASSWORD_MISSING:"ERROR_PASSWORD_MISSING",ERROR_LIMIT_EXCEEDED:"ERROR_LIMIT_EXCEEDED",ERROR_USER_NOT_LOGGED_IN:"ERROR_USER_NOT_LOGGED_IN",ERROR_INVALID_GUID:"ERROR_INVALID_GUID",ERROR_PASSWORD_MISSING_MESSAGE:"Password is mandatory for a password group",ERROR_LIMIT_EXCEEDED_MESSAGE:"Limit Exceeded Max limit of %s",ERROR_USER_NOT_LOGGED_IN_MESSAGE:"Please log in to CometChat before calling this method",ERROR_INVALID_GUID_MESSAGE:"Please provide a valid GUID",ERROR_DEFAULT_MESSAGE:"Something went wrong",ERR_SETTINGS_HASH_OUTDATED:"ERR_SETTINGS_HASH_OUTDATED",ERR_NO_AUTH:"ERR_NO_AUTH",ERR_XMPP_CONFLICT:"conflict"},t.CALL_ERROR={CALL_ALREADY_INITIATED:{code:"CALL_ALREADY_INITIATED",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},ERROR_IN_CALLING:{code:"CALL_IN_PROGRESS",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},CANNOT_ACCEPT_CALL:{code:"OTHER_CALL_ONGOING",name:"OTHER_CALL_ONGOING",message:"There is already a call in progress",details:{}},NOT_INITIALIZED:{code:"NOT_INITIALIZED",name:"NOT_INITIALIZED",message:"Please call the CometChat.init() method before calling any other methods related to CometChat.",details:{}},NOT_LOGGED_IN:{code:"NOT_LOGGED_IN",name:"NOT_LOGGED_IN",message:"Please login before starting a call.",details:{}},SESSION_ID_REQUIRED:{code:"SESSION_ID_REQUIRED",name:"SESSION_ID_REQUIRED",message:"Please make sure you are passing correct session id.",details:{}}},t.PARAMETER_ERROR={PARAMETER_REQUIRED:{code:"%s_NOT_PROVIDED",name:"%s_NOT_PROVIDED",message:"please provide the %s.",details:{}}},t.GENERAL_ERROR={MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a string.",details:{}},MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a number.",details:{}},MUST_BE_A_OBJECT:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a object.",details:{}},MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be an array.",details:{}},MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a boolean.",details:{}},MUST_BE_A_BLOB:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a blob.",details:{}},INVALID:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s. Please provide a valid %s.",details:{}},METHOD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s is required.",details:{}},LIMIT_EXCEEDED:{code:"ERROR_%s_EXCEEDED",name:"ERROR_%s_EXCEEDED",message:"Limit exceeded max limit of %s.",details:{}},MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a postive integer greater than 0.",details:{}},INVALID_MEDIA_FILE:{code:"INVALID_%s",name:"INVALID_%s",message:"The message type does not match the file's mime type.",details:{}},EMPTY_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s cannot be empty.",details:{}},MISSING_KEY:{code:"MISSING_KEY",name:"MISSING_KEY",message:"The key %s is missing from the %s object.",details:{}},EMPTY_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"The parameter %s should be an array and it cannot be empty.",details:{}},INVALID_SEARCH_KEYWORD:{code:"INVALID_SEARCH_KEYWORD",name:"INVALID_SEARCH_KEYWORD",message:"Invalid search keyword. Please provide a valid search keyword.",details:{}},INVALID_GROUP_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for the group. Please provide a valid %s.",details:{}},INVALID_USER_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for a user. Please provide a valid %s.",details:{}},PARAMETER_MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a number.",details:{}},PARAMETER_MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as an array.",details:{}},PARAMETER_MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a boolean.",details:{}},PARAMETER_MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter to be a positive number greater than 0.",details:{}},PARAMETER_MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a string.",details:{}},PARAMETER_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s cannot be blank. Please provide a valid %s.",details:{}},PASSWORD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"Password is mandatory for a password group.",details:{}},INVALID_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}}},t.UserErrors={INVALID_STATUS:new i.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new i.CometChatException({code:"INVALID_DIRECTION_VALUE",name:"INVALID_DIRECTION_VALUE",message:"The `direction` parameter accepts only `both`, `blockeyByMe` or `hasBlockedMe`.",details:""}),USER_NOT_LOGGED_IN:new i.CometChatException({code:"USER_NOT_LOGGED_IN",name:"USER_NOT_LOGGED_IN",message:"Please log in to CometChat before calling this method.",details:""})},t.GroupErrors={NOT_A_GROUP:new i.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new i.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new i.CometChatException({code:"INVALID_GROUP_TYPE",name:"INVALID_GROUP_TYPE",message:"Group type can be `public`, `private`, `protected` or `password`.",details:""})},t.ConversationErrors={INVALID_CONVERSATION_TYPE:{code:"INVALID_CONVERSATION_TYPE",name:"INVALID_CONVERSATION_TYPE",message:"Conversation type can be `user` or `group`.",details:"Please check the value of conversationType."},CONVERSATION_NOT_FOUND:{code:"CONVERSATION_NOT_FOUND",name:"CONVERSATION_NOT_FOUND",message:"Conversation for %s %s not found.",details:"Please check the value of conversationWith and conversationType."}},t.ExtensionErrors={INVALID_EXTENSION:{code:"ERROR_INVALID_EXTENSION",name:"ERROR_INVALID_EXTENSION",message:"The provided extension cannot be null or empty. Please provide a valid extension.",details:{}},EXTENSION_NOT_FOUND:{code:"ERROR_EXTENSION_NOT_FOUND",name:"ERROR_EXTENSION_NOT_FOUND",message:"The provided extension could not be found.",details:{}}},t.MessageErrors={INVALID_RECEIVER_TYPE:{code:"INVALID_RECEIVER_TYPE",name:"INVALID_RECEIVER_TYPE",message:"Receiver type can be `user` or `group`.",details:"Please check the value of receiverType."}},t.FeatureRestrictionErrors={INVALID_FEATURE:{code:"ERROR_INVALID_FEATURE",name:"ERROR_INVALID_FEATURE",message:"The provided feature cannot be null or empty. Please provide a valid feature.",details:{}},FEATURE_NOT_FOUND:{code:"ERROR_FEATURE_NOT_FOUND",name:"ERROR_FEATURE_NOT_FOUND",message:"The provided feature could not be found.",details:{}}},t.PresenceConstatnts={XMPP_KEYS:{FROM:"from",STATUS:"status",LAST_ACTIVE_AT:"lastActiveAt",TYPE:"type"},STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},t.APP_SETTINGS={APP_SETTINGS:"app_settings",KEYS:{CHAT_HOST:"CHAT_HOST",CHAT_USE_SSL:"CHAT_USE_SSL",GROUP_SERVICE:"GROUP_SERVICE",CALL_SERVICE:"CALL_SERVICE",CHAT_WS_PORT:"CHAT_WS_PORT",CHAT_WSS_PORT:"CHAT_WSS_PORT",CHAT_HTTP_BIND_PORT:"CHAT_HTTP_BIND_PORT",CHAT_HTTPS_BIND_PORT:"CHAT_HTTPS_BIND_PORT",ADMIN_API_HOST:"ADMIN_API_HOST",CLIENT_API_HOST:"CLIENT_API_HOST",WEBRTC_HOST:"WEBRTC_HOST",WEBRTC_USE_SSL:"WEBRTC_USE_SSL",WEBRTC_WS_PORT:"WEBRTC_WS_PORT",WEBRTC_WSS_PORT:"WEBRTC_WSS_PORT",WEBRTC_HTTP_BIND_PORT:"WEBRTC_HTTP_BIND_PORT",WEBRTC_HTTPS_BIND_PORT:"WEBRTC_HTTPS_BIND_PORT",EXTENSION_LIST:"extensions",EXTENSION_KEYS:{ID:"id",NAME:"name"},JID_HOST_OVERRIDE:"JID_HOST_OVERRIDE",CHAT_HOST_OVERRIDE:"CHAT_HOST_OVERRIDE",CHAT_HOST_APP_SPECIFIC:"CHAT_HOST_APP_SPECIFIC",MODE:"MODE",DEFAULT_MODE:"DEFAULT",HIGH_VOL_MODE:"HIGH_VOL",FLAKY_MODE:"FLAKY",POLLING_ENABLED:"POLLING_ENABLED",POLLING_INTERVAL:"POLLING_INTERVAL",ANALYTICS_PING_DISABLED:"ANALYTICS_PING_DISABLED",ANALYTICS_HOST:"ANALYTICS_HOST",ANALYTICS_VERSION:"ANALYTICS_VERSION",SETTINGS_HASH:"settingsHash",SETTINGS_HASH_RECEIVED_AT:"settingsHashReceivedAt",DENY_FALLBACK_TO_POLLING:"DENY_FALLBACK_TO_POLLING"}},t.COMMON_UTILITY_CONSTANTS={TYPE_CONSTANTS:{BOOLEAN:"boolean",STRING:"string",OBJECT:"object",NUMBER:"number"}},t.CONNECTION_STATUS={CONNECTED:"connected",CONNECTING:"connecting",DISCONNECTED:"disconnected",FEATURE_THROTTLED:"featureThrottled"}},function(e,r,t){"use strict";r.__esModule=!0;var s=t(9),i=t(0),o=t(5),a=t(2),c=t(17),u=t(18),l=t(20),E=t(3),n=t(12);function d(e){return null!=e&&("string"==typeof e&&(e=e.trim()),"object"==typeof e&&0===Object.keys(e).length&&(e=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(e)}function h(e){for(var s=[],t=1;ti[0]&&t[1]","text/xml"),t.btoa=$.encode,t.atob=$.decode,p.isNative=!0,p.typingTimer(),p.appId=e,p.localStorage=T.LocalStorage.getInstance(),p.keyStore=i.KeyStore.getInstance(),p.messageListnerMaping=v.MessageListnerMaping.getInstance()}catch(e){g.Logger.error("CometChat: constructor",e)}}return p.setAuthToken=function(e){try{p.authToken=e}catch(e){g.Logger.error("CometChat: setAuthToken",e)}},p.prototype.getAuthToken=function(){try{return p.authToken}catch(e){g.Logger.error("CometChat: getAuthToken",e)}},p.getAppId=function(){try{return p.appId}catch(e){g.Logger.error("CometChat: getAppId",e)}},p.prototype.getApiKey=function(){try{return p.apiKey}catch(e){g.Logger.error("CometChat: getApiKey",e)}},p.getMode=function(){try{return p.mode}catch(e){g.Logger.error("CometChat: getMode",e)}},p.setMode=function(e){try{p.mode=e}catch(e){g.Logger.error("CometChat: getMode",e)}},p.getSessionId=function(){try{return p.sessionId}catch(e){g.Logger.error("CometChat: getAppId",e)}},p.getLastMessageId=function(){try{return p.lastMessageId}catch(e){g.Logger.error("CometChat: getLastMessageId",e)}},p.setLastMessageId=function(e){try{p.lastMessageId=e}catch(e){g.Logger.error("CometChat: getLastMessageId",e)}},p.setSuccessfulTimeStamp=function(e){try{p.successfulPingTimeStamp=e}catch(e){g.Logger.error("CometChat: setSuccessfulTimeStamp",e)}},p.getSuccessfultTimeStamp=function(){try{return p.successfulPingTimeStamp}catch(e){g.Logger.error("CometChat: getSuccessfultTimeStamp",e)}},p.isPollingEnabled=function(){try{return p.pollingEnabled}catch(e){g.Logger.error("CometChat: isPollingEnabled",e)}},p.didMessagesPollingStart=function(){try{return p.isMessagesPollingStarted}catch(e){g.Logger.error("CometChat: didMessagesPollingStart",e)}},p.didAnalyticsPingStart=function(){try{return p.isAnalyticsPingStarted}catch(e){g.Logger.error("CometChat: didAnalyticsPingStart",e)}},p.init=function(o,e){var r=this;return void 0===o&&(o=""),void 0===e&&(e={}),new Promise(function(n,s){try{p.pollingMessagesId=0,"object"==typeof o&&(o.hasOwnProperty("appId")&&(o=o.appId),o.hasOwnProperty("appSettings")&&(e=o.appSettings)),g.isFalsy(e)?e=(new K.AppSettingsBuilder).setRegion(K.AppSettings.REGION_EU).build():e.getRegion()==K.AppSettings.REGION_PRIVATE&&(e.region=o),r.appSettings=e,g.isFalsy(o)?s(new C.CometChatException(O.INIT_ERROR.NO_APP_ID)):(p.setSuccessfulTimeStamp((new Date).getTime()),r.initialzed=!0,p.appId=o,p.getInstance(o),p.sessionId=R.APPINFO.platform+"-"+R.APPINFO.sdkVersionWithUnderScore+"-"+V()+"-"+(new Date).getTime(),p.setLastMessageId(0),p.shouldFallBackToPolling=!0,T.LocalStorage.getInstance().get(R.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e)p.appId=o,p.getInstance(o),T.LocalStorage.getInstance().set(R.LOCAL_STORE.KEY_APP_ID,o),n(!0);else{var t=e.toLocaleString();t===o?(p.appId=t,p.getInstance(t),T.LocalStorage.getInstance().get(R.LOCAL_STORE.KEY_USER).then(function(e){e?(p.isLoggedOut=!1,p.user=new _.Me(e),p.setAuthToken(p.user.getAuthToken()),e.jwt&&(p.jwt=e.jwt),n(!0),T.LocalStorage.getInstance().get(R.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){e&&(e[R.APP_SETTINGS.KEYS.MODE]&&(p.mode=e[R.APP_SETTINGS.KEYS.MODE]),e[R.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(p.settingsHash=e[R.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(p.settingsHashReceivedAt=e[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),e[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]&&(p.analyticsHost=e[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]),e[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]&&(p.analyticsVersion=e[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]),p.isAnalyticsDisabled=!!e[R.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],e.hasOwnProperty(R.APP_SETTINGS.KEYS.DENY_FALLBACK_TO_POLLING)&&(p.shouldFallBackToPolling=!1),p.didAnalyticsPingStart()||p.isAnalyticsDisabled||(p.pingAnalytics(),p.startAnalyticsPingTimer()),e[R.APP_SETTINGS.KEYS.POLLING_ENABLED]?(p.pollingEnabled=!0,e[R.APP_SETTINGS.KEYS.POLLING_INTERVAL]&&(p.pollingInterval=e[R.APP_SETTINGS.KEYS.POLLING_INTERVAL]),r.currentConnectionStatus=R.CONNECTION_STATUS.FEATURE_THROTTLED,p.didMessagesPollingStart()||(X.XMPPConnectionHandlers.map(function(e){try{e._XMPPeventListener&&(g.isFalsy(e._XMPPeventListener.onFeatureThrottled)||e._XMPPeventListener.onFeatureThrottled())}catch(e){g.Logger.error("XMPPConnectionHandlers: Feature Throttled Status",e)}}),p.pollingMessagesTimestamp=Math.floor((new Date).getTime()/1e3),p.fetchMessages(),p.startMessagesTimer())):(p.pollingEnabled=!1,p.isConnectingFromInit=!0,p.XMPPLogin(p.user,function(){n(!0)},function(){s("error in connecting to xmpp server")})))})):n(!0)})):r.clearCache().then(function(){p.apiKey=void 0,p.user=void 0,p.authToken=void 0,p.cometChat=void 0,p.mode=void 0,d.XMPPConnectionHelper.getInstance().XMPPDisconnect(),p.appId=o,T.LocalStorage.getInstance().set(R.LOCAL_STORE.KEY_APP_ID,o),p.getInstance(o),n(!0)})}i.KeyStore.getInstance().get(R.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==e){var t=V(),n=(new Date).getTime(),s=o+"_"+t+"_"+n;i.KeyStore.getInstance().set(R.LOCAL_STORE.KEY_DEVICE_ID,s)}})}))}catch(e){s(new C.CometChatException(e))}})},p.isInitialized=function(){try{return this.initialzed}catch(e){g.Logger.error("CometChat: isInitialized",e)}},p.getInstance=function(e){try{return this.cometChat||(this.cometChat=new p(e)),this.cometChat}catch(e){g.Logger.error("CometChat: getInstance",e)}},p.registerTokenForPushNotification=function(E,d){var h=this;return new Promise(function(u,l){try{p.keyStore.get(R.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){var t="",n=e,s=R.APPINFO.platform,o=R.APPINFO.sdkVersion,r=R.APPINFO.apiVersion;if(navigator&&(t=navigator.userAgent),null==n){var i=V(),a=(new Date).getTime();n=h.appId+"_"+i+"_"+a,p.keyStore.set(R.LOCAL_STORE.KEY_DEVICE_ID,n)}var c={platform:s,deviceId:n,appInfo:{version:o,apiVersion:r,userAgent:t,pushNotification:{fcmDeviceToken:E,settings:d}}};S.makeApiCall("updateMyDetails",{},c,!1).then(function(e){u("Token Registration successful")},function(e){l(new C.CometChatException(e.error))}).catch(function(e){l(new C.CometChatException(e))})})}catch(e){l(new C.CometChatException(e))}})},p.pushToLoginListener=function(t,n){X.loginHandlers.map(function(e){try{if(e._eventListener)switch(n){case"Login_Success":g.isFalsy(e._eventListener.loginSuccess)||e._eventListener.loginSuccess(t);break;case"Login_Failure":g.isFalsy(e._eventListener.loginFailure)||e._eventListener.loginFailure(t);break;case"Logout_Success":g.isFalsy(e._eventListener.logoutSuccess)||e._eventListener.logoutSuccess()}}catch(e){g.Logger.error("XMPPConnectionHandlers: onConnected Status",e)}})},p.login=function(){for(var c=this,u=[],e=0;e=1e3*R.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT||null==D.TypingNotificationController.getTypingStartedMap(n))&&g.getAppSettings().then(function(e){var t=p.getMode();if(g.isFalsy(t)||t&&t===R.APP_SETTINGS.KEYS.DEFAULT_MODE){switch(s){case R.XMPP.CONVERSATION.TYPE.CHAT:X.sendTypingStarted(g.format(R.XMPP.bare_jid_string,p.getAppId(),n,g.getJidHost(e)),s,o);break;case R.XMPP.CONVERSATION.TYPE.GROUP_CHAT:X.sendTypingStarted(g.format(R.XMPP.muc_jid_string,p.getAppId(),n,e[R.APP_SETTINGS.KEYS.GROUP_SERVICE],g.getJidHost(e)),s,o)}return D.TypingNotificationController.addTypingStarted(n),void D.TypingNotificationController.removeTypingEnded(n)}},function(e){})}catch(e){g.Logger.error("CometChat: startTyping",e)}},p.endTyping=function(e){try{if(!g.isFalsy(e)){var n,s=this.RECEIVER_TYPE.USER,o={};if(e instanceof U.TypingIndicator)n=e.getReceiverId(),s=e.getReceiverType(),o=e.getMetadata();else{if(!e.hasOwnProperty(R.TYPING_NOTIFICATION.RECEIVER_ID))return;n=e[R.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(R.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(s=e[R.TYPING_NOTIFICATION.RECEIVER_TYPE]),s=s==this.RECEIVER_TYPE.USER?R.XMPP.CONVERSATION.TYPE.CHAT:R.XMPP.CONVERSATION.TYPE.GROUP_CHAT,e.hasOwnProperty(R.TYPING_NOTIFICATION.META)&&(o=e[R.TYPING_NOTIFICATION.META])}if(g.isFalsy(n))return;s=s==this.RECEIVER_TYPE.USER?R.XMPP.CONVERSATION.TYPE.CHAT:R.XMPP.CONVERSATION.TYPE.GROUP_CHAT,D.TypingNotificationController.getTypingStartedMap(n)&&g.getCurrentTime()-D.TypingNotificationController.getTypingStartedMap(n)<1e3*R.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&(D.TypingNotificationController.getTypingEndedMap(n)&&g.getCurrentTime()-D.TypingNotificationController.getTypingEndedMap(n)>=1e3*R.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT||null==D.TypingNotificationController.getTypingEndedMap(n))&&g.getAppSettings().then(function(e){var t=p.getMode();if(g.isFalsy(t)||t&&t===R.APP_SETTINGS.KEYS.DEFAULT_MODE){switch(s){case R.XMPP.CONVERSATION.TYPE.CHAT:X.sendTypingPaused(g.format(R.XMPP.bare_jid_string,p.getAppId(),n,g.getJidHost(e)),s,o);break;case R.XMPP.CONVERSATION.TYPE.GROUP_CHAT:X.sendTypingPaused(g.format(R.XMPP.muc_jid_string,p.getAppId(),n,e[R.APP_SETTINGS.KEYS.GROUP_SERVICE],g.getJidHost(e)),s,o)}return D.TypingNotificationController.addTypingEnded(n),void D.TypingNotificationController.removeTypingStarted(n)}},function(e){})}}catch(e){g.Logger.error("CometChat: endTyping",e)}},p.markAsRead=function(e,t,n){try{d.XMPPConnectionHelper.getInstance().markAsRead(t,n,e)}catch(e){g.Logger.error("CometChat: markAsRead",e)}},p.markAsDelivered=function(e,t,n){try{d.XMPPConnectionHelper.getInstance().markAsDelivered(t,n,e)}catch(e){g.Logger.error("CometChat: markAsDelivered",e)}},p.getMessageDetails=function(e){return new Promise(function(t,n){try{g.isFalsy(e)?n(new C.CometChatException(O.ERRORS.PARAMETER_MISSING)):S.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){t(A.MessageController.trasformJSONMessge(e.data))},function(e){g.Logger.error("CometChat:GetMessageDetails:",e),n(new C.CometChatException(e.error))})}catch(e){n(new C.CometChatException(e))}})},p.getMessageReceipts=function(s){return new Promise(function(t,n){try{var e=g.validateMsgId(s);if(e instanceof C.CometChatException)return void n(e);g.isFalsy(s)?n(new C.CometChatException(O.ERRORS.PARAMETER_MISSING)):S.makeApiCall("getMessageDetails",{messageId:s}).then(function(e){A.MessageController.getReceiptsFromJSON(e.data).then(function(e){t(e)},function(e){n(new C.CometChatException(e))})},function(e){g.Logger.error("CometChat:GetMessageDetails:",e),n(new C.CometChatException(e.error))})}catch(e){n(new C.CometChatException(e))}})},p.getUnreadMessageCount=function(n){void 0===n&&(n=!1);var o=0;return new Promise(function(s,t){try{var e=g.validateHideMessagesFromBlockedUsers(n);if(e instanceof C.CometChatException)return void t(e);n&&(o=1),S.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:o}).then(function(e){var t={},n={};e.data.map(function(e){e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==R.MessageConstatnts.RECEIVER_TYPE.GROUP?n[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),s({users:t,groups:n})},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.getUnreadMessageCountForAllUsers=function(s){void 0===s&&(s=!1);var o=0;return new Promise(function(n,t){try{var e=g.validateHideMessagesFromBlockedUsers(s);if(e instanceof C.CometChatException)return void t(e);s&&(o=1),S.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:o,receiverType:R.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(h({},t))},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.getUnreadMessageCountForAllGroups=function(s){void 0===s&&(s=!1);var o=0;return new Promise(function(n,t){try{var e=g.validateHideMessagesFromBlockedUsers(s);if(e instanceof C.CometChatException)return void t(e);s&&(o=1),S.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:o,receiverType:R.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==R.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(h({},t))},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.getUnreadMessageCountForUser=function(o,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=g.validateId(o,"user");if(e instanceof C.CometChatException)return void t(e);var s=g.validateHideMessagesFromBlockedUsers(r);if(s instanceof C.CometChatException)return void t(s);r&&(i=1),S.makeApiCall("getUserMessages",{listId:o},{hideMessagesFromBlockedUsers:i,unread:1,count:1,uid:o}).then(function(e){var t={};e.data.map(function(e){t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(h({},t))},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.getUnreadMessageCountForGroup=function(o,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=g.validateId(o,"group");if(e instanceof C.CometChatException)return void t(e);var s=g.validateHideMessagesFromBlockedUsers(r);if(s instanceof C.CometChatException)return void t(s);r&&(i=1),S.makeApiCall("getGroupMessages",{listId:o},{hideMessagesFromBlockedUsers:i,unread:1,count:1,guid:o}).then(function(e){var t={};e.data.map(function(e){e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==R.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(h({},t))},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.editMessage=function(s){return new Promise(function(t,n){try{var e=g.validateMsgId(s.getId());if(e instanceof C.CometChatException)return void n(e);S.makeApiCall("updateMessage",{messageId:s.getId()},s).then(function(e){t(A.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new C.CometChatException(e.error))})}catch(e){n(new C.CometChatException(e))}})},p.deleteMessage=function(s){return new Promise(function(t,n){try{var e=g.validateMsgId(s);if(e instanceof C.CometChatException)return void n(e);S.makeApiCall("deleteMessage",{messageId:s},{id:s}).then(function(e){t(A.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new C.CometChatException(e.error))})}catch(e){n(new C.CometChatException(e))}})},p.getPreviousMessagesByTimestamp=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new C.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"TIMESTAMP","TIMESTAMP","timestamp")))):A.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.SENT_AT,R.MessageConstatnts.PAGINATION.AFFIX.PREPEND).then(function(e){return t(e)},function(e){return n(new C.CometChatException(e))})}catch(e){n(new C.CometChatException(e))}})},p.getPreviousMessagesById=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new C.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"MESSAGE_ID","MESSAGE_ID","messageId")))):A.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.ID,R.MessageConstatnts.PAGINATION.AFFIX.PREPEND).then(function(e){return t(e)},function(e){return n(new C.CometChatException(e))})}catch(e){n(new C.CometChatException(e))}})},p.getNextMessagesByTimestamp=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new C.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"TIMESTAMP","TIMESTAMP","timestamp")))):A.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.SENT_AT,R.MessageConstatnts.PAGINATION.AFFIX.APPEND).then(function(e){return t(e)},function(e){return n(new C.CometChatException(e))})}catch(e){n(new C.CometChatException(e))}})},p.getNextMessagesById=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new C.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"MESSAGE_ID","MESSAGE_ID","messageId")))):A.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.ID,R.MessageConstatnts.PAGINATION.AFFIX.APPEND).then(function(e){return t(e)},function(e){return n(new C.CometChatException(e))})}catch(e){n(new C.CometChatException(e))}})},p.createUser=function(o,r){return new Promise(function(n,t){try{if(g.isFalsy(r))return void t(new C.CometChatException(JSON.parse(g.format(JSON.stringify(R.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));p.apiKey=r;var e=g.validateCreateUser(o);if(e instanceof C.CometChatException)return void t(e);if(!(o instanceof _.User)){var s=void 0;if(!o.hasOwnProperty(R.UserConstants.UID))return void t(new C.CometChatException(O.ERRORS.PARAMETER_MISSING));if(!o.hasOwnProperty(R.UserConstants.NAME))return void t(new C.CometChatException(O.ERRORS.PARAMETER_MISSING));s=new _.User(o[R.UserConstants.UID],o[R.UserConstants.NAME]),o.hasOwnProperty(R.UserConstants.AVATAR)&&s.setAvatar(o[R.UserConstants.AVATAR]),o.hasOwnProperty(R.UserConstants.ROLE)&&s.setRole(o[R.UserConstants.ROLE]),o.hasOwnProperty(R.UserConstants.META_DATA)&&s.setMetadata(o[R.UserConstants.META_DATA]),o.hasOwnProperty(R.UserConstants.LINK)&&s.setLink(o[R.UserConstants.LINK]),o.hasOwnProperty(R.UserConstants.STATUS_MESSAGE)&&s.setStatusMessage(o[R.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(R.UserConstants.TAGS)&&s.setTags(o[R.UserConstants.TAGS]),o=s}S.makeApiCall("createUser",{},o).then(function(e){var t=u.UsersController.trasformJSONUser(e.data);n(t)},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.updateUser=function(s,i){var a=this;return new Promise(function(o,t){try{if(g.isFalsy(i))return void t(new C.CometChatException(JSON.parse(g.format(JSON.stringify(R.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));p.apiKey=i;var e=g.validateUpdateUser(s);if(e instanceof C.CometChatException)return void t(e);if(!(s instanceof _.User)){var n=void 0;if(!s.hasOwnProperty(R.UserConstants.UID))return void t(new C.CometChatException(O.ERRORS.PARAMETER_MISSING));n=new _.User(s[R.UserConstants.UID]),s.hasOwnProperty(R.UserConstants.NAME)&&n.setName(s[R.UserConstants.NAME]),s.hasOwnProperty(R.UserConstants.AVATAR)&&n.setAvatar(s[R.UserConstants.AVATAR]),s.hasOwnProperty(R.UserConstants.ROLE)&&n.setRole(s[R.UserConstants.ROLE]),s.hasOwnProperty(R.UserConstants.META_DATA)&&n.setMetadata(s[R.UserConstants.META_DATA]),s.hasOwnProperty(R.UserConstants.LINK)&&n.setLink(s[R.UserConstants.LINK]),s.hasOwnProperty(R.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(s[R.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(R.UserConstants.TAGS)&&n.setTags(s[R.UserConstants.TAGS]),s=n}var r=s.uid;S.makeApiCall("updateUser",{uid:r},s).then(function(s){if(a.user&&r.toLocaleLowerCase()===a.user.getUid().toLocaleLowerCase())T.LocalStorage.getInstance().get("user").then(function(e){if(e){var t=u.UsersController.trasformJSONUser(s.data),n=s.data;n.wsChannel=e.wsChannel,n.authToken=p.authToken,n.status=R.PresenceConstatnts.STATUS.ONLINE,e.jwt&&(n.jwt=e.jwt),p.user=new _.Me(n),a.localStorage.set("user",p.user),o(t)}});else{var e=u.UsersController.trasformJSONUser(s.data);o(e)}},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.getUser=function(s){return new Promise(function(n,t){try{"object"==typeof s&&s.hasOwnProperty("uid")&&(s=s.uid);var e=g.validateId(s,"user");if(e instanceof C.CometChatException)return void t(e);S.makeApiCall("user",{uid:s}).then(function(e){var t=u.UsersController.trasformJSONUser(e.data);n(t)}).catch(function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},p.getLoggedInUser=function(){var d=this;return new Promise(function(l,E){try{p.localStorage.get(R.LOCAL_STORE.KEY_USER).then(function(e){if(e)l(p.user=new _.Me(e));else{var r="",i="",a=R.APPINFO.platform,c=R.APPINFO.sdkVersion,u=R.APPINFO.apiVersion;p.keyStore.get(R.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(i=e,navigator&&(r=navigator.userAgent),null==i){var t=V(),n=(new Date).getTime();i=d.appId+"_"+t+"_"+n,p.keyStore.set(R.LOCAL_STORE.KEY_DEVICE_ID,i)}var s={version:c,apiVersion:u,userAgent:r};g.isFalsy(d.platform)||(s.platform=d.platform),g.isFalsy(d.language)||(s.language=d.language),g.isFalsy(d.resource)||(s.resource=d.resource);var o={platform:a,deviceId:i,appInfo:s};S.makeApiCall("updateMyDetails",{},o,!1).then(function(e){e.data.jwt&&(p.jwt=e.data.jwt);var t=e.data.settings;t&&(T.LocalStorage.getInstance().set("app_settings",t),t[R.APP_SETTINGS.KEYS.MODE]&&p.setMode(t[R.APP_SETTINGS.KEYS.MODE]),t[R.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(p.settingsHash=t[R.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(p.settingsHashReceivedAt=t[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),t[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]&&(p.analyticsHost=t[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]),t[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]&&(p.analyticsVersion=t[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]),p.isAnalyticsDisabled=!!t[R.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],t.hasOwnProperty(R.APP_SETTINGS.KEYS.DENY_FALLBACK_TO_POLLING)&&(p.shouldFallBackToPolling=!1),p.pollingEnabled=t[R.APP_SETTINGS.KEYS.POLLING_ENABLED],p.isPollingEnabled()&&t[R.APP_SETTINGS.KEYS.POLLING_INTERVAL]&&(p.pollingInterval=t[R.APP_SETTINGS.KEYS.POLLING_INTERVAL])),l(new _.Me(e.data))},function(e){E(new C.CometChatException(e.error))}).catch(function(e){E(new C.CometChatException(e))})})}})}catch(e){E(new C.CometChatException(e))}})},p.getLoggedinUser=function(){return new Promise(function(t,n){try{p.localStorage.get(R.LOCAL_STORE.KEY_USER).then(function(e){t(e?new _.User(e):null)},function(e){t(null)})}catch(e){n(new C.CometChatException(e))}})},p.blockUsers=function(s){return new Promise(function(t,n){try{var e=g.validateArray(s,"blockUsers");if(e instanceof C.CometChatException)return void n(e);g.isFalsy(s)?n(new C.CometChatException(O.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):S.makeApiCall("blockUsers",{},{blockedUids:s}).then(function(e){t(e.data)},function(e){n(new C.CometChatException(e.error))})}catch(e){n(new C.CometChatException(e))}})},p.unblockUsers=function(s){return new Promise(function(t,n){try{var e=g.validateArray(s,"unblockUsers");if(e instanceof C.CometChatException)return void n(e);g.isFalsy(s)?n(new C.CometChatException(O.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):S.makeApiCall("unblockUsers",{},{blockedUids:s}).then(function(e){t(e.data)},function(e){n(new C.CometChatException(e.error))})}catch(e){n(new C.CometChatException(e))}})},p.getConversation=function(r,i){return new Promise(function(n,s){try{var e={};e.conversationWith=r,e.conversationType=i;var t=g.validateConversationType(i);if(t instanceof C.CometChatException)return void s(t);var o=g.validateId(r,i);if(o instanceof C.CometChatException)return void s(o);S.makeApiCall("getConversations",{},e).then(function(e){if(0 All store cleared successfully","true"),e(!0)})}catch(e){g.Logger.error("CometChat: clearCache",e),t(e)}})},p.typingTimer=function(){try{setInterval(function(){D.TypingNotificationController.clearTimer()},500)}catch(e){g.Logger.error("CometChat: typingTimer",e)}},p.initialzed=!1,p.isNative=!1,p.CometChatException=C.CometChatException,p.TextMessage=m.TextMessage,p.MediaMessage=f.MediaMessage,p.CustomMessage=w.CustomMessage,p.Action=s.Action,p.Call=n.Call,p.TypingIndicator=U.TypingIndicator,p.Group=a.Group,p.AppUser=_.User,p.User=_.User,p.RTCUser=W.RTCUser,p.GroupMember=Y.GroupMember,p.Conversation=H.Conversation,p.USER_STATUS={ONLINE:R.PresenceConstatnts.STATUS.ONLINE,OFFLINE:R.PresenceConstatnts.STATUS.OFFLINE},p.MessagesRequest=L.DefaultMessagesRequest,p.MessagesRequestBuilder=L.DefaultMessagesRequestBuilder,p.UsersRequest=P.UsersRequest,p.UsersRequestBuilder=P.UsersRequestBuilder,p.ConversationsRequest=M.ConversationsRequest,p.ConversationsRequestBuilder=M.ConversationsRequestBuilder,p.BlockedUsersRequest=F.BlockedUsersRequest,p.BlockedUsersRequestBuilder=F.BlockedUsersRequestBuilder,p.GroupsRequest=r.GroupsRequest,p.GroupsRequestBuilder=r.GroupsRequestBuilder,p.GroupMembersRequest=y.GroupMembersRequest,p.GroupMembersRequestBuilder=y.GroupMembersRequestBuilder,p.BannedMembersRequest=y.GroupMembersRequest,p.BannedMembersRequestBuilder=y.GroupOutCastMembersRequestBuilder,p.AppSettings=K.AppSettings,p.AppSettingsBuilder=K.AppSettingsBuilder,p.MessageListener=e.MessageEventListener,p.UserListener=e.UserEventListener,p.GroupListener=e.GroupEventListener,p.OngoingCallListener=e.UserCallEventListener,p.CallListener=e.CallEventListener,p.ConnectionListener=d.XMPPConnectionEventListener,p.LoginListener=e.LoginEventListener,p.MESSAGE_TYPE=R.MessageConstatnts.TYPE,p.CATEGORY_MESSAGE=R.MessageConstatnts.CATEGORY.MESSAGE,p.CATEGORY_ACTION=R.MessageConstatnts.CATEGORY.ACTION,p.CATEGORY_CALL=R.MessageConstatnts.CATEGORY.CALL,p.CATEGORY_CUSTOM=R.MessageConstatnts.CATEGORY.CUSTOM,p.ACTION_TYPE=R.ActionConstatnts.ACTIONS,p.CALL_TYPE=R.CallConstants.CALL_TYPE,p.RECEIVER_TYPE=R.MessageConstatnts.RECEIVER_TYPE,p.CALL_STATUS=R.CallConstants.CALL_STATUS,p.CallController=N.CallController,p.GROUP_MEMBER_SCOPE=R.GROUP_MEMBER_SCOPE,p.GROUP_TYPE=R.GROUP_TYPE,p.MESSAGE_REQUEST=R.MessageConstatnts.PAGINATION.CURSOR_FILEDS,p.CometChatExtension=G.CometChatExtension,p.ExtensionManager=b.ExtensionManager,p.CometChatHelper=B.CometChatHelper,p.WSReconnectionStartTime=0,p.WSMaxReconnectionLimit=10,p.WSCurrentReconnectionCount=0,p.WSReconnectionInProgress=!1,p.WSReconnectionPeriod=3e4,p.WSReconnectionTimerInterval=3e4,p.pollingEnabledInternally=!1,p.accidentalDisconnect=!1,p.successfulPingTimeStamp=0,p.currentConnectionStatus=R.CONNECTION_STATUS.DISCONNECTED,p.CONNECTION_STATUS=R.CONNECTION_STATUS,p.Attachment=k.Attachment,p.isConnectingFromInit=!1,p.loginInProgress=!1,p.lastMessageId=0,p.pollingEnabled=!1,p.pollingInterval=5e3,p.pollingLimit=100,p.pollingAffix="append",p.pollingMessagesId=0,p.settingsInterval=6e4,p.isMessagesPollingStarted=!1,p.isAnalyticsPingStarted=!1,p.isLoggedOut=!0,p.isAnalyticsDisabled=!1,p.CallingComponent=q.CallingComponent,p.CallSettings=j.CallSettings,p.CallSettingsBuilder=j.CallSettingsBuilder,p.CALL_MODE=R.CallConstants.CALL_MODE,p.AUDIO_MODE=R.CallConstants.AUDIO_MODE,p.shouldFallBackToPolling=!0,p}();z.CometChat=p}).call(this,Z(28))},function(e,t,n){"use strict";var s,o=this&&this.__extends||(s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0;var r=n(2),i=n(12),a=n(0),c=function(){function e(){for(var e=[],t=0;ti[0]&&t[1]Math.floor(E.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),s>Math.floor(E.TIMEOUT*this.wait)&&(E.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(E.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}},_getRequestStatus:function(e,t){var n;if(4===e.xhr.readyState)try{n=e.xhr.status}catch(e){E.error("Caught an error while retrieving a request's status, reqStatus: "+n)}return void 0===n&&(n="number"==typeof t?t:0),n},_onRequestStateChange:function(e,t){if(E.debug("request id "+t.id+"."+t.sends+" state changed to "+t.xhr.readyState),t.abort)t.abort=!1;else if(4===t.xhr.readyState){var n=this._getRequestStatus(t);if(this.lastResponseHeaders=t.xhr.getAllResponseHeaders(),this.disconnecting&&400<=n)return this._hitError(n),void this._callProtocolErrorHandlers(t);var s=0this._conn.maxRetries;if((s||o)&&(this._removeRequest(t),E.debug("request id "+t.id+" should now be removed")),200===n){var r=this._requests[0]===t;(this._requests[1]===t||r&&0Math.floor(E.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(t.rid)+1),E.debug("request id "+t.id+"."+t.sends+" got 200"),e(t),this.errors=0}else 0===n||400<=n&&n<600||12e3<=n?(E.error("request id "+t.id+"."+t.sends+" error "+n+" happened"),this._hitError(n),this._callProtocolErrorHandlers(t),400<=n&&n<500&&(this._conn._changeConnectStatus(E.Status.DISCONNECTING,null),this._conn._doDisconnect())):E.error("request id "+t.id+"."+t.sends+" error "+n+" happened");s||o?o&&!this._conn.connected&&this._conn._changeConnectStatus(E.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}},_processRequest:function(e){var n=this,s=this._requests[e],t=this._getRequestStatus(s,-1);if(s.sends>this._conn.maxRetries)this._conn._onDisconnectTimeout();else{var o=s.age(),r=!isNaN(o)&&o>Math.floor(E.TIMEOUT*this.wait),i=null!==s.dead&&s.timeDead()>Math.floor(E.SECONDARY_TIMEOUT*this.wait),a=4===s.xhr.readyState&&(t<1||500<=t);if((r||i||a)&&(i&&E.error("Request ".concat(this._requests[e].id," timed out (secondary), restarting")),s.abort=!0,s.xhr.abort(),s.xhr.onreadystatechange=function(){},this._requests[e]=new E.Request(s.xmlData,s.origFunc,s.rid,s.sends),s=this._requests[e]),0===s.xhr.readyState){E.debug("request id "+s.id+"."+s.sends+" posting");try{var c=this._conn.options.contentType||"text/xml; charset=utf-8";s.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==s.xhr.setRequestHeader&&s.xhr.setRequestHeader("Content-Type",c),this._conn.options.withCredentials&&(s.xhr.withCredentials=!0)}catch(e){return E.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(E.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var u=function(){if(s.date=new Date,n._conn.options.customHeaders){var e=n._conn.options.customHeaders;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.xhr.setRequestHeader(t,e[t])}s.xhr.send(s.data)};if(1/g,">")).replace(/'/g,"'")).replace(/"/g,""")},xmlunescape:function(e){return e=(e=(e=(e=(e=e.replace(/\&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/'/g,"'")).replace(/"/g,'"')},xmlTextNode:function(e){return C.xmlGenerator().createTextNode(e)},xmlHtmlNode:function(e){var t;DOMParser?t=(new DOMParser).parseFromString(e,"text/xml"):((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e));return t},getText:function(e){if(!e)return null;var t="";0===e.childNodes.length&&e.nodeType===C.ElementType.TEXT&&(t+=e.nodeValue);for(var n=0;n/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(e){return"string"!=typeof e?e:e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(e){return e.indexOf("@")<0?null:e.split("@")[0]},getDomainFromJid:function(e){var t=C.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;var n=t.split("@");return n.splice(0,1),n.join("@")},getResourceFromJid:function(e){var t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:function(e){return e?e.split("/")[0]:null},_handleError:function(e){void 0!==e.stack&&C.fatal(e.stack),e.sourceURL?C.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?C.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):C.fatal("error: "+e.message)},log:function(e,t){e===this.LogLevel.FATAL&&"object"===g(window.console)&&"function"==typeof window.console.error&&window.console.error(t)},debug:function(e){this.log(this.LogLevel.DEBUG,e)},info:function(e){this.log(this.LogLevel.INFO,e)},warn:function(e){this.log(this.LogLevel.WARN,e)},error:function(e){this.log(this.LogLevel.ERROR,e)},fatal:function(e){this.log(this.LogLevel.FATAL,e)},serialize:function(n){if(!n)return null;"function"==typeof n.tree&&(n=n.tree());var e=r(Array(n.attributes.length).keys()).map(function(e){return n.attributes[e].nodeName});e.sort();var t=e.reduce(function(e,t){return"".concat(e," ").concat(t,'="').concat(C.xmlescape(n.attributes.getNamedItem(t).value),'"')},"<".concat(n.nodeName));if(0";for(var s=0;s"}}t+=""}else t+="/>";return t},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(e,t){C._connectionPlugins[e]=t},Builder:function(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=C.NS.CLIENT:t||(t={xmlns:C.NS.CLIENT})),this.nodeTree=C.xmlElement(e,t),this.node=this.nodeTree}};C.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return C.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},root:function(){return this.node=this.nodeTree,this},attrs:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this},c:function(e,t,n){var s=C.xmlElement(e,t,n);return this.node.appendChild(s),"string"!=typeof n&&"number"!=typeof n&&(this.node=s),this},cnode:function(e){var t,n=C.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}var s=t?n.importNode(e,!0):C.copyElement(e);return this.node.appendChild(s),this.node=s,this},t:function(e){var t=C.xmlTextNode(e);return this.node.appendChild(t),this},h:function(e){var t=document.createElement("body");t.innerHTML=e;for(var n=C.createHtml(t);0e[n].prototype.priority&&(n=s);if(n!==t){var o=e[t];e[t]=e[n],e[n]=o}}return e},_attemptSASLAuth:function(e){e=this.sortMechanismsByPriority(e||[]);for(var t=!1,n=0;n>16)+(t>>16)+(n>>16)<<16|65535&n},s=function(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<>>32-a,n);var i,a},d=function(e,t,n,s,o,r,i){return a(t&n|~t&s,e,t,o,r,i)},h=function(e,t,n,s,o,r,i){return a(t&s|n&~s,e,t,o,r,i)},p=function(e,t,n,s,o,r,i){return a(t^n^s,e,t,o,r,i)},g=function(e,t,n,s,o,r,i){return a(n^(t|~s),e,t,o,r,i)},o=function(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var n,s,o,r,i=1732584193,a=-271733879,c=-1732584194,u=271733878,l=0;l>2]>>s%4*8+4&15)+t.charAt(e[s>>2]>>s%4*8&15);return n}(o(s(e),8*e.length))},hash:function(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(o(s(e),8*e.length))}}},"./src/sha1.js":function(e,t,n){"use strict";function a(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,s,o,r,i,a,c,u,l,E=new Array(80),d=1732584193,h=-271733879,p=-1732584194,g=271733878,C=-1009589776;for(n=0;n>16)+(t>>16)+(n>>16)<<16|65535&n}function T(e,t){return e<>>32-t}function c(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function o(e){for(var t,n,s="",o=0;o<4*e.length;o+=3)for(t=(e[o>>2]>>8*(3-o%4)&255)<<16|(e[o+1>>2]>>8*(3-(o+1)%4)&255)<<8|e[o+2>>2]>>8*(3-(o+2)%4)&255,n=0;n<4;n++)8*o+6*n>32*e.length?s+="=":s+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return s}function r(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}n.r(t),n.d(t,"default",function(){return i});var i={b64_hmac_sha1:function(e,t){return o(s(e,t))},b64_sha1:function(e){return o(a(c(e),8*e.length))},binb2str:r,core_hmac_sha1:s,str_hmac_sha1:function(e,t){return r(s(e,t))},str_sha1:function(e){return r(a(c(e),8*e.length))}}},"./src/strophe.js":function(e,t,n){"use strict";n.r(t);n("./src/bosh.js"),n("./src/websocket.js");var s=n("./src/core.js");n.d(t,"default",function(){return s.default})},"./src/utils.js":function(e,t,n){"use strict";function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.r(t),n.d(t,"default",function(){return s});var s={utf16to8:function(e){var t,n,s="",o=e.length;for(t=0;t>12&15),s+=String.fromCharCode(128|n>>6&63)):s+=String.fromCharCode(192|n>>6&31),s+=String.fromCharCode(128|n>>0&63));return s},addCookies:function(e){for(var t in e=e||{})if(Object.prototype.hasOwnProperty.call(e,t)){var n="",s="",o="",r=e[t],i="object"===c(r),a=escape(unescape(i?r.value:r));i&&(n=r.expires?";expires="+r.expires:"",s=r.domain?";domain="+r.domain:"",o=r.path?";path="+r.path:""),document.cookie=t+"="+a+n+s+o}}}},"./src/websocket.js":function(e,t,n){"use strict";n.r(t);var s=n("./src/core.js"),u=s.default.Strophe,o=s.default.$build;u.Websocket=function(e){this._conn=e,this.strip="wrapper";var t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){var n="";"ws"===e.options.protocol&&"https:"!==window.location.protocol?n+="ws":n+="wss",n+="://"+window.location.host,0!==t.indexOf("/")?n+=window.location.pathname+t:n+=t,e.service=n}},u.Websocket.prototype={_buildStream:function(){return o("open",{xmlns:u.NS.FRAMING,to:this._conn.domain,version:"1.0"})},_check_streamerror:function(e,t){var n;if(0===(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(u.NS.STREAM,"error"):e.getElementsByTagName("stream:error")).length)return!1;for(var s=n[0],o="",r="",i=0;i: "+n);var s=e.getAttribute("version");return"string"!=typeof s?t="Missing version in ":"1.0"!==s&&(t="Wrong version in : "+s),!t||(this._conn._changeConnectStatus(u.Status.CONNFAIL,t),this._conn._doDisconnect(),!1)},_connect_cb_wrapper:function(e){if(0===e.data.indexOf("\s*)*/,"");if(""===t)return;var n=(new DOMParser).parseFromString(t,"text/xml").documentElement;this._conn.xmlInput(n),this._conn.rawInput(e.data),this._handleStreamStart(n)&&this._connect_cb(n)}else if(0===e.data.indexOf(" tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){u.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(e){return""+e+""},_closeSocket:function(){if(this.socket)try{this.socket.onerror=null,this.socket.close()}catch(e){u.debug(e.message)}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(e){this._conn.connected&&!this._conn.disconnecting?(u.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(u.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(u.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):u.info("Websocket closed")},_no_auth_received:function(e){u.error("Server did not offer a supported authentication mechanism"),this._changeConnectStatus(u.Status.CONNFAIL,u.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()},_onDisconnectTimeout:function(){},_abortAllRequests:function(){},_onError:function(e){u.error("Websocket error "+e),this._conn._changeConnectStatus(u.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()},_onIdle:function(){var e=this._conn._data;if(0i[0]&&t[1]"}},getFriends:{endpoint:"user/friends",method:"GET"},unfriend:{endpoint:"user/friends/{{uid}}/{{gid}}",method:"DELETE",data:{uids:"array"}},acceptFriendRequest:{endpoint:"user/friends/{{uid}}/accept",method:"PUT",data:{uids:"array"}},rejectFriendRequest:{endpoint:"user/friends/{{uid}}/reject",method:"DELETE",data:{uids:"array"}},createGroup:{endpoint:"groups",method:"POST",data:{guid:"required|string|max:100",name:"required|string|max:100",type:"enum|public,protected,password",password:"filled|string|max:100"}},getGroups:{endpoint:"groups",method:"GET"},getGroup:{endpoint:"groups/{{guid}}",method:"GET"},updateGroup:{endpoint:"groups/{{guid}}",method:"PUT"},deleteGroup:{endpoint:"groups/{{guid}}",method:"DELETE"},addGroupMembers:{endpoint:"groups/{{guid}}/members",method:"POST",data:{uids:"array"}},getGroupMembers:{endpoint:"groups/{{guid}}/members",method:"GET"},joinGroup:{endpoint:"groups/{{guid}}/members",method:"POST"},leaveGroup:{endpoint:"groups/{{guid}}/members",method:"DELETE"},kickGroupMembers:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"DELETE",data:{uids:"array"}},changeScopeOfMember:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"PUT",data:{uids:"array"}},banGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"POST",data:{uids:"array"}},unbanGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"DELETE",data:{uids:"array"}},addMemebersToGroup:{endpoint:"groups/{{guid}}/members",method:"PUT"},getBannedGroupMembers:{endpoint:"groups/{{guid}}/bannedusers",method:"GET"},promotemoteGroupMember:{endpoint:"groups/{{guid}}/promote",method:"PUT",data:{uids:"array"}},demoteGroupMember:{endpoint:"groups/{{guid}}/demote",method:"DELETE",data:{uids:"array"}},transferOwnership:{endpoint:"groups/{{guid}}/owner",method:"PATCH"},sendMessage:{endpoint:"messages",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},sendMessageInThread:{endpoint:"messages/{{parentId}}/thread",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},getMessages:{endpoint:"messages",method:"GET"},getMessageDetails:{endpoint:"messages/{{messageId}}",method:"GET"},getUserMessages:{endpoint:"users/{{listId}}/messages",method:"GET"},getGroupMessages:{endpoint:"groups/{{listId}}/messages",method:"GET"},getThreadMessages:{endpoint:"messages/{{listId}}/thread",method:"GET"},getMessage:{endpoint:"user/messages/{{muid}}",method:"GET"},updateMessage:{endpoint:"messages/{{messageId}}",method:"PUT"},deleteMessage:{endpoint:"messages/{{messageId}}",method:"DELETE"},createCallSession:{endpoint:"calls",method:"POST",data:{}},updateCallSession:{endpoint:"calls/{{sessionid}}",method:"put",data:{}},getConversations:{endpoint:"conversations",method:"GET"}}}return r.prototype.getEndpointData=function(o){return new Promise(function(s,t){try{c.LocalStorage.getInstance().get(a.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(i.isFalsy(e)){var t={};if((new r).uriEndpoints.hasOwnProperty(o))if((t=(new r).uriEndpoints[o]).hasOwnProperty("isAdminApi")){var n=i.format((new r).adminApiUrl,u.CometChat.appSettings.getRegion())+(new r).adminApiVersion+"/"+t.endpoint;t.endpoint=n}else{n=i.format((new r).baseUrl,u.CometChat.appSettings.getRegion())+(new r).apiVersion+"/"+t.endpoint;t.endpoint=n}s(t)}else{t={};if((new r).uriEndpoints.hasOwnProperty(o))if((t=(new r).uriEndpoints[o]).hasOwnProperty("isAdminApi"))t.endpoint="https://"+e[a.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+(new r).adminApiVersion+"/"+t.endpoint;else{n="https://"+e[a.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+(new r).apiVersion+"/"+t.endpoint;t.endpoint=n}s(t)}},function(e){var t;(new r).uriEndpoints.hasOwnProperty(o)&&((t=(new r).uriEndpoints[o]).hasOwnProperty(["isAdminApi"])?t.endpoint=i.format((new r).adminApiUrl,u.CometChat.appSettings.getRegion())+(new r).adminApiVersion+"/"+t.endpoint:t.endpoint=i.format((new r).baseUrl,u.CometChat.appSettings.getRegion())+(new r).apiVersion+"/"+t.endpoint),s(t)})}catch(e){t(new l.CometChatException(e))}})},r}();t.EndpointFactory=s},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,s=arguments.length;ne.getId()&&(i=parseInt(e.getId().toString())),s=1e3*o.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&delete n.TYPING_STARTED_MAP[e]})}),new Promise(function(e,t){Object.keys(n.TYPING_ENDED_MAP).map(function(e){s.getCurrentTime()-n.TYPING_ENDED_MAP[e]>=1e3*o.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&delete n.TYPING_ENDED_MAP[e]})}),new Promise(function(e,t){Object.keys(n.INCOMING_TYPING_STARTED_MAP).map(function(e){s.getCurrentTime()-n.INCOMING_TYPING_STARTED_MAP[e][o.TYPING_NOTIFICATION.KEYS.TIMESTAMP]>=1e3*o.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&(r.XMPPConnectionHelper.getInstance().publishTypinStatusNotification(n.INCOMING_TYPING_STARTED_MAP[e][o.TYPING_NOTIFICATION.KEYS.TYPING_NOTIFICATION],o.TYPING_NOTIFICATION.ACTIONS.ENDED),delete n.INCOMING_TYPING_STARTED_MAP[e])})})},e.TYPING_STARTED_MAP={},e.TYPING_ENDED_MAP={},e.INCOMING_TYPING_STARTED_MAP={},e}();t.TypingNotificationController=i},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(r,i,a,c){return new(a||(a=Promise))(function(e,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function s(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(n,s)}o((c=c.apply(r,i||[])).next())})},o=this&&this.__generator||function(n,s){var o,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function w(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(w(e,t))return!0}while(e=e.nextSibling)}function Y(){}function G(e,t,n,s){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function b(e,t,n){if(e&&e._inc){e._inc++;var s=t.childNodes;if(n)s[s.length++]=n;else{for(var o=t.firstChild,r=0;o;)o=(s[r++]=o).nextSibling;s.length=r}}}function x(e,t){var n=t.previousSibling,s=t.nextSibling;return n?n.nextSibling=s:e.firstChild=s,s?s.previousSibling=n:e.lastChild=n,b(e.ownerDocument,e),t}function F(e,t,n){var s=t.parentNode;if(s&&s.removeChild(t),t.nodeType===y){var o=t.firstChild;if(null==o)return t;var r=t.lastChild}else o=r=t;var i=n?n.previousSibling:e.lastChild;for(o.previousSibling=i,r.nextSibling=n,i?i.nextSibling=o:e.firstChild=o,null==n?e.lastChild=r:n.previousSibling=r;o.parentNode=e,o!==r&&(o=o.nextSibling););return b(e.ownerDocument||e,e),t.nodeType==y&&(t.firstChild=t.lastChild=null),t}function K(){this._nsMap={}}function B(){}function H(){}function J(){}function k(){}function V(){}function X(){}function j(){}function q(){}function W(){}function $(){}function Q(){}function z(){}function Z(e,t){var n=[],s=9==this.nodeType?this.documentElement:this,o=s.prefix,r=s.namespaceURI;if(r&&null==o&&null==(o=s.lookupPrefix(r)))var i=[{namespace:r,prefix:null}];return te(this,n,e,t,i),n.join("")}function ee(e,t,n){var s=e.prefix||"",o=e.namespaceURI;if(!s&&!o)return!1;if("xml"===s&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var r=n.length;r--;){var i=n[r];if(i.prefix==s)return i.namespace!=o}return!0}function te(e,t,n,s,o){if(s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case _:o||(o=[]);o.length;var r=e.attributes,i=r.length,a=e.firstChild,c=e.tagName;n=S===e.namespaceURI||n,t.push("<",c);for(var u=0;u"),n&&/^script$/i.test(c))for(;a;)a.data?t.push(a.data):te(a,t,n,s,o),a=a.nextSibling;else for(;a;)te(a,t,n,s,o),a=a.nextSibling;t.push("")}else t.push("/>");return;case N:case y:for(a=e.firstChild;a;)te(a,t,n,s,o),a=a.nextSibling;return;case T:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,D),'"');case f:return t.push(e.data.replace(/[<&]/g,D));case m:return t.push("");case I:return t.push("\x3c!--",e.data,"--\x3e");case O:var p=e.publicId,g=e.systemId;if(t.push("');else if(g&&"."!=g)t.push(' SYSTEM "',g,'">');else{var C=e.internalSubset;C&&t.push(" [",C,"]"),t.push(">")}return;case R:return t.push("");case A:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function ne(e,t,n){e[t]=n}d.prototype=Error.prototype,r(a,d),h.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],s=0;si[0]&&t[1]t._resendCount)return;t._msgQueue[e].tree().setAttribute("from",t._conn.jid),t._conn.send(t._msgQueue[e]),t.resendMessage(e)}},this._resendTime)},addReceiptHandler:function(t,e,n,s){var o=this;this._conn.addHandler(function(e){return o._processReceipt(e),t(e)},p.Strophe.NS.RECEIPTS,"message",e,null,n,s)},_processReceipt:function(h,e){return void 0===e&&(e=0),n(this,void 0,void 0,function(){var r,i,a,c,u,l,t,n,E,s,o,d=this;return g(this,function(e){if(T.CometChat.getConnectionStatus()==S.CONNECTION_STATUS.CONNECTED){r=h.getAttribute(S.DELIVERY_RECEIPTS.ID),i=p.Strophe.getBareJidFromJid(h.getAttribute(S.MessageConstatnts.XMPP_KEYS.FROM)),a=C.getUidFromJid(i),c=S.MessageConstatnts.XMPP_KEYS.TYPE_USER,u=S.MessageConstatnts.RECEIVER_TYPE.USER,l=h.getElementsByTagName("request"),t=h.getElementsByTagName("received");try{n=h.getElementsByTagName("body")[0].innerHTML}catch(e){E=n=void 0}void 0!==n&&(E=JSON.parse(n).receiverType),s=T.CometChat.getMode(),(_.isFalsy(s)||s&&s===S.APP_SETTINGS.KEYS.DEFAULT_MODE)&&T.CometChat.getLoggedinUser().then(function(e){var t=new f.User(e);t.setAuthToken("");var n=JSON.stringify(t);if(h.getAttribute(S.MessageConstatnts.XMPP_KEYS.TYPE)==S.MessageConstatnts.XMPP_KEYS.TYPE_GROUP||void 0!==E&&E==S.MessageConstatnts.RECEIVER_TYPE.GROUP){if(u=S.MessageConstatnts.RECEIVER_TYPE.GROUP,i=C.getGroupJidFullGroupJid(h.getAttribute(S.MessageConstatnts.XMPP_KEYS.FROM)),c=S.MessageConstatnts.XMPP_KEYS.TYPE_GROUP,0a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)return new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0l.DEFAULT_VALUES.USERS_MAX_LIMIT)return new c.CometChatException(JSON.parse(i.format(JSON.stringify(l.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",l.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0u.DEFAULT_VALUES.USERS_MAX_LIMIT)return new c.CometChatException(JSON.parse(i.format(JSON.stringify(u.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",u.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},o.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT?new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT))):this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e}();t.ConversationsRequest=c;var u=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setConversationType=function(e){return this.conversationType=e,this},e.prototype.build=function(){return new c(this)},e}();t.ConversationsRequestBuilder=u},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(r,i,a,c){return new(a||(a=Promise))(function(e,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function s(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(n,s)}o((c=c.apply(r,i||[])).next())})},a=this&&this.__generator||function(n,s){var o,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]f.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void t(new C.CometChatException(JSON.parse(T.format(JSON.stringify(f.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",f.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(re&&I.MessageListnerMaping.getInstance().set(f.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(l.id))},function(e){I.MessageListnerMaping.getInstance().set(f.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(l.id))}),g.affix==f.MessageConstatnts.PAGINATION.AFFIX.APPEND?(g.idparseInt(l.id)&&(g.id=parseInt(l.id)),g.timestamp>l.sentAt&&(g.timestamp=l.sentAt),g.updatedAt>l.updatedAt&&(g.updatedAt=l.updatedAt)),g.id&&(g.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.ID]=g.id),g.timestamp&&(g.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=g.timestamp),g.updatedAt&&(g.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=g.updatedAt),t.push(_.MessageController.trasformJSONMessge(l))})}else t=[];s(t)},function(e){t(new C.CometChatException(e.error))})}catch(e){t(new C.CometChatException(e))}})},e.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(T.isFalsy(this.guid)||T.isFalsy(this.uid))&&T.isFalsy(this.guid)?(T.isFalsy(this.uid)?this.endpointName="getMessages":this.endpointName="getUserMessages",this.listId=this.uid):(this.endpointName="getGroupMessages",this.listId=this.guid)},e.prototype.makeData=function(){var e={};e[f.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,e[f.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(T.isFalsy(this.guid)||T.isFalsy(this.uid))&&T.isFalsy(this.guid)&&T.isFalsy(this.uid)},e.prototype.getFilteredPreviousDataByReceiverId=function(t){return s(this,void 0,void 0,function(){var n,s=this;return a(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,o.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).filter(function(e){return t[e].sender.uid==s.uid}).map(function(e){n=n.concat([t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,o.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e.prototype.getFilteredNextDataByReceiverId=function(t){return s(this,void 0,void 0,function(){var n,s=this;return a(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,o.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).filter(function(e){return t[e].sender.uid==s.uid}).map(function(e){n=n.concat([t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,o.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e}();t.DefaultMessagesRequest=r;var i=function(){function e(){this.maxLimit=f.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=f.DEFAULT_VALUES.DEFAULT_MSG_ID,this.unread=!1,this.HideMessagesFromBlockedUsers=!1,this.onlyUpdate=0}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setGUID=function(e){return this.guid=e,this},e.prototype.setUID=function(e){return this.uid=e,this},e.prototype.setParentMessageId=function(e){return this.parentMessageId=e,this},e.prototype.setTimestamp=function(e){return void 0===e&&(e=T.getCurrentTime()),this.timestamp=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=f.DEFAULT_VALUES.DEFAULT_MSG_ID),this.id=e,this},e.prototype.setUnread=function(e){return void 0===e&&(e=!1),this.unread=e,this},e.prototype.hideMessagesFromBlockedUsers=function(e){return void 0===e&&(e=!1),this.HideMessagesFromBlockedUsers=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKey=e,this},e.prototype.setUpdatedAfter=function(e){return this.updatedAt=e,this},e.prototype.updatesOnly=function(e){return e&&(this.onlyUpdate=1),this},e.prototype.setCategory=function(e){return this.category=e,this},e.prototype.setCategories=function(e){return this.categories=e,this},e.prototype.setType=function(e){return this.type=e,this},e.prototype.setTypes=function(e){return this.types=e,this},e.prototype.hideReplies=function(e){return this.HideReplies=e,this},e.prototype.build=function(){return this.category&&this.categories&&this.categories.push(this.category),this.type&&this.types&&this.types.push(this.type),new r(this)},e}();t.DefaultMessagesRequestBuilder=i},function(e,t,n){"use strict";t.__esModule=!0;var s=function(e){};t.CometChatExtension=s},function(e,t,n){"use strict";t.__esModule=!0;var o=n(5),s=n(1),r=n(8),i=n(2),a=n(0),c=function(){function e(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},s.isFalsy(e)||(this.limit=e.limit,s.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),s.isFalsy(e.direction)||(this.direction=e.direction))}return e.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0>>((3&t)<<3)&255;return o}}},function(e,t){for(var o=[],n=0;n<256;++n)o[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,s=o;return[s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]]].join("")}},function(e,E,d){(function(r,i){var c;!function(e){var t=E,n=(r&&r.exports,"object"==typeof i&&i);n.global!==n&&n.window;var s=function(e){this.message=e};(s.prototype=new Error).name="InvalidCharacterError";var u=function(e){throw new s(e)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=/[\t\n\f\r ]/g,o={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,s,o,r=e.length%3,i="",a=-1,c=e.length-r;++a>18&63)+l.charAt(o>>12&63)+l.charAt(o>>6&63)+l.charAt(63&o);return 2==r?(t=e.charCodeAt(a)<<8,n=e.charCodeAt(++a),i+=l.charAt((o=t+n)>>10)+l.charAt(o>>4&63)+l.charAt(o<<2&63)+"="):1==r&&(o=e.charCodeAt(a),i+=l.charAt(o>>2)+l.charAt(o<<4&63)+"=="),i},decode:function(e){var t=(e=String(e).replace(a,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var n,s,o=0,r="",i=-1;++i>(-2*o&6)));return r},version:"0.1.0"};void 0===(c=function(){return o}.call(E,d,E,r))||(r.exports=c)}()}).call(this,d(69)(e),d(28))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";t.__esModule=!0;var s=n(1),o=function(){function e(e){this.id="",this.name="",e&&(s.isFalsy(e.id)||(this.id=e.id),s.isFalsy(e.name)||(this.name=e.name))}return e.prototype.getId=function(){return this.id},e.prototype.getName=function(){return this.name},e}();t.CCExtension=o},function(e,t,n){function s(e){this.options=e||{locator:{}}}function u(){this.cdata=!1}function l(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function E(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function o(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function d(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}s.prototype.parseFromString=function(e,t){var n=this.options,s=new h,o=n.domBuilder||new u,r=n.errorHandler,i=n.locator,a=n.xmlns||{},c={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return i&&o.setDocumentLocator(i),s.errorHandler=function(s,e,o){if(!s){if(e instanceof u)return e;s=e}var r={},i=s instanceof Function;function t(t){var n=s[t];!n&&i&&(n=2==s.length?function(e){s(t,e)}:s),r[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+E(o))}||function(){}}return o=o||{},t("warning"),t("error"),t("fatalError"),r}(r,o,i),s.domBuilder=n.domBuilder||o,/\/x?html?$/.test(t)&&(c.nbsp=" ",c.copy="©",a[""]="http://www.w3.org/1999/xhtml"),a.xml=a.xml||"http://www.w3.org/XML/1998/namespace",e?s.parse(e,a,c):s.errorHandler.error("invalid doc source"),o.doc},u.prototype={startDocument:function(){this.doc=(new r).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,s){var o=this.doc,r=o.createElementNS(e,n||t),i=s.length;d(this,r),this.currentElement=r,this.locator&&l(this.locator,r);for(var a=0;a":switch(c){case E:n.setTagName(e.slice(t,a));case C:case S:case _:break;case g:case d:"/"===(l=e.slice(t,a)).slice(-1)&&(n.closed=!0,l=l.slice(0,-1));case h:c===h&&(l=i),c==g?(r.warning('attribute "'+l+'" missed quot(")!!'),n.add(i,l.replace(/&#?\w+;/g,o),t)):("http://www.w3.org/1999/xhtml"===s[""]&&l.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),n.add(l,l,t));break;case p:throw new Error("attribute value missed!!")}return a;case"€":u=" ";default:if(u<=" ")switch(c){case E:n.setTagName(e.slice(t,a)),c=S;break;case d:i=e.slice(t,a),c=h;break;case g:var l=e.slice(t,a).replace(/&#?\w+;/g,o);r.warning('attribute "'+l+'" missed quot(")!!'),n.add(i,l,t);case C:c=S}else switch(c){case h:n.tagName;"http://www.w3.org/1999/xhtml"===s[""]&&i.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+i+'" missed value!! "'+i+'" instead2!!'),n.add(i,i,t),t=a,c=d;break;case C:r.warning('attribute space is required"'+i+'"!!');case S:c=d,t=a;break;case p:c=g,t=a;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}a++}}function D(e,t,n){for(var s=e.tagName,o=null,r=e.length;r--;){var i=e[r],a=i.qName,c=i.value;if(0<(d=a.indexOf(":")))var u=i.prefix=a.slice(0,d),l=a.slice(d+1),E="xmlns"===u&&l;else u=null,E="xmlns"===(l=a)&&"";i.localName=l,!1!==E&&(null==o&&(o={},T(n,n={})),n[E]=o[E]=c,i.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(E,c))}for(r=e.length;r--;){(u=(i=e[r]).prefix)&&("xml"===u&&(i.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==u&&(i.uri=n[u||""]))}var d=s.indexOf(":");l=e.localName=0",t),i=e.substring(t+1,r);if(/[&<]/.test(i))return/^script$/i.test(n)||(i=i.replace(/&#?\w+;/g,s)),o.characters(i,0,i.length),r}return t+1}function Y(e,t,n,s){var o=s[n];return null==o&&((o=e.lastIndexOf(""))",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var r=function(e,t){var n,s=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=t,o.exec(e);for(;n=o.exec(e);)if(s.push(n),n[1])return s}(e,t),i=r.length;if(1",t);if(s){var o=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),s+2}return-1}return-1}function x(e){}function i(e,t){return e.__proto__=t,e}r.prototype={parse:function(e,t,n){var s=this.domBuilder;s.startDocument(),T(t,t={}),function(n,e,s,o,r){function i(e){var t=e.slice(1,-1);return t in s?s[t]:"#"===t.charAt(0)?function(e){{if(65535>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function t(e){if(p",g+3),T=n.substring(g+2,_),f=d.pop();_<0?(T=n.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+T+" is not complete:"+f.tagName),_=g+1+T.length):T.match(/\si[0]&&t[1]","text/xml"),t.btoa=$.encode,t.atob=$.decode,p.isNative=!0,p.typingTimer(),p.appId=e,p.localStorage=f.LocalStorage.getInstance(),p.keyStore=i.KeyStore.getInstance(),p.messageListnerMaping=v.MessageListnerMaping.getInstance()}catch(e){g.Logger.error("CometChat: constructor",e)}}return p.setAuthToken=function(e){try{p.authToken=e}catch(e){g.Logger.error("CometChat: setAuthToken",e)}},p.prototype.getAuthToken=function(){try{return p.authToken}catch(e){g.Logger.error("CometChat: getAuthToken",e)}},p.getAppId=function(){try{return p.appId}catch(e){g.Logger.error("CometChat: getAppId",e)}},p.prototype.getApiKey=function(){try{return p.apiKey}catch(e){g.Logger.error("CometChat: getApiKey",e)}},p.getMode=function(){try{return p.mode}catch(e){g.Logger.error("CometChat: getMode",e)}},p.setMode=function(e){try{p.mode=e}catch(e){g.Logger.error("CometChat: getMode",e)}},p.getSessionId=function(){try{return p.sessionId}catch(e){g.Logger.error("CometChat: getAppId",e)}},p.getLastMessageId=function(){try{return p.lastMessageId}catch(e){g.Logger.error("CometChat: getLastMessageId",e)}},p.setLastMessageId=function(e){try{p.lastMessageId=e}catch(e){g.Logger.error("CometChat: getLastMessageId",e)}},p.setSuccessfulTimeStamp=function(e){try{p.successfulPingTimeStamp=e}catch(e){g.Logger.error("CometChat: setSuccessfulTimeStamp",e)}},p.getSuccessfultTimeStamp=function(){try{return p.successfulPingTimeStamp}catch(e){g.Logger.error("CometChat: getSuccessfultTimeStamp",e)}},p.isPollingEnabled=function(){try{return p.pollingEnabled}catch(e){g.Logger.error("CometChat: isPollingEnabled",e)}},p.didMessagesPollingStart=function(){try{return p.isMessagesPollingStarted}catch(e){g.Logger.error("CometChat: didMessagesPollingStart",e)}},p.didAnalyticsPingStart=function(){try{return p.isAnalyticsPingStarted}catch(e){g.Logger.error("CometChat: didAnalyticsPingStart",e)}},p.init=function(o,e){var r=this;return void 0===o&&(o=""),void 0===e&&(e={}),new Promise(function(n,s){try{p.pollingMessagesId=0,"object"==typeof o&&(o.hasOwnProperty("appId")&&(o=o.appId),o.hasOwnProperty("appSettings")&&(e=o.appSettings)),g.isFalsy(e)?e=(new K.AppSettingsBuilder).setRegion(K.AppSettings.REGION_EU).build():e.getRegion()==K.AppSettings.REGION_PRIVATE&&(e.region=o),r.appSettings=e,g.isFalsy(o)?s(new S.CometChatException(O.INIT_ERROR.NO_APP_ID)):(p.setSuccessfulTimeStamp((new Date).getTime()),r.initialzed=!0,p.appId=o,p.getInstance(o),p.sessionId=R.APPINFO.platform+"-"+R.APPINFO.sdkVersionWithUnderScore+"-"+V()+"-"+(new Date).getTime(),p.setLastMessageId(0),p.shouldFallBackToPolling=!0,f.LocalStorage.getInstance().get(R.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e)p.appId=o,p.getInstance(o),f.LocalStorage.getInstance().set(R.LOCAL_STORE.KEY_APP_ID,o),n(!0);else{var t=e.toLocaleString();t===o?(p.appId=t,p.getInstance(t),f.LocalStorage.getInstance().get(R.LOCAL_STORE.KEY_USER).then(function(e){e?(p.isLoggedOut=!1,p.user=new _.Me(e),p.setAuthToken(p.user.getAuthToken()),e.jwt&&(p.jwt=e.jwt),n(!0),f.LocalStorage.getInstance().get(R.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){e&&(e[R.APP_SETTINGS.KEYS.MODE]&&(p.mode=e[R.APP_SETTINGS.KEYS.MODE]),e[R.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(p.settingsHash=e[R.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(p.settingsHashReceivedAt=e[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),e[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]&&(p.analyticsHost=e[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]),e[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]&&(p.analyticsVersion=e[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]),p.isAnalyticsDisabled=!!e[R.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],e.hasOwnProperty(R.APP_SETTINGS.KEYS.DENY_FALLBACK_TO_POLLING)&&(p.shouldFallBackToPolling=!1),p.didAnalyticsPingStart()||p.isAnalyticsDisabled||(p.pingAnalytics(),p.startAnalyticsPingTimer()),e[R.APP_SETTINGS.KEYS.POLLING_ENABLED]?(p.pollingEnabled=!0,e[R.APP_SETTINGS.KEYS.POLLING_INTERVAL]&&(p.pollingInterval=e[R.APP_SETTINGS.KEYS.POLLING_INTERVAL]),r.currentConnectionStatus=R.CONNECTION_STATUS.FEATURE_THROTTLED,p.didMessagesPollingStart()||(X.XMPPConnectionHandlers.map(function(e){try{e._XMPPeventListener&&(g.isFalsy(e._XMPPeventListener.onFeatureThrottled)||e._XMPPeventListener.onFeatureThrottled())}catch(e){g.Logger.error("XMPPConnectionHandlers: Feature Throttled Status",e)}}),p.pollingMessagesTimestamp=Math.floor((new Date).getTime()/1e3),p.fetchMessages(),p.startMessagesTimer())):(p.pollingEnabled=!1,p.isConnectingFromInit=!0,p.XMPPLogin(p.user,function(){n(!0)},function(){s("error in connecting to xmpp server")})))})):n(!0)})):r.clearCache().then(function(){p.apiKey=void 0,p.user=void 0,p.authToken=void 0,p.cometChat=void 0,p.mode=void 0,T.XMPPConnectionHelper.getInstance().XMPPDisconnect(),p.appId=o,f.LocalStorage.getInstance().set(R.LOCAL_STORE.KEY_APP_ID,o),p.getInstance(o),n(!0)})}i.KeyStore.getInstance().get(R.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==e){var t=V(),n=(new Date).getTime(),s=o+"_"+t+"_"+n;i.KeyStore.getInstance().set(R.LOCAL_STORE.KEY_DEVICE_ID,s)}})}))}catch(e){s(new S.CometChatException(e))}})},p.isInitialized=function(){try{return this.initialzed}catch(e){g.Logger.error("CometChat: isInitialized",e)}},p.getInstance=function(e){try{return this.cometChat||(this.cometChat=new p(e)),this.cometChat}catch(e){g.Logger.error("CometChat: getInstance",e)}},p.registerTokenForPushNotification=function(E,d){var h=this;return new Promise(function(u,l){try{p.keyStore.get(R.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){var t="",n=e,s=R.APPINFO.platform,o=R.APPINFO.sdkVersion,r=R.APPINFO.apiVersion;if(navigator&&(t=navigator.userAgent),null==n){var i=V(),a=(new Date).getTime();n=h.appId+"_"+i+"_"+a,p.keyStore.set(R.LOCAL_STORE.KEY_DEVICE_ID,n)}var c={platform:s,deviceId:n,appInfo:{version:o,apiVersion:r,userAgent:t,pushNotification:{fcmDeviceToken:E,settings:d}}};C.makeApiCall("updateMyDetails",{},c,!1).then(function(e){u("Token Registration successful")},function(e){l(new S.CometChatException(e.error))}).catch(function(e){l(new S.CometChatException(e))})})}catch(e){l(new S.CometChatException(e))}})},p.pushToLoginListener=function(t,n){X.loginHandlers.map(function(e){try{if(e._eventListener)switch(n){case"Login_Success":g.isFalsy(e._eventListener.loginSuccess)||e._eventListener.loginSuccess(t);break;case"Login_Failure":g.isFalsy(e._eventListener.loginFailure)||e._eventListener.loginFailure(t);break;case"Logout_Success":g.isFalsy(e._eventListener.logoutSuccess)||e._eventListener.logoutSuccess()}}catch(e){g.Logger.error("XMPPConnectionHandlers: onConnected Status",e)}})},p.login=function(){for(var c=this,u=[],e=0;e=1e3*R.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT||null==D.TypingNotificationController.getTypingStartedMap(n))&&g.getAppSettings().then(function(e){var t=p.getMode();if(g.isFalsy(t)||t&&t===R.APP_SETTINGS.KEYS.DEFAULT_MODE){switch(s){case R.XMPP.CONVERSATION.TYPE.CHAT:X.sendTypingStarted(g.format(R.XMPP.bare_jid_string,p.getAppId(),n,g.getJidHost(e)),s,o);break;case R.XMPP.CONVERSATION.TYPE.GROUP_CHAT:X.sendTypingStarted(g.format(R.XMPP.muc_jid_string,p.getAppId(),n,e[R.APP_SETTINGS.KEYS.GROUP_SERVICE],g.getJidHost(e)),s,o)}return D.TypingNotificationController.addTypingStarted(n),void D.TypingNotificationController.removeTypingEnded(n)}},function(e){})}catch(e){g.Logger.error("CometChat: startTyping",e)}},p.endTyping=function(e){try{if(!g.isFalsy(e)){var n,s=this.RECEIVER_TYPE.USER,o={};if(e instanceof U.TypingIndicator)n=e.getReceiverId(),s=e.getReceiverType(),o=e.getMetadata();else{if(!e.hasOwnProperty(R.TYPING_NOTIFICATION.RECEIVER_ID))return;n=e[R.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(R.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(s=e[R.TYPING_NOTIFICATION.RECEIVER_TYPE]),s=s==this.RECEIVER_TYPE.USER?R.XMPP.CONVERSATION.TYPE.CHAT:R.XMPP.CONVERSATION.TYPE.GROUP_CHAT,e.hasOwnProperty(R.TYPING_NOTIFICATION.META)&&(o=e[R.TYPING_NOTIFICATION.META])}if(g.isFalsy(n))return;s=s==this.RECEIVER_TYPE.USER?R.XMPP.CONVERSATION.TYPE.CHAT:R.XMPP.CONVERSATION.TYPE.GROUP_CHAT,D.TypingNotificationController.getTypingStartedMap(n)&&g.getCurrentTime()-D.TypingNotificationController.getTypingStartedMap(n)<1e3*R.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&(D.TypingNotificationController.getTypingEndedMap(n)&&g.getCurrentTime()-D.TypingNotificationController.getTypingEndedMap(n)>=1e3*R.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT||null==D.TypingNotificationController.getTypingEndedMap(n))&&g.getAppSettings().then(function(e){var t=p.getMode();if(g.isFalsy(t)||t&&t===R.APP_SETTINGS.KEYS.DEFAULT_MODE){switch(s){case R.XMPP.CONVERSATION.TYPE.CHAT:X.sendTypingPaused(g.format(R.XMPP.bare_jid_string,p.getAppId(),n,g.getJidHost(e)),s,o);break;case R.XMPP.CONVERSATION.TYPE.GROUP_CHAT:X.sendTypingPaused(g.format(R.XMPP.muc_jid_string,p.getAppId(),n,e[R.APP_SETTINGS.KEYS.GROUP_SERVICE],g.getJidHost(e)),s,o)}return D.TypingNotificationController.addTypingEnded(n),void D.TypingNotificationController.removeTypingStarted(n)}},function(e){})}}catch(e){g.Logger.error("CometChat: endTyping",e)}},p.markAsRead=function(e,t,n){try{T.XMPPConnectionHelper.getInstance().markAsRead(t,n,e)}catch(e){g.Logger.error("CometChat: markAsRead",e)}},p.markAsDelivered=function(e,t,n){try{T.XMPPConnectionHelper.getInstance().markAsDelivered(t,n,e)}catch(e){g.Logger.error("CometChat: markAsDelivered",e)}},p.getMessageDetails=function(e){return new Promise(function(t,n){try{g.isFalsy(e)?n(new S.CometChatException(O.ERRORS.PARAMETER_MISSING)):C.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){t(I.MessageController.trasformJSONMessge(e.data))},function(e){g.Logger.error("CometChat:GetMessageDetails:",e),n(new S.CometChatException(e.error))})}catch(e){n(new S.CometChatException(e))}})},p.getMessageReceipts=function(s){return new Promise(function(t,n){try{var e=g.validateMsgId(s);if(e instanceof S.CometChatException)return void n(e);g.isFalsy(s)?n(new S.CometChatException(O.ERRORS.PARAMETER_MISSING)):C.makeApiCall("getMessageDetails",{messageId:s}).then(function(e){I.MessageController.getReceiptsFromJSON(e.data).then(function(e){t(e)},function(e){n(new S.CometChatException(e))})},function(e){g.Logger.error("CometChat:GetMessageDetails:",e),n(new S.CometChatException(e.error))})}catch(e){n(new S.CometChatException(e))}})},p.getUnreadMessageCount=function(n){void 0===n&&(n=!1);var o=0;return new Promise(function(s,t){try{var e=g.validateHideMessagesFromBlockedUsers(n);if(e instanceof S.CometChatException)return void t(e);n&&(o=1),C.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:o}).then(function(e){var t={},n={};e.data.map(function(e){e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==R.MessageConstatnts.RECEIVER_TYPE.GROUP?n[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),s({users:t,groups:n})},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.getUnreadMessageCountForAllUsers=function(s){void 0===s&&(s=!1);var o=0;return new Promise(function(n,t){try{var e=g.validateHideMessagesFromBlockedUsers(s);if(e instanceof S.CometChatException)return void t(e);s&&(o=1),C.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:o,receiverType:R.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(h({},t))},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.getUnreadMessageCountForAllGroups=function(s){void 0===s&&(s=!1);var o=0;return new Promise(function(n,t){try{var e=g.validateHideMessagesFromBlockedUsers(s);if(e instanceof S.CometChatException)return void t(e);s&&(o=1),C.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:o,receiverType:R.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==R.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(h({},t))},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.getUnreadMessageCountForUser=function(o,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=g.validateId(o,"user");if(e instanceof S.CometChatException)return void t(e);var s=g.validateHideMessagesFromBlockedUsers(r);if(s instanceof S.CometChatException)return void t(s);r&&(i=1),C.makeApiCall("getUserMessages",{listId:o},{hideMessagesFromBlockedUsers:i,unread:1,count:1,uid:o}).then(function(e){var t={};e.data.map(function(e){t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(h({},t))},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.getUnreadMessageCountForGroup=function(o,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=g.validateId(o,"group");if(e instanceof S.CometChatException)return void t(e);var s=g.validateHideMessagesFromBlockedUsers(r);if(s instanceof S.CometChatException)return void t(s);r&&(i=1),C.makeApiCall("getGroupMessages",{listId:o},{hideMessagesFromBlockedUsers:i,unread:1,count:1,guid:o}).then(function(e){var t={};e.data.map(function(e){e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==R.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[R.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(h({},t))},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.editMessage=function(s){return new Promise(function(t,n){try{var e=g.validateMsgId(s.getId());if(e instanceof S.CometChatException)return void n(e);C.makeApiCall("updateMessage",{messageId:s.getId()},s).then(function(e){t(I.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new S.CometChatException(e.error))})}catch(e){n(new S.CometChatException(e))}})},p.deleteMessage=function(s){return new Promise(function(t,n){try{var e=g.validateMsgId(s);if(e instanceof S.CometChatException)return void n(e);C.makeApiCall("deleteMessage",{messageId:s},{id:s}).then(function(e){t(I.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new S.CometChatException(e.error))})}catch(e){n(new S.CometChatException(e))}})},p.getPreviousMessagesByTimestamp=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new S.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"TIMESTAMP","TIMESTAMP","timestamp")))):I.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.SENT_AT,R.MessageConstatnts.PAGINATION.AFFIX.PREPEND).then(function(e){return t(e)},function(e){return n(new S.CometChatException(e))})}catch(e){n(new S.CometChatException(e))}})},p.getPreviousMessagesById=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new S.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"MESSAGE_ID","MESSAGE_ID","messageId")))):I.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.ID,R.MessageConstatnts.PAGINATION.AFFIX.PREPEND).then(function(e){return t(e)},function(e){return n(new S.CometChatException(e))})}catch(e){n(new S.CometChatException(e))}})},p.getNextMessagesByTimestamp=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new S.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"TIMESTAMP","TIMESTAMP","timestamp")))):I.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.SENT_AT,R.MessageConstatnts.PAGINATION.AFFIX.APPEND).then(function(e){return t(e)},function(e){return n(new S.CometChatException(e))})}catch(e){n(new S.CometChatException(e))}})},p.getNextMessagesById=function(e,s){return new Promise(function(t,n){try{g.isFalsy(s)?n(new S.CometChatException(JSON.parse(g.format(JSON.stringify(R.PARAMETER_ERROR.PARAMETER_REQUIRED),"MESSAGE_ID","MESSAGE_ID","messageId")))):I.MessageController.getAllMessage(e,s,R.MessageConstatnts.PAGINATION.CURSOR_FILEDS.ID,R.MessageConstatnts.PAGINATION.AFFIX.APPEND).then(function(e){return t(e)},function(e){return n(new S.CometChatException(e))})}catch(e){n(new S.CometChatException(e))}})},p.createUser=function(o,r){return new Promise(function(n,t){try{if(g.isFalsy(r))return void t(new S.CometChatException(JSON.parse(g.format(JSON.stringify(R.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));p.apiKey=r;var e=g.validateCreateUser(o);if(e instanceof S.CometChatException)return void t(e);if(!(o instanceof _.User)){var s=void 0;if(!o.hasOwnProperty(R.UserConstants.UID))return void t(new S.CometChatException(O.ERRORS.PARAMETER_MISSING));if(!o.hasOwnProperty(R.UserConstants.NAME))return void t(new S.CometChatException(O.ERRORS.PARAMETER_MISSING));s=new _.User(o[R.UserConstants.UID],o[R.UserConstants.NAME]),o.hasOwnProperty(R.UserConstants.AVATAR)&&s.setAvatar(o[R.UserConstants.AVATAR]),o.hasOwnProperty(R.UserConstants.ROLE)&&s.setRole(o[R.UserConstants.ROLE]),o.hasOwnProperty(R.UserConstants.META_DATA)&&s.setMetadata(o[R.UserConstants.META_DATA]),o.hasOwnProperty(R.UserConstants.LINK)&&s.setLink(o[R.UserConstants.LINK]),o.hasOwnProperty(R.UserConstants.STATUS_MESSAGE)&&s.setStatusMessage(o[R.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(R.UserConstants.TAGS)&&s.setTags(o[R.UserConstants.TAGS]),o=s}C.makeApiCall("createUser",{},o).then(function(e){var t=c.UsersController.trasformJSONUser(e.data);n(t)},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.updateUser=function(s,i){var a=this;return new Promise(function(o,t){try{if(g.isFalsy(i))return void t(new S.CometChatException(JSON.parse(g.format(JSON.stringify(R.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));p.apiKey=i;var e=g.validateUpdateUser(s);if(e instanceof S.CometChatException)return void t(e);if(!(s instanceof _.User)){var n=void 0;if(!s.hasOwnProperty(R.UserConstants.UID))return void t(new S.CometChatException(O.ERRORS.PARAMETER_MISSING));n=new _.User(s[R.UserConstants.UID]),s.hasOwnProperty(R.UserConstants.NAME)&&n.setName(s[R.UserConstants.NAME]),s.hasOwnProperty(R.UserConstants.AVATAR)&&n.setAvatar(s[R.UserConstants.AVATAR]),s.hasOwnProperty(R.UserConstants.ROLE)&&n.setRole(s[R.UserConstants.ROLE]),s.hasOwnProperty(R.UserConstants.META_DATA)&&n.setMetadata(s[R.UserConstants.META_DATA]),s.hasOwnProperty(R.UserConstants.LINK)&&n.setLink(s[R.UserConstants.LINK]),s.hasOwnProperty(R.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(s[R.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(R.UserConstants.TAGS)&&n.setTags(s[R.UserConstants.TAGS]),s=n}var r=s.uid;C.makeApiCall("updateUser",{uid:r},s).then(function(s){if(a.user&&r.toLocaleLowerCase()===a.user.getUid().toLocaleLowerCase())f.LocalStorage.getInstance().get("user").then(function(e){if(e){var t=c.UsersController.trasformJSONUser(s.data),n=s.data;n.wsChannel=e.wsChannel,n.authToken=p.authToken,n.status=R.PresenceConstatnts.STATUS.ONLINE,e.jwt&&(n.jwt=e.jwt),p.user=new _.Me(n),a.localStorage.set("user",p.user),o(t)}});else{var e=c.UsersController.trasformJSONUser(s.data);o(e)}},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.getUser=function(s){return new Promise(function(n,t){try{"object"==typeof s&&s.hasOwnProperty("uid")&&(s=s.uid);var e=g.validateId(s,"user");if(e instanceof S.CometChatException)return void t(e);C.makeApiCall("user",{uid:s}).then(function(e){var t=c.UsersController.trasformJSONUser(e.data);n(t)}).catch(function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},p.getLoggedInUser=function(){var d=this;return new Promise(function(l,E){try{p.localStorage.get(R.LOCAL_STORE.KEY_USER).then(function(e){if(e)l(p.user=new _.Me(e));else{var r="",i="",a=R.APPINFO.platform,c=R.APPINFO.sdkVersion,u=R.APPINFO.apiVersion;p.keyStore.get(R.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(i=e,navigator&&(r=navigator.userAgent),null==i){var t=V(),n=(new Date).getTime();i=d.appId+"_"+t+"_"+n,p.keyStore.set(R.LOCAL_STORE.KEY_DEVICE_ID,i)}var s={version:c,apiVersion:u,userAgent:r};g.isFalsy(d.platform)||(s.platform=d.platform),g.isFalsy(d.language)||(s.language=d.language),g.isFalsy(d.resource)||(s.resource=d.resource);var o={platform:a,deviceId:i,appInfo:s};C.makeApiCall("updateMyDetails",{},o,!1).then(function(e){e.data.jwt&&(p.jwt=e.data.jwt);var t=e.data.settings;t&&(f.LocalStorage.getInstance().set("app_settings",t),t[R.APP_SETTINGS.KEYS.MODE]&&p.setMode(t[R.APP_SETTINGS.KEYS.MODE]),t[R.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(p.settingsHash=t[R.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(p.settingsHashReceivedAt=t[R.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),t[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]&&(p.analyticsHost=t[R.APP_SETTINGS.KEYS.ANALYTICS_HOST]),t[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]&&(p.analyticsVersion=t[R.APP_SETTINGS.KEYS.ANALYTICS_VERSION]),p.isAnalyticsDisabled=!!t[R.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],t.hasOwnProperty(R.APP_SETTINGS.KEYS.DENY_FALLBACK_TO_POLLING)&&(p.shouldFallBackToPolling=!1),p.pollingEnabled=t[R.APP_SETTINGS.KEYS.POLLING_ENABLED],p.isPollingEnabled()&&t[R.APP_SETTINGS.KEYS.POLLING_INTERVAL]&&(p.pollingInterval=t[R.APP_SETTINGS.KEYS.POLLING_INTERVAL])),l(new _.Me(e.data))},function(e){E(new S.CometChatException(e.error))}).catch(function(e){E(new S.CometChatException(e))})})}})}catch(e){E(new S.CometChatException(e))}})},p.getLoggedinUser=function(){return new Promise(function(t,n){try{p.localStorage.get(R.LOCAL_STORE.KEY_USER).then(function(e){t(e?new _.User(e):null)},function(e){t(null)})}catch(e){n(new S.CometChatException(e))}})},p.blockUsers=function(s){return new Promise(function(t,n){try{var e=g.validateArray(s,"blockUsers");if(e instanceof S.CometChatException)return void n(e);g.isFalsy(s)?n(new S.CometChatException(O.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):C.makeApiCall("blockUsers",{},{blockedUids:s}).then(function(e){t(e.data)},function(e){n(new S.CometChatException(e.error))})}catch(e){n(new S.CometChatException(e))}})},p.unblockUsers=function(s){return new Promise(function(t,n){try{var e=g.validateArray(s,"unblockUsers");if(e instanceof S.CometChatException)return void n(e);g.isFalsy(s)?n(new S.CometChatException(O.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):C.makeApiCall("unblockUsers",{},{blockedUids:s}).then(function(e){t(e.data)},function(e){n(new S.CometChatException(e.error))})}catch(e){n(new S.CometChatException(e))}})},p.getConversation=function(r,i){return new Promise(function(n,s){try{var e={};e.conversationWith=r,e.conversationType=i;var t=g.validateConversationType(i);if(t instanceof S.CometChatException)return void s(t);var o=g.validateId(r,i);if(o instanceof S.CometChatException)return void s(o);C.makeApiCall("getConversations",{},e).then(function(e){if(0 All store cleared successfully","true"),e(!0)})}catch(e){g.Logger.error("CometChat: clearCache",e),t(e)}})},p.typingTimer=function(){try{setInterval(function(){D.TypingNotificationController.clearTimer()},500)}catch(e){g.Logger.error("CometChat: typingTimer",e)}},p.prototype.internalLogout=function(){try{p.didAnalyticsPingStart()&&p.clearAnalyticsPingTimer(),p.didMessagesPollingStart()&&p.clearMessagesTimer(),p.WSReconnectionInProgress&&p.clearWSReconnectionTimer(),p.isLoggedOut=!0,p.pollingMessagesId=0,p.pollingEnabled=!1,p.pollingInterval=5e3,p.pollingEnabledInternally=!1,p.WSReconnectionStartTime=0,p.WSReconnectionInProgress=!1,p.setLastMessageId(0),p.setAccidentalDisconnect(!1),p.isAnalyticsDisabled=!1,p.shouldFallBackToPolling=!0,p.clearCache().then(function(){p.apiKey=void 0,p.user=void 0,p.authToken=void 0,p.cometChat=void 0,p.mode=void 0,T.XMPPConnectionHelper.getInstance().XMPPDisconnect(),p.pushToLoginListener("","Logout_Success")})}catch(e){g.Logger.error("CometChat: internalLogout",e)}},p.initialzed=!1,p.isNative=!1,p.CometChatException=S.CometChatException,p.TextMessage=m.TextMessage,p.MediaMessage=A.MediaMessage,p.CustomMessage=w.CustomMessage,p.Action=s.Action,p.Call=n.Call,p.TypingIndicator=U.TypingIndicator,p.Group=a.Group,p.AppUser=_.User,p.User=_.User,p.RTCUser=W.RTCUser,p.GroupMember=Y.GroupMember,p.Conversation=H.Conversation,p.USER_STATUS={ONLINE:R.PresenceConstatnts.STATUS.ONLINE,OFFLINE:R.PresenceConstatnts.STATUS.OFFLINE},p.MessagesRequest=L.DefaultMessagesRequest,p.MessagesRequestBuilder=L.DefaultMessagesRequestBuilder,p.UsersRequest=y.UsersRequest,p.UsersRequestBuilder=y.UsersRequestBuilder,p.ConversationsRequest=M.ConversationsRequest,p.ConversationsRequestBuilder=M.ConversationsRequestBuilder,p.BlockedUsersRequest=F.BlockedUsersRequest,p.BlockedUsersRequestBuilder=F.BlockedUsersRequestBuilder,p.GroupsRequest=r.GroupsRequest,p.GroupsRequestBuilder=r.GroupsRequestBuilder,p.GroupMembersRequest=P.GroupMembersRequest,p.GroupMembersRequestBuilder=P.GroupMembersRequestBuilder,p.BannedMembersRequest=P.GroupMembersRequest,p.BannedMembersRequestBuilder=P.GroupOutCastMembersRequestBuilder,p.AppSettings=K.AppSettings,p.AppSettingsBuilder=K.AppSettingsBuilder,p.MessageListener=e.MessageEventListener,p.UserListener=e.UserEventListener,p.GroupListener=e.GroupEventListener,p.OngoingCallListener=e.UserCallEventListener,p.CallListener=e.CallEventListener,p.ConnectionListener=T.XMPPConnectionEventListener,p.LoginListener=e.LoginEventListener,p.MESSAGE_TYPE=R.MessageConstatnts.TYPE,p.CATEGORY_MESSAGE=R.MessageConstatnts.CATEGORY.MESSAGE,p.CATEGORY_ACTION=R.MessageConstatnts.CATEGORY.ACTION,p.CATEGORY_CALL=R.MessageConstatnts.CATEGORY.CALL,p.CATEGORY_CUSTOM=R.MessageConstatnts.CATEGORY.CUSTOM,p.ACTION_TYPE=R.ActionConstatnts.ACTIONS,p.CALL_TYPE=R.CallConstants.CALL_TYPE,p.RECEIVER_TYPE=R.MessageConstatnts.RECEIVER_TYPE,p.CALL_STATUS=R.CallConstants.CALL_STATUS,p.CallController=N.CallController,p.GROUP_MEMBER_SCOPE=R.GROUP_MEMBER_SCOPE,p.GROUP_TYPE=R.GROUP_TYPE,p.MESSAGE_REQUEST=R.MessageConstatnts.PAGINATION.CURSOR_FILEDS,p.CometChatExtension=G.CometChatExtension,p.ExtensionManager=b.ExtensionManager,p.CometChatHelper=B.CometChatHelper,p.WSReconnectionStartTime=0,p.WSMaxReconnectionLimit=10,p.WSCurrentReconnectionCount=0,p.WSReconnectionInProgress=!1,p.WSReconnectionPeriod=3e4,p.WSReconnectionTimerInterval=3e4,p.pollingEnabledInternally=!1,p.accidentalDisconnect=!1,p.successfulPingTimeStamp=0,p.currentConnectionStatus=R.CONNECTION_STATUS.DISCONNECTED,p.CONNECTION_STATUS=R.CONNECTION_STATUS,p.Attachment=k.Attachment,p.isConnectingFromInit=!1,p.loginInProgress=!1,p.lastMessageId=0,p.pollingEnabled=!1,p.pollingInterval=5e3,p.pollingLimit=100,p.pollingAffix="append",p.pollingMessagesId=0,p.settingsInterval=6e4,p.isMessagesPollingStarted=!1,p.isAnalyticsPingStarted=!1,p.isLoggedOut=!0,p.isAnalyticsDisabled=!1,p.CallingComponent=q.CallingComponent,p.CallSettings=j.CallSettings,p.CallSettingsBuilder=j.CallSettingsBuilder,p.CALL_MODE=R.CallConstants.CALL_MODE,p.AUDIO_MODE=R.CallConstants.AUDIO_MODE,p.shouldFallBackToPolling=!0,p}();Z.CometChat=p}).call(this,ee(28))},function(e,t,n){"use strict";var s,o=this&&this.__extends||(s=function(e,t){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}s(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0;var r=n(2),i=n(12),a=n(0),c=function(){function e(){for(var e=[],t=0;ti[0]&&t[1]Math.floor(E.SECONDARY_TIMEOUT*this.wait)&&this._throttledRequestHandler(),s>Math.floor(E.TIMEOUT*this.wait)&&(E.warn("Request "+this._requests[0].id+" timed out, over "+Math.floor(E.TIMEOUT*this.wait)+" seconds since last activity"),this._throttledRequestHandler())}}},_getRequestStatus:function(e,t){var n;if(4===e.xhr.readyState)try{n=e.xhr.status}catch(e){E.error("Caught an error while retrieving a request's status, reqStatus: "+n)}return void 0===n&&(n="number"==typeof t?t:0),n},_onRequestStateChange:function(e,t){if(E.debug("request id "+t.id+"."+t.sends+" state changed to "+t.xhr.readyState),t.abort)t.abort=!1;else if(4===t.xhr.readyState){var n=this._getRequestStatus(t);if(this.lastResponseHeaders=t.xhr.getAllResponseHeaders(),this.disconnecting&&400<=n)return this._hitError(n),void this._callProtocolErrorHandlers(t);var s=0this._conn.maxRetries;if((s||o)&&(this._removeRequest(t),E.debug("request id "+t.id+" should now be removed")),200===n){var r=this._requests[0]===t;(this._requests[1]===t||r&&0Math.floor(E.SECONDARY_TIMEOUT*this.wait))&&this._restartRequest(0),this._conn.nextValidRid(Number(t.rid)+1),E.debug("request id "+t.id+"."+t.sends+" got 200"),e(t),this.errors=0}else 0===n||400<=n&&n<600||12e3<=n?(E.error("request id "+t.id+"."+t.sends+" error "+n+" happened"),this._hitError(n),this._callProtocolErrorHandlers(t),400<=n&&n<500&&(this._conn._changeConnectStatus(E.Status.DISCONNECTING,null),this._conn._doDisconnect())):E.error("request id "+t.id+"."+t.sends+" error "+n+" happened");s||o?o&&!this._conn.connected&&this._conn._changeConnectStatus(E.Status.CONNFAIL,"giving-up"):this._throttledRequestHandler()}},_processRequest:function(e){var n=this,s=this._requests[e],t=this._getRequestStatus(s,-1);if(s.sends>this._conn.maxRetries)this._conn._onDisconnectTimeout();else{var o=s.age(),r=!isNaN(o)&&o>Math.floor(E.TIMEOUT*this.wait),i=null!==s.dead&&s.timeDead()>Math.floor(E.SECONDARY_TIMEOUT*this.wait),a=4===s.xhr.readyState&&(t<1||500<=t);if((r||i||a)&&(i&&E.error("Request ".concat(this._requests[e].id," timed out (secondary), restarting")),s.abort=!0,s.xhr.abort(),s.xhr.onreadystatechange=function(){},this._requests[e]=new E.Request(s.xmlData,s.origFunc,s.rid,s.sends),s=this._requests[e]),0===s.xhr.readyState){E.debug("request id "+s.id+"."+s.sends+" posting");try{var c=this._conn.options.contentType||"text/xml; charset=utf-8";s.xhr.open("POST",this._conn.service,!this._conn.options.sync),void 0!==s.xhr.setRequestHeader&&s.xhr.setRequestHeader("Content-Type",c),this._conn.options.withCredentials&&(s.xhr.withCredentials=!0)}catch(e){return E.error("XHR open failed: "+e.toString()),this._conn.connected||this._conn._changeConnectStatus(E.Status.CONNFAIL,"bad-service"),void this._conn.disconnect()}var u=function(){if(s.date=new Date,n._conn.options.customHeaders){var e=n._conn.options.customHeaders;for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&s.xhr.setRequestHeader(t,e[t])}s.xhr.send(s.data)};if(1/g,">")).replace(/'/g,"'")).replace(/"/g,""")},xmlunescape:function(e){return e=(e=(e=(e=(e=e.replace(/\&/g,"&")).replace(/</g,"<")).replace(/>/g,">")).replace(/'/g,"'")).replace(/"/g,'"')},xmlTextNode:function(e){return S.xmlGenerator().createTextNode(e)},xmlHtmlNode:function(e){var t;DOMParser?t=(new DOMParser).parseFromString(e,"text/xml"):((t=new ActiveXObject("Microsoft.XMLDOM")).async="false",t.loadXML(e));return t},getText:function(e){if(!e)return null;var t="";0===e.childNodes.length&&e.nodeType===S.ElementType.TEXT&&(t+=e.nodeValue);for(var n=0;n/g,"\\3e").replace(/@/g,"\\40")},unescapeNode:function(e){return"string"!=typeof e?e:e.replace(/\\20/g," ").replace(/\\22/g,'"').replace(/\\26/g,"&").replace(/\\27/g,"'").replace(/\\2f/g,"/").replace(/\\3a/g,":").replace(/\\3c/g,"<").replace(/\\3e/g,">").replace(/\\40/g,"@").replace(/\\5c/g,"\\")},getNodeFromJid:function(e){return e.indexOf("@")<0?null:e.split("@")[0]},getDomainFromJid:function(e){var t=S.getBareJidFromJid(e);if(t.indexOf("@")<0)return t;var n=t.split("@");return n.splice(0,1),n.join("@")},getResourceFromJid:function(e){var t=e.split("/");return t.length<2?null:(t.splice(0,1),t.join("/"))},getBareJidFromJid:function(e){return e?e.split("/")[0]:null},_handleError:function(e){void 0!==e.stack&&S.fatal(e.stack),e.sourceURL?S.fatal("error: "+this.handler+" "+e.sourceURL+":"+e.line+" - "+e.name+": "+e.message):e.fileName?S.fatal("error: "+this.handler+" "+e.fileName+":"+e.lineNumber+" - "+e.name+": "+e.message):S.fatal("error: "+e.message)},log:function(e,t){e===this.LogLevel.FATAL&&"object"===g(window.console)&&"function"==typeof window.console.error&&window.console.error(t)},debug:function(e){this.log(this.LogLevel.DEBUG,e)},info:function(e){this.log(this.LogLevel.INFO,e)},warn:function(e){this.log(this.LogLevel.WARN,e)},error:function(e){this.log(this.LogLevel.ERROR,e)},fatal:function(e){this.log(this.LogLevel.FATAL,e)},serialize:function(n){if(!n)return null;"function"==typeof n.tree&&(n=n.tree());var e=r(Array(n.attributes.length).keys()).map(function(e){return n.attributes[e].nodeName});e.sort();var t=e.reduce(function(e,t){return"".concat(e," ").concat(t,'="').concat(S.xmlescape(n.attributes.getNamedItem(t).value),'"')},"<".concat(n.nodeName));if(0";for(var s=0;s"}}t+=""}else t+="/>";return t},_requestId:0,_connectionPlugins:{},addConnectionPlugin:function(e,t){S._connectionPlugins[e]=t},Builder:function(e,t){"presence"!==e&&"message"!==e&&"iq"!==e||(t&&!t.xmlns?t.xmlns=S.NS.CLIENT:t||(t={xmlns:S.NS.CLIENT})),this.nodeTree=S.xmlElement(e,t),this.node=this.nodeTree}};S.Builder.prototype={tree:function(){return this.nodeTree},toString:function(){return S.serialize(this.nodeTree)},up:function(){return this.node=this.node.parentNode,this},root:function(){return this.node=this.nodeTree,this},attrs:function(e){for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(void 0===e[t]?this.node.removeAttribute(t):this.node.setAttribute(t,e[t]));return this},c:function(e,t,n){var s=S.xmlElement(e,t,n);return this.node.appendChild(s),"string"!=typeof n&&"number"!=typeof n&&(this.node=s),this},cnode:function(e){var t,n=S.xmlGenerator();try{t=void 0!==n.importNode}catch(e){t=!1}var s=t?n.importNode(e,!0):S.copyElement(e);return this.node.appendChild(s),this.node=s,this},t:function(e){var t=S.xmlTextNode(e);return this.node.appendChild(t),this},h:function(e){var t=document.createElement("body");t.innerHTML=e;for(var n=S.createHtml(t);0e[n].prototype.priority&&(n=s);if(n!==t){var o=e[t];e[t]=e[n],e[n]=o}}return e},_attemptSASLAuth:function(e){e=this.sortMechanismsByPriority(e||[]);for(var t=!1,n=0;n>16)+(t>>16)+(n>>16)<<16|65535&n},s=function(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<>>32-a,n);var i,a},d=function(e,t,n,s,o,r,i){return a(t&n|~t&s,e,t,o,r,i)},h=function(e,t,n,s,o,r,i){return a(t&s|n&~s,e,t,o,r,i)},p=function(e,t,n,s,o,r,i){return a(t^n^s,e,t,o,r,i)},g=function(e,t,n,s,o,r,i){return a(n^(t|~s),e,t,o,r,i)},o=function(e,t){e[t>>5]|=128<>>9<<4)]=t;for(var n,s,o,r,i=1732584193,a=-271733879,c=-1732584194,u=271733878,l=0;l>2]>>s%4*8+4&15)+t.charAt(e[s>>2]>>s%4*8&15);return n}(o(s(e),8*e.length))},hash:function(e){return function(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}(o(s(e),8*e.length))}}},"./src/sha1.js":function(e,t,n){"use strict";function a(e,t){e[t>>5]|=128<<24-t%32,e[15+(t+64>>9<<4)]=t;var n,s,o,r,i,a,c,u,l,E=new Array(80),d=1732584193,h=-271733879,p=-1732584194,g=271733878,S=-1009589776;for(n=0;n>16)+(t>>16)+(n>>16)<<16|65535&n}function T(e,t){return e<>>32-t}function c(e){for(var t=[],n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<24-n%32;return t}function o(e){for(var t,n,s="",o=0;o<4*e.length;o+=3)for(t=(e[o>>2]>>8*(3-o%4)&255)<<16|(e[o+1>>2]>>8*(3-(o+1)%4)&255)<<8|e[o+2>>2]>>8*(3-(o+2)%4)&255,n=0;n<4;n++)8*o+6*n>32*e.length?s+="=":s+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t>>6*(3-n)&63);return s}function r(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>24-n%32&255);return t}n.r(t),n.d(t,"default",function(){return i});var i={b64_hmac_sha1:function(e,t){return o(s(e,t))},b64_sha1:function(e){return o(a(c(e),8*e.length))},binb2str:r,core_hmac_sha1:s,str_hmac_sha1:function(e,t){return r(s(e,t))},str_sha1:function(e){return r(a(c(e),8*e.length))}}},"./src/strophe.js":function(e,t,n){"use strict";n.r(t);n("./src/bosh.js"),n("./src/websocket.js");var s=n("./src/core.js");n.d(t,"default",function(){return s.default})},"./src/utils.js":function(e,t,n){"use strict";function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.r(t),n.d(t,"default",function(){return s});var s={utf16to8:function(e){var t,n,s="",o=e.length;for(t=0;t>12&15),s+=String.fromCharCode(128|n>>6&63)):s+=String.fromCharCode(192|n>>6&31),s+=String.fromCharCode(128|n>>0&63));return s},addCookies:function(e){for(var t in e=e||{})if(Object.prototype.hasOwnProperty.call(e,t)){var n="",s="",o="",r=e[t],i="object"===c(r),a=escape(unescape(i?r.value:r));i&&(n=r.expires?";expires="+r.expires:"",s=r.domain?";domain="+r.domain:"",o=r.path?";path="+r.path:""),document.cookie=t+"="+a+n+s+o}}}},"./src/websocket.js":function(e,t,n){"use strict";n.r(t);var s=n("./src/core.js"),u=s.default.Strophe,o=s.default.$build;u.Websocket=function(e){this._conn=e,this.strip="wrapper";var t=e.service;if(0!==t.indexOf("ws:")&&0!==t.indexOf("wss:")){var n="";"ws"===e.options.protocol&&"https:"!==window.location.protocol?n+="ws":n+="wss",n+="://"+window.location.host,0!==t.indexOf("/")?n+=window.location.pathname+t:n+=t,e.service=n}},u.Websocket.prototype={_buildStream:function(){return o("open",{xmlns:u.NS.FRAMING,to:this._conn.domain,version:"1.0"})},_check_streamerror:function(e,t){var n;if(0===(n=e.getElementsByTagNameNS?e.getElementsByTagNameNS(u.NS.STREAM,"error"):e.getElementsByTagName("stream:error")).length)return!1;for(var s=n[0],o="",r="",i=0;i: "+n);var s=e.getAttribute("version");return"string"!=typeof s?t="Missing version in ":"1.0"!==s&&(t="Wrong version in : "+s),!t||(this._conn._changeConnectStatus(u.Status.CONNFAIL,t),this._conn._doDisconnect(),!1)},_connect_cb_wrapper:function(e){if(0===e.data.indexOf("\s*)*/,"");if(""===t)return;var n=(new DOMParser).parseFromString(t,"text/xml").documentElement;this._conn.xmlInput(n),this._conn.rawInput(e.data),this._handleStreamStart(n)&&this._connect_cb(n)}else if(0===e.data.indexOf(" tag.")}}this._conn._doDisconnect()},_doDisconnect:function(){u.info("WebSockets _doDisconnect was called"),this._closeSocket()},_streamWrap:function(e){return""+e+""},_closeSocket:function(){if(this.socket)try{this.socket.onerror=null,this.socket.close()}catch(e){u.debug(e.message)}this.socket=null},_emptyQueue:function(){return!0},_onClose:function(e){this._conn.connected&&!this._conn.disconnecting?(u.error("Websocket closed unexpectedly"),this._conn._doDisconnect()):e&&1006===e.code&&!this._conn.connected&&this.socket?(u.error("Websocket closed unexcectedly"),this._conn._changeConnectStatus(u.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._conn._doDisconnect()):u.info("Websocket closed")},_no_auth_received:function(e){u.error("Server did not offer a supported authentication mechanism"),this._changeConnectStatus(u.Status.CONNFAIL,u.ErrorCondition.NO_AUTH_MECH),e&&e.call(this._conn),this._conn._doDisconnect()},_onDisconnectTimeout:function(){},_abortAllRequests:function(){},_onError:function(e){u.error("Websocket error "+e),this._conn._changeConnectStatus(u.Status.CONNFAIL,"The WebSocket connection could not be established or was disconnected."),this._disconnect()},_onIdle:function(){var e=this._conn._data;if(0i[0]&&t[1]"}},getFriends:{endpoint:"user/friends",method:"GET"},unfriend:{endpoint:"user/friends/{{uid}}/{{gid}}",method:"DELETE",data:{uids:"array"}},acceptFriendRequest:{endpoint:"user/friends/{{uid}}/accept",method:"PUT",data:{uids:"array"}},rejectFriendRequest:{endpoint:"user/friends/{{uid}}/reject",method:"DELETE",data:{uids:"array"}},createGroup:{endpoint:"groups",method:"POST",data:{guid:"required|string|max:100",name:"required|string|max:100",type:"enum|public,protected,password",password:"filled|string|max:100"}},getGroups:{endpoint:"groups",method:"GET"},getGroup:{endpoint:"groups/{{guid}}",method:"GET"},updateGroup:{endpoint:"groups/{{guid}}",method:"PUT"},deleteGroup:{endpoint:"groups/{{guid}}",method:"DELETE"},addGroupMembers:{endpoint:"groups/{{guid}}/members",method:"POST",data:{uids:"array"}},getGroupMembers:{endpoint:"groups/{{guid}}/members",method:"GET"},joinGroup:{endpoint:"groups/{{guid}}/members",method:"POST"},leaveGroup:{endpoint:"groups/{{guid}}/members",method:"DELETE"},kickGroupMembers:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"DELETE",data:{uids:"array"}},changeScopeOfMember:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"PUT",data:{uids:"array"}},banGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"POST",data:{uids:"array"}},unbanGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"DELETE",data:{uids:"array"}},addMemebersToGroup:{endpoint:"groups/{{guid}}/members",method:"PUT"},getBannedGroupMembers:{endpoint:"groups/{{guid}}/bannedusers",method:"GET"},promotemoteGroupMember:{endpoint:"groups/{{guid}}/promote",method:"PUT",data:{uids:"array"}},demoteGroupMember:{endpoint:"groups/{{guid}}/demote",method:"DELETE",data:{uids:"array"}},transferOwnership:{endpoint:"groups/{{guid}}/owner",method:"PATCH"},sendMessage:{endpoint:"messages",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},sendMessageInThread:{endpoint:"messages/{{parentId}}/thread",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},getMessages:{endpoint:"messages",method:"GET"},getMessageDetails:{endpoint:"messages/{{messageId}}",method:"GET"},getUserMessages:{endpoint:"users/{{listId}}/messages",method:"GET"},getGroupMessages:{endpoint:"groups/{{listId}}/messages",method:"GET"},getThreadMessages:{endpoint:"messages/{{listId}}/thread",method:"GET"},getMessage:{endpoint:"user/messages/{{muid}}",method:"GET"},updateMessage:{endpoint:"messages/{{messageId}}",method:"PUT"},deleteMessage:{endpoint:"messages/{{messageId}}",method:"DELETE"},createCallSession:{endpoint:"calls",method:"POST",data:{}},updateCallSession:{endpoint:"calls/{{sessionid}}",method:"put",data:{}},getConversations:{endpoint:"conversations",method:"GET"}}}return r.prototype.getEndpointData=function(o){return new Promise(function(s,t){try{c.LocalStorage.getInstance().get(a.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(i.isFalsy(e)){var t={};if((new r).uriEndpoints.hasOwnProperty(o))if((t=(new r).uriEndpoints[o]).hasOwnProperty("isAdminApi")){var n=i.format((new r).adminApiUrl,u.CometChat.appSettings.getRegion())+(new r).adminApiVersion+"/"+t.endpoint;t.endpoint=n}else{n=i.format((new r).baseUrl,u.CometChat.appSettings.getRegion())+(new r).apiVersion+"/"+t.endpoint;t.endpoint=n}s(t)}else{t={};if((new r).uriEndpoints.hasOwnProperty(o))if((t=(new r).uriEndpoints[o]).hasOwnProperty("isAdminApi"))t.endpoint="https://"+e[a.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+(new r).adminApiVersion+"/"+t.endpoint;else{n="https://"+e[a.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+(new r).apiVersion+"/"+t.endpoint;t.endpoint=n}s(t)}},function(e){var t;(new r).uriEndpoints.hasOwnProperty(o)&&((t=(new r).uriEndpoints[o]).hasOwnProperty(["isAdminApi"])?t.endpoint=i.format((new r).adminApiUrl,u.CometChat.appSettings.getRegion())+(new r).adminApiVersion+"/"+t.endpoint:t.endpoint=i.format((new r).baseUrl,u.CometChat.appSettings.getRegion())+(new r).apiVersion+"/"+t.endpoint),s(t)})}catch(e){t(new l.CometChatException(e))}})},r}();t.EndpointFactory=s},function(e,t,n){"use strict";t.__esModule=!0;var s=n(29),i=n(2);t.getEndPoint=function(e,r){void 0===e&&(e=""),void 0===r&&(r={});var t=new s.EndpointFactory;return new Promise(function(s,o){try{t.getEndpointData(e).then(function(e){var t=e;if(t){for(var n in r)t.endpoint=t.endpoint.replace("{{"+n+"}}",r[n]);s(t)}else o({error:"Unknown endPoint name."})})}catch(e){o(new i.CometChatException(e))}})}},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,s=arguments.length;ne.getId()&&(i=parseInt(e.getId().toString())),s=1e3*o.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&delete n.TYPING_STARTED_MAP[e]})}),new Promise(function(e,t){Object.keys(n.TYPING_ENDED_MAP).map(function(e){s.getCurrentTime()-n.TYPING_ENDED_MAP[e]>=1e3*o.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&delete n.TYPING_ENDED_MAP[e]})}),new Promise(function(e,t){Object.keys(n.INCOMING_TYPING_STARTED_MAP).map(function(e){s.getCurrentTime()-n.INCOMING_TYPING_STARTED_MAP[e][o.TYPING_NOTIFICATION.KEYS.TIMESTAMP]>=1e3*o.DEFAULT_VALUES.DEFAULT_MAX_TYPING_INDICATOR_LIMIT&&(r.XMPPConnectionHelper.getInstance().publishTypinStatusNotification(n.INCOMING_TYPING_STARTED_MAP[e][o.TYPING_NOTIFICATION.KEYS.TYPING_NOTIFICATION],o.TYPING_NOTIFICATION.ACTIONS.ENDED),delete n.INCOMING_TYPING_STARTED_MAP[e])})})},e.TYPING_STARTED_MAP={},e.TYPING_ENDED_MAP={},e.INCOMING_TYPING_STARTED_MAP={},e}();t.TypingNotificationController=i},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(r,i,a,c){return new(a||(a=Promise))(function(e,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function s(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(n,s)}o((c=c.apply(r,i||[])).next())})},o=this&&this.__generator||function(n,s){var o,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function w(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(w(e,t))return!0}while(e=e.nextSibling)}function Y(){}function G(e,t,n,s){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function b(e,t,n){if(e&&e._inc){e._inc++;var s=t.childNodes;if(n)s[s.length++]=n;else{for(var o=t.firstChild,r=0;o;)o=(s[r++]=o).nextSibling;s.length=r}}}function x(e,t){var n=t.previousSibling,s=t.nextSibling;return n?n.nextSibling=s:e.firstChild=s,s?s.previousSibling=n:e.lastChild=n,b(e.ownerDocument,e),t}function F(e,t,n){var s=t.parentNode;if(s&&s.removeChild(t),t.nodeType===P){var o=t.firstChild;if(null==o)return t;var r=t.lastChild}else o=r=t;var i=n?n.previousSibling:e.lastChild;for(o.previousSibling=i,r.nextSibling=n,i?i.nextSibling=o:e.firstChild=o,null==n?e.lastChild=r:n.previousSibling=r;o.parentNode=e,o!==r&&(o=o.nextSibling););return b(e.ownerDocument||e,e),t.nodeType==P&&(t.firstChild=t.lastChild=null),t}function K(){this._nsMap={}}function B(){}function H(){}function J(){}function k(){}function V(){}function X(){}function j(){}function q(){}function W(){}function $(){}function Q(){}function z(){}function Z(e,t){var n=[],s=9==this.nodeType?this.documentElement:this,o=s.prefix,r=s.namespaceURI;if(r&&null==o&&null==(o=s.lookupPrefix(r)))var i=[{namespace:r,prefix:null}];return te(this,n,e,t,i),n.join("")}function ee(e,t,n){var s=e.prefix||"",o=e.namespaceURI;if(!s&&!o)return!1;if("xml"===s&&"http://www.w3.org/XML/1998/namespace"===o||"http://www.w3.org/2000/xmlns/"==o)return!1;for(var r=n.length;r--;){var i=n[r];if(i.prefix==s)return i.namespace!=o}return!0}function te(e,t,n,s,o){if(s){if(!(e=s(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case _:o||(o=[]);o.length;var r=e.attributes,i=r.length,a=e.firstChild,c=e.tagName;n=C===e.namespaceURI||n,t.push("<",c);for(var u=0;u"),n&&/^script$/i.test(c))for(;a;)a.data?t.push(a.data):te(a,t,n,s,o),a=a.nextSibling;else for(;a;)te(a,t,n,s,o),a=a.nextSibling;t.push("")}else t.push("/>");return;case N:case P:for(a=e.firstChild;a;)te(a,t,n,s,o),a=a.nextSibling;return;case T:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,D),'"');case f:return t.push(e.data.replace(/[<&]/g,D));case A:return t.push("");case R:return t.push("\x3c!--",e.data,"--\x3e");case O:var p=e.publicId,g=e.systemId;if(t.push("');else if(g&&"."!=g)t.push(' SYSTEM "',g,'">');else{var S=e.internalSubset;S&&t.push(" [",S,"]"),t.push(">")}return;case I:return t.push("");case m:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function ne(e,t,n){e[t]=n}d.prototype=Error.prototype,r(a,d),h.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],s=0;si[0]&&t[1]t._resendCount)return;t._msgQueue[e].tree().setAttribute("from",t._conn.jid),t._conn.send(t._msgQueue[e]),t.resendMessage(e)}},this._resendTime)},addReceiptHandler:function(t,e,n,s){var o=this;this._conn.addHandler(function(e){return o._processReceipt(e),t(e)},p.Strophe.NS.RECEIPTS,"message",e,null,n,s)},_processReceipt:function(h,e){return void 0===e&&(e=0),n(this,void 0,void 0,function(){var r,i,a,c,u,l,t,n,E,s,o,d=this;return g(this,function(e){if(T.CometChat.getConnectionStatus()==C.CONNECTION_STATUS.CONNECTED){r=h.getAttribute(C.DELIVERY_RECEIPTS.ID),i=p.Strophe.getBareJidFromJid(h.getAttribute(C.MessageConstatnts.XMPP_KEYS.FROM)),a=S.getUidFromJid(i),c=C.MessageConstatnts.XMPP_KEYS.TYPE_USER,u=C.MessageConstatnts.RECEIVER_TYPE.USER,l=h.getElementsByTagName("request"),t=h.getElementsByTagName("received");try{n=h.getElementsByTagName("body")[0].innerHTML}catch(e){E=n=void 0}void 0!==n&&(E=JSON.parse(n).receiverType),s=T.CometChat.getMode(),(_.isFalsy(s)||s&&s===C.APP_SETTINGS.KEYS.DEFAULT_MODE)&&T.CometChat.getLoggedinUser().then(function(e){var t=new f.User(e);t.setAuthToken("");var n=JSON.stringify(t);if(h.getAttribute(C.MessageConstatnts.XMPP_KEYS.TYPE)==C.MessageConstatnts.XMPP_KEYS.TYPE_GROUP||void 0!==E&&E==C.MessageConstatnts.RECEIVER_TYPE.GROUP){if(u=C.MessageConstatnts.RECEIVER_TYPE.GROUP,i=S.getGroupJidFullGroupJid(h.getAttribute(C.MessageConstatnts.XMPP_KEYS.FROM)),c=C.MessageConstatnts.XMPP_KEYS.TYPE_GROUP,0a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)return new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0l.DEFAULT_VALUES.USERS_MAX_LIMIT)return new c.CometChatException(JSON.parse(i.format(JSON.stringify(l.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",l.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0u.DEFAULT_VALUES.USERS_MAX_LIMIT)return new c.CometChatException(JSON.parse(i.format(JSON.stringify(u.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",u.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},o.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT?new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT))):this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e}();t.ConversationsRequest=c;var u=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setConversationType=function(e){return this.conversationType=e,this},e.prototype.build=function(){return new c(this)},e}();t.ConversationsRequestBuilder=u},function(e,t,n){"use strict";var s=this&&this.__awaiter||function(r,i,a,c){return new(a||(a=Promise))(function(e,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function s(e){try{o(c.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(n,s)}o((c=c.apply(r,i||[])).next())})},a=this&&this.__generator||function(n,s){var o,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]f.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void t(new S.CometChatException(JSON.parse(T.format(JSON.stringify(f.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",f.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(re&&R.MessageListnerMaping.getInstance().set(f.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(l.id))},function(e){R.MessageListnerMaping.getInstance().set(f.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(l.id))}),g.affix==f.MessageConstatnts.PAGINATION.AFFIX.APPEND?(g.idparseInt(l.id)&&(g.id=parseInt(l.id)),g.timestamp>l.sentAt&&(g.timestamp=l.sentAt),g.updatedAt>l.updatedAt&&(g.updatedAt=l.updatedAt)),g.id&&(g.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.ID]=g.id),g.timestamp&&(g.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=g.timestamp),g.updatedAt&&(g.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=g.updatedAt),t.push(_.MessageController.trasformJSONMessge(l))})}else t=[];s(t)},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},e.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[f.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(T.isFalsy(this.guid)||T.isFalsy(this.uid))&&T.isFalsy(this.guid)?(T.isFalsy(this.uid)?this.endpointName="getMessages":this.endpointName="getUserMessages",this.listId=this.uid):(this.endpointName="getGroupMessages",this.listId=this.guid)},e.prototype.makeData=function(){var e={};e[f.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,e[f.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(T.isFalsy(this.guid)||T.isFalsy(this.uid))&&T.isFalsy(this.guid)&&T.isFalsy(this.uid)},e.prototype.getFilteredPreviousDataByReceiverId=function(t){return s(this,void 0,void 0,function(){var n,s=this;return a(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,o.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).filter(function(e){return t[e].sender.uid==s.uid}).map(function(e){n=n.concat([t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,o.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e.prototype.getFilteredNextDataByReceiverId=function(t){return s(this,void 0,void 0,function(){var n,s=this;return a(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,o.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,o.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).filter(function(e){return t[e].sender.uid==s.uid}).map(function(e){n=n.concat([t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,o.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>s.id}).map(function(e){n=n.concat([t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e}();t.DefaultMessagesRequest=r;var i=function(){function e(){this.maxLimit=f.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=f.DEFAULT_VALUES.DEFAULT_MSG_ID,this.unread=!1,this.HideMessagesFromBlockedUsers=!1,this.onlyUpdate=0}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setGUID=function(e){return this.guid=e,this},e.prototype.setUID=function(e){return this.uid=e,this},e.prototype.setParentMessageId=function(e){return this.parentMessageId=e,this},e.prototype.setTimestamp=function(e){return void 0===e&&(e=T.getCurrentTime()),this.timestamp=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=f.DEFAULT_VALUES.DEFAULT_MSG_ID),this.id=e,this},e.prototype.setUnread=function(e){return void 0===e&&(e=!1),this.unread=e,this},e.prototype.hideMessagesFromBlockedUsers=function(e){return void 0===e&&(e=!1),this.HideMessagesFromBlockedUsers=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKey=e,this},e.prototype.setUpdatedAfter=function(e){return this.updatedAt=e,this},e.prototype.updatesOnly=function(e){return e&&(this.onlyUpdate=1),this},e.prototype.setCategory=function(e){return this.category=e,this},e.prototype.setCategories=function(e){return this.categories=e,this},e.prototype.setType=function(e){return this.type=e,this},e.prototype.setTypes=function(e){return this.types=e,this},e.prototype.hideReplies=function(e){return this.HideReplies=e,this},e.prototype.build=function(){return this.category&&this.categories&&this.categories.push(this.category),this.type&&this.types&&this.types.push(this.type),new r(this)},e}();t.DefaultMessagesRequestBuilder=i},function(e,t,n){"use strict";t.__esModule=!0;var s=function(e){};t.CometChatExtension=s},function(e,t,n){"use strict";t.__esModule=!0;var o=n(5),s=n(1),r=n(8),i=n(2),a=n(0),c=function(){function e(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},s.isFalsy(e)||(this.limit=e.limit,s.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),s.isFalsy(e.direction)||(this.direction=e.direction))}return e.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limitthis.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.getPreData=function(){var e={};return e.per_page=this.limit,0<=this.next_page&&0>>((3&t)<<3)&255;return o}}},function(e,t){for(var o=[],n=0;n<256;++n)o[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,s=o;return[s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],"-",s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]],s[e[n++]]].join("")}},function(e,E,d){(function(r,i){var c;!function(e){var t=E,n=(r&&r.exports,"object"==typeof i&&i);n.global!==n&&n.window;var s=function(e){this.message=e};(s.prototype=new Error).name="InvalidCharacterError";var u=function(e){throw new s(e)},l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=/[\t\n\f\r ]/g,o={encode:function(e){e=String(e),/[^\0-\xFF]/.test(e)&&u("The string to be encoded contains characters outside of the Latin1 range.");for(var t,n,s,o,r=e.length%3,i="",a=-1,c=e.length-r;++a>18&63)+l.charAt(o>>12&63)+l.charAt(o>>6&63)+l.charAt(63&o);return 2==r?(t=e.charCodeAt(a)<<8,n=e.charCodeAt(++a),i+=l.charAt((o=t+n)>>10)+l.charAt(o>>4&63)+l.charAt(o<<2&63)+"="):1==r&&(o=e.charCodeAt(a),i+=l.charAt(o>>2)+l.charAt(o<<4&63)+"=="),i},decode:function(e){var t=(e=String(e).replace(a,"")).length;t%4==0&&(t=(e=e.replace(/==?$/,"")).length),(t%4==1||/[^+a-zA-Z0-9/]/.test(e))&&u("Invalid character: the string to be decoded is not correctly encoded.");for(var n,s,o=0,r="",i=-1;++i>(-2*o&6)));return r},version:"0.1.0"};void 0===(c=function(){return o}.call(E,d,E,r))||(r.exports=c)}()}).call(this,d(69)(e),d(28))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";t.__esModule=!0;var s=n(1),o=function(){function e(e){this.id="",this.name="",e&&(s.isFalsy(e.id)||(this.id=e.id),s.isFalsy(e.name)||(this.name=e.name))}return e.prototype.getId=function(){return this.id},e.prototype.getName=function(){return this.name},e}();t.CCExtension=o},function(e,t,n){function s(e){this.options=e||{locator:{}}}function u(){this.cdata=!1}function l(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function E(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function o(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function d(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}s.prototype.parseFromString=function(e,t){var n=this.options,s=new h,o=n.domBuilder||new u,r=n.errorHandler,i=n.locator,a=n.xmlns||{},c={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return i&&o.setDocumentLocator(i),s.errorHandler=function(s,e,o){if(!s){if(e instanceof u)return e;s=e}var r={},i=s instanceof Function;function t(t){var n=s[t];!n&&i&&(n=2==s.length?function(e){s(t,e)}:s),r[t]=n&&function(e){n("[xmldom "+t+"]\t"+e+E(o))}||function(){}}return o=o||{},t("warning"),t("error"),t("fatalError"),r}(r,o,i),s.domBuilder=n.domBuilder||o,/\/x?html?$/.test(t)&&(c.nbsp=" ",c.copy="©",a[""]="http://www.w3.org/1999/xhtml"),a.xml=a.xml||"http://www.w3.org/XML/1998/namespace",e?s.parse(e,a,c):s.errorHandler.error("invalid doc source"),o.doc},u.prototype={startDocument:function(){this.doc=(new r).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,s){var o=this.doc,r=o.createElementNS(e,n||t),i=s.length;d(this,r),this.currentElement=r,this.locator&&l(this.locator,r);for(var a=0;a":switch(c){case E:n.setTagName(e.slice(t,a));case S:case C:case _:break;case g:case d:"/"===(l=e.slice(t,a)).slice(-1)&&(n.closed=!0,l=l.slice(0,-1));case h:c===h&&(l=i),c==g?(r.warning('attribute "'+l+'" missed quot(")!!'),n.add(i,l.replace(/&#?\w+;/g,o),t)):("http://www.w3.org/1999/xhtml"===s[""]&&l.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),n.add(l,l,t));break;case p:throw new Error("attribute value missed!!")}return a;case"€":u=" ";default:if(u<=" ")switch(c){case E:n.setTagName(e.slice(t,a)),c=C;break;case d:i=e.slice(t,a),c=h;break;case g:var l=e.slice(t,a).replace(/&#?\w+;/g,o);r.warning('attribute "'+l+'" missed quot(")!!'),n.add(i,l,t);case S:c=C}else switch(c){case h:n.tagName;"http://www.w3.org/1999/xhtml"===s[""]&&i.match(/^(?:disabled|checked|selected)$/i)||r.warning('attribute "'+i+'" missed value!! "'+i+'" instead2!!'),n.add(i,i,t),t=a,c=d;break;case S:r.warning('attribute space is required"'+i+'"!!');case C:c=d,t=a;break;case p:c=g,t=a;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}a++}}function D(e,t,n){for(var s=e.tagName,o=null,r=e.length;r--;){var i=e[r],a=i.qName,c=i.value;if(0<(d=a.indexOf(":")))var u=i.prefix=a.slice(0,d),l=a.slice(d+1),E="xmlns"===u&&l;else u=null,E="xmlns"===(l=a)&&"";i.localName=l,!1!==E&&(null==o&&(o={},T(n,n={})),n[E]=o[E]=c,i.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(E,c))}for(r=e.length;r--;){(u=(i=e[r]).prefix)&&("xml"===u&&(i.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==u&&(i.uri=n[u||""]))}var d=s.indexOf(":");l=e.localName=0",t),i=e.substring(t+1,r);if(/[&<]/.test(i))return/^script$/i.test(n)||(i=i.replace(/&#?\w+;/g,s)),o.characters(i,0,i.length),r}return t+1}function Y(e,t,n,s){var o=s[n];return null==o&&((o=e.lastIndexOf(""))",t+9);return n.startCDATA(),n.characters(e,t+9,o-t-9),n.endCDATA(),o+3}var r=function(e,t){var n,s=[],o=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;o.lastIndex=t,o.exec(e);for(;n=o.exec(e);)if(s.push(n),n[1])return s}(e,t),i=r.length;if(1",t);if(s){var o=e.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(o){o[0].length;return n.processingInstruction(o[1],o[2]),s+2}return-1}return-1}function x(e){}function i(e,t){return e.__proto__=t,e}r.prototype={parse:function(e,t,n){var s=this.domBuilder;s.startDocument(),T(t,t={}),function(n,e,s,o,r){function i(e){var t=e.slice(1,-1);return t in s?s[t]:"#"===t.charAt(0)?function(e){{if(65535>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}}(parseInt(t.substr(1).replace("x","0x"))):(r.error("entity not found:"+e),e)}function t(e){if(p",g+3),T=n.substring(g+2,_),f=d.pop();_<0?(T=n.substring(g+2).replace(/[\s<].*/,""),r.error("end tag name: "+T+" is not complete:"+f.tagName),_=g+1+T.length):T.match(/\s + ![GitHub repo size](https://img.shields.io/github/repo-size/cometchat-pro/react-native-chat-sdk) ![GitHub contributors](https://img.shields.io/github/contributors/cometchat-pro/react-native-chat-sdk) ![GitHub stars](https://img.shields.io/github/stars/cometchat-pro/react-native-chat-sdk?style=social) @@ -79,7 +79,7 @@ To setup React Native SDK, you need to first register on CometChat Dashboard. [ 1. Run the following command to install the CometChat Pro React Native SDK
```javascript - npm install @cometchat-pro/react-native-chat@2.2.1 --save + npm install @cometchat-pro/react-native-chat@2.3.0 --save ``` You can refer to the below link for instructions on how to do so:
diff --git a/package.json b/package.json index 9d447e6..c7ed64f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cometchat-pro/react-native-chat", - "version": "2.2.1", + "version": "2.3.0", "description": "A complete chat solution.", "main": "CometChat.js", "scripts": {