UNPKG

@cometchat-pro/cordova-ionic-chat

Version:
1 lines 366 kB
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,function(){return function(n){var o={};function r(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,r),e.l=!0,e.exports}return r.m=n,r.c=o,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=41)}([function(t,h,T){"use strict";(function(n){var t=this&&this.__awaiter||function(t,i,a,c){return new(a||(a=Promise))(function(n,e){function o(t){try{s(c.next(t))}catch(t){e(t)}}function r(t){try{s(c.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,r)}s((c=c.apply(t,i||[])).next())})},o=this&&this.__generator||function(n,o){var r,s,i,t,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,s&&(i=2&e[0]?s.return:e[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,e[1])).done)return i;switch(s=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,s=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){a.label=e[1];break}if(6===e[0]&&a.label<i[1]){a.label=i[1],i=e;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(e);break}i[2]&&a.ops.pop(),a.trys.pop();continue}e=o.call(n,a)}catch(t){e=[6,t],s=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};h.__esModule=!0,h.getCallingComponentVersion=h.isCallingComponentInstalled=h.validateConversationType=h.validateUpdateUser=h.validateCreateUser=h.validateMessage=h.validateChatType=h.validateMsgId=h.validateArray=h.validateHideMessagesFromBlockedUsers=h.validateId=h.validateCreateGroup=h.validateJoinGroup=h.validateUpdateGroup=h.validateScope=h.isAudio=h.isVideo=h.isImage=h.getUpdatedSettings=h.getAppSettings=h.getCurrentTime=h.Logger=h.createUidFromJid=h.format=h.getOrdinalSuffix=h.isFalsy=h.isTruthy=h.isObject=h.getJidHost=h.getChatHost=void 0;var r=T(16),i=T(1),s=T(6),a=T(2),c=T(18),E=T(19),u=T(21),p=T(3),e=T(13);T(30).Plugins.Calling;function l(t){return null!=t&&("string"==typeof t&&(t=t.trim()),"object"==typeof t&&0===Object.keys(t).length&&(t=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(t)}function S(t){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return t.split("%s").reduce(function(t,e,n){return t+e+(o[n]||"")},"")}h.getChatHost=function(t){return t[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?t[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:t[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?t[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:t[i.APP_SETTINGS.KEYS.CHAT_HOST]},h.getJidHost=function(t){return t[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?t[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:t[i.APP_SETTINGS.KEYS.CHAT_HOST]},h.isObject=function(t){return t instanceof Object&&t.constructor===Object},h.isTruthy=function(t){return[!0,1,"1","true","TRUE"].includes(t)},h.isFalsy=l,h.getOrdinalSuffix=function(t){var e=t%10,n=t%100;return 1==e&&11!=n?t+"st":2==e&&12!=n?t+"nd":3==e&&13!=n?t+"rd":t+"th"},h.format=S,h.createUidFromJid=function(t){return t.substring(t.lastIndexOf("]")+1,t.lastIndexOf("@"))};var d=function(){function t(){}return t.log=function(t,e){},t.error=function(t,e){},t.info=function(t,e){},t}();function C(){return new Promise(function(e,n){s.makeApiCall("appSettings").then(function(t){r.LocalStorage.getInstance().set(i.LOCAL_STORE.KEY_APP_SETTINGS,t.data),t.data.MODE&&p.CometChat.setMode(t.data.MODE),e(t.data)},function(t){n(new a.CometChatException(t.error))})})}h.Logger=d,h.getCurrentTime=function(){return(new Date).getTime()},h.getAppSettings=function(){return new Promise(function(e,n){r.LocalStorage.getInstance().get(i.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){l(t)?C().then(function(t){e(t)},function(t){n(t)}):e(t)},function(t){n(t)})})},h.getUpdatedSettings=C,h.isImage=function(t){var e;return t.type&&t.type.toLowerCase().includes("image")&&(e=!0),e},h.isVideo=function(t){var e;return t.type&&t.type.toLowerCase().includes("video")&&(e=!0),e},h.isAudio=function(t){var e;return t.type&&t.type.toLowerCase().includes("audio")&&(e=!0),e},h.validateScope=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):l(t)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):t!=p.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&t!=p.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&t!=p.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new a.CometChatException(i.GroupErrors.INVALID_SCOPE):void 0},h.validateUpdateGroup=function(t){return t.hasOwnProperty(i.GroupConstants.KEYS.GUID)?typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):l(t[i.GroupConstants.KEYS.GUID])?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):t.hasOwnProperty(i.GroupConstants.KEYS.NAME)&&""===t[i.GroupConstants.KEYS.NAME]?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},h.validateJoinGroup=function(t,e,n){if(typeof t==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!t.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PUBLIC&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PASSWORD&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PROTECTED&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()==p.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(t[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(e))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e.toLowerCase()!=p.CometChat.GROUP_TYPE.PUBLIC&&e.toLowerCase()!=p.CometChat.GROUP_TYPE.PASSWORD&&e.toLowerCase()!=p.CometChat.GROUP_TYPE.PROTECTED&&e.toLowerCase()!=p.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e.toLowerCase()==p.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(n))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},h.validateCreateGroup=function(t){if(!t.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.NAME))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof t[i.GroupConstants.KEYS.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(l(t[i.GroupConstants.KEYS.NAME]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PUBLIC&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PASSWORD&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PROTECTED&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()==p.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(t[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(t.hasOwnProperty(i.GroupConstants.KEYS.TAGS)){if(!Array.isArray(t[i.GroupConstants.KEYS.TAGS]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===t[i.GroupConstants.KEYS.TAGS].length)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},h.validateId=function(t,e){if("user"===e){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(t))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===e){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}},h.validateHideMessagesFromBlockedUsers=function(t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},h.validateArray=function(t,e){var n="List should be an array.";return n="blockUsers"===e?"blockUsers() method accepts an array of users.":"unblockUsers"===e?"unblockUsers() method accepts an array of users.":"groupMembers"===e?"addMembersToGroup() method accepts members list as an array of users.":"addMembersToGroup() method accepts bannedMembers list as an array of users.",typeof t!=i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(t)?void 0:new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},h.validateMsgId=function(t){return isNaN(t)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):l(t)?new a.CometChatException(e.ERRORS.PARAMETER_MISSING):void 0},h.validateChatType=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):l(t)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):t!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&t!=i.MessageConstatnts.RECEIVER_TYPE.USER?new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE):void 0},h.validateMessage=function(t){var e=t;if(typeof e.getReceiverId()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(l(e.getReceiverId()))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof e.getReceiverType()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(l(e.getReceiverType()))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(e.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&e.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.USER)return new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE);if(t instanceof c.TextMessage){var n=t;if(typeof n.getText()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(t instanceof E.MediaMessage){var o=t;if(o.getData()&&o.getData().hasOwnProperty("attachments"))for(var r=o.getAttachments(),s=0;s<r.length;s++){if(!r[s].getExtension())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!r[s].getMimeType())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!r[s].getName())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!r[s].getUrl())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(o.hasOwnProperty("files"))for(s=0;s<o.files.length;s++)if(o.files[s].hasOwnProperty("file")){if(!(o.files[s].file instanceof Blob))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}else if(!(o.files[s]instanceof Blob))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}if(t instanceof u.CustomMessage&&l(t.getCustomData()))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")))},h.validateCreateUser=function(t){if(!t.hasOwnProperty(i.UserConstants.UID))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof t[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(t[i.UserConstants.UID]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!t.hasOwnProperty(i.UserConstants.NAME))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof t[i.UserConstants.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(l(t[i.UserConstants.NAME]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(t.hasOwnProperty(i.UserConstants.AVATAR)&&""===t[i.UserConstants.AVATAR])return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(t.hasOwnProperty(i.UserConstants.META_DATA)&&""===t[i.UserConstants.META_DATA])return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(t.hasOwnProperty(i.UserConstants.LINK)&&""===t[i.UserConstants.LINK])return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(t.hasOwnProperty(i.UserConstants.STATUS_MESSAGE)&&""===t[i.UserConstants.STATUS_MESSAGE])return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(t.hasOwnProperty(i.UserConstants.ROLE)&&""===t[i.UserConstants.ROLE])return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(t.hasOwnProperty(i.UserConstants.TAGS)){if(!Array.isArray(t[i.UserConstants.TAGS]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===t[i.UserConstants.TAGS].length)return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},h.validateUpdateUser=function(t){return t.hasOwnProperty(i.UserConstants.UID)?typeof t[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):l(t[i.UserConstants.UID])?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):t.hasOwnProperty(i.UserConstants.NAME)&&""===t[i.UserConstants.NAME]?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},h.validateConversationType=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):l(t)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(t=t.toLowerCase())!=p.CometChat.RECEIVER_TYPE.USER&&t!=p.CometChat.RECEIVER_TYPE.GROUP?new a.CometChatException(i.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},h.isCallingComponentInstalled=function(){return!!(n.hasOwnProperty("CometChatCalling")&&n.CometChatCalling&&n.CometChatCalling.hasOwnProperty("isCallingComponentInstalled")&&n.CometChatCalling.isCallingComponentInstalled)},h.getCallingComponentVersion=function(){return t(void 0,void 0,void 0,function(){var e;return o(this,function(t){switch(t.label){case 0:if(!h.isCallingComponentInstalled())return[3,7];e=n.CometChatCalling.Calling,t.label=1;case 1:return t.trys.push([1,5,,6]),e.getPluginVersion()?[4,e.getPluginVersion()]:[3,3];case 2:return 3==t.sent().version?[2,3]:[2,2];case 3:return[2,2];case 4:return[3,6];case 5:return t.sent(),[2,2];case 6:return[3,8];case 7:return[2,0];case 8:return[2]}})})}}).call(this,T(15))},function(t,e,n){"use strict";e.__esModule=!0,e.ONLINE_MEMBER_COUNT_API=e.JWT_API=e.ProsodyApiErrors=e.PROSODY_API=e.API_ERROR_CODES=e.CONNECTION_STATUS=e.COMMON_UTILITY_CONSTANTS=e.APP_SETTINGS=e.PresenceConstatnts=e.FeatureRestrictionErrors=e.MessageErrors=e.ExtensionErrors=e.ConversationErrors=e.GroupErrors=e.UserErrors=e.ReceiptErrors=e.GENERAL_ERROR=e.PARAMETER_ERROR=e.CALL_ERROR=e.Errors=e.UserConstants=e.GroupMemersConstans=e.GroupConstants=e.CallConstants=e.BlockedUsersConstants=e.ActionConstatnts=e.TYPING_NOTIFICATION=e.MessageCategory=e.ATTACHMENTS_CONSTANTS=e.MessageConstatnts=e.READ_RECEIPTS=e.DELIVERY_RECEIPTS=e.ResponseConstants=e.LOCAL_STORE=e.ANALYTICS=e.WS=e.SDKHeader=e.APPINFO=e.GROUP_MEMBER_SCOPE=e.GroupMemberScope=e.GROUP_TYPE=e.GroupType=e.DEFAULT_VALUES=e.constants=void 0;var o,r,s,i=n(2);e.constants={DEFAULT_STORE:"cometchat",MSG_VER_PRE:"store-ver-pre",MSG_VER_POST:"store-ver-post"},e.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"},(o=e.GroupType||(e.GroupType={})).Public="public",o.Private="private",o.Protected="protected",o.Password="password",e.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(r=e.GroupMemberScope||(e.GroupMemberScope={})).Admin="admin",r.Moderator="moderator",r.Member="member",e.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},e.APPINFO={platform:"IONIC_CORDOVA",sdkVersion:"v3.0.12",apiVersion:"v3.0",sdkVersionWithUnderScore:"3_0_12"},e.SDKHeader={platform:"ionic",sdkVersion:"3.0.12",sdk:"%s@%s"},e.WS={CONVERSATION:{TYPE:{CHAT:"chat",GROUP_CHAT:"groupchat"}}},e.ANALYTICS={analyticsHost:"metrics-%s.cometchat.io",analyticsVersion:"v1"},e.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"},e.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"}}},e.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"},e.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"},e.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"},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",HIDE_DELETED_MESSAGES:"hideDeleted",WITH_TAGS:"withTags",TAGS:"tags"}}},e.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(s=e.MessageCategory||(e.MessageCategory={})).ACTION="action",s.MESSAGE="message",s.CALL="call",s.CUSTOM="custom",e.TYPING_NOTIFICATION={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"receiverType",META:"metadata",KEYS:{TYPING_NOTIFICATION:"typingNotification",TIMESTAMP:"timestamp"},ACTIONS:{STARTED:"started",ENDED:"ended"}},e.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"}},e.BlockedUsersConstants={REQUEST_KEYS:{DIRECTIONS:{BOTH:"both",HAS_BLOCKED_ME:"hasBlockedMe",BLOCKED_BY_ME:"blockedByMe"}}},e.CallConstants={CALL_MODE:{DEFAULT:"DEFAULT",SPOTLIGHT:"SPOTLIGHT",SINGLE:"SINGLE"},AUDIO_MODE:{SPEAKER:"SPEAKER",EARPIECE:"EARPIECE",BLUETOOTH:"BLUETOOTH",HEADPHONES:"HEADPHONES"},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"},ZOOM_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visibility:!0},FULL_SCREEN_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visibility:!0},USER_LIST_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visibility:!0},NAME_LABEL_DEFAULT_PARAMS:{position:"bottom-left",visibility:!0,color:"#333333"},MAIN_VIDEO_CONTAINER_SETTINGS:{KEYS:{POSITION:"position",VISIBILITY:"visibility",COLOR:"color"}}},e.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"}},e.GroupMemersConstans={KEYS:{SCOPE:"scope",UID:"uid",GUID:"guid",USER:"user",NAME:"name"}},e.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"}},e.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"},e.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:{}},MODULE_NOT_INSTALLED:{code:"ERROR_CALL_MODULE_NOT_FOUND",name:"ERROR_CALL_MODULE_NOT_FOUND",message:"CometChat Calling module not found. Please add the CometChat Calling dependency and try again.",details:{}}},e.PARAMETER_ERROR={PARAMETER_REQUIRED:{code:"%s_NOT_PROVIDED",name:"%s_NOT_PROVIDED",message:"please provide the %s.",details:{}}},e.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:{}}},e.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:{}}},e.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:""})},e.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:""})},e.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."}},e.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:{}}},e.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."}},e.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:{}}},e.PresenceConstatnts={STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},e.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"}},e.COMMON_UTILITY_CONSTANTS={TYPE_CONSTANTS:{BOOLEAN:"boolean",STRING:"string",OBJECT:"object",NUMBER:"number"}},e.CONNECTION_STATUS={CONNECTED:"connected",CONNECTING:"connecting",DISCONNECTED:"disconnected",FEATURE_THROTTLED:"featureThrottled"},e.API_ERROR_CODES={AUTH_ERR_AUTH_TOKEN_NOT_FOUND:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND"},e.PROSODY_API={DOMAIN_PREFIX:"xmpp",PATH:{ROOM:"room",ROOM_SIZE:"room-size",SESSIONS:"sessions"},RESPONSE:{PARTICIPANTS:"participants"},QUERY_PARAMETERS:{DOMAIN:"domain",ROOM:"room"}},e.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:""}},e.JWT_API={KEYS:{PASSTHROUGH:"passthrough",EXPAND:"expand"}},e.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:""}}}},function(t,e,n){"use strict";e.__esModule=!0,e.CometChatException=void 0;var o=function(t){null!==t.code&&void 0!==t.code&&""!==t.code&&(this.code=t.code),null!==t.name&&void 0!==t.name&&""!==t.name&&(this.name=t.name),null!==t.message&&void 0!==t.message&&""!==t.message&&(this.message=t.message),null!==t.details&&void 0!==t.details&&""!==t.details&&(this.details=t.details)};e.CometChatException=o},function(t,nt,ot){"use strict";(function(w){var S=this&&this.__assign||function(){return(S=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},c=this&&this.__awaiter||function(t,i,a,c){return new(a||(a=Promise))(function(n,e){function o(t){try{s(c.next(t))}catch(t){e(t)}}function r(t){try{s(c.throw(t))}catch(t){e(t)}}function s(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,r)}s((c=c.apply(t,i||[])).next())})},Y=this&&this.__generator||function(n,o){var r,s,i,t,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,s&&(i=2&e[0]?s.return:e[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,e[1])).done)return i;switch(s=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,s=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){a.label=e[1];break}if(6===e[0]&&a.label<i[1]){a.label=i[1],i=e;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(e);break}i[2]&&a.ops.pop(),a.trys.pop();continue}e=o.call(n,a)}catch(t){e=[6,t],s=0}finally{r=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};nt.__esModule=!0,nt.CometChat=void 0;var u=ot(31),G=ot(0),b=ot(2),K=ot(6),B=ot(4),d=ot(16),E=ot(19),p=ot(7),l=ot(18),C=ot(10),h=ot(11),x=ot(1),a=ot(8),T=ot(17),s=ot(33),t=ot(25),e=ot(23),F=ot(34),g=ot(13),n=ot(22),o=ot(42),r=ot(43),i=ot(44),_=ot(45),f=ot(47),R=ot(48),A=ot(27),I=ot(28),O=ot(38),N=ot(21),m=ot(36),y=ot(50),v=ot(51),L=ot(52),P=ot(37),M=ot(26),D=ot(20),V=ot(53),U=ot(30),J=ot(54),k=ot(55),H=ot(39),W=ot(5),j=ot(29),q=ot(64),X=ot(32),Q=ot(65),z=U.Plugins.Calling,Z=ot(66),$=k.WSConnectionHelper.getInstance(),tt=H.ListenerHandlers.getInstance(),et=function(){function U(t){try{U.appId=t,U.localStorage=d.LocalStorage.getInstance(),U.keyStore=s.KeyStore.getInstance()}catch(t){G.Logger.error("CometChat: constructor",t)}}return U.setAuthToken=function(t){try{U.authToken=t}catch(t){G.Logger.error("CometChat: setAuthToken",t)}},U.prototype.getAuthToken=function(){try{return U.authToken}catch(t){G.Logger.error("CometChat: getAuthToken",t)}},U.getAppId=function(){try{return U.appId}catch(t){G.Logger.error("CometChat: getAppId",t)}},U.prototype.getApiKey=function(){try{return U.apiKey}catch(t){G.Logger.error("CometChat: getApiKey",t)}},U.getMode=function(){try{return U.mode}catch(t){G.Logger.error("CometChat: getMode",t)}},U.setMode=function(t){try{U.mode=t}catch(t){G.Logger.error("CometChat: getMode",t)}},U.getSessionId=function(){try{return U.sessionId}catch(t){G.Logger.error("CometChat: getAppId",t)}},U.didAnalyticsPingStart=function(){try{return U.isAnalyticsPingStarted}catch(t){G.Logger.error("CometChat: didAnalyticsPingStart",t)}},U.init=function(r,t){var o=this;return void 0===r&&(r=""),new Promise(function(n,e){try{"object"==typeof r&&(r.hasOwnProperty("appId")&&(r=r.appId),r.hasOwnProperty("appSettings")&&(t=r.appSettings)),G.isFalsy(t)?t=(new v.AppSettingsBuilder).setRegion(v.AppSettings.REGION_EU).build():t.getRegion()==v.AppSettings.REGION_PRIVATE&&(t.region=r),o.appSettings=t,G.isFalsy(r)?e(new b.CometChatException(g.INIT_ERROR.NO_APP_ID)):(o.initialzed=!0,U.appId=r,U.getInstance(r),U.sessionId=x.APPINFO.platform+"-"+x.APPINFO.sdkVersionWithUnderScore+"-"+Z()+"-"+(new Date).getTime(),d.LocalStorage.getInstance().get(x.LOCAL_STORE.KEY_APP_ID).then(function(t){if(null==t||null==t)U.appId=r,U.getInstance(r),d.LocalStorage.getInstance().set(x.LOCAL_STORE.KEY_APP_ID,r),n(!0);else{var e=t.toLocaleString();e===r?(U.appId=e,U.getInstance(e),d.LocalStorage.getInstance().get(x.LOCAL_STORE.KEY_USER).then(function(t){t?(U.isLoggedOut=!1,U.user=new B.Me(t),U.setAuthToken(U.user.getAuthToken()),t.jwt&&(U.jwt=t.jwt),n(!0),d.LocalStorage.getInstance().get(x.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){if(t){if(t.hasOwnProperty(x.APP_SETTINGS.KEYS.APP_VERSION)){var e=parseInt(x.APPINFO.sdkVersion.charAt(1));t[x.APP_SETTINGS.KEYS.APP_VERSION]<e&&(o.appSettings.shouldAutoEstablishSocketConnection()||(U.shouldConnectToWS=!1),U.getInstance().internalRestart(U.user.getAuthToken()))}else o.appSettings.shouldAutoEstablishSocketConnection()||(U.shouldConnectToWS=!1),U.getInstance().internalRestart(U.user.getAuthToken());t[x.APP_SETTINGS.KEYS.MODE]&&(U.mode=t[x.APP_SETTINGS.KEYS.MODE]),t[x.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(U.settingsHash=t[x.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[x.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(U.settingsHashReceivedAt=t[x.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),U.isAnalyticsDisabled=!!t[x.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],U.didAnalyticsPingStart()||U.isAnalyticsDisabled||!o.appSettings.shouldAutoEstablishSocketConnection()||(U.pingAnalytics(),U.startAnalyticsPingTimer()),$&&!$.connection&&o.appSettings.shouldAutoEstablishSocketConnection()&&(U.isConnectingFromInit=!0,U.WSLogin(U.user))}})):n(!0)})):o.clearCache().then(function(){U.apiKey=void 0,U.user=void 0,U.authToken=void 0,U.cometChat=void 0,U.mode=void 0,$.WSLogout(),U.appId=r,d.LocalStorage.getInstance().set(x.LOCAL_STORE.KEY_APP_ID,r),U.getInstance(r),n(!0)})}s.KeyStore.getInstance().get(x.LOCAL_STORE.KEY_DEVICE_ID).then(function(t){if(null==t){var e=Z(),n=(new Date).getTime(),o=r+"_"+e+"_"+n;s.KeyStore.getInstance().set(x.LOCAL_STORE.KEY_DEVICE_ID,o)}})}))}catch(t){e