-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathCometChat.js
More file actions
1 lines (1 loc) · 479 KB
/
CometChat.js
File metadata and controls
1 lines (1 loc) · 479 KB
1
!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 r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(){return function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=51)}([function(e,f,_){"use strict";(function(n){var e=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function r(e){try{s(E.next(e))}catch(e){t(e)}}function o(e){try{s(E.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,o)}s((E=E.apply(e,i||[])).next())})},r=this&&this.__generator||function(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(f,"__esModule",{value:!0}),f.validateQuestion=f.updatePropertiesWithDynamicValue=f.getCallingComponentVersion=f.isCallingComponentInstalled=f.validateConversationType=f.validateUpdateUser=f.validateCreateUser=f.validateMessage=f.validateChatType=f.validateMsgId=f.validateArray=f.validateHideMessagesFromBlockedUsers=f.validateId=f.validateCreateGroup=f.validateJoinGroup=f.validateUpdateGroup=f.validateScope=f.isAudio=f.isVideo=f.isImage=f.getUpdatedSettings=f.getAppSettings=f.getCurrentTime=f.Logger=f.createUidFromJid=f.format=f.getOrdinalSuffix=f.isFalsy=f.isTruthy=f.isObject=f.getJidHost=f.getChatHost=void 0;var o=_(17),i=_(1),s=_(6),a=_(2),E=_(19),c=_(21),u=_(23),p=_(4),t=_(10),l=(_(36).Plugins.Calling,_(24));function d(e){return null!=e&&("string"==typeof e&&(e=e.trim()),"object"==typeof e&&0===Object.keys(e).length&&(e=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(e)}function S(e){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];return e.split("%s").reduce(function(e,t,n){return e+t+(r[n]||"")},"")}f.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]},f.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]},f.isObject=function(e){return e instanceof Object&&e.constructor===Object},f.isTruthy=function(e){return[!0,1,"1","true","TRUE"].includes(e)},f.isFalsy=d,f.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"},f.format=S,f.createUidFromJid=function(e){return e.substring(e.lastIndexOf("]")+1,e.lastIndexOf("@"))};var C=function(){function e(){}return e.log=function(e,t){},e.error=function(e,t){},e.info=function(e,t){},e}();function h(){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&&p.CometChat.setMode(e.data.MODE),t(e.data)},function(e){n(new a.CometChatException(e.error))})})}f.Logger=C,f.getCurrentTime=function(){return(new Date).getTime()},f.getAppSettings=function(){return new Promise(function(t,n){o.LocalStorage.getInstance().get(i.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){d(e)?h().then(function(e){t(e)},function(e){n(e)}):t(e)},function(e){n(e)})})},f.getUpdatedSettings=h,f.isImage=function(e){var t;return e.type&&e.type.toLowerCase().includes("image")&&(t=!0),t},f.isVideo=function(e){var t;return e.type&&e.type.toLowerCase().includes("video")&&(t=!0),t},f.isAudio=function(e){var t;return e.type&&e.type.toLowerCase().includes("audio")&&(t=!0),t},f.validateScope=function(e){return typeof e!==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"))):d(e)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):e!=p.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&e!=p.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&e!=p.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new a.CometChatException(i.GroupErrors.INVALID_SCOPE):void 0},f.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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):d(e[i.GroupConstants.KEYS.GUID])?new a.CometChatException(JSON.parse(S(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(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")))},f.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(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(d(e[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(S(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(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(d(e[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(e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PUBLIC&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PASSWORD&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PROTECTED&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()==p.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(d(e[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!==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),"GUID","GUID","GUID")));if(d(e))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(d(t))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t.toLowerCase()!=p.CometChat.GROUP_TYPE.PUBLIC&&t.toLowerCase()!=p.CometChat.GROUP_TYPE.PASSWORD&&t.toLowerCase()!=p.CometChat.GROUP_TYPE.PROTECTED&&t.toLowerCase()!=p.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t.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(d(n))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},f.validateCreateGroup=function(e){if(!e.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 e[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(d(e[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(S(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(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(d(e[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(!e.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 e[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(d(e[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(e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PUBLIC&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PASSWORD&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PROTECTED&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=p.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()==p.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(d(e[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(S(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(S(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(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},f.validateId=function(e,t){if("user"===t){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),"UID","UID","UID")));if(d(e))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(d(e))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"BOT_ID","BOT_ID","BOT_ID")));if(d(e))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"BOT_ID","BOT_ID","BOT_ID","BOT_ID")))}},f.validateHideMessagesFromBlockedUsers=function(e){if(typeof e!==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")))},f.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(S(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(e)?void 0:new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},f.validateMsgId=function(e){return isNaN(e)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):d(e)?new a.CometChatException(t.ERRORS.PARAMETER_MISSING):void 0},f.validateChatType=function(e){return typeof e!==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"))):d(e)?new a.CometChatException(JSON.parse(S(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},f.validateMessage=function(e){var t=e;if(typeof t.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(d(t.getReceiverId()))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(d(t.getReceiverType()))return new a.CometChatException(JSON.parse(S(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(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(e instanceof c.MediaMessage){var r=e;if(r.getData()&&r.getData().hasOwnProperty("attachments"))for(var o=r.getAttachments(),s=0;s<o.length;s++){if(!o[s].getExtension())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!o[s].getMimeType())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!o[s].getName())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!o[s].getUrl())return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(r.hasOwnProperty("files"))for(s=0;s<r.files.length;s++)if(r.files[s].hasOwnProperty("file")){if(!(r.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(!(r.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(e instanceof u.CustomMessage&&d(e.getCustomData()))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")));if(e instanceof l.InteractiveMessage&&d(e.getInteractiveData()))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"INTERACTIVE_DATA","INTERACTIVE_DATA","interactive data","interactive data")))},f.validateCreateUser=function(e){if(!e.hasOwnProperty(i.UserConstants.UID))return new a.CometChatException(JSON.parse(S(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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(d(e[i.UserConstants.UID]))return new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!e.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 e[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(d(e[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(e.hasOwnProperty(i.UserConstants.AVATAR)&&""===e[i.UserConstants.AVATAR])return new a.CometChatException(JSON.parse(S(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(S(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(S(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(S(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(S(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(S(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(S(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},f.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(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):d(e[i.UserConstants.UID])?new a.CometChatException(JSON.parse(S(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(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")))},f.validateConversationType=function(e){return typeof e!==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"))):d(e)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(e=e.toLowerCase())!=p.CometChat.RECEIVER_TYPE.USER&&e!=p.CometChat.RECEIVER_TYPE.GROUP?new a.CometChatException(i.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},f.isCallingComponentInstalled=function(){return!!(n.hasOwnProperty("CometChatCalling")&&n.CometChatCalling&&n.CometChatCalling.hasOwnProperty("isCallingComponentInstalled")&&n.CometChatCalling.isCallingComponentInstalled)},f.getCallingComponentVersion=function(){return e(void 0,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:if(!f.isCallingComponentInstalled())return[3,7];t=n.CometChatCalling.Calling,e.label=1;case 1:return e.trys.push([1,5,,6]),t.getPluginVersion()?[4,t.getPluginVersion()]:[3,3];case 2:return 3==e.sent().version?[2,3]:[2,2];case 3:return[2,2];case 4:return[3,6];case 5:return e.sent(),[2,2];case 6:return[3,8];case 7:return[2,0];case 8:return[2]}})})},f.updatePropertiesWithDynamicValue=function(e,r,o){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(r)&&!t[n].includes(i.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY)&&(t[n]+=o))}(e),e},f.validateQuestion=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"QUESTION","QUESTION","Question"))):d(e)?new a.CometChatException(JSON.parse(S(JSON.stringify(i.GENERAL_ERROR.INVALID),"QUESTION","QUESTION","question","question"))):void 0}}).call(this,_(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AttachmentType=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.CONNECTION_STATUS=t.COMMON_UTILITY_CONSTANTS=t.APP_SETTINGS=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.DEFAULT_VALUES=t.constants=void 0;var r,o,s,i,a,E,c=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},(r=t.GroupType||(t.GroupType={})).Public="public",r.Private="private",r.Protected="protected",r.Password="password",t.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(o=t.GroupMemberScope||(t.GroupMemberScope={})).Admin="admin",o.Moderator="moderator",o.Member="member",t.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},t.APPINFO={platform:"IONIC_CORDOVA",sdkVersion:"v4.0.12",apiVersion:"v3.0",sdkVersionWithUnderScore:"4_0_12"},t.SDKHeader={platform:"ionic",sdkVersion:"4.0.12",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",HAS_ATTACHMENTS:"hasAttachments",HAS_LINKS:"hasLinks",HAS_MENTIONS:"hasMentions",HAS_REACTIONS:"hasReactions",MENTIONED_UIDS:"mentionedUids",ATTACHMENT_TYPES:"attachmentTypes"}}},t.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(s=t.MessageCategory||(t.MessageCategory={})).ACTION="action",s.MESSAGE="message",s.CALL="call",s.CUSTOM="custom",s.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"},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"}}},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:{}},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:{}}},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 c.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new c.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 c.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 c.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new c.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new c.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.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",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"},(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",(E=t.AttachmentType||(t.AttachmentType={})).IMAGE="image",E.VIDEO="video",E.AUDIO="audio",E.FILE="file"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatException=void 0;var r=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=r},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(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 s=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 s.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 o(e,n),e.prototype.getWsChannel=function(){return this.wsChannel},e.prototype.getJWT=function(){return this.jwt},e.prototype.getFat=function(){return this.fat},e}(t.User=E);t.Me=c},function(e,de,Se){"use strict";(function(Y){var d=this&&this.__assign||function(){return(d=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},E=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function r(e){try{s(E.next(e))}catch(e){t(e)}}function o(e){try{s(E.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,o)}s((E=E.apply(e,i||[])).next())})},w=this&&this.__generator||function(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(de,"__esModule",{value:!0}),de.CometChat=void 0;var u=Se(37),G=Se(0),b=Se(2),K=Se(6),B=Se(3),S=Se(17),c=Se(21),p=Se(7),l=Se(19),C=Se(12),h=Se(13),F=Se(1),a=Se(9),f=Se(18),s=Se(29),e=Se(30),t=Se(27),x=Se(40),_=Se(10),n=Se(26),r=Se(52),o=Se(53),i=Se(54),T=Se(55),g=Se(57),R=Se(58),A=Se(32),I=Se(33),O=Se(44),N=Se(23),m=Se(42),y=Se(60),P=Se(61),v=Se(62),M=Se(43),L=Se(31),U=Se(22),V=Se(63),D=Se(36),k=Se(64),J=Se(65),H=Se(46),W=Se(5),j=Se(35),q=Se(75),X=Se(38),z=Se(76),Q=Se(48),Z=Se(25),$=Se(39),ee=Se(45),te=Se(24),ne=Se(77),re=Se(82),oe=Se(20),se=Se(47),ie=Se(34),ae=Se(83),Ee=D.Plugins.Calling,ce=Se(84),ue=J.WSConnectionHelper.getInstance(),pe=H.ListenerHandlers.getInstance(),le=function(){function D(e){var t,n,r=this;try{D.appId=e,D.localStorage=S.LocalStorage.getInstance(),D.keyStore=s.KeyStore.getInstance(),Y.CapacitorApp&&(D.App=Y.CapacitorApp.App,null===(n=null===(t=null==D?void 0:D.App)||void 0===t?void 0:t.App)||void 0===n||n.addListener("appStateChange",function(e){var t,n=e.isActive;n?ue.onAppActive():ue.onAppInactive(),D.appSettings.shouldAutoEstablishSocketConnection()?n?(D.isAppInactive=!1,D.connect(),D.callWaitTimer&&r.clearCallWaitTimer()):(D.isAppInactive=!0,(null===(t=null==D?void 0:D.getActiveCall())||void 0===t?void 0:t.getStatus())===F.CallConstants.CALL_STATUS.INITIATED?r.startCallWaitTimer():D.disconnectInternally()):n?(D.isAppInactive=!1,!Q.checkConnection(ue.connection)&&D.disconnectedByUser||D.startAnalyticsPingTimer()):(D.isAppInactive=!0,D.clearAnalyticsPingTimer())}))}catch(e){G.Logger.error("CometChat: constructor",e)}}return D.ping=function(e){var t=e||{},n=t.onError,r=t.onSuccess;this.currentConnectionStatus===F.CONNECTION_STATUS.CONNECTED?D.user?ue.pingWS({onError:n,onSuccess:r}):n&&n(new b.CometChatException({code:F.Errors.ERROR_USER_NOT_LOGGED_IN,message:F.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE})):n&&n(new b.CometChatException(F.ReceiptErrors.NO_WEBSOCKET_CONNECTION))},D.prototype.startCallWaitTimer=function(){var e=this;D.callWaitTimer=setInterval(function(){try{1<D.callWaitTime?D.callWaitTime=D.callWaitTime-1:1===D.callWaitTime&&(D.disconnectInternally(),e.clearCallWaitTimer())}catch(e){G.Logger.error("CometChat: startCallWaitTimer",e)}},1e3)},D.prototype.clearCallWaitTimer=function(){try{clearInterval(D.callWaitTimer),D.callWaitTime=30}catch(e){G.Logger.error("CometChat: clearCallWaitTimer",e)}},D.clearActiveCall=function(){x.CallController.getInstance().clearActiveCall()},D.setAuthToken=function(e){try{D.authToken=e}catch(e){G.Logger.error("CometChat: setAuthToken",e)}},D.prototype.getAuthToken=function(){try{return D.authToken}catch(e){G.Logger.error("CometChat: getAuthToken",e)}},D.getAppId=function(){try{return D.appId}catch(e){G.Logger.error("CometChat: getAppId",e)}},D.prototype.getApiKey=function(){try{return D.apiKey}catch(e){G.Logger.error("CometChat: getApiKey",e)}},D.getMode=function(){try{return D.mode}catch(e){G.Logger.error("CometChat: getMode",e)}},D.setMode=function(e){try{D.mode=e}catch(e){G.Logger.error("CometChat: getMode",e)}},D.getSessionId=function(){try{return D.sessionId}catch(e){G.Logger.error("CometChat: getAppId",e)}},D.didAnalyticsPingStart=function(){try{return D.isAnalyticsPingStarted}catch(e){G.Logger.error("CometChat: didAnalyticsPingStart",e)}},D.init=function(o,e){var r=this;return void 0===o&&(o=""),new Promise(function(n,t){try{"object"==typeof o&&(o.hasOwnProperty("appId")&&(o=o.appId),o.hasOwnProperty("appSettings")&&(e=o.appSettings)),G.isFalsy(e)?e=(new P.AppSettingsBuilder).setRegion(P.AppSettings.REGION_EU).build():e.getRegion()==P.AppSettings.REGION_PRIVATE&&(e.region=o),r.appSettings=e,G.isFalsy(o)?t(new b.CometChatException(_.INIT_ERROR.NO_APP_ID)):(r.initialzed=!0,D.appId=o,D.getInstance(o),D.sessionId=F.APPINFO.platform+"-"+F.APPINFO.sdkVersionWithUnderScore+"-"+ce()+"-"+(new Date).getTime(),S.LocalStorage.getInstance().get(F.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e)D.appId=o,D.getInstance(o),S.LocalStorage.getInstance().set(F.LOCAL_STORE.KEY_APP_ID,o),n(!0);else{var t=e.toLocaleString();t===o?(D.appId=t,D.getInstance(t),S.LocalStorage.getInstance().get(F.LOCAL_STORE.KEY_USER).then(function(e){e?(D.isLoggedOut=!1,D.user=new B.Me(e),D.setAuthToken(D.user.getAuthToken()),e.jwt&&(D.jwt=e.jwt),new ne.PostDetails,n(!0),S.LocalStorage.getInstance().get(F.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(e){if(e.hasOwnProperty(F.APP_SETTINGS.KEYS.APP_VERSION)){var t=parseInt(F.APPINFO.sdkVersion.charAt(1));e[F.APP_SETTINGS.KEYS.APP_VERSION]<t&&4!==e[F.APP_SETTINGS.KEYS.APP_VERSION]&&(r.appSettings.shouldAutoEstablishSocketConnection()||(D.shouldConnectToWS=!1),D.getInstance().internalRestart(D.user.getAuthToken()))}else r.appSettings.shouldAutoEstablishSocketConnection()||(D.shouldConnectToWS=!1),D.getInstance().internalRestart(D.user.getAuthToken());e[F.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(D.SECURED_MEDIA_HOST=e[F.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]),e[F.APP_SETTINGS.KEYS.MODE]&&(D.mode=e[F.APP_SETTINGS.KEYS.MODE]),e[F.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(D.settingsHash=e[F.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[F.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(D.settingsHashReceivedAt=e[F.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),D.isAnalyticsDisabled=!!e[F.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],D.didAnalyticsPingStart()||D.isAnalyticsDisabled||!r.appSettings.shouldAutoEstablishSocketConnection()||(D.pingAnalytics(),D.startAnalyticsPingTimer()),ue&&!ue.connection&&r.appSettings.shouldAutoEstablishSocketConnection()&&(D.isConnectingFromInit=!0,D.WSLogin(D.user))}})):n(!0)})):r.clearCache().then(function(){D.apiKey=void 0,D.user=void 0,D.authToken=void 0,D.cometChat=void 0,D.mode=void 0,ue.WSLogout(),D.appId=o,S.LocalStorage.getInstance().set(F.LOCAL_STORE.KEY_APP_ID,o),D.getInstance(o),n(!0)})}s.KeyStore.getInstance().get(F.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==e){var t=ce(),n=(new Date).getTime(),r=o+"_"+t+"_"+n;s.KeyStore.getInstance().set(F.LOCAL_STORE.KEY_DEVICE_ID,r)}})}))}catch(e){t(new b.CometChatException(e))}})},D.isInitialized=function(){try{return this.initialzed}catch(e){G.Logger.error("CometChat: isInitialized",e)}},D.getInstance=function(e){try{return this.cometChat||(this.cometChat=new D(e)),this.cometChat}catch(e){G.Logger.error("CometChat: getInstance",e)}},D.registerTokenForPushNotification=function(l,d){var S=this;return new Promise(function(u,p){try{D.keyStore.get(F.LOCAL_STORE.KEY_DEVICE_ID).then(function(c){G.getAppSettings().then(function(e){var t="",n=c,r=F.APPINFO.platform,o=F.APPINFO.sdkVersion,s=e[F.APP_SETTINGS.KEYS.CHAT_API_VERSION];if(navigator&&(t=navigator.userAgent),null==n){var i=ce(),a=(new Date).getTime();n=S.appId+"_"+i+"_"+a,D.keyStore.set(F.LOCAL_STORE.KEY_DEVICE_ID,n)}var E={platform:r,deviceId:n,appInfo:{version:o,apiVersion:s,userAgent:t,pushNotification:{fcmDeviceToken:l,settings:d}}};K.makeApiCall("updateMyDetails",{},E,!1).then(function(e){u("Token Registration successful")},function(e){p(new b.CometChatException(e.error))}).catch(function(e){p(new b.CometChatException(e))})},function(e){return p(new b.CometChatException(e))})})}catch(e){p(new b.CometChatException(e))}})},D.pushToLoginListener=function(t,n){pe.loginHandlers.map(function(e){try{if(e._eventListener)switch(n){case"Login_Success":G.isFalsy(e._eventListener.loginSuccess)||e._eventListener.loginSuccess(t);break;case"Login_Failure":G.isFalsy(e._eventListener.loginFailure)||e._eventListener.loginFailure(t);break;case"Logout_Success":G.isFalsy(e._eventListener.logoutSuccess)||e._eventListener.logoutSuccess()}}catch(e){G.Logger.error("ConnectionHandlers: onConnected Status",e)}})},D.login=function(){for(var E=this,c=[],e=0;e<arguments.length;e++)c[e]=arguments[e];return new Promise(function(i,a){try{if(D.loginInProgress){D.isLoggedOut=!0;var t=new b.CometChatException(_.LOGIN_ERROR.REQUEST_IN_PROGRESS);return a(t)}D.loginInProgress=!0,D.isConnectingFromInit=!1,D.localStorage.get(F.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e){var t=new b.CometChatException(_.LOGIN_ERROR.NOT_INITIALIZED);return D.internalRestart||D.pushToLoginListener(t,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(t)}var n=e.toLocaleString();if(E.getInstance(n),D.appId=n,S.LocalStorage.getInstance().set(F.LOCAL_STORE.KEY_APP_ID,n),"object"==typeof c[0]){var r=c[0];c[0].hasOwnProperty("authToken")?c[0]=r.authToken:c[0].hasOwnProperty("username")&&c[0].hasOwnProperty("apiKey")&&(c[0]=r.username,c[1]=r.apiKey)}if(2==c.length){if(G.isFalsy(c[0])||G.isFalsy(c[1])){t=new b.CometChatException(_.ERRORS.PARAMETER_MISSING);return D.internalRestart||D.pushToLoginListener(t,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(t)}}else{if(1!=c.length){t=new b.CometChatException(_.ERRORS.PARAMETER_MISSING);return D.internalRestart||D.pushToLoginListener(t,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(t)}if(G.isFalsy(c[0])){var t=new b.CometChatException(_.ERRORS.PARAMETER_MISSING);return D.internalRestart||D.pushToLoginListener(t,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(t)}}if(G.isFalsy(E.getAppId())){t=new b.CometChatException(_.LOGIN_ERROR.NOT_INITIALIZED);return D.internalRestart||D.pushToLoginListener(t,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(t)}return D.localStorage.get(F.LOCAL_STORE.KEY_USER).then(function(s){if(2==c.length){D.apiKey=c[1];var e=c[0];if(null!=s&&s.uid!==c[0])D.localStorage.clearStore().then(function(){ue.WSLogout(),D.generateAuthToken(e).then(function(e){D.user=new B.Me(e),D.setAuthToken(D.user.getAuthToken()),D.getLoggedInUser().then(function(e){(D.user=new B.Me(e)).setAuthToken(D.authToken),D.setAuthToken(D.user.getAuthToken());var t=D.user;t.setStatus(F.PresenceConstatnts.STATUS.ONLINE),D.localStorage.set("user",t);var n=new B.User(t);i(n),D.isConnectingFromInit||D.internalRestart||(D.pushToLoginListener(n,"Login_Success"),new ne.PostDetails),D.loginInProgress=!1,D.didAnalyticsPingStart()||D.isAnalyticsDisabled||!D.appSettings.shouldAutoEstablishSocketConnection()||(D.pingAnalytics(),D.startAnalyticsPingTimer()),D.isLoggedOut=!1,(D.appSettings.shouldAutoEstablishSocketConnection()||D.internalRestart)&&D.shouldConnectToWS&&D.WSLogin(D.user)},function(e){return D.internalRestart||D.pushToLoginListener(e,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(e)})},function(e){return D.internalRestart||D.pushToLoginListener(e,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(e)})});else{if(!G.isFalsy(D.authToken)){var t=new B.User(E.user);return D.internalRestart||(D.pushToLoginListener(t,"Login_Success"),new ne.PostDetails),D.loginInProgress=!1,D.isLoggedOut=!1,i(t)}if(!G.isFalsy(e)){if(G.isFalsy(D.apiKey)){var n=new b.CometChatException(_.LOGIN_ERROR.UNAUTHORISED);return D.internalRestart||D.pushToLoginListener(n,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(n)}E.generateAuthToken(e).then(function(e){E.user=new B.Me(e),E.setAuthToken(D.user.getAuthToken()),E.getLoggedInUser().then(function(e){E.user=new B.Me(e),E.user.setAuthToken(D.authToken),E.setAuthToken(E.user.getAuthToken()),ue.WSLogout();var t=E.user;t.setStatus(F.PresenceConstatnts.STATUS.ONLINE),E.localStorage.set("user",t);var n=new B.User(t);i(n),D.isConnectingFromInit||D.internalRestart||(D.pushToLoginListener(n,"Login_Success"),new ne.PostDetails),D.loginInProgress=!1,D.didAnalyticsPingStart()||D.isAnalyticsDisabled||!D.appSettings.shouldAutoEstablishSocketConnection()||(D.pingAnalytics(),D.startAnalyticsPingTimer()),D.isLoggedOut=!1,(D.appSettings.shouldAutoEstablishSocketConnection()||D.internalRestart)&&D.shouldConnectToWS&&E.WSLogin(E.user)},function(e){return D.internalRestart||D.pushToLoginListener(e,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(e)})},function(e){return D.internalRestart||D.pushToLoginListener(e,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(e)})}}}else D.authToken=c[0],E.getLoggedInUser().then(function(e){if(e.authToken!=c[0]){var r=E;r.localStorage.clearStore().then(function(){ue.WSLogout(),r.getLoggedInUser().then(function(e){(D.user=new B.Me(e)).setAuthToken(D.authToken),D.setAuthToken(D.user.getAuthToken());var t=D.user;t.setStatus(F.PresenceConstatnts.STATUS.ONLINE),r.localStorage.set("user",t);var n=new B.User(t);i(n),D.isConnectingFromInit||D.internalRestart||(D.pushToLoginListener(n,"Login_Success"),new ne.PostDetails),D.loginInProgress=!1,D.didAnalyticsPingStart()||D.isAnalyticsDisabled||!D.appSettings.shouldAutoEstablishSocketConnection()||(D.pingAnalytics(),D.startAnalyticsPingTimer()),D.isLoggedOut=!1,(D.appSettings.shouldAutoEstablishSocketConnection()||D.internalRestart)&&D.shouldConnectToWS&&D.WSLogin(new B.Me(e))},function(e){return D.internalRestart||D.pushToLoginListener(e,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(e)})})}else{if(s){var t=new B.User(e);return D.internalRestart||(D.pushToLoginListener(t,"Login_Success"),new ne.PostDetails),D.loginInProgress=!1,D.isLoggedOut=!1,i(t)}(D.user=new B.Me(e)).setAuthToken(D.authToken),D.setAuthToken(D.user.getAuthToken());var n=D.user;n.setStatus(F.PresenceConstatnts.STATUS.ONLINE),D.localStorage.set("user",n);var o=new B.User(n);i(o),D.isConnectingFromInit||D.internalRestart||(D.pushToLoginListener(o,"Login_Success"),new ne.PostDetails),D.loginInProgress=!1,D.didAnalyticsPingStart()||D.isAnalyticsDisabled||!D.appSettings.shouldAutoEstablishSocketConnection()||(D.pingAnalytics(),D.startAnalyticsPingTimer()),D.isLoggedOut=!1,(D.appSettings.shouldAutoEstablishSocketConnection()||D.internalRestart)&&D.shouldConnectToWS&&D.WSLogin(new B.Me(e))}},function(e){return D.internalRestart||D.pushToLoginListener(e,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(e)})})})}catch(e){t=new b.CometChatException(e);return D.internalRestart||D.pushToLoginListener(t,"Login_Failure"),D.loginInProgress=!1,D.isLoggedOut=!0,a(t)}})},D.sendMessage=function(a){var e=this;return new Promise(function(s,i){return E(e,void 0,void 0,function(){var t,n,r,o=this;return w(this,function(e){try{return a instanceof l.TextMessage||a instanceof c.MediaMessage||a instanceof N.CustomMessage||a instanceof te.InteractiveMessage||(a=a[F.MessageConstatnts.KEYS.ATTATCHMENT]?(t=F.MessageConstatnts.TYPE.FILE,G.isImage(a[F.MessageConstatnts.KEYS.ATTATCHMENT])?t=F.MessageConstatnts.TYPE.IMAGE:G.isAudio(a[F.MessageConstatnts.KEYS.ATTATCHMENT])?t=F.MessageConstatnts.TYPE.AUDIO:G.isVideo(a[F.MessageConstatnts.KEYS.ATTATCHMENT])&&(t=F.MessageConstatnts.TYPE.VIDEO),new c.MediaMessage(a[F.MessageConstatnts.KEYS.RECEIVER_ID],a[F.MessageConstatnts.KEYS.ATTATCHMENT],t,a[F.MessageConstatnts.KEYS.RECEIVER_TYPE])):new l.TextMessage(a[F.MessageConstatnts.KEYS.RECEIVER_ID],a[F.MessageConstatnts.KEYS.TEXT],a[F.MessageConstatnts.KEYS.RECEIVER_TYPE])),(n=G.validateMessage(a))instanceof b.CometChatException?(i(n),[2]):(a.receiver=a.receiverId,delete a.receiverId,r=a.parentMessageId,[2,K.makeApiCall(r?"sendMessageInThread":"sendMessage",r?{parentId:r}:{},a,a instanceof c.MediaMessage).then(function(n){return E(o,void 0,void 0,function(){var t;return w(this,function(e){return t=C.MessageController.trasformJSONMessge(n.data),A.MessageListnerMaping.getInstance().set("all",parseInt(t.id)),s(t),[2]})})},function(e){i(new b.CometChatException(e.error))})])}catch(e){i(new b.CometChatException(e))}return[2]})})})},D.sendDirectMessage=function(e){try{return Object.assign(e,{receiverType:F.MessageConstatnts.RECEIVER_TYPE.USER}),this.sendMessage(e)}catch(e){G.Logger.error("CometChat: sendDirectMessage",e)}},D.sendGroupMessage=function(e){try{return Object.assign(e,{receiverType:F.MessageConstatnts.RECEIVER_TYPE.GROUP}),this.sendMessage(e)}catch(e){G.Logger.error("CometChat: sendGroupMessage",e)}},D.sendMediaMessage=function(e){try{return this.sendMessage(e)}catch(e){G.Logger.error("CometChat: sendMediaMessage",e)}},D.sendCustomMessage=function(e){try{return this.sendMessage(e)}catch(e){G.Logger.error("CometChat: sendCustomMessage",e)}},D.sendInteractiveMessage=function(e){try{return this.sendMessage(e)}catch(e){G.Logger.error("CometChat: sendInteractiveMessage",e)}},D.getLastDeliveredMessageId=function(){return E(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,A.MessageListnerMaping.getInstance().get(F.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST)];case 1:return[2,e.sent()];case 2:return t=e.sent(),G.Logger.error("CometChat: getLastDeliveredMessageId",t),[3,3];case 3:return[2]}})})},D.startTyping=function(e){try{if(G.isFalsy(e))return;var t=void 0,n=this.RECEIVER_TYPE.USER,r={};if(e instanceof I.TypingIndicator)t=e.getReceiverId(),n=e.getReceiverType(),r=e.getMetadata();else{if(!e.hasOwnProperty(F.TYPING_NOTIFICATION.RECEIVER_ID))return;t=e[F.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(F.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=e[F.TYPING_NOTIFICATION.RECEIVER_TYPE]),e.hasOwnProperty(F.TYPING_NOTIFICATION.META)&&(r=e[F.TYPING_NOTIFICATION.META])}if(G.isFalsy(t))return;if(null==O.TypingNotificationController.getTypingStartedMap(t)){var o=D.getMode();return G.isFalsy(o)||o&&o!==F.APP_SETTINGS.KEYS.NO_TRANSIENT&&o!==F.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(ue.startTypingIndicator(t,n,r),O.TypingNotificationController.addTypingStarted(t),void O.TypingNotificationController.removeTypingEnded(t)):void 0}}catch(e){G.Logger.error("CometChat: startTyping",e)}},D.endTyping=function(e){try{if(G.isFalsy(e))return;var t=void 0,n=this.RECEIVER_TYPE.USER,r={};if(e instanceof I.TypingIndicator)t=e.getReceiverId(),n=e.getReceiverType(),r=e.getMetadata();else{if(!e.hasOwnProperty(F.TYPING_NOTIFICATION.RECEIVER_ID))return;t=e[F.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(F.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=e[F.TYPING_NOTIFICATION.RECEIVER_TYPE]),n=n==this.RECEIVER_TYPE.USER?F.WS.CONVERSATION.TYPE.CHAT:F.WS.CONVERSATION.TYPE.GROUP_CHAT,e.hasOwnProperty(F.TYPING_NOTIFICATION.META)&&(r=e[F.TYPING_NOTIFICATION.META])}if(G.isFalsy(t))return;if(null==O.TypingNotificationController.getTypingEndedMap(t)){var o=D.getMode();return G.isFalsy(o)||o&&o!==F.APP_SETTINGS.KEYS.NO_TRANSIENT&&o!==F.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(ue.pauseTypingIndicator(t,n,r),O.TypingNotificationController.addTypingEnded(t),void O.TypingNotificationController.removeTypingStarted(t)):void 0}}catch(e){G.Logger.error("CometChat: endTyping",e)}},D.markAsRead=function(){for(var E=[],e=0;e<arguments.length;e++)E[e]=arguments[e];return new Promise(function(t,n){try{var e=void 0,r=void 0,o=void 0,s=void 0;if(3===E.length)return n(new b.CometChatException(F.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(G.isFalsy(E[0])||"string"!=typeof E[0])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(e=E[0],G.isFalsy(E[1])||"string"!=typeof E[1])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(r=E[1],G.isFalsy(E[2])||"string"!=typeof E[2])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(o=E[2],G.isFalsy(E[3])||"string"!=typeof E[3])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));s=E[3]}else{if(1!==E.length)return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsRead() expects either 1 or 4 arguments."))));if(G.isFalsy(E[0])||!(E[0]instanceof p.BaseMessage))return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];e=i.getId().toString(),r=(o=i.getReceiverType())===F.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===D.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),s=i.getSender().getUid()}var a=D.getMode();if(!(G.isFalsy(a)||a&&a!==F.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==F.APP_SETTINGS.KEYS.LIMITED_TRANSIENT))return n(new b.CometChatException(F.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED));if(D.getConnectionStatus()===F.CONNECTION_STATUS.CONNECTED)return ue.markAsRead(r,o,e,s),t();K.makeApiCall(o===F.MessageConstatnts.RECEIVER_TYPE.USER?"markAsReadForUser":"markAsReadForGroup",o===F.MessageConstatnts.RECEIVER_TYPE.USER?{uid:r}:{guid:r},{messageId:e}).then(function(e){return t()},function(e){return n(new b.CometChatException(e.error))})}catch(e){return G.Logger.error("CometChat: markAsRead",e),n(new b.CometChatException(F.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},D.markAsDelivered=function(){for(var E=[],e=0;e<arguments.length;e++)E[e]=arguments[e];return new Promise(function(t,n){try{var e=void 0,r=void 0,o=void 0,s=void 0;if(3===E.length)return n(new b.CometChatException(F.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(G.isFalsy(E[0])||"string"!=typeof E[0])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(e=E[0],G.isFalsy(E[1])||"string"!=typeof E[1])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(r=E[1],G.isFalsy(E[2])||"string"!=typeof E[2])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(o=E[2],G.isFalsy(E[3])||"string"!=typeof E[3])return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));s=E[3]}else{if(1!==E.length)return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsDelivered() expects either 1 or 4 arguments."))));if(G.isFalsy(E[0])||!(E[0]instanceof p.BaseMessage))return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];e=i.getId().toString(),r=(o=i.getReceiverType())===F.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===D.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),s=i.getSender().getUid()}var a=D.getMode();if(!(G.isFalsy(a)||a&&a!==F.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==F.APP_SETTINGS.KEYS.LIMITED_TRANSIENT))return n(new b.CometChatException(F.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED));if(D.getConnectionStatus()===F.CONNECTION_STATUS.CONNECTED)return ue.markAsDelivered(r,o,e,s),t();K.makeApiCall(o===F.MessageConstatnts.RECEIVER_TYPE.USER?"markAsDeliveredForUser":"markAsDeliveredForGroup",o===F.MessageConstatnts.RECEIVER_TYPE.USER?{uid:r}:{guid:r},{messageId:e}).then(function(e){return t(e)},function(e){return n(new b.CometChatException(e.error))})}catch(e){return G.Logger.error("CometChat: markAsDelivered",e),n(new b.CometChatException(F.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},D.sendTransientMessage=function(e){try{if(G.isFalsy(e))return;var t=void 0,n=void 0,r={};if(!(e instanceof j.TransientMessage))return;if(t=e.getReceiverId(),n=e.getReceiverType(),r=e.getData(),G.isFalsy(t)||G.isFalsy(n))return;var o=D.getMode();return G.isFalsy(o)||o&&o!==F.APP_SETTINGS.KEYS.NO_TRANSIENT?void ue.sendTransientMessage(t,n,r):void 0}catch(e){G.Logger.error("CometChat: startTyping",e)}},D.getMessageDetails=function(e){return new Promise(function(t,n){try{G.isFalsy(e)?n(new b.CometChatException(_.ERRORS.PARAMETER_MISSING)):K.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){t(C.MessageController.trasformJSONMessge(e.data))},function(e){G.Logger.error("CometChat:GetMessageDetails:",e),n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.getMessageReceipts=function(r){return new Promise(function(t,n){try{var e=G.validateMsgId(r);if(e instanceof b.CometChatException)return void n(e);G.isFalsy(r)?n(new b.CometChatException(_.ERRORS.PARAMETER_MISSING)):K.makeApiCall("getMessageDetails",{messageId:r}).then(function(e){C.MessageController.getReceiptsFromJSON(e.data).then(function(e){t(e)},function(e){n(new b.CometChatException(e))})},function(e){G.Logger.error("CometChat:GetMessageDetails:",e),n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.getUnreadMessageCount=function(n){void 0===n&&(n=!1);var o=0;return new Promise(function(r,t){try{var e=G.validateHideMessagesFromBlockedUsers(n);if(e instanceof b.CometChatException)return void t(e);n&&(o=1),K.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:o}).then(function(e){var t={},n={};e.data.map(function(e){e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==F.MessageConstatnts.RECEIVER_TYPE.GROUP?n[e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:t[e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),r({users:t,groups:n})},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getUnreadMessageCountForAllUsers=function(r){void 0===r&&(r=!1);var o=0;return new Promise(function(n,t){try{var e=G.validateHideMessagesFromBlockedUsers(r);if(e instanceof b.CometChatException)return void t(e);r&&(o=1),K.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:o,receiverType:F.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){t[e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(d({},t))},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getUnreadMessageCountForAllGroups=function(r){void 0===r&&(r=!1);var o=0;return new Promise(function(n,t){try{var e=G.validateHideMessagesFromBlockedUsers(r);if(e instanceof b.CometChatException)return void t(e);r&&(o=1),K.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:o,receiverType:F.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==F.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(d({},t))},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getUnreadMessageCountForUser=function(o,s){void 0===s&&(s=!1);var i=0;return new Promise(function(n,t){try{var e=G.validateId(o,"user");if(e instanceof b.CometChatException)return void t(e);var r=G.validateHideMessagesFromBlockedUsers(s);if(r instanceof b.CometChatException)return void t(r);s&&(i=1),K.makeApiCall("getUserMessages",{listId:o},{hideMessagesFromBlockedUsers:i,unread:1,count:1,uid:o}).then(function(e){var t={};e.data.map(function(e){t[e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(d({},t))},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getUnreadMessageCountForGroup=function(o,s){void 0===s&&(s=!1);var i=0;return new Promise(function(n,t){try{var e=G.validateId(o,"group");if(e instanceof b.CometChatException)return void t(e);var r=G.validateHideMessagesFromBlockedUsers(s);if(r instanceof b.CometChatException)return void t(r);s&&(i=1),K.makeApiCall("getGroupMessages",{listId:o},{hideMessagesFromBlockedUsers:i,unread:1,count:1,guid:o}).then(function(e){var t={};e.data.map(function(e){e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==F.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[F.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(d({},t))},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.addReaction=function(r,o){return new Promise(function(n,t){try{var e=G.validateMsgId(r);if(e instanceof b.CometChatException)return void t(e);G.isFalsy(r)||G.isFalsy(o)?t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING)):K.makeApiCall("addReaction",{messageId:r,reaction:encodeURIComponent(o)}).then(function(e){var t=C.MessageController.trasformJSONMessge(e.data);n(t)},function(e){G.Logger.error("CometChat:addReaction:",e),t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.removeReaction=function(r,o){return new Promise(function(n,t){try{var e=G.validateMsgId(r);if(e instanceof b.CometChatException)return void t(e);G.isFalsy(r)||G.isFalsy(o)?t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING)):K.makeApiCall("removeReaction",{messageId:r,reaction:encodeURIComponent(o)}).then(function(e){var t=C.MessageController.trasformJSONMessge(e.data);n(t)},function(e){G.Logger.error("CometChat:removeReaction:",e),t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.editMessage=function(r){return new Promise(function(t,n){try{var e=G.validateMsgId(r.getId());if(e instanceof b.CometChatException)return void n(e);K.makeApiCall("updateMessage",{messageId:r.getId()},r).then(function(e){t(C.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.deleteMessage=function(r){return new Promise(function(t,n){try{var e=G.validateMsgId(r);if(e instanceof b.CometChatException)return void n(e);K.makeApiCall("deleteMessage",{messageId:r},{id:r}).then(function(e){t(C.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.getOnlineUserCount=function(){return new Promise(function(r,o){try{G.getAppSettings().then(function(e){var t=G.format((new u.EndpointFactory).wsApi,G.getChatHost(e),G.format(F.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,e[F.APP_SETTINGS.KEYS.WS_API_VERSION])),n={appId:D.appId,Authorization:D.jwt,Accept:"application/json","Content-Type":"application/json"};K.postData(t,"POST",{},n,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(F.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?r(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ONLINE_MEMBER_COUNT_API.RESPONSE.ONLINE_USERS_COUNT]):o(new b.CometChatException(e.error))}).catch(function(){var e={error:_.FETCH_ERROR.ERROR_IN_API_CALL};return o(e)})},function(e){return o(new b.CometChatException(e))})}catch(e){return o(new b.CometChatException(e))}})},D.getOnlineGroupMemberCount=function(i){return new Promise(function(o,s){try{if(!i||0==i.length)return s(new b.CometChatException(F.ONLINE_MEMBER_COUNT_API.ERRORS.INVALID_GROUPLIST));G.getAppSettings().then(function(e){var t=G.format((new u.EndpointFactory).wsApi,G.getChatHost(e),G.format(F.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,e[F.APP_SETTINGS.KEYS.WS_API_VERSION])),n={groups:i},r={appId:D.appId,Authorization:D.jwt,Accept:"application/json","Content-Type":"application/json"};K.postData(t,"POST",n,r,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(F.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ONLINE_MEMBER_COUNT_API.RESPONSE.GROUPS]):s(new b.CometChatException(e.error))}).catch(function(){var e={error:_.FETCH_ERROR.ERROR_IN_API_CALL};return s(e)})},function(e){return s(new b.CometChatException(e))})}catch(e){return s(new b.CometChatException(e))}})},D.createUser=function(o,s){return new Promise(function(n,t){try{if(G.isFalsy(s))return void t(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));D.apiKey=s;var e=G.validateCreateUser(o);if(e instanceof b.CometChatException)return void t(e);if(!(o instanceof B.User)){var r=void 0;if(!o.hasOwnProperty(F.UserConstants.UID))return void t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING));if(!o.hasOwnProperty(F.UserConstants.NAME))return void t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING));r=new B.User(o[F.UserConstants.UID],o[F.UserConstants.NAME]),o.hasOwnProperty(F.UserConstants.AVATAR)&&r.setAvatar(o[F.UserConstants.AVATAR]),o.hasOwnProperty(F.UserConstants.ROLE)&&r.setRole(o[F.UserConstants.ROLE]),o.hasOwnProperty(F.UserConstants.META_DATA)&&r.setMetadata(o[F.UserConstants.META_DATA]),o.hasOwnProperty(F.UserConstants.LINK)&&r.setLink(o[F.UserConstants.LINK]),o.hasOwnProperty(F.UserConstants.STATUS_MESSAGE)&&r.setStatusMessage(o[F.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(F.UserConstants.TAGS)&&r.setTags(o[F.UserConstants.TAGS]),o=r}K.makeApiCall("createUser",{},o).then(function(e){var t=h.UsersController.trasformJSONUser(e.data);n(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.updateUser=function(r,i){var a=this;return new Promise(function(o,t){try{if(G.isFalsy(i))return void t(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));D.apiKey=i;var e=G.validateUpdateUser(r);if(e instanceof b.CometChatException)return void t(e);if(!(r instanceof B.User)){var n=void 0;if(!r.hasOwnProperty(F.UserConstants.UID))return void t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING));n=new B.User(r[F.UserConstants.UID]),r.hasOwnProperty(F.UserConstants.NAME)&&n.setName(r[F.UserConstants.NAME]),r.hasOwnProperty(F.UserConstants.AVATAR)&&n.setAvatar(r[F.UserConstants.AVATAR]),r.hasOwnProperty(F.UserConstants.ROLE)&&n.setRole(r[F.UserConstants.ROLE]),r.hasOwnProperty(F.UserConstants.META_DATA)&&n.setMetadata(r[F.UserConstants.META_DATA]),r.hasOwnProperty(F.UserConstants.LINK)&&n.setLink(r[F.UserConstants.LINK]),r.hasOwnProperty(F.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(r[F.UserConstants.STATUS_MESSAGE]),r.hasOwnProperty(F.UserConstants.TAGS)&&n.setTags(r[F.UserConstants.TAGS]),r=n}var s=r.uid;K.makeApiCall("updateUser",{uid:s},r).then(function(r){if(a.user&&s.toLocaleLowerCase()===a.user.getUid().toLocaleLowerCase())S.LocalStorage.getInstance().get("user").then(function(e){if(e){var t=h.UsersController.trasformJSONUser(r.data),n=r.data;n.wsChannel=e.wsChannel,n.authToken=D.authToken,n.status=F.PresenceConstatnts.STATUS.ONLINE,e.jwt&&(n.jwt=e.jwt),D.user=new B.Me(n),a.localStorage.set("user",D.user),o(t)}});else{var e=h.UsersController.trasformJSONUser(r.data);o(e)}},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.updateCurrentUserDetails=function(o){var s=this;return new Promise(function(r,t){try{o.uid=s.user.uid;var e=G.validateUpdateUser(o);if(e instanceof b.CometChatException)return void t(e);if(!(o instanceof B.User)){var n=void 0;o.hasOwnProperty(F.UserConstants.UID)&&(n=new B.User(o[F.UserConstants.UID])),o.hasOwnProperty(F.UserConstants.NAME)&&n.setName(o[F.UserConstants.NAME]),o.hasOwnProperty(F.UserConstants.AVATAR)&&n.setAvatar(o[F.UserConstants.AVATAR]),o.hasOwnProperty(F.UserConstants.ROLE)&&n.setRole(o[F.UserConstants.ROLE]),o.hasOwnProperty(F.UserConstants.META_DATA)&&n.setMetadata(o[F.UserConstants.META_DATA]),o.hasOwnProperty(F.UserConstants.LINK)&&n.setLink(o[F.UserConstants.LINK]),o.hasOwnProperty(F.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(o[F.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(F.UserConstants.TAGS)&&n.setTags(o[F.UserConstants.TAGS]),o=n}K.makeApiCall("updateMyDetails",{},o).then(function(e){var t=h.UsersController.trasformJSONUser(e.data),n=D.user=new B.Me(e.data);n.setStatus(F.PresenceConstatnts.STATUS.ONLINE),D.localStorage.set("user",n),r(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getUser=function(r){return new Promise(function(n,t){try{"object"==typeof r&&r.hasOwnProperty("uid")&&(r=r.uid);var e=G.validateId(r,"user");if(e instanceof b.CometChatException)return void t(e);K.makeApiCall("user",{uid:r}).then(function(e){var t=h.UsersController.trasformJSONUser(e.data);n(t)}).catch(function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getLoggedInUser=function(){var l=this;return new Promise(function(u,p){try{D.localStorage.get(F.LOCAL_STORE.KEY_USER).then(function(e){if(e)D.user=new B.Me(e),u(D.user);else{var s="",i="",a=F.APPINFO.platform,E=F.APPINFO.sdkVersion,c=F.APPINFO.apiVersion;D.keyStore.get(F.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(i=e,navigator&&(s=navigator.userAgent),null==i){var t=ce(),n=(new Date).getTime();i=l.appId+"_"+t+"_"+n,D.keyStore.set(F.LOCAL_STORE.KEY_DEVICE_ID,i)}var r={version:E,apiVersion:c,userAgent:s};G.isFalsy(l.platform)||(r.platform=l.platform),G.isFalsy(l.language)||(r.language=l.language),G.isFalsy(l.resource)||(r.resource=l.resource);var o={platform:a,deviceId:i,appInfo:r};K.makeApiCall("updateMyDetails",{},o,!1).then(function(e){e.data.jwt&&(D.jwt=e.data.jwt);var t=e.data.settings;t&&(S.LocalStorage.getInstance().set("app_settings",t),t[F.APP_SETTINGS.KEYS.MODE]&&D.setMode(t[F.APP_SETTINGS.KEYS.MODE]),t[F.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(D.settingsHash=t[F.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[F.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(D.settingsHashReceivedAt=t[F.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),D.isAnalyticsDisabled=!!t[F.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],t[F.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(D.SECURED_MEDIA_HOST=t[F.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST])),u(new B.Me(e.data))},function(e){p(new b.CometChatException(e.error))}).catch(function(e){p(new b.CometChatException(e))})})}})}catch(e){p(new b.CometChatException(e))}})},D.getLoggedinUser=function(){return new Promise(function(t,n){try{D.localStorage.get(F.LOCAL_STORE.KEY_USER).then(function(e){t(e?new B.User(e):null)},function(e){t(null)})}catch(e){n(new b.CometChatException(e))}})},D.blockUsers=function(r){return new Promise(function(t,n){try{var e=G.validateArray(r,"blockUsers");if(e instanceof b.CometChatException)return void n(e);G.isFalsy(r)?n(new b.CometChatException(_.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):K.makeApiCall("blockUsers",{},{blockedUids:r}).then(function(e){t(e.data)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.unblockUsers=function(r){return new Promise(function(t,n){try{var e=G.validateArray(r,"unblockUsers");if(e instanceof b.CometChatException)return void n(e);G.isFalsy(r)?n(new b.CometChatException(_.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):K.makeApiCall("unblockUsers",{},{blockedUids:r}).then(function(e){t(e.data)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.getConversation=function(i,a){return new Promise(function(n,r){try{var e=G.validateConversationType(a);if(e instanceof b.CometChatException)return void r(e);var t=G.validateId(i,a);if(t instanceof b.CometChatException)return void r(t);a=a.toLowerCase(),i=i.toLowerCase();var o={},s="";a===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="getGroupConversation",o.guid=i):(s="getUserConversation",o.uid=i),K.makeApiCall(s,o).then(function(e){if(e.data){var t=e.data;n(L.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[],t.unreadMentionsCount,t.lastReadMessageId))}else r(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(e){r(new b.CometChatException(e.error))})}catch(e){r(new b.CometChatException(e))}})},D.tagConversation=function(i,a,E){return void 0===E&&(E=[]),new Promise(function(n,r){try{var e=G.validateConversationType(a);if(e instanceof b.CometChatException)return void r(e);var t=G.validateId(i,a);if(t instanceof b.CometChatException)return void r(t);a=a.toLowerCase(),i=i.toLowerCase();var o={},s="";a===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="updateGroupConversation",o.guid=i):(s="updateUserConversation",o.uid=i),K.makeApiCall(s,o,{tags:E}).then(function(e){if(e.data){var t=e.data;n(L.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[],t.unreadMentionsCount,t.lastReadMessageId))}else r(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(e){r(new b.CometChatException(e.error))})}catch(e){r(new b.CometChatException(e))}})},D.deleteConversation=function(i,a){return new Promise(function(t,n){try{var e=G.validateConversationType(a);if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(i,a);if(r instanceof b.CometChatException)return void n(r);var o={},s="";a=a.toLowerCase(),i=i.toLowerCase(),a===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="deleteGroupConversation",o.guid=i):(s="deleteUserConversation",o.uid=i),K.makeApiCall(s,o).then(function(e){t("Conversation deleted successfully.")},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.createGroup=function(o){return new Promise(function(t,n){try{var e=G.validateCreateGroup(o);if(e instanceof b.CometChatException)return void n(e);if(!(o instanceof a.Group)){var r=void 0;if(!o.hasOwnProperty(F.GroupConstants.KEYS.GUID))return void n(new b.CometChatException(_.ERRORS.PARAMETER_MISSING));if(!o.hasOwnProperty(F.GroupConstants.KEYS.NAME))return void n(new b.CometChatException(_.ERRORS.PARAMETER_MISSING));if(r=new a.Group(o[F.GroupConstants.KEYS.GUID],o[F.GroupConstants.KEYS.NAME],""),o.hasOwnProperty(F.GroupConstants.KEYS.TYPE))if(o[F.GroupConstants.KEYS.TYPE].toLocaleLowerCase()==F.GroupType.Password){if(!o.hasOwnProperty(F.GroupConstants.KEYS.PASSWORD))return void n(new b.CometChatException(_.GROUP_CREATION_ERRORS.EMPTY_PASSWORD));r.setType(F.GROUP_TYPE.PASSWORD),r.setPassword(o[F.GroupConstants.KEYS.PASSWORD])}else r.setType(o[F.GroupConstants.KEYS.TYPE]);else r.setType(F.GROUP_TYPE.PUBLIC);o.hasOwnProperty(F.GroupConstants.KEYS.ICON)&&r.setIcon(o[F.GroupConstants.KEYS.ICON]),o.hasOwnProperty(F.GroupConstants.KEYS.DESCRIPTION)&&r.setDescription(o[F.GroupConstants.KEYS.DESCRIPTION]),o.hasOwnProperty(F.GroupConstants.KEYS.TAGS)&&r.setTags(o[F.GroupConstants.KEYS.TAGS]),o=r}K.makeApiCall("createGroup",{},o).then(function(e){f.GroupsController.trasformJSONGroup(e.data).setHasJoined(!0),t(f.GroupsController.trasformJSONGroup(e.data))},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.getGroup=function(r){return new Promise(function(t,n){try{"object"==typeof r&&r.hasOwnProperty("guid")&&(r=r.guid);var e=G.validateId(r,"group");if(e instanceof b.CometChatException)return void n(e);K.makeApiCall("getGroup",{guid:r}).then(function(e){t(f.GroupsController.trasformJSONGroup(e.data))},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.joinGroup=function(o,s,i){return void 0===s&&(s=F.GroupType.Public),void 0===i&&(i=""),new Promise(function(n,t){try{var e=G.validateJoinGroup(o,s,i);if(e instanceof b.CometChatException)return void t(e);var r=void 0;"object"==typeof o&&(o.hasOwnProperty(F.GroupConstants.KEYS.GUID)?(o.hasOwnProperty(F.GroupConstants.KEYS.TYPE)&&(s=o[F.GroupConstants.KEYS.TYPE],o[F.GroupConstants.KEYS.TYPE].toLocaleLowerCase()===F.GroupType.Password&&o.hasOwnProperty(F.GroupConstants.KEYS.PASSWORD)&&(i=o[F.GroupConstants.KEYS.PASSWORD])),o=o[F.GroupConstants.KEYS.GUID]):t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING))),r=G.isFalsy(i)?new a.Group(o,"name",s):new a.Group(o,"name",s,i),K.makeApiCall("joinGroup",r,r).then(function(e){var t=f.GroupsController.trasformJSONGroup(e.data[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ActionConstatnts.ACTION_KEYS.ENTITIES][F.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][F.ActionConstatnts.ACTION_KEYS.ENTITY]);t.setHasJoined(!0),n(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.updateGroup=function(o){return new Promise(function(t,n){try{var e=G.validateUpdateGroup(o);if(e instanceof b.CometChatException)return void n(e);if(!(o instanceof a.Group)){var r=void 0;if(!o.hasOwnProperty(F.GroupConstants.KEYS.GUID))return void n(new b.CometChatException(_.ERRORS.PARAMETER_MISSING));r=new a.Group(F.GroupConstants.KEYS.GUID,"",""),o.hasOwnProperty(F.GroupConstants.KEYS.TYPE)?r.setType(o[F.GroupConstants.KEYS.TYPE]):(o[F.GroupConstants.KEYS.TYPE]=F.GROUP_TYPE.PUBLIC,r.setType[F.GROUP_TYPE.PUBLIC]),o.hasOwnProperty(F.GroupConstants.KEYS.NAME)&&r.setName(o[F.GroupConstants.KEYS.NAME]),o.hasOwnProperty(F.GroupConstants.KEYS.ICON)&&r.setIcon(o[F.GroupConstants.KEYS.ICON]),o.hasOwnProperty(F.GroupConstants.KEYS.DESCRIPTION)&&r.setDescription(o[F.GroupConstants.KEYS.DESCRIPTION]),o.hasOwnProperty(F.GroupConstants.KEYS.TAGS)&&r.setTags(o[F.GroupConstants.KEYS.TAGS]),o=r}K.makeApiCall("updateGroup",o,o).then(function(e){t(f.GroupsController.trasformJSONGroup(e.data))},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.deleteGroup=function(r){return new Promise(function(t,n){try{var e=G.validateId(r,"group");if(e instanceof b.CometChatException)return void n(e);K.makeApiCall("deleteGroup",{guid:r}).then(function(e){t(!0)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.leaveGroup=function(r){return new Promise(function(t,n){try{var e=G.validateId(r,"group");if(e instanceof b.CometChatException)return void n(e);K.makeApiCall("leaveGroup",{guid:r}).then(function(e){t(!0)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.kickGroupMember=function(o,s){return new Promise(function(t,n){try{var e=G.validateId(o,"group");if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(s,"user");if(r instanceof b.CometChatException)return void n(r);K.makeApiCall("kickGroupMembers",{guid:o,uid:s}).then(function(e){t(!0)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.updateGroupMemberScope=function(s,i,a){return new Promise(function(t,n){try{var e=G.validateId(s,"group");if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(i,"user");if(r instanceof b.CometChatException)return void n(r);var o=G.validateScope(a);if(o instanceof b.CometChatException)return void n(o);K.makeApiCall("changeScopeOfMember",{guid:s,uid:i},{scope:a}).then(function(e){t(!0)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.banGroupMember=function(o,s){return new Promise(function(t,n){try{var e=G.validateId(o,"group");if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(s,"user");if(r instanceof b.CometChatException)return void n(r);K.makeApiCall("banGroupMember",{guid:o,uid:s}).then(function(e){t(!0)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.unbanGroupMember=function(o,s){return new Promise(function(t,n){try{var e=G.validateId(o,"group");if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(s,"user");if(r instanceof b.CometChatException)return void n(r);K.makeApiCall("unbanGroupMember",{guid:o,uid:s}).then(function(e){t(!0)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.addMembersToGroup=function(i,a,E){var c=[],u=[],p=[],l=[];return new Promise(function(e,t){try{var n=G.validateId(i,"group");if(n instanceof b.CometChatException)return void t(n);var r=G.validateArray(a,"groupMembers");if(r instanceof b.CometChatException)return void t(r);if(E){var o=G.validateArray(E,"bannedMembers");if(o instanceof b.CometChatException)return void t(o)}G.isFalsy(a)&&G.isFalsy(E)?t(new b.CometChatException({})):G.isFalsy(a)||G.isFalsy(E)?G.isFalsy(a)?E.map(function(e){l.push(e)}):(a.filter(function(e){if(e.getScope()==F.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){c.push(e.getUid())}),a.filter(function(e){if(e.getScope()==F.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){u.push(e.getUid())}),a.filter(function(e){if(e.getScope()==F.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){p.push(e.getUid())})):(a.filter(function(e){if(e.getScope()==F.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){c.push(e.getUid())}),a.filter(function(e){if(e.getScope()==F.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){u.push(e.getUid())}),a.filter(function(e){if(e.getScope()==F.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){p.push(e.getUid())}),E.map(function(e){l.push(e)}));var s={};G.isFalsy(c)||(s=d(d({},s),{admins:c})),G.isFalsy(p)||(s=d(d({},s),{participants:p})),G.isFalsy(u)||(s=d(d({},s),{moderators:u})),G.isFalsy(l)||(s=d(d({},s),{usersToBan:l})),K.makeApiCall("addMemebersToGroup",{guid:i},s).then(function(t){var n={};Object.keys(t.data.admins).map(function(e){t.data.admins[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.admins[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.participants).map(function(e){t.data.participants[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.participants[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.moderators).map(function(e){t.data.moderators[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.moderators[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.usersToBan).map(function(e){t.data.usersToBan[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.usersToBan[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),e(n)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.transferGroupOwnership=function(o,s){return new Promise(function(n,t){try{var e=G.validateId(o,"group");if(e instanceof b.CometChatException)return void t(e);var r=G.validateId(s,"user");if(r instanceof b.CometChatException)return void t(r);K.makeApiCall("transferOwnership",{guid:o},{owner:s}).then(function(e){var t;t=e&&e.data&&e.data.message?e.data.message:"Ownership transferred to user "+s+" for the group with guid "+o+".",n(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.createGroupWithMembers=function(i,a,E){var c=[],u=[],p=[],l=[];return new Promise(function(s,t){try{var e=G.validateCreateGroup(i);if(e instanceof b.CometChatException)return void t(e);if(a&&0<a.length){var n=G.validateArray(a,"groupMembers");if(n instanceof b.CometChatException)return void t(n);a.map(function(e){e.getScope()===F.GROUP_MEMBER_SCOPE.ADMIN&&c.push(e.getUid()),e.getScope()===F.GROUP_MEMBER_SCOPE.MODERATOR&&u.push(e.getUid()),e.getScope()===F.GROUP_MEMBER_SCOPE.PARTICIPANT&&p.push(e.getUid())})}if(E&&0<E.length){var r=G.validateArray(E,"bannedMembers");if(r instanceof b.CometChatException)return void t(r);E.map(function(e){l.push(e)})}var o={};o=d({},i),G.isFalsy(c)||(o.members=d(d({},o.members),{admins:c})),G.isFalsy(p)||(o.members=d(d({},o.members),{participants:p})),G.isFalsy(u)||(o.members=d(d({},o.members),{moderators:u})),G.isFalsy(l)||(o.members=d(d({},o.members),{usersToBan:l})),K.makeApiCall("createGroup",{},o).then(function(e){var t={members:{}},n=e.data.members.data?e.data.members.data:{admins:{},moderators:{},participants:{},usersToBan:{}};Object.keys(n.admins).map(function(e){n.admins[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.admins[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.participants).map(function(e){n.participants[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.participants[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.moderators).map(function(e){n.moderators[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.moderators[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.usersToBan).map(function(e){n.usersToBan[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.usersToBan[e][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][F.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),delete e.data.members;var r=e.data,o=f.GroupsController.trasformJSONGroup(r);o.setHasJoined(!0),t=d(d({},t),{group:o}),s(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.initiateCall=function(t){var o=this;return new Promise(function(n,r){if(G.isCallingComponentInstalled()){var e=o.getActiveCall();if(null===e)try{G.isFalsy(JSON.parse(JSON.stringify(t)).sender)?G.isFalsy(e)?(t.setStatus(F.CallConstants.CALL_STATUS.INITIATED),t.receiver=t.receiverId.toString(),delete t.receiverId,K.makeApiCall("createCallSession",{},t).then(function(e){var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);x.CallController.getInstance().initiateCall(t).then(function(e){n(t)}).catch(function(e){r(new b.CometChatException(e))})},function(e){r(new b.CometChatException(e.error))})):r(new b.CometChatException(F.CALL_ERROR.ERROR_IN_CALLING)):x.CallController.getInstance().initiateCall(t).then(function(e){n(Object.assign(t))}).catch(function(e){r(new b.CometChatException(e))})}catch(e){r(new b.CometChatException(e))}else r(new b.CometChatException(F.CALL_ERROR.CALL_ALREADY_INITIATED))}else r(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))})},D.acceptCall=function(r){var o=this;return new Promise(function(n,t){if(G.isCallingComponentInstalled())if(null===o.getActiveCall())try{var e={};e[F.CallConstants.CALL_KEYS.CALL_STATUS]=F.CallConstants.CALL_STATUS.ONGOING,K.makeApiCall("updateCallSession",{sessionid:r},e).then(function(e){var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);x.CallController.getInstance().onCallStarted(t),n(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}else t(new b.CometChatException(F.CALL_ERROR.CANNOT_ACCEPT_CALL));else t(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))})},D.rejectCall=function(e,t){try{switch(t){case F.CallConstants.CALL_STATUS.REJECTED:return this.rejectIncomingCall(e);case F.CallConstants.CALL_STATUS.CANCELLED:return this.cancelCall(e);case F.CallConstants.CALL_STATUS.BUSY:return this.sendBusyResponse(e);default:return this.endCall(e)}}catch(e){G.Logger.error("CometChat: rejectCall",e)}},D.endCall=function(o){var s=this;return new Promise(function(n,t){if(G.isCallingComponentInstalled()){var r=s.getActiveCall();if(null!==r){if(r.getSessionId()===o)try{var e={};e[F.CallConstants.CALL_KEYS.CALL_STATUS]=F.CallConstants.CALL_STATUS.ENDED,r.getJoinedAt()&&(e[F.CallConstants.CALL_KEYS.CALL_JOINED_AT]=r.getJoinedAt()),K.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){x.CallController.getInstance().endSession();var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t),x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onCallEnded(t),x.CallController.getInstance().endCall()},function(e){G.Logger.log("calling Log",{error:e}),x.CallController.getInstance().endSession(),r.setStatus(F.CallConstants.CALL_STATUS.ENDED),n(r),x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onCallEnded(r),x.CallController.getInstance().endCall()})}catch(e){t(new b.CometChatException(e))}}else x.CallController.getInstance().endSession(),x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null),x.CallController.getInstance().endCall(),n(null)}else t(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))})},D.getActiveCall=function(){try{return x.CallController.getInstance().getActiveCall()}catch(e){G.Logger.error("CometChat: getActiveCall",e)}},D.startCall=function(U){return E(this,void 0,void 0,function(){var r,o,s,i,a,E,c,u,p,l,d,S,C,h,f,_,T,g,R,A,I,O,N,m,y,P,v,M,t,n,L=this;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),o=this.getActiveCall(),d=l=!(p=u=c=E=a=!(i=!1)),S=F.CallConstants.CALL_MODE.DEFAULT,T={},R=g=!0,O=I=!(A="circle"),P=this.user,[4,G.getCallingComponentVersion()];case 1:return t=e.sent(),M=3===t?Y.CometChatCalling.Calling:2===t?Ee:null,G.getAppSettings().then(function(e){if(_=e[F.APP_SETTINGS.KEYS.WEBRTC_HOST],T[F.APP_SETTINGS.KEYS.ANALYTICS_HOST]=e[F.APP_SETTINGS.KEYS.ANALYTICS_HOST],T[F.APP_SETTINGS.KEYS.ANALYTICS_VERSION]=e[F.APP_SETTINGS.KEYS.ANALYTICS_VERSION],T[F.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]=e[F.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],T[F.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL]=e[F.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL],h=e[F.APP_SETTINGS.KEYS.REGION],U.getCallEventListener()&&x.CallController.getInstance().setCallListner(U.getCallEventListener()),M)if(G.isFalsy(L.appSettings))x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.NOT_INITIALIZED));else if(h)if(P)if((v=new k.RTCUser(P.getUid())).setName(P.getName()),v.setAvatar(P.getAvatar()),v.setResource(D.getSessionId()),D.appId)if(f=D.appId,G.isFalsy(U))x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.CALL_SETTINGS_REQUIRED));else{if(o){var t=o.getType();i=t===F.CallConstants.CALL_TYPE.AUDIO,s=o.getSessionId()}else{if(i=U.isAudioOnlyCall(),G.isFalsy(U.getSessionId()))return void(x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.SESSION_ID_REQUIRED)));s=("v1."+h+"."+D.getAppId()+"."+U.getSessionId()).toLowerCase()}if(s){a=U.isDefaultLayoutEnabled(),E=U.isPauseVideoButtonEnabled(),c=U.isMuteAudioButtonEnabled(),u=U.isEndCallButtonEnabled(),p=U.isAudioModeButtonEnabled(),S=U.getMode(),l=U.getStartWithAudioMuted(),d=U.getStartWithVideoMuted(),C=U.getDefaultAudioMode(),R=i?(g=U.isAudioToVideoButtonEnabled(),!1):(g=!1,U.isSwitchCameraButtonEnabled()),A=U.getAvatarMode(),I=U.isRecordingButtonEnabled(),O=U.shouldStartRecordingOnCallStart(),N=U.getMainVideoContainerSetting(),m=U.isVideoTileClickEnabled(),y=U.isVideoTileDragEnabled();var n={uid:P.getUid(),sessionId:s};D.getJWT(n).then(function(e){e.hasOwnProperty("token")?(v.setJWT(e.token),r=(new V.CallSettingsBuilder).setSessionID(s).enableDefaultLayout(a).setIsAudioOnlyCall(i).setUser(v).setRegion(h).setAppId(f).setDomain(_).showEndCallButton(u).showMuteAudioButton(c).showPauseVideoButton(E).showAudioModeButton(p).setMode(S).startWithAudioMuted(l).startWithVideoMuted(d).setAnalyticsSettings(T).setDefaultAudioMode(C).showSwitchToVideoCallButton(g).showSwitchCameraButton(R).setAvatarMode(A).showRecordingButton(I).startRecordingOnCallStart(O).setMainVideoContainerSetting(N).enableVideoTileClick(m).enableVideoTileDrag(y).build(),M.startCall({callsettings:JSON.stringify(r)}),M.addListener("ON_CALL_END_BUTTON_PRESSED",function(e){G.Logger.log("CALLING_EVENT","ON_CALL_END_BUTTON_PRESSED"),o?D.endCall(r.getSessionId()):x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null),M.endCallSession()}),M.addListener("ON_CALL_ENDED",function(e){G.Logger.log("CALLING_EVENT","ON_CALL_ENDED"),o&&(D.endCall(r.getSessionId()),M.endCallSession())}),M.addListener("ON_USER_JOINED",function(e){if(G.Logger.log("CALLING_EVENT","ON_USER_JOINED"),e){var t=void 0,n=e;G.isFalsy(n.uid)||G.isFalsy(n.name)||((t=new B.User(n)).setStatus("online"),D.user.getUid().toLowerCase()!=t.getUid().toLowerCase()&&x.CallController.getInstance().getCallListner()&&(G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onUserJoined)||x.CallController.getInstance().getCallListner()._eventListener.onUserJoined(t)))}}),M.addListener("ON_USER_LEFT",function(e){if(G.Logger.log("CALLING_EVENT","ON_USER_LEFT"),e){var t=void 0,n=e;G.isFalsy(n.uid)||G.isFalsy(n.name)||((t=new B.User(n)).setStatus("online"),D.user.getUid().toLowerCase()!=t.getUid().toLowerCase()&&x.CallController.getInstance().getCallListner()&&(G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onUserLeft)||x.CallController.getInstance().getCallListner()._eventListener.onUserLeft(t)))}}),M.addListener("ON_USER_LIST_CHANGED",function(e){G.Logger.log("CALLING_EVENT","ON_USER_LIST_CHANGED");var n=[];e&&e.userList&&0<e.userList.length&&(e.userList.map(function(e){if(!G.isFalsy(e.uid)&&!G.isFalsy(e.name)){var t=new B.User(e);t.setStatus("online"),n.push(t)}}),x.CallController.getInstance().getCallListner()&&(G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onUserListUpdated)||x.CallController.getInstance().getCallListner()._eventListener.onUserListUpdated(n)))}),M.addListener("ON_AUDIO_MODE_CHANGED",function(e){var r=[];e&&e.modes&&0<e.modes.length&&(e.modes.map(function(e){var t="",n=!1;e.hasOwnProperty("mode")&&(t=e.mode),e.hasOwnProperty("isSelected")&&(n=e.isSelected),e.hasOwnProperty("type")&&(t=e.type),e.hasOwnProperty("selected")&&(n=e.selected),r.push(new z.AudioMode(t,n))}),x.CallController.getInstance().getCallListner()&&(G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onAudioModesUpdated)||x.CallController.getInstance().getCallListner()._eventListener.onAudioModesUpdated(r)))}),Ee.addListener("ON_SWITCHED_TO_VIDEO",function(e){if(G.Logger.info("onCallSwitchedToVideo received in SDK = ",e),e.hasOwnProperty("initiator")&&e.hasOwnProperty("sessionId")&&!G.isFalsy(e.initiator.uid)&&!G.isFalsy(e.sessionId)&&e.hasOwnProperty("accepted")&&!G.isFalsy(e.accepted.uid)){var t=e.sessionId,n=new B.User(e.initiator);n.setStatus("online");var r=new B.User(e.accepted);if(r.setStatus("online"),x.CallController.getInstance().getCallListner()&&(G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo)||x.CallController.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo(t,n,r)),e.initiator.uid.toLowerCase()===D.user.getUid().toLowerCase()&&!e.sessionId.includes("v1."))try{K.makeApiCall("updateCallType",{sessionid:t},{type:"video"}).then(function(e){G.Logger.log("API :: response",e)},function(e){G.Logger.error("CallController :: onSwitchedToVideo",e)})}catch(e){G.Logger.error("CallController :: onSwitchedToVideo",e)}}}),Ee.addListener("ON_RECORDING_TOGGLED",function(e){if(e&&e.hasOwnProperty("user")&&e.hasOwnProperty("recordingStarted")&&!G.isFalsy(e.user.uid)&&!G.isFalsy(e.user.name)){var t=new B.User(e.user);t.setStatus("online");var n=e.recordingStarted;x.CallController.getInstance().getCallListner()&&(n?G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onRecordingStarted)||x.CallController.getInstance().getCallListner()._eventListener.onRecordingStarted(t):G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onRecordingStopped)||x.CallController.getInstance().getCallListner()._eventListener.onRecordingStopped(t))}}),Ee.addListener("ON_USER_MUTED",function(e){if(e&&e.hasOwnProperty("muted")&&e.hasOwnProperty("mutedBy")&&!G.isFalsy(e.muted.uid)&&!G.isFalsy(e.muted.name)&&!G.isFalsy(e.mutedBy.uid)&&!G.isFalsy(e.mutedBy.name)){var t=new B.User(e.muted);t.setStatus("online");var n=new B.User(e.mutedBy);n.setStatus("online"),x.CallController.getInstance().getCallListner()&&(G.isFalsy(x.CallController.getInstance().getCallListner()._eventListener.onUserMuted)||x.CallController.getInstance().getCallListner()._eventListener.onUserMuted(t,n))}})):x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.JWT_NOT_FOUND))},function(e){x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(e))})}else x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.SESSION_ID_REQUIRED))}else x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.NOT_INITIALIZED));else x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.NOT_LOGGED_IN));else x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.NOT_INITIALIZED));else x.CallController.getInstance().getCallListner()&&x.CallController.getInstance().getCallListner()._eventListener.onError(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))}),[3,3];case 2:return n=e.sent(),G.Logger.error("CometChat: startCall",n),[3,3];case 3:return[2]}})})},D.getCallParticipantCount=function(E,c){return new Promise(function(i,a){try{G.getAppSettings().then(function(e){if(G.isFalsy(E))return a(new b.CometChatException(F.ProsodyApiErrors.INVALID_SESSIONID));if(G.isFalsy(c))return a(new b.CometChatException(F.ProsodyApiErrors.INVALID_TYPE));var t=e[F.APP_SETTINGS.KEYS.REGION],n={},r=e[F.APP_SETTINGS.KEYS.WEBRTC_HOST],o=e[F.APP_SETTINGS.KEYS.WEBRTC_API_SUBDOMAIN],s=G.format((new u.EndpointFactory).prosodyApi,o,r,F.PROSODY_API.PATH.ROOM_SIZE);"direct"===c.toLowerCase()&&(E=("v1."+t+"."+D.getAppId()+"."+E).toLowerCase()),n[F.PROSODY_API.QUERY_PARAMETERS.DOMAIN]=r,n[F.PROSODY_API.QUERY_PARAMETERS.ROOM]=E,K.postData(s,"GET",n,{},!1).then(function(e){return e.text()}).then(function(e){var t=e?JSON.parse(e):{};return t.hasOwnProperty(F.PROSODY_API.RESPONSE.PARTICIPANTS)?i(t[F.PROSODY_API.RESPONSE.PARTICIPANTS]):i(0)}).catch(function(){var e={error:_.FETCH_ERROR.ERROR_IN_API_CALL};return a(e)})},function(e){return a(new b.CometChatException(e))})}catch(e){return a(new b.CometChatException(e))}})},D.rejectIncomingCall=function(r){return new Promise(function(n,t){try{if(G.isCallingComponentInstalled()){var e={};e[F.CallConstants.CALL_KEYS.CALL_STATUS]=F.CallConstants.CALL_STATUS.REJECTED,K.makeApiCall("updateCallSession",{sessionid:r},e).then(function(e){var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t)},function(e){t(new b.CometChatException(e.error))})}else t(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new b.CometChatException(e))}})},D.cancelCall=function(o){var s=this;return new Promise(function(n,t){var e=s.getActiveCall();if(null!==e&&e.getSessionId()===o&&e.getCallInitiator().getUid().toLocaleLowerCase()===D.user.getUid().toLocaleLowerCase())try{if(G.isCallingComponentInstalled()){var r={};r[F.CallConstants.CALL_KEYS.CALL_STATUS]=F.CallConstants.CALL_STATUS.CANCELLED,K.makeApiCall("updateCallSession",{sessionid:o},r).then(function(e){var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);x.CallController.getInstance().endCallSession(),n(t)},function(e){t(new b.CometChatException(e.error))})}else t(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new b.CometChatException(e))}})},D.sendBusyResponse=function(r){return new Promise(function(n,t){try{if(G.isCallingComponentInstalled()){var e={};e[F.CallConstants.CALL_KEYS.CALL_STATUS]=F.CallConstants.CALL_STATUS.BUSY,K.makeApiCall("updateCallSession",{sessionid:r},e).then(function(e){var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t)},function(e){t(new b.CometChatException(e.error))})}else t(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new b.CometChatException(e))}})},D.sendUnansweredResponse=function(r){return new Promise(function(n,t){try{if(G.isCallingComponentInstalled()){var e={};e[F.CallConstants.CALL_KEYS.CALL_STATUS]=F.CallConstants.CALL_STATUS.UNANSWERED,K.makeApiCall("updateCallSession",{sessionid:r},e).then(function(e){var t=C.MessageController.trasformJSONMessge(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);ue.publishCallMessage(t),n(t)},function(e){t(new b.CometChatException(e.error))})}else t(new b.CometChatException(F.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new b.CometChatException(e))}})},D.addConnectionListener=function(e,t){try{pe.addConnectionEventListener(e,t)}catch(e){G.Logger.error("CometChat: addConnectionListener",e)}},D.removeConnectionListener=function(e){try{pe.removeConnectionEventListener(e)}catch(e){G.Logger.error("CometChat: removeConnectionListener",e)}},D.addMessageListener=function(e,t){try{pe.addMessageEventListener(e,t)}catch(e){G.Logger.error("CometChat: addMessageListener",e)}},D.removeMessageListener=function(e){try{pe.removeMessageEventListener(e)}catch(e){G.Logger.error("CometChat: removeMessageListener",e)}},D.addCallListener=function(e,t){try{pe.addCallEventListener(e,t)}catch(e){G.Logger.error("CometChat: addCallListener",e)}},D.removeCallListener=function(e){try{pe.removeCallEventListener(e)}catch(e){G.Logger.error("CometChat: removeCallListener",e)}},D.addUserListener=function(e,t){try{pe.addUserEventListener(e,t)}catch(e){G.Logger.error("CometChat: addUserListener",e)}},D.removeUserListener=function(e){try{pe.removeUserEventListener(e)}catch(e){G.Logger.error("CometChat: removeUserListener",e)}},D.addGroupListener=function(e,t){try{pe.addGroupEventListener(e,t)}catch(e){G.Logger.error("CometChat: addGroupListener",e)}},D.removeGroupListener=function(e){try{pe.removeGroupEventListener(e)}catch(e){G.Logger.error("CometChat: removeGroupListener",e)}},D.addLoginListener=function(e,t){try{pe.addLoginEventListener(e,t)}catch(e){G.Logger.error("CometChat: addLoginListener",e)}},D.removeLoginListener=function(e){try{pe.removeLoginEventListener(e)}catch(e){G.Logger.error("CometChat: removeLoginListener",e)}},D.generateAuthToken=function(p){var l=this;return new Promise(function(r,o){try{var s={},i="",a="",E=F.APPINFO.platform,c=F.APPINFO.sdkVersion,u=F.APPINFO.apiVersion;navigator&&(a=navigator.userAgent),D.keyStore.get(F.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==(i=e)){var t=ce(),n=(new Date).getTime();i=l.appId+"_"+t+"_"+n,D.keyStore.set(F.LOCAL_STORE.KEY_DEVICE_ID,i)}s={platform:E,deviceId:i,appInfo:{version:c,apiVersion:u,userAgent:a}},K.makeApiCall("authToken",{uid:p},s).then(function(e){r(e.data)}).catch(function(e){o(new b.CometChatException(e.error))})},function(e){G.Logger.error("Got error while fetching data from key store",e)})}catch(e){o(new b.CometChatException(e))}})},D.tryReconnectingToWS=function(){D.WSReconnectionInProgress||D.startWSReconnectionTimer()},D.prototype.makeWSConnection=function(){D.WSLogin(D.user)},D.prototype.accidentallyDisconnected=function(){D.currentConnectionStatus=F.CONNECTION_STATUS.CONNECTING,pe.connectionHandlers.map(function(e){try{e._eventListener&&(G.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){G.Logger.error("ConnectionHandlers: inConnecting Status",e)}}),D.tryReconnectingToWS()},D.WSLogin=function(e){var r=this;ue.connection||ue.WSLogin(e.getJWT(),function(e,t){switch(e){case W.READY_STATE.CONNECTING:(n=D.getConnectionStatus())==F.CONNECTION_STATUS.DISCONNECTED&&(r.currentConnectionStatus=F.CONNECTION_STATUS.CONNECTING,pe.connectionHandlers.map(function(e){try{e._eventListener&&(G.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){G.Logger.error("connectionHandlers: Connecting Status",e)}}));break;case W.READY_STATE.OPEN:(n=D.getConnectionStatus())==F.CONNECTION_STATUS.CONNECTING&&(r.currentConnectionStatus=F.CONNECTION_STATUS.CONNECTED,pe.connectionHandlers.map(function(e){try{e._eventListener&&(G.isFalsy(e._eventListener.onConnected)||e._eventListener.onConnected()),r.onConnectionSuccess&&(r.onConnectionSuccess(),r.onConnectionSuccess=null)}catch(e){G.Logger.error("connectionHandlers: Connected Status",e)}})),D.WSReconnectionInProgress&&D.clearWSReconnectionTimer();break;case W.READY_STATE.CLOSING:break;case W.READY_STATE.CLOSED:var n=D.getConnectionStatus();1e3!==t.code&&(r.onConnectionError&&(r.onConnectionError(new b.CometChatException(F.ReceiptErrors.NO_WEBSOCKET_CONNECTION)),r.onConnectionError=null),pe.connectionHandlers.map(function(e){try{e._eventListener&&(G.isFalsy(e._eventListener.onConnectionError)||e._eventListener.onConnectionError())}catch(e){G.Logger.error("connectionHandlers: ConnectionError Status",e)}})),n!==F.CONNECTION_STATUS.DISCONNECTED&&n!==F.CONNECTION_STATUS.CONNECTING&&(r.currentConnectionStatus=F.CONNECTION_STATUS.DISCONNECTED,pe.connectionHandlers.map(function(e){try{e._eventListener&&(G.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected()),D.onDisconnectSuccess&&(D.onDisconnectSuccess(),D.onDisconnectSuccess=null)}catch(e){G.Logger.error("connectionHandlers: Disconnected Status",e)}})),ue.connection&&(ue.connection=null),D.isLoggedOut||D.disconnectedByUser||D.isAppInactive||r.tryReconnectingToWS()}})},D.pingAnalytics=function(){var c=this;try{D.keyStore.get("deviceId").then(function(E){G.getAppSettings().then(function(e){var t=null;window&&window.location&&window.location.origin&&(t=window.location.origin);var n="",r=E,o={version:F.SDKHeader.sdkVersion,apiVersion:e[F.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:t,uts:(new Date).getTime()};G.isFalsy(c.resource)||(o.resource=c.resource),G.isFalsy(c.platform)||(o.platform=c.platform),G.isFalsy(c.language)||(o.language=c.language),navigator&&(n=navigator.userAgent);var s={appInfo:o,uid:D.user.getUid(),userAgent:n,deviceId:r,platform:F.SDKHeader.platform};G.isFalsy(D.getSessionId())||(s.wsId=D.getSessionId());var i="https://"+e[F.APP_SETTINGS.KEYS.ANALYTICS_HOST]+"/"+e[F.APP_SETTINGS.KEYS.ANALYTICS_VERSION]+"/ping",a={appId:D.appId,sdk:G.format(F.SDKHeader.sdk,F.SDKHeader.platform,F.SDKHeader.sdkVersion),"Content-Type":"application/json"};D.settingsHash&&(a.settingsHash=D.settingsHash),D.settingsHashReceivedAt&&(a.settingsHashReceivedAt=D.settingsHashReceivedAt),D.jwt&&(a.Authorization="Bearer "+D.jwt),D.authToken&&(a.authToken=D.authToken),K.postData(i,"POST",s,a,!1).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty(F.ResponseConstants.RESPONSE_KEYS.KEY_DATA))G.Logger.log("Analytics Ping Request Data",e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);else if(e.hasOwnProperty(F.ResponseConstants.RESPONSE_KEYS.KEY_ERROR)){var t=e[F.ResponseConstants.RESPONSE_KEYS.KEY_ERROR];G.Logger.log("Analytics Ping Request Error",new b.CometChatException(t));var n=t.code;if(n===F.Errors.ERR_SETTINGS_HASH_OUTDATED){var r=D.authToken;D.getInstance().internalRestart(r)}n===F.Errors.ERR_NO_AUTH&&c.updateJWT()}}).catch(function(e){G.Logger.error("CometChat: pingAnalytics Fetch Error",e)})},function(e){G.Logger.error("CometChat: pingAnalytics getSettings Error",e)})},function(e){G.Logger.error("CometChat: pingAnalytics getDeviceId Error",e)})}catch(e){G.Logger.error("CometChat: pingAnalytics",e)}},D.updateJWT=function(){K.makeApiCall("getMyDetails",{},{},!1).then(function(e){var t=e.data,n=t.settings,r=new B.Me(t);if(D.user=r,t.hasOwnProperty("jwt")&&t.jwt&&(D.jwt=t.jwt),S.LocalStorage.getInstance().set("user",r),n&&n[F.APP_SETTINGS.KEYS.SETTINGS_HASH]&&D.settingsHash!==n[F.APP_SETTINGS.KEYS.SETTINGS_HASH]){var o=D.getInstance().getAuthToken();D.getInstance().internalRestart(o)}G.Logger.log("CometChat: updateJWT response",e)},function(e){G.Logger.error("CometChat: updateJWT Fetch Error",e)}).catch(function(e){G.Logger.error("CometChat: updateJWT",e)})},D.startAnalyticsPingTimer=function(){var e=this;D.isAnalyticsPingStarted=!0,D.analyticsPingTimer=setInterval(function(){try{e.pingAnalytics()}catch(e){G.Logger.error("CometChat: startAnalyticsPingTimer",e)}},D.settingsInterval)},D.clearAnalyticsPingTimer=function(){try{D.isAnalyticsPingStarted=!1,clearInterval(D.analyticsPingTimer)}catch(e){G.Logger.error("CometChat: clearAnalyticsPingTimer",e)}},D.startWSReconnectionTimer=function(){D.WSReconnectionInProgress=!0,D.WSReconnectionTimer=setInterval(function(){try{D.WSLogin(D.user)}catch(e){G.Logger.error("CometChat: startWSReconnectionTimer",e)}},D.WSReconnectionTimerInterval)},D.clearWSReconnectionTimer=function(){D.WSReconnectionInProgress=!1,clearInterval(D.WSReconnectionTimer)},D.getJWT=function(s){return new Promise(function(r,o){try{X.getEndPoint("getJWT").then(function(e){var t={appId:D.appId,Accept:"application/json",authToken:D.authToken,resource:D.getSessionId(),sdk:G.format(F.SDKHeader.sdk,F.SDKHeader.platform,F.SDKHeader.sdkVersion),"Content-Type":"application/json"},n={};n[F.JWT_API.KEYS.PASSTHROUGH]=s,K.postData(e.endpoint,e.method,n,t,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(F.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?r(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):o(new b.CometChatException(e.error))}).catch(function(e){var t={error:_.FETCH_ERROR.ERROR_IN_API_CALL};o(new b.CometChatException(t))})},function(e){o(new b.CometChatException(e))})}catch(e){o(new b.CometChatException(e))}})},D.getConnectionStatus=function(){return this.currentConnectionStatus},D.prototype.setConnectionStatus=function(e){D.currentConnectionStatus=e},D.isExtensionEnabled=function(s){return new Promise(function(r,o){try{if(G.isFalsy(s))return o(new b.CometChatException(F.ExtensionErrors.INVALID_EXTENSION));G.getAppSettings().then(function(e){if(e.extensions){var t=e.extensions;if(0<t.length){var n=t.some(function(e){return e.id===s});return r(n)}return r(!1)}return o(new b.CometChatException(F.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return o(new b.CometChatException(e))})}catch(e){return o(new b.CometChatException(e))}})},D.isAIFeatureEnabled=function(e){return new Promise(function(n,t){try{if(G.isFalsy(e))return t(new b.CometChatException(F.AIFeatureError.INVALID_AI_FEATURE));var r=F.AI_FEATURE_ACCESSIBLE,o=F.AI_FEATURE_ENABLED,s=G.format(F.AI_SLUG_ACCESSIBLE,e),i=G.format(F.AI_SLUG_ENABLED,e);G.getAppSettings().then(function(e){if(null==e?void 0:e.parameters){var t=null==e?void 0:e.parameters;return t[r]&&t[o]&&t[s]&&t[i]?n(!0):n(!1)}return n(!1)},function(e){return t(new b.CometChatException(e))})}catch(e){return t(new b.CometChatException(e))}})},D.getExtensionDetails=function(i){return new Promise(function(o,s){try{if(G.isFalsy(i))return s(new b.CometChatException(F.ExtensionErrors.INVALID_EXTENSION));G.getAppSettings().then(function(e){if(e.extensions){var t=e.extensions;if(0<t.length){var n=t.filter(function(e){return e.id===i});if(0<n.length){var r=new q.CCExtension(n[0]);return o(r)}return s(new b.CometChatException(F.ExtensionErrors.EXTENSION_NOT_FOUND))}return s(new b.CometChatException(F.ExtensionErrors.EXTENSION_NOT_FOUND))}return s(new b.CometChatException(F.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return s(new b.CometChatException(e))})}catch(e){return s(new b.CometChatException(e))}})},D.getAppSettings=function(){return new Promise(function(t,n){try{K.makeApiCall("appSettings").then(function(e){S.LocalStorage.getInstance().set(F.LOCAL_STORE.KEY_APP_SETTINGS,e.data),t(e.data)},function(e){n(new b.CometChatException(e.error))})}catch(e){n(new b.CometChatException(e))}})},D.isFeatureEnabled=function(o){return new Promise(function(n,r){try{if(G.isFalsy(o))return r(new b.CometChatException(F.FeatureRestrictionErrors.INVALID_FEATURE));G.getAppSettings().then(function(e){if(e.parameters){var t=e.parameters;return t.hasOwnProperty(o)?n(t[o]):n(!1)}return r(new b.CometChatException(F.FeatureRestrictionErrors.FEATURE_NOT_FOUND))},function(e){return r(new b.CometChatException(e))})}catch(e){return r(new b.CometChatException(e))}})},D.logout=function(){var r=this;return new Promise(function(t,n){try{D.didAnalyticsPingStart()&&D.clearAnalyticsPingTimer(),D.WSReconnectionInProgress&&D.clearWSReconnectionTimer(),D.isLoggedOut=!0,D.WSReconnectionInProgress=!1,D.isAnalyticsDisabled=!1,K.makeApiCall("userLogout").then(function(e){r.clearCache().then(function(){D.apiKey=void 0,D.user=void 0,D.authToken=void 0,D.cometChat=void 0,D.mode=void 0,ue.WSLogout(),D.pushToLoginListener("","Logout_Success"),t(e.data)})},function(e){r.clearCache().then(function(){D.apiKey=void 0,D.user=void 0,D.authToken=void 0,D.cometChat=void 0,D.mode=void 0,ue.WSLogout(),D.pushToLoginListener("","Logout_Success"),new b.CometChatException(e.error).code==_.SERVER_ERRORS.AUTH_ERR.code?t({}):n(new b.CometChatException(e.error))})})}catch(e){n(new b.CometChatException(e))}})},D.callExtension=function(s,i,a,E){return void 0===E&&(E={}),new Promise(function(r,o){try{G.getAppSettings().then(function(e){var t=G.format((new u.EndpointFactory).extensionApi,s,e[F.APP_SETTINGS.KEYS.REGION],e[F.APP_SETTINGS.KEYS.EXTENSION_DOMAIN],a),n={appId:D.appId,Accept:"application/json",authToken:D.authToken,resource:D.getSessionId(),sdk:G.format(F.SDKHeader.sdk,F.SDKHeader.platform,F.SDKHeader.sdkVersion),chatApiVersion:e[F.APP_SETTINGS.KEYS.CHAT_API_VERSION],"Content-Type":"application/json"};D.jwt&&(n.Authorization="Bearer "+D.jwt),K.postData(t,i,E,n,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(F.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?r(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):o(new b.CometChatException(e.error))}).catch(function(e){var t={error:_.FETCH_ERROR.ERROR_IN_API_CALL};o(t)})},function(e){return o(new b.CometChatException(e))})}catch(e){return o(new b.CometChatException(e))}})},D.getConversationStarter=function(a,E,c){return new Promise(function(t,n){try{a=a.toLowerCase(),E=E.toLowerCase();var e=G.validateChatType(E);if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(a,E);if(r instanceof b.CometChatException)return void n(r);var o={},s="";E===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="getGroupConversationStarter",o.guid=a):(s="getUserConversationStarter",o.uid=a);var i={uid:D.user.uid,name:D.user.name};o.onbehalfofuser=btoa(JSON.stringify(i)),K.makeApiCall(s,o,c||{}).then(function(e){return e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]?t(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]):n(new b.CometChatException(F.AIErrors.NO_CONVERSATION_STARTER))},function(e){return n(new b.CometChatException(e.error))})}catch(e){return n(new b.CometChatException(e))}})},D.getSmartReplies=function(a,E,c){return new Promise(function(t,n){try{a=a.toLowerCase(),E=E.toLowerCase();var e=G.validateChatType(E);if(e instanceof b.CometChatException)return void n(e);var r=G.validateId(a,E);if(r instanceof b.CometChatException)return void n(r);var o={},s="";E===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="getGroupSmartReply",o.guid=a):(s="getUserSmartReply",o.uid=a);var i={uid:D.user.uid,name:D.user.name};o.onbehalfofuser=btoa(JSON.stringify(i)),K.makeApiCall(s,o,c||{}).then(function(e){return e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]?t(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]):n(new b.CometChatException(F.AIErrors.NO_SMART_REPLY))},function(e){return n(new b.CometChatException(e.error))})}catch(e){return n(new b.CometChatException(e))}})},D.askBot=function(c,u,p,l,d){return new Promise(function(n,r){try{var e={},t="";c=c.toLowerCase(),u=u.toLowerCase();var o=G.validateChatType(u);if(o instanceof b.CometChatException)return void r(o);var s=G.validateId(c,u);if(s instanceof b.CometChatException)return void r(s);var i=G.validateId(p,"bot");if(i instanceof b.CometChatException)return void r(i);e.botId=p,G.isFalsy(d)&&(d={});var a=G.validateQuestion(l);if(a instanceof b.CometChatException)return void r(a);d.question=l,u===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(t="getBotAssistanceInGroupConversation",e.guid=c):(t="getBotAssistanceInUserConversation",e.uid=c);var E={uid:D.user.uid,name:D.user.name};e.onbehalfofuser=btoa(JSON.stringify(E)),K.makeApiCall(t,e,d).then(function(e){if(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY]){var t=e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY];return n(t.toString())}return r(new b.CometChatException(F.AIErrors.NO_ASSISTANCE))},function(e){return r(new b.CometChatException(e.error))})}catch(e){return r(new b.CometChatException(e))}})},D.getConversationSummary=function(a,E,c){return new Promise(function(n,r){try{a=a.toLowerCase(),E=E.toLowerCase();var e=G.validateChatType(E);if(e instanceof b.CometChatException)return void r(e);var t=G.validateId(a,E);if(t instanceof b.CometChatException)return void r(t);var o={},s="";E===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="getGroupConversationSummary",o.guid=a):(s="getUserConversationSummary",o.uid=a);var i={uid:D.user.uid,name:D.user.name};o.onbehalfofuser=btoa(JSON.stringify(i)),K.makeApiCall(s,o,c||{}).then(function(e){if(e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY]){var t=e[F.ResponseConstants.RESPONSE_KEYS.KEY_DATA][F.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY];return n(t.toString())}return r(new b.CometChatException(F.AIErrors.NO_CONVERSATION_SUMMARY))},function(e){return r(new b.CometChatException(e.error))})}catch(e){return r(new b.CometChatException(e))}})},D.setSource=function(e,t,n){G.isFalsy(e)||(this.resource=e),G.isFalsy(t)||(this.platform=t),G.isFalsy(n)||(this.language=n)},D.setDemoMetaInfo=function(e){D.demoMetaInfo=e},D.clearCache=function(){return new Promise(function(e,t){try{S.LocalStorage.getInstance().clearStore().then(function(){G.Logger.info("CometChat: clearCache => All store cleared successfully","true"),e(!0)})}catch(e){G.Logger.error("CometChat: clearCache",e),t(e)}})},D.connect=function(e){var t=e||{},n=t.onSuccess,r=t.onError;D.user?(ue.connection||(D.onConnectionSuccess=n,D.disconnectedByUser=!1,D.WSLogin(D.user)),D.didAnalyticsPingStart()||D.isAnalyticsDisabled||(D.pingAnalytics(),D.startAnalyticsPingTimer())):r&&r(new b.CometChatException({code:F.Errors.ERROR_USER_NOT_LOGGED_IN,message:F.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE}))},D.disconnect=function(e){var t=e||{},n=t.onSuccess,r=t.onError;D.user?(D.disconnectedByUser=!0,D.disconnectInternally({onError:r}),ue.clearWSResponseTimer(),D.onDisconnectSuccess=n):r&&r(new b.CometChatException({code:F.Errors.ERROR_USER_NOT_LOGGED_IN,message:F.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE}))},D.disconnectInternally=function(e){var t=(e||{}).onError;D.user?(D.disconnectedByUser=!0,ue.connection&&ue.WSLogout(),D.didAnalyticsPingStart()&&D.clearAnalyticsPingTimer(),D.clearWSReconnectionTimer()):t&&t(new b.CometChatException({code:F.Errors.ERROR_USER_NOT_LOGGED_IN,message:F.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE}))},D.prototype.internalRestart=function(e){D.internalRestart||D.getInstance().internalLogout(!1).then(function(){D.internalRestart=!0,D.login(e).then(function(e){D.shouldConnectToWS=!0,D.internalRestart=!1},function(e){G.Logger.error("CometChat: internalRestart :: login",e),D.internalRestart=!1})},function(e){G.Logger.error("CometChat: internalRestart :: internalLogout",e)})},D.prototype.internalLogout=function(n){return void 0===n&&(n=!0),new Promise(function(e,t){try{D.didAnalyticsPingStart()&&D.clearAnalyticsPingTimer(),D.WSReconnectionInProgress&&D.clearWSReconnectionTimer(),D.isLoggedOut=!0,D.WSReconnectionInProgress=!1,D.isAnalyticsDisabled=!1,D.clearCache().then(function(){D.apiKey=void 0,D.user=void 0,D.authToken=void 0,D.cometChat=void 0,D.mode=void 0,ue.WSLogout(),n&&D.pushToLoginListener("","Logout_Success"),e(!0)})}catch(e){G.Logger.error("CometChat: internalLogout",e),t(e)}})},D.markAsUnread=function(s){var i=this;return new Promise(function(t,n){try{var e=void 0;if(G.isFalsy(s)||!(s instanceof p.BaseMessage))return n(new b.CometChatException(JSON.parse(G.format(JSON.stringify(F.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));e=s.getId().toString();var r={},o="";s.getReceiverType()===F.MessageConstatnts.RECEIVER_TYPE.GROUP?(o="markGroupMessagesAsUnread",r.guid=s.getReceiverId()):(o="markUserMessagesAsUnread",i.user&&s.getSender().getUid()===i.user.getUid()?r.uid=s.getReceiverId():r.uid=s.getSender().getUid()),K.makeApiCall(o,r,{messageId:e}).then(function(e){return t("Messages marked as unread successfully.")},function(e){return n(new b.CometChatException(e.error))})}catch(e){return G.Logger.error("CometChat: markAsUnread",e),n(new b.CometChatException(e))}})},D.markAsInteracted=function(e,r,t){return new Promise(function(n,t){try{G.isFalsy(e)?t(new b.CometChatException(_.ERRORS.PARAMETER_MISSING)):K.makeApiCall("markInteracted",{messageId:e},{interactions:[r]}).then(function(e){var t;t=e&&e.data&&e.data.message?e.data.message:"Marked interacted",n(t)},function(e){t(new b.CometChatException(e.error))})}catch(e){t(new b.CometChatException(e))}})},D.getConversationUpdateSettings=function(){return E(this,void 0,void 0,function(){var t;return w(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,G.getAppSettings()];case 1:return t=e.sent(),[2,ae.ConversationUpdateSettings.fromJSON(t)];case 2:return e.sent(),[2,new ae.ConversationUpdateSettings];case 3:return[2]}})})},D.initialzed=!1,D.CometChatException=b.CometChatException,D.TextMessage=l.TextMessage,D.MediaMessage=c.MediaMessage,D.CustomMessage=N.CustomMessage,D.Action=n.Action,D.Call=t.Call,D.TypingIndicator=I.TypingIndicator,D.TransientMessage=j.TransientMessage,D.InteractiveMessage=te.InteractiveMessage,D.InteractionGoal=$.InteractionGoal,D.Interaction=Z.Interaction,D.InteractionReceipt=ee.InteractionReceipt,D.Group=a.Group,D.User=B.User,D.GroupMember=m.GroupMember,D.Conversation=M.Conversation,D.ReactionCount=oe.ReactionCount,D.ReactionEvent=se.ReactionEvent,D.Reaction=ie.Reaction,D.USER_STATUS={ONLINE:F.PresenceConstatnts.STATUS.ONLINE,OFFLINE:F.PresenceConstatnts.STATUS.OFFLINE},D.MessagesRequest=R.MessagesRequest,D.MessagesRequestBuilder=R.MessagesRequestBuilder,D.ReactionsRequest=re.ReactionsRequest,D.ReactionsRequestBuilder=re.ReactionsRequestBuilder,D.UsersRequest=T.UsersRequest,D.UsersRequestBuilder=T.UsersRequestBuilder,D.ConversationsRequest=g.ConversationsRequest,D.ConversationsRequestBuilder=g.ConversationsRequestBuilder,D.BlockedUsersRequest=y.BlockedUsersRequest,D.BlockedUsersRequestBuilder=y.BlockedUsersRequestBuilder,D.GroupsRequest=r.GroupsRequest,D.GroupsRequestBuilder=r.GroupsRequestBuilder,D.GroupMembersRequest=o.GroupMembersRequest,D.GroupMembersRequestBuilder=o.GroupMembersRequestBuilder,D.BannedMembersRequest=i.BannedMembersRequest,D.BannedMembersRequestBuilder=i.BannedMembersRequestBuilder,D.CallSettings=V.CallSettings,D.CallSettingsBuilder=V.CallSettingsBuilder,D.MainVideoContainerSetting=V.MainVideoContainerSetting,D.AppSettings=P.AppSettings,D.AppSettingsBuilder=P.AppSettingsBuilder,D.MessageListener=e.MessageListener,D.UserListener=e.UserListener,D.GroupListener=e.GroupListener,D.OngoingCallListener=e.OngoingCallListener,D.CallListener=e.CallListener,D.ConnectionListener=e.ConnectionListener,D.LoginListener=e.LoginListener,D.CallController=x.CallController,D.CometChatHelper=v.CometChatHelper,D.Attachment=U.Attachment,D.GoalType=F.GoalType,D.AttachmentType=F.AttachmentType,D.MESSAGE_TYPE=F.MessageConstatnts.TYPE,D.CATEGORY_MESSAGE=F.MessageConstatnts.CATEGORY.MESSAGE,D.CATEGORY_ACTION=F.MessageConstatnts.CATEGORY.ACTION,D.CATEGORY_CALL=F.MessageConstatnts.CATEGORY.CALL,D.CATEGORY_CUSTOM=F.MessageConstatnts.CATEGORY.CUSTOM,D.ACTION_TYPE=F.ActionConstatnts.ACTIONS,D.CALL_TYPE=F.CallConstants.CALL_TYPE,D.RECEIVER_TYPE=F.MessageConstatnts.RECEIVER_TYPE,D.CATEGORY_INTERACTIVE=F.MessageConstatnts.CATEGORY.INTERACTIVE,D.REACTION_ACTION=F.REACTION_ACTION,D.CALL_STATUS=F.CallConstants.CALL_STATUS,D.GROUP_MEMBER_SCOPE=F.GROUP_MEMBER_SCOPE,D.GROUP_TYPE=F.GROUP_TYPE,D.MESSAGE_REQUEST=F.MessageConstatnts.PAGINATION.CURSOR_FILEDS,D.CONNECTION_STATUS=F.CONNECTION_STATUS,D.CALL_MODE=F.CallConstants.CALL_MODE,D.AUDIO_MODE=F.CallConstants.AUDIO_MODE,D.SORT_BY=F.UserConstants.SORT_BY,D.SORT_ORDER=F.UserConstants.SORT_ORDER,D.WSReconnectionInProgress=!1,D.WSReconnectionTimerInterval=5e3,D.currentConnectionStatus=F.CONNECTION_STATUS.DISCONNECTED,D.isConnectingFromInit=!1,D.loginInProgress=!1,D.internalRestart=!1,D.settingsInterval=6e4,D.isAnalyticsPingStarted=!1,D.isLoggedOut=!0,D.isAnalyticsDisabled=!1,D.disconnectedByUser=!1,D.shouldConnectToWS=!0,D.isAppInactive=!1,D.onConnectionSuccess=null,D.onDisconnectSuccess=null,D.onConnectionError=null,D.callWaitTimer=null,D.callWaitTime=30,D}();de.CometChat=le}).call(this,Se(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KEYS=t.AUTH=t.MESSAGE=t.PRESENCE=t.INTERACTION_RECEIPT=t.RECEIPTS=t.TRANSIENT_MESSAGE=t.MESSAGE_REACTION=t.TYPING_INDICATOR=t.LOGOUT_REASON=t.LOGOUT_CODE=t.READY_STATE=t.WS=void 0,t.WS={protocol:"wss://"},t.READY_STATE={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3,INVALID_JWT:4},t.LOGOUT_CODE=1e3,t.LOGOUT_REASON="User logged out",t.TYPING_INDICATOR={TYPE:"typing_indicator",ACTION:{STARTED:"started",ENDED:"ended"}},t.MESSAGE_REACTION={TYPE:"reaction",ACTION:{ADDED:"message_reaction_added",REMOVED:"message_reaction_removed"}},t.TRANSIENT_MESSAGE={TYPE:"transient_message"},t.RECEIPTS={TYPE:"receipts",ACTION:{READ:"read",DELIVERED:"delivered",READ_BY_ALL:"readByAll",DELIVERED_TO_ALL:"deliveredToAll"},RECEIPT_TYPE:{READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery",READ_BY_ALL_RECEIPT:"readByAll",DELIVERY_TO_ALL_RECEIPT:"deliveredToAll"}},t.INTERACTION_RECEIPT={TYPE:"interaction_completed"},t.PRESENCE={TYPE:"presence",ACTION:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline"}},t.MESSAGE={TYPE:"message"},t.AUTH={TYPE:"auth"},t.KEYS={TYPE:"type",ACTION:"action",APP_ID:"appId",RECEIVER:"receiver",RECEIVER_TYPE:"receiverType",DEVICE_ID:"deviceId",BODY:"body",USER:"user",METADATA:"metadata",MESSAGE_ID:"messageId",TIMESTAMP:"timestamp",STATUS:"status",CODE:"code",SENDER:"sender",MESSAGE_SENDER:"messageSender",PRESENCE_SUBSCRIPTION:"presenceSubscription",AUTH:"auth",PING:"ping",DATA:"data",PARAMS:"params",ACK:"ack",PONG:"pong",INTERACTIONS:"interactions",REACTION:"reaction",REACTED_AT:"reactedAt",REACTED_BY:"reactedBy",ID:"id",UID:"uid",CONVERSATION_ID:"conversationId",PARENT_ID:"parentId"}},function(e,t,n){"use strict";var u=this&&this.__assign||function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.postData=t.makeAdminApiCall=t.makeApiCall=void 0;var p=n(38),l=n(4),d=n(0),S=n(2),C=n(10),h=n(1);function f(n,e,r,t,o){var s;return void 0===n&&(n=""),void 0===e&&(e="GET"),void 0===r&&(r={}),void 0===t&&(t={}),r=d.isFalsy(r)?void 0:("GET"==e&&(n+="?",Object.keys(r).map(function(e,t){n=t===Object.keys(r).length-1?n+e+"="+r[e]:n+e+"="+r[e]+"&"}),r=void 0),o&&(s=new FormData,Object.keys(r).map(function(e){if("data"!=e){if("tags"==e)for(var t=0;t<r[e].length;t++)s.append(e+"[]",r[e][t]);else if("metadata"!=e)if("files"===e)for(t=0;t<r[e].length;t++)r[e][t].hasOwnProperty("file")?s.append(e+"[]",r[e][t].file,r[e][t].name?r[e][t].name:null):s.append(e+"[]",r[e][t]);else s.append(e,r[e])}else s.append(e,JSON.stringify(r[e]))})),JSON.stringify(r)),fetch(n,{method:e,mode:"cors",cache:"no-cache",headers:t,redirect:"follow",referrer:"no-referrer",body:o?s:r})}t.makeApiCall=function(o,s,i,a,E){void 0===o&&(o=""),void 0===s&&(s={}),void 0===i&&(i={});var c=l.CometChat.getInstance(l.CometChat.getAppId());return new Promise(function(n,r){try{p.getEndPoint(o,s).then(function(e){var t=u({resource:l.CometChat.getSessionId(),appId:l.CometChat.getAppId(),Accept:"application/json",sdk:d.format(h.SDKHeader.sdk,h.SDKHeader.platform,h.SDKHeader.sdkVersion)},E);a||(t["Content-Type"]="application/json"),e.hasOwnProperty("isAIApi")&&e.isAIApi&&(t.onbehalfofuser=s.onbehalfofuser),e.hasOwnProperty("isAdminApi")&&e.isAdminApi?c.getApiKey()?t.apiKey=c.getApiKey():r({error:{code:"API_KEY_NOT_SET",message:"An apiKey is needed to use the "+o+" api.",name:"API_KEY_NOT_SET"}}):c.getAuthToken()?t.authToken=c.getAuthToken():r({error:{code:"USER_NOT_LOGED_IN",message:"An authToken is need to use the "+o+" end-point. PS- We are aware of the spelling mistake, but in order to maintain backward compatibility we cannot change it :(",name:"User not logged-in"}}),f(e.endpoint,e.method,i,t,a).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty("data"))e.data.hasOwnProperty("authToken")&&l.CometChat.setAuthToken(e.data.authToken),n(e);else{if(e.hasOwnProperty("error")){var t=e.error;t.hasOwnProperty("code")&&t.code===h.API_ERROR_CODES.AUTH_ERR_AUTH_TOKEN_NOT_FOUND&&l.CometChat.getInstance().internalLogout().then(function(){d.Logger.log("CometChat: makeApiCall","User logged out")})}r(e)}}).catch(function(e){var t={error:C.FETCH_ERROR.ERROR_IN_API_CALL};r(t)})}).catch(function(e){return r})}catch(e){r(new S.CometChatException(e))}})},t.makeAdminApiCall=function(o,e,s,i){void 0===o&&(o=""),void 0===e&&(e={}),void 0===s&&(s={});var a=l.CometChat.getInstance(l.CometChat.getAppId());return new Promise(function(n,r){p.getEndPoint(o,e).then(function(e){var t={appId:l.CometChat.getAppId(),Accept:"application/json",sdk:d.format(h.SDKHeader.sdk,h.SDKHeader.platform,h.SDKHeader.sdkVersion)};i||(t["Content-Type"]="application/json"),e.hasOwnProperty("isAdminApi")&&e.isAdminApi?a.getApiKey()?t.apiKey=a.getApiKey():r({error:"An apiKey is need to use the "+o+" api."}):a.getAuthToken()?t.authToken=a.getAuthToken():r({error:"An authToken is need to use the "+o+" api."}),f(e.endpoint,e.method,s,t,i).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty("data")?(e.data.hasOwnProperty("authToken")&&l.CometChat.setAuthToken(e.data.authToken),n(e)):r(e)}).catch(function(e){var t={error:C.FETCH_ERROR.ERROR_IN_API_CALL};r(t)})}).catch(function(e){return r})})},t.postData=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseMessage=void 0;var r=n(1),o=n(20),s=n(0),i=function(){function e(e,t,n,r){this.reactions=[],this.mentionedUsers=[],this.mentionedMe=!1,this.receiverId=e,this.type=t,this.receiverType=n,this.category=r}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getUnreadRepliesCount=function(){return this.unreadRepliesCount},e.prototype.setUnreadRepliesCount=function(e){this.unreadRepliesCount=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e.prototype.getMuid=function(){return this.muid},e.prototype.setMuid=function(e){this.muid=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSentAt=function(){return this.sentAt},e.prototype.setSentAt=function(e){this.sentAt=e},e.prototype.getStatus=function(){return this.status},e.prototype.setStatus=function(e){this.status=e},e.prototype.getDeliveredAt=function(){return this.deliveredAt},e.prototype.setDeliveredAt=function(e){this.deliveredAt=e},e.prototype.getDeliveredToMeAt=function(){return this.deliveredToMeAt},e.prototype.setDeliveredToMeAt=function(e){this.deliveredToMeAt=e},e.prototype.getReadAt=function(){return this.readAt},e.prototype.setReadAt=function(e){this.readAt=e},e.prototype.getReadByMeAt=function(){return this.readByMeAt},e.prototype.setReadByMeAt=function(e){this.readByMeAt=e},e.prototype.getCategory=function(){return this.category},e.prototype.setCategory=function(e){this.category=e},e.prototype.getEditedAt=function(){return this.editedAt},e.prototype.setEditedAt=function(e){this.editedAt=e},e.prototype.getEditedBy=function(){return this.editedBy},e.prototype.setEditedBy=function(e){this.editedBy=e},e.prototype.getDeletedAt=function(){return this.deletedAt},e.prototype.setDeletedAt=function(e){this.deletedAt=e},e.prototype.getDeletedBy=function(){return this.deletedBy},e.prototype.setDeletedBy=function(e){this.deletedBy=e},e.prototype.getReplyCount=function(){return this.replyCount},e.prototype.setReplyCount=function(e){this.replyCount=e},e.prototype.getRawMessage=function(){return this.rawMessage},e.prototype.setRawMessage=function(e){this.rawMessage=e},e.prototype.setMentionedUsers=function(e){this.mentionedUsers=e},e.prototype.getMentionedUsers=function(){return this.mentionedUsers},e.prototype.setHasMentionedMe=function(e){this.mentionedMe=e},e.prototype.hasMentionedMe=function(){return this.mentionedMe},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.setReactions=function(e){try{this.setReactionsToData(e)}catch(e){return this.reactions}},e.prototype.getReactions=function(){try{return this.getReactionsFromData()}catch(e){return this.reactions}},e.prototype.setReactionsToData=function(e){var t=this.getData();if(t[r.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]){var n=e.map(function(e){return new o.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe)});t[r.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]=n,this.setData(t),this.reactions=n}else t[r.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]=e,this.setData(t),this.reactions=e},e.prototype.getReactionsFromData=function(){try{var e=this.getData(),n=[];if(e[r.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS])e[r.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS].forEach(function(e){var t=new o.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe);n.push(t)});return n}catch(e){throw s.Logger.error("BaseMessageModel: getReactionsFromData",e),e}},e}();t.BaseMessage=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatEvent=void 0;var i=n(0),r=n(5),o=function(){function e(e,t,n,r,o,s){i.isFalsy(e)||(this.appId=e),i.isFalsy(t)||(this.receiver=t),i.isFalsy(n)||(this.receiverType=n),i.isFalsy(o)||(this.deviceId=o),i.isFalsy(r)||(this.sender=r),i.isFalsy(s)||(this.messageSender=s)}return e.prototype.getAppId=function(){return this.appId},e.prototype.setAppId=function(e){this.appId=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getDeviceId=function(){return this.deviceId},e.prototype.setDeviceId=function(e){this.deviceId=e},e.prototype.getMessageSender=function(){return this.messageSender},e.prototype.setMessageSender=function(e){this.messageSender=e},e.prototype.getCometChatEventJSON=function(){var e={};return e[r.KEYS.APP_ID]=this.getAppId(),e[r.KEYS.RECEIVER]=this.getReceiver(),e[r.KEYS.RECEIVER_TYPE]=this.getReceiverType(),e[r.KEYS.DEVICE_ID]=this.getDeviceId(),e[r.KEYS.TYPE]=this.getType(),e[r.KEYS.SENDER]=this.getSender(),i.isFalsy(this.getMessageSender())||(e[r.KEYS.MESSAGE_SENDER]=this.getMessageSender()),e},e}();t.CometChatEvent=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Group=void 0;var r=n(1),o=function(){function e(e,t,n,r,o,s,i){this.hasJoined=!1,this.membersCount=0,this.isBanned=!1,this.guid=e,t&&(this.name=t),n&&(this.type=n),!r&&""!==r||"password"!=n||(this.password=r),(o||""===o)&&(this.icon=o),(s||""===s)&&(this.description=s),i&&(this.hasJoined=i)}return e.prototype.getGuid=function(){return this.guid},e.prototype.setGuid=function(e){this.guid=e},e.prototype.getName=function(){return this.name},e.prototype.setName=function(e){e&&(this.name=e)},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getPassword=function(){return this.password},e.prototype.setPassword=function(e){this.password=e},e.prototype.getIcon=function(){return this.icon},e.prototype.setIcon=function(e){this.icon=e},e.prototype.getDescription=function(){return this.description},e.prototype.setDescription=function(e){this.description=e},e.prototype.getOwner=function(){return this.owner},e.prototype.setOwner=function(e){this.owner=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getCreatedAt=function(){return this.createdAt},e.prototype.setCreatedAt=function(e){this.createdAt=e},e.prototype.getUpdatedAt=function(){return this.updatedAt},e.prototype.setUpdatedAt=function(e){this.updatedAt=e},e.prototype.getHasJoined=function(){return this.hasJoined},e.prototype.setHasJoined=function(e){this.hasJoined=e},e.prototype.getWsChannel=function(){return this.wsChannel},e.prototype.setWsChannel=function(e){this.wsChannel=e},e.prototype.setScope=function(e){this.scope=e},e.prototype.getScope=function(){return this.scope},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.getMembersCount=function(){return this.membersCount},e.prototype.setMembersCount=function(e){this.membersCount=e},e.prototype.setTags=function(e){this.tags=e},e.prototype.getTags=function(){return this.tags},e.prototype.isBannedFromGroup=function(){return this.isBanned},e.TYPE=r.GroupType,e.Type=e.TYPE,e}();t.Group=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FETCH_ERROR=t.TYPINGNOTIFICATION_CONSTANTS=t.LOGIN_ERROR=t.MESSAGE_ERRORS=t.MESSAGES_REQUEST_ERRORS=t.USERS_REQUEST_ERRORS=t.GROUP_CREATION_ERRORS=t.INIT_ERROR=t.ERRORS=t.SERVER_ERRORS=void 0,t.SERVER_ERRORS={AUTH_ERR:{code:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND",message:"The auth token %s% does not exist. Please make sure you are logged in and have a valid auth token or try login again."}},t.ERRORS={PARAMETER_MISSING:{code:"MISSING_PARAMETERS",name:"Invalid or no parameter passed to the method."}},t.INIT_ERROR={NO_APP_ID:{code:t.ERRORS.PARAMETER_MISSING.code,name:t.ERRORS.PARAMETER_MISSING.name,message:"AppID cannot be empty. Please specify a valid appID.",details:{}}},t.GROUP_CREATION_ERRORS={EMPTY_PASSWORD:{code:"ERR_EMPTY_GROUP_PASS",details:void 0,message:"Password is mandatory to join a group.",name:void 0}},t.USERS_REQUEST_ERRORS={EMPTY_USERS_LIST:{code:"EMPTY_USERS_LIST",name:"EMPTY_USERS_LIST",message:"The users list needs to have atleast one UID.",details:{}}},t.MESSAGES_REQUEST_ERRORS={REQUEST_IN_PROGRESS_ERROR:{code:"REQUEST_IN_PROGRESS",name:"REQUEST_IN_PROGRESS",message:"Request in progress.",details:{}},NOT_ENOUGH_PARAMS:{code:"NOT_ENOUGH_PARAMETERS",name:"NOT_ENOUGH_PARAMETERS",message:"`Timestamp`, `MessageId` or `updatedAfter` is required to use the 'fetchNext()' method.",details:{}}},t.MESSAGE_ERRORS={INVALID_CUSTOM_DATA:{code:"-1",name:"%s_CUSTOM_DATA",message:"",details:{}}},t.LOGIN_ERROR={NOT_INITIALIZED:{code:"-1",name:"COMETCHAT_INITIALIZATION_NOT_DONE",message:"please initialize the cometchat before using login method.",details:{}},UNAUTHORISED:{code:401,name:"USER_NOT_AUTHORISED",message:"The `authToken` of the user is not authorised. Please verify again.",details:{}},WS_CONNECTION_FAIL:{code:-1,name:"WS_CONNECTION_FAIL",message:"WS Connection failed. %s",details:{}},WS_CONNECTION_FAIL_PORT_ERROR:{code:-1,name:"WS_CONNECTION_FAIL",message:"WS Connection failed. Trying to connect with port: %s",details:{}},WS_CONNECTION_FALLBACK_FAIL_PORT_ERROR:{code:-1,name:"WS_CONNECTION_FALLBACK_FAIL",message:"WS Connection fallback failed. Trying to connect with port: %s",details:{}},WS_AUTH_FAIL:{code:-1,name:"WS_AUTH_FAIL",message:"WS username/password not correct.",details:{}},NO_INTERNET:{code:-1,name:"NO_INTERNET_CONNECTION",message:"You do not have internet connection.",details:{}},REQUEST_IN_PROGRESS:{code:-1,name:"LOGIN_IN_PROGRESS",message:"Please wait until the previous login request ends.",details:{}}},t.TYPINGNOTIFICATION_CONSTANTS={TOO_MANY_REQUEST:{code:"TOO_MANY_REQUEST",name:"TOO MANY REQUEST",message:"too many request, wait for `%s` seconds before sending next request.",details:{}}},t.FETCH_ERROR={ERROR_IN_API_CALL:{code:"FAILED_TO_FETCH",name:"FAILED_TO_FETCH",message:"There is an unknown issue with the API request. Please check your internet connection and verify the api call.",details:{}}}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageController=void 0;var C=n(7),h=n(19),f=n(21),_=n(0),T=n(1),g=n(26),R=n(27),A=n(28),s=n(2),I=n(22),O=n(23),N=n(4),i=n(13),a=n(3),m=n(24),r=function(){function S(){}return S.trasformJSONMessge=function(n){var e,t,r,o,s;try{var i=null,a=void 0;switch(n[T.MessageConstatnts.KEYS.CATEGORY]){case T.MessageConstatnts.CATEGORY.ACTION:a=g.Action.actionFromJSON(n);break;case T.MessageConstatnts.CATEGORY.CALL:a=R.Call.callFromJSON(n);break;case T.MessageConstatnts.CATEGORY.MESSAGE:switch(n[T.MessageConstatnts.KEYS.TYPE]){case T.MessageConstatnts.TYPE.TEXT:a=new h.TextMessage(n[T.MessageConstatnts.KEYS.RECEIVER],n[T.MessageConstatnts.KEYS.DATA][T.MessageConstatnts.KEYS.TEXT],n[T.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case T.MessageConstatnts.TYPE.CUSTOM:a=new O.CustomMessage(n[T.MessageConstatnts.KEYS.RECEIVER],n[T.MessageConstatnts.KEYS.DATA][T.MessageConstatnts.KEYS.CUSTOM_DATA],n[T.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;default:if(a=new f.MediaMessage(n[T.MessageConstatnts.KEYS.RECEIVER],n[T.MessageConstatnts.KEYS.DATA][T.MessageConstatnts.KEYS.URL],n[T.MessageConstatnts.KEYS.TYPE],n[T.MessageConstatnts.KEYS.RECEIVER_TYPE]),n.hasOwnProperty(T.MessageConstatnts.KEYS.DATA)){var E=n[T.MessageConstatnts.KEYS.DATA];if(E.hasOwnProperty(T.MessageConstatnts.KEYS.ATTATCHMENTS)){var c,u=E[T.MessageConstatnts.KEYS.ATTATCHMENTS];new Array;u.map(function(e){c=new I.Attachment(e)}),a.setAttachment(c)}E.hasOwnProperty(T.MessageConstatnts.KEYS.TEXT)&&a.setCaption(E[T.MessageConstatnts.KEYS.TEXT])}a.hasOwnProperty("file")&&delete a.file}break;case T.MessageConstatnts.CATEGORY.CUSTOM:a=new O.CustomMessage(n[T.MessageConstatnts.KEYS.RECEIVER],n[T.MessageConstatnts.KEYS.DATA][T.MessageConstatnts.KEYS.CUSTOM_DATA],n[T.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type);break;case T.MessageConstatnts.CATEGORY.INTERACTIVE:a=new m.InteractiveMessage(n[T.MessageConstatnts.KEYS.RECEIVER],n[T.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type,n[T.MessageConstatnts.KEYS.DATA][T.MessageConstatnts.KEYS.INTERACTIVE_DATA],n[T.MessageConstatnts.KEYS.DATA][T.MessageConstatnts.KEYS.INTERACTION_GOAL])}if((n[T.MessageConstatnts.KEYS.CATEGORY]===T.MessageConstatnts.CATEGORY.MESSAGE||n[T.MessageConstatnts.KEYS.CATEGORY]===T.MessageConstatnts.CATEGORY.CUSTOM)&&n[T.MessageConstatnts.KEYS.TYPE]!==T.MessageConstatnts.TYPE.TEXT&&(null==n?void 0:n[T.MessageConstatnts.KEYS.DATA])&&(null===(e=null==n?void 0:n[T.MessageConstatnts.KEYS.DATA])||void 0===e?void 0:e[T.MessageConstatnts.KEYS.ATTATCHMENTS])&&0!==(null===(r=null===(t=null==n?void 0:n[T.MessageConstatnts.KEYS.DATA])||void 0===t?void 0:t[T.MessageConstatnts.KEYS.ATTATCHMENTS])||void 0===r?void 0:r.length)&&(null===(o=N.CometChat.user)||void 0===o?void 0:o.getFat())&&N.CometChat.SECURED_MEDIA_HOST){var p=N.CometChat.SECURED_MEDIA_HOST,l=null===(s=N.CometChat.user)||void 0===s?void 0:s.getFat(),d=_.updatePropertiesWithDynamicValue(n,p,"?"+T.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY+"="+l);d&&(n=d)}n[T.MessageConstatnts.KEYS.MY_RECEIPTS]&&(n[T.MessageConstatnts.KEYS.MY_RECEIPTS]=n[T.MessageConstatnts.KEYS.MY_RECEIPTS],Object.keys(n[T.MessageConstatnts.KEYS.MY_RECEIPTS]).map(function(e){var t=new A.MessageReceipt;e==T.DELIVERY_RECEIPTS.DELIVERED_AT&&(t.setReceiptType(t.RECEIPT_TYPE.DELIVERY_RECEIPT),t.setDeliveredAt(n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.DELIVERY_RECEIPTS.DELIVERED_AT]),_.isFalsy(n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.DELIVERY_RECEIPTS.RECIPIENT])?n[T.DELIVERY_RECEIPTS.DELIVERED_TO_ME_AT]=n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.DELIVERY_RECEIPTS.DELIVERED_AT]:t.setSender(n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.DELIVERY_RECEIPTS.RECIPIENT]),t.setReceiverType(n[T.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(n[T.MessageConstatnts.KEYS.RECEIVER])),n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.READ_RECEIPTS.READ_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.READ_RECEIPT),t.setReadAt(n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.READ_RECEIPTS.READ_AT]),_.isFalsy(n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.READ_RECEIPTS.RECIPIENT])?n[T.READ_RECEIPTS.READ_BY_ME_AT]=n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.READ_RECEIPTS.READ_AT]:t.setSender(n[T.MessageConstatnts.KEYS.MY_RECEIPTS][T.READ_RECEIPTS.RECIPIENT]),t.setReceiverType(n[T.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(n[T.MessageConstatnts.KEYS.RECEIVER]))}));try{if(Object.assign(a,n),(n=a).parentId&&(n.parentMessageId=n.parentId,delete n.parentId),n instanceof C.BaseMessage&&(_.isFalsy(i)||n.setRawMessage(i)),n instanceof h.TextMessage)S.extractDetailsFromMentions(n),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.getData()[T.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[T.MessageConstatnts.KEYS.METADATA]);else if(n instanceof f.MediaMessage)S.extractDetailsFromMentions(n),n.getData()[T.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[T.MessageConstatnts.KEYS.METADATA]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver());else if(n instanceof g.Action)n.setSender(n.getSender()),n.setReceiver(n.getActionFor()),n.setActionBy(n.getActionBy()),n.setActionOn(n.getActionOn()),n.setActionFor(n.getActionFor()),n.setMessage(n.getMessage());else if(n instanceof R.Call){try{n.setSender(n.getSender())}catch(e){_.Logger.error("MessageController: trasformJSONMessge: setSender",e)}try{n.setCallInitiator(n.getCallInitiator())}catch(e){_.Logger.error("MessageController: trasformJSONMessge: setCallInitiator",e)}try{n.setReceiver(n.getCallReceiver()),n.setCallReceiver(n.getCallReceiver())}catch(e){_.Logger.error("MessageController: trasformJSONMessge: setCallreceiver",e)}}else n instanceof O.CustomMessage?(n.getData()[T.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[T.MessageConstatnts.KEYS.METADATA]),n.setCustomData(n.getData()[T.MessageConstatnts.KEYS.CUSTOM_DATA]),n.setSubType(n.getData()[T.MessageConstatnts.KEYS.CUSTOM_SUB_TYPE]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver())):n instanceof m.InteractiveMessage&&(n.setMetadata(n.getData()[T.MessageConstatnts.KEYS.METADATA]),n.setInteractiveData(n.getData()[T.MessageConstatnts.KEYS.INTERACTIVE_DATA]),n.setInteractionGoal(n.getInteractionGoal()),n.setInteractions(n.getInteractions()),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.setIsSenderInteractionAllowed(n.getData()[T.MessageConstatnts.KEYS.ALLOW_SENDER_INTERACTION]));n.hasOwnProperty("rawMessage")||(i=JSON.parse(JSON.stringify(n))),n instanceof C.BaseMessage&&(_.isFalsy(i)||n.setRawMessage(i))}catch(e){_.Logger.error("MessageController: trasformJSONMessge: Main",e),n=null}return n}catch(e){_.Logger.error("MessageController: trasformJSONMessge",e)}},S.extractDetailsFromMentions=function(e){if(e.getData()[T.MessageConstatnts.KEYS.MENTIONS]){var t=[],n=!1,r=N.CometChat.user,o=e.getData()[T.MessageConstatnts.KEYS.MENTIONS];for(var s in o)s.toString()==(null==r?void 0:r.getUid())&&(n=!0),t.push(new a.User(o[s]));e.setMentionedUsers(t),e.setHasMentionedMe(n)}},S.getReceiptsFromJSON=function(o){return new Promise(function(e,t){try{var r=[];N.CometChat.getLoggedInUser().then(function(n){_.isFalsy(o.receipts)?e([]):(o.receipts.data.map(function(e){var t=new A.MessageReceipt;e[T.DELIVERY_RECEIPTS.DELIVERED_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.DELIVERY_RECEIPT),t.setDeliveredAt(e[T.DELIVERY_RECEIPTS.DELIVERED_AT]),t.setTimestamp(e[T.DELIVERY_RECEIPTS.DELIVERED_AT]),_.isFalsy(e[T.DELIVERY_RECEIPTS.RECIPIENT])?t.setSender(n):t.setSender(i.UsersController.trasformJSONUser(e[T.DELIVERY_RECEIPTS.RECIPIENT])),t.setReceiverType(o[T.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(o[T.MessageConstatnts.KEYS.RECEIVER])),e[T.READ_RECEIPTS.READ_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.READ_RECEIPT),t.setReadAt(e[T.READ_RECEIPTS.READ_AT]),t.setTimestamp(e[e[T.READ_RECEIPTS.READ_AT]]),_.isFalsy(e[T.READ_RECEIPTS.RECIPIENT])?t.setSender(n):t.setSender(i.UsersController.trasformJSONUser(e[T.READ_RECEIPTS.RECIPIENT])),t.setReceiverType(o[T.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(o[T.MessageConstatnts.KEYS.RECEIVER])),r.push(t)}),e(r))})}catch(e){t(new s.CometChatException(e))}})},S}();t.MessageController=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UsersController=void 0;var r=n(3),o=n(0),s=function(){function e(){}return e.trasformJSONUser=function(e){var t;try{e.uid=e.uid.toString(),e.name=e.name.toString(),e.status&&"offline"!==e.status?e.status="online":e.status="offline",t=new r.User(e),Object.assign(t,e),e=t}catch(e){o.Logger.error("UsersController:transformJSONUser",e)}return e},e}();t.UsersController=s},function(e,t,n){"use strict";var r,o,s,i,a,E,c,u;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PROVIDER_ID=t.APIResponseConstants=t.APIConstants=t.PushPlatforms=t.MutedConversationType=t.DayOfWeek=t.DNDOptions=t.MemberActionsOptions=t.ReactionsOptions=t.RepliesOptions=t.MessagesOptions=void 0,(r=t.MessagesOptions||(t.MessagesOptions={}))[r.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",r[r.SUBSCRIBE_TO_ALL=2]="SUBSCRIBE_TO_ALL",r[r.SUBSCRIBE_TO_MENTIONS=3]="SUBSCRIBE_TO_MENTIONS",(o=t.RepliesOptions||(t.RepliesOptions={}))[o.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",o[o.SUBSCRIBE_TO_ALL=2]="SUBSCRIBE_TO_ALL",o[o.SUBSCRIBE_TO_MENTIONS=3]="SUBSCRIBE_TO_MENTIONS",(s=t.ReactionsOptions||(t.ReactionsOptions={}))[s.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",s[s.SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES=2]="SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES",s[s.SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES=3]="SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES",(i=t.MemberActionsOptions||(t.MemberActionsOptions={}))[i.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",i[i.SUBSCRIBE=2]="SUBSCRIBE",(a=t.DNDOptions||(t.DNDOptions={}))[a.DISABLED=1]="DISABLED",a[a.ENABLED=2]="ENABLED",(E=t.DayOfWeek||(t.DayOfWeek={})).MONDAY="monday",E.TUESDAY="tuesday",E.WEDNESDAY="wednesday",E.THURSDAY="thursday",E.FRIDAY="friday",E.SATURDAY="saturday",E.SUNDAY="sunday",(c=t.MutedConversationType||(t.MutedConversationType={})).ONE_ON_ONE="oneOnOne",c.GROUP="group",(u=t.PushPlatforms||(t.PushPlatforms={})).FCM_IONIC_CORDOVA_ANDROID="fcm_ionic_cordova_android",u.FCM_IONIC_CORDOVA_IOS="fcm_ionic_cordova_ios",u.APNS_IONIC_CORDOVA_DEVICE="apns_ionic_cordova_device",u.APNS_IONIC_CORDOVA_VOIP="apns_ionic_cordova_voip",t.APIConstants={KEY_GROUP_PREFERENCES:"groupPreferences",KEY_GROUP_MESSAGES:"groupMessages",KEY_GROUP_REACTIONS:"groupReactions",KEY_GROUP_REPLIES:"groupReplies",KEY_GROUP_MEMBER_ADDED:"groupMemberAdded",KEY_GROUP_MEMBER_LEFT:"groupMemberLeft",KEY_GROUP_MEMBER_JOINED:"groupMemberJoined",KEY_GROUP_MEMBER_KICKED:"groupMemberKicked",KEY_GROUP_MEMBER_BANNED:"groupMemberBanned",KEY_GROUP_MEMBER_UNBANNED:"groupMemberUnbanned",KEY_GROUP_MEMBER_SCOPE_CHANGED:"groupMemberScopeChanged",KEY_MUTE_PREFERENCES:"mutePreferences",KEY_MUTE_DND:"dnd",KEY_MUTE_SCHEDULE:"schedule",KEY_ONE_ON_ONE_PREFERENCES:"oneOnOnePreferences",KEY_ONE_ON_ONE_MESSAGES:"oneOnOneMessages",KEY_ONE_ON_ONE_REACTIONS:"oneOnOneReactions",KEY_ONE_ON_ONE_REPLIES:"oneOnOneReplies",KEY_USE_PRIVACY_TEMPLATE:"usePrivacyTemplate",KEY_PROVIDER_ID:"providerId",KEY_TIMEZONE:"timezone",KEY_PLATFORM:"platform",KEY_FCM_TOKEN:"fcmToken",KEY_DEVICE_TOKEN:"deviceToken",KEY_VOIP_TOKEN:"voipToken",KEY_CONVERSATIONS:"conversations",KEY_GET_PREFERENCES:"getPushPreferences",KEY_UPDATE_PREFERENCES:"updatePushPreferences",KEY_RESET_PREFERENCES:"resetPushPreferences",KEY_REGISTER_TOKEN:"registerToken",KEY_UNREGISTER_TOKEN:"unregisterToken",KEY_MUTE_CONVERSATIONS:"muteConversations",KEY_UNMUTE_CONVERSATIONS:"unmuteConversations",KEY_GET_MUTED_CONVERSATIONS:"getMutedConversations",KEY_MUTED_CONVERSATIONS:"mutedConversations",KEY_FROM:"from",KEY_TO:"to",KEY_GET_TIMEZONE:"getTimezone",KEY_UPDATE_TIMEZONE:"updateTimezone"},t.APIResponseConstants={TOKEN_REGISTER_SUCCESS:"Push token registered successfully.",TOKEN_REGISTER_ERROR:"Failed to register push token.",TOKEN_UNREGISTER_SUCCESS:"Push token unregistered successfully.",TOKEN_UNREGISTER_ERROR:"Failed to unregister push token.",MUTE_CONVERSATION_SUCCESS:"Conversations muted successfully.",MUTE_CONVERSATION_ERROR:"Failed to mute conversations.",UNMUTE_CONVERSATION_SUCCESS:"Conversations unmuted successfully.",UNMUTE_CONVERSATION_ERROR:"Failed to unmute conversations.",TIMEZONE_UPDATE_SUCCESS:"Timezone updated successfully.",TIMEZONE_UPDATE_ERROR:"Failed to update Timezone.",TIMEZONE_FETCH_ERROR:"Failed to fetch Timezone."},t.DEFAULT_PROVIDER_ID="default"},function(e,t,n){(function(r){e.exports=function o(s,i,a){function E(n,e){if(!i[n]){if(!s[n]){if(c)return c(n,!0);var t=new Error("Cannot find module '"+n+"'");throw t.code="MODULE_NOT_FOUND",t}var r=i[n]={exports:{}};s[n][0].call(r.exports,function(e){var t=s[n][1][e];return E(t||e)},r,r.exports,o,s,i,a)}return i[n].exports}for(var c=!1,e=0;e<a.length;e++)E(a[e]);return E}({1:[function(e,u,t){(function(t){"use strict";var n,r,e=t.MutationObserver||t.WebKitMutationObserver;if(e){var o=0,s=new e(c),i=t.document.createTextNode("");s.observe(i,{characterData:!0}),n=function(){i.data=o=++o%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var a=new t.MessageChannel;a.port1.onmessage=c,n=function(){a.port2.postMessage(0)}}var E=[];function c(){var e,t;r=!0;for(var n=E.length;n;){for(t=E,E=[],e=-1;++e<n;)t[e]();n=E.length}r=!1}u.exports=function(e){1!==E.push(e)||r||n()}}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var o=e(1);function c(){}var u={},s=["REJECTED"],i=["FULFILLED"],a=["PENDING"];function r(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,e!==c&&d(this,e)}function E(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function p(t,n,r){o(function(){var e;try{e=n(r)}catch(e){return u.reject(t,e)}e===t?u.reject(t,new TypeError("Cannot resolve promise with itself")):u.resolve(t,e)})}function l(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function d(t,e){var n=!1;function r(e){n||(n=!0,u.reject(t,e))}function o(e){n||(n=!0,u.resolve(t,e))}var s=S(function(){e(o,r)});"error"===s.status&&r(s.value)}function S(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=r).prototype.catch=function(e){return this.then(null,e)},r.prototype.then=function(e,t){if("function"!=typeof e&&this.state===i||"function"!=typeof t&&this.state===s)return this;var n=new this.constructor(c);if(this.state!==a){var r=this.state===i?e:t;p(n,r,this.outcome)}else this.queue.push(new E(n,e,t));return n},E.prototype.callFulfilled=function(e){u.resolve(this.promise,e)},E.prototype.otherCallFulfilled=function(e){p(this.promise,this.onFulfilled,e)},E.prototype.callRejected=function(e){u.reject(this.promise,e)},E.prototype.otherCallRejected=function(e){p(this.promise,this.onRejected,e)},u.resolve=function(e,t){var n=S(l,t);if("error"===n.status)return u.reject(e,n.value);var r=n.value;if(r)d(e,r);else{e.state=i,e.outcome=t;for(var o=-1,s=e.queue.length;++o<s;)e.queue[o].callFulfilled(t)}return e},u.reject=function(e,t){e.state=s,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},r.resolve=function(e){return e instanceof this?e:u.resolve(new this(c),e)},r.reject=function(e){var t=new this(c);return u.reject(t,e)},r.all=function(e){var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,o=!1;if(!r)return this.resolve([]);for(var s=new Array(r),i=0,t=-1,a=new this(c);++t<r;)E(e[t],t);return a;function E(e,t){n.resolve(e).then(function(e){s[t]=e,++i!==r||o||(o=!0,u.resolve(a,s))},function(e){o||(o=!0,u.reject(a,e))})}},r.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var o,s=-1,i=new this(c);++s<n;)o=e[s],t.resolve(o).then(function(e){r||(r=!0,u.resolve(i,e))},function(e){r||(r=!0,u.reject(i,e))});return i}},{1:1}],3:[function(t,e,n){(function(e){"use strict";"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(t,n){t=t||[],n=n||{};try{return new Blob(t,n)}catch(e){if("TypeError"!==e.name)throw e;for(var r="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,o=new r,s=0;s<t.length;s+=1)o.append(t[s]);return o.getBlob(n.type)}}"undefined"==typeof Promise&&e(3);var p=Promise;function l(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function u(e){return"string"!=typeof e&&(e=String(e)),e}function s(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var a="local-forage-detect-blob-support",o=void 0,d={},S=Object.prototype.toString,C="readonly",h="readwrite";function f(e){return"boolean"==typeof o?p.resolve(o):(r=e,new p(function(n){var e=r.transaction(a,h),t=i([""]);e.objectStore(a).put(t,"key"),e.onabort=function(e){e.preventDefault(),e.stopPropagation(),n(!1)},e.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),t=navigator.userAgent.match(/Edge\//);n(t||!e||43<=parseInt(e[1],10))}}).catch(function(){return!1})).then(function(e){return o=e});var r}function _(e){var t=d[e.name],n={};n.promise=new p(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then(function(){return n.promise}):t.dbReady=n.promise}function T(e){var t=d[e.name],n=t.deferredOperations.pop();if(n)return n.resolve(),n.promise}function g(e,t){var n=d[e.name],r=n.deferredOperations.pop();if(r)return r.reject(t),r.promise}function R(o,s){return new p(function(e,t){if(d[o.name]=d[o.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},o.db){if(!s)return e(o.db);_(o),o.db.close()}var n=[o.name];s&&n.push(o.version);var r=E.open.apply(E,n);s&&(r.onupgradeneeded=function(e){var t=r.result;try{t.createObjectStore(o.storeName),e.oldVersion<=1&&t.createObjectStore(a)}catch(e){if("ConstraintError"!==e.name)throw e}}),r.onerror=function(e){e.preventDefault(),t(r.error)},r.onsuccess=function(){e(r.result),T(o)}})}function A(e){return R(e,!1)}function I(e){return R(e,!0)}function O(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(e.version,e.version=e.db.version),o||n){if(n){var s=e.db.version+1;s>e.version&&(e.version=s)}return!0}return!1}function N(e){var t=function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}(atob(e.data));return i([t],{type:e.type})}function m(e){return e&&e.__local_forage_encoded_blob}function y(e){var t=this,n=t._initReady().then(function(){var e=d[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(n,e,e),n}function P(t,n,r,o){void 0===o&&(o=1);try{var e=t.db.transaction(t.storeName,n);r(null,e)}catch(e){if(0<o&&(!t.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return p.resolve().then(function(){if(!t.db||"NotFoundError"===e.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),I(t)}).then(function(){return function(n){_(n);for(var r=d[n.name],o=r.forages,e=0;e<o.length;e++){var t=o[e];t._dbInfo.db&&(t._dbInfo.db.close(),t._dbInfo.db=null)}return n.db=null,A(n).then(function(e){return n.db=e,O(n)?I(n):e}).then(function(e){n.db=r.db=e;for(var t=0;t<o.length;t++)o[t]._dbInfo.db=e}).catch(function(e){throw g(n,e),e})}(t).then(function(){P(t,n,r,o-1)})}).catch(r);r(e)}}var v={_driver:"asyncStorage",_initStorage:function(e){var r=this,o={db:null};if(e)for(var t in e)o[t]=e[t];var s=d[o.name];s||(s={forages:[],db:null,dbReady:null,deferredOperations:[]},d[o.name]=s),s.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=y);var n=[];function i(){return p.resolve()}for(var a=0;a<s.forages.length;a++){var E=s.forages[a];E!==r&&n.push(E._initReady().catch(i))}var c=s.forages.slice(0);return p.all(n).then(function(){return o.db=s.db,A(o)}).then(function(e){return o.db=e,O(o,r._defaultConfig.version)?I(o):e}).then(function(e){o.db=s.db=e,r._dbInfo=o;for(var t=0;t<c.length;t++){var n=c[t];n!==r&&(n._dbInfo.db=o.db,n._dbInfo.version=o.version)}})},_support:function(){try{if(!E)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(a,e){var E=this,t=new p(function(s,i){E.ready().then(function(){P(E._dbInfo,C,function(e,t){if(e)return i(e);try{var n=t.objectStore(E._dbInfo.storeName),r=n.openCursor(),o=1;r.onsuccess=function(){var e=r.result;if(e){var t=e.value;m(t)&&(t=N(t));var n=a(t,e.key,o++);void 0!==n?s(n):e.continue()}else s()},r.onerror=function(){i(r.error)}}catch(e){i(e)}})}).catch(i)});return l(t,e),t},getItem:function(i,e){var a=this;i=u(i);var t=new p(function(o,s){a.ready().then(function(){P(a._dbInfo,C,function(e,t){if(e)return s(e);try{var n=t.objectStore(a._dbInfo.storeName),r=n.get(i);r.onsuccess=function(){var e=r.result;void 0===e&&(e=null),m(e)&&(e=N(e)),o(e)},r.onerror=function(){s(r.error)}}catch(e){s(e)}})}).catch(s)});return l(t,e),t},setItem:function(a,t,e){var E=this;a=u(a);var n=new p(function(s,i){var e;E.ready().then(function(){return e=E._dbInfo,"[object Blob]"===S.call(t)?f(e.db).then(function(e){return e?t:(r=t,new p(function(n,e){var t=new FileReader;t.onerror=e,t.onloadend=function(e){var t=btoa(e.target.result||"");n({__local_forage_encoded_blob:!0,data:t,type:r.type})},t.readAsBinaryString(r)}));var r}):t}).then(function(o){P(E._dbInfo,h,function(e,t){if(e)return i(e);try{var n=t.objectStore(E._dbInfo.storeName);null===o&&(o=void 0);var r=n.put(o,a);t.oncomplete=function(){void 0===o&&(o=null),s(o)},t.onabort=t.onerror=function(){var e=r.error?r.error:r.transaction.error;i(e)}}catch(e){i(e)}})}).catch(i)});return l(n,e),n},removeItem:function(i,e){var a=this;i=u(i);var t=new p(function(o,s){a.ready().then(function(){P(a._dbInfo,h,function(e,t){if(e)return s(e);try{var n=t.objectStore(a._dbInfo.storeName),r=n.delete(i);t.oncomplete=function(){o()},t.onerror=function(){s(r.error)},t.onabort=function(){var e=r.error?r.error:r.transaction.error;s(e)}}catch(e){s(e)}})}).catch(s)});return l(t,e),t},clear:function(e){var i=this,t=new p(function(o,s){i.ready().then(function(){P(i._dbInfo,h,function(e,t){if(e)return s(e);try{var n=t.objectStore(i._dbInfo.storeName),r=n.clear();t.oncomplete=function(){o()},t.onabort=t.onerror=function(){var e=r.error?r.error:r.transaction.error;s(e)}}catch(e){s(e)}})}).catch(s)});return l(t,e),t},length:function(e){var i=this,t=new p(function(o,s){i.ready().then(function(){P(i._dbInfo,C,function(e,t){if(e)return s(e);try{var n=t.objectStore(i._dbInfo.storeName),r=n.count();r.onsuccess=function(){o(r.result)},r.onerror=function(){s(r.error)}}catch(e){s(e)}})}).catch(s)});return l(t,e),t},key:function(a,e){var E=this,t=new p(function(s,i){a<0?s(null):E.ready().then(function(){P(E._dbInfo,C,function(e,t){if(e)return i(e);try{var n=t.objectStore(E._dbInfo.storeName),r=!1,o=n.openCursor();o.onsuccess=function(){var e=o.result;e?0===a?s(e.key):r?s(e.key):(r=!0,e.advance(a)):s(null)},o.onerror=function(){i(o.error)}}catch(e){i(e)}})}).catch(i)});return l(t,e),t},keys:function(e){var a=this,t=new p(function(s,i){a.ready().then(function(){P(a._dbInfo,C,function(e,t){if(e)return i(e);try{var n=t.objectStore(a._dbInfo.storeName),r=n.openCursor(),o=[];r.onsuccess=function(){var e=r.result;e?(o.push(e.key),e.continue()):s(o)},r.onerror=function(){i(r.error)}}catch(e){i(e)}})}).catch(i)});return l(t,e),t},dropInstance:function(a,e){e=s.apply(this,arguments);var t,n=this.config();if((a="function"!=typeof a&&a||{}).name||(a.name=a.name||n.name,a.storeName=a.storeName||n.storeName),a.name){var r=a.name===n.name&&this._dbInfo.db,o=r?p.resolve(this._dbInfo.db):A(a).then(function(e){var t=d[a.name],n=t.forages;t.db=e;for(var r=0;r<n.length;r++)n[r]._dbInfo.db=e;return e});t=a.storeName?o.then(function(e){if(e.objectStoreNames.contains(a.storeName)){var o=e.version+1;_(a);var r=d[a.name],s=r.forages;e.close();for(var t=0;t<s.length;t++){var n=s[t];n._dbInfo.db=null,n._dbInfo.version=o}var i=new p(function(t,n){var r=E.open(a.name,o);r.onerror=function(e){var t=r.result;t.close(),n(e)},r.onupgradeneeded=function(){var e=r.result;e.deleteObjectStore(a.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}});return i.then(function(e){r.db=e;for(var t=0;t<s.length;t++){var n=s[t];n._dbInfo.db=e,T(n._dbInfo)}}).catch(function(e){throw(g(a,e)||p.resolve()).catch(function(){}),e})}}):o.then(function(e){_(a);var r=d[a.name],o=r.forages;e.close();for(var t=0;t<o.length;t++){var n=o[t];n._dbInfo.db=null}var s=new p(function(t,n){var r=E.deleteDatabase(a.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}});return s.then(function(e){r.db=e;for(var t=0;t<o.length;t++){var n=o[t];T(n._dbInfo)}}).catch(function(e){throw(g(a,e)||p.resolve()).catch(function(){}),e})})}else t=p.reject("Invalid arguments");return l(t,e),t}},M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=/^~~local_forage_type~([^~]+)~/,U="__lfsc__:",D=U.length,Y="arbf",w="blob",G=D+Y.length,b=Object.prototype.toString;function K(e){var t,n,r,o,s,i=.75*e.length,a=e.length,E=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);var c=new ArrayBuffer(i),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=M.indexOf(e[t]),r=M.indexOf(e[t+1]),o=M.indexOf(e[t+2]),s=M.indexOf(e[t+3]),u[E++]=n<<2|r>>4,u[E++]=(15&r)<<4|o>>2,u[E++]=(3&o)<<6|63&s;return c}function B(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=M[n[t]>>2],r+=M[(3&n[t])<<4|n[t+1]>>4],r+=M[(15&n[t+1])<<2|n[t+2]>>6],r+=M[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var F={serialize:function(t,n){var e="";if(t&&(e=b.call(t)),t&&("[object ArrayBuffer]"===e||t.buffer&&"[object ArrayBuffer]"===b.call(t.buffer))){var r,o=U;t instanceof ArrayBuffer?(r=t,o+=Y):(r=t.buffer,"[object Int8Array]"===e?o+="si08":"[object Uint8Array]"===e?o+="ui08":"[object Uint8ClampedArray]"===e?o+="uic8":"[object Int16Array]"===e?o+="si16":"[object Uint16Array]"===e?o+="ur16":"[object Int32Array]"===e?o+="si32":"[object Uint32Array]"===e?o+="ui32":"[object Float32Array]"===e?o+="fl32":"[object Float64Array]"===e?o+="fl64":n(new Error("Failed to get type for BinaryArray"))),n(o+B(r))}else if("[object Blob]"===e){var s=new FileReader;s.onload=function(){var e="~~local_forage_type~"+t.type+"~"+B(this.result);n(U+w+e)},s.readAsArrayBuffer(t)}else try{n(JSON.stringify(t))}catch(e){n(null,e)}},deserialize:function(e){if(e.substring(0,D)!==U)return JSON.parse(e);var t,n=e.substring(G),r=e.substring(D,G);if(r===w&&L.test(n)){var o=n.match(L);t=o[1],n=n.substring(o[0].length)}var s=K(n);switch(r){case Y:return s;case w:return i([s],{type:t});case"si08":return new Int8Array(s);case"ui08":return new Uint8Array(s);case"uic8":return new Uint8ClampedArray(s);case"si16":return new Int16Array(s);case"ur16":return new Uint16Array(s);case"si32":return new Int32Array(s);case"ui32":return new Uint32Array(s);case"fl32":return new Float32Array(s);case"fl64":return new Float64Array(s);default:throw new Error("Unkown type: "+r)}},stringToBuffer:K,bufferToString:B};function x(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function V(e,r,o,s,i,a){e.executeSql(o,s,i,function(e,n){n.code===n.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[r.storeName],function(e,t){t.rows.length?a(e,n):x(e,r,function(){e.executeSql(o,s,i,a)},a)},a):a(e,n)},a)}function k(i,e,a,E){var c=this;i=u(i);var t=new p(function(o,s){c.ready().then(function(){void 0===e&&(e=null);var n=e,r=c._dbInfo;r.serializer.serialize(e,function(t,e){e?s(e):r.db.transaction(function(e){V(e,r,"INSERT OR REPLACE INTO "+r.storeName+" (key, value) VALUES (?, ?)",[i,t],function(){o(n)},function(e,t){s(t)})},function(e){if(e.code===e.QUOTA_ERR){if(0<E)return void o(k.apply(c,[i,n,a,E-1]));s(e)}})})}).catch(s)});return l(t,a),t}var J={_driver:"webSQLStorage",_initStorage:function(e){var r=this,o={db:null};if(e)for(var t in e)o[t]="string"!=typeof e[t]?e[t].toString():e[t];var n=new p(function(t,n){try{o.db=openDatabase(o.name,String(o.version),o.description,o.size)}catch(e){return n(e)}o.db.transaction(function(e){x(e,o,function(){r._dbInfo=o,t()},function(e,t){n(t)})},n)});return o.serializer=F,n},_support:"function"==typeof openDatabase,iterate:function(c,e){var t=this,n=new p(function(E,n){t.ready().then(function(){var a=t._dbInfo;a.db.transaction(function(e){V(e,a,"SELECT * FROM "+a.storeName,[],function(e,t){for(var n=t.rows,r=n.length,o=0;o<r;o++){var s=n.item(o),i=s.value;if(i&&(i=a.serializer.deserialize(i)),void 0!==(i=c(i,s.key,o+1)))return void E(i)}E()},function(e,t){n(t)})})}).catch(n)});return l(n,e),n},getItem:function(t,e){var s=this;t=u(t);var n=new p(function(o,n){s.ready().then(function(){var r=s._dbInfo;r.db.transaction(function(e){V(e,r,"SELECT * FROM "+r.storeName+" WHERE key = ? LIMIT 1",[t],function(e,t){var n=t.rows.length?t.rows.item(0).value:null;n&&(n=r.serializer.deserialize(n)),o(n)},function(e,t){n(t)})})}).catch(n)});return l(n,e),n},setItem:function(e,t,n){return k.apply(this,[e,t,n,1])},removeItem:function(o,e){var s=this;o=u(o);var t=new p(function(n,r){s.ready().then(function(){var t=s._dbInfo;t.db.transaction(function(e){V(e,t,"DELETE FROM "+t.storeName+" WHERE key = ?",[o],function(){n()},function(e,t){r(t)})})}).catch(r)});return l(t,e),t},clear:function(e){var o=this,t=new p(function(n,r){o.ready().then(function(){var t=o._dbInfo;t.db.transaction(function(e){V(e,t,"DELETE FROM "+t.storeName,[],function(){n()},function(e,t){r(t)})})}).catch(r)});return l(t,e),t},length:function(e){var o=this,t=new p(function(r,n){o.ready().then(function(){var t=o._dbInfo;t.db.transaction(function(e){V(e,t,"SELECT COUNT(key) as c FROM "+t.storeName,[],function(e,t){var n=t.rows.item(0).c;r(n)},function(e,t){n(t)})})}).catch(n)});return l(t,e),t},key:function(o,e){var s=this,t=new p(function(r,n){s.ready().then(function(){var t=s._dbInfo;t.db.transaction(function(e){V(e,t,"SELECT key FROM "+t.storeName+" WHERE id = ? LIMIT 1",[o+1],function(e,t){var n=t.rows.length?t.rows.item(0).key:null;r(n)},function(e,t){n(t)})})}).catch(n)});return l(t,e),t},keys:function(e){var r=this,t=new p(function(o,n){r.ready().then(function(){var t=r._dbInfo;t.db.transaction(function(e){V(e,t,"SELECT key FROM "+t.storeName,[],function(e,t){for(var n=[],r=0;r<t.rows.length;r++)n.push(t.rows.item(r).key);o(n)},function(e,t){n(t)})})}).catch(n)});return l(t,e),t},dropInstance:function(n,e){e=s.apply(this,arguments);var r=this.config();(n="function"!=typeof n&&n||{}).name||(n.name=n.name||r.name,n.storeName=n.storeName||r.storeName);var t,o=this;return l(t=n.name?new p(function(e){var t,s;t=n.name===r.name?o._dbInfo.db:openDatabase(n.name,"","",0),n.storeName?e({db:t,storeNames:[n.storeName]}):e((s=t,new p(function(o,n){s.transaction(function(e){e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(e,t){for(var n=[],r=0;r<t.rows.length;r++)n.push(t.rows.item(r).name);o({db:s,storeNames:n})},function(e,t){n(t)})},function(e){n(e)})})))}).then(function(a){return new p(function(s,i){a.db.transaction(function(r){function e(t){return new p(function(e,n){r.executeSql("DROP TABLE IF EXISTS "+t,[],function(){e()},function(e,t){n(t)})})}for(var t=[],n=0,o=a.storeNames.length;n<o;n++)t.push(e(a.storeNames[n]));p.all(t).then(function(){s()}).catch(function(e){i(e)})},function(e){i(e)})})}):p.reject("Invalid arguments"),e),t}};function H(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function W(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||0<localStorage.length}var j={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=H(e,this._defaultConfig),W()?((this._dbInfo=t).serializer=F,p.resolve()):p.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(E,e){var c=this,t=c.ready().then(function(){for(var e=c._dbInfo,t=e.keyPrefix,n=t.length,r=localStorage.length,o=1,s=0;s<r;s++){var i=localStorage.key(s);if(0===i.indexOf(t)){var a=localStorage.getItem(i);if(a&&(a=e.serializer.deserialize(a)),void 0!==(a=E(a,i.substring(n),o++)))return a}}});return l(t,e),t},getItem:function(n,e){var r=this;n=u(n);var t=r.ready().then(function(){var e=r._dbInfo,t=localStorage.getItem(e.keyPrefix+n);return t&&(t=e.serializer.deserialize(t)),t});return l(t,e),t},setItem:function(i,e,t){var a=this;i=u(i);var n=a.ready().then(function(){void 0===e&&(e=null);var s=e;return new p(function(n,r){var o=a._dbInfo;o.serializer.serialize(e,function(e,t){if(t)r(t);else try{localStorage.setItem(o.keyPrefix+i,e),n(s)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e)}})})});return l(n,t),n},removeItem:function(t,e){var n=this;t=u(t);var r=n.ready().then(function(){var e=n._dbInfo;localStorage.removeItem(e.keyPrefix+t)});return l(r,e),r},clear:function(e){var r=this,t=r.ready().then(function(){for(var e=r._dbInfo.keyPrefix,t=localStorage.length-1;0<=t;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}});return l(t,e),t},length:function(e){var t=this.keys().then(function(e){return e.length});return l(t,e),t},key:function(n,e){var r=this,t=r.ready().then(function(){var t,e=r._dbInfo;try{t=localStorage.key(n)}catch(e){t=null}return t&&(t=t.substring(e.keyPrefix.length)),t});return l(t,e),t},keys:function(e){var s=this,t=s.ready().then(function(){for(var e=s._dbInfo,t=localStorage.length,n=[],r=0;r<t;r++){var o=localStorage.key(r);0===o.indexOf(e.keyPrefix)&&n.push(o.substring(e.keyPrefix.length))}return n});return l(t,e),t},dropInstance:function(t,e){if(e=s.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var n=this.config();t.name=t.name||n.name,t.storeName=t.storeName||n.storeName}var r,o=this;return l(r=t.name?new p(function(e){t.storeName?e(H(t,o._defaultConfig)):e(t.name+"/")}).then(function(e){for(var t=localStorage.length-1;0<=t;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}):p.reject("Invalid arguments"),e),r}},q=function(e,t){for(var n=e.length,r=0;r<n;){if((o=e[r])===(s=t)||"number"==typeof o&&"number"==typeof s&&isNaN(o)&&isNaN(s))return!0;r++}var o,s;return!1},X=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},z={},Q={},Z={INDEXEDDB:v,WEBSQL:J,LOCALSTORAGE:j},$=[Z.INDEXEDDB._driver,Z.WEBSQL._driver,Z.LOCALSTORAGE._driver],ee=["dropInstance"],te=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ee),ne={description:"",driver:$.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function re(t,n){t[n]=function(){var e=arguments;return t.ready().then(function(){return t[n].apply(t,e)})}}function oe(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(X(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var se=function(){function o(e){for(var t in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),Z)if(Z.hasOwnProperty(t)){var n=Z[t],r=n._driver;this[t]=r,z[r]||this.defineDriver(n)}this._defaultConfig=oe({},ne),this._config=oe({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(e){if("object"!==(void 0===e?"undefined":r(e)))return"string"==typeof e?this._config[e]:this._config;if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)},o.prototype.defineDriver=function(u,e,t){var n=new p(function(t,n){try{var r=u._driver,e=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver)return void n(e);for(var o=te.concat("_initStorage"),s=0,i=o.length;s<i;s++){var a=o[s],E=!q(ee,a);if((E||u[a])&&"function"!=typeof u[a])return void n(e)}!function(){for(var e=function(n){return function(){var e=new Error("Method "+n+" is not implemented by the current driver"),t=p.reject(e);return l(t,arguments[arguments.length-1]),t}},t=0,n=ee.length;t<n;t++){var r=ee[t];u[r]||(u[r]=e(r))}}();var c=function(e){z[r],z[r]=u,Q[r]=e,t()};"_support"in u?u._support&&"function"==typeof u._support?u._support().then(c,n):c(!!u._support):c(!0)}catch(e){n(e)}});return c(n,e,t),n},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(e,t,n){var r=z[e]?p.resolve(z[e]):p.reject(new Error("Driver not found."));return c(r,t,n),r},o.prototype.getSerializer=function(e){var t=p.resolve(F);return c(t,e),t},o.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(n,e,e),n},o.prototype.setDriver=function(e,t,n){var s=this;X(e)||(e=[e]);var r=this._getSupportedDrivers(e);function i(){s._config.driver=s.driver()}function a(e){return s._extend(e),i(),s._ready=s._initStorage(s._config),s._ready}var o=null!==this._driverSet?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=o.then(function(){var e=r[0];return s._dbInfo=null,s._ready=null,s.getDriver(e).then(function(e){var o;s._driver=e._driver,i(),s._wrapLibraryMethodsWithReady(),s._initDriver=(o=r,function(){var n=0;function r(){for(;n<o.length;){var e=o[n];return n++,s._dbInfo=null,s._ready=null,s.getDriver(e).then(a).catch(r)}i();var t=new Error("No available storage method found.");return s._driverSet=p.reject(t),s._driverSet}return r()})})}).catch(function(){i();var e=new Error("No available storage method found.");return s._driverSet=p.reject(e),s._driverSet}),c(this._driverSet,t,n),this._driverSet},o.prototype.supports=function(e){return!!Q[e]},o.prototype._extend=function(e){oe(this,e)},o.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},o.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=te.length;e<t;e++)re(this,te[e])},o.prototype.createInstance=function(e){return new o(e)},o}(),ie=new se;t.exports=ie},{3:3}]},{},[4])(4)}).call(this,n(11))},function(e,s,i){"use strict";(function(e){i.d(s,"a",function(){return r}),i.d(s,"b",function(){return o});var t,n=i(50),r=(t="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:{}).Capacitor=t.Capacitor||new n.a,o=r.Plugins}).call(this,i(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorage=void 0;var r=n(0),o=n(1),s=n(15),i=n(4),a=n(2),E=function(){function e(e){this.store=o.constants.DEFAULT_STORE,r.isFalsy(e)||(this.store=e),this.localStore=s.createInstance({name:r.format(o.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),o.LOCAL_STORE.COMMON_STORE)}),this.localStore.setDriver([s.LOCALSTORAGE,s.INDEXEDDB,s.WEBSQL])}return e.getInstance=function(){return null==e.localStorage&&(e.localStorage=new e),e.localStorage},e.prototype.set=function(e,t){return this.localStore.setItem(e,JSON.stringify(t))},e.prototype.remove=function(e){this.localStore.removeItem(e)},e.prototype.update=function(e,t){this.remove(e),this.set(e,t)},e.prototype.get=function(e){var r=this;return new Promise(function(n,t){try{r.localStore.getItem(e).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.clearStore=function(){var r=this;return new Promise(function(n,t){try{r.localStore.keys().then(function(e){if(0<e.length)for(var t=0;t<e.length;t++)"appId"!==e[t]&&r.localStore.removeItem(e[t]),t===e.length-1&&n(!0)})}catch(e){t(e)}})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.localStorage=null,e}();t.LocalStorage=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupsController=void 0;var r=n(9),o=n(1),s=n(0),i=function(){function e(){}return e.trasformJSONGroup=function(e){var t;try{t=new r.Group(e[o.GroupConstants.KEYS.GUID],e[o.GroupConstants.KEYS.NAME],e[o.GroupConstants.KEYS.TYPE]),e.wsChannel&&delete e.wsChannel,Object.assign(t,e),e=t}catch(e){s.Logger.error("GroupsController:transformJSONGroup",e)}return e},e}();t.GroupsController=i},function(e,t,n){"use strict";var r,s=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.TextMessage=void 0;var o=n(7),a=n(1),E=n(3),c=n(9),u=n(0),p=function(o){function e(e,t,n){var r=o.call(this,e,"text",n,a.MessageCategory.MESSAGE)||this;return r.type="text",r.data={text:t},r.text=t,r}return s(e,o),e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getText=function(){return this.text},e.prototype.setText=function(e){this.text=e,this.data.text=e},e.prototype.setProcessedText=function(e){this.processedText=e},e.prototype.getProcessedText=function(){return this.processedText},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("TextMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new E.User(t);var n=new c.Group(t[a.GroupConstants.KEYS.GUID],t[a.GroupConstants.KEYS.NAME],t[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("TextMessageModel: getReceiverFromData",e),e}},e.TYPE=a.MessageConstatnts.TYPE.TEXT,e.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=a.MessageConstatnts.CATEGORY.MESSAGE,e}(o.BaseMessage);t.TextMessage=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionCount=void 0;var r=n(0),o=function(){function e(e,t,n){this.reactedByMe=!1,r.isFalsy(e)||(this.reaction=e),r.isFalsy(t)||(this.count=t),null===n&&void 0===n||(this.reactedByMe=n)}return e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getCount=function(){return this.count},e.prototype.setCount=function(e){this.count=e},e.prototype.getReactedByMe=function(){return!!this.reactedByMe&&this.reactedByMe},e.prototype.setReactedByMe=function(e){this.reactedByMe=e},e}();t.ReactionCount=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaMessage=void 0;var s=n(7),a=n(1),E=n(3),c=n(22),u=n(9),p=n(0),l=function(s){function e(e,t,n,r){var o=s.call(this,e,n,r,a.MessageCategory.MESSAGE)||this;return o.data={},"object"!=typeof t?o.data={url:t}:t&&(0<t.length?o.files=t:o.files=[t]),o}return o(e,s),e.prototype.setCaption=function(e){this.caption=e,this.data[a.MessageConstatnts.KEYS.TEXT]=e},e.prototype.getCaption=function(){return this.data[a.MessageConstatnts.KEYS.TEXT]},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getAttachment=function(){return new c.Attachment(this.data.attachments[0])},e.prototype.setAttachment=function(e){this.data.attachments=[c.Attachment.toJSON(e)]},e.prototype.getAttachments=function(){var e=[];if(this.data.attachments&&0<this.data.attachments.length)for(var t=0;t<this.data.attachments.length;t++)e.push(new c.Attachment(this.data.attachments[t]));return e},e.prototype.setAttachments=function(e){var t=[];if(e&&0<e.length)for(var n=0;n<e.length;n++)t.push(c.Attachment.toJSON(e[n]));this.data.attachments=t},e.prototype.getURL=function(){try{var e=this.getData();if(e[a.MessageConstatnts.KEYS.URL])return e[a.MessageConstatnts.KEYS.URL]}catch(e){p.Logger.error("MediaMessageModel: getURL",e)}},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw p.Logger.error("MediaMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new E.User(t);var n=new u.Group(t[a.GroupConstants.KEYS.GUID],t[a.GroupConstants.KEYS.NAME],t[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw p.Logger.error("MediaMessageModel: getReceiverFromData",e),e}},e.TYPE=a.MessageConstatnts.TYPE,e.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=a.MessageConstatnts.CATEGORY,e}(s.BaseMessage);t.MediaMessage=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Attachment=void 0;var r=n(1),o=function(){function t(e){e.hasOwnProperty(r.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION)&&(this.extension=e[r.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION]),e.hasOwnProperty(r.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE)&&(this.mimeType=e[r.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE]),e.hasOwnProperty(r.ATTACHMENTS_CONSTANTS.KEYS.NAME)&&(this.name=e[r.ATTACHMENTS_CONSTANTS.KEYS.NAME]),e.hasOwnProperty(r.ATTACHMENTS_CONSTANTS.KEYS.SIZE)&&(this.size=e[r.ATTACHMENTS_CONSTANTS.KEYS.SIZE]),e.hasOwnProperty(r.ATTACHMENTS_CONSTANTS.KEYS.URL)&&(this.url=e[r.ATTACHMENTS_CONSTANTS.KEYS.URL])}return t.prototype.createFileFromJSON=function(e){return new t(e)},t.toJSON=function(e){return{extension:e.getExtension(),mimeType:e.getMimeType(),name:e.getName(),url:e.getUrl(),size:e.getSize()}},t.prototype.getExtension=function(){return this.extension},t.prototype.setExtension=function(e){this.extension=e},t.prototype.getMimeType=function(){return this.mimeType},t.prototype.setMimeType=function(e){this.mimeType=e},t.prototype.getName=function(){return this.name},t.prototype.setName=function(e){this.name=e},t.prototype.getSize=function(){return this.size},t.prototype.setSize=function(e){this.size=e},t.prototype.getUrl=function(){return this.url},t.prototype.setUrl=function(e){this.url=e},t}();t.Attachment=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.CustomMessage=void 0;var i=n(7),E=n(1),c=n(3),u=n(0),p=n(9),a=function(a){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this;if(3==e.length){var r=e[0],o=e[1],s=e[2];n=a.call(this,r,E.MessageConstatnts.TYPE.CUSTOM,o,E.MessageCategory.MESSAGE)||this,("object"!=typeof s||Array.isArray(s))&&(s={}),n.customData=s,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=s}if(4==e.length){r=e[0],o=e[1];var i=e[2];s=e[3];n=a.call(this,r,i,o,E.MessageCategory.CUSTOM)||this,("object"!=typeof s||Array.isArray(s))&&(s={}),n.customData=s,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=s}return n}return o(e,a),e.prototype.getConversationText=function(){var e;return null!==(e=this.data.text)&&void 0!==e?e:""},e.prototype.setConversationText=function(e){this.data.text=e},e.prototype.willUpdateConversation=function(){var e;return null!==(e=this.data.updateConversation)&&void 0!==e&&e},e.prototype.shouldUpdateConversation=function(e){this.data.updateConversation=e},e.prototype.willSendNotification=function(){var e;return null!==(e=this.data.sendNotification)&&void 0!==e&&e},e.prototype.shouldSendNotification=function(e){this.data.sendNotification=e},e.prototype.getCustomData=function(){return this.customData},e.prototype.setCustomData=function(e){this.customData=e,this.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=e},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getSubType=function(){return this.subType},e.prototype.setSubType=function(e){this.subType=e,this.data=s(s({},this.data),{subType:e})},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=s(s({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new c.User(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("CustomMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER)return new c.User(t);var n=new p.Group(t[E.GroupConstants.KEYS.GUID],t[E.GroupConstants.KEYS.NAME],t[E.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("CustomMessageModel: getReceiverFromData",e),e}},e}(i.BaseMessage);t.CustomMessage=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.InteractiveMessage=void 0;var i=n(7),c=n(1),a=n(3),u=n(0),p=n(9),l=n(39),d=n(25),E=function(E){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this;if(4==e.length){var r=e[0],o=e[1],s=e[2],i=e[3];(n=E.call(this,r,s,o,c.MessageCategory.INTERACTIVE)||this).interactionGoal=new l.InteractionGoal(c.GoalType.NONE,[]),("object"!=typeof i||Array.isArray(i))&&(i={}),n.interactiveData=i,n.interactions=[],u.isFalsy(n.data)&&(n.data={}),n.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=i,n.data[c.MessageConstatnts.KEYS.INTERACTION_GOAL]=new l.InteractionGoal(c.GoalType.NONE,[])}else if(5==e.length){r=e[0],o=e[1],s=e[2],i=e[3];var a=e[4];n=E.call(this,r,s,o,c.MessageCategory.INTERACTIVE)||this,("object"!=typeof i||Array.isArray(i))&&(i={}),("object"!=typeof a||Array.isArray(a))&&(a={}),n.interactiveData=i,n.interactionGoal=a,u.isFalsy(n.data)&&(n.data={}),n.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=i,n.data[c.MessageConstatnts.KEYS.INTERACTION_GOAL]=a,n.interactions=[]}return n}return o(e,E),e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getInteractiveData=function(){return this.interactiveData},e.prototype.setInteractiveData=function(e){this.interactiveData=e,this.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=e},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getInteractionGoal=function(){try{return this.getInteractionGoalFromdata()}catch(e){return this.interactionGoal}},e.prototype.setInteractionGoal=function(e){this.interactionGoal=e,this.data=s(s({},this.data),{interactionGoal:e})},e.prototype.getInteractions=function(){try{return this.getInteractionsFromData()}catch(e){return this.interactions}},e.prototype.setInteractions=function(e){this.interactions=e;var t=c.MessageConstatnts.KEYS.INTERACTIONS;this.data[t]=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=s(s({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.setIsSenderInteractionAllowed=function(e){this.allowSenderInteraction=this.allowSenderInteraction},e.prototype.getIsSenderInteractionAllowed=function(){return this.allowSenderInteraction},e.prototype.getInteractionGoalFromdata=function(){try{var e=this.getData();if(e[c.MessageConstatnts.KEYS.INTERACTION_GOAL])return new l.InteractionGoal(e[c.MessageConstatnts.KEYS.INTERACTION_GOAL][c.MessageConstatnts.KEYS.TYPE],e[c.MessageConstatnts.KEYS.INTERACTION_GOAL][c.MessageConstatnts.KEYS.ELEMENT_IDS])}catch(e){throw u.Logger.error("InteractiveMessageModel: getFromData",e),e}},e.prototype.getInteractionsFromData=function(){try{var e=this.getData();if(e[c.MessageConstatnts.KEYS.INTERACTIONS])return(e[c.MessageConstatnts.KEYS.INTERACTIONS]||[]).map(function(e){return new d.Interaction(e[c.MessageConstatnts.KEYS.ELEMENT_ID],e[c.MessageConstatnts.KEYS.INTERACTED_AT])})}catch(e){throw u.Logger.error("InteractiveMessageModel: getFromData",e),e}},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.SENDER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new a.User(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.SENDER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("CustomMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.RECEIVER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.RECEIVER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new a.User(t);var n=new p.Group(t[c.GroupConstants.KEYS.GUID],t[c.GroupConstants.KEYS.NAME],t[c.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("InteractiveMessageModel: getReceiverFromData",e),e}},e}(i.BaseMessage);t.InteractiveMessage=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Interaction=void 0;var r=n(1),o=function(){function n(e,t){this.elementId=e,this.interactedAt=t}return n.prototype.getElementId=function(){return this.elementId},n.prototype.getInteractedAt=function(){return this.interactedAt},n.prototype.setElementId=function(e){this.elementId=e},n.prototype.setInteractedAt=function(e){this.interactedAt=this.interactedAt},n.getInteractionFromJSON=function(e){var t=e[r.MessageConstatnts.KEYS.INTERACTED_AT];return new n(e[r.MessageConstatnts.KEYS.ELEMENT_ID],t)},n}();t.Interaction=o},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var i=n(7),c=n(9),u=n(3),p=n(1),a=n(0),l=n(12),E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.actionFromJSON=function(e){var t=new this(e[p.MessageConstatnts.KEYS.RECEIVER],e[p.MessageConstatnts.KEYS.TYPE],e[p.MessageConstatnts.KEYS.RECEIVER_TYPE],p.MessageCategory.ACTION),n=e[p.MessageConstatnts.KEYS.DATA];if(t.data=n,t.setAction(n[p.MessageConstatnts.KEYS.ACTION]),n[p.ActionConstatnts.ACTION_KEYS.EXTRAS]){var r=n[p.ActionConstatnts.ACTION_KEYS.EXTRAS];if(r[p.ActionConstatnts.ACTION_KEYS.SCOPE]){var o=r[p.ActionConstatnts.ACTION_KEYS.SCOPE];o[p.ActionConstatnts.ACTION_KEYS.NEW]&&o[p.ActionConstatnts.ACTION_KEYS.OLD]&&(t.setOldScope(o[p.ActionConstatnts.ACTION_KEYS.OLD]),t.setNewScope(o[p.ActionConstatnts.ACTION_KEYS.NEW]))}}n[p.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[p.MessageConstatnts.KEYS.METADATA]);var s=n[p.ActionConstatnts.ACTION_KEYS.ENTITIES];if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var i=new u.User(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=i,t.setSender(i)}else{var a=new c.Group("","","");Object.assign(a,s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=a}if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR])if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=i}else{a=new c.Group("","","");Object.assign(a,s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=a}if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON])if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=i}else if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.GROUP){a=new c.Group("","","");Object.assign(a,s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=a}else if(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.MESSAGE){var E=l.MessageController.trasformJSONMessge(s[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]);t.actionOn=E}return t.setMessage(t.getActionMessage(t)),t},t.prototype.getOldScope=function(){return this.oldScope},t.prototype.setOldScope=function(e){this.oldScope=e},t.prototype.getNewScope=function(){return this.newScope},t.prototype.setNewScope=function(e){this.newScope=e},t.prototype.getRawData=function(){return this.rawData},t.prototype.setRawData=function(e){this.rawData=e},t.prototype.getMessage=function(){return this.message},t.prototype.setMessage=function(e){this.message=e},t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getActionBy=function(){return this.actionBy},t.prototype.setActionBy=function(e){this.actionBy=e},t.prototype.getActionOn=function(){return this.actionOn},t.prototype.setActionOn=function(e){this.actionOn=e},t.prototype.getActionFor=function(){return this.actionFor},t.prototype.setActionFor=function(e){this.actionFor=e},t.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},t.prototype.setMetadata=function(e){this.metadata=e,this.data=s(s({},this.data),{metadata:e})},t.prototype.getActionMessage=function(e){var t="";switch(e.getType()){case p.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_USER:case p.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP:switch(e.getAction()){case p.ActionConstatnts.ACTION_KEYS.ACTION_CREATED:case p.ActionConstatnts.ACTION_KEYS.ACTION_UPDATED:case p.ActionConstatnts.ACTION_KEYS.ACTION_DELETED:}break;case p.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP_MEMBER:switch(e.getAction()){case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_JOINED:var n=e.getActionBy();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_GROUP_JOINED_MESSAGE,n.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_LEFT:n=e.getActionBy();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_GROUP_LEFT_MESSAGE,n.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_KICKED:n=e.getActionBy();var r=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_KICKED_MESSAGE,n.getName(),r.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_BANNED:n=e.getActionBy(),r=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_BANNED_MESSAGE,n.getName(),r.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_UNBANNED:n=e.getActionBy(),r=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_UNBANNED_MESSAGE,n.getName(),r.getName());break;case p.ActionConstatnts.ACTION_KEYS.ACTION_SCOPE_CHANGED:n=e.getActionBy(),r=e.getActionOn();var o=e.getNewScope();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_SCOPE_CHANGED,n.getName(),r.getName(),o);break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_ADDED:n=e.getActionBy(),r=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_ADDED_TO_GROUP,n.getName(),r.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_EDITED:t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MESSAGE_EDITED_MESSAGE,"");break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_DELETED:t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MESSAGE_DELETED_MESSAGE,"")}}return t},t.prototype.getSenderFromData=function(){var e=this.data[p.ActionConstatnts.ACTION_KEYS.ENTITIES];if(e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY]&&e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var t=new u.User(e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]);return Object.assign(t,e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t}},t.TYPE=p.MessageConstatnts.TYPE,t.RECEIVER_TYPE=p.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=p.MessageConstatnts.CATEGORY,t.ACTION_TYPE=p.ActionConstatnts.ACTION_TYPE,t}(i.BaseMessage);t.Action=E},function(e,t,n){"use strict";var r,s=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Call=void 0;var o=n(7),a=n(9),E=n(1),c=n(0),u=n(3),p=function(o){function e(e,t,n,r){return c.isFalsy(r)?o.call(this,e,t,n,E.MessageCategory.CALL)||this:o.call(this,e,t,n,r)||this}return s(e,o),e.prototype.getCallInitiator=function(){try{return this.getCallInitiatedByFromData()}catch(e){return this.callInitiator}},e.prototype.setCallInitiator=function(e){this.callInitiator=e},e.prototype.getCallReceiver=function(){try{return this.getCallReceivedByFromData()}catch(e){return this.callReceiver}},e.prototype.setCallReceiver=function(e){this.callReceiver=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getSessionId=function(){return this.sessionId},e.prototype.setSessionId=function(e){this.sessionId=e},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getAction=function(){return this.action},e.prototype.setAction=function(e){this.action=e},e.prototype.getInitiatedAt=function(){return this.initiatedAt},e.prototype.setInitiatedAt=function(e){this.initiatedAt=e},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.getRawData=function(){return this.rawData},e.prototype.setRawData=function(e){this.rawData=e},e.callFromJSON=function(e){try{var t=new this(e[E.MessageConstatnts.KEYS.RECEIVER],e[E.MessageConstatnts.KEYS.TYPE],e[E.MessageConstatnts.KEYS.RECEIVER_TYPE],E.MessageCategory.CALL),n=e[E.MessageConstatnts.KEYS.DATA];t.setAction(n[E.MessageConstatnts.KEYS.ACTION]),n[E.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[E.MessageConstatnts.KEYS.METADATA]);var r=n[E.ActionConstatnts.ACTION_KEYS.ENTITIES];if(r[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])r[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY];if(r[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON]){var o=r[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON];if(o[E.CallConstants.CALL_KEYS.CALL_ENTITY]){var s=o[E.CallConstants.CALL_KEYS.CALL_ENTITY];if(s[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]&&(t.sessionId=s[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]),s[E.CallConstants.CALL_KEYS.CALL_STATUS]&&(t.status=s[E.CallConstants.CALL_KEYS.CALL_STATUS]),s[E.CallConstants.CALL_KEYS.CALL_DATA]){var i=s[E.CallConstants.CALL_KEYS.CALL_DATA];if(i[E.CallConstants.CALL_KEYS.CALL_METADATA]&&(t.metadata=i[E.CallConstants.CALL_KEYS.CALL_METADATA]),i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES])i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES]}s[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]&&(t.initiatedAt=s[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]),s[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]&&(t.joinedAt=s[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]),s[E.CallConstants.CALL_KEYS.CALL_LEFT_AT]&&(t.joinedAt=s[E.CallConstants.CALL_KEYS.CALL_LEFT_AT])}}return t}catch(e){c.Logger.error("CallModel: callFromJSON",e)}},e.prototype.getSenderFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(e){throw c.Logger.error("CallModel:getSenderFromData",e),e}},e.prototype.getCallInitiatedByFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.CallConstants.CALL_KEYS.CALL_DATA][E.ActionConstatnts.ACTION_KEYS.ENTITIES][E.CallConstants.CALL_KEYS.CALL_SENDER])return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.CallConstants.CALL_KEYS.CALL_DATA][E.ActionConstatnts.ACTION_KEYS.ENTITIES][E.CallConstants.CALL_KEYS.CALL_SENDER][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(e){throw c.Logger.error("CallModel:getCallInitiatedByFromData",e),e}},e.prototype.getCallReceivedByFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]){if(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY_TYPE]==E.CallConstants.CALL_KEYS.CALL_ENTITY_USER)return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]);var t=new a.Group(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.GUID],e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.NAME],e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.TYPE]);return Object.assign(t,e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY])}}catch(e){throw c.Logger.error("CallModel:getCallReceivedByFromData",e),e}},e.TYPE=E.MessageConstatnts.TYPE,e.RECEIVER_TYPE=E.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=E.MessageConstatnts.CATEGORY,e.ACTION_TYPE=E.ActionConstatnts.ACTION_TYPE,e}(o.BaseMessage);t.Call=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageReceipt=void 0;var r=function(){function e(){this.RECEIPT_TYPE={READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery",READ_BY_ALL_RECEIPT:"readByAll",DELIVERED_TO_ALL_RECEIPT:"deliveredToAll"},this.receiptType=this.RECEIPT_TYPE.DELIVERY_RECEIPT}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.setTimestamp=function(e){this.timestamp=e},e.prototype.setReadAt=function(e){this.readAt=e},e.prototype.getReadAt=function(){return this.readAt},e.prototype.setDeliveredAt=function(e){this.deliveredAt=e},e.prototype.getDeliveredAt=function(){return this.deliveredAt},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getReceiptType=function(){return this.receiptType},e.prototype.setReceiptType=function(e){void 0===e&&(e=this.RECEIPT_TYPE.DELIVERY_RECEIPT),this.receiptType=e},e}();t.MessageReceipt=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeyStore=void 0;var r=n(4),o=n(0),s=n(1),i=n(15),a=n(2),E=function(){function e(e){this.store=s.constants.DEFAULT_STORE,o.isFalsy(e)||(this.store=e),this.keyStore=i.createInstance({name:o.format(s.LOCAL_STORE.STORE_STRING,r.CometChat.getAppId(),s.LOCAL_STORE.KEYS_STORE)}),this.keyStore.setDriver([i.LOCALSTORAGE,i.INDEXEDDB,i.WEBSQL])}return e.getInstance=function(){return null==e.KeyStore&&(e.KeyStore=new e),e.KeyStore},e.prototype.set=function(e,t){return this.keyStore.setItem(e,t)},e.prototype.remove=function(e){this.keyStore.removeItem(e)},e.prototype.get=function(e){var r=this;return new Promise(function(n,t){try{r.keyStore.getItem(e).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.clearStore=function(){return this.keyStore.clear()},e}();t.KeyStore=E},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.WSConnectionListener=t.UserLoginListener=t.CallsListener=t.UserCallListener=t.GroupsListener=t.UsersListener=t.MessagesListener=t.Listener=t.ConnectionListener=t.LoginListener=t.OngoingCallListener=t.GroupListener=t.UserListener=t.CallListener=t.MessageListener=void 0;var o=n(0),s=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onTextMessageReceived=void 0,this.onMediaMessageReceived=void 0,this.onCustomMessageReceived=void 0,this.onTypingStarted=void 0,this.onTypingEnded=void 0,this.onMessagesDelivered=void 0,this.onMessagesRead=void 0,this.onMessagesDeliveredToAll=void 0,this.onMessagesReadByAll=void 0,this.onMessageEdited=void 0,this.onMessageDeleted=void 0,this.onTransientMessageReceived=void 0,this.onInteractiveMessageReceived=void 0,this.onInteractionGoalCompleted=void 0,this.onMessageReactionAdded=void 0,this.onMessageReactionRemoved=void 0,o.isFalsy(e[0].onTextMessageReceived)||(this.onTextMessageReceived=e[0].onTextMessageReceived),o.isFalsy(e[0].onMediaMessageReceived)||(this.onMediaMessageReceived=e[0].onMediaMessageReceived),o.isFalsy(e[0].onTypingStarted)||(this.onTypingStarted=e[0].onTypingStarted),o.isFalsy(e[0].onTypingEnded)||(this.onTypingEnded=e[0].onTypingEnded),o.isFalsy(e[0].onMessagesDelivered)||(this.onMessagesDelivered=e[0].onMessagesDelivered),o.isFalsy(e[0].onMessagesRead)||(this.onMessagesRead=e[0].onMessagesRead),o.isFalsy(e[0].onCustomMessageReceived)||(this.onCustomMessageReceived=e[0].onCustomMessageReceived),o.isFalsy(e[0].onMessageEdited)||(this.onMessageEdited=e[0].onMessageEdited),o.isFalsy(e[0].onMessageDeleted)||(this.onMessageDeleted=e[0].onMessageDeleted),o.isFalsy(e[0].onTransientMessageReceived)||(this.onTransientMessageReceived=e[0].onTransientMessageReceived),o.isFalsy(e[0].onInteractiveMessageReceived)||(this.onInteractiveMessageReceived=e[0].onInteractiveMessageReceived),o.isFalsy(e[0].onInteractionGoalCompleted)||(this.onInteractionGoalCompleted=e[0].onInteractionGoalCompleted),o.isFalsy(e[0].onMessageReactionAdded)||(this.onMessageReactionAdded=e[0].onMessageReactionAdded),o.isFalsy(e[0].onMessageReactionRemoved)||(this.onMessageReactionRemoved=e[0].onMessageReactionRemoved),o.isFalsy(e[0].onMessagesDeliveredToAll)||(this.onMessagesDeliveredToAll=e[0].onMessagesDeliveredToAll),o.isFalsy(e[0].onMessagesReadByAll)||(this.onMessagesReadByAll=e[0].onMessagesReadByAll)};t.MessageListener=s;var a=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onIncomingCallReceived=void 0,this.onOutgoingCallAccepted=void 0,this.onOutgoingCallRejected=void 0,this.onIncomingCallCancelled=void 0,this.onCallEndedMessageReceived=void 0,o.isFalsy(e[0].onIncomingCallReceived)||(this.onIncomingCallReceived=e[0].onIncomingCallReceived),o.isFalsy(e[0].onOutgoingCallAccepted)||(this.onOutgoingCallAccepted=e[0].onOutgoingCallAccepted),o.isFalsy(e[0].onOutgoingCallRejected)||(this.onOutgoingCallRejected=e[0].onOutgoingCallRejected),o.isFalsy(e[0].onIncomingCallCancelled)||(this.onIncomingCallCancelled=e[0].onIncomingCallCancelled),o.isFalsy(e[0].onCallEndedMessageReceived)||(this.onCallEndedMessageReceived=e[0].onCallEndedMessageReceived)};t.CallListener=a;var E=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.isFalsy(e[0].onUserOnline)||(this.onUserOnline=e[0].onUserOnline),o.isFalsy(e[0].onUserOffline)||(this.onUserOffline=e[0].onUserOffline)};t.UserListener=E;var c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.isFalsy(e[0].onGroupMemberJoined)||(this.onGroupMemberJoined=e[0].onGroupMemberJoined),o.isFalsy(e[0].onGroupMemberLeft)||(this.onGroupMemberLeft=e[0].onGroupMemberLeft),o.isFalsy(e[0].onGroupMemberKicked)||(this.onGroupMemberKicked=e[0].onGroupMemberKicked),o.isFalsy(e[0].onGroupMemberBanned)||(this.onGroupMemberBanned=e[0].onGroupMemberBanned),o.isFalsy(e[0].onGroupMemberUnbanned)||(this.onGroupMemberUnbanned=e[0].onGroupMemberUnbanned),o.isFalsy(e[0].onGroupMemberScopeChanged)||(this.onGroupMemberScopeChanged=e[0].onGroupMemberScopeChanged),o.isFalsy(e[0].onMemberAddedToGroup)||(this.onGroupMemberAddedToGroup=e[0].onMemberAddedToGroup)};t.GroupListener=c;var u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.isFalsy(e[0].onYouLeft)||(this.onYouLeft=e[0].onYouLeft),o.isFalsy(e[0].onYouJoined)||(this.onYouJoined=e[0].onYouJoined),o.isFalsy(e[0].onUserJoined)||(this.onUserJoined=e[0].onUserJoined),o.isFalsy(e[0].onUserLeft)||(this.onUserLeft=e[0].onUserLeft),o.isFalsy(e[0].onUserListUpdated)||(this.onUserListUpdated=e[0].onUserListUpdated),o.isFalsy(e[0].onAudioModesUpdated)||(this.onAudioModesUpdated=e[0].onAudioModesUpdated),o.isFalsy(e[0].onCallEnded)||(this.onCallEnded=e[0].onCallEnded),o.isFalsy(e[0].onError)||(this.onError=e[0].onError),o.isFalsy(e[0].onRecordingStarted)||(this.onRecordingStarted=e[0].onRecordingStarted),o.isFalsy(e[0].onRecordingStopped)||(this.onRecordingStopped=e[0].onRecordingStopped),o.isFalsy(e[0].onUserMuted)||(this.onUserMuted=e[0].onUserMuted),o.isFalsy(e[0].onCallSwitchedToVideo)||(this.onCallSwitchedToVideo=e[0].onCallSwitchedToVideo)};t.OngoingCallListener=u;var p=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.isFalsy(e[0].loginSuccess)||(this.loginSuccess=e[0].loginSuccess),o.isFalsy(e[0].loginFailure)||(this.loginFailure=e[0].loginFailure),o.isFalsy(e[0].logoutSuccess)||(this.logoutSuccess=e[0].logoutSuccess),o.isFalsy(e[0].logoutFailure)||(this.logoutFailure=e[0].logoutFailure)};t.LoginListener=p;var l=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onConnected=void 0,this.inConnecting=void 0,this.onDisconnected=void 0,this.onConnectionError=void 0,this.onFeatureThrottled=void 0,o.isFalsy(e[0].onConnected)||(this.onConnected=e[0].onConnected),o.isFalsy(e[0].inConnecting)||(this.inConnecting=e[0].inConnecting),o.isFalsy(e[0].onDisconnected)||(this.onDisconnected=e[0].onDisconnected),o.isFalsy(e[0].onConnectionError)||(this.onConnectionError=e[0].onConnectionError),o.isFalsy(e[0].onFeatureThrottled)||(this.onFeatureThrottled=e[0].onFeatureThrottled)};t.ConnectionListener=l;var d=function(e,t){this._name=e,this._callback=t},S=function(s){function e(e,t,n,r){var o=s.call(this,e,r)||this;return o._eventListener=t,n&&(o._cursor=n),o}return i(e,s),e}(t.Listener=d);t.MessagesListener=S;var C=function(s){function e(e,t,n,r){var o=s.call(this,e,r)||this;return o._eventListener=t,n&&(o._cursor=n),o}return i(e,s),e}(d);t.UsersListener=C;var h=function(s){function e(e,t,n,r){var o=s.call(this,e,r)||this;return o._eventListener=t,n&&(o._cursor=n),o}return i(e,s),e}(d);t.GroupsListener=h;var f=function(o){function e(e,t,n){var r=o.call(this,"callListner",n)||this;return r._eventListener=e,r}return i(e,o),e}(d);t.UserCallListener=f;var _=function(s){function e(e,t,n,r){var o=s.call(this,e,r)||this;return o._eventListener=t,o}return i(e,s),e}(d);t.CallsListener=_;var T=function(s){function e(e,t,n,r){var o=s.call(this,e,r)||this;return o._eventListener=t,n&&(o._cursor=n),o}return i(e,s),e}(d);t.UserLoginListener=T;var g=function(s){function e(e,t,n,r){var o=s.call(this,e,r)||this;return o._eventListener=t,n&&(o._cursor=n),o}return i(e,s),e}(d);t.WSConnectionListener=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationController=void 0;var c=n(43),u=n(0),r=function(){function e(){}return e.trasformJSONConversation=function(e,t,n,r,o,s,i,a){var E;try{E=new c.Conversation(e,t,n,r,o,s,i,a)}catch(e){u.Logger.error("ConversationController:transformJSONConversation",e)}return E},e}();t.ConversationController=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageListnerMaping=void 0;var r=n(0),o=n(1),s=n(15),i=n(4),a=function(){function e(e){this.store=o.constants.DEFAULT_STORE,r.isFalsy(e)||(this.store=e),this.settingsStore=s.createInstance({name:r.format(o.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),o.LOCAL_STORE.MESSAGE_LISTENERS_LIST)}),this.settingsStore.setDriver([s.LOCALSTORAGE,s.INDEXEDDB,s.WEBSQL])}return e.getInstance=function(){return null==e.settingsStore&&(e.settingsStore=new e),e.settingsStore},e.prototype.set=function(e,t){return this.settingsStore.setItem(e,t)},e.prototype.remove=function(e){this.settingsStore.removeItem(e)},e.prototype.get=function(e){return this.settingsStore.getItem(e)},e.prototype.clearStore=function(){return this.settingsStore.clear()},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.settingsStore=null,e}();t.MessageListnerMaping=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypingIndicator=void 0;var r=function(){function e(e,t,n){this.receiverId=e,this.receiverType=t,this.metadata=n}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e}();t.TypingIndicator=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Reaction=void 0;var r=n(3),i=n(0),o=function(){function e(e,t,n,r,o,s){i.isFalsy(e)||(this.id=e),i.isFalsy(t)||(this.messageId=t),i.isFalsy(n)||(this.reaction=n),i.isFalsy(r)||(this.uid=r),i.isFalsy(o)||(this.reactedAt=o),i.isFalsy(s)||(this.reactedBy=s)}return e.prototype.getReactionId=function(){return this.id},e.prototype.setReactionId=function(e){this.id=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getUid=function(){return this.uid},e.prototype.setUid=function(e){this.uid=e},e.prototype.getReactedAt=function(){return this.reactedAt},e.prototype.setReactedAt=function(e){this.reactedAt=e},e.prototype.getReactedBy=function(){return new r.User(this.reactedBy)},e.prototype.setReactedBy=function(e){this.reactedBy=e},e}();t.Reaction=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransientMessage=void 0;var r=function(){function e(e,t,n){this.receiverId=e,this.receiverType=t,this.data=n||{}}return e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e}();t.TransientMessage=r},function(e,t,n){"use strict";var r,o,E,s,c,i,a,u,p,l,d,S,C,h,f,_,T,g,R,A,I,O,N,m,y,P,v,M;n.r(t),(o=r||(r={})).Prompt="PROMPT",o.Camera="CAMERA",o.Photos="PHOTOS",(s=E||(E={})).Rear="REAR",s.Front="FRONT",(i=c||(c={})).Uri="uri",i.Base64="base64",i.DataUrl="dataUrl",(u=a||(a={})).Documents="DOCUMENTS",u.Data="DATA",u.Cache="CACHE",u.External="EXTERNAL",u.ExternalStorage="EXTERNAL_STORAGE",(l=p||(p={})).UTF8="utf8",l.ASCII="ascii",l.UTF16="utf16",(S=d||(d={})).Heavy="HEAVY",S.Medium="MEDIUM",S.Light="LIGHT",(h=C||(C={})).SUCCESS="SUCCESS",h.WARNING="WARNING",h.ERROR="ERROR",(_=f||(f={})).Dark="DARK",_.Light="LIGHT",(g=T||(T={})).Body="body",g.Ionic="ionic",g.Native="native",g.None="none",(A=R||(R={})).Default="DEFAULT",A.Destructive="DESTRUCTIVE",A.Cancel="CANCEL",(O=I||(I={})).Camera="camera",O.Photos="photos",O.Geolocation="geolocation",O.Notifications="notifications",O.ClipboardRead="clipboard-read",O.ClipboardWrite="clipboard-write",O.Microphone="microphone",(m=N||(N={})).Smart="smart",m.Shared="shared",m.User="user",(P=y||(y={})).Dark="DARK",P.Light="LIGHT",(M=v||(v={})).None="NONE",M.Slide="SLIDE",M.Fade="FADE";var L=n(16),U=function(){function e(){this.plugins={},this.loadedPlugins={}}return e.prototype.addPlugin=function(e){this.plugins[e.config.name]=e},e.prototype.getPlugin=function(e){return this.plugins[e]},e.prototype.loadPlugin=function(e){var t=this.getPlugin(e);t&&t.load()},e.prototype.getPlugins=function(){var e=[];for(var t in this.plugins)e.push(this.plugins[t]);return e},e}(),D=new U,Y=function(){function e(e,t){this.config=e,this.loaded=!1,this.listeners={},this.windowListeners={},t?t.addPlugin(this):D.addPlugin(this)}return e.prototype.addWindowListener=function(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0},e.prototype.removeWindowListener=function(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)},e.prototype.addListener=function(e,t){var n=this;this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t);var r=this.windowListeners[e];return r&&!r.registered&&this.addWindowListener(r),{remove:function(){n.removeListener(e,t)}}},e.prototype.removeListener=function(e,t){var n=this.listeners[e];if(n){var r=n.indexOf(t);this.listeners[e].splice(r,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])}},e.prototype.removeAllListeners=function(){for(var e in this.listeners={},this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}},e.prototype.notifyListeners=function(e,t){var n=this.listeners[e];n&&n.forEach(function(e){return e(t)})},e.prototype.hasListeners=function(e){return!!this.listeners[e].length},e.prototype.registerWindowListener=function(e,t){var n=this;this.windowListeners[t]={registered:!1,windowEventName:e,pluginEventName:t,handler:function(e){n.notifyListeners(t,e)}}},e.prototype.requestPermissions=function(){return Capacitor.isNative?Capacitor.nativePromise(this.config.name,"requestPermissions",{}):Promise.resolve({results:[]})},e.prototype.load=function(){this.loaded=!0},e}(),w=function(e){for(var t=0,n=D.getPlugins();t<n.length;t++){var r=n[t];G(e,r)}},G=function(e,t){var n;(!e.hasOwnProperty(t.config.name)||(n=t).config.platforms&&0<=n.config.platforms.indexOf(Capacitor.platform))&&(e[t.config.name]=t)},b=function(e,t){return(b=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 K(e,t){function n(){this.constructor=e}b(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function B(s,i,a,E){return new(a||(a=Promise))(function(e,t){function n(e){try{o(E.next(e))}catch(e){t(e)}}function r(e){try{o(E.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new a(function(e){e(t.value)}).then(n,r)}o((E=E.apply(s,i||[])).next())})}function F(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var x=function(e){function t(){return e.call(this,{name:"Accessibility",platforms:["web"]})||this}return K(t,e),t.prototype.isScreenReaderEnabled=function(){throw new Error("Feature not available in the browser")},t.prototype.speak=function(e){if(!("speechSynthesis"in window))return Promise.reject("Browser does not support the Speech Synthesis API");var t=new SpeechSynthesisUtterance(e.value);return e.language&&(t.lang=e.language),window.speechSynthesis.speak(t),Promise.resolve()},t}(Y),V=new x,k=function(t){function e(){var e=t.call(this,{name:"App",platforms:["web"]})||this;return"undefined"!=typeof document&&document.addEventListener("visibilitychange",e.handleVisibilityChange.bind(e),!1),e}return K(e,t),e.prototype.exitApp=function(){throw new Error("Method not implemented.")},e.prototype.canOpenUrl=function(e){return Promise.resolve({value:!0})},e.prototype.openUrl=function(e){return Promise.resolve({completed:!0})},e.prototype.getLaunchUrl=function(){return Promise.resolve({url:""})},e.prototype.getState=function(){return Promise.resolve({isActive:!0!==document.hidden})},e.prototype.handleVisibilityChange=function(){var e={isActive:!0!==document.hidden};this.notifyListeners("appStateChange",e)},e}(Y),J=new k,H=function(e){function t(){return e.call(this,{name:"Browser",platforms:["web"]})||this}return K(t,e),t.prototype.open=function(t){return B(this,void 0,void 0,function(){return F(this,function(e){return this._lastWindow=window.open(t.url,t.windowName||"_blank"),[2,Promise.resolve()]})})},t.prototype.prefetch=function(e){return B(this,void 0,void 0,function(){return F(this,function(e){return[2,Promise.resolve()]})})},t.prototype.close=function(){return B(this,void 0,void 0,function(){return F(this,function(e){return this._lastWindow&&this._lastWindow.close(),[2,Promise.resolve()]})})},t}(Y),W=new H,j=function(e){function t(){return e.call(this,{name:"Camera",platforms:["web"]})||this}return K(t,e),t.prototype.getPhoto=function(a){return B(this,void 0,void 0,function(){var t=this;return F(this,function(e){return[2,new Promise(function(s,i){return B(t,void 0,void 0,function(){var o,t=this;return F(this,function(e){switch(e.label){case 0:return a.webUseInput?(this.fileInputExperience(a,s),[3,7]):[3,1];case 1:if(!customElements.get("pwa-camera-modal"))return[3,6];o=document.createElement("pwa-camera-modal"),document.body.appendChild(o),e.label=2;case 2:return e.trys.push([2,4,,5]),[4,o.componentOnReady()];case 3:return e.sent(),o.addEventListener("onPhoto",function(r){return B(t,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return null!==(t=r.detail)?[3,1]:(i("User cancelled photos app"),[3,4]);case 1:return t instanceof Error?(i(t.message),[3,4]):[3,2];case 2:return n=s,[4,this._getCameraPhoto(t,a)];case 3:n.apply(void 0,[e.sent()]),e.label=4;case 4:return o.dismiss(),document.body.removeChild(o),[2]}})})}),o.present(),[3,5];case 4:return e.sent(),this.fileInputExperience(a,s),[3,5];case 5:return[3,7];case 6:this.fileInputExperience(a,s),e.label=7;case 7:return[2]}})})})]})})},t.prototype.fileInputExperience=function(o,s){var i=document.querySelector("#_capacitor-camera-input"),a=function(){i.parentNode&&i.parentNode.removeChild(i)};i||((i=document.createElement("input")).id="_capacitor-camera-input",i.type="file",document.body.appendChild(i)),i.accept="image/*",i.capture=!0,o.source===r.Photos||o.source===r.Prompt?i.removeAttribute("capture"):o.direction===E.Front?i.capture="user":o.direction===E.Rear&&(i.capture="environment"),i.addEventListener("change",function(e){var t=i.files[0],n="jpeg";if("image/png"===t.type?n="png":"image/gif"===t.type&&(n="gif"),o.resultType===c.DataUrl||o.resultType===c.Base64){var r=new FileReader;r.addEventListener("load",function(){if(o.resultType===c.DataUrl)s({dataUrl:r.result,format:n});else if(o.resultType===c.Base64){var e=r.result.split(",")[1];s({base64String:e,format:n})}a()}),r.readAsDataURL(t)}else s({webPath:URL.createObjectURL(t),format:n}),a()}),i.click()},t.prototype._getCameraPhoto=function(e,s){return new Promise(function(t,n){var r=new FileReader,o=e.type.split("/")[1];s.resultType===c.Uri?t({webPath:URL.createObjectURL(e),format:o}):(r.readAsDataURL(e),r.onloadend=function(){var e=r.result;s.resultType===c.DataUrl?t({dataUrl:e,format:o}):t({base64String:e.split(",")[1],format:o})},r.onerror=function(e){n(e)})})},t}(Y),q=new j,X=function(e){function t(){return e.call(this,{name:"Clipboard",platforms:["web"]})||this}return K(t,e),t.prototype.write=function(o){return B(this,void 0,void 0,function(){var t,n,r;return F(this,function(e){switch(e.label){case 0:return navigator.clipboard?void 0!==o.string||o.url?navigator.clipboard.writeText?[4,navigator.clipboard.writeText(void 0!==o.string?o.string:o.url)]:[2,Promise.reject("Writting to clipboard not supported in this browser")]:[3,2]:[2,Promise.reject("Clipboard API not available in this browser")];case 1:return e.sent(),[3,10];case 2:if(!o.image)return[3,9];if(!navigator.clipboard.write)return[2,Promise.reject("Setting images not supported in this browser")];e.label=3;case 3:return e.trys.push([3,7,,8]),[4,fetch(o.image)];case 4:return[4,e.sent().blob()];case 5:return t=e.sent(),n=new ClipboardItem(((r={})[t.type]=t,r)),[4,navigator.clipboard.write([n])];case 6:return e.sent(),[3,8];case 7:return e.sent(),[2,Promise.reject("Failed to write image")];case 8:return[3,10];case 9:return[2,Promise.reject("Nothing to write")];case 10:return[2,Promise.resolve()]}})})},t.prototype.read=function(){return B(this,void 0,void 0,function(){var t,n,r,o;return F(this,function(e){switch(e.label){case 0:return navigator.clipboard?navigator.clipboard.read?[3,1]:navigator.clipboard.readText?[2,this.readText()]:[2,Promise.reject("Reading from clipboard not supported in this browser")]:[2,Promise.reject("Clipboard API not available in this browser")];case 1:return e.trys.push([1,5,,6]),[4,navigator.clipboard.read()];case 2:return t=e.sent(),n=t[0].types[0],[4,t[0].getType(n)];case 3:return r=e.sent(),[4,this._getBlobData(r,n)];case 4:return o=e.sent(),[2,Promise.resolve({value:o,type:n})];case 5:return e.sent(),[2,this.readText()];case 6:return[2]}})})},t.prototype.readText=function(){return B(this,void 0,void 0,function(){var t;return F(this,function(e){switch(e.label){case 0:return[4,navigator.clipboard.readText()];case 1:return t=e.sent(),[2,Promise.resolve({value:t,type:"text/plain"})]}})})},t.prototype._getBlobData=function(e,o){return new Promise(function(t,n){var r=new FileReader;o.includes("image")?r.readAsDataURL(e):r.readAsText(e),r.onloadend=function(){var e=r.result;t(e)},r.onerror=function(e){n(e)}})},t}(Y),z=new X,Q=function(t){function o(){var e=t.call(this,{name:"Filesystem",platforms:["web"]})||this;return e.DEFAULT_DIRECTORY=a.Data,e.DB_VERSION=1,e.DB_NAME="Disc",e._writeCmds=["add","put","delete"],e}return K(o,t),o.prototype.initDb=function(){return B(this,void 0,void 0,function(){var r=this;return F(this,function(e){if(void 0!==this._db)return[2,this._db];if(!("indexedDB"in window))throw new Error("This browser doesn't support IndexedDB");return[2,new Promise(function(e,t){var n=indexedDB.open(r.DB_NAME,r.DB_VERSION);n.onupgradeneeded=o.doUpgrade,n.onsuccess=function(){r._db=n.result,e(n.result)},n.onerror=function(){return t(n.error)},n.onblocked=function(){}})]})})},o.doUpgrade=function(e){var t=e.target.result;switch(e.oldVersion){case 0:case 1:default:t.objectStoreNames.contains("FileStorage")&&t.deleteObjectStore("FileStorage"),t.createObjectStore("FileStorage",{keyPath:"path"}).createIndex("by_folder","folder")}},o.prototype.dbRequest=function(i,a){return B(this,void 0,void 0,function(){var s;return F(this,function(e){return s=-1!==this._writeCmds.indexOf(i)?"readwrite":"readonly",[2,this.initDb().then(function(o){return new Promise(function(e,t){var n=o.transaction(["FileStorage"],s).objectStore("FileStorage"),r=n[i].apply(n,a);r.onsuccess=function(){return e(r.result)},r.onerror=function(){return t(r.error)}})})]})})},o.prototype.dbIndexRequest=function(i,a,E){return B(this,void 0,void 0,function(){var s;return F(this,function(e){return s=-1!==this._writeCmds.indexOf(a)?"readwrite":"readonly",[2,this.initDb().then(function(o){return new Promise(function(e,t){var n=o.transaction(["FileStorage"],s).objectStore("FileStorage").index(i),r=n[a].apply(n,E);r.onsuccess=function(){return e(r.result)},r.onerror=function(){return t(r.error)}})})]})})},o.prototype.getPath=function(e,t){e=e||this.DEFAULT_DIRECTORY;var n=void 0!==t?t.replace(/^[/]+|[/]+$/g,""):"",r="/"+e;return""!==t&&(r+="/"+n),r},o.prototype.clear=function(){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return[4,this.initDb()];case 1:return t=e.sent(),n=t.transaction(["FileStorage"],"readwrite"),n.objectStore("FileStorage").clear(),[2,{}]}})})},o.prototype.readFile=function(r){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(r.directory,r.path),[4,this.dbRequest("get",[t])];case 1:if(void 0===(n=e.sent()))throw Error("File does not exist.");return[2,{data:n.content}]}})})},o.prototype.writeFile=function(p){return B(this,void 0,void 0,function(){var t,n,r,o,s,i,a,E,c,u;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(p.directory,p.path),n=p.data,r=p.recursive,[4,this.dbRequest("get",[t])];case 1:if((o=e.sent())&&"directory"===o.type)throw"The supplied path is a directory.";return s=p.encoding,i=t.substr(0,t.lastIndexOf("/")),[4,this.dbRequest("get",[i])];case 2:return void 0!==e.sent()?[3,4]:-1===(a=i.indexOf("/",1))?[3,4]:(E=i.substr(a),[4,this.mkdir({path:E,directory:p.directory,recursive:r})]);case 3:e.sent(),e.label=4;case 4:return c=Date.now(),u={path:t,folder:i,type:"file",size:n.length,ctime:c,mtime:c,content:!s&&0<=n.indexOf(",")?n.split(",")[1]:n},[4,this.dbRequest("put",[u])];case 5:return e.sent(),[2,{uri:u.path}]}})})},o.prototype.appendFile=function(u){return B(this,void 0,void 0,function(){var t,n,r,o,s,i,a,E,c;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(u.directory,u.path),n=u.data,r=t.substr(0,t.lastIndexOf("/")),o=Date.now(),s=o,[4,this.dbRequest("get",[t])];case 1:if((i=e.sent())&&"directory"===i.type)throw"The supplied path is a directory.";return[4,this.dbRequest("get",[r])];case 2:return void 0!==e.sent()?[3,4]:(a=r.indexOf("/",1),E=-1!==a?r.substr(a):"/",[4,this.mkdir({path:E,directory:u.directory,recursive:!0})]);case 3:e.sent(),e.label=4;case 4:return void 0!==i&&(n=i.content+n,s=i.ctime),c={path:t,folder:r,type:"file",size:n.length,ctime:s,mtime:o,content:n},[4,this.dbRequest("put",[c])];case 5:return e.sent(),[2,{}]}})})},o.prototype.deleteFile=function(n){return B(this,void 0,void 0,function(){var t;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(n.directory,n.path),[4,this.dbRequest("get",[t])];case 1:if(void 0===e.sent())throw Error("File does not exist.");return[4,this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(t)])];case 2:if(0!==e.sent().length)throw Error("Folder is not empty.");return[4,this.dbRequest("delete",[t])];case 3:return e.sent(),[2,{}]}})})},o.prototype.mkdir=function(u){return B(this,void 0,void 0,function(){var t,n,r,o,s,i,a,E,c;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(u.directory,u.path),n=u.recursive,r=t.substr(0,t.lastIndexOf("/")),o=(t.match(/\//g)||[]).length,[4,this.dbRequest("get",[r])];case 1:return s=e.sent(),[4,this.dbRequest("get",[t])];case 2:if(i=e.sent(),1===o)throw Error("Cannot create Root directory");if(void 0!==i)throw Error("Current directory does already exist.");if(!n&&2!==o&&void 0===s)throw Error("Parent directory must exist");return n&&2!==o&&void 0===s?(a=r.substr(r.indexOf("/",1)),[4,this.mkdir({path:a,directory:u.directory,recursive:n})]):[3,4];case 3:e.sent(),e.label=4;case 4:return E=Date.now(),c={path:t,folder:r,type:"directory",size:0,ctime:E,mtime:E},[4,this.dbRequest("put",[c])];case 5:return e.sent(),[2,{}]}})})},o.prototype.rmdir=function(p){return B(this,void 0,void 0,function(){var t,n,r,o,s,i,a,E,c,u;return F(this,function(e){switch(e.label){case 0:return t=p.path,n=p.directory,r=p.recursive,o=this.getPath(n,t),[4,this.dbRequest("get",[o])];case 1:if(void 0===(s=e.sent()))throw Error("Folder does not exist.");if("directory"!==s.type)throw Error("Requested path is not a directory");return[4,this.readdir({path:t,directory:n})];case 2:if(0!==(i=e.sent()).files.length&&!r)throw Error("Folder is not empty");a=0,E=i.files,e.label=3;case 3:return a<E.length?(c=E[a],u=t+"/"+c,[4,this.stat({path:u,directory:n})]):[3,9];case 4:return"file"!==e.sent().type?[3,6]:[4,this.deleteFile({path:u,directory:n})];case 5:return e.sent(),[3,8];case 6:return[4,this.rmdir({path:u,directory:n,recursive:r})];case 7:e.sent(),e.label=8;case 8:return a++,[3,3];case 9:return[4,this.dbRequest("delete",[o])];case 10:return e.sent(),[2,{}]}})})},o.prototype.readdir=function(o){return B(this,void 0,void 0,function(){var t,n,r;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(o.directory,o.path),[4,this.dbRequest("get",[t])];case 1:if(n=e.sent(),""!==o.path&&void 0===n)throw Error("Folder does not exist.");return[4,this.dbIndexRequest("by_folder","getAllKeys",[IDBKeyRange.only(t)])];case 2:return r=e.sent(),[2,{files:r.map(function(e){return e.substring(t.length+1)})}]}})})},o.prototype.getUri=function(r){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(r.directory,r.path),[4,this.dbRequest("get",[t])];case 1:return void 0!==(n=e.sent())?[3,3]:[4,this.dbRequest("get",[t+"/"])];case 2:n=e.sent(),e.label=3;case 3:if(void 0===n)throw Error("Entry does not exist.");return[2,{uri:n.path}]}})})},o.prototype.stat=function(r){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(r.directory,r.path),[4,this.dbRequest("get",[t])];case 1:return void 0!==(n=e.sent())?[3,3]:[4,this.dbRequest("get",[t+"/"])];case 2:n=e.sent(),e.label=3;case 3:if(void 0===n)throw Error("Entry does not exist.");return[2,{type:n.type,size:n.size,ctime:n.ctime,mtime:n.mtime,uri:n.path}]}})})},o.prototype.rename=function(t){return B(this,void 0,void 0,function(){return F(this,function(e){return[2,this._copy(t,!0)]})})},o.prototype.copy=function(t){return B(this,void 0,void 0,function(){return F(this,function(e){return[2,this._copy(t,!1)]})})},o.prototype._copy=function(_,T){return void 0===T&&(T=!1),B(this,void 0,void 0,function(){var t,n,r,i,o,s,a,E,c,u,p,l,d,S,C,h,f=this;return F(this,function(e){switch(e.label){case 0:if(t=_.to,n=_.from,r=_.directory,i=_.toDirectory,!t||!n)throw Error("Both to and from must be provided");if(i||(i=r),o=this.getPath(r,n),s=this.getPath(i,t),o===s)return[2,{}];if(s.startsWith(o))throw Error("To path cannot contain the from path");e.label=1;case 1:return e.trys.push([1,3,,6]),[4,this.stat({path:t,directory:i})];case 2:return a=e.sent(),[3,6];case 3:return e.sent(),(E=t.split("/")).pop(),c=E.join("/"),0<E.length?[4,this.stat({path:c,directory:i})]:[3,5];case 4:if("directory"!==e.sent().type)throw new Error("Parent directory of the to path is a file");e.label=5;case 5:return[3,6];case 6:if(a&&"directory"===a.type)throw new Error("Cannot overwrite a directory with a file");return[4,this.stat({path:n,directory:r})];case 7:switch(u=e.sent(),p=function(r,o,s){return B(f,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return t=this.getPath(i,r),[4,this.dbRequest("get",[t])];case 1:return(n=e.sent()).ctime=o,n.mtime=s,[4,this.dbRequest("put",[n])];case 2:return e.sent(),[2]}})})},u.type){case"file":return[3,8];case"directory":return[3,15]}return[3,28];case 8:return[4,this.readFile({path:n,directory:r})];case 9:return l=e.sent(),T?[4,this.deleteFile({path:n,directory:r})]:[3,11];case 10:e.sent(),e.label=11;case 11:return[4,this.writeFile({path:t,directory:i,data:l.data})];case 12:return e.sent(),T?[4,p(t,u.ctime,u.mtime)]:[3,14];case 13:e.sent(),e.label=14;case 14:return[2,{}];case 15:if(a)throw Error("Cannot move a directory over an existing object");e.label=16;case 16:return e.trys.push([16,20,,21]),[4,this.mkdir({path:t,directory:i,recursive:!1})];case 17:return e.sent(),T?[4,p(t,u.ctime,u.mtime)]:[3,19];case 18:e.sent(),e.label=19;case 19:return[3,21];case 20:return e.sent(),[3,21];case 21:return[4,this.readdir({path:n,directory:r})];case 22:d=e.sent().files,S=0,C=d,e.label=23;case 23:return S<C.length?(h=C[S],[4,this._copy({from:n+"/"+h,to:t+"/"+h,directory:r,toDirectory:i},T)]):[3,26];case 24:e.sent(),e.label=25;case 25:return S++,[3,23];case 26:return T?[4,this.rmdir({path:n,directory:r})]:[3,28];case 27:e.sent(),e.label=28;case 28:return[2,{}]}})})},o._debug=!0,o}(Y),Z=new Q,$=function(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return e.forEach(function(e){if(e&&"object"==typeof e)for(var t in e)e.hasOwnProperty(t)&&(n[t]=e[t])}),n},ee=function(e){function t(){return e.call(this,{name:"Geolocation",platforms:["web"]})||this}return K(t,e),t.prototype.getCurrentPosition=function(r){var e=this;return new Promise(function(t,n){return e.requestPermissions().then(function(e){window.navigator.geolocation.getCurrentPosition(function(e){t(e)},function(e){n(e)},$({enableHighAccuracy:!0,timeout:1e4,maximumAge:0},r))})})},t.prototype.watchPosition=function(e,t){return""+window.navigator.geolocation.watchPosition(function(e){t(e)},function(e){t(null,e)},$({enableHighAccuracy:!0,timeout:1e4,maximumAge:0},e))},t.prototype.clearWatch=function(e){return window.navigator.geolocation.clearWatch(parseInt(e.id,10)),Promise.resolve()},t}(Y),te=new ee,ne=function(e){function t(){return e.call(this,{name:"Device",platforms:["web"]})||this}return K(t,e),t.prototype.getInfo=function(){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){return t=navigator.userAgent,n=this.parseUa(t),[2,Promise.resolve({model:n.model,platform:"web",appVersion:"",appBuild:"",appId:"",appName:"",operatingSystem:n.operatingSystem,osVersion:n.osVersion,manufacturer:navigator.vendor,isVirtual:!1,uuid:this.getUid()})]})})},t.prototype.getBatteryInfo=function(){return B(this,void 0,void 0,function(){var t;return F(this,function(e){switch(e.label){case 0:t={},e.label=1;case 1:return e.trys.push([1,3,,4]),[4,navigator.getBattery()];case 2:return t=e.sent(),[3,4];case 3:return e.sent(),[3,4];case 4:return[2,Promise.resolve({batteryLevel:t.level,isCharging:t.charging})]}})})},t.prototype.getLanguageCode=function(){return B(this,void 0,void 0,function(){return F(this,function(e){return[2,{value:navigator.language}]})})},t.prototype.parseUa=function(e){var t={},n=e.indexOf("(")+1,r=e.indexOf(") AppleWebKit");-1!==e.indexOf(") Gecko")&&(r=e.indexOf(") Gecko"));var o=e.substring(n,r);if(-1!==e.indexOf("Android"))t.model=o.replace("; wv","").split("; ").pop().split(" Build")[0],t.osVersion=o.split("; ")[1];else if(t.model=o.split("; ")[0],navigator.oscpu)t.osVersion=navigator.oscpu;else if(-1!==e.indexOf("Windows"))t.osVersion=o;else{var s=o.split("; ").pop().replace(" like Mac OS X","").split(" ");t.osVersion=s[s.length-1].replace(/_/g,".")}return/android/i.test(e)?t.operatingSystem="android":/iPad|iPhone|iPod/.test(e)&&!window.MSStream?t.operatingSystem="ios":/Win/.test(e)?t.operatingSystem="windows":/Mac/i.test(e)?t.operatingSystem="mac":t.operatingSystem="unknown",t},t.prototype.getUid=function(){var e=window.localStorage.getItem("_capuid");return e||(e="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}),window.localStorage.setItem("_capuid",e),e)},t}(Y),re=new ne,oe=function(t){function e(){var e=t.call(this,{name:"LocalNotifications",platforms:["web"]})||this;return e.pending=[],e}return K(e,t),e.prototype.createChannel=function(e){throw new Error("Feature not available in the browser. "+e.id)},e.prototype.deleteChannel=function(e){throw new Error("Feature not available in the browser. "+e.id)},e.prototype.listChannels=function(){throw new Error("Feature not available in the browser")},e.prototype.sendPending=function(){var t=this,n=[],r=+new Date;this.pending.forEach(function(e){e.schedule&&e.schedule.at&&+e.schedule.at<=r&&(t.buildNotification(e),n.push(e))}),this.pending=this.pending.filter(function(t){return!n.find(function(e){return e===t})})},e.prototype.sendNotification=function(e){var t=this,n=e;if(e.schedule&&e.schedule.at){var r=+e.schedule.at-+new Date;return this.pending.push(n),void setTimeout(function(){t.sendPending()},r)}this.buildNotification(e)},e.prototype.buildNotification=function(e){var t=e;return new Notification(t.title,{body:t.body})},e.prototype.schedule=function(e){var t=this,n=[];return e.notifications.forEach(function(e){n.push(t.sendNotification(e))}),Promise.resolve({notifications:e.notifications.map(function(e){return{id:""+e.id}})})},e.prototype.getPending=function(){return Promise.resolve({notifications:this.pending.map(function(e){return{id:""+e.id}})})},e.prototype.registerActionTypes=function(e){throw new Error("Method not implemented.")},e.prototype.cancel=function(e){return this.pending=this.pending.filter(function(t){return!e.notifications.find(function(e){return e.id===""+t.id})}),Promise.resolve()},e.prototype.areEnabled=function(){return Promise.resolve({value:"granted"===Notification.permission})},e.prototype.requestPermission=function(){return new Promise(function(n){Notification.requestPermission(function(e){var t=!0;"denied"!==e&&"default"!==e||(t=!1),n({granted:t})})})},e.prototype.requestPermissions=function(){return new Promise(function(t,n){Notification.requestPermission(function(e){"denied"!==e&&"default"!==e?t({results:[e]}):n(e)})})},e}(Y),se=new oe,ie=function(e){function t(){return e.call(this,{name:"Share",platforms:["web"]})||this}return K(t,e),t.prototype.share=function(e){return navigator.share?navigator.share({title:e.title,text:e.text,url:e.url}):Promise.reject("Web Share API not available")},t}(Y),ae=new ie,Ee=function(e){function t(){return e.call(this,{name:"Modals",platforms:["web"]})||this}return K(t,e),t.prototype.alert=function(t){return B(this,void 0,void 0,function(){return F(this,function(e){return window.alert(t.message),[2,Promise.resolve()]})})},t.prototype.prompt=function(n){return B(this,void 0,void 0,function(){var t;return F(this,function(e){return t=window.prompt(n.message,n.inputText||""),[2,Promise.resolve({value:t,cancelled:null===t})]})})},t.prototype.confirm=function(n){return B(this,void 0,void 0,function(){var t;return F(this,function(e){return t=window.confirm(n.message),[2,Promise.resolve({value:t})]})})},t.prototype.showActions=function(n){return B(this,void 0,void 0,function(){var t=this;return F(this,function(e){return[2,new Promise(function(o,e){return B(t,void 0,void 0,function(){var t,r=this;return F(this,function(e){return(t=document.querySelector("pwa-action-sheet"))||(t=document.createElement("pwa-action-sheet"),document.body.appendChild(t)),t.header=n.title,t.cancelable=!1,t.options=n.options,t.addEventListener("onSelection",function(n){return B(r,void 0,void 0,function(){var t;return F(this,function(e){return t=n.detail,o({index:t}),[2]})})}),[2]})})})]})})},t}(Y),ce=new Ee,ue=function(t){function e(){var e=t.call(this,{name:"Motion"})||this;return e.registerWindowListener("devicemotion","accel"),e.registerWindowListener("deviceorientation","orientation"),e}return K(e,t),e}(Y),pe=new ue,le=function(t){function e(){var e=t.call(this,{name:"Network",platforms:["web"]})||this;return e.listenerFunction=null,e}return K(e,t),e.prototype.getStatus=function(){return new Promise(function(e,t){if(window.navigator){var n=window.navigator.onLine,r=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,o=r?r.type||r.effectiveType:"wifi";e({connected:n,connectionType:n?o:"none"})}else t("Network info not available")})},e.prototype.addListener=function(e,t){var n=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection,r=n?n.type||n.effectiveType:"wifi",o=t.bind(this,{connected:!0,connectionType:r}),s=t.bind(this,{connected:!1,connectionType:"none"});if(0===e.localeCompare("networkStatusChange"))return window.addEventListener("online",o),window.addEventListener("offline",s),{remove:function(){window.removeEventListener("online",o),window.removeEventListener("offline",s)}}},e}(Y),de=new le,Se=function(e){function t(){return e.call(this,{name:"Permissions"})||this}return K(t,e),t.prototype.query=function(r){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){switch(e.label){case 0:return(t=window.navigator).permissions?(n=r.name===I.Photos?"camera":r.name,[4,t.permissions.query({name:n})]):[2,Promise.reject("This browser does not support the Permissions API")];case 1:return[2,{state:e.sent().state}]}})})},t}(Y),Ce=new Se,he=function(e){function t(){return e.call(this,{name:"SplashScreen",platforms:["web"]})||this}return K(t,e),t.prototype.show=function(e,t){return Promise.resolve()},t.prototype.hide=function(e,t){return Promise.resolve()},t}(Y),fe=new he,_e=function(t){function e(){var e=t.call(this,{name:"Storage",platforms:["web"]})||this;return e.KEY_PREFIX="_cap_",e}return K(e,t),e.prototype.get=function(n){var r=this;return new Promise(function(e,t){e({value:window.localStorage.getItem(r.makeKey(n.key))})})},e.prototype.set=function(n){var r=this;return new Promise(function(e,t){window.localStorage.setItem(r.makeKey(n.key),n.value),e()})},e.prototype.remove=function(n){var r=this;return new Promise(function(e,t){window.localStorage.removeItem(r.makeKey(n.key)),e()})},e.prototype.keys=function(){var n=this;return new Promise(function(e,t){e({keys:Object.keys(localStorage).filter(function(e){return n.isKey(e)}).map(function(e){return n.getKey(e)})})})},e.prototype.clear=function(){var n=this;return new Promise(function(e,t){Object.keys(localStorage).filter(function(e){return n.isKey(e)}).forEach(function(e){return window.localStorage.removeItem(e)}),e()})},e.prototype.makeKey=function(e){return this.KEY_PREFIX+e},e.prototype.isKey=function(e){return 0===e.indexOf(this.KEY_PREFIX)},e.prototype.getKey=function(e){return e.substr(this.KEY_PREFIX.length)},e}(Y),Te=new _e,ge=function(e){function t(){return e.call(this,{name:"Toast",platforms:["web"]})||this}return K(t,e),t.prototype.show=function(r){return B(this,void 0,void 0,function(){var t,n;return F(this,function(e){return t=2e3,r.duration&&(t="long"===r.duration?3500:2e3),(n=document.createElement("pwa-toast")).duration=t,n.message=r.text,document.body.appendChild(n),[2]})})},t}(Y),Re=new ge;w(L.b);var Ae=function(e){G(L.b,e)};n.d(t,"CameraSource",function(){return r}),n.d(t,"CameraDirection",function(){return E}),n.d(t,"CameraResultType",function(){return c}),n.d(t,"FilesystemDirectory",function(){return a}),n.d(t,"FilesystemEncoding",function(){return p}),n.d(t,"HapticsImpactStyle",function(){return d}),n.d(t,"HapticsNotificationType",function(){return C}),n.d(t,"KeyboardStyle",function(){return f}),n.d(t,"KeyboardResize",function(){return T}),n.d(t,"ActionSheetOptionStyle",function(){return R}),n.d(t,"PermissionType",function(){return I}),n.d(t,"PhotosAlbumType",function(){return N}),n.d(t,"StatusBarStyle",function(){return y}),n.d(t,"StatusBarAnimation",function(){return v}),n.d(t,"Capacitor",function(){return L.a}),n.d(t,"Plugins",function(){return L.b}),n.d(t,"registerWebPlugin",function(){return Ae}),n.d(t,"AccessibilityPluginWeb",function(){return x}),n.d(t,"Accessibility",function(){return V}),n.d(t,"AppPluginWeb",function(){return k}),n.d(t,"App",function(){return J}),n.d(t,"BrowserPluginWeb",function(){return H}),n.d(t,"Browser",function(){return W}),n.d(t,"CameraPluginWeb",function(){return j}),n.d(t,"Camera",function(){return q}),n.d(t,"ClipboardPluginWeb",function(){return X}),n.d(t,"Clipboard",function(){return z}),n.d(t,"FilesystemPluginWeb",function(){return Q}),n.d(t,"Filesystem",function(){return Z}),n.d(t,"GeolocationPluginWeb",function(){return ee}),n.d(t,"Geolocation",function(){return te}),n.d(t,"DevicePluginWeb",function(){return ne}),n.d(t,"Device",function(){return re}),n.d(t,"LocalNotificationsPluginWeb",function(){return oe}),n.d(t,"LocalNotifications",function(){return se}),n.d(t,"SharePluginWeb",function(){return ie}),n.d(t,"Share",function(){return ae}),n.d(t,"ModalsPluginWeb",function(){return Ee}),n.d(t,"Modals",function(){return ce}),n.d(t,"MotionPluginWeb",function(){return ue}),n.d(t,"Motion",function(){return pe}),n.d(t,"NetworkPluginWeb",function(){return le}),n.d(t,"Network",function(){return de}),n.d(t,"PermissionsPluginWeb",function(){return Se}),n.d(t,"Permissions",function(){return Ce}),n.d(t,"SplashScreenPluginWeb",function(){return he}),n.d(t,"SplashScreen",function(){return fe}),n.d(t,"StoragePluginWeb",function(){return _e}),n.d(t,"Storage",function(){return Te}),n.d(t,"ToastPluginWeb",function(){return ge}),n.d(t,"Toast",function(){return Re}),n.d(t,"WebPluginRegistry",function(){return U}),n.d(t,"WebPlugins",function(){return D}),n.d(t,"WebPlugin",function(){return Y}),n.d(t,"mergeWebPlugins",function(){return w}),n.d(t,"mergeWebPlugin",function(){return G})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointFactory=void 0;var E=n(0),c=n(1),u=n(17),p=n(4),l=n(2),r=function(){function a(){this.baseUrl="https://%s.apiclient-%s.cometchat.io/",this.apiVersion=c.APPINFO.apiVersion,this.adminApiUrl="https://%s.api-%s.cometchat.io/",this.adminApiVersion=c.APPINFO.apiVersion,this.extensionApi="https://%s-%s.%s/%s",this.prosodyApi="https://%s.%s/%s",this.wsApi="https://%s/%s",this.uriEndpoints={authToken:{endpoint:"users/{{uid}}/auth_tokens",method:"POST",data:{uid:"string|max:100"},isAdminApi:!0},appSettings:{endpoint:"settings",method:"GET"},login:{endpoint:"admin/users/auth",method:"POST",data:{uid:"string|max:100"}},logout:{endpoint:"admin/users/auth/{{authToken}}",method:"DELETE"},getMyDetails:{endpoint:"me",method:"GET"},updateMyDetails:{endpoint:"me",method:"PUT"},getJWT:{endpoint:"me/jwt",method:"POST"},userSessions:{endpoint:"user_sessions",method:"POST"},users:{endpoint:"users",method:"GET"},user:{endpoint:"users/{{uid}}",method:"GET"},blockUsers:{endpoint:"blockedusers",method:"POST"},blockedUsersList:{endpoint:"blockedusers",method:"GET"},unblockUsers:{endpoint:"blockedusers",method:"DELETE"},userLogout:{endpoint:"me",method:"DELETE"},createUser:{endpoint:"users",method:"POST",isAdminApi:!0},updateUser:{endpoint:"users/{{uid}}",method:"PUT",isAdminApi:!0},createGroup:{endpoint:"groups",method:"POST",data:{guid:"required|string|max:100",name:"required|string|max:100",type:"enum|public,protected,password",password:"filled|string|max:100"}},getGroups:{endpoint:"groups",method:"GET"},getGroup:{endpoint:"groups/{{guid}}",method:"GET"},updateGroup:{endpoint:"groups/{{guid}}",method:"PUT"},deleteGroup:{endpoint:"groups/{{guid}}",method:"DELETE"},addGroupMembers:{endpoint:"groups/{{guid}}/members",method:"POST",data:{uids:"array<string|max:100>"}},getGroupMembers:{endpoint:"groups/{{guid}}/members",method:"GET"},joinGroup:{endpoint:"groups/{{guid}}/members",method:"POST"},leaveGroup:{endpoint:"groups/{{guid}}/members",method:"DELETE"},kickGroupMembers:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},changeScopeOfMember:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"PUT",data:{uids:"array<string|max:100>"}},banGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"POST",data:{uids:"array<string|max:100>"}},unbanGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},addMemebersToGroup:{endpoint:"groups/{{guid}}/members",method:"PUT"},getBannedGroupMembers:{endpoint:"groups/{{guid}}/bannedusers",method:"GET"},promotemoteGroupMember:{endpoint:"groups/{{guid}}/promote",method:"PUT",data:{uids:"array<string|max:100>"}},demoteGroupMember:{endpoint:"groups/{{guid}}/demote",method:"DELETE",data:{uids:"array<string|max:100>"}},transferOwnership:{endpoint:"groups/{{guid}}/owner",method:"PATCH"},sendMessage:{endpoint:"messages",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},sendMessageInThread:{endpoint:"messages/{{parentId}}/thread",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},getMessages:{endpoint:"messages",method:"GET"},getMessageDetails:{endpoint:"messages/{{messageId}}",method:"GET"},addReaction:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"POST"},removeReaction:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"DELETE"},getFilteredReactionsList:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"GET",data:{}},getReactionsList:{endpoint:"messages/{{messageId}}/reactions",method:"GET",data:{}},getUserMessages:{endpoint:"users/{{listId}}/messages",method:"GET"},getGroupMessages:{endpoint:"groups/{{listId}}/messages",method:"GET"},getThreadMessages:{endpoint:"messages/{{listId}}/thread",method:"GET"},getMessage:{endpoint:"user/messages/{{muid}}",method:"GET"},updateMessage:{endpoint:"messages/{{messageId}}",method:"PUT"},deleteMessage:{endpoint:"messages/{{messageId}}",method:"DELETE"},markAsReadForUser:{endpoint:"users/{{uid}}/conversation/read",method:"POST"},markAsReadForGroup:{endpoint:"groups/{{guid}}/conversation/read",method:"POST"},markAsDeliveredForUser:{endpoint:"users/{{uid}}/conversation/delivered",method:"POST"},markAsDeliveredForGroup:{endpoint:"groups/{{guid}}/conversation/delivered",method:"POST"},markUserMessagesAsUnread:{endpoint:"users/{{uid}}/conversation/read",method:"DELETE"},markGroupMessagesAsUnread:{endpoint:"groups/{{guid}}/conversation/read",method:"DELETE"},createCallSession:{endpoint:"calls",method:"POST",data:{}},updateCallSession:{endpoint:"calls/{{sessionid}}",method:"put",data:{}},getConversations:{endpoint:"conversations",method:"GET"},getUserConversation:{endpoint:"users/{{uid}}/conversation",method:"GET"},getGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"GET"},deleteUserConversation:{endpoint:"users/{{uid}}/conversation",method:"DELETE"},deleteGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"DELETE"},updateUserConversation:{endpoint:"users/{{uid}}/conversation",method:"PUT"},updateGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"PUT"},updateCallType:{endpoint:"calls/{{sessionid}}/type",method:"PATCH"},getUserConversationStarter:{endpoint:"ai/conversation-starter/users/{{uid}}",method:"GET",isAIApi:!0},getGroupConversationStarter:{endpoint:"ai/conversation-starter/groups/{{guid}}",method:"GET",isAIApi:!0},getUserSmartReply:{endpoint:"ai/smart-replies/users/{{uid}}",method:"GET",isAIApi:!0},getGroupSmartReply:{endpoint:"ai/smart-replies/groups/{{guid}}",method:"GET",isAIApi:!0},markInteracted:{endpoint:"messages/{{messageId}}/interacted",method:"PATCH"},getUserConversationSummary:{endpoint:"ai/conversation-summary/users/{{uid}}",method:"GET",isAIApi:!0},getGroupConversationSummary:{endpoint:"ai/conversation-summary/groups/{{guid}}",method:"GET",isAIApi:!0},getBotAssistanceInUserConversation:{endpoint:"ai/bots/{{botId}}/assistance/users/{{uid}}",method:"GET",isAIApi:!0},getBotAssistanceInGroupConversation:{endpoint:"ai/bots/{{botId}}/assistance/groups/{{guid}}",method:"GET",isAIApi:!0},getPushPreferences:{endpoint:"notifications/push/v1/preferences",method:"GET"},updatePushPreferences:{endpoint:"notifications/push/v1/preferences",method:"PATCH"},resetPushPreferences:{endpoint:"notifications/push/v1/preferences",method:"DELETE"},registerToken:{endpoint:"notifications/push/v1/tokens",method:"POST"},unregisterToken:{endpoint:"notifications/push/v1/tokens",method:"DELETE"},muteConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"PUT"},unmuteConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"DELETE"},getMutedConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"GET"},updateTimezone:{endpoint:"notifications/v1/preferences/timezone",method:"PATCH"},getTimezone:{endpoint:"notifications/v1/preferences/timezone",method:"GET"}}}return a.prototype.getEndpointData=function(i){return new Promise(function(r,t){try{var o=p.CometChat.appSettings.getAdminHost(),s=p.CometChat.appSettings.getClientHost();u.LocalStorage.getInstance().get(c.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){var t;if(E.isFalsy(e)){if((new a).uriEndpoints.hasOwnProperty(i))if((t=(new a).uriEndpoints[i]).hasOwnProperty("isAdminApi"))if(E.isFalsy(o)){var n=E.format((new a).adminApiUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).adminApiVersion+"/"+t.endpoint;t.endpoint=n,r(t)}else{n="https://"+o+"/"+t.endpoint;t.endpoint=n,r(t)}else if(E.isFalsy(s)){n=E.format((new a).baseUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).apiVersion+"/"+t.endpoint;t.endpoint=n,r(t)}else{n="https://"+s+"/"+t.endpoint;t.endpoint=n,r(t)}}else if((new a).uriEndpoints.hasOwnProperty(i))if((t=(new a).uriEndpoints[i]).hasOwnProperty("isAdminApi")){n="https://"+e[c.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+e[c.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+t.endpoint;t.endpoint=n,r(t)}else{n="https://"+e[c.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+e[c.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+t.endpoint;t.endpoint=n,r(t)}},function(e){if((new a).uriEndpoints.hasOwnProperty(i)){var t=(new a).uriEndpoints[i];t.hasOwnProperty(["isAdminApi"])?E.isFalsy(o)?t.endpoint=E.format((new a).adminApiUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).adminApiVersion+"/"+t.endpoint:t.endpoint="https://"+o+"/"+t.endpoint:E.isFalsy(s)?t.endpoint=E.format((new a).baseUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).apiVersion+"/"+t.endpoint:t.endpoint="https://"+s+"/"+t.endpoint,r(t)}})}catch(e){t(new l.CometChatException(e))}})},a}();t.EndpointFactory=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEndPoint=void 0;var r=n(37),i=n(2);t.getEndPoint=function(e,s){void 0===e&&(e=""),void 0===s&&(s={});var t=new r.EndpointFactory;return new Promise(function(r,o){try{t.getEndpointData(e).then(function(e){var t=e;if(t){for(var n in s)t.endpoint=t.endpoint.replace("{{"+n+"}}",s[n]);r(t)}else o({error:"Unknown endPoint name."})})}catch(e){o(new i.CometChatException(e))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionGoal=void 0;var r=function(){function e(e,t){this.elementIds=[],this.type=e,this.elementIds=t}return e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getElementIds=function(){return this.elementIds},e.prototype.setElementIds=function(e){this.elementIds=e},e}();t.InteractionGoal=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallController=void 0;var o=n(1),s=n(0),r=n(4),i=n(2),a=n(30),E=n(36).Plugins.Calling,c=function(){function e(){this.TAG="calling Log",this.callListner=void 0,this.CALL_NO_ANSWER_INTERVAL=45e3}return e.prototype.getCallListner=function(){return this.callListner},e.prototype.setCallListner=function(e){this.callListner=new a.UserCallListener(e)},e.getInstance=function(){try{return null!=this.callController&&null!=this.callController||(this.callController=new e),this.callController}catch(e){s.Logger.error("CallController: getInstance",e)}},e.prototype.getActiveCall=function(){try{return s.isFalsy(this.call)?null:this.call}catch(e){s.Logger.error("CallController: getActiveCall",e)}},e.prototype.initiateCall=function(n){var r=this;return new Promise(function(e,t){try{s.isFalsy(r.call)?null!=n&&null!=n?(r.call=n,r.startCallTimer(),e(n)):t(new i.CometChatException(o.CALL_ERROR.ERROR_IN_CALLING)):t(new i.CometChatException(o.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){t(new i.CometChatException(e))}})},e.prototype.clearTimer=function(){this.timer&&this.stopCallTimer()},e.prototype.endCall=function(e){try{this.endCallSession()}catch(e){s.Logger.error("CallController: endCall",e)}},e.prototype.onCallStarted=function(n){var r=this;return new Promise(function(e,t){try{s.isFalsy(r.call)?null!=n&&null!=n?e(r.call=n):t(new i.CometChatException(o.CALL_ERROR.ERROR_IN_CALLING)):t(new i.CometChatException(o.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){t(new i.CometChatException(e))}})},e.prototype.clearActiveCall=function(){this.call=void 0,e.callController=void 0,this.timer&&this.stopCallTimer()},e.prototype.endCallSession=function(){try{this.call=void 0,e.callController=void 0,this.timer&&this.stopCallTimer()}catch(e){s.Logger.error("CallController:EndCallSession",{e:e})}},e.prototype.startCallTimer=function(){var t=this;try{this.timer=setTimeout(function(){t.call?r.CometChat.sendUnansweredResponse(t.call.getSessionId()).then(function(e){t.endCallSession()},function(e){t.endCallSession()}):t.endCallSession()},this.CALL_NO_ANSWER_INTERVAL)}catch(e){s.Logger.error("CallController: startCallTimer",e)}},e.prototype.stopCallTimer=function(){try{clearTimeout(this.timer)}catch(e){s.Logger.error("CallController: stopCallTimer",e)}},e.prototype.callStarted=function(){this.timer&&this.stopCallTimer()},e.prototype.endSession=function(){E.endCallSession()},e.callController=void 0,e}();t.CallController=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMembersController=void 0;var r=n(42),o=n(1),s=n(0),i=function(){function e(){}return e.trasformJSONGroupMember=function(t){var e;try{return t.status&&"offline"!==t.status?t.status="online":t.status="offline",e=new r.GroupMember(t[o.GroupMemersConstans.KEYS.UID]),Object.assign(e,t),e}catch(e){return s.Logger.error("GroupMembersController:trasformJSONGroupMember",{e:e,groupMember:t}),t}},e}();t.GroupMembersController=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMember=void 0;var s=n(3),i=n(1),a=function(r){function e(e,t){var n=r.call(this,e)||this;return n.joinedAt=0,t&&(n.scope=t),n}return o(e,r),e.prototype.setScope=function(e){this.scope=e},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.setGuid=function(e){this.guid=e},e.prototype.getScope=function(){return this.scope},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.getGuid=function(){return this.guid},e.GroupMemberScope=i.GroupMemberScope,e}(s.User);t.GroupMember=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversation=void 0;var E=n(12),c=n(1),u=n(13),p=n(18),r=function(){function e(e,t,n,r,o,s,i,a){this.conversationId=e,this.conversationType=t,this.unreadMentionsCount=null!=i?i:0,this.lastReadMessageId=null!=a?a:"",this.unreadMessageCount=null!=o?o:0,this.lastMessage=null!=n?n:null,s&&0<s.length&&(this.tags=s),n&&n.id&&void 0!==n.id&&null!==n.id&&""!==n.id&&(this.lastMessage=E.MessageController.trasformJSONMessge(n)),this.conversationType==c.MessageConstatnts.RECEIVER_TYPE.USER?this.conversationWith=u.UsersController.trasformJSONUser(r):this.conversationWith=p.GroupsController.trasformJSONGroup(r)}return e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.setConversationType=function(e){this.conversationType=e},e.prototype.getUnreadMentionsCount=function(){return this.unreadMentionsCount},e.prototype.setUnreadMentionsCount=function(e){this.unreadMentionsCount=e},e.prototype.getLastReadMessageId=function(){return this.lastReadMessageId},e.prototype.setLastReadMessageId=function(e){this.lastReadMessageId=e},e.prototype.setLastMessage=function(e){this.lastMessage=e},e.prototype.setConversationWith=function(e){this.conversationWith=e},e.prototype.setUnreadMessageCount=function(e){this.unreadMessageCount=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.getConversationType=function(){return this.conversationType},e.prototype.getLastMessage=function(){return this.lastMessage},e.prototype.getConversationWith=function(){return this.conversationWith},e.prototype.getUnreadMessageCount=function(){return this.unreadMessageCount},e.prototype.getTags=function(){return this.tags},e}();t.Conversation=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypingNotificationController=void 0;var r=n(0),o=function(){function e(){}return e.addTypingStarted=function(e){this.TYPING_STARTED_MAP[e]=r.getCurrentTime()},e.removeTypingStarted=function(e){delete this.TYPING_STARTED_MAP[e]},e.getTypingStartedMap=function(e){if(e)return this.TYPING_STARTED_MAP[e]},e.addTypingEnded=function(e){this.TYPING_ENDED_MAP[e]=r.getCurrentTime()},e.removeTypingEnded=function(e){delete this.TYPING_ENDED_MAP[e]},e.getTypingEndedMap=function(e){if(e)return this.TYPING_ENDED_MAP[e]},e.addIncomingTypingStarted=function(e){this.INCOMING_TYPING_STARTED_MAP[e.getReceiverId()]={typingNotification:e,timestamp:r.getCurrentTime()}},e.removeIncomingTypingStarted=function(e){delete this.INCOMING_TYPING_STARTED_MAP[e.getReceiverId()]},e.TYPING_STARTED_MAP={},e.TYPING_ENDED_MAP={},e.INCOMING_TYPING_STARTED_MAP={},e}();t.TypingNotificationController=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionReceipt=void 0;var r=function(){function e(){}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiveId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getInteractions=function(){return this.interactions},e.prototype.setInteractions=function(e){this.interactions=e},e}();t.InteractionReceipt=r},function(e,t,n){"use strict";var r=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var s=arguments[t],i=0,a=s.length;i<a;i++,o++)r[o]=s[i];return r};Object.defineProperty(t,"__esModule",{value:!0}),t.ListenerHandlers=void 0;var o=n(0),s=n(30),i=function(){function e(){this.connectionHandlers=[],this.loginHandlers=[],this.messageHandlers=[],this.userHandlers=[],this.groupHandlers=[],this.callHandlers=[]}return e.getInstance=function(){return null!=this.listenerHandlers&&null!=this.listenerHandlers||(this.listenerHandlers=new e),this.listenerHandlers},e.prototype.addConnectionEventListener=function(t,e){try{this.connectionHandlers=this.connectionHandlers.filter(function(e){return e._name!=t}),this.connectionHandlers=r(this.connectionHandlers,[new s.WSConnectionListener(t,e)])}catch(e){o.Logger.error("ListenerHandlers: addWSConnectionEventListener",e)}},e.prototype.removeConnectionEventListener=function(t){try{this.connectionHandlers=this.connectionHandlers.filter(function(e){return e._name!==t})}catch(e){o.Logger.error("ListenerHandlers: removeWSConnectionEventListener",e)}},e.prototype.addLoginEventListener=function(t,e){try{this.loginHandlers=this.loginHandlers.filter(function(e){return e._name!=t}),this.loginHandlers=r(this.loginHandlers,[new s.UserLoginListener(t,e)])}catch(e){o.Logger.error("ListenerHandlers: addLoginEventListener",e)}},e.prototype.removeLoginEventListener=function(t){try{this.loginHandlers=this.loginHandlers.filter(function(e){return e._name!==t})}catch(e){o.Logger.error("ListenerHandlers: removeLoginEventListener",e)}},e.prototype.addMessageEventListener=function(t,e){try{this.messageHandlers=this.messageHandlers.filter(function(e){return e._name!=t}),this.messageHandlers=r(this.messageHandlers,[new s.MessagesListener(t,e)])}catch(e){o.Logger.error("ListenerHandlers: addMessageEventListener",e)}},e.prototype.removeMessageEventListener=function(t){try{this.messageHandlers=this.messageHandlers.filter(function(e){return e._name!==t})}catch(e){o.Logger.error("ListenerHandlers: removeMessageEventListener",e)}},e.prototype.addUserEventListener=function(t,e){try{this.userHandlers=this.userHandlers.filter(function(e){return e._name!=t}),this.userHandlers=r(this.userHandlers,[new s.UsersListener(t,e)])}catch(e){o.Logger.error("ListenerHandlers: addUserEventListener",e)}},e.prototype.removeUserEventListener=function(t){try{this.userHandlers=this.userHandlers.filter(function(e){return e._name!==t})}catch(e){o.Logger.error("ListenerHandlers: removeUserEventListener",e)}},e.prototype.addGroupEventListener=function(t,e){try{this.groupHandlers=this.groupHandlers.filter(function(e){return e._name!=t}),this.groupHandlers=r(this.groupHandlers,[new s.GroupsListener(t,e)])}catch(e){o.Logger.error("ListenerHandlers: addGroupEventListener",e)}},e.prototype.removeGroupEventListener=function(t){try{this.groupHandlers=this.groupHandlers.filter(function(e){return e._name!==t})}catch(e){o.Logger.error("ListenerHandlers: removeGroupEventListener",e)}},e.prototype.addCallEventListener=function(t,e){try{this.callHandlers=this.callHandlers.filter(function(e){return e._name!=t}),this.callHandlers=r(this.callHandlers,[new s.CallsListener(t,e)])}catch(e){o.Logger.error("ListenerHandlers: addCallEventListener",e)}},e.prototype.removeCallEventListener=function(t){try{this.callHandlers=this.callHandlers.filter(function(e){return e._name!==t})}catch(e){o.Logger.error("ListenerHandlers: removeCallEventListener",e)}},e.listenerHandlers=new e,e}();t.ListenerHandlers=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionEvent=void 0;var s=n(0),r=function(){function e(e,t,n,r,o){this.parentMessageId=null,s.isFalsy(e)||(this.reaction=e),s.isFalsy(t)||(this.receiverId=t),s.isFalsy(n)||(this.receiverType=n),s.isFalsy(r)||(this.conversationId=r),s.isFalsy(o)||(this.parentMessageId=o)}return e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e}();t.ReactionEvent=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWSURL=t.stringifyMessage=t.checkConnection=void 0;var r=n(1),o=n(0),s=n(5);t.checkConnection=function(e){return e&&e.readyState===s.READY_STATE.OPEN},t.stringifyMessage=function(e){return JSON.stringify(e)},t.getWSURL=function(){return new Promise(function(n,e){o.getAppSettings().then(function(e){var t=s.WS.protocol+o.getChatHost(e)+":"+e[r.APP_SETTINGS.KEYS.CHAT_WSS_PORT];n(t)},function(e){o.Logger.error("WSHelper :: getWSURL",e)})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DaySchedule=void 0;var r=function(){function e(e,t,n){this.from=e,this.to=t,this.dnd=n}return e.prototype.getFrom=function(){return this.from},e.prototype.setFrom=function(e){this.from=e},e.prototype.getTo=function(){return this.to},e.prototype.setTo=function(e){this.to=e},e.prototype.getDND=function(){return this.dnd},e.prototype.setDND=function(e){this.dnd=e},e}();t.DaySchedule=r},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(){var t=this;this.platform="web",this.isNative=!1,this.Plugins={},"undefined"!=typeof Proxy&&(this.Plugins=new Proxy(this.Plugins,{get:function(e,n){if(void 0!==e[n])return e[n];var r=t;return new Proxy({},{get:function(e,t){return void 0===e[t]?r.pluginMethodNoop.bind(r,e,t,n):e[t]}})}}))}return e.prototype.pluginMethodNoop=function(e,t,n){return Promise.reject(n+" does not have web implementation.")},e.prototype.getPlatform=function(){return this.platform},e.prototype.isPluginAvailable=function(e){return this.Plugins.hasOwnProperty(e)},e.prototype.convertFileSrc=function(e){return e},e.prototype.handleError=function(e){},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatNotifications=t.CometChat=t.init=void 0;var r=n(4),o=n(87);t.init=function(e){return r.CometChat.getInstance(e)},t.CometChat=r.CometChat,t.CometChatNotifications=o.CometChatNotifications},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupsRequestBuilder=t.GroupsRequest=void 0;var o=n(6),r=n(0),s=n(2),i=n(18),a=n(1),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.hasJoined=0,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},r.isFalsy(e)||(r.isFalsy(e.limit)||(this.limit=e.limit),e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),r.isFalsy(e.hasJoined)||(this.hasJoined=1),r.isFalsy(e.tags)||(this.tags=e.tags),r.isFalsy(e.showTags)||(this.withTags=e.showTags))}return e.prototype.validateGroupBuilder=function(){if(void 0===this.limit)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.withTags){if(typeof this.withTags!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()")));1==this.withTags?this.withTags=!0:this.withTags=!1}return void 0===this.tags||Array.isArray(this.tags)?void 0:new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")))},e.prototype.fetchNext=function(){var r=this;return new Promise(function(t,n){try{var e=r.validateGroupBuilder();if(e instanceof s.CometChatException)return void n(e);o.makeApiCall("getGroups",{},r.getNextData()).then(function(e){if(e.meta&&(r.total_pages=e.meta.pagination.total_pages),0<e.data.length){r.pagination=e.meta.pagination;var n=[];e.data.map(function(e,t){n.push(i.GroupsController.trasformJSONGroup(e))}),t(n)}t([])},function(e){n(new s.CometChatException(e.error))})}catch(e){n(new s.CometChatException(e))}})},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.isJoinedOnly=function(){return this.hasJoined},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),r.isFalsy(this.hasJoined)||(e.hasJoined=1),r.isFalsy(this.tags)||(e.tags=this.tags.map(function(e){return encodeURIComponent(e.trim())})),r.isFalsy(this.withTags)||(e.withTags=1),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=100,e.DEFAULT_LIMIT=30,e}();t.GroupsRequest=E;var c=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.joinedOnly=function(e){return this.hasJoined=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.showTags=e,this},e.prototype.build=function(){return new E(this)},e}();t.GroupsRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMembersRequestBuilder=t.GroupMembersRequest=void 0;var o=n(6),r=n(0),s=n(17),i=n(2),a=n(41),E=n(1),c=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},this.store=s.LocalStorage.getInstance(),r.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),r.isFalsy(e.scopes)||(this.scopes=e.scopes))}return e.prototype.validateGroupMembersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>E.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",E.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<E.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(r.isFalsy(this.guid))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var r=this;return new Promise(function(n,t){try{var e=r.validateGroupMembersBuilder();if(e instanceof i.CometChatException)return void t(e);o.makeApiCall("getGroupMembers",{guid:r.guid},r.getNextData()).then(function(e){if(e.meta&&(r.total_pages=e.meta.pagination.total_pages),0<e.data.length){r.pagination=e.meta.pagination;var t=[];e.data.map(function(e){e.guid=r.guid,t.push(a.GroupMembersController.trasformJSONGroupMember(e))}),n(t)}else n([])},function(e){t(new i.CometChatException(e.error))})}catch(e){t(new i.CometChatException(e))}})},e.prototype.getGuid=function(){return this.guid},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getScopes=function(){return this.scopes},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),r.isFalsy(this.scopes)||(e.scopes=this.scopes),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.GroupMembersRequest=c;var u=function(){function e(e){this.guid=e}return e.prototype.setGuid=function(e){return this.guid=e,this},e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setScopes=function(e){return this.scopes=e,this},e.prototype.build=function(){return new c(this)},e}();t.GroupMembersRequestBuilder=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BannedMembersRequestBuilder=t.BannedMembersRequest=void 0;var o=n(6),r=n(0),s=n(2),i=n(41),a=n(1),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},r.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),r.isFalsy(e.scopes)||(this.scopes=e.scopes))}return e.prototype.validateBannedMembersBuilder=function(){if(void 0===this.limit)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(r.isFalsy(this.guid))return new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var r=this;return new Promise(function(n,t){try{var e=r.validateBannedMembersBuilder();if(e instanceof s.CometChatException)return void t(e);o.makeApiCall("getBannedGroupMembers",{guid:r.guid},r.getNextData()).then(function(e){if(e.meta&&(r.total_pages=e.meta.pagination.total_pages),0<e.data.length){r.pagination=e.meta.pagination;var t=[];e.data.map(function(e){e.guid=r.guid,t.push(i.GroupMembersController.trasformJSONGroupMember(e))}),n(t)}else n([])},function(e){t(new s.CometChatException(e.error))})}catch(e){t(new s.CometChatException(e))}})},e.prototype.getGuid=function(){return this.guid},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getScopes=function(){return this.scopes},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),r.isFalsy(this.scopes)||(e.scopes=this.scopes),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.BannedMembersRequest=E;var c=function(){function e(e){this.guid=e}return e.prototype.setGuid=function(e){return this.guid=e,this},e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setScopes=function(e){return this.scopes=e,this},e.prototype.build=function(){return new E(this)},e}();t.BannedMembersRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UsersRequestBuilder=t.UsersRequest=void 0;var o=n(6),r=n(0),s=n(13),i=n(2),a=n(56),E=n(1),c=function(){function t(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.hideBlockedUsers=!1,this.friendsOnly=!1,this.fetchingInProgress=!1,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},t.userStore=a.UserStore.getInstance(),r.isFalsy(e)||(this.limit=e.limit,e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),r.isFalsy(e.status)||(e.status==t.USER_STATUS.ONLINE?this.status=E.PresenceConstatnts.STATUS.AVAILABLE:this.status=e.status),r.isFalsy(e.shouldHideBlockedUsers)||(this.hideBlockedUsers=e.shouldHideBlockedUsers),r.isFalsy(e.showFriendsOnly)||(this.friendsOnly=e.showFriendsOnly),r.isFalsy(e.showTags)||(this.withTags=e.showTags),r.isFalsy(e.role)||(this.role=e.role),r.isFalsy(e.roles)||(this.roles=e.roles),r.isFalsy(e.tags)||(this.tags=e.tags),r.isFalsy(e.UIDs)||(this.UIDs=e.UIDs),r.isFalsy(e.SortBy)||(this.sortBy=e.SortBy),r.isFalsy(e.SearchIn)||(this.searchIn=e.SearchIn),r.isFalsy(e.SortOrder)||(this.sortOrder=e.SortOrder))}return t.prototype.validateUserBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>E.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",E.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<E.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));this.searchKeyword=this.searchKeyword.trim()}if(this.status){if(typeof this.status!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_STATUS","SET_STATUS","setStatus()")));if("available"!=this.status.toLowerCase()&&"offline"!=this.status.toLowerCase())return new i.CometChatException(E.UserErrors.INVALID_STATUS)}if(void 0!==this.hideBlockedUsers){if(typeof this.hideBlockedUsers!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_BLOCKED_USERS","HIDE_BLOCKED_USERS","hideBlockedUsers()")));1==this.hideBlockedUsers?this.hideBlockedUsers=!0:this.hideBlockedUsers=!1}if(void 0!==this.friendsOnly){if(typeof this.friendsOnly!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"FRIENDS_ONLY","FRIENDS_ONLY","friendsOnly()")));1==this.friendsOnly?this.friendsOnly=!0:this.friendsOnly=!1}if(void 0!==this.withTags){if(typeof this.withTags!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()")));1==this.withTags?this.withTags=!0:this.withTags=!1}if(void 0!==this.roles&&!Array.isArray(this.roles))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"ROLES","ROLES","setRoles()")));if(void 0!==this.tags&&!Array.isArray(this.tags))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")));if(void 0!==this.UIDs&&!Array.isArray(this.UIDs))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"UIDs","UIDs","setUIDs()")));if(this.sortBy){if(typeof this.sortBy!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY","SORT_BY","sortBy()")));if(r.isFalsy(this.sortBy.trim()))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SORT_BY","SORT_BY","sort by","sort by")));this.sortBy=this.sortBy.trim().toLowerCase()}if(this.sortOrder){if(typeof this.sortOrder!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY_ORDER","SORT_BY_ORDER","sortByOrder()")));if(r.isFalsy(this.sortOrder.trim()))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SORT_BY_ORDER","SORT_BY_ORDER","sort order","sort order")));this.sortOrder=this.sortOrder.trim().toLowerCase()}return this.searchIn&&!Array.isArray(this.searchIn)?new i.CometChatException(JSON.parse(r.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SEARCH_IN","SEARCH_IN","searchIn()"))):void 0},t.prototype.getLimit=function(){return this.limit},t.prototype.getSearchKeyword=function(){return this.searchKeyword},t.prototype.isHideBlockedUsers=function(){return this.hideBlockedUsers},t.prototype.getStatus=function(){return this.status},t.prototype.getRole=function(){return this.role},t.prototype.isFriendsOnly=function(){return this.friendsOnly},t.prototype.getRoles=function(){return this.roles},t.prototype.getTags=function(){return this.tags},t.prototype.isWithTags=function(){return this.withTags},t.prototype.getUIDs=function(){return this.UIDs},t.prototype.getSearchIn=function(){return this.searchIn},t.prototype.getSortBy=function(){return this.sortBy},t.prototype.getSortOrder=function(){return this.sortOrder},t.prototype.fetchNext=function(){var r=this;return new Promise(function(n,t){try{if(r.fetchingInProgress)r.fetchingInProgress=!1,n([]);else{r.fetchingInProgress=!0;var e=r.validateUserBuilder();if(e instanceof i.CometChatException)return void t(e);o.makeApiCall("users",{},r.getNextData()).then(function(e){if(e.meta&&(r.total_pages=e.meta.pagination.total_pages),0<e.data.length){r.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(s.UsersController.trasformJSONUser(e))}),n(t)}else n([]);r.fetchingInProgress=!1},function(e){r.fetchingInProgress=!1,t(new i.CometChatException(e.error))})}}catch(e){r.fetchingInProgress=!1,t(new i.CometChatException(e))}})},t.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),r.isFalsy(this.status)||(e.status=this.status),r.isFalsy(this.hideBlockedUsers)||(e.hideBlockedUsers=1),r.isFalsy(this.role)||(e.roles=this.role),r.isFalsy(this.roles)||(e.roles=this.roles),r.isFalsy(this.tags)||(e.tags=this.tags.map(function(e){return encodeURIComponent(e)})),r.isFalsy(this.friendsOnly)||(e.friendsOnly=1),r.isFalsy(this.withTags)||(e.withTags=1),r.isFalsy(this.UIDs)||(e.uids=this.UIDs),r.isFalsy(this.sortBy)||(e.sortBy=this.sortBy),r.isFalsy(this.sortOrder)||(e.sortOrder=this.sortOrder),r.isFalsy(this.searchIn)||(e.searchIn=this.searchIn),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},t.USER_STATUS={ONLINE:E.PresenceConstatnts.STATUS.ONLINE,OFFLINE:E.PresenceConstatnts.STATUS.OFFLINE},t}();t.UsersRequest=c;var u=function(){function e(){this.shouldHideBlockedUsers=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setStatus=function(e){return this.status=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.hideBlockedUsers=function(e){return this.shouldHideBlockedUsers=e,this},e.prototype.setRole=function(e){return this.role=e,this},e.prototype.setRoles=function(e){return this.roles=e,this},e.prototype.friendsOnly=function(e){return this.showFriendsOnly=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.showTags=e,this},e.prototype.setUIDs=function(e){return this.UIDs=e,this},e.prototype.sortBy=function(e){return this.SortBy=e,this},e.prototype.sortByOrder=function(e){return this.SortOrder=e,this},e.prototype.searchIn=function(e){return this.SearchIn=e,this},e.prototype.build=function(){return this.role&&this.roles&&this.roles.push(this.role),new c(this)},e}();t.UsersRequestBuilder=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserStore=void 0;var r=n(4),o=n(0),s=n(1),i=n(15),a=function(){function e(e){this.store=s.constants.DEFAULT_STORE,o.isFalsy(e)||(this.store=e),this.userStore=i.createInstance({name:o.format(s.LOCAL_STORE.STORE_STRING,r.CometChat.getAppId(),s.LOCAL_STORE.USERS_STORE)}),this.userStore.setDriver([i.LOCALSTORAGE,i.INDEXEDDB,i.WEBSQL])}return e.getInstance=function(){return null==e.UserStore&&(e.UserStore=new e),e.UserStore},e.prototype.set=function(e,t){return this.userStore.setItem(e,t)},e.prototype.remove=function(e){this.userStore.removeItem(e)},e.prototype.get=function(e){return this.userStore.getItem(e)},e.prototype.clearStore=function(){var n=this;return new Promise(function(e,t){n.userStore.clear().then(function(){e(!0)}).catch(function(e){t(e)})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeUsers=function(e){var t=this;return e.map(function(e){t.set(e.getUid(),e)}),!0},e.prototype.storeUser=function(e){return this.set(e.getUid(),e),!0},e}();t.UserStore=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationsRequestBuilder=t.ConversationsRequest=void 0;var o=n(6),r=n(0),s=n(2),i=n(31),a=n(1),E=function(){function e(e){this.limit=30,this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.getUserAndGroupTags=!1,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},r.isFalsy(e)||(this.limit=e.limit,r.isFalsy(e.conversationType)||(this.conversationType=e.conversationType),e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),r.isFalsy(e.getUserAndGroupTags)||(this.getUserAndGroupTags=e.getUserAndGroupTags),e.tags&&(this.tags=e.tags),r.isFalsy(e.WithTags)||(this.withTags=e.WithTags),e.groupTags&&(this.groupTags=e.groupTags),e.userTags&&(this.userTags=e.userTags),e.IncludeBlockedUsers&&(this.includeBlockedUsers=e.IncludeBlockedUsers),e.WithBlockedInfo&&(this.withBlockedInfo=e.WithBlockedInfo),e.unreadOnly&&(this.unread=e.unreadOnly))}return e.prototype.validateConversationBuilder=function(){return void 0===this.limit?new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))):isNaN(this.limit)?new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):this.limit>a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT?new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT))):this.limit<a.DEFAULT_VALUES.ZERO?new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING&&void 0!==this.searchKeyword?new s.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))):void 0},e.prototype.fetchNext=function(){var r=this;return new Promise(function(n,t){try{if(r.fetchingInProgress)r.fetchingInProgress=!1,n([]);else{r.fetchingInProgress=!0;var e=r.validateConversationBuilder();if(e instanceof s.CometChatException)return void t(e);o.makeApiCall("getConversations",{},r.getNextData()).then(function(e){if(e.meta&&(r.total_pages=e.meta.pagination.total_pages),0<e.data.length){r.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(i.ConversationController.trasformJSONConversation(e.conversationId,e.conversationType,e.lastMessage,e.conversationWith,parseInt(e.unreadMessageCount),e.tags?e.tags:[],e.unreadMentionsCount,e.lastReadMessageId))}),n(t)}else n([]);r.fetchingInProgress=!1},function(e){r.fetchingInProgress=!1,t(new s.CometChatException(e.error))})}}catch(e){r.fetchingInProgress=!1,t(new s.CometChatException(e))}})},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,r.isFalsy(this.conversationType)||(e.conversationType=this.conversationType),this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),r.isFalsy(this.getUserAndGroupTags)||(e.withUserAndGroupTags=this.getUserAndGroupTags),r.isFalsy(this.tags)||(e.tags=this.tags.map(function(e){return encodeURIComponent(e.trim())})),r.isFalsy(this.withTags)||(e.withTags=this.withTags),r.isFalsy(this.userTags)||(e.userTags=this.userTags.map(function(e){return encodeURIComponent(e.trim())})),r.isFalsy(this.groupTags)||(e.groupTags=this.groupTags.map(function(e){return encodeURIComponent(e.trim())})),r.isFalsy(this.includeBlockedUsers)||(e.includeBlockedUsers=this.includeBlockedUsers),r.isFalsy(this.withBlockedInfo)||(e.withBlockedInfo=this.withBlockedInfo),r.isFalsy(this.unread)||(e.unread=this.unread),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.isIncludeBlockedUsers=function(){return this.includeBlockedUsers},e.prototype.isWithBlockedInfo=function(){return this.withBlockedInfo},e.prototype.getLimit=function(){return this.limit},e.prototype.getConversationType=function(){return this.conversationType},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.isWithUserAndGroupTags=function(){return this.getUserAndGroupTags},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getGroupTags=function(){return this.groupTags},e.prototype.getUserTags=function(){return this.userTags},e.prototype.getUnread=function(){return this.unread},e}();t.ConversationsRequest=E;var c=function(){function e(){this.WithTags=!1,this.IncludeBlockedUsers=!1,this.WithBlockedInfo=!1,this.unreadOnly=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setConversationType=function(e){return this.conversationType=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.withUserAndGroupTags=function(e){return"boolean"==typeof e&&(this.getUserAndGroupTags=e),this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.WithTags=e,this},e.prototype.setGroupTags=function(e){return this.groupTags=e,this},e.prototype.setUserTags=function(e){return this.userTags=e,this},e.prototype.setIncludeBlockedUsers=function(e){return this.IncludeBlockedUsers=e,this},e.prototype.includeBlockedUsers=function(e){return this.IncludeBlockedUsers=e,this},e.prototype.setWithBlockedInfo=function(e){return this.WithBlockedInfo=e,this},e.prototype.withBlockedInfo=function(e){return this.WithBlockedInfo=e,this},e.prototype.setUnread=function(e){return this.unreadOnly=e,this},e.prototype.build=function(){return new E(this)},e}();t.ConversationsRequestBuilder=c},function(e,t,n){"use strict";var P=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function r(e){try{s(E.next(e))}catch(e){t(e)}}function o(e){try{s(E.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,o)}s((E=E.apply(e,i||[])).next())})},v=this&&this.__generator||function(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var s=arguments[t],i=0,a=s.length;i<a;i++,o++)r[o]=s[i];return r};Object.defineProperty(t,"__esModule",{value:!0}),t.MessagesRequestBuilder=t.MessagesRequest=void 0;var M=n(2),L=n(6),U=n(12),D=n(0),s=n(59),Y=n(1),i=n(10),w=n(32),r=function(){function e(e){this.limit=Y.DEFAULT_VALUES.MSGS_LIMIT,this.timestamp=0,this.id=Y.DEFAULT_VALUES.DEFAULT_MSG_ID,this.messageStore=s.MessagesStore.getInstance(),this.endpointName="getUserMessages",this.listId="",this.totalPages=0,this.unread=!1,this.inProgress=!1,this.hideMessagesFromBlockedUsers=!1,this.updatedAt=0,this.onlyUpdates=0,this.paginationMeta={},this.WithTags=!1,this.hideDeletedMessages=!1,this.mentionsWithTagInfoFlag=!1,this.mentionsWithBlockedInfoFlag=!1,this.interactionGoalCompletedOnly=!1,this.hasAttachments=!1,this.hasLinks=!1,this.hasMentions=!1,this.hasReactions=!1,this.limit=e.limit,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,this.uid=e.uid,this.guid=e.guid,this.parentMessageId=e.parentMessageId,this.timestamp=e.timestamp,this.timestamp&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.id=e.id,this.id!=Y.DEFAULT_VALUES.DEFAULT_MSG_ID&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.hideMessagesFromBlockedUsers=e.HideMessagesFromBlockedUsers,this.hideMessagesFromBlockedUsers&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=this.hideMessagesFromBlockedUsers),this.unread=e.unread,this.unread&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.UNREAD]=this.unread),e.searchKey&&(this.searchKey=e.searchKey,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=this.searchKey),e.onlyUpdate&&(this.onlyUpdates=e.onlyUpdate,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ONLY_UPDATES]=this.onlyUpdates),e.updatedAt&&(this.updatedAt=e.updatedAt,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),e.category&&(this.category=e.category),e.categories&&(this.categories=e.categories),e.type&&(this.type=e.type),e.types&&(this.types=e.types),e.WithTags&&(this.WithTags=e.WithTags),e.tags&&(this.tags=e.tags),e.HideReplies&&(this.hideReplies=e.HideReplies,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES]=this.hideReplies),this.hideDeletedMessages=e.HideDeletedMessages,this.hideDeletedMessages&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=this.hideDeletedMessages),this.hasAttachments=e.HasAttachments,this.hasAttachments&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_ATTACHMENTS]=this.hasAttachments),this.hasLinks=e.HasLinks,this.hasLinks&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_LINKS]=this.hasLinks),this.hasMentions=e.HasMentions,this.hasMentions&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_MENTIONS]=this.hasMentions),this.hasReactions=e.HasReactions,this.hasReactions&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_REACTIONS]=this.hasReactions),e.mentionedUIDs&&(this.mentionedUIDs=e.mentionedUIDs),e.attachmentTypes&&(this.attachmentTypes=e.attachmentTypes),this.mentionsWithTagInfoFlag=e.mentionsWithTagInfoFlag,this.mentionsWithBlockedInfoFlag=e.mentionsWithBlockedInfoFlag,this.interactionGoalCompletedOnly=e.interactionGoalCompletedOnly,this.interactionGoalCompletedOnly&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=this.interactionGoalCompletedOnly)}return e.prototype.getLimit=function(){return this.limit},e.prototype.getUID=function(){return this.uid},e.prototype.getGUID=function(){return this.guid},e.prototype.getMessageId=function(){return this.id},e.prototype.isUnread=function(){return this.unread},e.prototype.isHideMessagesFromBlockedUsers=function(){return this.hideMessagesFromBlockedUsers},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getSearchKeyword=function(){return this.searchKey},e.prototype.getUpdatedAfter=function(){return this.updatedAt},e.prototype.isUpdatesOnly=function(){return this.onlyUpdates},e.prototype.getCategories=function(){return this.categories},e.prototype.getCategory=function(){return this.category},e.prototype.getTypes=function(){return this.types},e.prototype.getType=function(){return this.type},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.isHideReplies=function(){return this.hideReplies},e.prototype.isHideDeletedMessages=function(){return this.hideDeletedMessages},e.prototype.getHasAttachments=function(){return this.hasAttachments},e.prototype.getHasLinks=function(){return this.hasLinks},e.prototype.getHasMentions=function(){return this.hasMentions},e.prototype.getHasReactions=function(){return this.hasReactions},e.prototype.getMentionedUIDs=function(){return this.mentionedUIDs},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.WithTags},e.prototype.isMentionsWithTagInfo=function(){return this.mentionsWithTagInfoFlag},e.prototype.isMentionsWithBlockedInfo=function(){return this.mentionsWithBlockedInfoFlag},e.prototype.isInteractionGoalCompletedOnly=function(){return this.interactionGoalCompletedOnly},e.prototype.getAttachmentTypes=function(){return this.attachmentTypes},e.prototype.fetchNext=function(){var e=this;return new Promise(function(o,s){return P(e,void 0,void 0,function(){var t,n,r;return v(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,s(new M.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,this.onlyUpdates){if(0==this.updatedAt)return this.inProgress=!1,s(new M.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2]}else if(0==this.timestamp&&0==this.id&&0==this.updatedAt)return this.inProgress=!1,s(new M.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=Y.MessageConstatnts.PAGINATION.AFFIX.APPEND,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=Y.MessageConstatnts.PAGINATION.AFFIX.APPEND,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t=e.sent(),o(t),this.inProgress=!1,[3,4];case 3:return n=e.sent(),this.inProgress=!1,s(new M.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return r=e.sent(),this.inProgress=!1,s(new M.CometChatException(r)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(o,s){return P(e,void 0,void 0,function(){var t,n,r;return v(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return s(new M.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,this.onlyUpdates&&0==this.updatedAt)return this.inProgress=!1,s(new M.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=Y.MessageConstatnts.PAGINATION.AFFIX.PREPEND,this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=Y.MessageConstatnts.PAGINATION.AFFIX.PREPEND,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t=e.sent(),o(t),this.inProgress=!1,[3,4];case 3:return n=e.sent(),this.inProgress=!1,s(new M.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return r=e.sent(),this.inProgress=!1,s(new M.CometChatException(r)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(){var y=this;return new Promise(function(o,t){try{var e=y.mentionsWithTagInfoFlag;if(void 0!==e){if(typeof e!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_TAG_INFO","MENTIONS_WITH_TAG_INFO","mentionsWithTagInfo()"))));1==e&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_TAG_INFO]=1)}var n=y.mentionsWithBlockedInfoFlag;if(void 0!==n){if(typeof n!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_BLOCKED_INFO","MENTIONS_WITH_BLOCKED_INFO","mentionsWithBlockedInfo()"))));1==n&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_BLOCKED_INFO]=1)}var r=y.uid;if(void 0!==r){if(typeof r!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"UID","UID","setUID()"))));if(D.isFalsy(r.trim()))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.INVALID),"UID","UID","UID","UID"))));y.uid=r.trim()}var s=y.guid;if(void 0!==s){if(typeof s!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","setGUID()"))));if(D.isFalsy(s.trim()))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID"))));y.guid=s.trim()}var i=y.parentMessageId;if(void 0!==i){if(isNaN(i))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))));if(i<Y.DEFAULT_VALUES.ZERO)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))))}var a=y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.PER_PAGE];if(void 0===a)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(a))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(a>Y.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",Y.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(a<Y.DEFAULT_VALUES.ZERO)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));var E=y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY];if(void 0!==E){if(typeof E!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))));y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=encodeURIComponent(E.trim())}var c=y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ID];if(void 0!==c){if(isNaN(c))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))));if(c<Y.DEFAULT_VALUES.ZERO)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))))}var u=y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.SENT_AT];if(void 0!==u){if(isNaN(u))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))));if(u<Y.DEFAULT_VALUES.ZERO)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))))}var p=y.hideMessagesFromBlockedUsers;if(void 0!==p){if(typeof p!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers()"))));1==p&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=1)}var l=y.unread;if(void 0!==l){if(typeof l!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"UNREAD","UNREAD","setUnread()"))));1==l&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.UNREAD]=1)}var d=y.category;if(void 0!==d){if(typeof d!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_CATEGORY","SET_CATEGORY","setCategory()"))));if(D.isFalsy(d.trim()))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.INVALID),"SET_CATEGORY","SET_CATEGORY","category","category"))));y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=d.trim()}var S=y.categories;if(void 0!==S){if(!Array.isArray(S))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_CATEGORIES","SET_CATEGORIES","setCategories()"))));0<S.length&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=S)}var C=y.type;if(void 0!==C){if(typeof C!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_TYPE","SET_TYPE","setType()"))));if(D.isFalsy(C.trim()))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.INVALID),"SET_TYPE","SET_TYPE","type","type"))));y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.TYPES]=encodeURIComponent(C.trim())}var h=y.types;if(void 0!==h){if(!Array.isArray(h))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<h.length&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.TYPES]=h.map(function(e){return encodeURIComponent(e)}))}var f=y.tags;if(void 0!==f){if(!Array.isArray(f))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TAGS","SET_TAGS","setTags()"))));0<f.length&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.TAGS]=f.map(function(e){return encodeURIComponent(e)}))}var _=y.WithTags;if(void 0!==_){if(typeof _!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()"))));1==_&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.WITH_TAGS]=1)}var T=y.hideDeletedMessages;if(void 0!==T){if(typeof T!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_DELETED_MESSAGES","HIDE_DELETED_MESSAGES","hideDeletedMessages()"))));1==T&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=1)}var g=y.interactionGoalCompletedOnly;if(void 0!==g){if(typeof g!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"ONLY_INTERACTION_GOAL_COMPLETED","ONLY_INTERACTION_GOAL_COMPLETED","interactionGoalCompletedOnly()"))));1==g&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=1)}var R=y.hasAttachments;if(void 0!==R){if(typeof R!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_ATTACHMENTS","HAS_ATTACHMENTS","hasAttachments()"))));1==R&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_ATTACHMENTS]=1)}var A=y.hasLinks;if(void 0!==A){if(typeof A!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_LINKS","HAS_LINKS","hasLinks()"))));1==A&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_LINKS]=1)}var I=y.hasMentions;if(void 0!==I){if(typeof I!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_MENTIONS","HAS_MENTIONS","hasMentions()"))));1==I&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_MENTIONS]=1)}var O=y.hasReactions;if(void 0!==O){if(typeof O!==Y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_REACTIONS","HAS_REACTIONS","hasReactions()"))));1==O&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HAS_REACTIONS]=1)}var N=y.mentionedUIDs;if(void 0!==N){if(!Array.isArray(N))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"MENTIONED_UIDS","MENTIONED_UIDS","setMentionedUIDs()"))));0<(null==N?void 0:N.length)&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.MENTIONED_UIDS]=N)}var m=y.attachmentTypes;if(void 0!==m){if(!Array.isArray(m))return void t(new M.CometChatException(JSON.parse(D.format(JSON.stringify(Y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<m.length&&(y.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ATTACHMENT_TYPES]=m)}if(y.createEndpoint(),y.totalPages)if(1!=y.totalPages);else if(y.lastAffix==y.affix)return void o([]);L.makeApiCall(y.endpointName,{listId:y.listId},y.paginationMeta).then(function(t){return P(y,void 0,void 0,function(){var n,r=this;return v(this,function(e){return n=[],t[Y.ResponseConstants.RESPONSE_KEYS.KEY_META][Y.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(Y.MessageConstatnts.PAGINATION.KEYS.ID)&&0==this.id&&(this.id=parseInt(t.meta.cursor[Y.MessageConstatnts.PAGINATION.KEYS.ID])),t[Y.ResponseConstants.RESPONSE_KEYS.KEY_META][Y.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(Y.MessageConstatnts.PAGINATION.KEYS.SENT_AT)&&0==this.timestamp&&(this.timestamp=t.meta.cursor[Y.MessageConstatnts.PAGINATION.KEYS.SENT_AT]),t.meta.pagination.hasOwnProperty("total_pages")&&(this.totalPages=t.meta.pagination.total_pages),t.meta.cursor.hasOwnProperty("affix")&&(this.lastAffix=t.meta.cursor.affix),t.data[0]?(0<this.id&&(this.id=parseInt(t.data[0].id)),0<this.timestamp&&(this.timestamp=t.data[0].sentAt),t.data.map(function(t){return P(r,void 0,void 0,function(){return v(this,function(e){return w.MessageListnerMaping.getInstance().get(Y.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST).then(function(e){parseInt(t.id)>e&&w.MessageListnerMaping.getInstance().set(Y.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))},function(e){w.MessageListnerMaping.getInstance().set(Y.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))}),this.affix==Y.MessageConstatnts.PAGINATION.AFFIX.APPEND?(this.id<parseInt(t.id)&&0<this.id&&(this.id=parseInt(t.id)),this.timestamp<t.sentAt&&0<this.timestamp&&(this.timestamp=t.sentAt),this.updatedAt<t.updatedAt&&0<this.updatedAt&&(this.updatedAt=t.updatedAt)):(this.id>parseInt(t.id)&&(this.id=parseInt(t.id)),this.timestamp>t.sentAt&&(this.timestamp=t.sentAt),this.updatedAt>t.updatedAt&&(this.updatedAt=t.updatedAt)),this.id&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.timestamp&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.updatedAt&&(this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),n.push(U.MessageController.trasformJSONMessge(t)),[2]})})})):n=[],o(n),[2]})})},function(e){t(new M.CometChatException(e.error))})}catch(e){t(new M.CometChatException(e))}})},e.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[Y.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(D.isFalsy(this.guid)||D.isFalsy(this.uid))&&D.isFalsy(this.guid)?(D.isFalsy(this.uid)?this.endpointName="getMessages":this.endpointName="getUserMessages",this.listId=this.uid):(this.endpointName="getGroupMessages",this.listId=this.guid)},e.prototype.makeData=function(){var e={};e[Y.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,e[Y.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(D.isFalsy(this.guid)||D.isFalsy(this.uid))&&D.isFalsy(this.guid)&&D.isFalsy(this.uid)},e.prototype.getFilteredPreviousDataByReceiverId=function(t){return P(this,void 0,void 0,function(){var n,r=this;return v(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,s.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).map(function(e){n=o(n,[t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,s.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).map(function(e){n=o(n,[t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,s.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).filter(function(e){return t[e].sender.uid==r.uid}).map(function(e){n=o(n,[t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,s.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).map(function(e){n=o(n,[t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e.prototype.getFilteredNextDataByReceiverId=function(t){return P(this,void 0,void 0,function(){var n,r=this;return v(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,s.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).map(function(e){n=o(n,[t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,s.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).map(function(e){n=o(n,[t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,s.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).filter(function(e){return t[e].sender.uid==r.uid}).map(function(e){n=o(n,[t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,s.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>r.id}).map(function(e){n=o(n,[t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e}();t.MessagesRequest=r;var a=function(){function e(){this.maxLimit=Y.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=Y.DEFAULT_VALUES.DEFAULT_MSG_ID,this.unread=!1,this.HideMessagesFromBlockedUsers=!1,this.onlyUpdate=0,this.HideDeletedMessages=!1,this.WithTags=!1,this.mentionsWithTagInfoFlag=!1,this.mentionsWithBlockedInfoFlag=!1,this.interactionGoalCompletedOnly=!1,this.HasAttachments=!1,this.HasLinks=!1,this.HasMentions=!1,this.HasReactions=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setGUID=function(e){return this.guid=e,this},e.prototype.setUID=function(e){return this.uid=e,this},e.prototype.setParentMessageId=function(e){return this.parentMessageId=e,this},e.prototype.setTimestamp=function(e){return void 0===e&&(e=D.getCurrentTime()),this.timestamp=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=Y.DEFAULT_VALUES.DEFAULT_MSG_ID),this.id=e,this},e.prototype.setUnread=function(e){return void 0===e&&(e=!1),this.unread=e,this},e.prototype.hideMessagesFromBlockedUsers=function(e){return void 0===e&&(e=!1),this.HideMessagesFromBlockedUsers=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKey=e,this},e.prototype.setUpdatedAfter=function(e){return this.updatedAt=e,this},e.prototype.updatesOnly=function(e){return e&&(this.onlyUpdate=1),this},e.prototype.setCategory=function(e){return this.category=e,this},e.prototype.setCategories=function(e){return this.categories=e,this},e.prototype.setType=function(e){return this.type=e,this},e.prototype.setTypes=function(e){return this.types=e,this},e.prototype.hideReplies=function(e){return this.HideReplies=e,this},e.prototype.hideDeletedMessages=function(e){return this.HideDeletedMessages=e,this},e.prototype.hasAttachments=function(e){return this.HasAttachments=e,this},e.prototype.hasLinks=function(e){return this.HasLinks=e,this},e.prototype.hasMentions=function(e){return this.HasMentions=e,this},e.prototype.hasReactions=function(e){return this.HasReactions=e,this},e.prototype.setMentionedUIDs=function(e){return this.mentionedUIDs=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.WithTags=e,this},e.prototype.mentionsWithTagInfo=function(e){return void 0===e&&(e=!1),this.mentionsWithTagInfoFlag=e,this},e.prototype.mentionsWithBlockedInfo=function(e){return void 0===e&&(e=!1),this.mentionsWithBlockedInfoFlag=e,this},e.prototype.setInteractionGoalCompletedOnly=function(e){return void 0===e&&(e=!1),this.interactionGoalCompletedOnly=e,this},e.prototype.setAttachmentTypes=function(e){return this.attachmentTypes=e,this},e.prototype.build=function(){return this.category&&this.categories&&this.categories.push(this.category),this.type&&this.types&&this.types.push(this.type),new r(this)},e}();t.MessagesRequestBuilder=a},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessagesStore=void 0;var r=n(4),E=n(0),c=n(1),o=n(15),s=function(){function e(e){this.store=c.constants.DEFAULT_STORE,E.isFalsy(e)||(this.store=e),this.messagesStore=o.createInstance({name:E.format(c.LOCAL_STORE.STORE_STRING,r.CometChat.getAppId(),c.LOCAL_STORE.MESSAGES_STORE)}),this.messagesStore.setDriver([o.LOCALSTORAGE,o.INDEXEDDB,o.WEBSQL])}return e.getInstance=function(){return null==e.MessagesStore&&(e.MessagesStore=new e),e.MessagesStore},e.prototype.set=function(e,t){return this.messagesStore.setItem(e,t)},e.prototype.remove=function(e){this.messagesStore.removeItem(e)},e.prototype.get=function(e){return this.messagesStore.getItem(e)},e.prototype.clearStore=function(){var n=this;return new Promise(function(e,t){n.messagesStore.clear().then(function(){e(!0)}).catch(function(e){t(e)})})},e.prototype.getAllMessages=function(){var n=this,r={};return new Promise(function(e,t){n.messagesStore.iterate(function(e,t,n){t!=c.constants.MSG_VER_POST&&t!=c.constants.MSG_VER_POST&&(r=a(a({},r),e))}).then(function(){e(r)})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeMessages=function(e){var n=this;if(r.CometChat.user.getUid()){var o=r.CometChat.user.getUid(),s={},i=0;return this.get(c.constants.MSG_VER_POST).then(function(r){e.map(function(e){var t;if(!E.isFalsy(e)){0==i&&(i=parseInt(e.getId().toString())),i>e.getId()&&(i=parseInt(e.getId().toString())),r<e.getId()&&(r=parseInt(e.getId().toString()));var n=void 0;n=e.getSender()instanceof Object?e.getSender().getUid():e.getSender(),e.getReceiverType()==c.MessageConstatnts.RECEIVER_TYPE.GROUP&&(n=e.getReceiver()),e.getSender()instanceof Object?e.getSender().getUid()==o&&(n=e.getReceiver()):e.getSender()==o&&(n=e.getReceiver()),s[n]||(s[n]={}),s[n]=a(a({},s[n]),((t={})[e.getId()]=e,t))}}),n.get(c.constants.MSG_VER_PRE).then(function(e){(0<i&&i<e||null==e)&&n.set(c.constants.MSG_VER_PRE,i)})&&0<r&&n.set(c.constants.MSG_VER_POST,r),Object.keys(s).map(function(t){n.get(t).then(function(e){null==e&&(e={}),n.set(t,a(a({},s[t]),e))})})}),!0}},e}();t.MessagesStore=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockedUsersRequestBuilder=t.BlockedUsersRequest=void 0;var o=n(6),r=n(0),s=n(13),i=n(2),a=n(1),E=function(){function e(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},r.isFalsy(e)||(this.limit=e.limit,e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),r.isFalsy(e.direction)||(this.direction=e.direction))}return e.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.direction){if(typeof this.direction!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(r.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_DIRECTION","SET_DIRECTION","setDirection()")));if(this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BOTH&&this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME&&this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME)return new i.CometChatException(a.UserErrors.INVALID_DIRECTION)}},e.prototype.fetchNext=function(){var r=this;return new Promise(function(n,t){try{if(r.fetchingInProgress)r.fetchingInProgress=!1,n([]);else{r.fetchingInProgress=!0;var e=r.validateBlockedUsersBuilder();if(e instanceof i.CometChatException)return void t(e);o.makeApiCall("blockedUsersList",{},r.getNextData()).then(function(e){if(e.meta&&(r.total_pages=e.meta.pagination.total_pages),0<e.data.length){r.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(s.UsersController.trasformJSONUser(e))}),n(t)}else n([]);r.fetchingInProgress=!1},function(e){r.fetchingInProgress=!1,t(new i.CometChatException(e.error))})}}catch(e){r.fetchingInProgress=!1,t(new i.CometChatException(e))}})},e.prototype.getDirection=function(){return this.direction},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,r.isFalsy(this.direction)||(e.direction=this.direction),this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e.directions=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS,e}();t.BlockedUsersRequest=E;var c=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setDirection=function(e){return this.direction=e,this},e.prototype.blockedByMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME,this},e.prototype.hasBlockedMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME,this},e.prototype.build=function(){return new E(this)},e}();t.BlockedUsersRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppSettingsBuilder=t.AppSettings=void 0;var r=n(1),o=function(){function t(e){this.subscriptionType=t.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=r.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null,this.subscriptionType=e.subscriptionType,this.roles=e.roles,this.region=e.region,this.autoJoinGroup=e.autoJoinGroup,this.establishSocketConnection=e.establishSocketConnection,this.adminHost=e.adminHost,this.clientHost=e.clientHost}return t.prototype.getSubscriptionType=function(){return this.subscriptionType},t.prototype.getRoles=function(){return this.roles},t.prototype.getRegion=function(){return this.region},t.prototype.getIsAutoJoinEnabled=function(){return this.autoJoinGroup},t.prototype.shouldAutoEstablishSocketConnection=function(){return this.establishSocketConnection},t.prototype.getAdminHost=function(){return this.adminHost},t.prototype.getClientHost=function(){return this.clientHost},t.SUBSCRIPTION_TYPE_NONE="NONE",t.SUBSCRIPTION_TYPE_ALL_USERS="ALL_USERS",t.SUBSCRIPTION_TYPE_ROLES="ROLES",t.SUBSCRIPTION_TYPE_FRIENDS="FRIENDS",t.REGION_EU=r.DEFAULT_VALUES.REGION_DEFAULT_EU,t.REGION_US=r.DEFAULT_VALUES.REGION_DEFAULT_US,t.REGION_IN=r.DEFAULT_VALUES.REGION_DEFAULT_IN,t.REGION_PRIVATE=r.DEFAULT_VALUES.REGION_DEFAULT_PRIVATE,t}();t.AppSettings=o;var s=function(){function e(){this.subscriptionType=o.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=r.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null}return e.prototype.subscribePresenceForAllUsers=function(){return this.subscriptionType=o.SUBSCRIPTION_TYPE_ALL_USERS,this},e.prototype.subscribePresenceForRoles=function(e){return this.subscriptionType=o.SUBSCRIPTION_TYPE_ROLES,this.roles=e,this},e.prototype.subscribePresenceForFriends=function(){return this.subscriptionType=o.SUBSCRIPTION_TYPE_FRIENDS,this},e.prototype.setRegion=function(e){return void 0===e&&(e=r.DEFAULT_VALUES.REGION_DEFAULT),this.region=e.toLowerCase(),this},e.prototype.enableAutoJoinForGroups=function(e){return void 0===e&&(e=!0),this.autoJoinGroup=e,this},e.prototype.autoEstablishSocketConnection=function(e){return void 0===e&&(e=!0),this.establishSocketConnection=e,this},e.prototype.overrideAdminHost=function(e){return this.adminHost=e,this},e.prototype.overrideClientHost=function(e){return this.clientHost=e,this},e.prototype.build=function(){return new o(this)},e}();t.AppSettingsBuilder=s},function(e,t,n){"use strict";var p=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var s=arguments[t],i=0,a=s.length;i<a;i++,o++)r[o]=s[i];return r};Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatHelper=void 0;var l=n(12),d=n(1),S=n(13),C=n(18),h=n(31),f=n(4),_=n(2),r=n(0),T=n(7),g=n(5),R=n(20),A=n(10),o=function(){function e(){}return e.processMessage=function(e){try{return l.MessageController.trasformJSONMessge(e)}catch(e){r.Logger.error("CometChatHelper: processMessage",e)}},e.getConversationFromMessage=function(u){return new Promise(function(E,c){try{f.CometChat.getLoggedinUser().then(function(e){if(null!==e){var t=l.MessageController.trasformJSONMessge(u),n=t.receiverType,r=t.conversationId,o=void 0,s=l.MessageController.trasformJSONMessge(u);if(n==d.MessageConstatnts.RECEIVER_TYPE.USER){var i=S.UsersController.trasformJSONUser(t[d.MessageConstatnts.KEYS.SENDER]);o=i.getUid()==e.getUid()?S.UsersController.trasformJSONUser(t[d.MessageConstatnts.KEYS.RECEIVER]):i}else o=C.GroupsController.trasformJSONGroup(t[d.MessageConstatnts.KEYS.RECEIVER]);var a=h.ConversationController.trasformJSONConversation(r,n,s,o,0,[],null,null);E(a)}else c(d.UserErrors.USER_NOT_LOGGED_IN)},function(e){c(new _.CometChatException(e.error))})}catch(e){c(new _.CometChatException(e))}})},e.updateMessageWithReactionInfo=function(e,t,n){var r,o,s,i;try{if(!e||!t||!n)return new _.CometChatException(A.ERRORS.PARAMETER_MISSING);if(!(e instanceof T.BaseMessage))return new _.CometChatException(A.ERRORS.PARAMETER_MISSING);if(n===g.MESSAGE_REACTION.ACTION.ADDED){if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<(null===(r=e.getReactions())||void 0===r?void 0:r.length)){var a=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==a){(c=e.getReactions())[a].setCount(c[a].getCount()+1),(null===(o=null===f.CometChat||void 0===f.CometChat?void 0:f.CometChat.user)||void 0===o?void 0:o.uid)===t.getUid()&&c[a].setReactedByMe(!0),e.setReactions(c)}else{var E=void 0;E=(null===(s=null===f.CometChat||void 0===f.CometChat?void 0:f.CometChat.user)||void 0===s?void 0:s.uid)===t.getUid()?new R.ReactionCount(t.getReaction(),1,!0):new R.ReactionCount(t.getReaction(),1,!1),e.setReactions(p(e.getReactions(),[E]))}}else(null===(i=null===f.CometChat||void 0===f.CometChat?void 0:f.CometChat.user)||void 0===i?void 0:i.uid)===t.getUid()?e.setReactions([new R.ReactionCount(t.getReaction(),1,!0)]):e.setReactions([new R.ReactionCount(t.getReaction(),1,!1)]);return e}}else{if(n!==g.MESSAGE_REACTION.ACTION.REMOVED)return new _.CometChatException(A.ERRORS.PARAMETER_MISSING);if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<e.getReactions().length){var c,u=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==u)if(1<(E=e.getReactions()[u]).getCount())(c=e.getReactions())[u].setCount(c[u].getCount()-1),f.CometChat.user.getUid()===t.getUid()&&c[u].setReactedByMe(!1),e.setReactions(c);else c=(c=e.getReactions()).filter(function(e,t){return t!==u}),e.setReactions(c)}return e}}}catch(e){return new _.CometChatException(e)}},e}();t.CometChatHelper=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MainVideoContainerSetting=t.CallSettingsBuilder=t.CallSettings=void 0;var r=n(1),o=n(0),s=function(){function e(e){this.sessionID=e.sessionID,this.defaultLayout=e.defaultLayout,this.isAudioOnly=e.isAudioOnly,this.region=e.region,this.domain=e.domain,this.user=e.user,this.listener=e.listener,this.mode=e.mode,this.ShowEndCallButton=e.ShowEndCallButton,this.ShowSwitchCameraButton=e.ShowSwitchCameraButton,this.ShowMuteAudioButton=e.ShowMuteAudioButton,this.ShowPauseVideoButton=e.ShowPauseVideoButton,this.ShowAudioModeButton=e.ShowAudioModeButton,this.StartAudioMuted=e.StartAudioMuted,this.StartVideoMuted=e.StartVideoMuted,this.analyticsSettings=e.analyticsSettings,this.appId=e.appId,this.defaultAudioMode=e.defaultAudioMode,this.ShowSwitchToVideoCallButton=e.ShowSwitchToVideoCallButton,this.AvatarMode=e.AvatarMode,this.ShowRecordingButton=e.ShowRecordingButton,this.StartRecordingOnCallStart=e.StartRecordingOnCallStart,this.MainVideoContainerSetting=e.MainVideoContainerSetting,this.EnableVideoTileClick=e.EnableVideoTileClick,this.EnableDraggableVideoTile=e.EnableDraggableVideoTile}return e.prototype.getSessionId=function(){return this.sessionID},e.prototype.isAudioOnlyCall=function(){return this.isAudioOnly},e.prototype.getUser=function(){return this.user},e.prototype.getRegion=function(){return this.region},e.prototype.getAppId=function(){return this.appId},e.prototype.getDomain=function(){return this.domain},e.prototype.isDefaultLayoutEnabled=function(){return this.defaultLayout},e.prototype.getCallEventListener=function(){return this.listener},e.prototype.getMode=function(){return this.mode},e.prototype.getStartWithAudioMuted=function(){return this.StartAudioMuted},e.prototype.getStartWithVideoMuted=function(){return this.StartVideoMuted},e.prototype.isEndCallButtonEnabled=function(){return this.ShowEndCallButton},e.prototype.isSwitchCameraButtonEnabled=function(){return this.ShowSwitchCameraButton},e.prototype.isMuteAudioButtonEnabled=function(){return this.ShowMuteAudioButton},e.prototype.isPauseVideoButtonEnabled=function(){return this.ShowPauseVideoButton},e.prototype.isAudioModeButtonEnabled=function(){return this.ShowAudioModeButton},e.prototype.getAnalyticsSettings=function(){return this.analyticsSettings},e.prototype.getDefaultAudioMode=function(){return this.defaultAudioMode},e.prototype.isAudioToVideoButtonEnabled=function(){return this.ShowSwitchToVideoCallButton},e.prototype.getAvatarMode=function(){return this.AvatarMode},e.prototype.isRecordingButtonEnabled=function(){return this.ShowRecordingButton},e.prototype.shouldStartRecordingOnCallStart=function(){return this.StartRecordingOnCallStart},e.prototype.getMainVideoContainerSetting=function(){return this.MainVideoContainerSetting},e.prototype.isVideoTileClickEnabled=function(){return this.EnableVideoTileClick},e.prototype.isVideoTileDragEnabled=function(){return this.EnableDraggableVideoTile},e.POSITION_TOP_LEFT="top-left",e.POSITION_TOP_RIGHT="top-right",e.POSITION_BOTTOM_LEFT="bottom-left",e.POSITION_BOTTOM_RIGHT="bottom-right",e.ASPECT_RATIO_DEFAULT="default",e.ASPECT_RATIO_CONTAIN="contain",e.ASPECT_RATIO_COVER="cover",e}();t.CallSettings=s;var i=function(){function e(){this.defaultLayout=!0,this.isAudioOnly=!1,this.mode=r.CallConstants.CALL_MODE.DEFAULT,this.ShowEndCallButton=!0,this.ShowSwitchCameraButton=!0,this.ShowMuteAudioButton=!0,this.ShowPauseVideoButton=!0,this.ShowAudioModeButton=!0,this.StartAudioMuted=!1,this.StartVideoMuted=!1,this.analyticsSettings={},this.ShowSwitchToVideoCallButton=!0,this.AvatarMode="circle",this.ShowRecordingButton=!1,this.StartRecordingOnCallStart=!1,this.MainVideoContainerSetting=new a,this.EnableVideoTileClick=!0,this.EnableDraggableVideoTile=!0}return e.prototype.setSessionID=function(e){return this.sessionID=e,this},e.prototype.enableDefaultLayout=function(e){return this.defaultLayout=e,this},e.prototype.setIsAudioOnlyCall=function(e){return this.isAudioOnly=e,this},e.prototype.setRegion=function(e){return this.region=e,this},e.prototype.setDomain=function(e){return this.domain=e,this},e.prototype.setUser=function(e){return this.user=e,this},e.prototype.setCallEventListener=function(e){return this.listener=e,this},e.prototype.setMode=function(e){return this.mode=e,this},e.prototype.showEndCallButton=function(e){return this.ShowEndCallButton=e,this},e.prototype.showSwitchCameraButton=function(e){return this.ShowSwitchCameraButton=e,this},e.prototype.showMuteAudioButton=function(e){return this.ShowMuteAudioButton=e,this},e.prototype.showPauseVideoButton=function(e){return this.ShowPauseVideoButton=e,this},e.prototype.showAudioModeButton=function(e){return this.ShowAudioModeButton=e,this},e.prototype.startWithAudioMuted=function(e){return this.StartAudioMuted=e,this},e.prototype.startWithVideoMuted=function(e){return this.StartVideoMuted=e,this},e.prototype.setAnalyticsSettings=function(e){return this.analyticsSettings=e,this},e.prototype.setAppId=function(e){return this.appId=e,this},e.prototype.setDefaultAudioMode=function(e){return this.defaultAudioMode=e,this},e.prototype.showSwitchToVideoCallButton=function(e){return this.ShowSwitchToVideoCallButton=e,this},e.prototype.setAvatarMode=function(e){return this.AvatarMode=e,this},e.prototype.showRecordingButton=function(e){return this.ShowRecordingButton=e,this},e.prototype.startRecordingOnCallStart=function(e){return this.StartRecordingOnCallStart=e,this},e.prototype.setMainVideoContainerSetting=function(e){return this.MainVideoContainerSetting=e,this},e.prototype.enableVideoTileClick=function(e){return this.EnableVideoTileClick=e,this},e.prototype.enableVideoTileDrag=function(e){return this.EnableDraggableVideoTile=e,this},e.prototype.build=function(){return new s(this)},e}();t.CallSettingsBuilder=i;var a=function(){function e(){this.videoFit=s.ASPECT_RATIO_CONTAIN,this.zoomButton=r.CallConstants.ZOOM_BUTTON_DEFAULT_PARAMS,this.fullScreenButton=r.CallConstants.FULL_SCREEN_BUTTON_DEFAULT_PARAMS,this.userListButton=r.CallConstants.USER_LIST_BUTTON_DEFAULT_PARAMS,this.nameLabel=r.CallConstants.NAME_LABEL_DEFAULT_PARAMS}return e.prototype.setMainVideoAspectRatio=function(e){this.videoFit=e},e.prototype.setFullScreenButtonParams=function(e,t){o.isFalsy(e)||(this.fullScreenButton[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.fullScreenButton[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e.prototype.setNameLabelParams=function(e,t,n){o.isFalsy(e)||(this.nameLabel[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.nameLabel[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t),o.isFalsy(n)||(this.nameLabel[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.COLOR]=n)},e.prototype.setZoomButtonParams=function(e,t){o.isFalsy(e)||(this.zoomButton[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.zoomButton[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e.prototype.setUserListButtonParams=function(e,t){o.isFalsy(e)||(this.userListButton[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.userListButton[r.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e}();t.MainVideoContainerSetting=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RTCUser=void 0;var r=n(0),o=function(){function e(e){this.avatar="",r.isFalsy(e)||(this.uid=e.toString())}return e.prototype.setUID=function(e){this.uid=e?e.toString():""},e.prototype.getUID=function(){return this.uid.toString()},e.prototype.setName=function(e){this.name=e?e.toString():""},e.prototype.getName=function(){return this.name.toString()},e.prototype.setAvatar=function(e){this.avatar=e?e.toString():""},e.prototype.getAvatar=function(){return this.avatar.toString()},e.prototype.setJWT=function(e){this.jwt=e?e.toString():""},e.prototype.getJWT=function(){return this.jwt.toString()},e.prototype.setResource=function(e){this.resource=e?e.toString():""},e.prototype.getResource=function(){return this.resource.toString()},e}();t.RTCUser=o},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function r(e){try{s(E.next(e))}catch(e){t(e)}}function o(e){try{s(E.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,o)}s((E=E.apply(e,i||[])).next())})},a=this&&this.__generator||function(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WSConnectionHelper=void 0;var l=n(4),o=n(66),d=n(1),s=n(40),E=n(44),S=n(0),i=n(46),C=n(29),c=n(32),u=n(26),p=n(27),h=n(67),f=n(68),_=n(69),T=n(70),g=n(71),R=n(72),A=n(73),I=n(74),O=n(28),N=n(35),m=n(33),y=n(5),P=n(48),v=i.ListenerHandlers.getInstance(),M=function(){function i(){var e=this;this.startWSResponseTimer=function(){i.wsResponseTimer=setInterval(function(){try{1<i.wsResponseTime?i.wsResponseTime=i.wsResponseTime-1:1===i.wsResponseTime&&(l.CometChat.disconnectInternally(),e.clearPingTimer(),e.clearWSResponseTimer(),i.appInactiveTimer&&i.clearAppInactiveTimer())}catch(e){S.Logger.error("CometChat: startWSResponseTimer",e)}},1e3)},this.clearWSResponseTimer=function(){try{i.wsResponseTime=30,clearInterval(i.wsResponseTimer)}catch(e){S.Logger.error("WSConnectionHelper: clearWSResponseTimer",e)}}}return i.prototype.onAppActive=function(){l.CometChat.appSettings.shouldAutoEstablishSocketConnection()||(i.isAppInactive=!1,i.pingTimer&&i.clearAppInactiveTimer(),!i.pingTimer&&P.checkConnection(this.connection)&&(this.pingWS(),this.startPingingWS()))},i.prototype.onAppInactive=function(){l.CometChat.appSettings.shouldAutoEstablishSocketConnection()||(i.isAppInactive=!0)},i.getInstance=function(){try{return null!=this.wsConnectionHelper&&null!=this.wsConnectionHelper||(this.wsConnectionHelper=new i),this.wsConnectionHelper}catch(e){S.Logger.error("WSConnectionHelper: getInstance",e)}},i.prototype.WSLogin=function(t,n){var r=this;try{P.getWSURL().then(function(e){r.connection=new WebSocket(e),n&&r.connection&&r.connection.readyState==y.READY_STATE.CONNECTING&&n(r.connection.readyState),r.connection.onopen=function(e){r.onOpen(e,n),r.authenticateUser(t)},r.connection.onclose=function(e){r.onClose(e,n)},r.connection.onmessage=function(e){r.onMessage(e)}},function(e){S.Logger.error("WSConnectionHelper :: WSLogin",e)})}catch(e){S.Logger.error("WSConnectionHelper: WSLogin",e)}},i.prototype.onOpen=function(e,t){try{t&&this.connection&&t(this.connection.readyState)}catch(e){S.Logger.error("WSConnectionHelper: onOpen",e)}},i.prototype.onClose=function(e,t){try{t&&this.connection&&t(this.connection.readyState,e)}catch(e){S.Logger.error("WSConnectionHelper: onClose",e)}},i.prototype.onMessage=function(e){if(e.data&&"string"==typeof e.data)try{var t=JSON.parse(e.data);if(t&&t.action&&t.action===y.KEYS.PONG)return;var n=this.getCometChatEventFromMessage(t);if(n.getDeviceId()===l.CometChat.getSessionId()&&n.getType()!==y.AUTH.TYPE)return;switch(n.getType()){case y.MESSAGE_REACTION.TYPE:this.publishMessageReaction(n);break;case y.TYPING_INDICATOR.TYPE:this.publishTypingIndicator(n);break;case y.RECEIPTS.TYPE:this.publishReceipts(n);break;case y.PRESENCE.TYPE:this.publishPresence(n);break;case y.AUTH.TYPE:this.authResponseReceived(n);break;case y.MESSAGE.TYPE:this.publishMessages(n);break;case y.TRANSIENT_MESSAGE.TYPE:this.publishTransientMessage(n);break;case y.INTERACTION_RECEIPT.TYPE:this.publishInteractionReceipt(n);break;default:S.Logger.log("WSHelper: onMessage :: unknown type",e.data)}}catch(e){S.Logger.error("WSHelper: onMessage",e)}else S.Logger.log("WSHelper: onMessage :: object data",e.data)},i.prototype.authenticateUser=function(u){var p=this;try{l.CometChat.getLoggedinUser().then(function(c){c?C.KeyStore.getInstance().get("deviceId").then(function(E){S.getAppSettings().then(function(e){var t=null;window&&window.location&&window.location.origin&&(t=window.location.origin);var n="",r=E,o={version:d.SDKHeader.sdkVersion,apiVersion:e[d.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:t,uts:(new Date).getTime()};S.isFalsy(l.CometChat.resource)||(o.resource=l.CometChat.resource),S.isFalsy(l.CometChat.platform)||(o.platform=l.CometChat.platform),S.isFalsy(l.CometChat.language)||(o.language=l.CometChat.language),navigator&&(n=navigator.userAgent);var s={appInfo:o,userAgent:n,deviceId:r,platform:d.SDKHeader.platform},i=new h.CometChatAuthEvent(l.CometChat.getAppId(),"","",c.getUid(),l.CometChat.getSessionId());if(i.setAuth(u),i.setPresenceSubscription(l.CometChat.appSettings.getSubscriptionType()),i.setDeviceId(l.CometChat.getSessionId()),i.setExtraParmaeters(s),P.checkConnection(p.connection)){var a=i.getAsString();p.connection.send(a)}})}):S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},i.prototype.authResponseReceived=function(e){try{"200"===e.getCode()&&"OK"===e.getStatus()&&this.startPingingWS()}catch(e){S.Logger.error("WSConnectionHelper: authResponseReceived",e)}},i.prototype.WSLogout=function(){try{this.clearPingTimer(),P.checkConnection(this.connection)&&this.connection.close(y.LOGOUT_CODE,y.LOGOUT_REASON)}catch(e){S.Logger.error("WSConnectionHelper: WSLogout",e)}},i.prototype.pingWS=function(s){return r(this,void 0,void 0,function(){var t,n,r,o;return a(this,function(e){switch(e.label){case 0:return(t=s||{}).onError,n=t.onSuccess,P.checkConnection(this.connection)?(r=new _.CometChatPingEvent("","","","",""),o=r.getAsString(),this.connection.send(o),i.isAppInactive&&this.startWSResponseTimer(),[4,this.listenForPong()]):[3,2];case 1:e.sent()?(S.Logger.log("WSConnectionHelper :: startPingingWS","pong success"),i.isAppInactive?(this.clearWSResponseTimer(),i.pingTimer&&this.clearPingTimer(),i.appInactiveTimer&&i.clearAppInactiveTimer(),i.startAppInactiveTimer()):i.appInactiveTimer&&i.clearAppInactiveTimer(),l.CometChat.getConnectionStatus()!=d.CONNECTION_STATUS.CONNECTED&&(this.WSLogout(),this.connection=null,l.CometChat.getInstance().makeWSConnection()),n&&n({status:l.CometChat.getConnectionStatus()})):(i.isAppInactive?(i.appInactiveTimer&&i.clearAppInactiveTimer(),i.startAppInactiveTimer()):i.appInactiveTimer&&i.clearAppInactiveTimer(),S.Logger.log("WSConnectionHelper :: startPingingWS","pong failure"),this.WSLogout(),this.connection=null,l.CometChat.getInstance().setConnectionStatus(d.CONNECTION_STATUS.DISCONNECTED),v.connectionHandlers.map(function(e){try{e._eventListener&&(S.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected())}catch(e){S.Logger.error("WSConnectionHandlers: Disconnected Status",e)}}),l.CometChat.getInstance().accidentallyDisconnected()),e.label=2;case 2:return[2]}})})},i.prototype.startPingingWS=function(){var e=this;try{i.pingTimer||(i.pingTimer=setInterval(function(){return r(e,void 0,void 0,function(){return a(this,function(e){return this.pingWS(),[2]})})},15e3))}catch(e){S.Logger.error("WSConnectionHelper: startPingingWS",e)}},i.startAppInactiveTimer=function(){i.appInactiveTimer=setInterval(function(){try{1<i.appInactiveTime?i.appInactiveTime=i.appInactiveTime-1:1===i.appInactiveTime&&(l.CometChat.disconnectInternally(),clearInterval(i.appInactiveTimer),i.appInactiveTime=30)}catch(e){S.Logger.error("CometChat: startAppInactiveTimer",e)}},1e3)},i.clearAppInactiveTimer=function(){try{i.appInactiveTime=30,clearInterval(i.appInactiveTimer)}catch(e){S.Logger.error("WSConnectionHelper: clearAppInactiveTime",e)}},i.prototype.listenForPong=function(){var r=this;return new Promise(function(t,e){var n=setTimeout(function(){t(!1)},3e3);r.connection.addEventListener("message",function(e){e&&e.data&&"string"==typeof e.data&&(JSON.parse(e.data).action===y.KEYS.PONG&&(clearTimeout(n),t(!0)))})})},i.prototype.clearPingTimer=function(){i.pingTimer&&(clearInterval(i.pingTimer),i.pingTimer=void 0)},i.prototype.sendOnlineEvent=function(){var r=this;try{P.checkConnection(this.connection)&&l.CometChat.getLoggedinUser().then(function(e){if(e){e.authToken&&delete e.authToken;var t={appId:l.CometChat.getAppId(),deviceId:l.CometChat.getSessionId(),type:y.PRESENCE.TYPE,body:{action:y.PRESENCE.ACTION.ONLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:e}};if(P.checkConnection(r.connection)){var n=P.stringifyMessage(t);r.connection.send(n)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: sendOnlineEvent",e)}},i.prototype.sendOfflineEvent=function(){var r=this;try{P.checkConnection(this.connection)&&l.CometChat.getLoggedinUser().then(function(e){if(e){e.authToken&&delete e.authToken;var t={appId:l.CometChat.getAppId(),deviceId:l.CometChat.getSessionId(),type:y.PRESENCE.TYPE,body:{action:y.PRESENCE.ACTION.OFFLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:e}};if(P.checkConnection(r.connection)){var n=P.stringifyMessage(t);r.connection.send(n)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: sendOfflineEvent",e)}},i.prototype.startTypingIndicator=function(o,s,i){var a=this;try{l.CometChat.getLoggedinUser().then(function(e){if(e){var t=new m.TypingIndicator(o,s);e.authToken&&delete e.authToken,t.setSender(e),i&&t.setMetadata(i);var n=new I.CometChatTypingEvent(l.CometChat.getAppId(),o,s,e.getUid(),l.CometChat.getSessionId());if(n.setAction(y.TYPING_INDICATOR.ACTION.STARTED),n.setTypingIndicator(t),P.checkConnection(a.connection)){var r=n.getAsString();a.connection.send(r)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},i.prototype.pauseTypingIndicator=function(o,s,i){var a=this;try{l.CometChat.getLoggedinUser().then(function(e){if(e){var t=new m.TypingIndicator(o,s);e.authToken&&delete e.authToken,t.setSender(e),i&&t.setMetadata(i);var n=new I.CometChatTypingEvent(l.CometChat.getAppId(),o,s,e.getUid(),l.CometChat.getSessionId());if(n.setAction(y.TYPING_INDICATOR.ACTION.ENDED),n.setTypingIndicator(t),P.checkConnection(a.connection)){var r=n.getAsString();a.connection.send(r)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: pauseTypingIndicator",e)}},i.prototype.markAsRead=function(o,s,i,a){var E=this;try{l.CometChat.getLoggedinUser().then(function(e){if(e){var t=new g.CometChatReceiptEvent(l.CometChat.getAppId(),o,s,e.getUid(),l.CometChat.getSessionId(),a);t.setAction(y.RECEIPTS.ACTION.READ);var n=new O.MessageReceipt;if(e.authToken&&delete e.authToken,n.setSender(e),n.setReceiverType(s),n.setReceiver(o),n.setReceiptType(y.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),t.setMessageReceipt(n),P.checkConnection(E.connection)){var r=t.getAsString();E.connection.send(r)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: markAsRead",e)}},i.prototype.markAsDelivered=function(o,s,i,a){var E=this;try{l.CometChat.getLoggedinUser().then(function(e){if(e){var t=new g.CometChatReceiptEvent(l.CometChat.getAppId(),o,s,e.getUid(),l.CometChat.getSessionId(),a);t.setAction(y.RECEIPTS.ACTION.DELIVERED);var n=new O.MessageReceipt;if(e.authToken&&delete e.authToken,n.setSender(e),n.setReceiverType(s),n.setReceiver(o),n.setReceiptType(y.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),t.setMessageReceipt(n),P.checkConnection(E.connection)){var r=t.getAsString();E.connection.send(r)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: markAsDelivered",e)}},i.prototype.sendTransientMessage=function(o,s,i){var a=this;try{l.CometChat.getLoggedinUser().then(function(e){if(e){var t=new N.TransientMessage(o,s,i);e.authToken&&delete e.authToken,t.setSender(e);var n=new A.CometChatTransientEvent(l.CometChat.getAppId(),o,s,e.getUid(),l.CometChat.getSessionId());if(n.setTransientMessage(t),P.checkConnection(a.connection)){var r=n.getAsString();a.connection.send(r)}}else S.Logger.log("no logged-in user","null")},function(e){S.Logger.log("error in fetching logged-in user",e)})}catch(e){S.Logger.error("WSConnectionHelper: sendTransientMessage",e)}},i.prototype.publishMessageReaction=function(e){var t=e.getMessageReactionEvent();switch(e.getAction()){case y.MESSAGE_REACTION.ACTION.ADDED:v.messageHandlers.map(function(e){e._eventListener.onMessageReactionAdded&&e._eventListener.onMessageReactionAdded(t)});break;case y.MESSAGE_REACTION.ACTION.REMOVED:v.messageHandlers.map(function(e){e._eventListener.onMessageReactionRemoved&&e._eventListener.onMessageReactionRemoved(t)})}},i.prototype.publishTypingIndicator=function(e){try{var t=e.getTypingIndicator();switch(e.getAction()){case y.TYPING_INDICATOR.ACTION.STARTED:v.messageHandlers.map(function(e){e._eventListener.onTypingStarted&&e._eventListener.onTypingStarted(t)}),E.TypingNotificationController.addIncomingTypingStarted(t);break;case y.TYPING_INDICATOR.ACTION.ENDED:v.messageHandlers.map(function(e){e._eventListener.onTypingEnded&&e._eventListener.onTypingEnded(t)}),E.TypingNotificationController.removeIncomingTypingStarted(t)}}catch(e){S.Logger.error("WSHelper: publishTypingIndicator",e)}},i.prototype.publishReceipts=function(e){try{var t=e.getMessageReceipt();switch(e.getAction()){case y.RECEIPTS.ACTION.DELIVERED:v.messageHandlers.map(function(e){e._eventListener.onMessagesDelivered&&e._eventListener.onMessagesDelivered(t)});break;case y.RECEIPTS.ACTION.READ:v.messageHandlers.map(function(e){e._eventListener.onMessagesRead&&e._eventListener.onMessagesRead(t)});break;case y.RECEIPTS.ACTION.DELIVERED_TO_ALL:v.messageHandlers.map(function(e){e._eventListener.onMessagesDeliveredToAll&&e._eventListener.onMessagesDeliveredToAll(t)});break;case y.RECEIPTS.ACTION.READ_BY_ALL:v.messageHandlers.map(function(e){e._eventListener.onMessagesReadByAll&&e._eventListener.onMessagesReadByAll(t)})}}catch(e){S.Logger.error("WSHelper: publishReceipts",e)}},i.prototype.publishPresence=function(e){try{var t=e.getUser();switch(t.setLastActiveAt(e.getTimestamp()),e.getAction()){case y.PRESENCE.ACTION.ONLINE:case y.PRESENCE.ACTION.AVAILABLE:t.setStatus(d.PresenceConstatnts.STATUS.ONLINE),v.userHandlers.map(function(e){S.isFalsy(e._eventListener.onUserOnline)||e._eventListener.onUserOnline(t)});break;case y.PRESENCE.ACTION.OFFLINE:t.setStatus(d.PresenceConstatnts.STATUS.OFFLINE),v.userHandlers.map(function(e){S.isFalsy(e._eventListener.onUserOffline)||e._eventListener.onUserOffline(t)})}}catch(e){S.Logger.error("WSHelper: publishPresence",e)}},i.prototype.publishMessages=function(e){try{var t=e.getMessage();t&&t.getId()&&c.MessageListnerMaping.getInstance().set("all",t.getId()),t instanceof p.Call?this.publishCallMessage(t):t instanceof u.Action?this.publishActionMessage(t):this.publishMessage(t)}catch(e){S.Logger.error("WSHelper: publishMessages",e)}},i.prototype.publishMessage=function(n){try{v.messageHandlers.map(function(e){if(e._eventListener){var t=n;switch(t.getType()){case d.MessageConstatnts.TYPE.TEXT:S.isFalsy(e._eventListener.onTextMessageReceived)||e._eventListener.onTextMessageReceived(n);break;case d.MessageConstatnts.TYPE.CUSTOM:S.isFalsy(e._eventListener.onCustomMessageReceived)||e._eventListener.onCustomMessageReceived(n);break;default:t.getCategory()==d.MessageCategory.CUSTOM?S.isFalsy(e._eventListener.onCustomMessageReceived)||e._eventListener.onCustomMessageReceived(n):t.getCategory()==d.MessageCategory.INTERACTIVE?S.isFalsy(e._eventListener.onInteractiveMessageReceived)||e._eventListener.onInteractiveMessageReceived(n):S.isFalsy(e._eventListener.onMediaMessageReceived)||e._eventListener.onMediaMessageReceived(n)}}})}catch(e){S.Logger.error("WSHelper: publishMessage",e)}},i.prototype.publishCallMessage=function(t){try{var n=s.CallController.getInstance().getActiveCall();switch(t.getStatus()){case d.CallConstants.CALL_STATUS.INITIATED:t.getReceiverType()==d.CallConstants.RECEIVER_TYPE_GROUP?v.callHandlers.map(function(e){t.getCallInitiator().getUid().toLocaleLowerCase()!=l.CometChat.user.getUid().toLocaleLowerCase()&&(S.isFalsy(e._eventListener.onIncomingCallReceived)||e._eventListener.onIncomingCallReceived(t))}):v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onIncomingCallReceived)||e._eventListener.onIncomingCallReceived(t)});break;case d.CallConstants.CALL_STATUS.ONGOING:t.getReceiverType()==d.CallConstants.RECEIVER_TYPE_GROUP?t.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase()&&v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onOutgoingCallAccepted)||e._eventListener.onOutgoingCallAccepted(t)}):(s.CallController.getInstance().clearTimer(),v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onOutgoingCallAccepted)||e._eventListener.onOutgoingCallAccepted(t)}));break;case d.CallConstants.CALL_STATUS.UNANSWERED:if(t.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase())v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});else{if(null!==n&&n.getSessionId()===t.getSessionId())try{s.CallController.getInstance().endCall()}catch(e){S.Logger.error("CallError",e)}v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onIncomingCallCancelled)||e._eventListener.onIncomingCallCancelled(t)})}break;case d.CallConstants.CALL_STATUS.REJECTED:if(t.getReceiverType()==d.CallConstants.RECEIVER_TYPE_GROUP)t.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase()&&v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});else{if(null!==n&&n.getSessionId()===t.getSessionId())try{s.CallController.getInstance().endCall()}catch(e){S.Logger.error("CallError",e)}v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)})}break;case d.CallConstants.CALL_STATUS.BUSY:t.getReceiverType()==d.CallConstants.RECEIVER_TYPE_GROUP?t.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase()&&v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)}):v.callHandlers.map(function(e){if(null!==n&&n.getSessionId()===t.getSessionId())try{s.CallController.getInstance().endCall()}catch(e){S.Logger.error("CallError",e)}S.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});break;case d.CallConstants.CALL_STATUS.CANCELLED:if(v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onIncomingCallCancelled)||e._eventListener.onIncomingCallCancelled(t)}),null!==n&&n.getSessionId()===t.getSessionId())try{s.CallController.getInstance().endCall()}catch(e){S.Logger.error("CallError",e)}break;case d.CallConstants.CALL_STATUS.ENDED:if(v.callHandlers.map(function(e){S.isFalsy(e._eventListener.onCallEndedMessageReceived)||e._eventListener.onCallEndedMessageReceived(t)}),s.CallController.getInstance().getCallListner()&&s.CallController.getInstance().getCallListner()._eventListener.onCallEnded(t),null!==n&&n.getSessionId()===t.getSessionId())try{s.CallController.getInstance().endCall()}catch(e){S.Logger.error("CallError",e)}break;default:S.Logger.log("WSHelper: publishCallMessage :: unknown status",t)}}catch(e){S.Logger.error("WSHelper: publishCallMessage",e)}},i.prototype.publishActionMessage=function(t){try{switch(t.getAction()){case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_JOINED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberJoined)||e._eventListener.onGroupMemberJoined(t,t.getActionBy(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_INVITED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberJoined)||e._eventListener.onGroupMemberJoined(t,t.getActionBy(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_LEFT:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberLeft)||e._eventListener.onGroupMemberLeft(t,t.getActionBy(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_BANNED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberBanned)||e._eventListener.onGroupMemberBanned(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_KICKED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberKicked)||e._eventListener.onGroupMemberKicked(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_UNBANNED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberUnbanned)||e._eventListener.onGroupMemberUnbanned(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_SCOPE_CHANGED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberScopeChanged)||e._eventListener.onGroupMemberScopeChanged(t,t.getActionOn(),t.getNewScope(),t.getOldScope(),t.getActionFor())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_EDITED:v.messageHandlers.map(function(e){S.isFalsy(e._eventListener.onMessageEdited)||e._eventListener.onMessageEdited(t.getActionOn())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_DELETED:v.messageHandlers.map(function(e){S.isFalsy(e._eventListener.onMessageDeleted)||e._eventListener.onMessageDeleted(t.getActionOn())});break;case d.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_ADDED:v.groupHandlers.map(function(e){S.isFalsy(e._eventListener.onGroupMemberAddedToGroup)||e._eventListener.onGroupMemberAddedToGroup(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;default:S.Logger.log("WSHelper: publishActionMessage :: unknown action",t)}}catch(e){S.Logger.error("WSHelper: publishActionMessage",e)}},i.prototype.publishTransientMessage=function(e){try{var t=e.getTransientMessage();v.messageHandlers.map(function(e){e._eventListener.onTransientMessageReceived&&e._eventListener.onTransientMessageReceived(t)})}catch(e){S.Logger.error("WSHelper: publishTransientMessage",e)}},i.prototype.publishInteractionReceipt=function(e){try{var t=e.getInteractionReceipt();v.messageHandlers.map(function(e){e._eventListener.onInteractionGoalCompleted&&e._eventListener.onInteractionGoalCompleted(t)})}catch(e){S.Logger.error("WSHelper: publishInteractionReceipt",e)}},i.prototype.getCometChatEventFromMessage=function(e){try{if(e.hasOwnProperty(y.KEYS.TYPE))switch(e.type){case y.TYPING_INDICATOR.TYPE:return I.CometChatTypingEvent.getTypingEventFromJSON(e);case y.RECEIPTS.TYPE:return g.CometChatReceiptEvent.getReceiptEventFromJSON(e);case y.PRESENCE.TYPE:return T.CometChatPresenceEvent.getPresenceEventFromJSON(e);case y.MESSAGE.TYPE:return f.CometChatMessageEvent.getMessageEventFromJSON(e);case y.AUTH.TYPE:return h.CometChatAuthEvent.getAuthEventFromJSON(e);case y.TRANSIENT_MESSAGE.TYPE:return A.CometChatTransientEvent.getTransientEventFromJSON(e);case y.INTERACTION_RECEIPT.TYPE:return o.CometChatInteractionReceiptEvent.getReceiptEventFromJSON(e);case y.MESSAGE_REACTION.TYPE:return R.CometChatReactionEvent.getReactionEventFromJSON(e)}}catch(e){S.Logger.error("WSConnectionHelper: getCometChatEventFromMessage",e)}},i.wsConnectionHelper=new i,i.appInactiveTime=30,i.isAppInactive=!1,i.wsResponseTime=30,i}();t.WSConnectionHelper=M},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatInteractionReceiptEvent=void 0;var S=n(5),s=n(8),C=n(25),h=n(45),f=n(3),i=function(a){function d(e,t,n,r,o,s){var i=a.call(this,e,t,n,r,o,s)||this;return i.setType(S.INTERACTION_RECEIPT.TYPE),i}return o(d,a),d.prototype.getInteractionReceipt=function(){return this.interactionReceipt},d.prototype.setInteractionReceipt=function(e){this.interactionReceipt=e},d.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},d.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[S.KEYS.MESSAGE_ID]=this.interactionReceipt.getMessageId(),t[S.KEYS.USER]=this.interactionReceipt.getSender(),t[S.KEYS.INTERACTIONS]=this.interactionReceipt.getInteractions(),e[S.KEYS.BODY]=t,e},d.getReceiptEventFromJSON=function(e){var t=e[S.KEYS.APP_ID],n=e[S.KEYS.RECEIVER],r=e[S.KEYS.RECEIVER_TYPE],o=e[S.KEYS.DEVICE_ID],s=e[S.KEYS.SENDER],i=e[S.KEYS.MESSAGE_SENDER],a=e[S.KEYS.BODY],E=a[S.KEYS.USER],c=a[S.KEYS.MESSAGE_ID],u=a[S.KEYS.INTERACTIONS],p=new d(t,n,r,s,o,i),l=new h.InteractionReceipt;return l.setSender(new f.User(E)),l.setReceiverType(r),l.setMessageId(c),l.setReceiverId(n),l.setInteractions(u.map(function(e){return C.Interaction.getInteractionFromJSON(e)})),p.setInteractionReceipt(l),p},d}(s.CometChatEvent);t.CometChatInteractionReceiptEvent=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatAuthEvent=void 0;var p=n(5),s=function(i){function u(e,t,n,r,o){var s=i.call(this,e,t,n,r,o)||this;return s.setType(p.AUTH.TYPE),s}return o(u,i),u.prototype.getStatus=function(){return this.status},u.prototype.setStatus=function(e){this.status=e},u.prototype.getCode=function(){return this.code},u.prototype.setCode=function(e){this.code=e},u.prototype.setAuth=function(e){this.auth=e},u.prototype.getAuth=function(){return this.auth},u.prototype.setPresenceSubscription=function(e){this.presenceSubscription=e},u.prototype.getPresenceSubscription=function(){return this.presenceSubscription},u.prototype.setDeviceId=function(e){this.deviceId=e},u.prototype.getdeviceId=function(){return this.deviceId},u.prototype.setExtraParmaeters=function(e){this.params=e},u.prototype.getExtraParameters=function(){return this.params},u.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},u.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[p.KEYS.AUTH]=this.auth,t[p.KEYS.DEVICE_ID]=this.deviceId,t[p.KEYS.PRESENCE_SUBSCRIPTION]=this.presenceSubscription,t[p.KEYS.PARAMS]=this.params,e[p.KEYS.BODY]=t,e},u.getAuthEventFromJSON=function(e){var t=e[p.KEYS.APP_ID],n=e[p.KEYS.RECEIVER],r=e[p.KEYS.RECEIVER_TYPE],o=e[p.KEYS.DEVICE_ID],s=e[p.KEYS.SENDER],i=e[p.KEYS.BODY],a=i[p.KEYS.STATUS],E=i[p.KEYS.CODE],c=new u(t,n,r,s,o);return c.setStatus(a),c.setCode(E),c},u}(n(8).CometChatEvent);t.CometChatAuthEvent=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatMessageEvent=void 0;var u=n(12),p=n(5),s=function(i){function c(e,t,n,r,o){var s=i.call(this,e,t,n,r,o)||this;return s.setType(p.MESSAGE.TYPE),s}return o(c,i),c.prototype.getMessage=function(){return this.message},c.prototype.setMessage=function(e){this.message=e},c.getMessageEventFromJSON=function(e){var t=e[p.KEYS.APP_ID],n=e[p.KEYS.RECEIVER],r=e[p.KEYS.RECEIVER_TYPE],o=e[p.KEYS.DEVICE_ID],s=e[p.KEYS.SENDER],i=e[p.KEYS.BODY],a=new c(t,n,r,s,o),E=u.MessageController.trasformJSONMessge(i);return a.setMessage(E),a},c}(n(8).CometChatEvent);t.CometChatMessageEvent=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatPingEvent=void 0;var i=n(5),s=function(s){function e(e,t,n,r,o){return s.call(this,e,t,n,r,o)||this}return o(e,s),e.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},e.prototype.getAsJSONObject=function(){var e={};return e[i.KEYS.ACTION]=i.KEYS.PING,e[i.KEYS.ACK]="true",e},e}(n(8).CometChatEvent);t.CometChatPingEvent=s},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatPresenceEvent=void 0;var u=n(5),s=n(8),p=n(3),i=function(i){function c(e,t,n,r,o){var s=i.call(this,e,t,n,r,o)||this;return s.setType(u.PRESENCE.TYPE),s}return o(c,i),c.prototype.getAction=function(){return this.action},c.prototype.setAction=function(e){this.action=e},c.prototype.getUser=function(){return this.user},c.prototype.setUser=function(e){this.user=e},c.prototype.getTimestamp=function(){return this.timestamp},c.prototype.setTimestamp=function(e){this.timestamp=e},c.getPresenceEventFromJSON=function(e){var t=e[u.KEYS.APP_ID],n=e[u.KEYS.DEVICE_ID],r=e[u.KEYS.SENDER],o=e[u.KEYS.BODY],s=o[u.KEYS.ACTION],i=o[u.KEYS.USER],a=o[u.KEYS.TIMESTAMP],E=new c(t,"","",r,n);return E.setAction(s),E.setUser(new p.User(i)),E.setTimestamp(a),E},c}(s.CometChatEvent);t.CometChatPresenceEvent=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatReceiptEvent=void 0;var S=n(5),s=n(8),C=n(28),h=n(3),i=function(a){function d(e,t,n,r,o,s){var i=a.call(this,e,t,n,r,o,s)||this;return i.setType(S.RECEIPTS.TYPE),i}return o(d,a),d.prototype.getAction=function(){return this.action},d.prototype.setAction=function(e){this.action=e},d.prototype.getMessageReceipt=function(){return this.receipt},d.prototype.setMessageReceipt=function(e){this.receipt=e},d.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},d.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[S.KEYS.ACTION]=this.action,t[S.KEYS.MESSAGE_ID]=this.receipt.getMessageId(),t[S.KEYS.USER]=this.receipt.getSender(),e[S.KEYS.BODY]=t,e},d.getReceiptEventFromJSON=function(e){var t=e[S.KEYS.APP_ID],n=e[S.KEYS.RECEIVER],r=e[S.KEYS.RECEIVER_TYPE],o=e[S.KEYS.DEVICE_ID],s=e[S.KEYS.SENDER],i=e[S.KEYS.BODY],a=i[S.KEYS.ACTION],E=i[S.KEYS.USER],c=i[S.KEYS.MESSAGE_ID],u=i[S.KEYS.TIMESTAMP],p=new d(t,n,r,s,o);p.setAction(a);var l=new C.MessageReceipt;return l.setSender(new h.User(E)),l.setReceiverType(r),l.setReceiver(n),a===S.RECEIPTS.ACTION.DELIVERED&&(l.setReceiptType(S.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),l.setDeliveredAt(u)),a===S.RECEIPTS.ACTION.READ&&(l.setReceiptType(S.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),l.setReadAt(u)),a===S.RECEIPTS.ACTION.READ_BY_ALL&&(l.setReceiptType(S.RECEIPTS.RECEIPT_TYPE.READ_BY_ALL_RECEIPT),l.setReadAt(u)),a===S.RECEIPTS.ACTION.DELIVERED_TO_ALL&&(l.setReceiptType(S.RECEIPTS.RECEIPT_TYPE.DELIVERY_TO_ALL_RECEIPT),l.setDeliveredAt(u)),l.setMessageId(c.toString()),l.setTimestamp(u),p.setMessageReceipt(l),p},d}(s.CometChatEvent);t.CometChatReceiptEvent=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatReactionEvent=void 0;var g=n(5),s=n(8),R=n(34),A=n(47),i=function(i){function T(e,t,n,r,o){var s=i.call(this,e,t,n,r,o)||this;return s.setType(g.MESSAGE_REACTION.TYPE),s}return o(T,i),T.prototype.getAction=function(){return this.action},T.prototype.setAction=function(e){this.action=e},T.prototype.getMessageReactionEvent=function(){return this.reaction},T.prototype.setMessageReactionEvent=function(e){this.reaction=e},T.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},T.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[g.KEYS.ACTION]=this.action,t[g.KEYS.REACTION]=this.reaction,e[g.KEYS.BODY]=t,e},T.getReactionEventFromJSON=function(e){var t=e[g.KEYS.APP_ID],n=e[g.KEYS.DEVICE_ID],r=e[g.KEYS.SENDER],o=e[g.KEYS.RECEIVER],s=e[g.KEYS.RECEIVER_TYPE],i=e[g.KEYS.BODY],a=i[g.KEYS.ACTION],E=i[g.KEYS.ID],c=i[g.KEYS.MESSAGE_ID],u=i[g.KEYS.UID],p=i[g.KEYS.REACTION],l=i[g.KEYS.REACTED_BY],d=i[g.KEYS.REACTED_AT],S=i[g.KEYS.CONVERSATION_ID],C=i[g.KEYS.PARENT_ID],h=new R.Reaction(E,c,p,u,d,l),f=new A.ReactionEvent(h,o,s,S,C),_=new T(t,o,s,r,n);return _.setAction(a),_.setMessageReactionEvent(f),_},T}(s.CometChatEvent);t.CometChatReactionEvent=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatTransientEvent=void 0;var l=n(5),s=n(8),d=n(35),S=n(3),i=function(i){function p(e,t,n,r,o){var s=i.call(this,e,t,n,r,o)||this;return s.setType(l.TRANSIENT_MESSAGE.TYPE),s}return o(p,i),p.prototype.getTransientMessage=function(){return this.transientMessage},p.prototype.setTransientMessage=function(e){this.transientMessage=e},p.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},p.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[l.KEYS.USER]=this.transientMessage.getSender(),this.transientMessage.getData()&&(t[l.KEYS.DATA]=this.transientMessage.getData()),e[l.KEYS.BODY]=t,e},p.getTransientEventFromJSON=function(e){var t=e[l.KEYS.APP_ID],n=e[l.KEYS.RECEIVER],r=e[l.KEYS.RECEIVER_TYPE],o=e[l.KEYS.DEVICE_ID],s=e[l.KEYS.SENDER],i=e[l.KEYS.BODY],a=i[l.KEYS.USER],E=i[l.KEYS.DATA],c=new p(t,n,r,s,o),u=new d.TransientMessage(n,r,E);return u.setSender(new S.User(a)),i.hasOwnProperty(l.KEYS.DATA)&&i[l.KEYS.DATA]&&u.setData(E),c.setTransientMessage(u),c},p}(s.CometChatEvent);t.CometChatTransientEvent=i},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=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}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatTypingEvent=void 0;var d=n(5),s=n(8),S=n(33),C=n(3),i=function(i){function l(e,t,n,r,o){var s=i.call(this,e,t,n,r,o)||this;return s.setType(d.TYPING_INDICATOR.TYPE),s}return o(l,i),l.prototype.getAction=function(){return this.action},l.prototype.setAction=function(e){this.action=e},l.prototype.getTypingIndicator=function(){return this.typingIndicator},l.prototype.setTypingIndicator=function(e){this.typingIndicator=e},l.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},l.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[d.KEYS.ACTION]=this.action,t[d.KEYS.USER]=this.typingIndicator.getSender(),this.typingIndicator.getMetadata()&&(t[d.KEYS.METADATA]=this.typingIndicator.getMetadata()),e[d.KEYS.BODY]=t,e},l.getTypingEventFromJSON=function(e){var t=e[d.KEYS.APP_ID],n=e[d.KEYS.RECEIVER],r=e[d.KEYS.RECEIVER_TYPE],o=e[d.KEYS.DEVICE_ID],s=e[d.KEYS.SENDER],i=e[d.KEYS.BODY],a=i[d.KEYS.ACTION],E=i[d.KEYS.USER],c=i[d.KEYS.METADATA],u=new l(t,n,r,s,o);u.setAction(a);var p=new S.TypingIndicator(n,r);return p.setSender(new C.User(E)),i.hasOwnProperty(d.KEYS.METADATA)&&i[d.KEYS.METADATA]&&p.setMetadata(c),u.setTypingIndicator(p),u},l}(s.CometChatEvent);t.CometChatTypingEvent=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CCExtension=void 0;var r=n(0),o=function(){function e(e){this.id="",this.name="",e&&(r.isFalsy(e.id)||(this.id=e.id),r.isFalsy(e.name)||(this.name=e.name))}return e.prototype.getId=function(){return this.id},e.prototype.getName=function(){return this.name},e}();t.CCExtension=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AudioMode=void 0;var r=n(0),o=function(){function e(e,t){this.isSelected=!1,this.mode="",r.isFalsy(e)||(this.mode=e.toString()),this.isSelected=t||!1}return e.prototype.setMode=function(e){this.mode=e?e.toString():""},e.prototype.getMode=function(){return this.mode.toString()},e.prototype.setIsSelected=function(e){this.isSelected=e||!1},e.prototype.getIsSelected=function(){return this.isSelected},e}();t.AudioMode=o},function(e,r,o){"use strict";(function(t,n){var s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function r(e){try{s(E.next(e))}catch(e){t(e)}}function o(e){try{s(E.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,o)}s((E=E.apply(e,i||[])).next())})},a=this&&this.__generator||function(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(r,"__esModule",{value:!0}),r.PostDetails=void 0;var E=o(4),c=o(1),u=o(29),p=o(6),e=function(){function e(){var t=this;this.platform="ionic",this.uiKitSDK={version:""},this.callSDK={version:""},this._isDev=null!=window.IonicDevServer,this.getSDKVersion(),u.KeyStore.getInstance().get(c.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){e&&(t.deviceId=e)}),setTimeout(function(){t.postDetails()},5e3)}return e.prototype.getSDKVersion=function(){t.CometChatCallSDK&&(this.callSDK=t.CometChatCallSDK)},e.prototype.toBase64=function(t){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,n.from(t).toString("base64")]})})},e.prototype.customEncode=function(t){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,t.split("").map(function(e){return String.fromCharCode(e.charCodeAt(0)+1)}).join("")]})})},e.prototype.getSessionIdHash=function(){var o,s;return i(this,void 0,void 0,function(){var t,n,r;return a(this,function(e){switch(e.label){case 0:return t=""+c.SDKHeader.sdkVersion+(null!==(o=this.callSDK.version)&&void 0!==o?o:null)+"\n "+(null!==(s=this._isDev)&&void 0!==s&&s)+(E.CometChat.demoMetaInfo?E.CometChat.demoMetaInfo.version:null),[4,this.toBase64(t)];case 1:return n=e.sent(),r=this.customEncode(n),[2,r.then(function(e){return e.replace(/[^a-zA-Z0-9]/g,"")})]}})})},e.prototype.getStoredSessionIdHash=function(){return i(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,u.KeyStore.getInstance().get(c.LOCAL_STORE.KEY_SESSION_ID)];case 1:return[2,e.sent()]}})})},e.prototype.getLocale=function(){return navigator.language||navigator.userLanguage||"unknown"},e.prototype.getTimeZone=function(){var e=(new Date).getTimezoneOffset(),t=Math.floor(Math.abs(e)/60),n=Math.abs(e)%60;return(0<e?"-":"+")+(t=t<10?"0"+t:t)+":"+(n=n<10?"0"+n:n)},e.prototype.getOS=function(){return-1<window.navigator.userAgent.indexOf("Android")?"Android":-1<window.navigator.userAgent.indexOf("iPhone")?"iOS":"Unknown"},e.prototype.postDetails=function(){var o;return i(this,void 0,void 0,function(){var t,n,r=this;return a(this,function(e){switch(e.label){case 0:return[4,this.getSessionIdHash()];case 1:return t=e.sent(),[4,this.getStoredSessionIdHash()];case 2:return e.sent()===t||(n={sessionId:t,data:s(s({cometchat:s({chatsdk:{platform:this.platform,version:c.SDKHeader.sdkVersion}},this.callSDK.version?{callssdk:{platform:this.platform,version:this.callSDK.version}}:{})},E.CometChat.demoMetaInfo?{demo:{name:E.CometChat.demoMetaInfo.name,type:E.CometChat.demoMetaInfo.type,version:E.CometChat.demoMetaInfo.version,platform:E.CometChat.demoMetaInfo.platform}}:{}),{app:{debug:null!==(o=this._isDev)&&void 0!==o&&o},device:{id:this.deviceId,platform:this.platform,language:this.getLocale(),resolution:window.screen.width+" × "+window.screen.height,userAgent:window.navigator.userAgent,timezone:this.getTimeZone(),os:{name:this.getOS()}}}),generatedAt:Math.ceil((new Date).valueOf()/1e3)},p.makeApiCall("userSessions",{},n).then(function(n){return i(r,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.sessionId)?[4,u.KeyStore.getInstance().set(c.LOCAL_STORE.KEY_SESSION_ID,n.data.sessionId)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})})),[2]}})})},e}();r.PostDetails=e}).call(this,o(11),o(78).Buffer)},function(e,K,t){"use strict";(function(e){var r=t(79),s=t(80),i=t(81);function n(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()<t)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=p.prototype:(null===e&&(e=new p(t)),e.length=t),e}function p(e,t,n){if(!(p.TYPED_ARRAY_SUPPORT||this instanceof p))return new p(e,t,n);if("number"!=typeof e)return o(this,e,t,n);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}function o(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);p.TYPED_ARRAY_SUPPORT?(e=t).__proto__=p.prototype:e=u(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!p.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(t,n),o=(e=a(e,r)).write(t,n);o!==r&&(e=e.slice(0,o));return e}(e,t,n):function(e,t){if(p.isBuffer(t)){var n=0|l(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):u(e,t);if("Buffer"===t.type&&i(t.data))return u(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function E(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function c(e,t){if(E(t),e=a(e,t<0?0:0|l(t)),!p.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function u(e,t){var n=t.length<0?0:0|l(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function l(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function d(e,t){if(p.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return w(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return w(e).length;t=(""+t).toLowerCase(),r=!0}}function S(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function C(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=p.from(t,r)),p.isBuffer(t))return 0===t.length?-1:h(e,t,n,r,o);if("number"==typeof t)return t&=255,p.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):h(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function h(e,t,n,r,o){var s,i=1,a=e.length,E=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a/=i=2,E/=2,n/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(o){var u=-1;for(s=n;s<a;s++)if(c(e,s)===c(t,-1===u?0:s-u)){if(-1===u&&(u=s),s-u+1===E)return u*i}else-1!==u&&(s-=s-u),u=-1}else for(a<n+E&&(n=a-E),s=n;0<=s;s--){for(var p=!0,l=0;l<E;l++)if(c(e,s+l)!==c(t,l)){p=!1;break}if(p)return s}return-1}function f(e,t,n,r){n=Number(n)||0;var o=e.length-n;r?o<(r=Number(r))&&(r=o):r=o;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");s/2<r&&(r=s/2);for(var i=0;i<r;++i){var a=parseInt(t.substr(2*i,2),16);if(isNaN(a))return i;e[n+i]=a}return i}function _(e,t,n,r){return b(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function T(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function g(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o<n;){var s,i,a,E,c=e[o],u=null,p=239<c?4:223<c?3:191<c?2:1;if(o+p<=n)switch(p){case 1:c<128&&(u=c);break;case 2:128==(192&(s=e[o+1]))&&127<(E=(31&c)<<6|63&s)&&(u=E);break;case 3:s=e[o+1],i=e[o+2],128==(192&s)&&128==(192&i)&&2047<(E=(15&c)<<12|(63&s)<<6|63&i)&&(E<55296||57343<E)&&(u=E);break;case 4:s=e[o+1],i=e[o+2],a=e[o+3],128==(192&s)&&128==(192&i)&&128==(192&a)&&65535<(E=(15&c)<<18|(63&s)<<12|(63&i)<<6|63&a)&&E<1114112&&(u=E)}null===u?(u=65533,p=1):65535<u&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),o+=p}return function(e){var t=e.length;if(t<=R)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=R));return n}(r)}K.Buffer=p,K.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},K.INSPECT_MAX_BYTES=50,p.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),K.kMaxLength=n(),p.poolSize=8192,p._augment=function(e){return e.__proto__=p.prototype,e},p.from=function(e,t,n){return o(null,e,t,n)},p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&p[Symbol.species]===p&&Object.defineProperty(p,Symbol.species,{value:null,configurable:!0})),p.alloc=function(e,t,n){return r=null,s=t,i=n,E(o=e),o<=0?a(r,o):void 0!==s?"string"==typeof i?a(r,o).fill(s,i):a(r,o).fill(s):a(r,o);var r,o,s,i},p.allocUnsafe=function(e){return c(null,e)},p.allocUnsafeSlow=function(e){return c(null,e)},p.isBuffer=function(e){return!(null==e||!e._isBuffer)},p.compare=function(e,t){if(!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,o=0,s=Math.min(n,r);o<s;++o)if(e[o]!==t[o]){n=e[o],r=t[o];break}return n<r?-1:r<n?1:0},p.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);var n;if(void 0===t)for(n=t=0;n<e.length;++n)t+=e[n].length;var r=p.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var s=e[n];if(!p.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(r,o),o+=s.length}return r},p.byteLength=d,p.prototype._isBuffer=!0,p.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)S(this,t,t+1);return this},p.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)S(this,t,t+3),S(this,t+1,t+2);return this},p.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)S(this,t,t+7),S(this,t+1,t+6),S(this,t+2,t+5),S(this,t+3,t+4);return this},p.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?g(this,0,e):function(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,n);case"utf8":case"utf-8":return g(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return I(this,t,n);case"base64":return T(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){var e="",t=K.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},p.prototype.compare=function(e,t,n,r,o){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(o<=r&&n<=t)return 0;if(o<=r)return-1;if(n<=t)return 1;if(this===e)return 0;for(var s=(o>>>=0)-(r>>>=0),i=(n>>>=0)-(t>>>=0),a=Math.min(s,i),E=this.slice(r,o),c=e.slice(t,n),u=0;u<a;++u)if(E[u]!==c[u]){s=E[u],i=c[u];break}return s<i?-1:i<s?1:0},p.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},p.prototype.indexOf=function(e,t,n){return C(this,e,t,n,!0)},p.prototype.lastIndexOf=function(e,t,n){return C(this,e,t,n,!1)},p.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-t;if((void 0===n||o<n)&&(n=o),0<e.length&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s,i,a,E,c,u,p,l,d,S=!1;;)switch(r){case"hex":return f(this,e,t,n);case"utf8":case"utf-8":return l=t,d=n,b(w(e,(p=this).length-l),p,l,d);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return E=this,c=t,u=n,b(G(e),E,c,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i=t,a=n,b(function(e,t){for(var n,r,o,s=[],i=0;i<e.length&&!((t-=2)<0);++i)n=e.charCodeAt(i),r=n>>8,o=n%256,s.push(o),s.push(r);return s}(e,(s=this).length-i),s,i,a);default:if(S)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),S=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var R=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(127&e[o]);return r}function I(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;o<n;++o)r+=String.fromCharCode(e[o]);return r}function O(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||r<n)&&(n=r);for(var o="",s=t;s<n;++s)o+=Y(e[s]);return o}function N(e,t,n){for(var r=e.slice(t,n),o="",s=0;s<r.length;s+=2)o+=String.fromCharCode(r[s]+256*r[s+1]);return o}function m(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(n<e+t)throw new RangeError("Trying to access beyond buffer length")}function y(e,t,n,r,o,s){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(o<t||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function P(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,s=Math.min(e.length-n,2);o<s;++o)e[n+o]=(t&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function v(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,s=Math.min(e.length-n,4);o<s;++o)e[n+o]=t>>>8*(r?o:3-o)&255}function M(e,t,n,r,o,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,r,o){return o||M(e,0,n,4),s.write(e,t,n,r,23,4),n+4}function U(e,t,n,r,o){return o||M(e,0,n,8),s.write(e,t,n,r,52,8),n+8}p.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):r<e&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):r<t&&(t=r),t<e&&(t=e),p.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=p.prototype;else{var o=t-e;n=new p(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+e]}return n},p.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var r=this[e],o=1,s=0;++s<t&&(o*=256);)r+=this[e+s]*o;return r},p.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var r=this[e+--t],o=1;0<t&&(o*=256);)r+=this[e+--t]*o;return r},p.prototype.readUInt8=function(e,t){return t||m(e,1,this.length),this[e]},p.prototype.readUInt16LE=function(e,t){return t||m(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUInt16BE=function(e,t){return t||m(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUInt32LE=function(e,t){return t||m(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUInt32BE=function(e,t){return t||m(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var r=this[e],o=1,s=0;++s<t&&(o*=256);)r+=this[e+s]*o;return(o*=128)<=r&&(r-=Math.pow(2,8*t)),r},p.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var r=t,o=1,s=this[e+--r];0<r&&(o*=256);)s+=this[e+--r]*o;return(o*=128)<=s&&(s-=Math.pow(2,8*t)),s},p.prototype.readInt8=function(e,t){return t||m(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){t||m(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},p.prototype.readInt16BE=function(e,t){t||m(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},p.prototype.readInt32LE=function(e,t){return t||m(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return t||m(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readFloatLE=function(e,t){return t||m(e,4,this.length),s.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return t||m(e,4,this.length),s.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return t||m(e,8,this.length),s.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return t||m(e,8,this.length),s.read(this,e,!1,52,8)},p.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||y(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,s=0;for(this[t]=255&e;++s<n&&(o*=256);)this[t+s]=e/o&255;return t+n},p.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||y(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,s=1;for(this[t+o]=255&e;0<=--o&&(s*=256);)this[t+o]=e/s&255;return t+n},p.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,1,255,0),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},p.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):v(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):v(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);y(this,e,t,n,o-1,-o)}var s=0,i=1,a=0;for(this[t]=255&e;++s<n&&(i*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/i>>0)-a&255;return t+n},p.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);y(this,e,t,n,o-1,-o)}var s=n-1,i=1,a=0;for(this[t+s]=255&e;0<=--s&&(i*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/i>>0)-a&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):P(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):P(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):v(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||y(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):v(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),0<r&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var o,s=r-n;if(this===e&&n<t&&t<r)for(o=s-1;0<=o;--o)e[o+t]=this[o+n];else if(s<1e3||!p.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+t]=this[o+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},p.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!p.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var i=p.isBuffer(e)?e:w(new p(e,r).toString()),a=i.length;for(s=0;s<n-t;++s)this[s+t]=i[s%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function w(e,t){var n;t=t||1/0;for(var r=e.length,o=null,s=[],i=0;i<r;++i){if(55295<(n=e.charCodeAt(i))&&n<57344){if(!o){if(56319<n){-1<(t-=3)&&s.push(239,191,189);continue}if(i+1===r){-1<(t-=3)&&s.push(239,191,189);continue}o=n;continue}if(n<56320){-1<(t-=3)&&s.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&-1<(t-=3)&&s.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function G(e){return r.toByteArray(function(e){var t;if((e=(t=e,t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function b(e,t,n,r){for(var o=0;o<r&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(this,t(11))},function(e,t,n){"use strict";t.byteLength=function(e){var t=d(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){for(var t,n=d(e),r=n[0],o=n[1],s=new l((c=r,u=o,3*(c+u)/4-u)),i=0,a=0<o?r-4:r,E=0;E<a;E+=4)t=p[e.charCodeAt(E)]<<18|p[e.charCodeAt(E+1)]<<12|p[e.charCodeAt(E+2)]<<6|p[e.charCodeAt(E+3)],s[i++]=t>>16&255,s[i++]=t>>8&255,s[i++]=255&t;var c,u;2===o&&(t=p[e.charCodeAt(E)]<<2|p[e.charCodeAt(E+1)]>>4,s[i++]=255&t);1===o&&(t=p[e.charCodeAt(E)]<<10|p[e.charCodeAt(E+1)]<<4|p[e.charCodeAt(E+2)]>>2,s[i++]=t>>8&255,s[i++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,o=[],s=0,i=n-r;s<i;s+=16383)o.push(E(e,s,i<s+16383?i:s+16383));1===r?(t=e[n-1],o.push(a[t>>2]+a[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],o.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return o.join("")};for(var a=[],p=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,s=r.length;o<s;++o)a[o]=r[o],p[r.charCodeAt(o)]=o;function d(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function E(e,t,n){for(var r,o,s=[],i=t;i<n;i+=3)r=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),s.push(a[(o=r)>>18&63]+a[o>>12&63]+a[o>>6&63]+a[63&o]);return s.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,o){var s,i,a=8*o-r-1,E=(1<<a)-1,c=E>>1,u=-7,p=n?o-1:0,l=n?-1:1,d=e[t+p];for(p+=l,s=d&(1<<-u)-1,d>>=-u,u+=a;0<u;s=256*s+e[t+p],p+=l,u-=8);for(i=s&(1<<-u)-1,s>>=-u,u+=r;0<u;i=256*i+e[t+p],p+=l,u-=8);if(0===s)s=1-c;else{if(s===E)return i?NaN:1/0*(d?-1:1);i+=Math.pow(2,r),s-=c}return(d?-1:1)*i*Math.pow(2,s-r)},t.write=function(e,t,n,r,o,s){var i,a,E,c=8*s-o-1,u=(1<<c)-1,p=u>>1,l=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,S=r?1:-1,C=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(E=Math.pow(2,-i))<1&&(i--,E*=2),2<=(t+=1<=i+p?l/E:l*Math.pow(2,1-p))*E&&(i++,E/=2),u<=i+p?(a=0,i=u):1<=i+p?(a=(t*E-1)*Math.pow(2,o),i+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,o),i=0));8<=o;e[n+d]=255&a,d+=S,a/=256,o-=8);for(i=i<<o|a,c+=o;0<c;e[n+d]=255&i,d+=S,i/=256,c-=8);e[n+d-S]|=128*C}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},s=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function r(e){try{s(E.next(e))}catch(e){t(e)}}function o(e){try{s(E.throw(e))}catch(e){t(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(r,o)}s((E=E.apply(e,i||[])).next())})},u=this&&this.__generator||function(n,r){var o,s,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,s&&(i=2&t[0]?s.return:t[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,t[1])).done)return i;switch(s=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,s=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=r.call(n,a)}catch(e){t=[6,e],s=0}finally{o=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionsRequestBuilder=t.ReactionsRequest=void 0;var p=n(2),i=n(6),l=n(0),d=n(1),S=n(10),a=n(34),E=n(3),r=function(){function e(e){this.limit=d.DEFAULT_VALUES.REACTIONS_LIMIT,this.msgId=d.DEFAULT_VALUES.DEFAULT_MSG_ID,this.params={},this.inProgress=!1,this.paginationMeta={},this.endpointName="getReactionsList",e.reaction&&(this.reaction=e.reaction),e.limit&&(this.limit=e.limit),this.msgId=e.msgId}return e.prototype.getLimit=function(){return this.limit},e.prototype.getMessageId=function(){return this.msgId},e.prototype.getReaction=function(){return this.reaction},e.prototype.fetchNext=function(){var e=this;return new Promise(function(a,E){return s(e,void 0,void 0,function(){var t,n,r,o,s,i;return u(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,E(new p.CometChatException(S.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,E(new p.CometChatException(JSON.parse(l.format(JSON.stringify(d.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];t=c(((s={limit:this.limit})[d.MessageConstatnts.PAGINATION.KEYS.AFFIX]=d.MessageConstatnts.PAGINATION.AFFIX.APPEND,s),null!==(i=this.nextPage)&&void 0!==i?i:{}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall(t)];case 2:return n=e.sent(),a(n),this.inProgress=!1,[3,4];case 3:return r=e.sent(),this.inProgress=!1,E(new p.CometChatException(r)),[3,4];case 4:return[3,6];case 5:return o=e.sent(),this.inProgress=!1,E(new p.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(a,E){return s(e,void 0,void 0,function(){var t,n,r,o,s,i;return u(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return E(new p.CometChatException(S.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,E(new p.CometChatException(JSON.parse(l.format(JSON.stringify(d.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];t=c(((s={limit:this.limit})[d.MessageConstatnts.PAGINATION.KEYS.AFFIX]=d.MessageConstatnts.PAGINATION.AFFIX.PREPEND,s),null!==(i=this.previousPage)&&void 0!==i?i:{}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall(t)];case 2:return n=e.sent(),a(n),this.inProgress=!1,[3,4];case 3:return r=e.sent(),this.inProgress=!1,E(new p.CometChatException(r)),[3,4];case 4:return[3,6];case 5:return o=e.sent(),this.inProgress=!1,E(new p.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(n){var o=this;return new Promise(function(r,t){try{var e=o.limit;if(void 0===e)return void t(new p.CometChatException(JSON.parse(l.format(JSON.stringify(d.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(e))return void t(new p.CometChatException(JSON.parse(l.format(JSON.stringify(d.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(e>d.DEFAULT_VALUES.REACTIONS_MAX_LIMIT)return void t(new p.CometChatException(JSON.parse(l.format(JSON.stringify(d.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",d.DEFAULT_VALUES.REACTIONS_MAX_LIMIT))));if(e<d.DEFAULT_VALUES.ZERO)return void t(new p.CometChatException(JSON.parse(l.format(JSON.stringify(d.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));o.createEndpoint(),i.makeApiCall(o.endpointName,o.params,n).then(function(n){return s(o,void 0,void 0,function(){var t;return u(this,function(e){return this.paginationMeta=n.meta,n.meta&&n.meta.next&&(this.nextPage=n.meta.next),n.meta&&n.meta.previous&&(this.previousPage=n.meta.previous),t=[],0<n.data.length&&n.data.map(function(e){t.push(new a.Reaction(e.id,e.messageId,e.reaction,e.uid,e.reactedAt,new E.User(e.reactedBy)))}),r(t),[2]})})},function(e){t(new p.CometChatException(e.error))})}catch(e){t(new p.CometChatException(e))}})},e.prototype.createEndpoint=function(){l.isFalsy(this.reaction)?(this.endpointName="getReactionsList",this.params={messageId:this.msgId}):(this.endpointName="getFilteredReactionsList",this.params={messageId:this.msgId,reaction:this.reaction})},e}();t.ReactionsRequest=r;var o=function(){function e(){this.msgId=d.DEFAULT_VALUES.DEFAULT_MSG_ID}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=d.DEFAULT_VALUES.DEFAULT_MSG_ID),this.msgId=e,this},e.prototype.setReaction=function(e){return this.reaction=e,this},e.prototype.build=function(){return new r(this)},e}();t.ReactionsRequestBuilder=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationUpdateSettings=void 0;var s=n(1),r=function(){function o(){this.callActivities=!0,this.groupActions=!0,this.customMessages=!0,this.messageReplies=!0}return o.prototype.shouldUpdateOnCallActivities=function(){return this.callActivities},o.prototype.setCallActivities=function(e){this.callActivities=e},o.prototype.shouldUpdateOnGroupActions=function(){return this.groupActions},o.prototype.setGroupActions=function(e){this.groupActions=e},o.prototype.shouldUpdateOnCustomMessages=function(){return this.customMessages},o.prototype.setCustomMessages=function(e){this.customMessages=e},o.prototype.shouldUpdateOnMessageReplies=function(){return this.messageReplies},o.prototype.setMessageReplies=function(e){this.messageReplies=e},o.fromJSON=function(e){var t,n=new o,r=null!==(t=e[s.APP_SETTINGS.KEYS.PARAMETERS])&&void 0!==t?t:{};return n.setCallActivities(!!r.hasOwnProperty(s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES)&&r[s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES]),n.setGroupActions(!!r.hasOwnProperty(s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS)&&r[s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS]),n.setCustomMessages(!!r.hasOwnProperty(s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES)&&r[s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES]),n.setMessageReplies(!!r.hasOwnProperty(s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES)&&r[s.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES]),n},o}();t.ConversationUpdateSettings=r},function(e,t,n){var i=n(85),a=n(86);e.exports=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||i)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var s=0;s<16;++s)t[r+s]=o[s];return t||a(o)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var o=[],n=0;n<256;++n)o[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,r=o;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatNotifications=void 0;var u=n(1),p=n(0),l=n(2),d=n(6),S=n(14),r=n(49),C=n(88),o=n(89),h=n(90),f=n(91),_=n(92),T=n(93),s=n(94),i=function(){function E(){}return E.fetchPushPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_GET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,r=void 0,o=void 0;t=e.data.hasOwnProperty(S.APIConstants.KEY_GROUP_PREFERENCES)?C.GroupPreferences.fromJSON(e.data):new C.GroupPreferences,n=e.data.hasOwnProperty(S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?_.OneOnOnePreferences.fromJSON(e.data):new _.OneOnOnePreferences,r=e.data.hasOwnProperty(S.APIConstants.KEY_MUTE_PREFERENCES)?h.MutePreferences.fromJSON(e.data):new h.MutePreferences,o=!!e.data.hasOwnProperty(S.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var s=T.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:r,usePrivacyTemplate:o});return i(s)}return i(new T.PushPreferences)},function(e){return t(new l.CometChatException(e.error))})},function(e){return t(new l.CometChatException(e))})}catch(e){return t(new l.CometChatException(e))}})},E.fetchPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_GET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,r=void 0,o=void 0;t=e.data.hasOwnProperty(S.APIConstants.KEY_GROUP_PREFERENCES)?C.GroupPreferences.fromJSON(e.data):new C.GroupPreferences,n=e.data.hasOwnProperty(S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?_.OneOnOnePreferences.fromJSON(e.data):new _.OneOnOnePreferences,r=e.data.hasOwnProperty(S.APIConstants.KEY_MUTE_PREFERENCES)?h.MutePreferences.fromJSON(e.data):new h.MutePreferences,o=!!e.data.hasOwnProperty(S.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var s=f.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:r,usePrivacyTemplate:o});return i(s)}return i(new f.NotificationPreferences)},function(e){return t(new l.CometChatException(e.error))})},function(e){return t(new l.CometChatException(e))})}catch(e){return t(new l.CometChatException(e))}})},E.updatePushPreferences=function(c){return new Promise(function(a,E){try{p.getAppSettings().then(function(e){var t,n=((t={})[S.APIConstants.KEY_GROUP_PREFERENCES]={},t[S.APIConstants.KEY_MUTE_PREFERENCES]={},t[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},t),r=c.getGroupPreferences(),o=c.getMutePreferences(),s=c.getOneOnOnePreferences(),i=c.getUsePrivacyTemplate();r&&(r.getMessagesPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MESSAGES]=r.getMessagesPreference()),r.getReactionsPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_REACTIONS]=r.getReactionsPreference()),r.getRepliesPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_REPLIES]=r.getRepliesPreference()),r.getMemberAddedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_ADDED]=r.getMemberAddedPreference()),r.getMemberBannedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_BANNED]=r.getMemberBannedPreference()),r.getMemberJoinedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_JOINED]=r.getMemberJoinedPreference()),r.getMemberKickedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_KICKED]=r.getMemberKickedPreference()),r.getMemberLeftPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_LEFT]=r.getMemberLeftPreference()),r.getMemberScopeChangedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=r.getMemberScopeChangedPreference()),r.getMemberUnbannedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=r.getMemberUnbannedPreference())),o&&(o.getDNDPreference()&&(n[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_DND]=o.getDNDPreference()),o.getSchedulePreference()&&(n[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE]=o.getSchedulePreference())),s&&(s.getMessagesPreference()&&(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][S.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=s.getMessagesPreference()),s.getReactionsPreference()&&(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][S.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=s.getReactionsPreference()),s.getRepliesPreference()&&(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][S.APIConstants.KEY_ONE_ON_ONE_REPLIES]=s.getRepliesPreference())),null!=i&&(n[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=i),0===Object.keys(n[S.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete n[S.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(n[S.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete n[S.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],d.makeApiCall(S.APIConstants.KEY_UPDATE_PREFERENCES,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,r=void 0,o=void 0;t=e.data.hasOwnProperty(S.APIConstants.KEY_GROUP_PREFERENCES)?C.GroupPreferences.fromJSON(e.data):new C.GroupPreferences,n=e.data.hasOwnProperty(S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?_.OneOnOnePreferences.fromJSON(e.data):new _.OneOnOnePreferences,r=e.data.hasOwnProperty(S.APIConstants.KEY_MUTE_PREFERENCES)?h.MutePreferences.fromJSON(e.data):new h.MutePreferences,o=!!e.data.hasOwnProperty(S.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var s=T.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:r,usePrivacyTemplate:o});return a(s)}return a(new T.PushPreferences)},function(e){return E(new l.CometChatException(e.error))})},function(e){return E(new l.CometChatException(e))})}catch(e){return E(new l.CometChatException(e))}})},E.updatePreferences=function(c){return new Promise(function(a,E){try{p.getAppSettings().then(function(e){var t,n=((t={})[S.APIConstants.KEY_GROUP_PREFERENCES]={},t[S.APIConstants.KEY_MUTE_PREFERENCES]={},t[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},t),r=c.getGroupPreferences(),o=c.getMutePreferences(),s=c.getOneOnOnePreferences(),i=c.getUsePrivacyTemplate();r&&(r.getMessagesPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MESSAGES]=r.getMessagesPreference()),r.getReactionsPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_REACTIONS]=r.getReactionsPreference()),r.getRepliesPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_REPLIES]=r.getRepliesPreference()),r.getMemberAddedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_ADDED]=r.getMemberAddedPreference()),r.getMemberBannedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_BANNED]=r.getMemberBannedPreference()),r.getMemberJoinedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_JOINED]=r.getMemberJoinedPreference()),r.getMemberKickedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_KICKED]=r.getMemberKickedPreference()),r.getMemberLeftPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_LEFT]=r.getMemberLeftPreference()),r.getMemberScopeChangedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=r.getMemberScopeChangedPreference()),r.getMemberUnbannedPreference()&&(n[S.APIConstants.KEY_GROUP_PREFERENCES][S.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=r.getMemberUnbannedPreference())),o&&(o.getDNDPreference()&&(n[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_DND]=o.getDNDPreference()),o.getSchedulePreference()&&(n[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE]=o.getSchedulePreference())),s&&(s.getMessagesPreference()&&(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][S.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=s.getMessagesPreference()),s.getReactionsPreference()&&(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][S.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=s.getReactionsPreference()),s.getRepliesPreference()&&(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][S.APIConstants.KEY_ONE_ON_ONE_REPLIES]=s.getRepliesPreference())),null!=i&&(n[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=i),0===Object.keys(n[S.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete n[S.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(n[S.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete n[S.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete n[S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],d.makeApiCall(S.APIConstants.KEY_UPDATE_PREFERENCES,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,r=void 0,o=void 0;t=e.data.hasOwnProperty(S.APIConstants.KEY_GROUP_PREFERENCES)?C.GroupPreferences.fromJSON(e.data):new C.GroupPreferences,n=e.data.hasOwnProperty(S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?_.OneOnOnePreferences.fromJSON(e.data):new _.OneOnOnePreferences,r=e.data.hasOwnProperty(S.APIConstants.KEY_MUTE_PREFERENCES)?h.MutePreferences.fromJSON(e.data):new h.MutePreferences,o=!!e.data.hasOwnProperty(S.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var s=f.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:r,usePrivacyTemplate:o});return a(s)}return a(new f.NotificationPreferences)},function(e){return E(new l.CometChatException(e.error))})},function(e){return E(new l.CometChatException(e))})}catch(e){return E(new l.CometChatException(e))}})},E.resetPushPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_RESET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,r=void 0,o=void 0;t=e.data.hasOwnProperty(S.APIConstants.KEY_GROUP_PREFERENCES)?C.GroupPreferences.fromJSON(e.data):new C.GroupPreferences,n=e.data.hasOwnProperty(S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?_.OneOnOnePreferences.fromJSON(e.data):new _.OneOnOnePreferences,r=e.data.hasOwnProperty(S.APIConstants.KEY_MUTE_PREFERENCES)?h.MutePreferences.fromJSON(e.data):new h.MutePreferences,o=!!e.data.hasOwnProperty(S.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var s=T.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:r,usePrivacyTemplate:o});return i(s)}return i(new T.PushPreferences)},function(e){return t(new l.CometChatException(e.error))})},function(e){return t(new l.CometChatException(e))})}catch(e){return t(new l.CometChatException(e))}})},E.resetPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_RESET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,r=void 0,o=void 0;t=e.data.hasOwnProperty(S.APIConstants.KEY_GROUP_PREFERENCES)?C.GroupPreferences.fromJSON(e.data):new C.GroupPreferences,n=e.data.hasOwnProperty(S.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?_.OneOnOnePreferences.fromJSON(e.data):new _.OneOnOnePreferences,r=e.data.hasOwnProperty(S.APIConstants.KEY_MUTE_PREFERENCES)?h.MutePreferences.fromJSON(e.data):new h.MutePreferences,o=!!e.data.hasOwnProperty(S.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[S.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var s=f.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:r,usePrivacyTemplate:o});return i(s)}return i(new f.NotificationPreferences)},function(e){return t(new l.CometChatException(e.error))})},function(e){return t(new l.CometChatException(e))})}catch(e){return t(new l.CometChatException(e))}})},E.getTokensForRequest=function(e,t,n,r){var o={};return o[S.APIConstants.KEY_PROVIDER_ID]=null!=r?r:S.DEFAULT_PROVIDER_ID,o[S.APIConstants.KEY_TIMEZONE]=e,n===S.PushPlatforms.FCM_IONIC_CORDOVA_ANDROID&&(o[S.APIConstants.KEY_FCM_TOKEN]=t),n===S.PushPlatforms.FCM_IONIC_CORDOVA_IOS&&(o[S.APIConstants.KEY_FCM_TOKEN]=t),n===S.PushPlatforms.APNS_IONIC_CORDOVA_DEVICE&&(o[S.APIConstants.KEY_DEVICE_TOKEN]=t),n===S.PushPlatforms.APNS_IONIC_CORDOVA_VOIP&&(o[S.APIConstants.KEY_VOIP_TOKEN]=t),o[S.APIConstants.KEY_PLATFORM]=n,o},E.registerPushToken=function(s,i,a){return new Promise(function(r,o){try{p.getAppSettings().then(function(e){var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=E.getTokensForRequest(t,s,i,a);d.makeApiCall(S.APIConstants.KEY_REGISTER_TOKEN,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?r(S.APIResponseConstants.TOKEN_REGISTER_SUCCESS):r(S.APIResponseConstants.TOKEN_REGISTER_ERROR)},function(e){return o(new l.CometChatException(e.error))})},function(e){return o(new l.CometChatException(e))})}catch(e){return o(new l.CometChatException(e))}})},E.unregisterPushToken=function(){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_UNREGISTER_TOKEN,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(S.APIResponseConstants.TOKEN_UNREGISTER_SUCCESS):t(S.APIResponseConstants.TOKEN_UNREGISTER_ERROR)},function(e){return n(new l.CometChatException(e.error))})},function(e){return n(new l.CometChatException(e))})}catch(e){return n(new l.CometChatException(e))}})},E.muteConversations=function(s){return new Promise(function(r,o){try{p.getAppSettings().then(function(e){var t,n=((t={})[S.APIConstants.KEY_CONVERSATIONS]=s,t);d.makeApiCall(S.APIConstants.KEY_MUTE_CONVERSATIONS,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?r(S.APIResponseConstants.MUTE_CONVERSATION_SUCCESS):r(S.APIResponseConstants.MUTE_CONVERSATION_ERROR)},function(e){return o(new l.CometChatException(e.error))})},function(e){return o(new l.CometChatException(e))})}catch(e){return o(new l.CometChatException(e))}})},E.unmuteConversations=function(s){return new Promise(function(r,o){try{p.getAppSettings().then(function(e){var t,n=((t={})[S.APIConstants.KEY_CONVERSATIONS]=s,t);d.makeApiCall(S.APIConstants.KEY_UNMUTE_CONVERSATIONS,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?r(S.APIResponseConstants.UNMUTE_CONVERSATION_SUCCESS):r(S.APIResponseConstants.UNMUTE_CONVERSATION_ERROR)},function(e){return o(new l.CometChatException(e.error))})},function(e){return o(new l.CometChatException(e))})}catch(e){return o(new l.CometChatException(e))}})},E.getMutedConversations=function(){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_GET_MUTED_CONVERSATIONS,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){var n=[];return e.hasOwnProperty("data")&&e.data.hasOwnProperty(S.APIConstants.KEY_MUTED_CONVERSATIONS)&&e.data[S.APIConstants.KEY_MUTED_CONVERSATIONS].forEach(function(e){var t=new o.MutedConversation;t.setId(e.id),t.setType(e.type),t.setUntil(e.until),n.push(t)}),t(n)},function(e){return n(new l.CometChatException(e.error))})},function(e){return n(new l.CometChatException(e))})}catch(e){return n(new l.CometChatException(e))}})},E.updateTimezone=function(r){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_UPDATE_TIMEZONE,null,{timezone:r},!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(S.APIResponseConstants.TIMEZONE_UPDATE_SUCCESS):t(S.APIResponseConstants.TIMEZONE_UPDATE_ERROR)},function(e){return n(new l.CometChatException(e.error))})},function(e){return n(new l.CometChatException(e))})}catch(e){return n(new l.CometChatException(e))}})},E.getTimezone=function(){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){d.makeApiCall(S.APIConstants.KEY_GET_TIMEZONE,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(e.data):t(S.APIResponseConstants.TIMEZONE_FETCH_ERROR)},function(e){return n(new l.CometChatException(e.error))})},function(e){return n(new l.CometChatException(e))})}catch(e){return n(new l.CometChatException(e))}})},E.MessagesOptions=S.MessagesOptions,E.RepliesOptions=S.RepliesOptions,E.ReactionsOptions=S.ReactionsOptions,E.MemberActionsOptions=S.MemberActionsOptions,E.DayOfWeek=S.DayOfWeek,E.DNDOptions=S.DNDOptions,E.MutedConversationType=S.MutedConversationType,E.PushPlatforms=S.PushPlatforms,E.DaySchedule=r.DaySchedule,E.PushPreferences=T.PushPreferences,E.GroupPreferences=C.GroupPreferences,E.OneOnOnePreferences=_.OneOnOnePreferences,E.MutePreferences=h.MutePreferences,E.MutedConversation=o.MutedConversation,E.UnmutedConversation=s.UnmutedConversation,E.NotificationPreferences=f.NotificationPreferences,E}();t.CometChatNotifications=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupPreferences=void 0;var r=n(14),o=function(){function n(){}return n.prototype.getMessagesPreference=function(){return this.groupMessages},n.prototype.getRepliesPreference=function(){return this.groupReplies},n.prototype.getReactionsPreference=function(){return this.groupReactions},n.prototype.getMemberLeftPreference=function(){return this.groupMemberLeft},n.prototype.getMemberAddedPreference=function(){return this.groupMemberAdded},n.prototype.getMemberJoinedPreference=function(){return this.groupMemberJoined},n.prototype.getMemberKickedPreference=function(){return this.groupMemberKicked},n.prototype.getMemberBannedPreference=function(){return this.groupMemberBanned},n.prototype.getMemberUnbannedPreference=function(){return this.groupMemberUnbanned},n.prototype.getMemberScopeChangedPreference=function(){return this.groupMemberScopeChanged},n.prototype.setMessagesPreference=function(e){this.groupMessages=e},n.prototype.setRepliesPreference=function(e){this.groupReplies=e},n.prototype.setReactionsPreference=function(e){this.groupReactions=e},n.prototype.setMemberLeftPreference=function(e){this.groupMemberLeft=e},n.prototype.setMemberAddedPreference=function(e){this.groupMemberAdded=e},n.prototype.setMemberJoinedPreference=function(e){this.groupMemberJoined=e},n.prototype.setMemberKickedPreference=function(e){this.groupMemberKicked=e},n.prototype.setMemberBannedPreference=function(e){this.groupMemberBanned=e},n.prototype.setMemberUnbannedPreference=function(e){this.groupMemberUnbanned=e},n.prototype.setMemberScopeChangedPreference=function(e){this.groupMemberScopeChanged=e},n.fromJSON=function(e){var t=new n;return t.setMessagesPreference(r.MessagesOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MESSAGES]]),t.setRepliesPreference(r.RepliesOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_REPLIES]]),t.setReactionsPreference(r.ReactionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_REACTIONS]]),t.setMemberAddedPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_ADDED]]),t.setMemberJoinedPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_JOINED]]),t.setMemberBannedPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_BANNED]]),t.setMemberKickedPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_KICKED]]),t.setMemberLeftPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_LEFT]]),t.setMemberScopeChangedPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]]),t.setMemberUnbannedPreference(r.MemberActionsOptions[e[r.APIConstants.KEY_GROUP_PREFERENCES][r.APIConstants.KEY_GROUP_MEMBER_UNBANNED]]),t},n}();t.GroupPreferences=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutedConversation=void 0;var r=function(){function e(){}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getUntil=function(){return this.until},e.prototype.setUntil=function(e){this.until=e},e}();t.MutedConversation=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutePreferences=void 0;var p=n(14),l=n(49),r=function(){function u(){}return u.prototype.getDNDPreference=function(){return this.dnd},u.prototype.setDNDPreference=function(e){this.dnd=e},u.prototype.getSchedulePreference=function(){return this.schedule},u.prototype.setSchedulePreference=function(e){this.schedule=e},u.prototype.getScheduleFor=function(e){return this.schedule.get(e)},u.prototype.setScheduleFor=function(e,t){this.schedule.set(e,t)},u.fromJSON=function(e){var t=new u;t.setDNDPreference(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_DND]);var n=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.MONDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.MONDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.MONDAY][p.APIConstants.KEY_MUTE_DND]),r=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.TUESDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.TUESDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.TUESDAY][p.APIConstants.KEY_MUTE_DND]),o=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.WEDNESDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.WEDNESDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.WEDNESDAY][p.APIConstants.KEY_MUTE_DND]),s=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.THURSDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.THURSDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.THURSDAY][p.APIConstants.KEY_MUTE_DND]),i=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.FRIDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.FRIDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.FRIDAY][p.APIConstants.KEY_MUTE_DND]),a=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SATURDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SATURDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SATURDAY][p.APIConstants.KEY_MUTE_DND]),E=new l.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SUNDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SUNDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SUNDAY][p.APIConstants.KEY_MUTE_DND]),c=new Map([[p.DayOfWeek.MONDAY,n],[p.DayOfWeek.TUESDAY,r],[p.DayOfWeek.WEDNESDAY,o],[p.DayOfWeek.THURSDAY,s],[p.DayOfWeek.FRIDAY,i],[p.DayOfWeek.SATURDAY,a],[p.DayOfWeek.SUNDAY,E]]);return t.setSchedulePreference(c),t},u}();t.MutePreferences=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationPreferences=void 0;var r=n(14),o=function(){function n(){}return n.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},n.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},n.prototype.getMutePreferences=function(){return this.mutePreferences},n.prototype.setMutePreferences=function(e){this.mutePreferences=e},n.prototype.getGroupPreferences=function(){return this.groupPreferences},n.prototype.setGroupPreferences=function(e){this.groupPreferences=e},n.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},n.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},n.fromJSON=function(e){var t=new n;return e.hasOwnProperty(r.APIConstants.KEY_MUTE_PREFERENCES)&&t.setMutePreferences(e[r.APIConstants.KEY_MUTE_PREFERENCES]),e.hasOwnProperty(r.APIConstants.KEY_GROUP_PREFERENCES)&&t.setGroupPreferences(e[r.APIConstants.KEY_GROUP_PREFERENCES]),e.hasOwnProperty(r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&t.setOneOnOnePreferences(e[r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),e.hasOwnProperty(r.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.setUsePrivacyTemplate(e[r.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),t},n}();t.NotificationPreferences=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OneOnOnePreferences=void 0;var r=n(14),o=function(){function n(){}return n.prototype.getReactionsPreference=function(){return this.oneOnOneMessageReactions},n.prototype.setReactionsPreference=function(e){this.oneOnOneMessageReactions=e},n.prototype.getRepliesPreference=function(){return this.oneOnOneReplies},n.prototype.setRepliesPreference=function(e){this.oneOnOneReplies=e},n.prototype.getMessagesPreference=function(){return this.oneOnOneMessages},n.prototype.setMessagesPreference=function(e){this.oneOnOneMessages=e},n.fromJSON=function(e){var t=new n;return t.setMessagesPreference(r.MessagesOptions[e[r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][r.APIConstants.KEY_ONE_ON_ONE_MESSAGES]]),t.setRepliesPreference(r.RepliesOptions[e[r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][r.APIConstants.KEY_ONE_ON_ONE_REPLIES]]),t.setReactionsPreference(r.ReactionsOptions[e[r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][r.APIConstants.KEY_ONE_ON_ONE_REACTIONS]]),t},n}();t.OneOnOnePreferences=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PushPreferences=void 0;var r=n(14),o=function(){function n(){}return n.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},n.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},n.prototype.getMutePreferences=function(){return this.mutePreferences},n.prototype.setMutePreferences=function(e){this.mutePreferences=e},n.prototype.getGroupPreferences=function(){return this.groupPreferences},n.prototype.setGroupPreferences=function(e){this.groupPreferences=e},n.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},n.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},n.fromJSON=function(e){var t=new n;return e.hasOwnProperty(r.APIConstants.KEY_MUTE_PREFERENCES)&&t.setMutePreferences(e[r.APIConstants.KEY_MUTE_PREFERENCES]),e.hasOwnProperty(r.APIConstants.KEY_GROUP_PREFERENCES)&&t.setGroupPreferences(e[r.APIConstants.KEY_GROUP_PREFERENCES]),e.hasOwnProperty(r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&t.setOneOnOnePreferences(e[r.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),e.hasOwnProperty(r.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.setUsePrivacyTemplate(e[r.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),t},n}();t.PushPreferences=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnmutedConversation=void 0;var r=function(){function e(){}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e}();t.UnmutedConversation=r}])}),function(){try{require("@capacitor/app")&&(window.CapacitorApp={},window.CapacitorApp.isApp=!0,window.CapacitorApp.App=require("@capacitor/app")),require("@cometchat/calls-sdk-ionic")&&(window.CometChatCallSDK=require("@cometchat/calls-sdk-ionic/package.json"),window.CometChatCalling={},window.CometChatCalling.isCallingComponentInstalled=!0,window.CometChatCalling.Calling=require("@cometchat/calls-sdk-ionic").Calling)}catch(e){}}();