UNPKG

@cometchat/chat-sdk-javascript

Version:
1 lines 441 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,function(){return function(n){var o={};function s(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,s),t.l=!0,t.exports}return s.m=n,s.c=o,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)s.d(n,o,function(e){return t[e]}.bind(null,o));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=35)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateQuestion=t.updatePropertiesWithDynamicValue=t.validateConversationType=t.validateUpdateUser=t.validateCreateUser=t.validateMessage=t.validateChatType=t.validateMsgId=t.validateArray=t.validateHideMessagesFromBlockedUsers=t.validateId=t.validateCreateGroup=t.validateJoinGroup=t.validateUpdateGroup=t.validateScope=t.isAudio=t.isVideo=t.isImage=t.getUpdatedSettings=t.getAppSettings=t.getCurrentTime=t.Logger=t.createUidFromJid=t.format=t.getOrdinalSuffix=t.isFalsy=t.isTruthy=t.isObject=t.getJidHost=t.getChatHost=void 0;var o=n(15),i=n(1),s=n(6),a=n(2),E=n(18),c=n(20),u=n(22),r=n(5),S=n(10),p=n(23);function C(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 l(e){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return e.split("%s").reduce(function(e,t,n){return e+t+(o[n]||"")},"")}t.getChatHost=function(e){return e[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?e[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:e[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?e[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:e[i.APP_SETTINGS.KEYS.CHAT_HOST]},t.getJidHost=function(e){return e[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?e[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:e[i.APP_SETTINGS.KEYS.CHAT_HOST]},t.isObject=function(e){return e instanceof Object&&e.constructor===Object},t.isTruthy=function(e){return[!0,1,"1","true","TRUE"].includes(e)},t.isFalsy=C,t.getOrdinalSuffix=function(e){var t=e%10,n=e%100;return 1==t&&11!=n?e+"st":2==t&&12!=n?e+"nd":3==t&&13!=n?e+"rd":e+"th"},t.format=l,t.createUidFromJid=function(e){return e.substring(e.lastIndexOf("]")+1,e.lastIndexOf("@"))};var _=function(){function e(){}return e.log=function(e,t){},e.error=function(e,t){},e.info=function(e,t){},e}();function d(){return new Promise(function(t,n){s.makeApiCall("appSettings").then(function(e){o.LocalStorage.getInstance().set(i.LOCAL_STORE.KEY_APP_SETTINGS,e.data),e.data.MODE&&r.CometChat.setMode(e.data.MODE),t(e.data)},function(e){n(new a.CometChatException(e.error))})})}t.Logger=_,t.getCurrentTime=function(){return(new Date).getTime()},t.getAppSettings=function(){return new Promise(function(t,n){o.LocalStorage.getInstance().get(i.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){C(e)?d().then(function(e){t(e)},function(e){n(e)}):t(e)},function(e){n(e)})})},t.getUpdatedSettings=d,t.isImage=function(e){var t;return e.type&&e.type.toLowerCase().includes("image")&&(t=!0),t},t.isVideo=function(e){var t;return e.type&&e.type.toLowerCase().includes("video")&&(t=!0),t},t.isAudio=function(e){var t;return e.type&&e.type.toLowerCase().includes("audio")&&(t=!0),t},t.validateScope=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):e!=r.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&e!=r.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&e!=r.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new a.CometChatException(i.GroupErrors.INVALID_SCOPE):void 0},t.validateUpdateGroup=function(e){return e.hasOwnProperty(i.GroupConstants.KEYS.GUID)?typeof e[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):C(e[i.GroupConstants.KEYS.GUID])?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):e.hasOwnProperty(i.GroupConstants.KEYS.NAME)&&""===e[i.GroupConstants.KEYS.NAME]?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},t.validateJoinGroup=function(e,t,n){if(typeof e==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!e.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(C(e[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(C(e[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(C(t))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t.toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&t.toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&t.toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&t.toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t.toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(C(n))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},t.validateCreateGroup=function(e){if(!e.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(i.GroupConstants.KEYS.NAME))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof e[i.GroupConstants.KEYS.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(C(e[i.GroupConstants.KEYS.NAME]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!e.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(C(e[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(C(e[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(e.hasOwnProperty(i.GroupConstants.KEYS.TAGS)){if(!Array.isArray(e[i.GroupConstants.KEYS.TAGS]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===e[i.GroupConstants.KEYS.TAGS].length)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},t.validateId=function(e,t){if("user"===t){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===t){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}if("bot"===t){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"BOT_ID","BOT_ID","BOT_ID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"BOT_ID","BOT_ID","BOT_ID","BOT_ID")))}},t.validateHideMessagesFromBlockedUsers=function(e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},t.validateArray=function(e,t){var n="List should be an array.";return n="blockUsers"===t?"blockUsers() method accepts an array of users.":"unblockUsers"===t?"unblockUsers() method accepts an array of users.":"groupMembers"===t?"addMembersToGroup() method accepts members list as an array of users.":"addMembersToGroup() method accepts bannedMembers list as an array of users.",typeof e!=i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(e)?void 0:new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},t.validateMsgId=function(e){return isNaN(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):C(e)?new a.CometChatException(S.ERRORS.PARAMETER_MISSING):void 0},t.validateChatType=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):e!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&e!=i.MessageConstatnts.RECEIVER_TYPE.USER?new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE):void 0},t.validateMessage=function(e){var t=e;if(typeof t.getReceiverId()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(C(t.getReceiverId()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof t.getReceiverType()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(C(t.getReceiverType()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(t.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&t.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.USER)return new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE);if(e instanceof E.TextMessage){var n=e;if(typeof n.getText()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")));if(""===n.getText().trim())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(e instanceof c.MediaMessage){var o=e;if(o.getData()&&o.getData().hasOwnProperty("attachments"))for(var s=o.getAttachments(),r=0;r<s.length;r++){if(!s[r].getExtension())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!s[r].getMimeType())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!s[r].getName())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!s[r].getUrl())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(o.hasOwnProperty("files"))for(r=0;r<o.files.length;r++)if(!(o.files[r]instanceof Blob))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}if(e instanceof u.CustomMessage&&C(e.getCustomData()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")));if(e instanceof p.InteractiveMessage&&C(e.getInteractiveData()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"INTERACTIVE_DATA","INTERACTIVE_DATA","interactive data","interactive data")))},t.validateCreateUser=function(e){if(!e.hasOwnProperty(i.UserConstants.UID))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof e[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(C(e[i.UserConstants.UID]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!e.hasOwnProperty(i.UserConstants.NAME))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof e[i.UserConstants.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(C(e[i.UserConstants.NAME]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(e.hasOwnProperty(i.UserConstants.AVATAR)&&""===e[i.UserConstants.AVATAR])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(e.hasOwnProperty(i.UserConstants.META_DATA)&&""===e[i.UserConstants.META_DATA])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(e.hasOwnProperty(i.UserConstants.LINK)&&""===e[i.UserConstants.LINK])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(e.hasOwnProperty(i.UserConstants.STATUS_MESSAGE)&&""===e[i.UserConstants.STATUS_MESSAGE])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(e.hasOwnProperty(i.UserConstants.ROLE)&&""===e[i.UserConstants.ROLE])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(e.hasOwnProperty(i.UserConstants.TAGS)){if(!Array.isArray(e[i.UserConstants.TAGS]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===e[i.UserConstants.TAGS].length)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},t.validateUpdateUser=function(e){return e.hasOwnProperty(i.UserConstants.UID)?typeof e[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):C(e[i.UserConstants.UID])?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):e.hasOwnProperty(i.UserConstants.NAME)&&""===e[i.UserConstants.NAME]?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},t.validateConversationType=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(e=e.toLowerCase())!=r.CometChat.RECEIVER_TYPE.USER&&e!=r.CometChat.RECEIVER_TYPE.GROUP?new a.CometChatException(i.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},t.updatePropertiesWithDynamicValue=function(e,o,s){return function e(t){for(var n in t)t.hasOwnProperty(n)&&("object"==typeof t[n]?e(t[n]):"string"==typeof t[n]&&t[n].includes(o)&&!t[n].includes(i.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY)&&(t[n]+=s))}(e),e},t.validateQuestion=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"QUESTION","QUESTION","Question"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"QUESTION","QUESTION","question","question"))):void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AI_SLUG_ENABLED=t.AI_SLUG_ACCESSIBLE=t.AI_FEATURE_ENABLED=t.AI_FEATURE_ACCESSIBLE=t.ADDITIONAL_CONSTANTS=t.ONLINE_MEMBER_COUNT_API=t.JWT_API=t.ProsodyApiErrors=t.PROSODY_API=t.API_ERROR_CODES=t.REACTION_ACTION=t.SESSION_STORE=t.CONNECTION_STATUS=t.COMMON_UTILITY_CONSTANTS=t.APP_SETTINGS=t.PresenceConstants=t.PresenceConstatnts=t.FeatureRestrictionErrors=t.MessageErrors=t.AIFeatureError=t.ExtensionErrors=t.AIErrors=t.ConversationErrors=t.GroupErrors=t.UserErrors=t.ReceiptErrors=t.GENERAL_ERROR=t.PARAMETER_ERROR=t.CALL_ERROR=t.Errors=t.UserConstants=t.GroupMemersConstans=t.GroupConstants=t.CallConstants=t.BlockedUsersConstants=t.ActionConstatnts=t.TYPING_NOTIFICATION=t.GoalType=t.MessageCategory=t.ATTACHMENTS_CONSTANTS=t.MessageConstatnts=t.READ_RECEIPTS=t.DELIVERY_RECEIPTS=t.ResponseConstants=t.LOCAL_STORE=t.ANALYTICS=t.WS=t.SDKHeader=t.APPINFO=t.GROUP_MEMBER_SCOPE=t.GroupMemberScope=t.GROUP_TYPE=t.GroupType=t.CALLING_COMPONENT_VERSION=t.DEFAULT_VALUES=t.constants=void 0;var o,s,r,i,a,E=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,REACTIONS_LIMIT:10,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",REACTIONS_MAX_LIMIT:20},t.CALLING_COMPONENT_VERSION=5,(o=t.GroupType||(t.GroupType={})).Public="public",o.Private="private",o.Protected="protected",o.Password="password",t.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(s=t.GroupMemberScope||(t.GroupMemberScope={})).Admin="admin",s.Moderator="moderator",s.Member="member",t.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},t.APPINFO={platform:"WEB",sdkVersion:"v4.0.11",apiVersion:"v3.0",sdkVersionWithUnderScore:"4_0_11"},t.SDKHeader={platform:"javascript",sdkVersion:"4.0.11",sdk:"%s@%s"},t.WS={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_SESSION_ID:"sessionId",KEY_MESSAGE_LISTENER_LIST:"all"},t.ResponseConstants={RESPONSE_KEYS:{KEY_DATA:"data",KEY_META:"meta",KEY_CURSOR:"cursor",KEY_NEXT:"next",KEY_PREVIOUS:"previous",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_REACTIONS:"reactions",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"},KEY_CONVERSATION_STARTER:"conversation-starter",KEY_SMART_REPLIES:"smart-replies",KEY_CONVERSATION_SUMMARY:"conversation-summary",KEY_BOT_REPLY:"bot-reply"}},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={TYPE:{TEXT:"text",MEDIA:"media",IMAGE:"image",VIDEO:"video",AUDIO:"audio",FILE:"file",CUSTOM:"custom"},CATEGORY:{MESSAGE:"message",ACTION:"action",CALL:"call",CUSTOM:"custom",INTERACTIVE:"interactive"},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",MENTIONS:"mentions",INTERACTIVE_DATA:"interactiveData",INTERACTION_GOAL:"interactionGoal",INTERACTIONS:"interactions",ALLOW_SENDER_INTERACTION:"allowSenderInteraction",ELEMENT_ID:"elementId",INTERACTED_AT:"interactedAt",ELEMENT_IDS:"elementIds"},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",HIDE_DELETED_MESSAGES:"hideDeleted",WITH_TAGS:"withTags",TAGS:"tags",MENTIONS_WITH_TAG_INFO:"mentionsWithTagInfo",MENTIONS_WITH_BLOCKED_INFO:"mentionsWithBlockedInfo",ONLY_INTERACTION_GOAL_COMPLETED:"onlyInteractionGoalCompleted"}}},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",r.INTERACTIVE="interactive",(i=t.GoalType||(t.GoalType={})).ANY_ACTION="anyAction",i.ANY_OF="anyOf",i.ALL_OF="allOf",i.NONE="none",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",TILE:"TILE",GRID:"GRID"},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"},AUDIO_INPUT_DEVICES:"audioInputDevices",AUDIO_OUTPUT_DEVICES:"audioOutputDevices",VIDEO_INPUT_DEVICES:"videoInputDevices",POST_MESSAGES:{TYPES:{ACTION_MESSAGE:"cometchat_action_message",HANGUP:"hangup",COMETCHAT_RTC_SETTINGS:"cometchat_rtc_settings"},ACTIONS:{USER_JOINED:"onUserJoined",USER_LEFT:"onUserLeft",USER_LIST_CHANGED:"onUserListChanged",INITIAL_DEVICE_LIST:"initialDeviceList",DEVICE_CHANGE:"onDeviceChange",LOAD:"LOAD",CHANGE_AUDIO_INPUT:"changeAudioInput",CHANGE_AUDIO_OUTPUT:"changeAudioOutput",CHANGE_VIDEO_INPUT:"changeVideoInput",MUTE_AUDIO:"muteAudio",UNMUTE_AUDIO:"unMuteAudio",PAUSE_VIDEO:"pauseVideo",UNPAUSE_VIDEO:"unPauseVideo",SWITCH_MODE:"switchMode",START_SCREENSHARE:"startScreenShare",STOP_SCREENSHARE:"stopScreenShare",END_CALL:"endCall",START_RECORDING:"startRecording",STOP_RECORDING:"stopRecording",RECORDING_TOGGLED:"onRecordingToggled",USER_MUTED:"onUserMuted",SCREEN_SHARE_STARTED:"SCREEN_SHARE_STARTED",SCREEN_SHARE_STOPPED:"SCREEN_SHARE_ENDED",SWITCH_TO_VIDEO_CALL:"switchedToVideo",SWITCHED_TO_VIDEO_CALL:"onCallSwitchedToVideo",OPEN_VIRTUAL_BACKGROUND:"openVirtualBackgroundMenu",SET_BACKGROUND_BLUR:"setBackgroundBlur",SET_BACKGROUND_IMAGE:"setBackgroundImage"}},MEDIA_DEVICE:{ID:"id",NAME:"name",ACTIVE:"active"},ZOOM_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},NAME_LABEL_DEFAULT_PARAMS:{position:"bottom-left",visible:!0,color:"rgba(27, 27, 27, 0.4)"},NETWORK_LABEL_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},MAIN_VIDEO_CONTAINER_SETTINGS:{KEYS:{POSITION:"position",VISIBILITY:"visible",COLOR:"color"}}},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",SORT_BY:{NAME:"name",STATUS:"status"},SORT_ORDER:{ASCENDING:"asc",DESCENDING:"desc"}},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"},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:"CALL_IN_PROGRESS",name:"CALL_IN_PROGRESS",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:{}},CALL_SETTINGS_REQUIRED:{code:"CALL_SETTINGS_REQUIRED",name:"CALL_SETTINGS_REQUIRED",message:"Please make sure you are passing the call settings object.",details:{}},JWT_NOT_FOUND:{code:"JWT_NOT_FOUND",name:"JWT_NOT_FOUND",message:"There was some issue while fetching JWT from API.",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.ReceiptErrors={MISSING_PARAMETERS:{code:"MISSING_PARAMETERS",name:"MISSING_PARAMETERS",message:"Expected 4 parameters received 3",details:{}},INVALID_PARAMETER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}},NO_WEBSOCKET_CONNECTION:{code:"NO_WEBSOCKET_CONNECTION",name:"NO_WEBSOCKET_CONNECTION",message:"Connection to our Websockets server is broken. Please retry after some time.",details:{}},RECEIPTS_TEMPORARILY_BLOCKED:{code:"RECEIPTS_TEMPORARILY_BLOCKED",name:"RECEIPTS_TEMPORARILY_BLOCKED",message:"Due to high load. Receipts have been blocked for your app.",details:{}},UNKNOWN_ERROR_OCCURRED:{code:"UNKNOWN_ERROR_OCCURRED",name:"UNKNOWN_ERROR_OCCURRED",message:"Unknown error occurred while marking a message as read.",details:{}}},t.UserErrors={INVALID_STATUS:new E.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new E.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 E.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 E.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new E.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new E.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.AIErrors={NO_CONVERSATION_STARTER:{code:"NO_CONVERSATION_STARTER",name:"NO_CONVERSATION_STARTER",message:"Unable to get conversation starter for this conversation.",details:""},NO_SMART_REPLY:{code:"NO_SMART_REPLY",name:"NO_SMART_REPLY",message:"Unable to get smart reply for this conversation.",details:""},NO_CONVERSATION_SUMMARY:{code:"NO_CONVERSATION_SUMMARY",name:"NO_CONVERSATION_SUMMARY",message:"Unable to get summary of the conversation.",details:""},NO_ASSISTANCE:{code:"EMPTY_RESPONSE",name:"EMPTY_RESPONSE",message:"Unable to get a suggestion.",details:""}},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.AIFeatureError={INVALID_AI_FEATURE:{code:"ERROR_INVALID_AI_FEATURE",name:"ERROR_INVALID_AI_FEATURE",message:"The provided AI Feature cannot be null or empty. Please provide a valid AI Feature.",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={STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},t.PresenceConstants={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",CONNECTION_TYPE:"connection_type",DEFAULT_MODE:"DEFAULT",LIMITED_TRANSIENT:"LIMITED_TRANSIENT",NO_TRANSIENT:"NO_TRANSIENT",POLLING_ENABLED:"POLLING_ENABLED",POLLING_INTERVAL:"POLLING_INTERVAL",ANALYTICS_PING_DISABLED:"ANALYTICS_PING_DISABLED",ANALYTICS_HOST:"ANALYTICS_HOST",ANALYTICS_VERSION:"ANALYTICS_VERSION",ANALYTICS_USE_SSL:"ANALYTICS_USE_SSL",SETTINGS_HASH:"settingsHash",SETTINGS_HASH_RECEIVED_AT:"settingsHashReceivedAt",DENY_FALLBACK_TO_POLLING:"DENY_FALLBACK_TO_POLLING",APP_VERSION:"APP_VERSION",MAIN_DOMAIN:"MAIN_DOMAIN",CHAT_API_VERSION:"CHAT_API_VERSION",WS_API_VERSION:"WS_API_VERSION",REGION:"REGION",EXTENSION_DOMAIN:"EXTENSION_DOMAIN",WEBRTC_API_SUBDOMAIN:"WEBRTC_API_SUBDOMAIN",WEBRTC_WEB_FRONTEND_HOST:"WEBRTC_WEB_FRONTEND_HOST",WEBRTC_WEB_FRONTEND_VERSION:"WEBRTC_WEB_FRONTEND_VERSION",SECURED_MEDIA_HOST:"SECURED_MEDIA_HOST",PARAMETERS:"parameters",CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES:"core.conversations.updateOnCallActivity",CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS:"core.conversations.updateOnGroupActions",CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES:"core.conversations.updateOnCustomMessage",CORE_CONVERSATIONS_UPDATE_ON_REPLIES:"core.conversations.updateOnReplies"}},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"},t.SESSION_STORE={SESSION_ID:"sessionId"},(a=t.REACTION_ACTION||(t.REACTION_ACTION={})).REACTION_ADDED="message_reaction_added",a.REACTION_REMOVED="message_reaction_removed",t.API_ERROR_CODES={AUTH_ERR_AUTH_TOKEN_NOT_FOUND:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND"},t.PROSODY_API={DOMAIN_PREFIX:"xmpp",PATH:{ROOM:"room",ROOM_SIZE:"room-size",SESSIONS:"sessions"},RESPONSE:{PARTICIPANTS:"participants"},QUERY_PARAMETERS:{DOMAIN:"domain",ROOM:"room"}},t.ProsodyApiErrors={INVALID_SESSIONID:{code:"ERROR_INVALID_SESSIONID",name:"ERROR_INVALID_SESSIONID",message:"The provided sessionId cannot be null or empty. Please provide a valid sessionId.",details:""},INVALID_TYPE:{code:"ERROR_INVALID_TYPE",name:"ERROR_INVALID_TYPE",message:"The provided type cannot be null or empty. Please provide a valid type.",details:""}},t.JWT_API={KEYS:{PASSTHROUGH:"passthrough",EXPAND:"expand"}},t.ONLINE_MEMBER_COUNT_API={ENDPOINTS:{GET_ONLINE_MEMBER_COUNT:"api/%s/online-members"},RESPONSE:{ONLINE_USERS_COUNT:"onlineUsersCount",GROUPS:"groups"},ERRORS:{INVALID_GROUPLIST:{code:"ERROR_INVALID_GROUPLIST",name:"ERROR_INVALID_GROUPLIST",message:"Grouplist cannot be null or empty.",details:""}}},t.ADDITIONAL_CONSTANTS={SECURE_URL_PROPERTY:"fat"},t.AI_FEATURE_ACCESSIBLE="features.ai.accessible",t.AI_FEATURE_ENABLED="features.ai.enabled",t.AI_SLUG_ACCESSIBLE="features.ai.%s.accessible",t.AI_SLUG_ENABLED="features.ai.%s.enabled"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatException=void 0;var o=function(e){null!==e.code&&void 0!==e.code&&""!==e.code&&(this.code=e.code),null!==e.name&&void 0!==e.name&&""!==e.name&&(this.name=e.name),null!==e.message&&void 0!==e.message&&""!==e.message&&(this.message=e.message),null!==e.details&&void 0!==e.details&&""!==e.details&&(this.details=e.details)};t.CometChatException=o},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=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}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.Me=t.User=void 0;var r=n(2),i=n(10),a=n(1),E=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.hasBlockedMe=!1,this.blockedByMe=!1,this.deactivatedAt=0,1===e.length)typeof e[0]===a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?this.uid=e[0]:(this.uid=e[0].uid,this.name=e[0].name,e[0].authToken&&(this.authToken=e[0].authToken),e[0].avatar&&(this.avatar=e[0].avatar),e[0].lastActiveAt&&(this.lastActiveAt=e[0].lastActiveAt),e[0].link&&(this.link=e[0].link),e[0].metadata&&(this.metadata=e[0].metadata),e[0].role&&(this.role=e[0].role),e[0].statusMessage&&(this.statusMessage=e[0].statusMessage),e[0].status&&"offline"!==e[0].status?this.status="online":this.status="offline",e[0].tags&&(this.tags=e[0].tags),e[0].deactivatedAt&&(this.deactivatedAt=e[0].deactivatedAt));else{if(2!==e.length)throw new r.CometChatException(i.ERRORS.PARAMETER_MISSING);this.uid=e[0],this.name=e[1]}}return e.prototype.getUid=function(){return this.uid.toString()},e.prototype.setUid=function(e){this.uid=e},e.prototype.getName=function(){return this.name.toString()},e.prototype.setName=function(e){e&&(this.name=e)},e.prototype.getAuthToken=function(){return this.authToken},e.prototype.setAuthToken=function(e){this.authToken=e},e.prototype.getAvatar=function(){return this.avatar},e.prototype.setAvatar=function(e){this.avatar=e},e.prototype.getLastActiveAt=function(){return this.lastActiveAt},e.prototype.setLastActiveAt=function(e){this.lastActiveAt=e},e.prototype.getLink=function(){return this.link},e.prototype.setLink=function(e){return this.link=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getRole=function(){return this.role},e.prototype.setRole=function(e){this.role=e},e.prototype.getStatus=function(){return this.status},e.prototype.setStatus=function(e){this.status=e},e.prototype.getStatusMessage=function(){return this.statusMessage},e.prototype.setStatusMessage=function(e){this.statusMessage=e},e.prototype.setBlockedByMe=function(e){this.blockedByMe=e},e.prototype.getBlockedByMe=function(){return this.blockedByMe},e.prototype.setHasBlockedMe=function(e){this.hasBlockedMe=e},e.prototype.getHasBlockedMe=function(){return this.hasBlockedMe},e.prototype.setTags=function(e){this.tags=e},e.prototype.getTags=function(){return this.tags},e.prototype.setDeactivatedAt=function(e){this.deactivatedAt=e},e.prototype.getDeactivatedAt=function(){return this.deactivatedAt},e}(),c=function(n){function e(e){var t=n.call(this,e)||this;return t.wsChannel=e.wsChannel,e.jwt&&(t.jwt=e.jwt),e.fat&&(t.fat=e.fat),t}return s(e,n),e.prototype.getWsChannel=function(){retur