@cometchat/chat-sdk-javascript 4.0.0-beta1 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/dist/CometChat.js +1 -1
  2. package/dist/index.d.ts +41 -0
  3. package/dist/type/lib/CometChat.d.ts +21 -0
  4. package/dist/type/lib/Constants.d.ts +20 -0
  5. package/dist/type/lib/Helper.d.ts +1 -0
  6. package/dist/type/lib/models/UserModel.d.ts +2 -0
  7. package/package.json +1 -1
  8. package/dist/.DS_Store +0 -0
  9. package/dist/javascript-chat-sdk/.git/COMMIT_EDITMSG +0 -1
  10. package/dist/javascript-chat-sdk/.git/FETCH_HEAD +0 -4
  11. package/dist/javascript-chat-sdk/.git/HEAD +0 -1
  12. package/dist/javascript-chat-sdk/.git/ORIG_HEAD +0 -1
  13. package/dist/javascript-chat-sdk/.git/config +0 -19
  14. package/dist/javascript-chat-sdk/.git/description +0 -1
  15. package/dist/javascript-chat-sdk/.git/hooks/applypatch-msg.sample +0 -15
  16. package/dist/javascript-chat-sdk/.git/hooks/commit-msg.sample +0 -24
  17. package/dist/javascript-chat-sdk/.git/hooks/fsmonitor-watchman.sample +0 -174
  18. package/dist/javascript-chat-sdk/.git/hooks/post-update.sample +0 -8
  19. package/dist/javascript-chat-sdk/.git/hooks/pre-applypatch.sample +0 -14
  20. package/dist/javascript-chat-sdk/.git/hooks/pre-commit.sample +0 -49
  21. package/dist/javascript-chat-sdk/.git/hooks/pre-merge-commit.sample +0 -13
  22. package/dist/javascript-chat-sdk/.git/hooks/pre-push.sample +0 -53
  23. package/dist/javascript-chat-sdk/.git/hooks/pre-rebase.sample +0 -169
  24. package/dist/javascript-chat-sdk/.git/hooks/pre-receive.sample +0 -24
  25. package/dist/javascript-chat-sdk/.git/hooks/prepare-commit-msg.sample +0 -42
  26. package/dist/javascript-chat-sdk/.git/hooks/push-to-checkout.sample +0 -78
  27. package/dist/javascript-chat-sdk/.git/hooks/update.sample +0 -128
  28. package/dist/javascript-chat-sdk/.git/index +0 -0
  29. package/dist/javascript-chat-sdk/.git/info/exclude +0 -6
  30. package/dist/javascript-chat-sdk/.git/logs/HEAD +0 -13
  31. package/dist/javascript-chat-sdk/.git/logs/refs/heads/master +0 -1
  32. package/dist/javascript-chat-sdk/.git/logs/refs/heads/master-v3 +0 -3
  33. package/dist/javascript-chat-sdk/.git/logs/refs/heads/master-v4 +0 -4
  34. package/dist/javascript-chat-sdk/.git/logs/refs/remotes/origin/HEAD +0 -1
  35. package/dist/javascript-chat-sdk/.git/logs/refs/remotes/origin/master-v3 +0 -2
  36. package/dist/javascript-chat-sdk/.git/logs/refs/remotes/origin/master-v4 +0 -2
  37. package/dist/javascript-chat-sdk/.git/logs/refs/stash +0 -1
  38. package/dist/javascript-chat-sdk/.git/objects/09/b9e17d9a0acd55c3644f4cfa19b1c40a139018 +0 -0
  39. package/dist/javascript-chat-sdk/.git/objects/0f/2d8999b370e8ddb236f767aa565b2aa72a6b21 +0 -0
  40. package/dist/javascript-chat-sdk/.git/objects/15/7f5161e31be14c74df7907c9c5046fbbea4461 +0 -0
  41. package/dist/javascript-chat-sdk/.git/objects/17/89200f3f5621f9df6d08d1071c59557ce5a29d +0 -0
  42. package/dist/javascript-chat-sdk/.git/objects/26/1de108a0253f54cf37e8a072f7f5f0098c7e89 +0 -4
  43. package/dist/javascript-chat-sdk/.git/objects/43/7ffc94a259dcd818cca308ab60a2780714092d +0 -1
  44. package/dist/javascript-chat-sdk/.git/objects/4e/6ab6a981ea6dccdb60b6438d7ca142aef269fc +0 -0
  45. package/dist/javascript-chat-sdk/.git/objects/5e/04a3d79cebcc2b02c14ea807f839ea73d44461 +0 -0
  46. package/dist/javascript-chat-sdk/.git/objects/65/bbff4d1cccc12285ea1c59a6f2082552f0d034 +0 -0
  47. package/dist/javascript-chat-sdk/.git/objects/6a/a6ef178cb2e3775bb149aba99ace8399525da6 +0 -0
  48. package/dist/javascript-chat-sdk/.git/objects/6b/e1ffe406de9ebb698ea891315b2b1459160029 +0 -0
  49. package/dist/javascript-chat-sdk/.git/objects/6b/efb8e9de892be7ecee5d39c30c0aa17d43d727 +0 -2
  50. package/dist/javascript-chat-sdk/.git/objects/6e/f136ca41bbb5684639947fa121b7eebb795592 +0 -0
  51. package/dist/javascript-chat-sdk/.git/objects/87/96f6311621c3ee4fc8d37eeec64a6c94e3e6ca +0 -0
  52. package/dist/javascript-chat-sdk/.git/objects/8b/2d226d44814b7265b68ab7953a87cd44d77965 +0 -0
  53. package/dist/javascript-chat-sdk/.git/objects/9c/bc4afb06153fd276e240e709984bf1099386ba +0 -0
  54. package/dist/javascript-chat-sdk/.git/objects/a9/6c6710dfb57871b6eccda3a94d83990ba94d9f +0 -0
  55. package/dist/javascript-chat-sdk/.git/objects/ad/1b70a4bb12b3fe2e6306d2b0922582036f4e42 +0 -0
  56. package/dist/javascript-chat-sdk/.git/objects/c1/655387f263ec50dbef8042099eead57dfe00c2 +0 -0
  57. package/dist/javascript-chat-sdk/.git/objects/e0/ad85d968302e5447402ed4d0bc8ace931b9167 +0 -0
  58. package/dist/javascript-chat-sdk/.git/objects/e8/0b03094191c92690d5bb92b4271058f188efd1 +0 -1
  59. package/dist/javascript-chat-sdk/.git/objects/f0/cc86624ec0504ed24dcd6a7b2cdee917b73395 +0 -2
  60. package/dist/javascript-chat-sdk/.git/objects/f9/95e0e3dc98868eb6404f8cdd84632ae140e1ff +0 -2
  61. package/dist/javascript-chat-sdk/.git/objects/fb/d9b82e03d33337a8d2606fc9e2f1652ffda3de +0 -0
  62. package/dist/javascript-chat-sdk/.git/objects/pack/pack-efd6261f29a0c404693064c4a255aada38ddab72.idx +0 -0
  63. package/dist/javascript-chat-sdk/.git/objects/pack/pack-efd6261f29a0c404693064c4a255aada38ddab72.pack +0 -0
  64. package/dist/javascript-chat-sdk/.git/packed-refs +0 -107
  65. package/dist/javascript-chat-sdk/.git/refs/heads/master +0 -1
  66. package/dist/javascript-chat-sdk/.git/refs/heads/master-v3 +0 -1
  67. package/dist/javascript-chat-sdk/.git/refs/heads/master-v4 +0 -1
  68. package/dist/javascript-chat-sdk/.git/refs/remotes/origin/HEAD +0 -1
  69. package/dist/javascript-chat-sdk/.git/refs/remotes/origin/master-v3 +0 -1
  70. package/dist/javascript-chat-sdk/.git/refs/remotes/origin/master-v4 +0 -1
  71. package/dist/javascript-chat-sdk/.git/refs/stash +0 -1
  72. package/dist/javascript-chat-sdk/.gitignore +0 -2
  73. package/dist/javascript-chat-sdk/CometChat.d.ts +0 -4732
  74. package/dist/javascript-chat-sdk/CometChat.js +0 -1
  75. package/dist/javascript-chat-sdk/LICENSE.md +0 -3
  76. package/dist/javascript-chat-sdk/README.md +0 -189
  77. package/dist/javascript-chat-sdk/package.json +0 -36
@@ -1 +0,0 @@
1
- !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,function(){return function(n){var o={};function s(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,s),e.l=!0,e.exports}return s.m=n,s.c=o,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)s.d(n,o,function(t){return e[t]}.bind(null,o));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=38)}([function(t,e,n){"use strict";e.__esModule=!0,e.validateConversationType=e.validateUpdateUser=e.validateCreateUser=e.validateMessage=e.validateChatType=e.validateMsgId=e.validateArray=e.validateHideMessagesFromBlockedUsers=e.validateId=e.validateCreateGroup=e.validateJoinGroup=e.validateUpdateGroup=e.validateScope=e.isAudio=e.isVideo=e.isImage=e.getUpdatedSettings=e.getAppSettings=e.getCurrentTime=e.Logger=e.createUidFromJid=e.format=e.getOrdinalSuffix=e.isFalsy=e.isTruthy=e.isObject=e.getJidHost=e.getChatHost=void 0;var o=n(14),i=n(1),s=n(6),a=n(2),E=n(16),c=n(17),u=n(19),r=n(3),S=n(13);function l(t){return null!=t&&("string"==typeof t&&(t=t.trim()),"object"==typeof t&&0===Object.keys(t).length&&(t=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(t)}function p(t){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return t.split("%s").reduce(function(t,e,n){return t+e+(o[n]||"")},"")}e.getChatHost=function(t){return t[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?t[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:t[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?t[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:t[i.APP_SETTINGS.KEYS.CHAT_HOST]},e.getJidHost=function(t){return t[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?t[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:t[i.APP_SETTINGS.KEYS.CHAT_HOST]},e.isObject=function(t){return t instanceof Object&&t.constructor===Object},e.isTruthy=function(t){return[!0,1,"1","true","TRUE"].includes(t)},e.isFalsy=l,e.getOrdinalSuffix=function(t){var e=t%10,n=t%100;return 1==e&&11!=n?t+"st":2==e&&12!=n?t+"nd":3==e&&13!=n?t+"rd":t+"th"},e.format=p,e.createUidFromJid=function(t){return t.substring(t.lastIndexOf("]")+1,t.lastIndexOf("@"))};var C=function(){function t(){}return t.log=function(t,e){},t.error=function(t,e){},t.info=function(t,e){},t}();function T(){return new Promise(function(e,n){s.makeApiCall("appSettings").then(function(t){o.LocalStorage.getInstance().set(i.LOCAL_STORE.KEY_APP_SETTINGS,t.data),t.data.MODE&&r.CometChat.setMode(t.data.MODE),e(t.data)},function(t){n(new a.CometChatException(t.error))})})}e.Logger=C,e.getCurrentTime=function(){return(new Date).getTime()},e.getAppSettings=function(){return new Promise(function(e,n){o.LocalStorage.getInstance().get(i.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){l(t)?T().then(function(t){e(t)},function(t){n(t)}):e(t)},function(t){n(t)})})},e.getUpdatedSettings=T,e.isImage=function(t){var e;return t.type&&t.type.toLowerCase().includes("image")&&(e=!0),e},e.isVideo=function(t){var e;return t.type&&t.type.toLowerCase().includes("video")&&(e=!0),e},e.isAudio=function(t){var e;return t.type&&t.type.toLowerCase().includes("audio")&&(e=!0),e},e.validateScope=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):l(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):t!=r.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&t!=r.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&t!=r.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new a.CometChatException(i.GroupErrors.INVALID_SCOPE):void 0},e.validateUpdateGroup=function(t){return t.hasOwnProperty(i.GroupConstants.KEYS.GUID)?typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):l(t[i.GroupConstants.KEYS.GUID])?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):t.hasOwnProperty(i.GroupConstants.KEYS.NAME)&&""===t[i.GroupConstants.KEYS.NAME]?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},e.validateJoinGroup=function(t,e,n){if(typeof t==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!t.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(t[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(e))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e.toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&e.toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&e.toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&e.toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e.toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(n))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},e.validateCreateGroup=function(t){if(!t.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.NAME))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof t[i.GroupConstants.KEYS.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(l(t[i.GroupConstants.KEYS.NAME]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(t[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(t.hasOwnProperty(i.GroupConstants.KEYS.TAGS)){if(!Array.isArray(t[i.GroupConstants.KEYS.TAGS]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===t[i.GroupConstants.KEYS.TAGS].length)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},e.validateId=function(t,e){if("user"===e){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(t))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===e){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}},e.validateHideMessagesFromBlockedUsers=function(t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},e.validateArray=function(t,e){var n="List should be an array.";return n="blockUsers"===e?"blockUsers() method accepts an array of users.":"unblockUsers"===e?"unblockUsers() method accepts an array of users.":"groupMembers"===e?"addMembersToGroup() method accepts members list as an array of users.":"addMembersToGroup() method accepts bannedMembers list as an array of users.",typeof t!=i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(t)?void 0:new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},e.validateMsgId=function(t){return isNaN(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):l(t)?new a.CometChatException(S.ERRORS.PARAMETER_MISSING):void 0},e.validateChatType=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):l(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):t!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&t!=i.MessageConstatnts.RECEIVER_TYPE.USER?new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE):void 0},e.validateMessage=function(t){var e=t;if(typeof e.getReceiverId()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(l(e.getReceiverId()))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof e.getReceiverType()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(l(e.getReceiverType()))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(e.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&e.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.USER)return new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE);if(t instanceof E.TextMessage){var n=t;if(typeof n.getText()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(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(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(t instanceof c.MediaMessage){var o=t;if(o.getData()&&o.getData().hasOwnProperty("attachments"))for(var s=o.getAttachments(),r=0;r<s.length;r++){if(!s[r].getExtension())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!s[r].getMimeType())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!s[r].getName())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!s[r].getUrl())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(o.hasOwnProperty("files"))for(r=0;r<o.files.length;r++)if(!(o.files[r]instanceof Blob))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}if(t instanceof u.CustomMessage&&l(t.getCustomData()))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")))},e.validateCreateUser=function(t){if(!t.hasOwnProperty(i.UserConstants.UID))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof t[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(t[i.UserConstants.UID]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!t.hasOwnProperty(i.UserConstants.NAME))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof t[i.UserConstants.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(l(t[i.UserConstants.NAME]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(t.hasOwnProperty(i.UserConstants.AVATAR)&&""===t[i.UserConstants.AVATAR])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(t.hasOwnProperty(i.UserConstants.META_DATA)&&""===t[i.UserConstants.META_DATA])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(t.hasOwnProperty(i.UserConstants.LINK)&&""===t[i.UserConstants.LINK])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(t.hasOwnProperty(i.UserConstants.STATUS_MESSAGE)&&""===t[i.UserConstants.STATUS_MESSAGE])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(t.hasOwnProperty(i.UserConstants.ROLE)&&""===t[i.UserConstants.ROLE])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(t.hasOwnProperty(i.UserConstants.TAGS)){if(!Array.isArray(t[i.UserConstants.TAGS]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===t[i.UserConstants.TAGS].length)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},e.validateUpdateUser=function(t){return t.hasOwnProperty(i.UserConstants.UID)?typeof t[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):l(t[i.UserConstants.UID])?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):t.hasOwnProperty(i.UserConstants.NAME)&&""===t[i.UserConstants.NAME]?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},e.validateConversationType=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):l(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(t=t.toLowerCase())!=r.CometChat.RECEIVER_TYPE.USER&&t!=r.CometChat.RECEIVER_TYPE.GROUP?new a.CometChatException(i.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0}},function(t,e,n){"use strict";e.__esModule=!0,e.ONLINE_MEMBER_COUNT_API=e.JWT_API=e.ProsodyApiErrors=e.PROSODY_API=e.API_ERROR_CODES=e.SESSION_STORE=e.CONNECTION_STATUS=e.COMMON_UTILITY_CONSTANTS=e.APP_SETTINGS=e.PresenceConstatnts=e.FeatureRestrictionErrors=e.MessageErrors=e.ExtensionErrors=e.ConversationErrors=e.GroupErrors=e.UserErrors=e.ReceiptErrors=e.GENERAL_ERROR=e.PARAMETER_ERROR=e.CALL_ERROR=e.Errors=e.UserConstants=e.GroupMemersConstans=e.GroupConstants=e.CallConstants=e.BlockedUsersConstants=e.ActionConstatnts=e.TYPING_NOTIFICATION=e.MessageCategory=e.ATTACHMENTS_CONSTANTS=e.MessageConstatnts=e.READ_RECEIPTS=e.DELIVERY_RECEIPTS=e.ResponseConstants=e.LOCAL_STORE=e.ANALYTICS=e.WS=e.SDKHeader=e.APPINFO=e.GROUP_MEMBER_SCOPE=e.GroupMemberScope=e.GROUP_TYPE=e.GroupType=e.CALLING_COMPONENT_VERSION=e.DEFAULT_VALUES=e.constants=void 0;var o,s,r,i=n(2);e.constants={DEFAULT_STORE:"cometchat",MSG_VER_PRE:"store-ver-pre",MSG_VER_POST:"store-ver-post"},e.DEFAULT_VALUES={ZERO:0,MSGS_LIMIT:30,MSGS_MAX_LIMIT:100,USERS_LIMIT:30,USERS_MAX_LIMIT:100,GROUPS_LIMIT:30,GROUPS_MAX_LIMIT:100,CONVERSATION_MAX_LIMIT:50,CALL_TIMEOUT:45,DEFAULT_MSG_ID:0,DEFAULT_MAX_TYPING_INDICATOR_LIMIT:5,REGION_DEFAULT:"eu",REGION_DEFAULT_EU:"eu",REGION_DEFAULT_US:"us",REGION_DEFAULT_IN:"in",REGION_DEFAULT_PRIVATE:"private"},e.CALLING_COMPONENT_VERSION=5,(o=e.GroupType||(e.GroupType={})).Public="public",o.Private="private",o.Protected="protected",o.Password="password",e.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(s=e.GroupMemberScope||(e.GroupMemberScope={})).Admin="admin",s.Moderator="moderator",s.Member="member",e.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},e.APPINFO={platform:"WEB",sdkVersion:"v4.0.0",apiVersion:"v3.0",sdkVersionWithUnderScore:"4_0_0"},e.SDKHeader={platform:"javascript",sdkVersion:"4.0.0",sdk:"%s@%s"},e.WS={CONVERSATION:{TYPE:{CHAT:"chat",GROUP_CHAT:"groupchat"}}},e.ANALYTICS={analyticsHost:"metrics-%s.cometchat.io",analyticsVersion:"v1"},e.LOCAL_STORE={COMMON_STORE:"common_store",MESSAGE_LISTENERS_LIST:"message_listeners_list",USERS_STORE:"users_store",MESSAGES_STORE:"messages_store",KEYS_STORE:"keys_store",STORE_STRING:"%s:%s",KEY_STRING:"%s/%s",KEY_USER:"user",KEY_APP_SETTINGS:"app_settings",KEY_APP_ID:"appId",KEY_DEVICE_ID:"deviceId",KEY_MESSAGE_LISTENER_LIST:"all"},e.ResponseConstants={RESPONSE_KEYS:{KEY_DATA:"data",KEY_META:"meta",KEY_CURSOR:"cursor",KEY_ACTION:"action",KEY_MESSAGE:"message",KEY_ERROR:"error",KEY_ERROR_DETAILS:"details",KEY_ERROR_CODE:"code",KEY_ERROR_MESSAGE:"message",KEY_AUTH_TOKEN:"authToken",KEY_WS_CHANNEL:"wsChannel",KEY_IDENTITY:"identity",KEY_SERVICE:"identity",KEY_ENTITIES:"entities",KEY_ENTITITY:"entity",KEY_ENTITYTYPE:"entityType",KEY_ATTACHMENTS:"attachments",CODE_REQUEST_OK:200,CODE_BAD_REQUEST:401,UNREAD_UNDELIVERED_KEYS:{ENTITY:"entity",ENTITY_TYPE:"entityType",ENTITY_Id:"entityId",COUNT:"count"},GROUP_MEMBERS_RESPONSE:{SUCCESS:"success",ERROR:"error",MESSAGE:"message"},KEY_ENTITY_TYPE:{USER:"user",GROUP:"group"}}},e.DELIVERY_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",RECEIVED:"delivered",DELIVERED_AT:"deliveredAt",ID:"id",TIME:"time",DELIVERED_TO_ME_AT:"deliveredToMeAt"},e.READ_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",READ:"read",READ_AT:"readAt",ID:"id",TIME:"time",READ_BY_ME_AT:"readByMeAt"},e.MessageConstatnts={TYPE:{TEXT:"text",MEDIA:"media",IMAGE:"image",VIDEO:"video",AUDIO:"audio",FILE:"file",CUSTOM:"custom"},CATEGORY:{MESSAGE:"message",ACTION:"action",CALL:"call",CUSTOM:"custom"},RECEIVER_TYPE:{USER:"user",GROUP:"group"},KEYS:{ATTATCHMENT:"attatchment",ATTATCHMENTS:"attachments",ACTION:"action",TYPE:"type",DATA:"data",ID:"id",MUID:"muid",SENDER:"sender",RECEIVER:"receiver",RECEIVER_ID:"receiverId",CATEGORY:"category",RECEIVER_TYPE:"receiverType",SENT_AT:"sentAt",STATUS:"status",TEXT:"text",URL:"url",METADATA:"metadata",RECEIPTS:"receipts",MY_RECEIPTS:"myReceipt",CUSTOM_DATA:"customData",CUSTOM_SUB_TYPE:"subType",RESOURCE:"resource"},KNOWN_MEDIA_TYPE:{IMAGE:[],VIDEO:[],AUDIO:[],FILE:[]},PAGINATION:{AFFIX:{APPEND:"append",PREPEND:"prepend"},CURSOR_FILEDS:{ID:"id",SENT_AT:"sentAt"},CURSOR_AFFIX_DEFAULT:"prepend",CURSOR_FIELD_DEFAULT:"sentAt",KEYS:{PER_PAGE:"per_page",CURSOR_AFFIX:"cursorAffix",AFFIX:"affix",CURSOR_FIELD:"cursorField",CURSOR_VALUE:"cursorValue",UID:"uid",SENT_AT:"sentAt",ID:"id",CURRENT_PAGE:"page",UNREAD:"unread",HIDE_MESSAGES_FROM_BLOCKED_USER:"hideMessagesFromBlockedUsers",SEARCH_KEY:"searchKey",ONLY_UPDATES:"onlyUpdates",UPDATED_AT:"updatedAt",CATEGORY:"category",CATEGORIES:"categories",TYPE:"type",TYPES:"types",HIDE_REPLIES:"hideReplies",HIDE_DELETED_MESSAGES:"hideDeleted",WITH_TAGS:"withTags",TAGS:"tags"}}},e.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(r=e.MessageCategory||(e.MessageCategory={})).ACTION="action",r.MESSAGE="message",r.CALL="call",r.CUSTOM="custom",e.TYPING_NOTIFICATION={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"receiverType",META:"metadata",KEYS:{TYPING_NOTIFICATION:"typingNotification",TIMESTAMP:"timestamp"},ACTIONS:{STARTED:"started",ENDED:"ended"}},e.ActionConstatnts={ACTION_SUBJECTS:{ACTION_ON:"on",ACTION_BY:"by",ACTION_FOR:"for"},ACTION_ENTITY_TYPE:{GROUP_USER:"groupuser",USER:"user",GROUP:"group",MESSAGE:"message"},ACTION_KEYS:{ACTION_CREATED:"created",ACTION_UPDATED:"updated",ACTION_DELETED:"deleted",ENTITIES:"entities",ENTITY:"entity",ENTITY_TYPE:"entityType",TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_ADDED:"added",ACTION_SCOPE_CHANGED:"scopeChanged",ACTION_TYPE_USER:"user",ACTION_TYPE_GROUP:"group",ACTION_TYPE_GROUP_MEMBER:"groupMember",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",ACTION_TYPE_CALL:"call",EXTRAS:"extras",SCOPE:"scope",NEW:"new",OLD:"old"},ActionMessages:{ACTION_GROUP_JOINED_MESSAGE:"%s joined",ACTION_GROUP_LEFT_MESSAGE:"%s left",ACTION_MEMBER_KICKED_MESSAGE:"%s kicked %s",ACTION_MEMBER_BANNED_MESSAGE:"%s banned %s",ACTION_MEMBER_UNBANNED_MESSAGE:"%s unbanned %s",ACTION_MEMBER_INVITED_MESSAGE:"%s banned %s",ACTION_MESSAGE_EDITED_MESSAGE:" Message Edited",ACTION_MESSAGE_DELETED_MESSAGE:"Message Deleted",ACTION_MEMBER_SCOPE_CHANGED:"%s made %s %s",ACTION_MEMBER_ADDED_TO_GROUP:"%s added %s"},ACTION_TYPE:{TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_SCOPE_CHANGED:"scopeChanged",TYPE_MESSAGE:"message",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",TYPE_MEMBER_ADDED:"added"},ACTIONS:{MEMBER_ADDED:"added",MEMBER_JOINED:"joined",MEMBER_LEFT:"left",MEMBER_KICKED:"kicked",MEMBER_BANNED:"banned",MEMBER_UNBANNED:"unbanned",MEMBER_INVITED:"invited",MEMBER_SCOPE_CHANGED:"scopeChanged",MESSAGE_EDITED:"edited",MESSSAGE_DELETED:"deleted",TYPE_USER:"user",TYPE_GROUP:"group",TYPE_GROUP_MEMBER:"groupMember"}},e.BlockedUsersConstants={REQUEST_KEYS:{DIRECTIONS:{BOTH:"both",HAS_BLOCKED_ME:"hasBlockedMe",BLOCKED_BY_ME:"blockedByMe"}}},e.CallConstants={CALL_MODE:{DEFAULT:"DEFAULT",SPOTLIGHT:"SPOTLIGHT",SINGLE:"SINGLE",TILE:"TILE",GRID:"GRID"},CALL_TYPE:{AUDIO:"audio",VIDEO:"video"},RECEIVER_TYPE_GROUP:"group",RECEIVER_TYPE_USER:"user",CALL_KEYS:{CALL_DATA:"data",CALL_ID:"id",CALL_SESSION_ID:"sessionid",CALL_RECEIVER:"receiver",CALL_SENDER:"sender",CALL_RECEIVER_TYPE:"receiverType",CALL_STATUS:"status",CALL_TYPE:"type",CALL_INITIATED_AT:"initiatedAt",CALL_JOINED_AT:"joinedAt",CALL_LEFT_AT:"leftAt",CALL_METADATA:"metadata",CALL_ENTITIES:"entities",CALL_ENTITY_TYPE:"entityType",CALL_ENTITY:"entity",CALL_ENTITY_USER:"user",CALL_ENTITY_GROUP:"group"},CALL_STATUS:{INITIATED:"initiated",ONGOING:"ongoing",UNANSWERED:"unanswered",REJECTED:"rejected",BUSY:"busy",CANCELLED:"cancelled",ENDED:"ended"},AUDIO_INPUT_DEVICES:"audioInputDevices",AUDIO_OUTPUT_DEVICES:"audioOutputDevices",VIDEO_INPUT_DEVICES:"videoInputDevices",POST_MESSAGES:{TYPES:{ACTION_MESSAGE:"cometchat_action_message",HANGUP:"hangup",COMETCHAT_RTC_SETTINGS:"cometchat_rtc_settings"},ACTIONS:{USER_JOINED:"onUserJoined",USER_LEFT:"onUserLeft",USER_LIST_CHANGED:"onUserListChanged",INITIAL_DEVICE_LIST:"initialDeviceList",DEVICE_CHANGE:"onDeviceChange",LOAD:"LOAD",CHANGE_AUDIO_INPUT:"changeAudioInput",CHANGE_AUDIO_OUTPUT:"changeAudioOutput",CHANGE_VIDEO_INPUT:"changeVideoInput",MUTE_AUDIO:"muteAudio",UNMUTE_AUDIO:"unMuteAudio",PAUSE_VIDEO:"pauseVideo",UNPAUSE_VIDEO:"unPauseVideo",SWITCH_MODE:"switchMode",START_SCREENSHARE:"startScreenShare",STOP_SCREENSHARE:"stopScreenShare",END_CALL:"endCall",START_RECORDING:"startRecording",STOP_RECORDING:"stopRecording",RECORDING_TOGGLED:"onRecordingToggled",USER_MUTED:"onUserMuted",SCREEN_SHARE_STARTED:"SCREEN_SHARE_STARTED",SCREEN_SHARE_STOPPED:"SCREEN_SHARE_ENDED",SWITCH_TO_VIDEO_CALL:"switchedToVideo",SWITCHED_TO_VIDEO_CALL:"onCallSwitchedToVideo",OPEN_VIRTUAL_BACKGROUND:"openVirtualBackgroundMenu",SET_BACKGROUND_BLUR:"setBackgroundBlur",SET_BACKGROUND_IMAGE:"setBackgroundImage"}},MEDIA_DEVICE:{ID:"id",NAME:"name",ACTIVE:"active"},ZOOM_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},NAME_LABEL_DEFAULT_PARAMS:{position:"bottom-left",visible:!0,color:"rgba(27, 27, 27, 0.4)"},NETWORK_LABEL_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},MAIN_VIDEO_CONTAINER_SETTINGS:{KEYS:{POSITION:"position",VISIBILITY:"visible",COLOR:"color"}}},e.GroupConstants={KEYS:{NAME:"name",GUID:"guid",TYPE:"type",PASSWORD:"password",ICON:"icon",DESCRIPTION:"description",OWNER:"owner",METADATA:"metadata",CREATED_AT:"createdAt",UPDATED_AT:"updatedAt",HAS_JOINED:"hasJoined",WS_CHANNEL:"wsChannel",TAGS:"tags"}},e.GroupMemersConstans={KEYS:{SCOPE:"scope",UID:"uid",GUID:"guid",USER:"user",NAME:"name"}},e.UserConstants={UID:"uid",NAME:"name",AUTH_TOKEN:"authToken",AVATAR:"avatar",LAST_ACTIVE_AT:"lastActiveAt",LINK:"link",META_DATA:"metadata",ROLE:"role",STATUS:"status",STATUS_MESSAGE:"statusMessage",USER_NAME:"user_name",TAGS:"tags",SORT_BY:{NAME:"name",STATUS:"status"},SORT_ORDER:{ASCENDING:"asc",DESCENDING:"desc"}},e.Errors={ERROR_IO_EXCEPTION:"ERROR_IO_EXCEPTION",ERROR_JSON_EXCEPTION:"ERROR_JSON_EXCEPTION",ERROR_PASSWORD_MISSING:"ERROR_PASSWORD_MISSING",ERROR_LIMIT_EXCEEDED:"ERROR_LIMIT_EXCEEDED",ERROR_USER_NOT_LOGGED_IN:"ERROR_USER_NOT_LOGGED_IN",ERROR_INVALID_GUID:"ERROR_INVALID_GUID",ERROR_PASSWORD_MISSING_MESSAGE:"Password is mandatory for a password group",ERROR_LIMIT_EXCEEDED_MESSAGE:"Limit Exceeded Max limit of %s",ERROR_USER_NOT_LOGGED_IN_MESSAGE:"Please log in to CometChat before calling this method",ERROR_INVALID_GUID_MESSAGE:"Please provide a valid GUID",ERROR_DEFAULT_MESSAGE:"Something went wrong",ERR_SETTINGS_HASH_OUTDATED:"ERR_SETTINGS_HASH_OUTDATED",ERR_NO_AUTH:"ERR_NO_AUTH"},e.CALL_ERROR={CALL_ALREADY_INITIATED:{code:"CALL_ALREADY_INITIATED",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},ERROR_IN_CALLING:{code:"CALL_IN_PROGRESS",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},CANNOT_ACCEPT_CALL:{code:"CALL_IN_PROGRESS",name:"CALL_IN_PROGRESS",message:"There is already a call in progress",details:{}},NOT_INITIALIZED:{code:"NOT_INITIALIZED",name:"NOT_INITIALIZED",message:"Please call the CometChat.init() method before calling any other methods related to CometChat.",details:{}},NOT_LOGGED_IN:{code:"NOT_LOGGED_IN",name:"NOT_LOGGED_IN",message:"Please login before starting a call.",details:{}},SESSION_ID_REQUIRED:{code:"SESSION_ID_REQUIRED",name:"SESSION_ID_REQUIRED",message:"Please make sure you are passing correct session id.",details:{}},CALL_SETTINGS_REQUIRED:{code:"CALL_SETTINGS_REQUIRED",name:"CALL_SETTINGS_REQUIRED",message:"Please make sure you are passing the call settings object.",details:{}},JWT_NOT_FOUND:{code:"JWT_NOT_FOUND",name:"JWT_NOT_FOUND",message:"There was some issue while fetching JWT from API.",details:{}}},e.PARAMETER_ERROR={PARAMETER_REQUIRED:{code:"%s_NOT_PROVIDED",name:"%s_NOT_PROVIDED",message:"please provide the %s.",details:{}}},e.GENERAL_ERROR={MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a string.",details:{}},MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a number.",details:{}},MUST_BE_A_OBJECT:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a object.",details:{}},MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be an array.",details:{}},MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a boolean.",details:{}},MUST_BE_A_BLOB:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a blob.",details:{}},INVALID:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s. Please provide a valid %s.",details:{}},METHOD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s is required.",details:{}},LIMIT_EXCEEDED:{code:"ERROR_%s_EXCEEDED",name:"ERROR_%s_EXCEEDED",message:"Limit exceeded max limit of %s.",details:{}},MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a postive integer greater than 0.",details:{}},INVALID_MEDIA_FILE:{code:"INVALID_%s",name:"INVALID_%s",message:"The message type does not match the file's mime type.",details:{}},EMPTY_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s cannot be empty.",details:{}},MISSING_KEY:{code:"MISSING_KEY",name:"MISSING_KEY",message:"The key %s is missing from the %s object.",details:{}},EMPTY_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"The parameter %s should be an array and it cannot be empty.",details:{}},INVALID_SEARCH_KEYWORD:{code:"INVALID_SEARCH_KEYWORD",name:"INVALID_SEARCH_KEYWORD",message:"Invalid search keyword. Please provide a valid search keyword.",details:{}},INVALID_GROUP_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for the group. Please provide a valid %s.",details:{}},INVALID_USER_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for a user. Please provide a valid %s.",details:{}},PARAMETER_MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a number.",details:{}},PARAMETER_MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as an array.",details:{}},PARAMETER_MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a boolean.",details:{}},PARAMETER_MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter to be a positive number greater than 0.",details:{}},PARAMETER_MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a string.",details:{}},PARAMETER_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s cannot be blank. Please provide a valid %s.",details:{}},PASSWORD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"Password is mandatory for a password group.",details:{}},INVALID_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}}},e.ReceiptErrors={MISSING_PARAMETERS:{code:"MISSING_PARAMETERS",name:"MISSING_PARAMETERS",message:"Expected 4 parameters received 3",details:{}},INVALID_PARAMETER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}},NO_WEBSOCKET_CONNECTION:{code:"NO_WEBSOCKET_CONNECTION",name:"NO_WEBSOCKET_CONNECTION",message:"Connection to our Websockets server is broken. Please retry after some time.",details:{}},RECEIPTS_TEMPORARILY_BLOCKED:{code:"RECEIPTS_TEMPORARILY_BLOCKED",name:"RECEIPTS_TEMPORARILY_BLOCKED",message:"Due to high load. Receipts have been blocked for your app.",details:{}},UNKNOWN_ERROR_OCCURRED:{code:"UNKNOWN_ERROR_OCCURRED",name:"UNKNOWN_ERROR_OCCURRED",message:"Unknown error occurred while marking a message as read.",details:{}}},e.UserErrors={INVALID_STATUS:new i.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new i.CometChatException({code:"INVALID_DIRECTION_VALUE",name:"INVALID_DIRECTION_VALUE",message:"The `direction` parameter accepts only `both`, `blockeyByMe` or `hasBlockedMe`.",details:""}),USER_NOT_LOGGED_IN:new i.CometChatException({code:"USER_NOT_LOGGED_IN",name:"USER_NOT_LOGGED_IN",message:"Please log in to CometChat before calling this method.",details:""})},e.GroupErrors={NOT_A_GROUP:new i.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new i.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new i.CometChatException({code:"INVALID_GROUP_TYPE",name:"INVALID_GROUP_TYPE",message:"Group type can be `public`, `private`, `protected` or `password`.",details:""})},e.ConversationErrors={INVALID_CONVERSATION_TYPE:{code:"INVALID_CONVERSATION_TYPE",name:"INVALID_CONVERSATION_TYPE",message:"Conversation type can be `user` or `group`.",details:"Please check the value of conversationType."},CONVERSATION_NOT_FOUND:{code:"CONVERSATION_NOT_FOUND",name:"CONVERSATION_NOT_FOUND",message:"Conversation for %s %s not found.",details:"Please check the value of conversationWith and conversationType."}},e.ExtensionErrors={INVALID_EXTENSION:{code:"ERROR_INVALID_EXTENSION",name:"ERROR_INVALID_EXTENSION",message:"The provided extension cannot be null or empty. Please provide a valid extension.",details:{}},EXTENSION_NOT_FOUND:{code:"ERROR_EXTENSION_NOT_FOUND",name:"ERROR_EXTENSION_NOT_FOUND",message:"The provided extension could not be found.",details:{}}},e.MessageErrors={INVALID_RECEIVER_TYPE:{code:"INVALID_RECEIVER_TYPE",name:"INVALID_RECEIVER_TYPE",message:"Receiver type can be `user` or `group`.",details:"Please check the value of receiverType."}},e.FeatureRestrictionErrors={INVALID_FEATURE:{code:"ERROR_INVALID_FEATURE",name:"ERROR_INVALID_FEATURE",message:"The provided feature cannot be null or empty. Please provide a valid feature.",details:{}},FEATURE_NOT_FOUND:{code:"ERROR_FEATURE_NOT_FOUND",name:"ERROR_FEATURE_NOT_FOUND",message:"The provided feature could not be found.",details:{}}},e.PresenceConstatnts={STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},e.APP_SETTINGS={APP_SETTINGS:"app_settings",KEYS:{CHAT_HOST:"CHAT_HOST",CHAT_USE_SSL:"CHAT_USE_SSL",GROUP_SERVICE:"GROUP_SERVICE",CALL_SERVICE:"CALL_SERVICE",CHAT_WS_PORT:"CHAT_WS_PORT",CHAT_WSS_PORT:"CHAT_WSS_PORT",CHAT_HTTP_BIND_PORT:"CHAT_HTTP_BIND_PORT",CHAT_HTTPS_BIND_PORT:"CHAT_HTTPS_BIND_PORT",ADMIN_API_HOST:"ADMIN_API_HOST",CLIENT_API_HOST:"CLIENT_API_HOST",WEBRTC_HOST:"WEBRTC_HOST",WEBRTC_USE_SSL:"WEBRTC_USE_SSL",WEBRTC_WS_PORT:"WEBRTC_WS_PORT",WEBRTC_WSS_PORT:"WEBRTC_WSS_PORT",WEBRTC_HTTP_BIND_PORT:"WEBRTC_HTTP_BIND_PORT",WEBRTC_HTTPS_BIND_PORT:"WEBRTC_HTTPS_BIND_PORT",EXTENSION_LIST:"extensions",EXTENSION_KEYS:{ID:"id",NAME:"name"},JID_HOST_OVERRIDE:"JID_HOST_OVERRIDE",CHAT_HOST_OVERRIDE:"CHAT_HOST_OVERRIDE",CHAT_HOST_APP_SPECIFIC:"CHAT_HOST_APP_SPECIFIC",MODE:"MODE",CONNECTION_TYPE:"connection_type",DEFAULT_MODE:"DEFAULT",LIMITED_TRANSIENT:"LIMITED_TRANSIENT",NO_TRANSIENT:"NO_TRANSIENT",POLLING_ENABLED:"POLLING_ENABLED",POLLING_INTERVAL:"POLLING_INTERVAL",ANALYTICS_PING_DISABLED:"ANALYTICS_PING_DISABLED",ANALYTICS_HOST:"ANALYTICS_HOST",ANALYTICS_VERSION:"ANALYTICS_VERSION",ANALYTICS_USE_SSL:"ANALYTICS_USE_SSL",SETTINGS_HASH:"settingsHash",SETTINGS_HASH_RECEIVED_AT:"settingsHashReceivedAt",DENY_FALLBACK_TO_POLLING:"DENY_FALLBACK_TO_POLLING",APP_VERSION:"APP_VERSION",MAIN_DOMAIN:"MAIN_DOMAIN",CHAT_API_VERSION:"CHAT_API_VERSION",WS_API_VERSION:"WS_API_VERSION",REGION:"REGION",EXTENSION_DOMAIN:"EXTENSION_DOMAIN",WEBRTC_API_SUBDOMAIN:"WEBRTC_API_SUBDOMAIN",WEBRTC_WEB_FRONTEND_HOST:"WEBRTC_WEB_FRONTEND_HOST",WEBRTC_WEB_FRONTEND_VERSION:"WEBRTC_WEB_FRONTEND_VERSION"}},e.COMMON_UTILITY_CONSTANTS={TYPE_CONSTANTS:{BOOLEAN:"boolean",STRING:"string",OBJECT:"object",NUMBER:"number"}},e.CONNECTION_STATUS={CONNECTED:"connected",CONNECTING:"connecting",DISCONNECTED:"disconnected",FEATURE_THROTTLED:"featureThrottled"},e.SESSION_STORE={SESSION_ID:"sessionId"},e.API_ERROR_CODES={AUTH_ERR_AUTH_TOKEN_NOT_FOUND:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND"},e.PROSODY_API={DOMAIN_PREFIX:"xmpp",PATH:{ROOM:"room",ROOM_SIZE:"room-size",SESSIONS:"sessions"},RESPONSE:{PARTICIPANTS:"participants"},QUERY_PARAMETERS:{DOMAIN:"domain",ROOM:"room"}},e.ProsodyApiErrors={INVALID_SESSIONID:{code:"ERROR_INVALID_SESSIONID",name:"ERROR_INVALID_SESSIONID",message:"The provided sessionId cannot be null or empty. Please provide a valid sessionId.",details:""},INVALID_TYPE:{code:"ERROR_INVALID_TYPE",name:"ERROR_INVALID_TYPE",message:"The provided type cannot be null or empty. Please provide a valid type.",details:""}},e.JWT_API={KEYS:{PASSTHROUGH:"passthrough",EXPAND:"expand"}},e.ONLINE_MEMBER_COUNT_API={ENDPOINTS:{GET_ONLINE_MEMBER_COUNT:"api/%s/online-members"},RESPONSE:{ONLINE_USERS_COUNT:"onlineUsersCount",GROUPS:"groups"},ERRORS:{INVALID_GROUPLIST:{code:"ERROR_INVALID_GROUPLIST",name:"ERROR_INVALID_GROUPLIST",message:"Grouplist cannot be null or empty.",details:""}}}},function(t,e,n){"use strict";e.__esModule=!0,e.CometChatException=void 0;var o=function(t){null!==t.code&&void 0!==t.code&&""!==t.code&&(this.code=t.code),null!==t.name&&void 0!==t.name&&""!==t.name&&(this.name=t.name),null!==t.message&&void 0!==t.message&&""!==t.message&&(this.message=t.message),null!==t.details&&void 0!==t.details&&""!==t.details&&(this.details=t.details)};e.CometChatException=o},function(t,e,n){"use strict";var p=this&&this.__assign||function(){return(p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},E=this&&this.__awaiter||function(t,i,a,E){return new(a||(a=Promise))(function(n,e){function o(t){try{r(E.next(t))}catch(t){e(t)}}function s(t){try{r(E.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,s)}r((E=E.apply(t,i||[])).next())})},c=this&&this.__generator||function(n,o){var s,r,i,t,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&e[0]?r.return:e[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,e[1])).done)return i;switch(r=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,r=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){a.label=e[1];break}if(6===e[0]&&a.label<i[1]){a.label=i[1],i=e;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(e);break}i[2]&&a.ops.pop(),a.trys.pop();continue}e=o.call(n,a)}catch(t){e=[6,t],r=0}finally{s=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};e.__esModule=!0,e.CometChat=void 0;var u=n(28),w=n(0),K=n(2),T=n(6),C=n(4),d=n(14),S=n(17),l=n(7),_=n(16),g=n(10),h=n(11),b=n(1),a=n(8),A=n(15),r=n(30),o=n(23),s=n(21),B=n(31),R=n(13),i=n(20),I=n(40),f=n(41),O=n(42),N=n(43),y=n(45),m=n(46),L=n(25),M=n(26),v=n(36),P=n(19),D=n(34),U=n(48),Y=n(49),F=n(50),V=n(35),x=n(24),k=n(18),J=n(51),H=n(52),W=n(53),G=n(37),j=n(5),X=n(62),q=n(29),Q=n(32),z=n(27),Z=n(63),$=W.WSConnectionHelper.getInstance(),tt=G.ListenerHandlers.getInstance(),et=function(){function G(t){try{G.appId=t,G.localStorage=d.LocalStorage.getInstance(),G.keyStore=r.KeyStore.getInstance()}catch(t){w.Logger.error("CometChat: constructor",t)}}return G.setAuthToken=function(t){try{G.authToken=t}catch(t){w.Logger.error("CometChat: setAuthToken",t)}},G.prototype.getAuthToken=function(){try{return G.authToken}catch(t){w.Logger.error("CometChat: getAuthToken",t)}},G.getAppId=function(){try{return G.appId}catch(t){w.Logger.error("CometChat: getAppId",t)}},G.prototype.getApiKey=function(){try{return G.apiKey}catch(t){w.Logger.error("CometChat: getApiKey",t)}},G.getMode=function(){try{return G.mode}catch(t){w.Logger.error("CometChat: getMode",t)}},G.setMode=function(t){try{G.mode=t}catch(t){w.Logger.error("CometChat: getMode",t)}},G.getSessionId=function(){try{return G.sessionId}catch(t){w.Logger.error("CometChat: getSessionId",t)}},G.onStorageEvent=function(t){if(document&&!document.hasFocus()){var e=G.appId+":common_store/user";t.key===e&&null===t.newValue&&(G.authToken=void 0,G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),$.WSLogout(),G.pushToLoginListener("","Logout_Success")),t.key===e&&null===t.oldValue&&d.LocalStorage.getInstance().get("user").then(function(t){t&&(G.user=new C.Me(t),G.setAuthToken(G.user.getAuthToken()),t.jwt&&(G.jwt=t.jwt),d.LocalStorage.getInstance().get("app_settings").then(function(t){if(t){if(t.hasOwnProperty(b.APP_SETTINGS.KEYS.APP_VERSION)){var e=parseInt(b.APPINFO.sdkVersion.charAt(1));t[b.APP_SETTINGS.KEYS.APP_VERSION]<e&&(G.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken()))}else G.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken());if(t[b.APP_SETTINGS.KEYS.MODE]&&(G.mode=t[b.APP_SETTINGS.KEYS.MODE]),t[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(G.settingsHash=t[b.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(G.settingsHashReceivedAt=t[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),G.isAnalyticsDisabled=!!t[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.getConnectionStatus()!==b.CONNECTION_STATUS.CONNECTED){var n=new C.User(G.user);G.pushToLoginListener(n,"Login_Success"),G.appSettings.shouldAutoEstablishSocketConnection()&&G.WSLogin(G.user)}}}))})}},G.beforeUnload=function(t){var e=G.getDataFromSessionStorage(b.SESSION_STORE.SESSION_ID);G.removeDataFromSessionStorage(b.SESSION_STORE.SESSION_ID),d.LocalStorage.getInstance().set(b.SESSION_STORE.SESSION_ID,e)},G.didAnalyticsPingStart=function(){try{return G.isAnalyticsPingStarted}catch(t){w.Logger.error("CometChat: didAnalyticsPingStart",t)}},G.getDataFromSessionStorage=function(t){if(window.sessionStorage)return window.sessionStorage.getItem(t)},G.addDataToSessionStorage=function(t,e){window.sessionStorage&&window.sessionStorage.setItem(t,e)},G.removeDataFromSessionStorage=function(t){window.sessionStorage&&window.sessionStorage.removeItem(t)},G.init=function(s,t){var o=this;return void 0===s&&(s=""),new Promise(function(n,e){try{"object"==typeof s&&(s.hasOwnProperty("appId")&&(s=s.appId),s.hasOwnProperty("appSettings")&&(t=s.appSettings)),w.isFalsy(t)?t=(new Y.AppSettingsBuilder).setRegion(Y.AppSettings.REGION_EU).build():t.getRegion()==Y.AppSettings.REGION_PRIVATE&&(t.region=s),o.appSettings=t,w.isFalsy(s)?e(new K.CometChatException(R.INIT_ERROR.NO_APP_ID)):(window.addEventListener&&(window.addEventListener("storage",G.onStorageEvent,!1),window.addEventListener("beforeunload",G.beforeUnload,!1)),o.initialzed=!0,G.appId=s,G.getInstance(s),d.LocalStorage.getInstance().get(b.SESSION_STORE.SESSION_ID).then(function(t){null==t||null==t?(G.sessionId=b.APPINFO.platform+"-"+b.APPINFO.sdkVersionWithUnderScore+"-"+Z()+"-"+(new Date).getTime(),G.addDataToSessionStorage(b.SESSION_STORE.SESSION_ID,G.getSessionId()),d.LocalStorage.getInstance().remove(b.SESSION_STORE.SESSION_ID)):(G.sessionId=t.toLocaleString(),d.LocalStorage.getInstance().remove(b.SESSION_STORE.SESSION_ID),G.addDataToSessionStorage(b.SESSION_STORE.SESSION_ID,G.getSessionId())),d.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_APP_ID).then(function(t){if(null==t||null==t)G.appId=s,G.getInstance(s),d.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,s),n(!0);else{var e=t.toLocaleString();e===s?(G.appId=e,G.getInstance(e),d.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_USER).then(function(t){t?(G.isLoggedOut=!1,G.user=new C.Me(t),G.setAuthToken(G.user.getAuthToken()),t.jwt&&(G.jwt=t.jwt),n(!0),d.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){if(t){if(t.hasOwnProperty(b.APP_SETTINGS.KEYS.APP_VERSION)){var e=parseInt(b.APPINFO.sdkVersion.charAt(1));t[b.APP_SETTINGS.KEYS.APP_VERSION]<e&&3!==t[b.APP_SETTINGS.KEYS.APP_VERSION]&&(o.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken()))}else o.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken());t[b.APP_SETTINGS.KEYS.MODE]&&(G.mode=t[b.APP_SETTINGS.KEYS.MODE]),t[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(G.settingsHash=t[b.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(G.settingsHashReceivedAt=t[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),G.isAnalyticsDisabled=!!t[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!o.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),$&&!$.connection&&o.appSettings.shouldAutoEstablishSocketConnection()&&(G.isConnectingFromInit=!0,G.WSLogin(G.user))}})):n(!0)})):o.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,$.WSLogout(),G.appId=s,d.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,s),G.getInstance(s),n(!0)})}r.KeyStore.getInstance().get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(t){if(null==t){var e=Z(),n=(new Date).getTime(),o=s+"_"+e+"_"+n;r.KeyStore.getInstance().set(b.LOCAL_STORE.KEY_DEVICE_ID,o)}})})}))}catch(t){e(new K.CometChatException(t))}})},G.isInitialized=function(){try{return this.initialzed}catch(t){w.Logger.error("CometChat: isInitialized",t)}},G.getInstance=function(t){try{return this.cometChat||(this.cometChat=new G(t)),this.cometChat}catch(t){w.Logger.error("CometChat: getInstance",t)}},G.registerTokenForPushNotification=function(l,p){var C=this;return new Promise(function(u,S){try{G.keyStore.get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(c){w.getAppSettings().then(function(t){var e="",n=c,o=b.APPINFO.platform,s=b.APPINFO.sdkVersion,r=t[b.APP_SETTINGS.KEYS.CHAT_API_VERSION];if(navigator&&(e=navigator.userAgent),null==n){var i=Z(),a=(new Date).getTime();n=C.appId+"_"+i+"_"+a,G.keyStore.set(b.LOCAL_STORE.KEY_DEVICE_ID,n)}var E={platform:o,deviceId:n,appInfo:{version:s,apiVersion:r,userAgent:e,pushNotification:{fcmDeviceToken:l,settings:p}}};T.makeApiCall("updateMyDetails",{},E,!1).then(function(t){u("Token Registration successful")},function(t){S(new K.CometChatException(t.error))}).catch(function(t){S(new K.CometChatException(t))})},function(t){S(new K.CometChatException(t))})})}catch(t){S(new K.CometChatException(t))}})},G.pushToLoginListener=function(e,n){tt.loginHandlers.map(function(t){try{if(t._eventListener)switch(n){case"Login_Success":w.isFalsy(t._eventListener.loginSuccess)||t._eventListener.loginSuccess(e);break;case"Login_Failure":w.isFalsy(t._eventListener.loginFailure)||t._eventListener.loginFailure(e);break;case"Logout_Success":w.isFalsy(t._eventListener.logoutSuccess)||t._eventListener.logoutSuccess()}}catch(t){w.Logger.error("ConnectionHandlers: onConnected Status",t)}})},G.login=function(){for(var E=this,c=[],t=0;t<arguments.length;t++)c[t]=arguments[t];return new Promise(function(i,a){try{if(G.loginInProgress){G.isLoggedOut=!0;var e=new K.CometChatException(R.LOGIN_ERROR.REQUEST_IN_PROGRESS);return a(e)}G.loginInProgress=!0,G.isConnectingFromInit=!1,G.localStorage.get(b.LOCAL_STORE.KEY_APP_ID).then(function(t){if(null==t||null==t){var e=new K.CometChatException(R.LOGIN_ERROR.NOT_INITIALIZED);return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)}var n=t.toLocaleString();if(E.getInstance(n),G.appId=n,d.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,n),"object"==typeof c[0]){var o=c[0];c[0].hasOwnProperty("authToken")?c[0]=o.authToken:c[0].hasOwnProperty("username")&&c[0].hasOwnProperty("apiKey")&&(c[0]=o.username,c[1]=o.apiKey)}if(2==c.length){if(w.isFalsy(c[0])||w.isFalsy(c[1])){e=new K.CometChatException(R.ERRORS.PARAMETER_MISSING);return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)}}else{if(1!=c.length){e=new K.CometChatException(R.ERRORS.PARAMETER_MISSING);return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)}if(w.isFalsy(c[0])){var e=new K.CometChatException(R.ERRORS.PARAMETER_MISSING);return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)}}if(w.isFalsy(E.getAppId())){e=new K.CometChatException(R.LOGIN_ERROR.NOT_INITIALIZED);return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)}return G.localStorage.get(b.LOCAL_STORE.KEY_USER).then(function(r){if(2==c.length){G.apiKey=c[1];var t=c[0];if(null!=r&&r.uid!==c[0])G.localStorage.clearStore().then(function(){$.WSLogout(),G.generateAuthToken(t).then(function(t){G.user=new C.Me(t),G.setAuthToken(G.user.getAuthToken()),G.getLoggedInUser().then(function(t){(G.user=new C.Me(t)).setAuthToken(G.authToken),G.setAuthToken(G.user.getAuthToken());var e=G.user;e.setStatus(b.PresenceConstatnts.STATUS.ONLINE),G.localStorage.set("user",e);var n=new C.User(e);i(n),G.isConnectingFromInit||G.internalRestart||G.pushToLoginListener(n,"Login_Success"),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&G.WSLogin(G.user)},function(t){return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)})},function(t){return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)})});else{if(!w.isFalsy(G.authToken)){var e=new C.User(E.user);return G.internalRestart||G.pushToLoginListener(e,"Login_Success"),G.loginInProgress=!1,G.isLoggedOut=!1,i(e)}if(!w.isFalsy(t)){if(w.isFalsy(G.apiKey)){var n=new K.CometChatException(R.LOGIN_ERROR.UNAUTHORISED);return G.internalRestart||G.pushToLoginListener(n,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(n)}E.generateAuthToken(t).then(function(t){E.user=new C.Me(t),E.setAuthToken(G.user.getAuthToken()),E.getLoggedInUser().then(function(t){E.user=new C.Me(t),E.user.setAuthToken(G.authToken),E.setAuthToken(E.user.getAuthToken()),$.WSLogout();var e=E.user;e.setStatus(b.PresenceConstatnts.STATUS.ONLINE),E.localStorage.set("user",e);var n=new C.User(e);i(n),G.isConnectingFromInit||G.internalRestart||G.pushToLoginListener(n,"Login_Success"),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&E.WSLogin(E.user)},function(t){return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)})},function(t){return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)})}}}else G.authToken=c[0],E.getLoggedInUser().then(function(t){if(t.authToken!=c[0]){var o=E;o.localStorage.clearStore().then(function(){$.WSLogout(),o.getLoggedInUser().then(function(t){(G.user=new C.Me(t)).setAuthToken(G.authToken),G.setAuthToken(G.user.getAuthToken());var e=G.user;e.setStatus(b.PresenceConstatnts.STATUS.ONLINE),o.localStorage.set("user",e);var n=new C.User(e);i(n),G.isConnectingFromInit||G.internalRestart||G.pushToLoginListener(n,"Login_Success"),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&G.WSLogin(new C.Me(t))},function(t){return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)})})}else{if(r){var e=new C.User(t);return G.internalRestart||G.pushToLoginListener(e,"Login_Success"),G.loginInProgress=!1,G.isLoggedOut=!1,i(e)}(G.user=new C.Me(t)).setAuthToken(G.authToken),G.setAuthToken(G.user.getAuthToken());var n=G.user;n.setStatus(b.PresenceConstatnts.STATUS.ONLINE),G.localStorage.set("user",n);var s=new C.User(n);i(s),G.isConnectingFromInit||G.internalRestart||G.pushToLoginListener(s,"Login_Success"),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&G.WSLogin(new C.Me(t))}},function(t){return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)})})})}catch(t){e=new K.CometChatException(t);return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)}})},G.sendMessage=function(a){var t=this;return new Promise(function(r,i){return E(t,void 0,void 0,function(){var e,n,o,s=this;return c(this,function(t){try{return a instanceof _.TextMessage||a instanceof S.MediaMessage||a instanceof P.CustomMessage||(a=a[b.MessageConstatnts.KEYS.ATTATCHMENT]?(e=b.MessageConstatnts.TYPE.FILE,w.isImage(a[b.MessageConstatnts.KEYS.ATTATCHMENT])?e=b.MessageConstatnts.TYPE.IMAGE:w.isAudio(a[b.MessageConstatnts.KEYS.ATTATCHMENT])?e=b.MessageConstatnts.TYPE.AUDIO:w.isVideo(a[b.MessageConstatnts.KEYS.ATTATCHMENT])&&(e=b.MessageConstatnts.TYPE.VIDEO),new S.MediaMessage(a[b.MessageConstatnts.KEYS.RECEIVER_ID],a[b.MessageConstatnts.KEYS.ATTATCHMENT],e,a[b.MessageConstatnts.KEYS.RECEIVER_TYPE])):new _.TextMessage(a[b.MessageConstatnts.KEYS.RECEIVER_ID],a[b.MessageConstatnts.KEYS.TEXT],a[b.MessageConstatnts.KEYS.RECEIVER_TYPE])),(n=w.validateMessage(a))instanceof K.CometChatException?(i(n),[2]):(a.receiver=a.receiverId,delete a.receiverId,o=a.parentMessageId,[2,T.makeApiCall(o?"sendMessageInThread":"sendMessage",o?{parentId:o}:{},a,a instanceof S.MediaMessage).then(function(n){return E(s,void 0,void 0,function(){var e;return c(this,function(t){return e=g.MessageController.trasformJSONMessge(n.data),L.MessageListnerMaping.getInstance().set("all",parseInt(e.id)),r(e),[2]})})},function(t){i(new K.CometChatException(t.error))})])}catch(t){i(new K.CometChatException(t))}return[2]})})})},G.sendDirectMessage=function(t){try{return Object.assign(t,{receiverType:b.MessageConstatnts.RECEIVER_TYPE.USER}),this.sendMessage(t)}catch(t){w.Logger.error("CometChat: sendDirectMessage",t)}},G.sendGroupMessage=function(t){try{return Object.assign(t,{receiverType:b.MessageConstatnts.RECEIVER_TYPE.GROUP}),this.sendMessage(t)}catch(t){w.Logger.error("CometChat: sendGroupMessage",t)}},G.sendMediaMessage=function(t){try{return this.sendMessage(t)}catch(t){w.Logger.error("CometChat: sendMediaMessage",t)}},G.sendCustomMessage=function(t){try{return this.sendMessage(t)}catch(t){w.Logger.error("CometChat: sendCustomMessage",t)}},G.getLastDeliveredMessageId=function(){return E(this,void 0,void 0,function(){var e;return c(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,L.MessageListnerMaping.getInstance().get(b.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST)];case 1:return[2,t.sent()];case 2:return e=t.sent(),w.Logger.error("CometChat: getLastDeliveredMessageId",e),[3,3];case 3:return[2]}})})},G.startTyping=function(t){try{if(w.isFalsy(t))return;var e=void 0,n=this.RECEIVER_TYPE.USER,o={};if(t instanceof M.TypingIndicator)e=t.getReceiverId(),n=t.getReceiverType(),o=t.getMetadata();else{if(!t.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_ID))return;e=t[b.TYPING_NOTIFICATION.RECEIVER_ID],t.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=t[b.TYPING_NOTIFICATION.RECEIVER_TYPE]),t.hasOwnProperty(b.TYPING_NOTIFICATION.META)&&(o=t[b.TYPING_NOTIFICATION.META])}if(w.isFalsy(e))return;if(null==v.TypingNotificationController.getTypingStartedMap(e)){var s=G.getMode();return w.isFalsy(s)||s&&s!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&s!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?($.startTypingIndicator(e,n,o),v.TypingNotificationController.addTypingStarted(e),void v.TypingNotificationController.removeTypingEnded(e)):void 0}}catch(t){w.Logger.error("CometChat: startTyping",t)}},G.endTyping=function(t){try{if(w.isFalsy(t))return;var e=void 0,n=this.RECEIVER_TYPE.USER,o={};if(t instanceof M.TypingIndicator)e=t.getReceiverId(),n=t.getReceiverType(),o=t.getMetadata();else{if(!t.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_ID))return;e=t[b.TYPING_NOTIFICATION.RECEIVER_ID],t.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=t[b.TYPING_NOTIFICATION.RECEIVER_TYPE]),n=n==this.RECEIVER_TYPE.USER?b.WS.CONVERSATION.TYPE.CHAT:b.WS.CONVERSATION.TYPE.GROUP_CHAT,t.hasOwnProperty(b.TYPING_NOTIFICATION.META)&&(o=t[b.TYPING_NOTIFICATION.META])}if(w.isFalsy(e))return;if(null==v.TypingNotificationController.getTypingEndedMap(e)){var s=G.getMode();return w.isFalsy(s)||s&&s!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&s!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?($.pauseTypingIndicator(e,n,o),v.TypingNotificationController.addTypingEnded(e),void v.TypingNotificationController.removeTypingStarted(e)):void 0}}catch(t){w.Logger.error("CometChat: endTyping",t)}},G.markAsRead=function(){for(var E=[],t=0;t<arguments.length;t++)E[t]=arguments[t];return new Promise(function(t,e){try{var n=void 0,o=void 0,s=void 0,r=void 0;if(3===E.length)return e(new K.CometChatException(b.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(w.isFalsy(E[0])||"string"!=typeof E[0])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(n=E[0],w.isFalsy(E[1])||"string"!=typeof E[1])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(o=E[1],w.isFalsy(E[2])||"string"!=typeof E[2])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(s=E[2],w.isFalsy(E[3])||"string"!=typeof E[3])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));r=E[3]}else{if(1!==E.length)return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsRead() expects either 1 or 4 arguments."))));if(w.isFalsy(E[0])||!(E[0]instanceof l.BaseMessage))return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];n=i.getId().toString(),o=(s=i.getReceiverType())===b.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===G.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),r=i.getSender().getUid()}var a=G.getMode();return w.isFalsy(a)||a&&a!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?G.getConnectionStatus()===b.CONNECTION_STATUS.CONNECTED?($.markAsRead(o,s,n,r),t()):e(new K.CometChatException(b.ReceiptErrors.NO_WEBSOCKET_CONNECTION)):e(new K.CometChatException(b.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED))}catch(t){return w.Logger.error("CometChat: markAsRead",t),e(new K.CometChatException(b.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},G.markAsDelivered=function(){for(var E=[],t=0;t<arguments.length;t++)E[t]=arguments[t];return new Promise(function(t,e){try{var n=void 0,o=void 0,s=void 0,r=void 0;if(3===E.length)return e(new K.CometChatException(b.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(w.isFalsy(E[0])||"string"!=typeof E[0])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(n=E[0],w.isFalsy(E[1])||"string"!=typeof E[1])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(o=E[1],w.isFalsy(E[2])||"string"!=typeof E[2])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(s=E[2],w.isFalsy(E[3])||"string"!=typeof E[3])return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));r=E[3]}else{if(1!==E.length)return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsDelivered() expects either 1 or 4 arguments."))));if(w.isFalsy(E[0])||!(E[0]instanceof l.BaseMessage))return e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];n=i.getId().toString(),o=(s=i.getReceiverType())===b.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===G.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),r=i.getSender().getUid()}var a=G.getMode();return w.isFalsy(a)||a&&a!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?G.getConnectionStatus()===b.CONNECTION_STATUS.CONNECTED?($.markAsDelivered(o,s,n,r),t()):e(new K.CometChatException(b.ReceiptErrors.NO_WEBSOCKET_CONNECTION)):e(new K.CometChatException(b.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED))}catch(t){return w.Logger.error("CometChat: markAsDelivered",t),e(new K.CometChatException(b.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},G.sendTransientMessage=function(t){try{if(w.isFalsy(t))return;var e=void 0,n=void 0,o={};if(!(t instanceof z.TransientMessage))return;if(e=t.getReceiverId(),n=t.getReceiverType(),o=t.getData(),w.isFalsy(e)||w.isFalsy(n))return;var s=G.getMode();return w.isFalsy(s)||s&&s!==b.APP_SETTINGS.KEYS.NO_TRANSIENT?void $.sendTransientMessage(e,n,o):void 0}catch(t){w.Logger.error("CometChat: sendTransientMessage",t)}},G.sendTestMessage=function(o){return E(this,void 0,void 0,function(){var e,n;return c(this,function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),(e=o)instanceof l.BaseMessage?[3,2]:[4,F.CometChatHelper.processMessage(o)];case 1:e=t.sent(),t.label=2;case 2:return e instanceof _.TextMessage&&W.WSConnectionHelper.getInstance().publishMessage(e),[3,4];case 3:return n=t.sent(),w.Logger.error("CometChat: sendTestMessage",n),[3,4];case 4:return[2]}})})},G.getMessageDetails=function(t){return new Promise(function(e,n){try{w.isFalsy(t)?n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):T.makeApiCall("getMessageDetails",{messageId:t}).then(function(t){e(g.MessageController.trasformJSONMessge(t.data))},function(t){w.Logger.error("CometChat:GetMessageDetails:",t),n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.getMessageReceipts=function(o){return new Promise(function(e,n){try{var t=w.validateMsgId(o);if(t instanceof K.CometChatException)return void n(t);w.isFalsy(o)?n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):T.makeApiCall("getMessageDetails",{messageId:o}).then(function(t){g.MessageController.getReceiptsFromJSON(t.data).then(function(t){e(t)},function(t){n(new K.CometChatException(t))})},function(t){w.Logger.error("CometChat:GetMessageDetails:",t),n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.getUnreadMessageCount=function(n){void 0===n&&(n=!1);var s=0;return new Promise(function(o,e){try{var t=w.validateHideMessagesFromBlockedUsers(n);if(t instanceof K.CometChatException)return void e(t);n&&(s=1),T.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:s}).then(function(t){var e={},n={};t.data.map(function(t){t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==b.MessageConstatnts.RECEIVER_TYPE.GROUP?n[t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:e[t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),o({users:e,groups:n})},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.getUnreadMessageCountForAllUsers=function(o){void 0===o&&(o=!1);var s=0;return new Promise(function(n,e){try{var t=w.validateHideMessagesFromBlockedUsers(o);if(t instanceof K.CometChatException)return void e(t);o&&(s=1),T.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:s,receiverType:b.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(t){var e={};t.data.map(function(t){e[t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(p({},e))},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.getUnreadMessageCountForAllGroups=function(o){void 0===o&&(o=!1);var s=0;return new Promise(function(n,e){try{var t=w.validateHideMessagesFromBlockedUsers(o);if(t instanceof K.CometChatException)return void e(t);o&&(s=1),T.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:s,receiverType:b.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(t){var e={};t.data.map(function(t){t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==b.MessageConstatnts.RECEIVER_TYPE.GROUP&&(e[t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(p({},e))},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.getUnreadMessageCountForUser=function(s,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,e){try{var t=w.validateId(s,"user");if(t instanceof K.CometChatException)return void e(t);var o=w.validateHideMessagesFromBlockedUsers(r);if(o instanceof K.CometChatException)return void e(o);r&&(i=1),T.makeApiCall("getUserMessages",{listId:s},{hideMessagesFromBlockedUsers:i,unread:1,count:1,uid:s}).then(function(t){var e={};t.data.map(function(t){e[t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(p({},e))},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.getUnreadMessageCountForGroup=function(s,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,e){try{var t=w.validateId(s,"group");if(t instanceof K.CometChatException)return void e(t);var o=w.validateHideMessagesFromBlockedUsers(r);if(o instanceof K.CometChatException)return void e(o);r&&(i=1),T.makeApiCall("getGroupMessages",{listId:s},{hideMessagesFromBlockedUsers:i,unread:1,count:1,guid:s}).then(function(t){var e={};t.data.map(function(t){t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==b.MessageConstatnts.RECEIVER_TYPE.GROUP&&(e[t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=t[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(p({},e))},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.editMessage=function(o){return new Promise(function(e,n){try{var t=w.validateMsgId(o.getId());if(t instanceof K.CometChatException)return void n(t);T.makeApiCall("updateMessage",{messageId:o.getId()},o).then(function(t){e(g.MessageController.trasformJSONMessge(t.data).getActionOn())},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.deleteMessage=function(o){return new Promise(function(e,n){try{var t=w.validateMsgId(o);if(t instanceof K.CometChatException)return void n(t);T.makeApiCall("deleteMessage",{messageId:o},{id:o}).then(function(t){e(g.MessageController.trasformJSONMessge(t.data).getActionOn())},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.getOnlineUserCount=function(){return new Promise(function(o,s){try{w.getAppSettings().then(function(t){var e=w.format((new u.EndpointFactory).wsApi,w.getChatHost(t),w.format(b.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,t[b.APP_SETTINGS.KEYS.WS_API_VERSION])),n={appId:G.appId,Authorization:G.jwt,Accept:"application/json","Content-Type":"application/json"};T.postData(e,"POST",{},n,!1).then(function(t){return t.json()}).then(function(t){return t.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ONLINE_MEMBER_COUNT_API.RESPONSE.ONLINE_USERS_COUNT]):s(new K.CometChatException(t.error))}).catch(function(){var t={error:R.FETCH_ERROR.ERROR_IN_API_CALL};return s(t)})},function(t){return s(new K.CometChatException(t))})}catch(t){return s(new K.CometChatException(t))}})},G.getOnlineGroupMemberCount=function(i){return new Promise(function(s,r){try{if(!i||0==i.length)return r(new K.CometChatException(b.ONLINE_MEMBER_COUNT_API.ERRORS.INVALID_GROUPLIST));w.getAppSettings().then(function(t){var e=w.format((new u.EndpointFactory).wsApi,w.getChatHost(t),w.format(b.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,t[b.APP_SETTINGS.KEYS.WS_API_VERSION])),n={groups:i},o={appId:G.appId,Authorization:G.jwt,Accept:"application/json","Content-Type":"application/json"};T.postData(e,"POST",n,o,!1).then(function(t){return t.json()}).then(function(t){return t.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?s(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ONLINE_MEMBER_COUNT_API.RESPONSE.GROUPS]):r(new K.CometChatException(t.error))}).catch(function(){var t={error:R.FETCH_ERROR.ERROR_IN_API_CALL};return r(t)})},function(t){return r(new K.CometChatException(t))})}catch(t){return r(new K.CometChatException(t))}})},G.createUser=function(s,r){return new Promise(function(n,e){try{if(w.isFalsy(r))return void e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));G.apiKey=r;var t=w.validateCreateUser(s);if(t instanceof K.CometChatException)return void e(t);if(!(s instanceof C.User)){var o=void 0;if(!s.hasOwnProperty(b.UserConstants.UID))return void e(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));if(!s.hasOwnProperty(b.UserConstants.NAME))return void e(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));o=new C.User(s[b.UserConstants.UID],s[b.UserConstants.NAME]),s.hasOwnProperty(b.UserConstants.AVATAR)&&o.setAvatar(s[b.UserConstants.AVATAR]),s.hasOwnProperty(b.UserConstants.ROLE)&&o.setRole(s[b.UserConstants.ROLE]),s.hasOwnProperty(b.UserConstants.META_DATA)&&o.setMetadata(s[b.UserConstants.META_DATA]),s.hasOwnProperty(b.UserConstants.LINK)&&o.setLink(s[b.UserConstants.LINK]),s.hasOwnProperty(b.UserConstants.STATUS_MESSAGE)&&o.setStatusMessage(s[b.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(b.UserConstants.TAGS)&&o.setTags(s[b.UserConstants.TAGS]),s=o}T.makeApiCall("createUser",{},s).then(function(t){var e=h.UsersController.trasformJSONUser(t.data);n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.updateUser=function(o,i){var a=this;return new Promise(function(s,e){try{if(w.isFalsy(i))return void e(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));G.apiKey=i;var t=w.validateUpdateUser(o);if(t instanceof K.CometChatException)return void e(t);if(!(o instanceof C.User)){var n=void 0;if(!o.hasOwnProperty(b.UserConstants.UID))return void e(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));n=new C.User(o[b.UserConstants.UID]),o.hasOwnProperty(b.UserConstants.NAME)&&n.setName(o[b.UserConstants.NAME]),o.hasOwnProperty(b.UserConstants.AVATAR)&&n.setAvatar(o[b.UserConstants.AVATAR]),o.hasOwnProperty(b.UserConstants.ROLE)&&n.setRole(o[b.UserConstants.ROLE]),o.hasOwnProperty(b.UserConstants.META_DATA)&&n.setMetadata(o[b.UserConstants.META_DATA]),o.hasOwnProperty(b.UserConstants.LINK)&&n.setLink(o[b.UserConstants.LINK]),o.hasOwnProperty(b.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(o[b.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(b.UserConstants.TAGS)&&n.setTags(o[b.UserConstants.TAGS]),o=n}var r=o.uid;T.makeApiCall("updateUser",{uid:r},o).then(function(o){if(a.user&&r.toLocaleLowerCase()===a.user.getUid().toLocaleLowerCase())d.LocalStorage.getInstance().get("user").then(function(t){if(t){var e=h.UsersController.trasformJSONUser(o.data),n=o.data;n.wsChannel=t.wsChannel,n.authToken=G.authToken,n.status=b.PresenceConstatnts.STATUS.ONLINE,t.jwt&&(n.jwt=t.jwt),G.user=new C.Me(n),a.localStorage.set("user",G.user),s(e)}});else{var t=h.UsersController.trasformJSONUser(o.data);s(t)}},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.updateCurrentUserDetails=function(s){var r=this;return new Promise(function(o,e){try{s.uid=r.user.uid;var t=w.validateUpdateUser(s);if(t instanceof K.CometChatException)return void e(t);if(!(s instanceof C.User)){var n=void 0;s.hasOwnProperty(b.UserConstants.UID)&&(n=new C.User(s[b.UserConstants.UID])),s.hasOwnProperty(b.UserConstants.NAME)&&n.setName(s[b.UserConstants.NAME]),s.hasOwnProperty(b.UserConstants.AVATAR)&&n.setAvatar(s[b.UserConstants.AVATAR]),s.hasOwnProperty(b.UserConstants.ROLE)&&n.setRole(s[b.UserConstants.ROLE]),s.hasOwnProperty(b.UserConstants.META_DATA)&&n.setMetadata(s[b.UserConstants.META_DATA]),s.hasOwnProperty(b.UserConstants.LINK)&&n.setLink(s[b.UserConstants.LINK]),s.hasOwnProperty(b.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(s[b.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(b.UserConstants.TAGS)&&n.setTags(s[b.UserConstants.TAGS]),s=n}T.makeApiCall("updateMyDetails",{},s).then(function(t){var e=h.UsersController.trasformJSONUser(t.data),n=G.user=new C.Me(t.data);n.setStatus(b.PresenceConstatnts.STATUS.ONLINE),G.localStorage.set("user",n),o(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.getUser=function(o){return new Promise(function(n,e){try{"object"==typeof o&&o.hasOwnProperty("uid")&&(o=o.uid);var t=w.validateId(o,"user");if(t instanceof K.CometChatException)return void e(t);T.makeApiCall("user",{uid:o}).then(function(t){var e=h.UsersController.trasformJSONUser(t.data);n(e)}).catch(function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.getLoggedInUser=function(){var l=this;return new Promise(function(u,S){try{G.localStorage.get(b.LOCAL_STORE.KEY_USER).then(function(t){if(t)u(G.user=new C.Me(t));else{var r="",i="",a=b.APPINFO.platform,E=b.APPINFO.sdkVersion,c=b.APPINFO.apiVersion;G.keyStore.get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(t){if(i=t,navigator&&(r=navigator.userAgent),null==i){var e=Z(),n=(new Date).getTime();i=l.appId+"_"+e+"_"+n,G.keyStore.set(b.LOCAL_STORE.KEY_DEVICE_ID,i)}var o={version:E,apiVersion:c,userAgent:r};w.isFalsy(l.platform)||(o.platform=l.platform),w.isFalsy(l.language)||(o.language=l.language),w.isFalsy(l.resource)||(o.resource=l.resource);var s={platform:a,deviceId:i,appInfo:o};T.makeApiCall("updateMyDetails",{},s,!1).then(function(t){t.data.jwt&&(G.jwt=t.data.jwt);var e=t.data.settings;e&&(d.LocalStorage.getInstance().set("app_settings",e),e[b.APP_SETTINGS.KEYS.MODE]&&G.setMode(e[b.APP_SETTINGS.KEYS.MODE]),e[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(G.settingsHash=e[b.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(G.settingsHashReceivedAt=e[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),G.isAnalyticsDisabled=!!e[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]),u(new C.Me(t.data))},function(t){S(new K.CometChatException(t.error))}).catch(function(t){S(new K.CometChatException(t))})})}})}catch(t){S(new K.CometChatException(t))}})},G.getLoggedinUser=function(){return new Promise(function(e,n){try{G.localStorage.get(b.LOCAL_STORE.KEY_USER).then(function(t){e(t?new C.User(t):null)},function(t){e(null)})}catch(t){n(new K.CometChatException(t))}})},G.blockUsers=function(o){return new Promise(function(e,n){try{var t=w.validateArray(o,"blockUsers");if(t instanceof K.CometChatException)return void n(t);w.isFalsy(o)?n(new K.CometChatException(R.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):T.makeApiCall("blockUsers",{},{blockedUids:o}).then(function(t){e(t.data)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.unblockUsers=function(o){return new Promise(function(e,n){try{var t=w.validateArray(o,"unblockUsers");if(t instanceof K.CometChatException)return void n(t);w.isFalsy(o)?n(new K.CometChatException(R.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):T.makeApiCall("unblockUsers",{},{blockedUids:o}).then(function(t){e(t.data)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.getConversation=function(i,a){return new Promise(function(n,o){try{var t=w.validateConversationType(a);if(t instanceof K.CometChatException)return void o(t);var e=w.validateId(i,a);if(e instanceof K.CometChatException)return void o(e);a=a.toLowerCase(),i=i.toLowerCase();var s={},r="";a===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversation",s.guid=i):(r="getUserConversation",s.uid=i),T.makeApiCall(r,s).then(function(t){if(t.data){var e=t.data;n(x.ConversationController.trasformJSONConversation(e.conversationId,e.conversationType,e.lastMessage,e.conversationWith,parseInt(e.unreadMessageCount),e.tags?e.tags:[]))}else o(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(t){o(new K.CometChatException(t.error))})}catch(t){o(new K.CometChatException(t))}})},G.tagConversation=function(i,a,E){return void 0===E&&(E=[]),new Promise(function(n,o){try{var t=w.validateConversationType(a);if(t instanceof K.CometChatException)return void o(t);var e=w.validateId(i,a);if(e instanceof K.CometChatException)return void o(e);a=a.toLowerCase(),i=i.toLowerCase();var s={},r="";a===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="updateGroupConversation",s.guid=i):(r="updateUserConversation",s.uid=i),T.makeApiCall(r,s,{tags:E}).then(function(t){if(t.data){var e=t.data;n(x.ConversationController.trasformJSONConversation(e.conversationId,e.conversationType,e.lastMessage,e.conversationWith,parseInt(e.unreadMessageCount),e.tags?e.tags:[]))}else o(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(t){o(new K.CometChatException(t.error))})}catch(t){o(new K.CometChatException(t))}})},G.deleteConversation=function(i,a){return new Promise(function(e,n){try{var t=w.validateConversationType(a);if(t instanceof K.CometChatException)return void n(t);var o=w.validateId(i,a);if(o instanceof K.CometChatException)return void n(o);var s={},r="";a=a.toLowerCase(),i=i.toLowerCase(),a===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="deleteGroupConversation",s.guid=i):(r="deleteUserConversation",s.uid=i),T.makeApiCall(r,s).then(function(t){e("Conversation deleted successfully.")},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.createGroup=function(s){return new Promise(function(e,n){try{var t=w.validateCreateGroup(s);if(t instanceof K.CometChatException)return void n(t);if(!(s instanceof a.Group)){var o=void 0;if(!s.hasOwnProperty(b.GroupConstants.KEYS.GUID))return void n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));if(!s.hasOwnProperty(b.GroupConstants.KEYS.NAME))return void n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));if(o=new a.Group(s[b.GroupConstants.KEYS.GUID],s[b.GroupConstants.KEYS.NAME],""),s.hasOwnProperty(b.GroupConstants.KEYS.TYPE))if(s[b.GroupConstants.KEYS.TYPE].toLocaleLowerCase()==b.GroupType.Password){if(!s.hasOwnProperty(b.GroupConstants.KEYS.PASSWORD))return void n(new K.CometChatException(R.GROUP_CREATION_ERRORS.EMPTY_PASSWORD));o.setType(b.GROUP_TYPE.PASSWORD),o.setPassword(s[b.GroupConstants.KEYS.PASSWORD])}else o.setType(s[b.GroupConstants.KEYS.TYPE]);else o.setType(b.GROUP_TYPE.PUBLIC);s.hasOwnProperty(b.GroupConstants.KEYS.ICON)&&o.setIcon(s[b.GroupConstants.KEYS.ICON]),s.hasOwnProperty(b.GroupConstants.KEYS.DESCRIPTION)&&o.setDescription(s[b.GroupConstants.KEYS.DESCRIPTION]),s.hasOwnProperty(b.GroupConstants.KEYS.TAGS)&&o.setTags(s[b.GroupConstants.KEYS.TAGS]),s=o}T.makeApiCall("createGroup",{},s).then(function(t){A.GroupsController.trasformJSONGroup(t.data).setHasJoined(!0),e(A.GroupsController.trasformJSONGroup(t.data))},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.getGroup=function(o){return new Promise(function(e,n){try{"object"==typeof o&&o.hasOwnProperty("guid")&&(o=o.guid);var t=w.validateId(o,"group");if(t instanceof K.CometChatException)return void n(t);T.makeApiCall("getGroup",{guid:o}).then(function(t){e(A.GroupsController.trasformJSONGroup(t.data))},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.joinGroup=function(s,r,i){return void 0===r&&(r=b.GroupType.Public),void 0===i&&(i=""),new Promise(function(n,e){try{var t=w.validateJoinGroup(s,r,i);if(t instanceof K.CometChatException)return void e(t);var o=void 0;"object"==typeof s&&(s.hasOwnProperty(b.GroupConstants.KEYS.GUID)?(s.hasOwnProperty(b.GroupConstants.KEYS.TYPE)&&(r=s[b.GroupConstants.KEYS.TYPE],s[b.GroupConstants.KEYS.TYPE].toLocaleLowerCase()===b.GroupType.Password&&s.hasOwnProperty(b.GroupConstants.KEYS.PASSWORD)&&(i=s[b.GroupConstants.KEYS.PASSWORD])),s=s[b.GroupConstants.KEYS.GUID]):e(new K.CometChatException(R.ERRORS.PARAMETER_MISSING))),o=w.isFalsy(i)?new a.Group(s,"name",r):new a.Group(s,"name",r,i),T.makeApiCall("joinGroup",o,o).then(function(t){var e=A.GroupsController.trasformJSONGroup(t.data[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ActionConstatnts.ACTION_KEYS.ENTITIES][b.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][b.ActionConstatnts.ACTION_KEYS.ENTITY]);e.setHasJoined(!0),n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.updateGroup=function(s){return new Promise(function(e,n){try{var t=w.validateUpdateGroup(s);if(t instanceof K.CometChatException)return void n(t);if(!(s instanceof a.Group)){var o=void 0;if(!s.hasOwnProperty(b.GroupConstants.KEYS.GUID))return void n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));o=new a.Group(b.GroupConstants.KEYS.GUID,"",""),s.hasOwnProperty(b.GroupConstants.KEYS.TYPE)?o.setType(s[b.GroupConstants.KEYS.TYPE]):(s[b.GroupConstants.KEYS.TYPE]=b.GROUP_TYPE.PUBLIC,o.setType[b.GROUP_TYPE.PUBLIC]),s.hasOwnProperty(b.GroupConstants.KEYS.NAME)&&o.setName(s[b.GroupConstants.KEYS.NAME]),s.hasOwnProperty(b.GroupConstants.KEYS.ICON)&&o.setIcon(s[b.GroupConstants.KEYS.ICON]),s.hasOwnProperty(b.GroupConstants.KEYS.DESCRIPTION)&&o.setDescription(s[b.GroupConstants.KEYS.DESCRIPTION]),s.hasOwnProperty(b.GroupConstants.KEYS.TAGS)&&o.setTags(s[b.GroupConstants.KEYS.TAGS]),s=o}T.makeApiCall("updateGroup",s,s).then(function(t){e(A.GroupsController.trasformJSONGroup(t.data))},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.deleteGroup=function(o){return new Promise(function(e,n){try{var t=w.validateId(o,"group");if(t instanceof K.CometChatException)return void n(t);T.makeApiCall("deleteGroup",{guid:o}).then(function(t){e(!0)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.leaveGroup=function(o){return new Promise(function(e,n){try{var t=w.validateId(o,"group");if(t instanceof K.CometChatException)return void n(t);T.makeApiCall("leaveGroup",{guid:o}).then(function(t){e(!0)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.kickGroupMember=function(s,r){return new Promise(function(e,n){try{var t=w.validateId(s,"group");if(t instanceof K.CometChatException)return void n(t);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void n(o);T.makeApiCall("kickGroupMembers",{guid:s,uid:r}).then(function(t){e(!0)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.updateGroupMemberScope=function(r,i,a){return new Promise(function(e,n){try{var t=w.validateId(r,"group");if(t instanceof K.CometChatException)return void n(t);var o=w.validateId(i,"user");if(o instanceof K.CometChatException)return void n(o);var s=w.validateScope(a);if(s instanceof K.CometChatException)return void n(s);T.makeApiCall("changeScopeOfMember",{guid:r,uid:i},{scope:a}).then(function(t){e(!0)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.banGroupMember=function(s,r){return new Promise(function(e,n){try{var t=w.validateId(s,"group");if(t instanceof K.CometChatException)return void n(t);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void n(o);T.makeApiCall("banGroupMember",{guid:s,uid:r}).then(function(t){e(!0)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.unbanGroupMember=function(s,r){return new Promise(function(e,n){try{var t=w.validateId(s,"group");if(t instanceof K.CometChatException)return void n(t);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void n(o);T.makeApiCall("unbanGroupMember",{guid:s,uid:r}).then(function(t){e(!0)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.addMembersToGroup=function(i,a,E){var c=[],u=[],S=[],l=[];return new Promise(function(t,e){try{var n=w.validateId(i,"group");if(n instanceof K.CometChatException)return void e(n);var o=w.validateArray(a,"groupMembers");if(o instanceof K.CometChatException)return void e(o);if(E){var s=w.validateArray(E,"bannedMembers");if(s instanceof K.CometChatException)return void e(s)}w.isFalsy(a)&&w.isFalsy(E)?e(new K.CometChatException({})):w.isFalsy(a)||w.isFalsy(E)?w.isFalsy(a)?E.map(function(t){l.push(t)}):(a.filter(function(t){if(t.getScope()==b.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(t){c.push(t.getUid())}),a.filter(function(t){if(t.getScope()==b.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(t){u.push(t.getUid())}),a.filter(function(t){if(t.getScope()==b.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(t){S.push(t.getUid())})):(a.filter(function(t){if(t.getScope()==b.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(t){c.push(t.getUid())}),a.filter(function(t){if(t.getScope()==b.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(t){u.push(t.getUid())}),a.filter(function(t){if(t.getScope()==b.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(t){S.push(t.getUid())}),E.map(function(t){l.push(t)}));var r={};w.isFalsy(c)||(r=p(p({},r),{admins:c})),w.isFalsy(S)||(r=p(p({},r),{participants:S})),w.isFalsy(u)||(r=p(p({},r),{moderators:u})),w.isFalsy(l)||(r=p(p({},r),{usersToBan:l})),T.makeApiCall("addMemebersToGroup",{guid:i},r).then(function(e){var n={};Object.keys(e.data.admins).map(function(t){e.data.admins[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[t]=e.data.admins[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(e.data.participants).map(function(t){e.data.participants[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[t]=e.data.participants[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(e.data.moderators).map(function(t){e.data.moderators[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[t]=e.data.moderators[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(e.data.usersToBan).map(function(t){e.data.usersToBan[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[t]=e.data.usersToBan[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),t(n)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.transferGroupOwnership=function(s,r){return new Promise(function(n,e){try{var t=w.validateId(s,"group");if(t instanceof K.CometChatException)return void e(t);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void e(o);T.makeApiCall("transferOwnership",{guid:s},{owner:r}).then(function(t){var e;e=t&&t.data&&t.data.message?t.data.message:"Ownership transferred to user "+r+" for the group with guid "+s+".",n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.createGroupWithMembers=function(i,a,E){var c=[],u=[],S=[],l=[];return new Promise(function(r,e){try{var t=w.validateCreateGroup(i);if(t instanceof K.CometChatException)return void e(t);if(a&&0<a.length){var n=w.validateArray(a,"groupMembers");if(n instanceof K.CometChatException)return void e(n);a.map(function(t){t.getScope()===b.GROUP_MEMBER_SCOPE.ADMIN&&c.push(t.getUid()),t.getScope()===b.GROUP_MEMBER_SCOPE.MODERATOR&&u.push(t.getUid()),t.getScope()===b.GROUP_MEMBER_SCOPE.PARTICIPANT&&S.push(t.getUid())})}if(E&&0<E.length){var o=w.validateArray(E,"bannedMembers");if(o instanceof K.CometChatException)return void e(o);E.map(function(t){l.push(t)})}var s={};s=p({},i),w.isFalsy(c)||(s.members=p(p({},s.members),{admins:c})),w.isFalsy(S)||(s.members=p(p({},s.members),{participants:S})),w.isFalsy(u)||(s.members=p(p({},s.members),{moderators:u})),w.isFalsy(l)||(s.members=p(p({},s.members),{usersToBan:l})),T.makeApiCall("createGroup",{},s).then(function(t){var e={members:{}},n=t.data.members.data?t.data.members.data:{admins:{},moderators:{},participants:{},usersToBan:{}};Object.keys(n.admins).map(function(t){n.admins[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?e.members[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:e.members[t]=n.admins[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.participants).map(function(t){n.participants[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?e.members[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:e.members[t]=n.participants[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.moderators).map(function(t){n.moderators[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?e.members[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:e.members[t]=n.moderators[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.usersToBan).map(function(t){n.usersToBan[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?e.members[t]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:e.members[t]=n.usersToBan[t][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),delete t.data.members;var o=t.data,s=A.GroupsController.trasformJSONGroup(o);s.setHasJoined(!0),e=p(p({},e),{group:s}),r(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.initiateCall=function(e){var s=this;return new Promise(function(n,o){var t=s.getActiveCall();if(null===t)try{w.isFalsy(JSON.parse(JSON.stringify(e)).sender)?w.isFalsy(t)?(e.setStatus(b.CallConstants.CALL_STATUS.INITIATED),e.receiver=e.receiverId.toString(),delete e.receiverId,T.makeApiCall("createCallSession",{},e).then(function(t){var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);B.CallController.getInstance().initiateCall(e).then(function(t){n(e)}).catch(function(t){o(new K.CometChatException(t))})},function(t){o(new K.CometChatException(t.error))})):o(new K.CometChatException(b.CALL_ERROR.ERROR_IN_CALLING)):B.CallController.getInstance().initiateCall(e).then(function(t){n(Object.assign(e))}).catch(function(t){o(new K.CometChatException(t))})}catch(t){o(new K.CometChatException(t))}else o(new K.CometChatException(b.CALL_ERROR.CALL_ALREADY_INITIATED))})},G.acceptCall=function(o){var s=this;return new Promise(function(n,e){if(null===s.getActiveCall())try{var t={};t[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.ONGOING,T.makeApiCall("updateCallSession",{sessionid:o},t).then(function(t){var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);B.CallController.getInstance().onCallStarted(e),n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}else e(new K.CometChatException(b.CALL_ERROR.CANNOT_ACCEPT_CALL))})},G.rejectCall=function(t,e){try{switch(e){case b.CallConstants.CALL_STATUS.REJECTED:return this.rejectIncomingCall(t);case b.CallConstants.CALL_STATUS.CANCELLED:return this.cancelCall(t);case b.CallConstants.CALL_STATUS.BUSY:return this.sendBusyResponse(t);default:return this.endCall(t,!0)}}catch(t){w.Logger.error("CometChat: rejectCall",t)}},G.endCall=function(s,r){var i=this;return new Promise(function(n,e){w.isFalsy(r)&&(r=!1);var o=i.getActiveCall();if(null!==o){if(o.getSessionId()===s)try{var t={};t[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.ENDED,o.getJoinedAt()&&(t[b.CallConstants.CALL_KEYS.CALL_JOINED_AT]=o.getJoinedAt()),T.makeApiCall("updateCallSession",{sessionid:s},t).then(function(t){r||B.CallController.getInstance().endSession();var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(e),B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onCallEnded(e),B.CallController.getInstance().endCall()},function(t){w.Logger.log("calling Log",{error:t}),r||B.CallController.getInstance().endSession(),o.setStatus(b.CallConstants.CALL_STATUS.ENDED),n(o),B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onCallEnded(o),B.CallController.getInstance().endCall()})}catch(t){e(new K.CometChatException(t))}}else r||B.CallController.getInstance().endSession(),n(null),B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null),B.CallController.getInstance().endCall()})},G.getActiveCall=function(){try{return B.CallController.getInstance().getActiveCall()}catch(t){w.Logger.error("CometChat: getActiveCall",t)}},G.startCall=function(o,s,r){var i=this;try{var a,E,c,u,S,l,p,C,T,d,_=this.getActiveCall(),g=!1,h=!0,A=!0,R=!0,I=!0,f=!0,O=!0,N=!1,y=!1,m=b.CallConstants.CALL_MODE.DEFAULT,L=!1,M=!1,v=!1,P=!0,D=!0,U={},Y=this.user;u=(new J.VirtualBackgroundBuilder).build(),S=new J.MainVideoContainerSetting,w.getAppSettings().then(function(t){if(C=t[b.APP_SETTINGS.KEYS.WEBRTC_HOST],U[b.APP_SETTINGS.KEYS.ANALYTICS_HOST]=t[b.APP_SETTINGS.KEYS.ANALYTICS_HOST],U[b.APP_SETTINGS.KEYS.ANALYTICS_VERSION]=t[b.APP_SETTINGS.KEYS.ANALYTICS_VERSION],U[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]=t[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],U[b.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL]=t[b.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL],l=t[b.APP_SETTINGS.KEYS.REGION],w.isFalsy(r)||B.CallController.getInstance().setCallListner(r),w.isFalsy(i.appSettings))B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_INITIALIZED));else if(l)if(Y)if((d=new H.RTCUser(Y.getUid())).setName(Y.getName()),d.setAvatar(Y.getAvatar()),d.setResource(G.getSessionId()),G.appId)if(p=G.appId,"string"==typeof o){if(_){var e=_.getType();g=e===b.CallConstants.CALL_TYPE.AUDIO,E=_.getSessionId()}else{if(w.isFalsy(o))return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));E=("v1."+l+"."+G.getAppId()+"."+o).toLowerCase()}if(!E)return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));P=!!g;var n={uid:Y.getUid(),sessionId:E};G.getJWT(n).then(function(t){t.hasOwnProperty("token")?(d.setJWT(t.token),a=(new J.CallSettingsBuilder).setSessionID(E).enableDefaultLayout(h).setIsAudioOnlyCall(g).setUser(d).setRegion(l).setAppId(p).setDomain(C).showEndCallButton(I).showMuteAudioButton(R).showPauseVideoButton(A).showScreenShareButton(f).showModeButton(O).setMode(m).setAnalyticsSettings(U).startWithAudioMuted(N).startWithVideoMuted(y).showRecordingButton(L).startRecordingOnCallStart(M).forceLegacyUI(v).showSwitchToVideoCallButton(P).setVirtualBackground(u).showVirtualBackgroundSetting(D).setMainVideoContainerSetting(S).build(),B.CallController.getInstance().startCall(a,s)):B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.JWT_NOT_FOUND))},function(t){B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(t))})}else{if(w.isFalsy(o))return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.CALL_SETTINGS_REQUIRED)));if(_){e=_.getType();g=e===b.CallConstants.CALL_TYPE.AUDIO,E=_.getSessionId()}else{if(g=o.isAudioOnlyCall(),w.isFalsy(o.getSessionId()))return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));E=("v1."+l+"."+G.getAppId()+"."+o.getSessionId()).toLowerCase()}if(!E)return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));h=o.isDefaultLayoutEnabled(),A=o.isPauseVideoButtonEnabled(),R=o.isMuteAudioButtonEnabled(),I=o.isEndCallButtonEnabled(),f=o.isScreenShareButtonEnabled(),m=o.getMode(),T=o.getLocalizedStringObject(),c=o.getCustomCSS(),O=o.isModeButtonEnabled(),N=o.getStartWithAudioMuted(),y=o.getStartWithVideoMuted(),L=o.isRecordingButtonEnabled(),M=o.shouldStartRecordingOnCallStart(),v=o.shouldUseLegacyUI(),P=!!g&&o.isAudioToVideoButtonEnabled(),u=o.getVirtualBackground(),D=o.isVirtualBackgroundSettingEnabled(),S=o.getMainVideoContainerSetting();n={uid:Y.getUid(),sessionId:E};G.getJWT(n).then(function(t){t.hasOwnProperty("token")?(d.setJWT(t.token),a=(new J.CallSettingsBuilder).setSessionID(E).enableDefaultLayout(h).setIsAudioOnlyCall(g).setUser(d).setRegion(l).setAppId(p).setDomain(C).showEndCallButton(I).showMuteAudioButton(R).showPauseVideoButton(A).showScreenShareButton(f).showModeButton(O).setMode(m).setLocalizedStringObject(T).setCustomCSS(c).setAnalyticsSettings(U).startWithAudioMuted(N).startWithVideoMuted(y).showRecordingButton(L).startRecordingOnCallStart(M).forceLegacyUI(v).showSwitchToVideoCallButton(P).setVirtualBackground(u).showVirtualBackgroundSetting(D).setMainVideoContainerSetting(S).build(),B.CallController.getInstance().startCall(a,s)):B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.JWT_NOT_FOUND))},function(t){B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(t))})}else B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_INITIALIZED));else B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_LOGGED_IN));else B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_INITIALIZED))},function(t){w.Logger.error("CometChat: startCall",t)})}catch(t){w.Logger.error("CometChat: startCall",t)}},G.getCallParticipantCount=function(E,c){return new Promise(function(i,a){try{w.getAppSettings().then(function(t){if(w.isFalsy(E))return a(new K.CometChatException(b.ProsodyApiErrors.INVALID_SESSIONID));if(w.isFalsy(c))return a(new K.CometChatException(b.ProsodyApiErrors.INVALID_TYPE));var e=t[b.APP_SETTINGS.KEYS.REGION],n={},o=t[b.APP_SETTINGS.KEYS.WEBRTC_HOST],s=t[b.APP_SETTINGS.KEYS.WEBRTC_API_SUBDOMAIN],r=w.format((new u.EndpointFactory).prosodyApi,s,o,b.PROSODY_API.PATH.ROOM_SIZE);"direct"===c.toLowerCase()&&(E=("v1."+e+"."+G.getAppId()+"."+E).toLowerCase()),n[b.PROSODY_API.QUERY_PARAMETERS.DOMAIN]=o,n[b.PROSODY_API.QUERY_PARAMETERS.ROOM]=E,T.postData(r,"GET",n,{},!1).then(function(t){return t.text()}).then(function(t){var e=t?JSON.parse(t):{};return e.hasOwnProperty(b.PROSODY_API.RESPONSE.PARTICIPANTS)?i(e[b.PROSODY_API.RESPONSE.PARTICIPANTS]):i(0)}).catch(function(){var t={error:R.FETCH_ERROR.ERROR_IN_API_CALL};return a(t)})},function(t){return a(new K.CometChatException(t))})}catch(t){return a(new K.CometChatException(t))}})},G.rejectIncomingCall=function(o){return new Promise(function(n,e){try{var t={};t[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.REJECTED,T.makeApiCall("updateCallSession",{sessionid:o},t).then(function(t){var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.cancelCall=function(o){var s=this;return new Promise(function(n,e){try{var t={};t[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.CANCELLED,T.makeApiCall("updateCallSession",{sessionid:o},t).then(function(t){var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);s.getActiveCall().getSessionId()===o&&B.CallController.getInstance().endCallSession(),n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.sendBusyResponse=function(o){return new Promise(function(n,e){try{var t={};t[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.BUSY,T.makeApiCall("updateCallSession",{sessionid:o},t).then(function(t){var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.sendUnansweredResponse=function(o){return new Promise(function(n,e){try{var t={};t[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.UNANSWERED,T.makeApiCall("updateCallSession",{sessionid:o},t).then(function(t){var e=g.MessageController.trasformJSONMessge(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);$.publishCallMessage(e),n(e)},function(t){e(new K.CometChatException(t.error))})}catch(t){e(new K.CometChatException(t))}})},G.addConnectionListener=function(t,e){try{tt.addConnectionEventListener(t,e)}catch(t){w.Logger.error("CometChat: addConnectionListener",t)}},G.removeConnectionListener=function(t){try{tt.removeConnectionEventListener(t)}catch(t){w.Logger.error("CometChat: removeConnectionListener",t)}},G.addMessageListener=function(t,e){try{tt.addMessageEventListener(t,e)}catch(t){w.Logger.error("CometChat: addMessageListener",t)}},G.removeMessageListener=function(t){try{tt.removeMessageEventListener(t)}catch(t){w.Logger.error("CometChat: removeMessageListener",t)}},G.addCallListener=function(t,e){try{tt.addCallEventListener(t,e)}catch(t){w.Logger.error("CometChat: addCallListener",t)}},G.removeCallListener=function(t){try{tt.removeCallEventListener(t)}catch(t){w.Logger.error("CometChat: removeCallListener",t)}},G.addUserListener=function(t,e){try{tt.addUserEventListener(t,e)}catch(t){w.Logger.error("CometChat: addUserListener",t)}},G.removeUserListener=function(t){try{tt.removeUserEventListener(t)}catch(t){w.Logger.error("CometChat: removeUserListener",t)}},G.addGroupListener=function(t,e){try{tt.addGroupEventListener(t,e)}catch(t){w.Logger.error("CometChat: addGroupListener",t)}},G.removeGroupListener=function(t){try{tt.removeGroupEventListener(t)}catch(t){w.Logger.error("CometChat: removeGroupListener",t)}},G.addLoginListener=function(t,e){try{tt.addLoginEventListener(t,e)}catch(t){w.Logger.error("CometChat: addLoginListener",t)}},G.removeLoginListener=function(t){try{tt.removeLoginEventListener(t)}catch(t){w.Logger.error("CometChat: removeLoginListener",t)}},G.generateAuthToken=function(S){var l=this;return new Promise(function(o,s){try{var r={},i="",a="",E=b.APPINFO.platform,c=b.APPINFO.sdkVersion,u=b.APPINFO.apiVersion;navigator&&(a=navigator.userAgent),G.keyStore.get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(t){if(null==(i=t)){var e=Z(),n=(new Date).getTime();i=l.appId+"_"+e+"_"+n,G.keyStore.set(b.LOCAL_STORE.KEY_DEVICE_ID,i)}r={platform:E,deviceId:i,appInfo:{version:c,apiVersion:u,userAgent:a}},T.makeApiCall("authToken",{uid:S},r).then(function(t){o(t.data)}).catch(function(t){s(new K.CometChatException(t.error))})},function(t){w.Logger.error("Got error while fetching data from key store",t)})}catch(t){s(new K.CometChatException(t))}})},G.tryReconnectingToWS=function(){G.WSReconnectionInProgress||G.startWSReconnectionTimer()},G.prototype.makeWSConnection=function(){G.WSLogin(G.user)},G.prototype.accidentallyDisconnected=function(){G.currentConnectionStatus=b.CONNECTION_STATUS.CONNECTING,tt.connectionHandlers.map(function(t){try{t._eventListener&&(w.isFalsy(t._eventListener.inConnecting)||t._eventListener.inConnecting())}catch(t){w.Logger.error("ConnectionHandlers: inConnecting Status",t)}}),G.tryReconnectingToWS()},G.WSLogin=function(t){var n=this;$.connection?w.Logger.error("CometChat :: WSLogin",$.connection):$.WSLogin(t.getJWT(),function(t){switch(t){case j.READY_STATE.CONNECTING:(e=G.getConnectionStatus())==b.CONNECTION_STATUS.DISCONNECTED&&(n.currentConnectionStatus=b.CONNECTION_STATUS.CONNECTING,tt.connectionHandlers.map(function(t){try{t._eventListener&&(w.isFalsy(t._eventListener.inConnecting)||t._eventListener.inConnecting())}catch(t){w.Logger.error("connectionHandlers: Connecting Status",t)}}));break;case j.READY_STATE.OPEN:(e=G.getConnectionStatus())==b.CONNECTION_STATUS.CONNECTING&&(n.currentConnectionStatus=b.CONNECTION_STATUS.CONNECTED,tt.connectionHandlers.map(function(t){try{t._eventListener&&(w.isFalsy(t._eventListener.onConnected)||t._eventListener.onConnected())}catch(t){w.Logger.error("connectionHandlers: Connected Status",t)}})),G.WSReconnectionInProgress&&G.clearWSReconnectionTimer();break;case j.READY_STATE.CLOSING:break;case j.READY_STATE.CLOSED:var e;(e=G.getConnectionStatus())!==b.CONNECTION_STATUS.DISCONNECTED&&e!==b.CONNECTION_STATUS.CONNECTING&&(n.currentConnectionStatus=b.CONNECTION_STATUS.DISCONNECTED,tt.connectionHandlers.map(function(t){try{t._eventListener&&(w.isFalsy(t._eventListener.onDisconnected)||t._eventListener.onDisconnected())}catch(t){w.Logger.error("connectionHandlers: Disconnected Status",t)}})),$.connection&&($.connection=null),G.isLoggedOut||G.disconnectedByUser||n.tryReconnectingToWS()}})},G.pingAnalytics=function(){var c=this;try{G.keyStore.get("deviceId").then(function(E){w.getAppSettings().then(function(t){var e=null;window&&window.location&&window.location.origin&&(e=window.location.origin);var n="",o=E,s={version:b.SDKHeader.sdkVersion,apiVersion:t[b.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:e,uts:(new Date).getTime()};w.isFalsy(c.resource)||(s.resource=c.resource),w.isFalsy(c.platform)||(s.platform=c.platform),w.isFalsy(c.language)||(s.language=c.language),navigator&&(n=navigator.userAgent);var r={appInfo:s,uid:G.user.getUid(),userAgent:n,deviceId:o,platform:b.SDKHeader.platform};w.isFalsy(G.getSessionId())||(r.wsId=G.getSessionId());var i="https://"+t[b.APP_SETTINGS.KEYS.ANALYTICS_HOST]+"/"+t[b.APP_SETTINGS.KEYS.ANALYTICS_VERSION]+"/ping",a={appId:G.appId,sdk:w.format(b.SDKHeader.sdk,b.SDKHeader.platform,b.SDKHeader.sdkVersion),"Content-Type":"application/json"};G.settingsHash&&(a.settingsHash=G.settingsHash),G.settingsHashReceivedAt&&(a.settingsHashReceivedAt=G.settingsHashReceivedAt),G.jwt&&(a.Authorization="Bearer "+G.jwt),G.authToken&&(a.authToken=G.authToken),T.postData(i,"POST",r,a,!1).then(function(t){return t.json()}).then(function(t){if(t.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA))w.Logger.log("Analytics Ping Request Data",t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);else if(t.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_ERROR)){var e=t[b.ResponseConstants.RESPONSE_KEYS.KEY_ERROR];w.Logger.log("Analytics Ping Request Error",new K.CometChatException(e));var n=e.code;if(n===b.Errors.ERR_SETTINGS_HASH_OUTDATED){var o=G.authToken;G.getInstance().internalRestart(o)}n===b.Errors.ERR_NO_AUTH&&c.updateJWT()}}).catch(function(t){w.Logger.error("CometChat: pingAnalytics Fetch Error",t)})},function(t){w.Logger.error("CometChat: pingAnalytics getSettings Error",t)})},function(t){w.Logger.error("CometChat: pingAnalytics getDeviceId Error",t)})}catch(t){w.Logger.error("CometChat: pingAnalytics",t)}},G.updateJWT=function(){T.makeApiCall("getMyDetails",{},{},!1).then(function(t){var e=t.data,n=e.settings,o=new C.Me(e);if(e.hasOwnProperty("jwt")&&e.jwt&&(G.jwt=e.jwt),d.LocalStorage.getInstance().set("user",o),n&&n[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&G.settingsHash!==n[b.APP_SETTINGS.KEYS.SETTINGS_HASH]){var s=G.getInstance().getAuthToken();G.getInstance().internalRestart(s)}w.Logger.log("CometChat: updateJWT response",t)},function(t){w.Logger.error("CometChat: updateJWT Fetch Error",t)}).catch(function(t){w.Logger.error("CometChat: updateJWT",t)})},G.startAnalyticsPingTimer=function(){var t=this;G.isAnalyticsPingStarted=!0,G.analyticsPingTimer=setInterval(function(){try{t.pingAnalytics()}catch(t){w.Logger.error("CometChat: startAnalyticsPingTimer",t)}},G.settingsInterval)},G.clearAnalyticsPingTimer=function(){try{G.isAnalyticsPingStarted=!1,clearInterval(G.analyticsPingTimer)}catch(t){w.Logger.error("CometChat: clearAnalyticsPingTimer",t)}},G.startWSReconnectionTimer=function(){G.WSReconnectionInProgress=!0,G.WSReconnectionTimer=setInterval(function(){try{G.WSLogin(G.user)}catch(t){w.Logger.error("CometChat: startWSReconnectionTimer",t)}},G.WSReconnectionTimerInterval)},G.clearWSReconnectionTimer=function(){G.WSReconnectionInProgress=!1,clearInterval(G.WSReconnectionTimer)},G.getJWT=function(r){return new Promise(function(o,s){try{q.getEndPoint("getJWT").then(function(t){var e={appId:G.appId,Accept:"application/json",authToken:G.authToken,resource:G.getSessionId(),sdk:w.format(b.SDKHeader.sdk,b.SDKHeader.platform,b.SDKHeader.sdkVersion),"Content-Type":"application/json"},n={};n[b.JWT_API.KEYS.PASSTHROUGH]=r,T.postData(t.endpoint,t.method,n,e,!1).then(function(t){return t.json()}).then(function(t){t.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):s(new K.CometChatException(t.error))}).catch(function(t){var e={error:R.FETCH_ERROR.ERROR_IN_API_CALL};s(new K.CometChatException(e))})},function(t){s(new K.CometChatException(t))})}catch(t){s(new K.CometChatException(t))}})},G.getConnectionStatus=function(){return this.currentConnectionStatus},G.prototype.setConnectionStatus=function(t){G.currentConnectionStatus=t},G.isExtensionEnabled=function(r){return new Promise(function(o,s){try{if(w.isFalsy(r))return s(new K.CometChatException(b.ExtensionErrors.INVALID_EXTENSION));w.getAppSettings().then(function(t){if(t.extensions){var e=t.extensions;if(0<e.length){var n=e.some(function(t){return t.id===r});return o(n)}return o(!1)}return s(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))},function(t){return s(new K.CometChatException(t))})}catch(t){return s(new K.CometChatException(t))}})},G.getExtensionDetails=function(i){return new Promise(function(s,r){try{if(w.isFalsy(i))return r(new K.CometChatException(b.ExtensionErrors.INVALID_EXTENSION));w.getAppSettings().then(function(t){if(t.extensions){var e=t.extensions;if(0<e.length){var n=e.filter(function(t){return t.id===i});if(0<n.length){var o=new X.CCExtension(n[0]);return s(o)}return r(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))}return r(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))}return r(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))},function(t){return r(new K.CometChatException(t))})}catch(t){return r(new K.CometChatException(t))}})},G.getAppSettings=function(){return new Promise(function(e,n){try{T.makeApiCall("appSettings").then(function(t){d.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_SETTINGS,t.data),e(t.data)},function(t){n(new K.CometChatException(t.error))})}catch(t){n(new K.CometChatException(t))}})},G.isFeatureEnabled=function(s){return new Promise(function(n,o){try{if(w.isFalsy(s))return o(new K.CometChatException(b.FeatureRestrictionErrors.INVALID_FEATURE));w.getAppSettings().then(function(t){if(t.parameters){var e=t.parameters;return e.hasOwnProperty(s)?n(e[s]):n(!1)}return o(new K.CometChatException(b.FeatureRestrictionErrors.FEATURE_NOT_FOUND))},function(t){return o(new K.CometChatException(t))})}catch(t){return o(new K.CometChatException(t))}})},G.logout=function(){var o=this;return new Promise(function(e,n){try{G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),G.WSReconnectionInProgress&&G.clearWSReconnectionTimer(),G.isLoggedOut=!0,G.WSReconnectionInProgress=!1,G.isAnalyticsDisabled=!1,T.makeApiCall("userLogout").then(function(t){o.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,$.WSLogout(),G.pushToLoginListener("","Logout_Success"),e(t.data)})},function(t){o.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,$.WSLogout(),G.pushToLoginListener("","Logout_Success"),new K.CometChatException(t.error).code==R.SERVER_ERRORS.AUTH_ERR.code?e({}):n(new K.CometChatException(t.error))})})}catch(t){n(new K.CometChatException(t))}})},G.callExtension=function(r,i,a,E){return void 0===E&&(E={}),new Promise(function(o,s){try{w.getAppSettings().then(function(t){var e=w.format((new u.EndpointFactory).extensionApi,r,t[b.APP_SETTINGS.KEYS.REGION],t[b.APP_SETTINGS.KEYS.EXTENSION_DOMAIN],a),n={appId:G.appId,Accept:"application/json",authToken:G.authToken,resource:G.getSessionId(),sdk:w.format(b.SDKHeader.sdk,b.SDKHeader.platform,b.SDKHeader.sdkVersion),chatApiVersion:t[b.APP_SETTINGS.KEYS.CHAT_API_VERSION],"Content-Type":"application/json"};T.postData(e,i,E,n,!1).then(function(t){return t.json()}).then(function(t){t.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(t[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):s(new K.CometChatException(t.error))}).catch(function(t){var e={error:R.FETCH_ERROR.ERROR_IN_API_CALL};s(e)})},function(t){return s(new K.CometChatException(t))})}catch(t){return s(new K.CometChatException(t))}})},G.setSource=function(t,e,n){w.isFalsy(t)||(this.resource=t),w.isFalsy(e)||(this.platform=e),w.isFalsy(n)||(this.language=n)},G.clearCache=function(){return new Promise(function(t,e){try{d.LocalStorage.getInstance().clearStore().then(function(){G.removeDataFromSessionStorage(b.SESSION_STORE.SESSION_ID),w.Logger.info("CometChat: clearCache => All store cleared successfully","true"),t(!0)})}catch(t){w.Logger.error("CometChat: clearCache",t),e(t)}})},G.connect=function(){G.user&&($.connection||(G.disconnectedByUser=!1,G.WSLogin(G.user)),G.didAnalyticsPingStart()||G.isAnalyticsDisabled||(G.pingAnalytics(),G.startAnalyticsPingTimer()))},G.disconnect=function(){G.user&&(G.disconnectedByUser=!0,$.connection&&$.WSLogout(),G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer())},G.prototype.internalRestart=function(t){G.internalRestart||G.getInstance().internalLogout(!1).then(function(){G.internalRestart=!0,G.login(t).then(function(t){G.shouldConnectToWS=!0,G.internalRestart=!1},function(t){w.Logger.error("CometChat: internalRestart :: login",t),G.internalRestart=!1})},function(t){w.Logger.error("CometChat: internalRestart :: internalLogout",t)})},G.prototype.internalLogout=function(n){return void 0===n&&(n=!0),new Promise(function(t,e){try{G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),G.WSReconnectionInProgress&&G.clearWSReconnectionTimer(),G.isLoggedOut=!0,G.WSReconnectionInProgress=!1,G.isAnalyticsDisabled=!1,G.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,$.WSLogout(),n&&G.pushToLoginListener("","Logout_Success"),t(!0)})}catch(t){w.Logger.error("CometChat: internalLogout",t),e(t)}})},G.initialzed=!1,G.CometChatException=K.CometChatException,G.TextMessage=_.TextMessage,G.MediaMessage=S.MediaMessage,G.CustomMessage=P.CustomMessage,G.Action=i.Action,G.Call=s.Call,G.TypingIndicator=M.TypingIndicator,G.TransientMessage=z.TransientMessage,G.Group=a.Group,G.User=C.User,G.GroupMember=D.GroupMember,G.Conversation=V.Conversation,G.USER_STATUS={ONLINE:b.PresenceConstatnts.STATUS.ONLINE,OFFLINE:b.PresenceConstatnts.STATUS.OFFLINE},G.MessagesRequest=m.MessagesRequest,G.MessagesRequestBuilder=m.MessagesRequestBuilder,G.UsersRequest=N.UsersRequest,G.UsersRequestBuilder=N.UsersRequestBuilder,G.ConversationsRequest=y.ConversationsRequest,G.ConversationsRequestBuilder=y.ConversationsRequestBuilder,G.BlockedUsersRequest=U.BlockedUsersRequest,G.BlockedUsersRequestBuilder=U.BlockedUsersRequestBuilder,G.GroupsRequest=I.GroupsRequest,G.GroupsRequestBuilder=I.GroupsRequestBuilder,G.GroupMembersRequest=f.GroupMembersRequest,G.GroupMembersRequestBuilder=f.GroupMembersRequestBuilder,G.BannedMembersRequest=O.BannedMembersRequest,G.BannedMembersRequestBuilder=O.BannedMembersRequestBuilder,G.CallSettings=J.CallSettings,G.CallSettingsBuilder=J.CallSettingsBuilder,G.MainVideoContainerSetting=J.MainVideoContainerSetting,G.VirtualBackground=J.VirtualBackground,G.VirtualBackgroundBuilder=J.VirtualBackgroundBuilder,G.AppSettings=Y.AppSettings,G.AppSettingsBuilder=Y.AppSettingsBuilder,G.MessageListener=o.MessageListener,G.UserListener=o.UserListener,G.GroupListener=o.GroupListener,G.OngoingCallListener=o.OngoingCallListener,G.CallListener=o.CallListener,G.ConnectionListener=o.ConnectionListener,G.LoginListener=o.LoginListener,G.CallController=B.CallController,G.CometChatHelper=F.CometChatHelper,G.Attachment=k.Attachment,G.MediaDevice=Q.MediaDevice,G.MESSAGE_TYPE=b.MessageConstatnts.TYPE,G.CATEGORY_MESSAGE=b.MessageConstatnts.CATEGORY.MESSAGE,G.CATEGORY_ACTION=b.MessageConstatnts.CATEGORY.ACTION,G.CATEGORY_CALL=b.MessageConstatnts.CATEGORY.CALL,G.CATEGORY_CUSTOM=b.MessageConstatnts.CATEGORY.CUSTOM,G.ACTION_TYPE=b.ActionConstatnts.ACTIONS,G.CALL_TYPE=b.CallConstants.CALL_TYPE,G.RECEIVER_TYPE=b.MessageConstatnts.RECEIVER_TYPE,G.CALL_STATUS=b.CallConstants.CALL_STATUS,G.GROUP_MEMBER_SCOPE=b.GROUP_MEMBER_SCOPE,G.GROUP_TYPE=b.GROUP_TYPE,G.MESSAGE_REQUEST=b.MessageConstatnts.PAGINATION.CURSOR_FILEDS,G.CONNECTION_STATUS=b.CONNECTION_STATUS,G.CALL_MODE=b.CallConstants.CALL_MODE,G.SORT_BY=b.UserConstants.SORT_BY,G.SORT_ORDER=b.UserConstants.SORT_ORDER,G.WSReconnectionInProgress=!1,G.WSReconnectionTimerInterval=5e3,G.currentConnectionStatus=b.CONNECTION_STATUS.DISCONNECTED,G.isConnectingFromInit=!1,G.loginInProgress=!1,G.internalRestart=!1,G.settingsInterval=6e4,G.isAnalyticsPingStarted=!1,G.isLoggedOut=!0,G.isAnalyticsDisabled=!1,G.disconnectedByUser=!1,G.shouldConnectToWS=!0,G}();e.CometChat=et},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.Me=e.User=void 0;var r=n(2),i=n(13),a=n(1),E=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.hasBlockedMe=!1,this.blockedByMe=!1,this.deactivatedAt=0,1===t.length)typeof t[0]===a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?this.uid=t[0]:(this.uid=t[0].uid,this.name=t[0].name,t[0].authToken&&(this.authToken=t[0].authToken),t[0].avatar&&(this.avatar=t[0].avatar),t[0].lastActiveAt&&(this.lastActiveAt=t[0].lastActiveAt),t[0].link&&(this.link=t[0].link),t[0].metadata&&(this.metadata=t[0].metadata),t[0].role&&(this.role=t[0].role),t[0].statusMessage&&(this.statusMessage=t[0].statusMessage),t[0].status&&"offline"!==t[0].status?this.status="online":this.status="offline",t[0].tags&&(this.tags=t[0].tags),t[0].deactivatedAt&&(this.deactivatedAt=t[0].deactivatedAt));else{if(2!==t.length)throw new r.CometChatException(i.ERRORS.PARAMETER_MISSING);this.uid=t[0],this.name=t[1]}}return t.prototype.getUid=function(){return this.uid.toString()},t.prototype.setUid=function(t){this.uid=t},t.prototype.getName=function(){return this.name.toString()},t.prototype.setName=function(t){t&&(this.name=t)},t.prototype.getAuthToken=function(){return this.authToken},t.prototype.setAuthToken=function(t){this.authToken=t},t.prototype.getAvatar=function(){return this.avatar},t.prototype.setAvatar=function(t){this.avatar=t},t.prototype.getLastActiveAt=function(){return this.lastActiveAt},t.prototype.setLastActiveAt=function(t){this.lastActiveAt=t},t.prototype.getLink=function(){return this.link},t.prototype.setLink=function(t){return this.link=t},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(t){this.metadata=t},t.prototype.getRole=function(){return this.role},t.prototype.setRole=function(t){this.role=t},t.prototype.getStatus=function(){return this.status},t.prototype.setStatus=function(t){this.status=t},t.prototype.getStatusMessage=function(){return this.statusMessage},t.prototype.setStatusMessage=function(t){this.statusMessage=t},t.prototype.setBlockedByMe=function(t){this.blockedByMe=t},t.prototype.getBlockedByMe=function(){return this.blockedByMe},t.prototype.setHasBlockedMe=function(t){this.hasBlockedMe=t},t.prototype.getHasBlockedMe=function(){return this.hasBlockedMe},t.prototype.setTags=function(t){this.tags=t},t.prototype.getTags=function(){return this.tags},t.prototype.setDeactivatedAt=function(t){this.deactivatedAt=t},t.prototype.getDeactivatedAt=function(){return this.deactivatedAt},t}(),c=function(n){function t(t){var e=n.call(this,t)||this;return e.wsChannel=t.wsChannel,t.jwt&&(e.jwt=t.jwt),e}return s(t,n),t.prototype.getWsChannel=function(){return this.wsChannel},t.prototype.getJWT=function(){return this.jwt},t}(e.User=E);e.Me=c},function(t,e,n){"use strict";e.__esModule=!0,e.KEYS=e.AUTH=e.MESSAGE=e.PRESENCE=e.RECEIPTS=e.TRANSIENT_MESSAGE=e.TYPING_INDICATOR=e.LOGOUT_REASON=e.LOGOUT_CODE=e.READY_STATE=e.WS=void 0,e.WS={protocol:"wss://"},e.READY_STATE={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3,INVALID_JWT:4},e.LOGOUT_CODE=1e3,e.LOGOUT_REASON="User logged out",e.TYPING_INDICATOR={TYPE:"typing_indicator",ACTION:{STARTED:"started",ENDED:"ended"}},e.TRANSIENT_MESSAGE={TYPE:"transient_message"},e.RECEIPTS={TYPE:"receipts",ACTION:{READ:"read",DELIVERED:"delivered"},RECEIPT_TYPE:{READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery"}},e.PRESENCE={TYPE:"presence",ACTION:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline"}},e.MESSAGE={TYPE:"message"},e.AUTH={TYPE:"auth"},e.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"}},function(t,e,n){"use strict";e.__esModule=!0,e.postData=e.makeAdminApiCall=e.makeApiCall=void 0;var E=n(29),c=n(3),u=n(0),S=n(2),l=n(13),p=n(1);function C(n,t,o,e,s){var r;return void 0===n&&(n=""),void 0===t&&(t="GET"),void 0===o&&(o={}),void 0===e&&(e={}),o=u.isFalsy(o)?void 0:("GET"==t&&(n+="?",Object.keys(o).map(function(t,e){n=e===Object.keys(o).length-1?n+t+"="+o[t]:n+t+"="+o[t]+"&"}),o=void 0),s&&(r=new FormData,Object.keys(o).map(function(t){if("data"!=t){if("tags"==t)r.append(t+"[]",o[t]);else if("metadata"!=t)if("files"===t)for(var e=0;e<o[t].length;e++)r.append(t+"[]",o[t][e]);else r.append(t,o[t])}else r.append(t,JSON.stringify(o[t]))})),JSON.stringify(o)),fetch(n,{method:t,mode:"cors",cache:"no-cache",headers:e,redirect:"follow",referrer:"no-referrer",body:s?r:o})}e.makeApiCall=function(s,t,r,i){void 0===s&&(s=""),void 0===t&&(t={}),void 0===r&&(r={});var a=c.CometChat.getInstance(c.CometChat.getAppId());return new Promise(function(n,o){try{E.getEndPoint(s,t).then(function(t){var e={resource:c.CometChat.getSessionId(),appId:c.CometChat.getAppId(),Accept:"application/json",sdk:u.format(p.SDKHeader.sdk,p.SDKHeader.platform,p.SDKHeader.sdkVersion)};i||(e["Content-Type"]="application/json"),t.hasOwnProperty("isAdminApi")&&t.isAdminApi?a.getApiKey()?e.apiKey=a.getApiKey():o({error:{code:"API_KEY_NOT_SET",message:"An apiKey is needed to use the "+s+" api.",name:"API_KEY_NOT_SET"}}):a.getAuthToken()?e.authToken=a.getAuthToken():o({error:{code:"USER_NOT_LOGED_IN",message:"An authToken is need to use the "+s+" 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"}}),C(t.endpoint,t.method,r,e,i).then(function(t){return t.json()}).then(function(t){if(t.hasOwnProperty("data"))t.data.hasOwnProperty("authToken")&&c.CometChat.setAuthToken(t.data.authToken),n(t);else{if(t.hasOwnProperty("error")){var e=t.error;e.hasOwnProperty("code")&&e.code===p.API_ERROR_CODES.AUTH_ERR_AUTH_TOKEN_NOT_FOUND&&c.CometChat.getInstance().internalLogout().then(function(){u.Logger.log("CometChat: makeApiCall","User logged out")})}o(t)}}).catch(function(t){var e={error:l.FETCH_ERROR.ERROR_IN_API_CALL};o(e)})}).catch(function(t){return o})}catch(t){o(new S.CometChatException(t))}})},e.makeAdminApiCall=function(s,t,r,i){void 0===s&&(s=""),void 0===t&&(t={}),void 0===r&&(r={});var a=c.CometChat.getInstance(c.CometChat.getAppId());return new Promise(function(n,o){E.getEndPoint(s,t).then(function(t){var e={appId:c.CometChat.getAppId(),Accept:"application/json",sdk:u.format(p.SDKHeader.sdk,p.SDKHeader.platform,p.SDKHeader.sdkVersion)};i||(e["Content-Type"]="application/json"),t.hasOwnProperty("isAdminApi")&&t.isAdminApi?a.getApiKey()?e.apiKey=a.getApiKey():o({error:"An apiKey is need to use the "+s+" api."}):a.getAuthToken()?e.authToken=a.getAuthToken():o({error:"An authToken is need to use the "+s+" api."}),C(t.endpoint,t.method,r,e,i).then(function(t){return t.json()}).then(function(t){t.hasOwnProperty("data")?(t.data.hasOwnProperty("authToken")&&c.CometChat.setAuthToken(t.data.authToken),n(t)):o(t)}).catch(function(t){var e={error:l.FETCH_ERROR.ERROR_IN_API_CALL};o(e)})}).catch(function(t){return o})})},e.postData=C},function(t,e,n){"use strict";e.__esModule=!0,e.BaseMessage=void 0;var o=function(){function t(t,e,n,o){this.receiverId=t,this.type=e,this.receiverType=n,this.category=o}return t.prototype.getId=function(){return this.id},t.prototype.setId=function(t){this.id=t},t.prototype.getConversationId=function(){return this.conversationId},t.prototype.setConversationId=function(t){this.conversationId=t},t.prototype.getParentMessageId=function(){return this.parentMessageId},t.prototype.setParentMessageId=function(t){this.parentMessageId=t},t.prototype.getMuid=function(){return this.muid},t.prototype.setMuid=function(t){this.muid=t},t.prototype.getSender=function(){return this.sender},t.prototype.setSender=function(t){this.sender=t},t.prototype.getReceiver=function(){return this.receiver},t.prototype.setReceiver=function(t){this.receiver=t},t.prototype.getReceiverId=function(){return this.receiverId},t.prototype.setReceiverId=function(t){this.receiverId=t},t.prototype.getType=function(){return this.type},t.prototype.setType=function(t){this.type=t},t.prototype.getReceiverType=function(){return this.receiverType},t.prototype.setReceiverType=function(t){this.receiverType=t},t.prototype.getSentAt=function(){return this.sentAt},t.prototype.setSentAt=function(t){this.sentAt=t},t.prototype.getStatus=function(){return this.status},t.prototype.setStatus=function(t){this.status=t},t.prototype.getDeliveredAt=function(){return this.deliveredAt},t.prototype.setDeliveredAt=function(t){this.deliveredAt=t},t.prototype.getDeliveredToMeAt=function(){return this.deliveredToMeAt},t.prototype.setDeliveredToMeAt=function(t){this.deliveredToMeAt=t},t.prototype.getReadAt=function(){return this.readAt},t.prototype.setReadAt=function(t){this.readAt=t},t.prototype.getReadByMeAt=function(){return this.readByMeAt},t.prototype.setReadByMeAt=function(t){this.readByMeAt=t},t.prototype.getCategory=function(){return this.category},t.prototype.setCategory=function(t){this.category=t},t.prototype.getEditedAt=function(){return this.editedAt},t.prototype.setEditedAt=function(t){this.editedAt=t},t.prototype.getEditedBy=function(){return this.editedBy},t.prototype.setEditedBy=function(t){this.editedBy=t},t.prototype.getDeletedAt=function(){return this.deletedAt},t.prototype.setDeletedAt=function(t){this.deletedAt=t},t.prototype.getDeletedBy=function(){return this.deletedBy},t.prototype.setDeletedBy=function(t){this.deletedBy=t},t.prototype.getReplyCount=function(){return this.replyCount},t.prototype.setReplyCount=function(t){this.replyCount=t},t.prototype.getRawMessage=function(){return this.rawMessage},t.prototype.setRawMessage=function(t){this.rawMessage=t},t}();e.BaseMessage=o},function(t,e,n){"use strict";e.__esModule=!0,e.Group=void 0;var o=n(1),s=function(){function t(t,e,n,o,s,r,i){this.hasJoined=!1,this.membersCount=0,this.guid=t,e&&(this.name=e),n&&(this.type=n),!o&&""!==o||"password"!=n||(this.password=o),(s||""===s)&&(this.icon=s),(r||""===r)&&(this.description=r),i&&(this.hasJoined=i)}return t.prototype.getGuid=function(){return this.guid},t.prototype.setGuid=function(t){this.guid=t},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){t&&(this.name=t)},t.prototype.getType=function(){return this.type},t.prototype.setType=function(t){this.type=t},t.prototype.getPassword=function(){return this.password},t.prototype.setPassword=function(t){this.password=t},t.prototype.getIcon=function(){return this.icon},t.prototype.setIcon=function(t){this.icon=t},t.prototype.getDescription=function(){return this.description},t.prototype.setDescription=function(t){this.description=t},t.prototype.getOwner=function(){return this.owner},t.prototype.setOwner=function(t){this.owner=t},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(t){this.metadata=t},t.prototype.getCreatedAt=function(){return this.createdAt},t.prototype.setCreatedAt=function(t){this.createdAt=t},t.prototype.getUpdatedAt=function(){return this.updatedAt},t.prototype.setUpdatedAt=function(t){this.updatedAt=t},t.prototype.getHasJoined=function(){return this.hasJoined},t.prototype.setHasJoined=function(t){this.hasJoined=t},t.prototype.getWsChannel=function(){return this.wsChannel},t.prototype.setWsChannel=function(t){this.wsChannel=t},t.prototype.setScope=function(t){this.scope=t},t.prototype.getScope=function(){return this.scope},t.prototype.getJoinedAt=function(){return this.joinedAt},t.prototype.setJoinedAt=function(t){this.joinedAt=t},t.prototype.getMembersCount=function(){return this.membersCount},t.prototype.setMembersCount=function(t){this.membersCount=t},t.prototype.setTags=function(t){this.tags=t},t.prototype.getTags=function(){return this.tags},t.TYPE=o.GroupType,t.Type=t.TYPE,t}();e.Group=s},function(t,e,n){"use strict";e.__esModule=!0,e.CometChatEvent=void 0;var i=n(0),o=n(5),s=function(){function t(t,e,n,o,s,r){i.isFalsy(t)||(this.appId=t),i.isFalsy(e)||(this.receiver=e),i.isFalsy(n)||(this.receiverType=n),i.isFalsy(s)||(this.deviceId=s),i.isFalsy(o)||(this.sender=o),i.isFalsy(r)||(this.messageSender=r)}return t.prototype.getAppId=function(){return this.appId},t.prototype.setAppId=function(t){this.appId=t},t.prototype.getReceiver=function(){return this.receiver},t.prototype.setReceiver=function(t){this.receiver=t},t.prototype.getSender=function(){return this.sender},t.prototype.setSender=function(t){this.sender=t},t.prototype.getReceiverType=function(){return this.receiverType},t.prototype.setReceiverType=function(t){this.receiverType=t},t.prototype.getType=function(){return this.type},t.prototype.setType=function(t){this.type=t},t.prototype.getDeviceId=function(){return this.deviceId},t.prototype.setDeviceId=function(t){this.deviceId=t},t.prototype.getMessageSender=function(){return this.messageSender},t.prototype.setMessageSender=function(t){this.messageSender=t},t.prototype.getCometChatEventJSON=function(){var t={};return t[o.KEYS.APP_ID]=this.getAppId(),t[o.KEYS.RECEIVER]=this.getReceiver(),t[o.KEYS.RECEIVER_TYPE]=this.getReceiverType(),t[o.KEYS.DEVICE_ID]=this.getDeviceId(),t[o.KEYS.TYPE]=this.getType(),t[o.KEYS.SENDER]=this.getSender(),i.isFalsy(this.getMessageSender())||(t[o.KEYS.MESSAGE_SENDER]=this.getMessageSender()),t},t}();e.CometChatEvent=s},function(t,e,n){"use strict";e.__esModule=!0,e.MessageController=void 0;var i=n(7),a=n(16),E=n(17),c=n(0),u=n(1),S=n(20),l=n(21),p=n(22),r=n(2),C=n(18),T=n(19),d=n(3),_=n(11),o=function(){function t(){}return t.trasformJSONMessge=function(n){try{var t=null;n.hasOwnProperty("rawMessage")||(t=JSON.parse(JSON.stringify(n)));var e=void 0;switch(n[u.MessageConstatnts.KEYS.CATEGORY]){case u.MessageConstatnts.CATEGORY.ACTION:e=S.Action.actionFromJSON(n);break;case u.MessageConstatnts.CATEGORY.CALL:e=l.Call.callFromJSON(n);break;case u.MessageConstatnts.CATEGORY.MESSAGE:switch(n[u.MessageConstatnts.KEYS.TYPE]){case u.MessageConstatnts.TYPE.TEXT:e=new a.TextMessage(n[u.MessageConstatnts.KEYS.RECEIVER],n[u.MessageConstatnts.KEYS.DATA][u.MessageConstatnts.KEYS.TEXT],n[u.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case u.MessageConstatnts.TYPE.CUSTOM:e=new T.CustomMessage(n[u.MessageConstatnts.KEYS.RECEIVER],n[u.MessageConstatnts.KEYS.DATA][u.MessageConstatnts.KEYS.CUSTOM_DATA],n[u.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;default:if(e=new E.MediaMessage(n[u.MessageConstatnts.KEYS.RECEIVER],n[u.MessageConstatnts.KEYS.DATA][u.MessageConstatnts.KEYS.URL],n[u.MessageConstatnts.KEYS.TYPE],n[u.MessageConstatnts.KEYS.RECEIVER_TYPE]),n.hasOwnProperty(u.MessageConstatnts.KEYS.DATA)){var o=n[u.MessageConstatnts.KEYS.DATA];if(o.hasOwnProperty(u.MessageConstatnts.KEYS.ATTATCHMENTS)){var s,r=o[u.MessageConstatnts.KEYS.ATTATCHMENTS];new Array;r.map(function(t){s=new C.Attachment(t)}),e.setAttachment(s)}o.hasOwnProperty(u.MessageConstatnts.KEYS.TEXT)&&e.setCaption(o[u.MessageConstatnts.KEYS.TEXT])}e.hasOwnProperty("file")&&delete e.file}break;case u.MessageConstatnts.CATEGORY.CUSTOM:e=new T.CustomMessage(n[u.MessageConstatnts.KEYS.RECEIVER],n[u.MessageConstatnts.KEYS.DATA][u.MessageConstatnts.KEYS.CUSTOM_DATA],n[u.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type)}n[u.MessageConstatnts.KEYS.MY_RECEIPTS]&&(n[u.MessageConstatnts.KEYS.MY_RECEIPTS]=n[u.MessageConstatnts.KEYS.MY_RECEIPTS],Object.keys(n[u.MessageConstatnts.KEYS.MY_RECEIPTS]).map(function(t){var e=new p.MessageReceipt;t==u.DELIVERY_RECEIPTS.DELIVERED_AT&&(e.setReceiptType(e.RECEIPT_TYPE.DELIVERY_RECEIPT),e.setDeliveredAt(n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.DELIVERY_RECEIPTS.DELIVERED_AT]),c.isFalsy(n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.DELIVERY_RECEIPTS.RECIPIENT])?n[u.DELIVERY_RECEIPTS.DELIVERED_TO_ME_AT]=n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.DELIVERY_RECEIPTS.DELIVERED_AT]:e.setSender(n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.DELIVERY_RECEIPTS.RECIPIENT]),e.setReceiverType(n[u.MessageConstatnts.KEYS.RECEIVER_TYPE]),e.setReceiver(n[u.MessageConstatnts.KEYS.RECEIVER])),n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.READ_RECEIPTS.READ_AT]&&(e.setReceiptType(e.RECEIPT_TYPE.READ_RECEIPT),e.setReadAt(n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.READ_RECEIPTS.READ_AT]),c.isFalsy(n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.READ_RECEIPTS.RECIPIENT])?n[u.READ_RECEIPTS.READ_BY_ME_AT]=n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.READ_RECEIPTS.READ_AT]:e.setSender(n[u.MessageConstatnts.KEYS.MY_RECEIPTS][u.READ_RECEIPTS.RECIPIENT]),e.setReceiverType(n[u.MessageConstatnts.KEYS.RECEIVER_TYPE]),e.setReceiver(n[u.MessageConstatnts.KEYS.RECEIVER]))}));try{if(Object.assign(e,n),(n=e).parentId&&(n.parentMessageId=n.parentId,delete n.parentId),n instanceof i.BaseMessage&&(c.isFalsy(t)||n.setRawMessage(t)),n instanceof a.TextMessage)n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.getData()[u.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[u.MessageConstatnts.KEYS.METADATA]);else if(n instanceof E.MediaMessage)n.getData()[u.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[u.MessageConstatnts.KEYS.METADATA]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver());else if(n instanceof S.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 l.Call){try{n.setSender(n.getSender())}catch(t){c.Logger.error("MessageController: trasformJSONMessge: setSender",t)}try{n.setCallInitiator(n.getCallInitiator())}catch(t){c.Logger.error("MessageController: trasformJSONMessge: setCallInitiator",t)}try{n.setReceiver(n.getCallReceiver()),n.setCallReceiver(n.getCallReceiver())}catch(t){c.Logger.error("MessageController: trasformJSONMessge: setCallreceiver",t)}}else n instanceof T.CustomMessage&&(n.getData()[u.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[u.MessageConstatnts.KEYS.METADATA]),n.setCustomData(n.getData()[u.MessageConstatnts.KEYS.CUSTOM_DATA]),n.setSubType(n.getData()[u.MessageConstatnts.KEYS.CUSTOM_SUB_TYPE]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()))}catch(t){c.Logger.error("MessageController: trasformJSONMessge: Main",t),n=null}return n}catch(t){c.Logger.error("MessageController: trasformJSONMessge",t)}},t.getReceiptsFromJSON=function(s){return new Promise(function(t,e){try{var o=[];d.CometChat.getLoggedInUser().then(function(n){c.isFalsy(s.receipts)?t([]):(s.receipts.data.map(function(t){var e=new p.MessageReceipt;t[u.DELIVERY_RECEIPTS.DELIVERED_AT]&&(e.setReceiptType(e.RECEIPT_TYPE.DELIVERY_RECEIPT),e.setDeliveredAt(t[u.DELIVERY_RECEIPTS.DELIVERED_AT]),e.setTimestamp(t[u.DELIVERY_RECEIPTS.DELIVERED_AT]),c.isFalsy(t[u.DELIVERY_RECEIPTS.RECIPIENT])?e.setSender(n):e.setSender(_.UsersController.trasformJSONUser(t[u.DELIVERY_RECEIPTS.RECIPIENT])),e.setReceiverType(s[u.MessageConstatnts.KEYS.RECEIVER_TYPE]),e.setReceiver(s[u.MessageConstatnts.KEYS.RECEIVER])),t[u.READ_RECEIPTS.READ_AT]&&(e.setReceiptType(e.RECEIPT_TYPE.READ_RECEIPT),e.setReadAt(t[u.READ_RECEIPTS.READ_AT]),e.setTimestamp(t[t[u.READ_RECEIPTS.READ_AT]]),c.isFalsy(t[u.READ_RECEIPTS.RECIPIENT])?e.setSender(n):e.setSender(_.UsersController.trasformJSONUser(t[u.READ_RECEIPTS.RECIPIENT])),e.setReceiverType(s[u.MessageConstatnts.KEYS.RECEIVER_TYPE]),e.setReceiver(s[u.MessageConstatnts.KEYS.RECEIVER])),o.push(e)}),t(o))})}catch(t){e(new r.CometChatException(t))}})},t}();e.MessageController=o},function(t,e,n){"use strict";e.__esModule=!0,e.UsersController=void 0;var o=n(4),s=n(0),r=function(){function t(){}return t.trasformJSONUser=function(t){var e;try{t.uid=t.uid.toString(),t.name=t.name.toString(),t.status&&"offline"!==t.status?t.status="online":t.status="offline",e=new o.User(t),Object.assign(e,t),t=e}catch(t){s.Logger.error("UsersController:transformJSONUser",t)}return t},t}();e.UsersController=r},function(t,e,n){(function(o){t.exports=function s(r,i,a){function E(n,t){if(!i[n]){if(!r[n]){if(c)return c(n,!0);var e=new Error("Cannot find module '"+n+"'");throw e.code="MODULE_NOT_FOUND",e}var o=i[n]={exports:{}};r[n][0].call(o.exports,function(t){var e=r[n][1][t];return E(e||t)},o,o.exports,s,r,i,a)}return i[n].exports}for(var c=!1,t=0;t<a.length;t++)E(a[t]);return E}({1:[function(t,u,e){(function(e){"use strict";var n,o,t=e.MutationObserver||e.WebKitMutationObserver;if(t){var s=0,r=new t(c),i=e.document.createTextNode("");r.observe(i,{characterData:!0}),n=function(){i.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){c(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(c,0)};else{var a=new e.MessageChannel;a.port1.onmessage=c,n=function(){a.port2.postMessage(0)}}var E=[];function c(){var t,e;o=!0;for(var n=E.length;n;){for(e=E,E=[],t=-1;++t<n;)e[t]();n=E.length}o=!1}u.exports=function(t){1!==E.push(t)||o||n()}}).call(this,void 0!==o?o:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(t,e,n){"use strict";var s=t(1);function c(){}var u={},r=["REJECTED"],i=["FULFILLED"],a=["PENDING"];function o(t){if("function"!=typeof t)throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,t!==c&&p(this,t)}function E(t,e,n){this.promise=t,"function"==typeof e&&(this.onFulfilled=e,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function S(e,n,o){s(function(){var t;try{t=n(o)}catch(t){return u.reject(e,t)}t===e?u.reject(e,new TypeError("Cannot resolve promise with itself")):u.resolve(e,t)})}function l(t){var e=t&&t.then;if(t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof e)return function(){e.apply(t,arguments)}}function p(e,t){var n=!1;function o(t){n||(n=!0,u.reject(e,t))}function s(t){n||(n=!0,u.resolve(e,t))}var r=C(function(){t(s,o)});"error"===r.status&&o(r.value)}function C(t,e){var n={};try{n.value=t(e),n.status="success"}catch(t){n.status="error",n.value=t}return n}(e.exports=o).prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){if("function"!=typeof t&&this.state===i||"function"!=typeof e&&this.state===r)return this;var n=new this.constructor(c);if(this.state!==a){var o=this.state===i?t:e;S(n,o,this.outcome)}else this.queue.push(new E(n,t,e));return n},E.prototype.callFulfilled=function(t){u.resolve(this.promise,t)},E.prototype.otherCallFulfilled=function(t){S(this.promise,this.onFulfilled,t)},E.prototype.callRejected=function(t){u.reject(this.promise,t)},E.prototype.otherCallRejected=function(t){S(this.promise,this.onRejected,t)},u.resolve=function(t,e){var n=C(l,e);if("error"===n.status)return u.reject(t,n.value);var o=n.value;if(o)p(t,o);else{t.state=i,t.outcome=e;for(var s=-1,r=t.queue.length;++s<r;)t.queue[s].callFulfilled(e)}return t},u.reject=function(t,e){t.state=r,t.outcome=e;for(var n=-1,o=t.queue.length;++n<o;)t.queue[n].callRejected(e);return t},o.resolve=function(t){return t instanceof this?t:u.resolve(new this(c),t)},o.reject=function(t){var e=new this(c);return u.reject(e,t)},o.all=function(t){var n=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var o=t.length,s=!1;if(!o)return this.resolve([]);for(var r=new Array(o),i=0,e=-1,a=new this(c);++e<o;)E(t[e],e);return a;function E(t,e){n.resolve(t).then(function(t){r[e]=t,++i!==o||s||(s=!0,u.resolve(a,r))},function(t){s||(s=!0,u.reject(a,t))})}},o.race=function(t){var e=this;if("[object Array]"!==Object.prototype.toString.call(t))return this.reject(new TypeError("must be an array"));var n=t.length,o=!1;if(!n)return this.resolve([]);for(var s,r=-1,i=new this(c);++r<n;)s=t[r],e.resolve(s).then(function(t){o||(o=!0,u.resolve(i,t))},function(t){o||(o=!0,u.reject(i,t))});return i}},{1:1}],3:[function(e,t,n){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==o?o:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(t,e,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},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(t){return}}();function i(e,n){e=e||[],n=n||{};try{return new Blob(e,n)}catch(t){if("TypeError"!==t.name)throw t;for(var o="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,s=new o,r=0;r<e.length;r+=1)s.append(e[r]);return s.getBlob(n.type)}}"undefined"==typeof Promise&&t(3);var S=Promise;function l(t,e){e&&t.then(function(t){e(null,t)},function(t){e(t)})}function c(t,e,n){"function"==typeof e&&t.then(e),"function"==typeof n&&t.catch(n)}function u(t){return"string"!=typeof t&&(t=String(t)),t}function r(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var a="local-forage-detect-blob-support",s=void 0,p={},C=Object.prototype.toString,T="readonly",d="readwrite";function _(t){return"boolean"==typeof s?S.resolve(s):(o=t,new S(function(n){var t=o.transaction(a,d),e=i([""]);t.objectStore(a).put(e,"key"),t.onabort=function(t){t.preventDefault(),t.stopPropagation(),n(!1)},t.oncomplete=function(){var t=navigator.userAgent.match(/Chrome\/(\d+)/),e=navigator.userAgent.match(/Edge\//);n(e||!t||43<=parseInt(t[1],10))}}).catch(function(){return!1})).then(function(t){return s=t});var o}function g(t){var e=p[t.name],n={};n.promise=new S(function(t,e){n.resolve=t,n.reject=e}),e.deferredOperations.push(n),e.dbReady?e.dbReady=e.dbReady.then(function(){return n.promise}):e.dbReady=n.promise}function h(t){var e=p[t.name],n=e.deferredOperations.pop();if(n)return n.resolve(),n.promise}function A(t,e){var n=p[t.name],o=n.deferredOperations.pop();if(o)return o.reject(e),o.promise}function R(s,r){return new S(function(e,n){if(p[s.name]=p[s.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},s.db){if(!r)return e(s.db);g(s),s.db.close()}var t=[s.name];r&&t.push(s.version);var o=E.open.apply(E,t);r&&(o.onupgradeneeded=function(t){var e=o.result;try{e.createObjectStore(s.storeName),t.oldVersion<=1&&e.createObjectStore(a)}catch(t){if("ConstraintError"!==t.name)throw t}}),o.onerror=function(t){t.preventDefault(),n(o.error)},o.onsuccess=function(){var t=o.result;t.onversionchange=function(t){t.target.close()},e(t),h(s)}})}function I(t){return R(t,!1)}function f(t){return R(t,!0)}function O(t,e){if(!t.db)return!0;var n=!t.db.objectStoreNames.contains(t.storeName),o=t.version<t.db.version,s=t.version>t.db.version;if(o&&(t.version,t.version=t.db.version),s||n){if(n){var r=t.db.version+1;r>t.version&&(t.version=r)}return!0}return!1}function N(t){var e=function(t){for(var e=t.length,n=new ArrayBuffer(e),o=new Uint8Array(n),s=0;s<e;s++)o[s]=t.charCodeAt(s);return n}(atob(t.data));return i([e],{type:t.type})}function y(t){return t&&t.__local_forage_encoded_blob}function m(t){var e=this,n=e._initReady().then(function(){var t=p[e._dbInfo.name];if(t&&t.dbReady)return t.dbReady});return c(n,t,t),n}function L(e,n,o,s){void 0===s&&(s=1);try{var t=e.db.transaction(e.storeName,n);o(null,t)}catch(t){if(0<s&&(!e.db||"InvalidStateError"===t.name||"NotFoundError"===t.name))return S.resolve().then(function(){if(!e.db||"NotFoundError"===t.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),f(e)}).then(function(){return function(n){g(n);for(var o=p[n.name],s=o.forages,t=0;t<s.length;t++){var e=s[t];e._dbInfo.db&&(e._dbInfo.db.close(),e._dbInfo.db=null)}return n.db=null,I(n).then(function(t){return n.db=t,O(n)?f(n):t}).then(function(t){n.db=o.db=t;for(var e=0;e<s.length;e++)s[e]._dbInfo.db=t}).catch(function(t){throw A(n,t),t})}(e).then(function(){L(e,n,o,s-1)})}).catch(o);o(t)}}var M={_driver:"asyncStorage",_initStorage:function(t){var o=this,s={db:null};if(t)for(var e in t)s[e]=t[e];var r=p[s.name];r||(r={forages:[],db:null,dbReady:null,deferredOperations:[]},p[s.name]=r),r.forages.push(o),o._initReady||(o._initReady=o.ready,o.ready=m);var n=[];function i(){return S.resolve()}for(var a=0;a<r.forages.length;a++){var E=r.forages[a];E!==o&&n.push(E._initReady().catch(i))}var c=r.forages.slice(0);return S.all(n).then(function(){return s.db=r.db,I(s)}).then(function(t){return s.db=t,O(s,o._defaultConfig.version)?f(s):t}).then(function(t){s.db=r.db=t,o._dbInfo=s;for(var e=0;e<c.length;e++){var n=c[e];n!==o&&(n._dbInfo.db=s.db,n._dbInfo.version=s.version)}})},_support:function(){try{if(!E||!E.open)return!1;var t="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),e="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!t||e)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(t){return!1}}(),iterate:function(a,t){var E=this,e=new S(function(r,i){E.ready().then(function(){L(E._dbInfo,T,function(t,e){if(t)return i(t);try{var n=e.objectStore(E._dbInfo.storeName),o=n.openCursor(),s=1;o.onsuccess=function(){var t=o.result;if(t){var e=t.value;y(e)&&(e=N(e));var n=a(e,t.key,s++);void 0!==n?r(n):t.continue()}else r()},o.onerror=function(){i(o.error)}}catch(t){i(t)}})}).catch(i)});return l(e,t),e},getItem:function(i,t){var a=this;i=u(i);var e=new S(function(s,r){a.ready().then(function(){L(a._dbInfo,T,function(t,e){if(t)return r(t);try{var n=e.objectStore(a._dbInfo.storeName),o=n.get(i);o.onsuccess=function(){var t=o.result;void 0===t&&(t=null),y(t)&&(t=N(t)),s(t)},o.onerror=function(){r(o.error)}}catch(t){r(t)}})}).catch(r)});return l(e,t),e},setItem:function(a,e,t){var E=this;a=u(a);var n=new S(function(r,i){var t;E.ready().then(function(){return t=E._dbInfo,"[object Blob]"===C.call(e)?_(t.db).then(function(t){return t?e:(o=e,new S(function(n,t){var e=new FileReader;e.onerror=t,e.onloadend=function(t){var e=btoa(t.target.result||"");n({__local_forage_encoded_blob:!0,data:e,type:o.type})},e.readAsBinaryString(o)}));var o}):e}).then(function(s){L(E._dbInfo,d,function(t,e){if(t)return i(t);try{var n=e.objectStore(E._dbInfo.storeName);null===s&&(s=void 0);var o=n.put(s,a);e.oncomplete=function(){void 0===s&&(s=null),r(s)},e.onabort=e.onerror=function(){var t=o.error?o.error:o.transaction.error;i(t)}}catch(t){i(t)}})}).catch(i)});return l(n,t),n},removeItem:function(i,t){var a=this;i=u(i);var e=new S(function(s,r){a.ready().then(function(){L(a._dbInfo,d,function(t,e){if(t)return r(t);try{var n=e.objectStore(a._dbInfo.storeName),o=n.delete(i);e.oncomplete=function(){s()},e.onerror=function(){r(o.error)},e.onabort=function(){var t=o.error?o.error:o.transaction.error;r(t)}}catch(t){r(t)}})}).catch(r)});return l(e,t),e},clear:function(t){var i=this,e=new S(function(s,r){i.ready().then(function(){L(i._dbInfo,d,function(t,e){if(t)return r(t);try{var n=e.objectStore(i._dbInfo.storeName),o=n.clear();e.oncomplete=function(){s()},e.onabort=e.onerror=function(){var t=o.error?o.error:o.transaction.error;r(t)}}catch(t){r(t)}})}).catch(r)});return l(e,t),e},length:function(t){var i=this,e=new S(function(s,r){i.ready().then(function(){L(i._dbInfo,T,function(t,e){if(t)return r(t);try{var n=e.objectStore(i._dbInfo.storeName),o=n.count();o.onsuccess=function(){s(o.result)},o.onerror=function(){r(o.error)}}catch(t){r(t)}})}).catch(r)});return l(e,t),e},key:function(a,t){var E=this,e=new S(function(r,i){a<0?r(null):E.ready().then(function(){L(E._dbInfo,T,function(t,e){if(t)return i(t);try{var n=e.objectStore(E._dbInfo.storeName),o=!1,s=n.openKeyCursor();s.onsuccess=function(){var t=s.result;t?0===a?r(t.key):o?r(t.key):(o=!0,t.advance(a)):r(null)},s.onerror=function(){i(s.error)}}catch(t){i(t)}})}).catch(i)});return l(e,t),e},keys:function(t){var a=this,e=new S(function(r,i){a.ready().then(function(){L(a._dbInfo,T,function(t,e){if(t)return i(t);try{var n=e.objectStore(a._dbInfo.storeName),o=n.openKeyCursor(),s=[];o.onsuccess=function(){var t=o.result;t?(s.push(t.key),t.continue()):r(s)},o.onerror=function(){i(o.error)}}catch(t){i(t)}})}).catch(i)});return l(e,t),e},dropInstance:function(a,t){t=r.apply(this,arguments);var e,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 o=a.name===n.name&&this._dbInfo.db,s=o?S.resolve(this._dbInfo.db):I(a).then(function(t){var e=p[a.name],n=e.forages;e.db=t;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=t;return t});e=a.storeName?s.then(function(t){if(t.objectStoreNames.contains(a.storeName)){var s=t.version+1;g(a);var o=p[a.name],r=o.forages;t.close();for(var e=0;e<r.length;e++){var n=r[e];n._dbInfo.db=null,n._dbInfo.version=s}var i=new S(function(e,n){var o=E.open(a.name,s);o.onerror=function(t){var e=o.result;e.close(),n(t)},o.onupgradeneeded=function(){var t=o.result;t.deleteObjectStore(a.storeName)},o.onsuccess=function(){var t=o.result;t.close(),e(t)}});return i.then(function(t){o.db=t;for(var e=0;e<r.length;e++){var n=r[e];n._dbInfo.db=t,h(n._dbInfo)}}).catch(function(t){throw(A(a,t)||S.resolve()).catch(function(){}),t})}}):s.then(function(t){g(a);var o=p[a.name],s=o.forages;t.close();for(var e=0;e<s.length;e++){var n=s[e];n._dbInfo.db=null}var r=new S(function(e,n){var o=E.deleteDatabase(a.name);o.onerror=function(){var t=o.result;t&&t.close(),n(o.error)},o.onblocked=function(){},o.onsuccess=function(){var t=o.result;t&&t.close(),e(t)}});return r.then(function(t){o.db=t;for(var e=0;e<s.length;e++){var n=s[e];h(n._dbInfo)}}).catch(function(t){throw(A(a,t)||S.resolve()).catch(function(){}),t})})}else e=S.reject("Invalid arguments");return l(e,t),e}},v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",U=D.length,Y="arbf",G="blob",w=U+Y.length,K=Object.prototype.toString;function b(t){var e,n,o,s,r,i=.75*t.length,a=t.length,E=0;"="===t[t.length-1]&&(i--,"="===t[t.length-2]&&i--);var c=new ArrayBuffer(i),u=new Uint8Array(c);for(e=0;e<a;e+=4)n=v.indexOf(t[e]),o=v.indexOf(t[e+1]),s=v.indexOf(t[e+2]),r=v.indexOf(t[e+3]),u[E++]=n<<2|o>>4,u[E++]=(15&o)<<4|s>>2,u[E++]=(3&s)<<6|63&r;return c}function B(t){var e,n=new Uint8Array(t),o="";for(e=0;e<n.length;e+=3)o+=v[n[e]>>2],o+=v[(3&n[e])<<4|n[e+1]>>4],o+=v[(15&n[e+1])<<2|n[e+2]>>6],o+=v[63&n[e+2]];return n.length%3==2?o=o.substring(0,o.length-1)+"=":n.length%3==1&&(o=o.substring(0,o.length-2)+"=="),o}var F={serialize:function(e,n){var t="";if(e&&(t=K.call(e)),e&&("[object ArrayBuffer]"===t||e.buffer&&"[object ArrayBuffer]"===K.call(e.buffer))){var o,s=D;e instanceof ArrayBuffer?(o=e,s+=Y):(o=e.buffer,"[object Int8Array]"===t?s+="si08":"[object Uint8Array]"===t?s+="ui08":"[object Uint8ClampedArray]"===t?s+="uic8":"[object Int16Array]"===t?s+="si16":"[object Uint16Array]"===t?s+="ur16":"[object Int32Array]"===t?s+="si32":"[object Uint32Array]"===t?s+="ui32":"[object Float32Array]"===t?s+="fl32":"[object Float64Array]"===t?s+="fl64":n(new Error("Failed to get type for BinaryArray"))),n(s+B(o))}else if("[object Blob]"===t){var r=new FileReader;r.onload=function(){var t="~~local_forage_type~"+e.type+"~"+B(this.result);n(D+G+t)},r.readAsArrayBuffer(e)}else try{n(JSON.stringify(e))}catch(t){n(null,t)}},deserialize:function(t){if(t.substring(0,U)!==D)return JSON.parse(t);var e,n=t.substring(w),o=t.substring(U,w);if(o===G&&P.test(n)){var s=n.match(P);e=s[1],n=n.substring(s[0].length)}var r=b(n);switch(o){case Y:return r;case G:return i([r],{type:e});case"si08":return new Int8Array(r);case"ui08":return new Uint8Array(r);case"uic8":return new Uint8ClampedArray(r);case"si16":return new Int16Array(r);case"ur16":return new Uint16Array(r);case"si32":return new Int32Array(r);case"ui32":return new Uint32Array(r);case"fl32":return new Float32Array(r);case"fl64":return new Float64Array(r);default:throw new Error("Unkown type: "+o)}},stringToBuffer:b,bufferToString:B};function V(t,e,n,o){t.executeSql("CREATE TABLE IF NOT EXISTS "+e.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,o)}function x(t,o,s,r,i,a){t.executeSql(s,r,i,function(t,n){n.code===n.SYNTAX_ERR?t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[o.storeName],function(t,e){e.rows.length?a(t,n):V(t,o,function(){t.executeSql(s,r,i,a)},a)},a):a(t,n)},a)}function k(i,t,a,E){var c=this;i=u(i);var e=new S(function(s,r){c.ready().then(function(){void 0===t&&(t=null);var n=t,o=c._dbInfo;o.serializer.serialize(t,function(e,t){t?r(t):o.db.transaction(function(t){x(t,o,"INSERT OR REPLACE INTO "+o.storeName+" (key, value) VALUES (?, ?)",[i,e],function(){s(n)},function(t,e){r(e)})},function(t){if(t.code===t.QUOTA_ERR){if(0<E)return void s(k.apply(c,[i,n,a,E-1]));r(t)}})})}).catch(r)});return l(e,a),e}var J={_driver:"webSQLStorage",_initStorage:function(t){var o=this,s={db:null};if(t)for(var e in t)s[e]="string"!=typeof t[e]?t[e].toString():t[e];var n=new S(function(e,n){try{s.db=openDatabase(s.name,String(s.version),s.description,s.size)}catch(t){return n(t)}s.db.transaction(function(t){V(t,s,function(){o._dbInfo=s,e()},function(t,e){n(e)})},n)});return s.serializer=F,n},_support:"function"==typeof openDatabase,iterate:function(c,t){var e=this,n=new S(function(E,n){e.ready().then(function(){var a=e._dbInfo;a.db.transaction(function(t){x(t,a,"SELECT * FROM "+a.storeName,[],function(t,e){for(var n=e.rows,o=n.length,s=0;s<o;s++){var r=n.item(s),i=r.value;if(i&&(i=a.serializer.deserialize(i)),void 0!==(i=c(i,r.key,s+1)))return void E(i)}E()},function(t,e){n(e)})})}).catch(n)});return l(n,t),n},getItem:function(e,t){var r=this;e=u(e);var n=new S(function(s,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(t){x(t,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],function(t,e){var n=e.rows.length?e.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),s(n)},function(t,e){n(e)})})}).catch(n)});return l(n,t),n},setItem:function(t,e,n){return k.apply(this,[t,e,n,1])},removeItem:function(s,t){var r=this;s=u(s);var e=new S(function(n,o){r.ready().then(function(){var e=r._dbInfo;e.db.transaction(function(t){x(t,e,"DELETE FROM "+e.storeName+" WHERE key = ?",[s],function(){n()},function(t,e){o(e)})})}).catch(o)});return l(e,t),e},clear:function(t){var s=this,e=new S(function(n,o){s.ready().then(function(){var e=s._dbInfo;e.db.transaction(function(t){x(t,e,"DELETE FROM "+e.storeName,[],function(){n()},function(t,e){o(e)})})}).catch(o)});return l(e,t),e},length:function(t){var s=this,e=new S(function(o,n){s.ready().then(function(){var e=s._dbInfo;e.db.transaction(function(t){x(t,e,"SELECT COUNT(key) as c FROM "+e.storeName,[],function(t,e){var n=e.rows.item(0).c;o(n)},function(t,e){n(e)})})}).catch(n)});return l(e,t),e},key:function(s,t){var r=this,e=new S(function(o,n){r.ready().then(function(){var e=r._dbInfo;e.db.transaction(function(t){x(t,e,"SELECT key FROM "+e.storeName+" WHERE id = ? LIMIT 1",[s+1],function(t,e){var n=e.rows.length?e.rows.item(0).key:null;o(n)},function(t,e){n(e)})})}).catch(n)});return l(e,t),e},keys:function(t){var o=this,e=new S(function(s,n){o.ready().then(function(){var e=o._dbInfo;e.db.transaction(function(t){x(t,e,"SELECT key FROM "+e.storeName,[],function(t,e){for(var n=[],o=0;o<e.rows.length;o++)n.push(e.rows.item(o).key);s(n)},function(t,e){n(e)})})}).catch(n)});return l(e,t),e},dropInstance:function(n,t){t=r.apply(this,arguments);var o=this.config();(n="function"!=typeof n&&n||{}).name||(n.name=n.name||o.name,n.storeName=n.storeName||o.storeName);var e,s=this;return l(e=n.name?new S(function(t){var e,r;e=n.name===o.name?s._dbInfo.db:openDatabase(n.name,"","",0),n.storeName?t({db:e,storeNames:[n.storeName]}):t((r=e,new S(function(s,n){r.transaction(function(t){t.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(t,e){for(var n=[],o=0;o<e.rows.length;o++)n.push(e.rows.item(o).name);s({db:r,storeNames:n})},function(t,e){n(e)})},function(t){n(t)})})))}).then(function(a){return new S(function(r,i){a.db.transaction(function(o){function t(e){return new S(function(t,n){o.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(t,e){n(e)})})}for(var e=[],n=0,s=a.storeNames.length;n<s;n++)e.push(t(a.storeNames[n]));S.all(e).then(function(){r()}).catch(function(t){i(t)})},function(t){i(t)})})}):S.reject("Invalid arguments"),t),e}};function H(t,e){var n=t.name+"/";return t.storeName!==e.storeName&&(n+=t.storeName+"/"),n}function W(){return!function(){var t="_localforage_support_test";try{return localStorage.setItem(t,!0),localStorage.removeItem(t),!1}catch(t){return!0}}()||0<localStorage.length}var j={_driver:"localStorageWrapper",_initStorage:function(t){var e={};if(t)for(var n in t)e[n]=t[n];return e.keyPrefix=H(t,this._defaultConfig),W()?((this._dbInfo=e).serializer=F,S.resolve()):S.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(t){return!1}}(),iterate:function(E,t){var c=this,e=c.ready().then(function(){for(var t=c._dbInfo,e=t.keyPrefix,n=e.length,o=localStorage.length,s=1,r=0;r<o;r++){var i=localStorage.key(r);if(0===i.indexOf(e)){var a=localStorage.getItem(i);if(a&&(a=t.serializer.deserialize(a)),void 0!==(a=E(a,i.substring(n),s++)))return a}}});return l(e,t),e},getItem:function(n,t){var o=this;n=u(n);var e=o.ready().then(function(){var t=o._dbInfo,e=localStorage.getItem(t.keyPrefix+n);return e&&(e=t.serializer.deserialize(e)),e});return l(e,t),e},setItem:function(i,t,e){var a=this;i=u(i);var n=a.ready().then(function(){void 0===t&&(t=null);var r=t;return new S(function(n,o){var s=a._dbInfo;s.serializer.serialize(t,function(t,e){if(e)o(e);else try{localStorage.setItem(s.keyPrefix+i,t),n(r)}catch(t){"QuotaExceededError"!==t.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==t.name||o(t),o(t)}})})});return l(n,e),n},removeItem:function(e,t){var n=this;e=u(e);var o=n.ready().then(function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return l(o,t),o},clear:function(t){var o=this,e=o.ready().then(function(){for(var t=o._dbInfo.keyPrefix,e=localStorage.length-1;0<=e;e--){var n=localStorage.key(e);0===n.indexOf(t)&&localStorage.removeItem(n)}});return l(e,t),e},length:function(t){var e=this.keys().then(function(t){return t.length});return l(e,t),e},key:function(n,t){var o=this,e=o.ready().then(function(){var e,t=o._dbInfo;try{e=localStorage.key(n)}catch(t){e=null}return e&&(e=e.substring(t.keyPrefix.length)),e});return l(e,t),e},keys:function(t){var r=this,e=r.ready().then(function(){for(var t=r._dbInfo,e=localStorage.length,n=[],o=0;o<e;o++){var s=localStorage.key(o);0===s.indexOf(t.keyPrefix)&&n.push(s.substring(t.keyPrefix.length))}return n});return l(e,t),e},dropInstance:function(e,t){if(t=r.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var o,s=this;return l(o=e.name?new S(function(t){e.storeName?t(H(e,s._defaultConfig)):t(e.name+"/")}).then(function(t){for(var e=localStorage.length-1;0<=e;e--){var n=localStorage.key(e);0===n.indexOf(t)&&localStorage.removeItem(n)}}):S.reject("Invalid arguments"),t),o}},X=function(t,e){for(var n=t.length,o=0;o<n;){if((s=t[o])===(r=e)||"number"==typeof s&&"number"==typeof r&&isNaN(s)&&isNaN(r))return!0;o++}var s,r;return!1},q=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},Q={},z={},Z={INDEXEDDB:M,WEBSQL:J,LOCALSTORAGE:j},$=[Z.INDEXEDDB._driver,Z.WEBSQL._driver,Z.LOCALSTORAGE._driver],tt=["dropInstance"],et=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(tt),nt={description:"",driver:$.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ot(e,n){e[n]=function(){var t=arguments;return e.ready().then(function(){return e[n].apply(e,t)})}}function st(){for(var t=1;t<arguments.length;t++){var e=arguments[t];if(e)for(var n in e)e.hasOwnProperty(n)&&(q(e[n])?arguments[0][n]=e[n].slice():arguments[0][n]=e[n])}return arguments[0]}var rt=function(){function s(t){for(var e in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),Z)if(Z.hasOwnProperty(e)){var n=Z[e],o=n._driver;this[e]=o,Q[o]||this.defineDriver(n)}this._defaultConfig=st({},nt),this._config=st({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return s.prototype.config=function(t){if("object"!==(void 0===t?"undefined":o(t)))return"string"==typeof t?this._config[t]:this._config;if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var e in t){if("storeName"===e&&(t[e]=t[e].replace(/\W/g,"_")),"version"===e&&"number"!=typeof t[e])return new Error("Database version must be a number.");this._config[e]=t[e]}return!("driver"in t&&t.driver)||this.setDriver(this._config.driver)},s.prototype.defineDriver=function(u,t,e){var n=new S(function(e,n){try{var o=u._driver,t=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver)return void n(t);for(var s=et.concat("_initStorage"),r=0,i=s.length;r<i;r++){var a=s[r],E=!X(tt,a);if((E||u[a])&&"function"!=typeof u[a])return void n(t)}!function(){for(var t=function(n){return function(){var t=new Error("Method "+n+" is not implemented by the current driver"),e=S.reject(t);return l(e,arguments[arguments.length-1]),e}},e=0,n=tt.length;e<n;e++){var o=tt[e];u[o]||(u[o]=t(o))}}();var c=function(t){Q[o],Q[o]=u,z[o]=t,e()};"_support"in u?u._support&&"function"==typeof u._support?u._support().then(c,n):c(!!u._support):c(!0)}catch(t){n(t)}});return c(n,t,e),n},s.prototype.driver=function(){return this._driver||null},s.prototype.getDriver=function(t,e,n){var o=Q[t]?S.resolve(Q[t]):S.reject(new Error("Driver not found."));return c(o,e,n),o},s.prototype.getSerializer=function(t){var e=S.resolve(F);return c(e,t),e},s.prototype.ready=function(t){var e=this,n=e._driverSet.then(function(){return null===e._ready&&(e._ready=e._initDriver()),e._ready});return c(n,t,t),n},s.prototype.setDriver=function(t,e,n){var r=this;q(t)||(t=[t]);var o=this._getSupportedDrivers(t);function i(){r._config.driver=r.driver()}function a(t){return r._extend(t),i(),r._ready=r._initStorage(r._config),r._ready}var s=null!==this._driverSet?this._driverSet.catch(function(){return S.resolve()}):S.resolve();return this._driverSet=s.then(function(){var t=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(t).then(function(t){var s;r._driver=t._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=(s=o,function(){var n=0;function o(){for(;n<s.length;){var t=s[n];return n++,r._dbInfo=null,r._ready=null,r.getDriver(t).then(a).catch(o)}i();var e=new Error("No available storage method found.");return r._driverSet=S.reject(e),r._driverSet}return o()})})}).catch(function(){i();var t=new Error("No available storage method found.");return r._driverSet=S.reject(t),r._driverSet}),c(this._driverSet,e,n),this._driverSet},s.prototype.supports=function(t){return!!z[t]},s.prototype._extend=function(t){st(this,t)},s.prototype._getSupportedDrivers=function(t){for(var e=[],n=0,o=t.length;n<o;n++){var s=t[n];this.supports(s)&&e.push(s)}return e},s.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,e=et.length;t<e;t++)ot(this,et[t])},s.prototype.createInstance=function(t){return new s(t)},s}(),it=new rt;e.exports=it},{3:3}]},{},[4])(4)}).call(this,n(39))},function(t,e,n){"use strict";e.__esModule=!0,e.FETCH_ERROR=e.TYPINGNOTIFICATION_CONSTANTS=e.LOGIN_ERROR=e.MESSAGE_ERRORS=e.MESSAGES_REQUEST_ERRORS=e.USERS_REQUEST_ERRORS=e.GROUP_CREATION_ERRORS=e.INIT_ERROR=e.ERRORS=e.SERVER_ERRORS=void 0,e.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."}},e.ERRORS={PARAMETER_MISSING:{code:"MISSING_PARAMETERS",name:"Invalid or no parameter passed to the method."}},e.INIT_ERROR={NO_APP_ID:{code:e.ERRORS.PARAMETER_MISSING.code,name:e.ERRORS.PARAMETER_MISSING.name,message:"AppID cannot be empty. Please specify a valid appID.",details:{}}},e.GROUP_CREATION_ERRORS={EMPTY_PASSWORD:{code:"ERR_EMPTY_GROUP_PASS",details:void 0,message:"Password is mandatory to join a group.",name:void 0}},e.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:{}}},e.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:{}}},e.MESSAGE_ERRORS={INVALID_CUSTOM_DATA:{code:"-1",name:"%s_CUSTOM_DATA",message:"",details:{}}},e.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:{}}},e.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:{}}},e.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(t,e,n){"use strict";e.__esModule=!0,e.LocalStorage=void 0;var o=n(0),s=n(1),r=n(12),i=n(3),a=n(2),E=function(){function t(t){this.store=s.constants.DEFAULT_STORE,o.isFalsy(t)||(this.store=t),this.localStore=r.createInstance({name:o.format(s.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),s.LOCAL_STORE.COMMON_STORE)}),this.localStore.setDriver([r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL])}return t.getInstance=function(){return null==t.localStorage&&(t.localStorage=new t),t.localStorage},t.prototype.set=function(t,e){return this.localStore.setItem(t,JSON.stringify(e))},t.prototype.remove=function(t){this.localStore.removeItem(t)},t.prototype.update=function(t,e){this.remove(t),this.set(t,e)},t.prototype.get=function(t){var o=this;return new Promise(function(n,e){try{o.localStore.getItem(t).then(function(e){try{n(JSON.parse(e))}catch(t){n(e)}},function(t){e(t)})}catch(t){e(new a.CometChatException(t))}})},t.prototype.clearStore=function(){var o=this;return new Promise(function(n,e){try{o.localStore.keys().then(function(t){if(0<t.length)for(var e=0;e<t.length;e++)"appId"!==t[e]&&o.localStore.removeItem(t[e]),e===t.length-1&&n(!0)})}catch(t){e(t)}})},t.prototype.clear=function(t){},t.prototype.selectStore=function(t){this.store=t},t.localStorage=null,t}();e.LocalStorage=E},function(t,e,n){"use strict";e.__esModule=!0,e.GroupsController=void 0;var o=n(8),s=n(1),r=n(0),i=function(){function t(){}return t.trasformJSONGroup=function(t){var e;try{e=new o.Group(t[s.GroupConstants.KEYS.GUID],t[s.GroupConstants.KEYS.NAME],t[s.GroupConstants.KEYS.TYPE]),t.wsChannel&&delete t.wsChannel,Object.assign(e,t),t=e}catch(t){r.Logger.error("GroupsController:transformJSONGroup",t)}return t},t}();e.GroupsController=i},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};e.__esModule=!0,e.TextMessage=void 0;var s=n(7),a=n(1),E=n(4),c=n(8),u=n(0),S=function(s){function t(t,e,n){var o=s.call(this,t,"text",n,a.MessageCategory.MESSAGE)||this;return o.type="text",o.data={text:e},o.text=e,o}return r(t,s),t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(t){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(t){return this.receiver}},t.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},t.prototype.setMetadata=function(t){this.metadata=t,this.data=i(i({},this.data),{metadata:t})},t.prototype.getData=function(){return this.data},t.prototype.setData=function(t){this.data=t},t.prototype.getText=function(){return this.text},t.prototype.setText=function(t){this.text=t,this.data.text=t},t.prototype.setProcessedText=function(t){this.processedText=t},t.prototype.getProcessedText=function(){return this.processedText},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(t){this.tags=t},t.prototype.getSenderFromData=function(){try{var t=this.getData();if(t[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(t[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(t){u.Logger.error("TextMessageModel: getSenderFromData",t)}},t.prototype.getReceiverFromData=function(){try{var t=this.getData(),e=t[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(t[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(e);var n=new c.Group(e[a.GroupConstants.KEYS.GUID],e[a.GroupConstants.KEYS.NAME],e[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,e)}catch(t){u.Logger.error("TextMessageModel: getReceiverFromData",t)}},t.TYPE=a.MessageConstatnts.TYPE.TEXT,t.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=a.MessageConstatnts.CATEGORY.MESSAGE,t}(s.BaseMessage);e.TextMessage=S},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};e.__esModule=!0,e.MediaMessage=void 0;var r=n(7),a=n(1),E=n(4),c=n(18),u=n(8),S=n(0),l=function(r){function t(t,e,n,o){var s=r.call(this,t,n,o,a.MessageCategory.MESSAGE)||this;return s.data={},"object"!=typeof e?s.data={url:e}:e&&(0<e.length?s.files=e:s.files=[e]),s}return s(t,r),t.prototype.setCaption=function(t){this.caption=t,this.data[a.MessageConstatnts.KEYS.TEXT]=t},t.prototype.getCaption=function(){return this.data[a.MessageConstatnts.KEYS.TEXT]},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(t){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(t){return this.receiver}},t.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},t.prototype.setMetadata=function(t){this.metadata=t,this.data=i(i({},this.data),{metadata:t})},t.prototype.getData=function(){return this.data},t.prototype.setData=function(t){this.data=t},t.prototype.getAttachment=function(){return new c.Attachment(this.data.attachments[0])},t.prototype.setAttachment=function(t){this.data.attachments=[c.Attachment.toJSON(t)]},t.prototype.getAttachments=function(){var t=[];if(this.data.attachments&&0<this.data.attachments.length)for(var e=0;e<this.data.attachments.length;e++)t.push(new c.Attachment(this.data.attachments[e]));return t},t.prototype.setAttachments=function(t){var e=[];if(t&&0<t.length)for(var n=0;n<t.length;n++)e.push(c.Attachment.toJSON(t[n]));this.data.attachments=e},t.prototype.getURL=function(){try{var t=this.getData();if(t[a.MessageConstatnts.KEYS.URL])return t[a.MessageConstatnts.KEYS.URL]}catch(t){S.Logger.error("MediaMessageModel: getURL",t)}},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(t){this.tags=t},t.prototype.getSenderFromData=function(){try{var t=this.getData();if(t[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(t[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(t){S.Logger.error("MediaMessageModel: getSenderFromData",t)}},t.prototype.getReceiverFromData=function(){try{var t=this.getData(),e=t[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(t[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(e);var n=new u.Group(e[a.GroupConstants.KEYS.GUID],e[a.GroupConstants.KEYS.NAME],e[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,e)}catch(t){S.Logger.error("MediaMessageModel: getReceiverFromData",t)}},t.TYPE=a.MessageConstatnts.TYPE,t.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=a.MessageConstatnts.CATEGORY,t}(r.BaseMessage);e.MediaMessage=l},function(t,e,n){"use strict";e.__esModule=!0,e.Attachment=void 0;var o=n(1),s=function(){function e(t){t.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION)&&(this.extension=t[o.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION]),t.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE)&&(this.mimeType=t[o.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE]),t.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.NAME)&&(this.name=t[o.ATTACHMENTS_CONSTANTS.KEYS.NAME]),t.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.SIZE)&&(this.size=t[o.ATTACHMENTS_CONSTANTS.KEYS.SIZE]),t.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.URL)&&(this.url=t[o.ATTACHMENTS_CONSTANTS.KEYS.URL])}return e.prototype.createFileFromJSON=function(t){return new e(t)},e.toJSON=function(t){return{extension:t.getExtension(),mimeType:t.getMimeType(),name:t.getName(),url:t.getUrl(),size:t.getSize()}},e.prototype.getExtension=function(){return this.extension},e.prototype.setExtension=function(t){this.extension=t},e.prototype.getMimeType=function(){return this.mimeType},e.prototype.setMimeType=function(t){this.mimeType=t},e.prototype.getName=function(){return this.name},e.prototype.setName=function(t){this.name=t},e.prototype.getSize=function(){return this.size},e.prototype.setSize=function(t){this.size=t},e.prototype.getUrl=function(){return this.url},e.prototype.setUrl=function(t){this.url=t},e}();e.Attachment=s},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};e.__esModule=!0,e.CustomMessage=void 0;var i=n(7),E=n(1),c=n(4),u=n(0),S=n(8),a=function(a){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=this;if(3==t.length){var o=t[0],s=t[1],r=t[2];n=a.call(this,o,E.MessageConstatnts.TYPE.CUSTOM,s,E.MessageCategory.MESSAGE)||this,("object"!=typeof r||Array.isArray(r))&&(r={}),n.customData=r,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=r}if(4==t.length){o=t[0],s=t[1];var i=t[2];r=t[3];n=a.call(this,o,i,s,E.MessageCategory.CUSTOM)||this,("object"!=typeof r||Array.isArray(r))&&(r={}),n.customData=r,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=r}return n}return s(t,a),t.prototype.getCustomData=function(){return this.customData},t.prototype.setCustomData=function(t){this.customData=t,this.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=t},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(t){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(t){return this.receiver}},t.prototype.getSubType=function(){return this.subType},t.prototype.setSubType=function(t){this.subType=t,this.data=r(r({},this.data),{subType:t})},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(t){this.metadata=t,this.data=r(r({},this.data),{metadata:t})},t.prototype.getData=function(){return this.data},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(t){this.tags=t},t.prototype.getSenderFromData=function(){try{var t=this.getData();if(t[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new c.User(t[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(t){u.Logger.error("CustomMessageModel: getSenderFromData",t)}},t.prototype.getReceiverFromData=function(){try{var t=this.getData(),e=t[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(t[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(e);var n=new S.Group(e[E.GroupConstants.KEYS.GUID],e[E.GroupConstants.KEYS.NAME],e[E.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,e)}catch(t){u.Logger.error("CustomMessageModel: getReceiverFromData",t)}},t}(i.BaseMessage);e.CustomMessage=a},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};e.__esModule=!0,e.Action=void 0;var i=n(7),c=n(8),u=n(4),S=n(1),a=n(0),l=n(10),E=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return s(e,t),e.actionFromJSON=function(t){var e=new this(t[S.MessageConstatnts.KEYS.RECEIVER],t[S.MessageConstatnts.KEYS.TYPE],t[S.MessageConstatnts.KEYS.RECEIVER_TYPE],S.MessageCategory.ACTION),n=t[S.MessageConstatnts.KEYS.DATA];if(e.data=n,e.setAction(n[S.MessageConstatnts.KEYS.ACTION]),n[S.ActionConstatnts.ACTION_KEYS.EXTRAS]){var o=n[S.ActionConstatnts.ACTION_KEYS.EXTRAS];if(o[S.ActionConstatnts.ACTION_KEYS.SCOPE]){var s=o[S.ActionConstatnts.ACTION_KEYS.SCOPE];s[S.ActionConstatnts.ACTION_KEYS.NEW]&&s[S.ActionConstatnts.ACTION_KEYS.OLD]&&(e.setOldScope(s[S.ActionConstatnts.ACTION_KEYS.OLD]),e.setNewScope(s[S.ActionConstatnts.ACTION_KEYS.NEW]))}}n[S.MessageConstatnts.KEYS.METADATA]&&e.setMetadata(n[S.MessageConstatnts.KEYS.METADATA]);var r=n[S.ActionConstatnts.ACTION_KEYS.ENTITIES];if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var i=new u.User(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e.actionBy=i,e.setSender(i)}else{var a=new c.Group("","","");Object.assign(a,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e.actionBy=a}if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR])if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e.actionFor=i}else{a=new c.Group("","","");Object.assign(a,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e.actionFor=a}if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON])if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e.actionOn=i}else if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.GROUP){a=new c.Group("","","");Object.assign(a,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e.actionOn=a}else if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.MESSAGE){var E=l.MessageController.trasformJSONMessge(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]);e.actionOn=E}return e.setMessage(e.getActionMessage(e)),e},e.prototype.getOldScope=function(){return this.oldScope},e.prototype.setOldScope=function(t){this.oldScope=t},e.prototype.getNewScope=function(){return this.newScope},e.prototype.setNewScope=function(t){this.newScope=t},e.prototype.getRawData=function(){return this.rawData},e.prototype.setRawData=function(t){this.rawData=t},e.prototype.getMessage=function(){return this.message},e.prototype.setMessage=function(t){this.message=t},e.prototype.getAction=function(){return this.action},e.prototype.setAction=function(t){this.action=t},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(t){return this.sender}},e.prototype.getActionBy=function(){return this.actionBy},e.prototype.setActionBy=function(t){this.actionBy=t},e.prototype.getActionOn=function(){return this.actionOn},e.prototype.setActionOn=function(t){this.actionOn=t},e.prototype.getActionFor=function(){return this.actionFor},e.prototype.setActionFor=function(t){this.actionFor=t},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(t){this.metadata=t,this.data=r(r({},this.data),{metadata:t})},e.prototype.getActionMessage=function(t){var e="";switch(t.getType()){case S.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_USER:case S.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP:switch(t.getAction()){case S.ActionConstatnts.ACTION_KEYS.ACTION_CREATED:case S.ActionConstatnts.ACTION_KEYS.ACTION_UPDATED:case S.ActionConstatnts.ACTION_KEYS.ACTION_DELETED:}break;case S.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP_MEMBER:switch(t.getAction()){case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_JOINED:var n=t.getActionBy();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_GROUP_JOINED_MESSAGE,n.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_LEFT:n=t.getActionBy();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_GROUP_LEFT_MESSAGE,n.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_KICKED:n=t.getActionBy();var o=t.getActionOn();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_KICKED_MESSAGE,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_BANNED:n=t.getActionBy(),o=t.getActionOn();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_BANNED_MESSAGE,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_UNBANNED:n=t.getActionBy(),o=t.getActionOn();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_UNBANNED_MESSAGE,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.ACTION_SCOPE_CHANGED:n=t.getActionBy(),o=t.getActionOn();var s=t.getNewScope();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_SCOPE_CHANGED,n.getName(),o.getName(),s);break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_ADDED:n=t.getActionBy(),o=t.getActionOn();e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_ADDED_TO_GROUP,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_EDITED:e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MESSAGE_EDITED_MESSAGE,"");break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_DELETED:e=a.format(S.ActionConstatnts.ActionMessages.ACTION_MESSAGE_DELETED_MESSAGE,"")}}return e},e.prototype.getSenderFromData=function(){var t=this.data[S.ActionConstatnts.ACTION_KEYS.ENTITIES];if(t[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY]&&t[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var e=new u.User(t[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]);return Object.assign(e,t[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]),e}},e.TYPE=S.MessageConstatnts.TYPE,e.RECEIVER_TYPE=S.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=S.MessageConstatnts.CATEGORY,e.ACTION_TYPE=S.ActionConstatnts.ACTION_TYPE,e}(i.BaseMessage);e.Action=E},function(t,e,n){"use strict";var o,r=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};e.__esModule=!0,e.Call=void 0;var s=n(7),a=n(8),E=n(1),c=n(0),u=n(4),S=function(s){function t(t,e,n,o){return c.isFalsy(o)?s.call(this,t,e,n,E.MessageCategory.CALL)||this:s.call(this,t,e,n,o)||this}return r(t,s),t.prototype.getCallInitiator=function(){return this.getCallInitiatedByFromData()},t.prototype.setCallInitiator=function(t){this.callInitiator=t},t.prototype.getCallReceiver=function(){return this.getCallReceivedByFromData()},t.prototype.setCallReceiver=function(t){this.callReceiver=t},t.prototype.getData=function(){return this.data},t.prototype.setData=function(t){this.data=t},t.prototype.getSessionId=function(){return this.sessionId},t.prototype.setSessionId=function(t){this.sessionId=t},t.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},t.prototype.setMetadata=function(t){this.metadata=t,this.data=i(i({},this.data),{metadata:t})},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(t){return this.sender}},t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(t){this.action=t},t.prototype.getInitiatedAt=function(){return this.initiatedAt},t.prototype.setInitiatedAt=function(t){this.initiatedAt=t},t.prototype.getJoinedAt=function(){return this.joinedAt},t.prototype.setJoinedAt=function(t){this.joinedAt=t},t.prototype.getRawData=function(){return this.rawData},t.prototype.setRawData=function(t){this.rawData=t},t.callFromJSON=function(t){try{var e=new this(t[E.MessageConstatnts.KEYS.RECEIVER],t[E.MessageConstatnts.KEYS.TYPE],t[E.MessageConstatnts.KEYS.RECEIVER_TYPE],E.MessageCategory.CALL),n=t[E.MessageConstatnts.KEYS.DATA];e.setAction(n[E.MessageConstatnts.KEYS.ACTION]),n[E.MessageConstatnts.KEYS.METADATA]&&e.setMetadata(n[E.MessageConstatnts.KEYS.METADATA]);var o=n[E.ActionConstatnts.ACTION_KEYS.ENTITIES];if(o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY];if(o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON]){var s=o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON];if(s[E.CallConstants.CALL_KEYS.CALL_ENTITY]){var r=s[E.CallConstants.CALL_KEYS.CALL_ENTITY];if(r[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]&&(e.sessionId=r[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]),r[E.CallConstants.CALL_KEYS.CALL_STATUS]&&(e.status=r[E.CallConstants.CALL_KEYS.CALL_STATUS]),r[E.CallConstants.CALL_KEYS.CALL_DATA]){var i=r[E.CallConstants.CALL_KEYS.CALL_DATA];if(i[E.CallConstants.CALL_KEYS.CALL_METADATA]&&(e.metadata=i[E.CallConstants.CALL_KEYS.CALL_METADATA]),i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES])i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES]}r[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]&&(e.initiatedAt=r[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]),r[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]&&(e.joinedAt=r[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]),r[E.CallConstants.CALL_KEYS.CALL_LEFT_AT]&&(e.joinedAt=r[E.CallConstants.CALL_KEYS.CALL_LEFT_AT])}}return e}catch(t){c.Logger.error("CallModel: callFromJSON",t)}},t.prototype.getSenderFromData=function(){try{var t=this.getData();if((t=t[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])return new u.User(t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(t){c.Logger.error("CallModel:getSenderFromData",t)}},t.prototype.getCallInitiatedByFromData=function(){try{var t=this.getData();if((t=t[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(t[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(t){c.Logger.error("CallModel:getCallInitiatedByFromData",t)}},t.prototype.getCallReceivedByFromData=function(){try{var t=this.getData();if((t=t[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]){if(t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY_TYPE]==E.CallConstants.CALL_KEYS.CALL_ENTITY_USER)return new u.User(t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]);var e=new a.Group(t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.GUID],t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.NAME],t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.TYPE]);return Object.assign(e,t[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY])}}catch(t){c.Logger.error("CallModel:getCallReceivedByFromData",t)}},t.TYPE=E.MessageConstatnts.TYPE,t.RECEIVER_TYPE=E.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=E.MessageConstatnts.CATEGORY,t.ACTION_TYPE=E.ActionConstatnts.ACTION_TYPE,t}(s.BaseMessage);e.Call=S},function(t,e,n){"use strict";e.__esModule=!0,e.MessageReceipt=void 0;var o=function(){function t(){this.RECEIPT_TYPE={READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery"},this.receiptType=this.RECEIPT_TYPE.DELIVERY_RECEIPT}return t.prototype.getReceiverType=function(){return this.receiverType},t.prototype.setReceiverType=function(t){this.receiverType=t},t.prototype.getSender=function(){return this.sender},t.prototype.setSender=function(t){this.sender=t},t.prototype.getReceiver=function(){return this.receiver},t.prototype.setReceiver=function(t){this.receiver=t},t.prototype.getTimestamp=function(){return this.timestamp},t.prototype.setTimestamp=function(t){this.timestamp=t},t.prototype.setReadAt=function(t){this.readAt=t},t.prototype.getReadAt=function(){return this.readAt},t.prototype.setDeliveredAt=function(t){this.deliveredAt=t},t.prototype.getDeliveredAt=function(){return this.deliveredAt},t.prototype.getMessageId=function(){return this.messageId},t.prototype.setMessageId=function(t){this.messageId=t},t.prototype.getReceiptType=function(){return this.receiptType},t.prototype.setReceiptType=function(t){void 0===t&&(t=this.RECEIPT_TYPE.DELIVERY_RECEIPT),this.receiptType=t},t}();e.MessageReceipt=o},function(t,e,n){"use strict";var o,i=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.WSConnectionListener=e.UserLoginListener=e.CallsListener=e.UserCallListener=e.GroupsListener=e.UsersListener=e.MessagesListener=e.Listener=e.ConnectionListener=e.LoginListener=e.OngoingCallListener=e.GroupListener=e.UserListener=e.CallListener=e.MessageListener=void 0;var s=n(0),r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];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.onMessageEdited=void 0,this.onMessageDeleted=void 0,this.onTransientMessageReceived=void 0,s.isFalsy(t[0].onTextMessageReceived)||(this.onTextMessageReceived=t[0].onTextMessageReceived),s.isFalsy(t[0].onMediaMessageReceived)||(this.onMediaMessageReceived=t[0].onMediaMessageReceived),s.isFalsy(t[0].onTypingStarted)||(this.onTypingStarted=t[0].onTypingStarted),s.isFalsy(t[0].onTypingEnded)||(this.onTypingEnded=t[0].onTypingEnded),s.isFalsy(t[0].onMessagesDelivered)||(this.onMessagesDelivered=t[0].onMessagesDelivered),s.isFalsy(t[0].onMessagesRead)||(this.onMessagesRead=t[0].onMessagesRead),s.isFalsy(t[0].onCustomMessageReceived)||(this.onCustomMessageReceived=t[0].onCustomMessageReceived),s.isFalsy(t[0].onMessageEdited)||(this.onMessageEdited=t[0].onMessageEdited),s.isFalsy(t[0].onMessageDeleted)||(this.onMessageDeleted=t[0].onMessageDeleted),s.isFalsy(t[0].onTransientMessageReceived)||(this.onTransientMessageReceived=t[0].onTransientMessageReceived)};e.MessageListener=r;var a=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.onIncomingCallReceived=void 0,this.onOutgoingCallAccepted=void 0,this.onOutgoingCallRejected=void 0,this.onIncomingCallCancelled=void 0,this.onCallEndedMessageReceived=void 0,s.isFalsy(t[0].onIncomingCallReceived)||(this.onIncomingCallReceived=t[0].onIncomingCallReceived),s.isFalsy(t[0].onOutgoingCallAccepted)||(this.onOutgoingCallAccepted=t[0].onOutgoingCallAccepted),s.isFalsy(t[0].onOutgoingCallRejected)||(this.onOutgoingCallRejected=t[0].onOutgoingCallRejected),s.isFalsy(t[0].onIncomingCallCancelled)||(this.onIncomingCallCancelled=t[0].onIncomingCallCancelled),s.isFalsy(t[0].onCallEndedMessageReceived)||(this.onCallEndedMessageReceived=t[0].onCallEndedMessageReceived)};e.CallListener=a;var E=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];s.isFalsy(t[0].onUserOnline)||(this.onUserOnline=t[0].onUserOnline),s.isFalsy(t[0].onUserOffline)||(this.onUserOffline=t[0].onUserOffline)};e.UserListener=E;var c=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];s.isFalsy(t[0].onGroupMemberJoined)||(this.onGroupMemberJoined=t[0].onGroupMemberJoined),s.isFalsy(t[0].onGroupMemberLeft)||(this.onGroupMemberLeft=t[0].onGroupMemberLeft),s.isFalsy(t[0].onGroupMemberKicked)||(this.onGroupMemberKicked=t[0].onGroupMemberKicked),s.isFalsy(t[0].onGroupMemberBanned)||(this.onGroupMemberBanned=t[0].onGroupMemberBanned),s.isFalsy(t[0].onGroupMemberUnbanned)||(this.onGroupMemberUnbanned=t[0].onGroupMemberUnbanned),s.isFalsy(t[0].onGroupMemberScopeChanged)||(this.onGroupMemberScopeChanged=t[0].onGroupMemberScopeChanged),s.isFalsy(t[0].onMemberAddedToGroup)||(this.onGroupMemberAddedToGroup=t[0].onMemberAddedToGroup)};e.GroupListener=c;var u=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];s.isFalsy(t[0].onYouLeft)||(this.onYouLeft=t[0].onYouLeft),s.isFalsy(t[0].onYouJoined)||(this.onYouJoined=t[0].onYouJoined),s.isFalsy(t[0].onUserJoined)||(this.onUserJoined=t[0].onUserJoined),s.isFalsy(t[0].onUserLeft)||(this.onUserLeft=t[0].onUserLeft),s.isFalsy(t[0].onUserListUpdated)||(this.onUserListUpdated=t[0].onUserListUpdated),s.isFalsy(t[0].onMediaDeviceListUpdated)||(this.onMediaDeviceListUpdated=t[0].onMediaDeviceListUpdated),s.isFalsy(t[0].onRecordingStarted)||(this.onRecordingStarted=t[0].onRecordingStarted),s.isFalsy(t[0].onRecordingStopped)||(this.onRecordingStopped=t[0].onRecordingStopped),s.isFalsy(t[0].onScreenShareStarted)||(this.onScreenShareStarted=t[0].onScreenShareStarted),s.isFalsy(t[0].onScreenShareStopped)||(this.onScreenShareStopped=t[0].onScreenShareStopped),s.isFalsy(t[0].onUserMuted)||(this.onUserMuted=t[0].onUserMuted),s.isFalsy(t[0].onCallSwitchedToVideo)||(this.onCallSwitchedToVideo=t[0].onCallSwitchedToVideo),s.isFalsy(t[0].onCallEnded)||(this.onCallEnded=t[0].onCallEnded),s.isFalsy(t[0].onError)||(this.onError=t[0].onError)};e.OngoingCallListener=u;var S=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];s.isFalsy(t[0].loginSuccess)||(this.loginSuccess=t[0].loginSuccess),s.isFalsy(t[0].loginFailure)||(this.loginFailure=t[0].loginFailure),s.isFalsy(t[0].logoutSuccess)||(this.logoutSuccess=t[0].logoutSuccess),s.isFalsy(t[0].logoutFailure)||(this.logoutFailure=t[0].logoutFailure)};e.LoginListener=S;var l=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this.onConnected=void 0,this.inConnecting=void 0,this.onDisconnected=void 0,this.onFeatureThrottled=void 0,s.isFalsy(t[0].onConnected)||(this.onConnected=t[0].onConnected),s.isFalsy(t[0].inConnecting)||(this.inConnecting=t[0].inConnecting),s.isFalsy(t[0].onDisconnected)||(this.onDisconnected=t[0].onDisconnected),s.isFalsy(t[0].onFeatureThrottled)||(this.onFeatureThrottled=t[0].onFeatureThrottled)};e.ConnectionListener=l;var p=function(t,e){this._name=t,this._callback=e},C=function(r){function t(t,e,n,o){var s=r.call(this,t,o)||this;return s._eventListener=e,n&&(s._cursor=n),s}return i(t,r),t}(e.Listener=p);e.MessagesListener=C;var T=function(r){function t(t,e,n,o){var s=r.call(this,t,o)||this;return s._eventListener=e,n&&(s._cursor=n),s}return i(t,r),t}(p);e.UsersListener=T;var d=function(r){function t(t,e,n,o){var s=r.call(this,t,o)||this;return s._eventListener=e,n&&(s._cursor=n),s}return i(t,r),t}(p);e.GroupsListener=d;var _=function(s){function t(t,e,n){var o=s.call(this,"callListner",n)||this;return o._eventListener=t,o}return i(t,s),t}(p);e.UserCallListener=_;var g=function(r){function t(t,e,n,o){var s=r.call(this,t,o)||this;return s._eventListener=e,s}return i(t,r),t}(p);e.CallsListener=g;var h=function(r){function t(t,e,n,o){var s=r.call(this,t,o)||this;return s._eventListener=e,n&&(s._cursor=n),s}return i(t,r),t}(p);e.UserLoginListener=h;var A=function(r){function t(t,e,n,o){var s=r.call(this,t,o)||this;return s._eventListener=e,n&&(s._cursor=n),s}return i(t,r),t}(p);e.WSConnectionListener=A},function(t,e,n){"use strict";e.__esModule=!0,e.ConversationController=void 0;var a=n(35),E=n(0),o=function(){function t(){}return t.trasformJSONConversation=function(t,e,n,o,s,r){var i;try{i=new a.Conversation(t,e,n,o,s,r)}catch(t){E.Logger.error("ConversationController:transformJSONConversation",t)}return i},t}();e.ConversationController=o},function(t,e,n){"use strict";e.__esModule=!0,e.MessageListnerMaping=void 0;var o=n(0),s=n(1),r=n(12),i=n(3),a=function(){function t(t){this.store=s.constants.DEFAULT_STORE,o.isFalsy(t)||(this.store=t),this.settingsStore=r.createInstance({name:o.format(s.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),s.LOCAL_STORE.MESSAGE_LISTENERS_LIST)}),this.settingsStore.setDriver([r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL])}return t.getInstance=function(){return null==t.settingsStore&&(t.settingsStore=new t),t.settingsStore},t.prototype.set=function(t,e){return this.settingsStore.setItem(t,e)},t.prototype.remove=function(t){this.settingsStore.removeItem(t)},t.prototype.get=function(t){return this.settingsStore.getItem(t)},t.prototype.clearStore=function(){return this.settingsStore.clear()},t.prototype.clear=function(t){},t.prototype.selectStore=function(t){this.store=t},t.settingsStore=null,t}();e.MessageListnerMaping=a},function(t,e,n){"use strict";e.__esModule=!0,e.TypingIndicator=void 0;var o=function(){function t(t,e,n){this.receiverId=t,this.receiverType=e,this.metadata=n}return t.prototype.getReceiverType=function(){return this.receiverType},t.prototype.setReceiverType=function(t){this.receiverType=t},t.prototype.getReceiverId=function(){return this.receiverId},t.prototype.setReceiverId=function(t){this.receiverId=t},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(t){this.metadata=t},t.prototype.getSender=function(){return this.sender},t.prototype.setSender=function(t){this.sender=t},t}();e.TypingIndicator=o},function(t,e,n){"use strict";e.__esModule=!0,e.TransientMessage=void 0;var o=function(){function t(t,e,n){this.receiverId=t,this.receiverType=e,this.data=n||{}}return t.prototype.getReceiverId=function(){return this.receiverId},t.prototype.setReceiverId=function(t){this.receiverId=t},t.prototype.getReceiverType=function(){return this.receiverType},t.prototype.setReceiverType=function(t){this.receiverType=t},t.prototype.getData=function(){return this.data},t.prototype.setData=function(t){this.data=t},t.prototype.getSender=function(){return this.sender},t.prototype.setSender=function(t){this.sender=t},t}();e.TransientMessage=o},function(t,e,n){"use strict";e.__esModule=!0,e.EndpointFactory=void 0;var c=n(0),u=n(1),o=n(14),S=n(3),l=n(2),s=function(){function E(){this.baseUrl="https://%s.apiclient-%s.cometchat.io/",this.apiVersion=u.APPINFO.apiVersion,this.adminApiUrl="https://%s.api-%s.cometchat.io/",this.adminApiVersion=u.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"},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},sendFriendRequests:{endpoint:"user/friends",method:"POST",data:{uids:"array<string|max:100>"}},getFriends:{endpoint:"user/friends",method:"GET"},unfriend:{endpoint:"user/friends/{{uid}}/{{gid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},acceptFriendRequest:{endpoint:"user/friends/{{uid}}/accept",method:"PUT",data:{uids:"array<string|max:100>"}},rejectFriendRequest:{endpoint:"user/friends/{{uid}}/reject",method:"DELETE",data:{uids:"array<string|max:100>"}},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"},getUserMessages:{endpoint:"users/{{listId}}/messages",method:"GET"},getGroupMessages:{endpoint:"groups/{{listId}}/messages",method:"GET"},getThreadMessages:{endpoint:"messages/{{listId}}/thread",method:"GET"},getMessage:{endpoint:"user/messages/{{muid}}",method:"GET"},updateMessage:{endpoint:"messages/{{messageId}}",method:"PUT"},deleteMessage:{endpoint:"messages/{{messageId}}",method:"DELETE"},createCallSession:{endpoint:"calls",method:"POST",data:{}},updateCallSession:{endpoint:"calls/{{sessionid}}",method:"put",data:{}},getConversations:{endpoint:"conversations",method:"GET"},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"}}}return E.prototype.getEndpointData=function(a){return new Promise(function(s,e){try{var r=S.CometChat.appSettings.getAdminHost(),i=S.CometChat.appSettings.getClientHost();o.LocalStorage.getInstance().get(u.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){if(c.isFalsy(t)){var e={};if((new E).uriEndpoints.hasOwnProperty(a))if((e=(new E).uriEndpoints[a]).hasOwnProperty("isAdminApi"))if(c.isFalsy(r)){var n=c.format((new E).adminApiUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).adminApiVersion+"/"+e.endpoint;e.endpoint=n,s(e)}else{n="https://"+r+"/"+e.endpoint;e.endpoint=n,s(e)}else if(c.isFalsy(i)){n=c.format((new E).baseUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).apiVersion+"/"+e.endpoint;e.endpoint=n,s(e)}else{n="https://"+i+"/"+e.endpoint;e.endpoint=n,s(e)}}else{e={};if((new E).uriEndpoints.hasOwnProperty(a))if((e=(new E).uriEndpoints[a]).hasOwnProperty("isAdminApi")){var o="https://"+t[u.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+t[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+e.endpoint;e.endpoint=o,s(e)}else{o="https://"+t[u.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+t[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+e.endpoint;e.endpoint=o,s(e)}}},function(t){var e;if((new E).uriEndpoints.hasOwnProperty(a))if((e=(new E).uriEndpoints[a]).hasOwnProperty(["isAdminApi"]))if(c.isFalsy(r)){var n=c.format((new E).adminApiUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).adminApiVersion+"/"+e.endpoint;e.endpoint=n,s(e)}else e.endpoint="https://"+r+"/"+e.endpoint,s(e);else if(c.isFalsy(i)){n=c.format((new E).baseUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).apiVersion+"/"+e.endpoint;e.endpoint=n,s(e)}else e.endpoint="https://"+i+"/"+e.endpoint,s(e)})}catch(t){e(new l.CometChatException(t))}})},E}();e.EndpointFactory=s},function(t,e,n){"use strict";e.__esModule=!0,e.getEndPoint=void 0;var o=n(28),i=n(2);e.getEndPoint=function(t,r){void 0===t&&(t=""),void 0===r&&(r={});var e=new o.EndpointFactory;return new Promise(function(o,s){try{e.getEndpointData(t).then(function(t){var e=t;if(e){for(var n in r)e.endpoint=e.endpoint.replace("{{"+n+"}}",r[n]);o(e)}else s({error:"Unknown endPoint name."})})}catch(t){s(new i.CometChatException(t))}})}},function(t,e,n){"use strict";e.__esModule=!0,e.KeyStore=void 0;var o=n(3),s=n(0),r=n(1),i=n(12),a=n(2),E=function(){function t(t){this.store=r.constants.DEFAULT_STORE,s.isFalsy(t)||(this.store=t),this.keyStore=i.createInstance({name:s.format(r.LOCAL_STORE.STORE_STRING,o.CometChat.getAppId(),r.LOCAL_STORE.KEYS_STORE)}),this.keyStore.setDriver([i.LOCALSTORAGE,i.INDEXEDDB,i.WEBSQL])}return t.getInstance=function(){return null==t.KeyStore&&(t.KeyStore=new t),t.KeyStore},t.prototype.set=function(t,e){return this.keyStore.setItem(t,e)},t.prototype.remove=function(t){this.keyStore.removeItem(t)},t.prototype.get=function(t){var o=this;return new Promise(function(n,e){try{o.keyStore.getItem(t).then(function(e){try{n(JSON.parse(e))}catch(t){n(e)}},function(t){e(t)})}catch(t){e(new a.CometChatException(t))}})},t.prototype.clearStore=function(){return this.keyStore.clear()},t}();e.KeyStore=E},function(t,e,n){"use strict";e.__esModule=!0,e.CallController=void 0;var h=n(1),A=n(0),R=n(3),s=n(2),o=n(23),r=n(32),I=n(4),f=n(6),i=function(){function g(){this.TAG="calling Log",this.CALL_NO_ANSWER_INTERVAL=45e3,this.view=void 0,this.isDev=!1}return g.prototype.getCallListner=function(){return g.callListner},g.prototype.setCallListner=function(t){g.callListner=new o.UserCallListener(t)},g.getInstance=function(){try{return null!=this.callController&&null!=this.callController||(this.callController=new g),this.callController}catch(t){A.Logger.error("CallController: getInstance",t)}},g.prototype.getActiveCall=function(){try{return A.isFalsy(this.call)?null:this.call}catch(t){A.Logger.error("CallController: getActiveCall",t)}},g.prototype.initiateCall=function(n){var o=this;return new Promise(function(t,e){try{A.isFalsy(o.call)?null!=n&&null!=n?(o.call=n,o.startCallTimer(),t(n)):e(new s.CometChatException(h.CALL_ERROR.ERROR_IN_CALLING)):e(new s.CometChatException(h.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(t){e(new s.CometChatException(t))}})},g.prototype.endCall=function(t){var e=this;try{document.getElementsByName("frame").forEach(function(t){e.view&&(e.view.removeChild(t),e.view=void 0)}),this.endCallSession()}catch(t){A.Logger.error("CallController: endCall",t)}},g.prototype.onCallStarted=function(n){var o=this;return new Promise(function(t,e){try{A.isFalsy(o.call)?null!=n&&null!=n?t(o.call=n):e(new s.CometChatException(h.CALL_ERROR.ERROR_IN_CALLING)):e(new s.CometChatException(h.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(t){e(new s.CometChatException(t))}})},g.prototype.endCallSession=function(){try{this.call=void 0,g.callController=void 0,this.timer&&this.stopCallTimer(),this.view=void 0,this.removeListener(),g.callScreen=null,g.callSettings=null}catch(t){A.Logger.error("CallController:EndCallSession",{e:t})}},g.prototype.startCallTimer=function(){var e=this;try{this.timer=setTimeout(function(){e.call?R.CometChat.sendUnansweredResponse(e.call.getSessionId()).then(function(t){e.endCallSession()},function(t){e.endCallSession()}):e.endCallSession()},this.CALL_NO_ANSWER_INTERVAL)}catch(t){A.Logger.error("CallController: startCallTimer",t)}},g.prototype.stopCallTimer=function(){try{clearTimeout(this.timer)}catch(t){A.Logger.error("CallController: stopCallTimer",t)}},g.prototype.startCall=function(e,n){var o=this;try{this.timer&&this.stopCallTimer();var s=document.createElement("iframe");this.getCallUrl().then(function(t){s.src=t+"",s.name="frame",s.setAttribute("allow","camera; microphone; display-capture;"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),g.callScreen=s,g.callSettings=e,n&&(o.view=n),n.appendChild(s),o.addListener()})}catch(t){A.Logger.error("CallController: startCall",t)}},g.prototype.addListener=function(){window.addEventListener("message",this.handler,!0)},g.prototype.removeListener=function(){window.removeEventListener("message",this.handler,!0)},g.prototype.handler=function(t){var e,n=this,o=g.callSettings,s=g.callScreen,r=g.getInstance().getActiveCall();try{if(void 0!==(e=JSON.parse(t.data))&&e.type==h.CallConstants.POST_MESSAGES.TYPES.HANGUP)g.deviceList=null,r?(A.Logger.info(this.TAG,g.callListner),window.setTimeout(function(){R.CometChat.endCall(r.getSessionId(),!0).then(function(t){A.Logger.info(n.TAG,{call:t})}).catch(function(t){A.Logger.info(n.TAG,"The Call Was Already Ended")})},1e3)):R.CometChat.endCall(o.getSessionId(),!0).then(function(t){A.Logger.info(n.TAG,{call:t})}).catch(function(t){A.Logger.info(n.TAG,"The Call Was Already Ended")});else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_JOINED){if(e.value){var i=void 0,a=e.value;A.isFalsy(a.uid)||A.isFalsy(a.name)||((i=new I.User(a)).setStatus("online"),R.CometChat.user.getUid().toLowerCase()!=i.getUid().toLowerCase()&&g.callListner&&(A.isFalsy(g.callListner._eventListener.onUserJoined)||g.callListner._eventListener.onUserJoined(i)))}}else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_LEFT){if(e.value){i=void 0,a=e.value;A.isFalsy(a.uid)||A.isFalsy(a.name)||((i=new I.User(a)).setStatus("online"),R.CometChat.user.getUid().toLowerCase()!=i.getUid().toLowerCase()&&g.callListner&&(A.isFalsy(g.callListner._eventListener.onUserLeft)||g.callListner._eventListener.onUserLeft(i)))}}else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_LIST_CHANGED){var E=[];if(e.value&&0<e.value.length)e.value.map(function(t){if(!A.isFalsy(t.uid)&&!A.isFalsy(t.name)){var e=new I.User(t);e.setStatus("online"),E.push(e)}}),g.callListner&&(A.isFalsy(g.callListner._eventListener.onUserListUpdated)||g.callListner._eventListener.onUserListUpdated(E))}else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.INITIAL_DEVICE_LIST)A.Logger.info("initialDeviceList received in SDK = ",e),e.value&&(g.deviceList=e.value);else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.DEVICE_CHANGE){if(A.Logger.info("onDeviceChange received in SDK = ",e),e.value){g.deviceList=e.value;var c=g.getAvailableDeviceObject(g.deviceList);g.callListner&&(A.isFalsy(g.callListner._eventListener.onMediaDeviceListUpdated)||g.callListner._eventListener.onMediaDeviceListUpdated(c))}}else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.RECORDING_TOGGLED){if(A.Logger.info("onRecordingToggled received in SDK = ",e),e.value)if((C=e.value).hasOwnProperty("user")&&C.hasOwnProperty("recordingStarted")&&!A.isFalsy(C.user.uid)&&!A.isFalsy(C.user.name)){var u=new I.User(C.user);u.setStatus("online");var S=C.recordingStarted;g.callListner&&(S?A.isFalsy(g.callListner._eventListener.onRecordingStarted)||g.callListner._eventListener.onRecordingStarted(u):A.isFalsy(g.callListner._eventListener.onRecordingStopped)||g.callListner._eventListener.onRecordingStopped(u))}}else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_MUTED){if(A.Logger.info("onUserMuted received in SDK = ",e),e.value)if((C=e.value).hasOwnProperty("muted")&&C.hasOwnProperty("mutedBy")&&!A.isFalsy(C.muted.uid)&&!A.isFalsy(C.muted.name)&&!A.isFalsy(C.mutedBy.uid)&&!A.isFalsy(C.mutedBy.name)){var l=new I.User(C.muted);l.setStatus("online");var p=new I.User(C.mutedBy);p.setStatus("online"),g.callListner&&(A.isFalsy(g.callListner._eventListener.onUserMuted)||g.callListner._eventListener.onUserMuted(l,p))}}else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.SCREEN_SHARE_STARTED)g.callListner&&(A.isFalsy(g.callListner._eventListener.onScreenShareStarted)||g.callListner._eventListener.onScreenShareStarted(null));else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.SCREEN_SHARE_STOPPED)g.callListner&&(A.isFalsy(g.callListner._eventListener.onScreenShareStopped)||g.callListner._eventListener.onScreenShareStopped(null));else if(void 0!==e&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.SWITCHED_TO_VIDEO_CALL){if(e.value){var C=e.value;if(A.Logger.info("onCallSwitchedToVideo received in SDK = ",C),C.hasOwnProperty("initiator")&&C.hasOwnProperty("sessionId")&&!A.isFalsy(C.initiator.uid)&&!A.isFalsy(C.sessionId)&&C.hasOwnProperty("accepted")&&!A.isFalsy(C.accepted.uid)){var T=C.sessionId,d=new I.User(C.initiator);d.setStatus("online");var _=new I.User(C.accepted);if(_.setStatus("online"),g.getInstance().getCallListner()&&(A.isFalsy(g.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo)||g.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo(T,d,_)),C.initiator.uid.toLowerCase()===R.CometChat.user.getUid().toLowerCase()&&!C.sessionId.includes("v1."))try{f.makeApiCall("updateCallType",{sessionid:T},{type:"video"}).then(function(t){},function(t){A.Logger.error("CallController :: onSwitchedToVideo",t)})}catch(t){A.Logger.error("CallController :: onSwitchedToVideo",t)}}}}else void 0!==e&&e.type&&e.action&&e.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&e.action==h.CallConstants.POST_MESSAGES.ACTIONS.LOAD&&null!=s.contentWindow&&s.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.COMETCHAT_RTC_SETTINGS,callsettings:JSON.stringify(o)},"*")}catch(t){e=void 0,A.Logger.error("CallController: startCall",t)}},g.prototype.getCallUrl=function(){var t=this,o=void 0;return new Promise(function(e,n){try{t.isDev?(o="https://rtc-test.cometchat.io/?v="+h.CALLING_COMPONENT_VERSION,e(o)):A.getAppSettings().then(function(t){o="https://"+t[h.APP_SETTINGS.KEYS.WEBRTC_WEB_FRONTEND_HOST]+"/?v="+h.CALLING_COMPONENT_VERSION,e(o)})}catch(t){n(new s.CometChatException(t))}})},g.getAvailableDeviceArray=function(t){var e=[];try{return t&&0<t.length&&t.map(function(t){e.push(new r.MediaDevice(t.deviceId,t.label,t.active))}),e}catch(t){return A.Logger.error("CallController: getAvailableDeviceArray",t),e}},g.getAvailableDeviceObject=function(t){var e=[],n=[],o=[];try{return A.isFalsy(t)||A.isFalsy(t[h.CallConstants.AUDIO_INPUT_DEVICES])||(e=g.getAvailableDeviceArray(t[h.CallConstants.AUDIO_INPUT_DEVICES])),A.isFalsy(t)||A.isFalsy(t[h.CallConstants.AUDIO_OUTPUT_DEVICES])||(n=g.getAvailableDeviceArray(t[h.CallConstants.AUDIO_OUTPUT_DEVICES])),A.isFalsy(t)||A.isFalsy(t[h.CallConstants.VIDEO_INPUT_DEVICES])||(o=g.getAvailableDeviceArray(t[h.CallConstants.VIDEO_INPUT_DEVICES])),{audioInputDevices:e,audioOutputDevices:n,videoInputDevices:o}}catch(t){return A.Logger.error("CallController: getAvailableDeviceObject",t),{audioInputDevices:e,audioOutputDevices:n,videoInputDevices:o}}},g.prototype.getAudioInputDevices=function(){var e=[];try{return A.isFalsy(g.deviceList)||A.isFalsy(g.deviceList[h.CallConstants.AUDIO_INPUT_DEVICES])||(e=g.getAvailableDeviceArray(g.deviceList[h.CallConstants.AUDIO_INPUT_DEVICES])),e}catch(t){return A.Logger.error("CallController: getAudioInputDevices",t),e}},g.prototype.getAudioOutputDevices=function(){var e=[];try{return A.isFalsy(g.deviceList)||A.isFalsy(g.deviceList[h.CallConstants.AUDIO_OUTPUT_DEVICES])||(e=g.getAvailableDeviceArray(g.deviceList[h.CallConstants.AUDIO_OUTPUT_DEVICES])),e}catch(t){return A.Logger.error("CallController: getAudioOutputDevices",t),e}},g.prototype.getVideoInputDevices=function(){var e=[];try{return A.isFalsy(g.deviceList)||A.isFalsy(g.deviceList[h.CallConstants.VIDEO_INPUT_DEVICES])||(e=g.getAvailableDeviceArray(g.deviceList[h.CallConstants.VIDEO_INPUT_DEVICES])),e}catch(t){return A.Logger.error("CallController: getVideoInputDevices",t),e}},g.prototype.setAudioInputDevice=function(e){try{if(g.callScreen&&!A.isFalsy(e)){var t=g.getAvailableDeviceArray(g.deviceList[h.CallConstants.AUDIO_INPUT_DEVICES]).filter(function(t){return t[h.CallConstants.MEDIA_DEVICE.ID]===e&&!t[h.CallConstants.MEDIA_DEVICE.ACTIVE]});t&&0<t.length&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_AUDIO_INPUT,value:e},"*")}}catch(t){A.Logger.error("CallController: setAudioInputDevice",t)}},g.prototype.setAudioOutputDevice=function(e){try{if(g.callScreen&&!A.isFalsy(e)){var t=g.getAvailableDeviceArray(g.deviceList[h.CallConstants.AUDIO_OUTPUT_DEVICES]).filter(function(t){return t[h.CallConstants.MEDIA_DEVICE.ID]===e&&!t[h.CallConstants.MEDIA_DEVICE.ACTIVE]});t&&0<t.length&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_AUDIO_OUTPUT,value:e},"*")}}catch(t){A.Logger.error("CallController: setAudioOutputDevice",t)}},g.prototype.setVideoInputDevice=function(e){try{if(g.callScreen&&!A.isFalsy(e)){var t=g.getAvailableDeviceArray(g.deviceList[h.CallConstants.VIDEO_INPUT_DEVICES]).filter(function(t){return t[h.CallConstants.MEDIA_DEVICE.ID]===e&&!t[h.CallConstants.MEDIA_DEVICE.ACTIVE]});t&&0<t.length&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_VIDEO_INPUT,value:e},"*")}}catch(t){A.Logger.error("CallController: setVideoInputDevice",t)}},g.prototype.muteAudio=function(t){try{g.callScreen&&(t?g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.MUTE_AUDIO},"*"):g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.UNMUTE_AUDIO},"*"))}catch(t){A.Logger.error("CallController: muteAudio",t)}},g.prototype.pauseVideo=function(t){try{g.callScreen&&(t?g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.PAUSE_VIDEO},"*"):g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.UNPAUSE_VIDEO},"*"))}catch(t){A.Logger.error("CallController: pauseVideo",t)}},g.prototype.setMode=function(t){try{g.callScreen&&!A.isFalsy(t)&&(t=t.toUpperCase(),-1<Object.values(h.CallConstants.CALL_MODE).indexOf(t)&&t!=h.CallConstants.CALL_MODE.SINGLE&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SWITCH_MODE,value:t},"*"))}catch(t){A.Logger.error("CallController: setMode",t)}},g.prototype.startScreenShare=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.START_SCREENSHARE},"*")}catch(t){A.Logger.error("CallController: startScreenShare",t)}},g.prototype.stopScreenShare=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.STOP_SCREENSHARE},"*")}catch(t){A.Logger.error("CallController: stopScreenShare",t)}},g.prototype.startRecording=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.START_RECORDING},"*")}catch(t){A.Logger.error("CallController: startRecording",t)}},g.prototype.stopRecording=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.STOP_RECORDING},"*")}catch(t){A.Logger.error("CallController: stopRecording",t)}},g.prototype.switchToVideoCall=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SWITCH_TO_VIDEO_CALL},"*")}catch(t){A.Logger.error("CallController: switchToVideoCall",t)}},g.prototype.openVirtualBackground=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.OPEN_VIRTUAL_BACKGROUND},"*")}catch(t){A.Logger.error("CallController: openVirtualBackground",t)}},g.prototype.setBackgroundBlur=function(t){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SET_BACKGROUND_BLUR,value:t},"*")}catch(t){A.Logger.error("CallController: openVirtualBackground",t)}},g.prototype.setBackgroundImage=function(t){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SET_BACKGROUND_IMAGE,value:t},"*")}catch(t){A.Logger.error("CallController: openVirtualBackground",t)}},g.prototype.endSession=function(){try{g.callScreen&&g.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.END_CALL},"*")}catch(t){A.Logger.error("CallController: endSession",t)}},g.callController=void 0,g.callListner=void 0,g}();e.CallController=i},function(t,e,n){"use strict";e.__esModule=!0,e.MediaDevice=void 0;var o=n(0),s=function(){function t(t,e,n){this.id="",this.name="",this.active=!1,o.isFalsy(t)||(this.id=t),o.isFalsy(e)||(this.name=e),this.active=!!n}return t.prototype.getId=function(){return this.id},t.prototype.setId=function(t){this.id=t||""},t.prototype.getName=function(){return this.name},t.prototype.setName=function(t){this.name=t||""},t.prototype.getIsActive=function(){return this.active},t.prototype.setIsActive=function(t){this.active=!!t},t}();e.MediaDevice=s},function(t,e,n){"use strict";e.__esModule=!0,e.GroupMembersController=void 0;var o=n(34),s=n(1),r=n(0),i=function(){function t(){}return t.trasformJSONGroupMember=function(e){var t;try{return e.status&&"offline"!==e.status?e.status="online":e.status="offline",t=new o.GroupMember(e[s.GroupMemersConstans.KEYS.UID]),Object.assign(t,e),t}catch(t){return r.Logger.error("GroupMembersController:trasformJSONGroupMember",{e:t,groupMember:e}),e}},t}();e.GroupMembersController=i},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.GroupMember=void 0;var r=n(4),i=n(1),a=function(o){function t(t,e){var n=o.call(this,t)||this;return n.joinedAt=0,e&&(n.scope=e),n}return s(t,o),t.prototype.setScope=function(t){this.scope=t},t.prototype.setJoinedAt=function(t){this.joinedAt=t},t.prototype.setGuid=function(t){this.guid=t},t.prototype.getScope=function(){return this.scope},t.prototype.getJoinedAt=function(){return this.joinedAt},t.prototype.getGuid=function(){return this.guid},t.GroupMemberScope=i.GroupMemberScope,t}(r.User);e.GroupMember=a},function(t,e,n){"use strict";e.__esModule=!0,e.Conversation=void 0;var i=n(10),a=n(1),E=n(11),c=n(15),o=function(){function t(t,e,n,o,s,r){this.conversationId=t,this.conversationType=e,r&&0<r.length&&(this.tags=r),void 0!==n&&void 0!==(this.lastMessage=n).id&&(this.lastMessage=i.MessageController.trasformJSONMessge(n)),this.conversationType==a.MessageConstatnts.RECEIVER_TYPE.USER?this.conversationWith=E.UsersController.trasformJSONUser(o):this.conversationWith=c.GroupsController.trasformJSONGroup(o),this.unreadMessageCount=void 0!==s?s:0}return t.prototype.setConversationId=function(t){this.conversationId=t},t.prototype.setConversationType=function(t){this.conversationType=t},t.prototype.setLastMessage=function(t){this.lastMessage=t},t.prototype.setConversationWith=function(t){this.conversationWith=t},t.prototype.setUnreadMessageCount=function(t){this.unreadMessageCount=t},t.prototype.getConversationId=function(){return this.conversationId},t.prototype.getConversationType=function(){return this.conversationType},t.prototype.getLastMessage=function(){return this.lastMessage},t.prototype.getConversationWith=function(){return this.conversationWith},t.prototype.getUnreadMessageCount=function(){return this.unreadMessageCount},t.prototype.getTags=function(){return this.tags},t}();e.Conversation=o},function(t,e,n){"use strict";e.__esModule=!0,e.TypingNotificationController=void 0;var o=n(0),s=function(){function t(){}return t.addTypingStarted=function(t){this.TYPING_STARTED_MAP[t]=o.getCurrentTime()},t.removeTypingStarted=function(t){delete this.TYPING_STARTED_MAP[t]},t.getTypingStartedMap=function(t){if(t)return this.TYPING_STARTED_MAP[t]},t.addTypingEnded=function(t){this.TYPING_ENDED_MAP[t]=o.getCurrentTime()},t.removeTypingEnded=function(t){delete this.TYPING_ENDED_MAP[t]},t.getTypingEndedMap=function(t){if(t)return this.TYPING_ENDED_MAP[t]},t.addIncomingTypingStarted=function(t){this.INCOMING_TYPING_STARTED_MAP[t.getReceiverId()]={typingNotification:t,timestamp:o.getCurrentTime()}},t.removeIncomingTypingStarted=function(t){delete this.INCOMING_TYPING_STARTED_MAP[t.getReceiverId()]},t.TYPING_STARTED_MAP={},t.TYPING_ENDED_MAP={},t.INCOMING_TYPING_STARTED_MAP={},t}();e.TypingNotificationController=s},function(t,e,n){"use strict";var o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),s=0;for(e=0;e<n;e++)for(var r=arguments[e],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};e.__esModule=!0,e.ListenerHandlers=void 0;var s=n(0),r=n(23),i=function(){function t(){this.connectionHandlers=[],this.loginHandlers=[],this.messageHandlers=[],this.userHandlers=[],this.groupHandlers=[],this.callHandlers=[]}return t.getInstance=function(){return null!=this.listenerHandlers&&null!=this.listenerHandlers||(this.listenerHandlers=new t),this.listenerHandlers},t.prototype.addConnectionEventListener=function(e,t){try{this.connectionHandlers=this.connectionHandlers.filter(function(t){return t._name!=e}),this.connectionHandlers=o(this.connectionHandlers,[new r.WSConnectionListener(e,t)])}catch(t){s.Logger.error("ListenerHandlers: addWSConnectionEventListener",t)}},t.prototype.removeConnectionEventListener=function(e){try{this.connectionHandlers=this.connectionHandlers.filter(function(t){return t._name!==e})}catch(t){s.Logger.error("ListenerHandlers: removeWSConnectionEventListener",t)}},t.prototype.addLoginEventListener=function(e,t){try{this.loginHandlers=this.loginHandlers.filter(function(t){return t._name!=e}),this.loginHandlers=o(this.loginHandlers,[new r.UserLoginListener(e,t)])}catch(t){s.Logger.error("ListenerHandlers: addLoginEventListener",t)}},t.prototype.removeLoginEventListener=function(e){try{this.loginHandlers=this.loginHandlers.filter(function(t){return t._name!==e})}catch(t){s.Logger.error("ListenerHandlers: removeLoginEventListener",t)}},t.prototype.addMessageEventListener=function(e,t){try{this.messageHandlers=this.messageHandlers.filter(function(t){return t._name!=e}),this.messageHandlers=o(this.messageHandlers,[new r.MessagesListener(e,t)])}catch(t){s.Logger.error("ListenerHandlers: addMessageEventListener",t)}},t.prototype.removeMessageEventListener=function(e){try{this.messageHandlers=this.messageHandlers.filter(function(t){return t._name!==e})}catch(t){s.Logger.error("ListenerHandlers: removeMessageEventListener",t)}},t.prototype.addUserEventListener=function(e,t){try{this.userHandlers=this.userHandlers.filter(function(t){return t._name!=e}),this.userHandlers=o(this.userHandlers,[new r.UsersListener(e,t)])}catch(t){s.Logger.error("ListenerHandlers: addUserEventListener",t)}},t.prototype.removeUserEventListener=function(e){try{this.userHandlers=this.userHandlers.filter(function(t){return t._name!==e})}catch(t){s.Logger.error("ListenerHandlers: removeUserEventListener",t)}},t.prototype.addGroupEventListener=function(e,t){try{this.groupHandlers=this.groupHandlers.filter(function(t){return t._name!=e}),this.groupHandlers=o(this.groupHandlers,[new r.GroupsListener(e,t)])}catch(t){s.Logger.error("ListenerHandlers: addGroupEventListener",t)}},t.prototype.removeGroupEventListener=function(e){try{this.groupHandlers=this.groupHandlers.filter(function(t){return t._name!==e})}catch(t){s.Logger.error("ListenerHandlers: removeGroupEventListener",t)}},t.prototype.addCallEventListener=function(e,t){try{this.callHandlers=this.callHandlers.filter(function(t){return t._name!=e}),this.callHandlers=o(this.callHandlers,[new r.CallsListener(e,t)])}catch(t){s.Logger.error("ListenerHandlers: addCallEventListener",t)}},t.prototype.removeCallEventListener=function(e){try{this.callHandlers=this.callHandlers.filter(function(t){return t._name!==e})}catch(t){s.Logger.error("ListenerHandlers: removeCallEventListener",t)}},t.listenerHandlers=new t,t}();e.ListenerHandlers=i},function(t,e,n){"use strict";e.__esModule=!0,e.CometChat=e.init=void 0;var o=n(3);e.init=function(t){return o.CometChat.getInstance(t)},e.CometChat=o.CometChat},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.__esModule=!0,e.GroupsRequestBuilder=e.GroupsRequest=void 0;var s=n(6),o=n(0),r=n(2),i=n(15),a=n(1),E=function(){function t(t){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:[]},o.isFalsy(t)||(o.isFalsy(t.limit)||(this.limit=t.limit),o.isFalsy(t.searchKeyword)||(this.searchKeyword=t.searchKeyword),o.isFalsy(t.hasJoined)||(this.hasJoined=1),o.isFalsy(t.tags)||(this.tags=t.tags),o.isFalsy(t.showTags)||(this.withTags=t.showTags))}return t.prototype.validateGroupBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.withTags){if(typeof this.withTags!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")))},t.prototype.fetchNext=function(){var o=this;return new Promise(function(e,n){try{var t=o.validateGroupBuilder();if(t instanceof r.CometChatException)return void n(t);s.makeApiCall("getGroups",{},o.getNextData()).then(function(t){if(t.meta&&(o.total_pages=t.meta.pagination.total_pages),0<t.data.length){o.pagination=t.meta.pagination;var n=[];t.data.map(function(t,e){n.push(i.GroupsController.trasformJSONGroup(t))}),e(n)}e([])},function(t){n(new r.CometChatException(t.error))})}catch(t){n(new r.CometChatException(t))}})},t.prototype.getNextData=function(){var t={};if(t.per_page=this.limit,o.isFalsy(this.searchKeyword)||(t.searchKey=this.searchKeyword),o.isFalsy(this.hasJoined)||(t.hasJoined=1),o.isFalsy(this.tags)||(t.tags=this.tags),o.isFalsy(this.withTags)||(t.withTags=1),1==this.current_page)t.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return t.page=this.next_page,t;t.page=this.next_page++}return t},t.MAX_LIMIT=100,t.DEFAULT_LIMIT=30,t}();e.GroupsRequest=E;var c=function(){function t(){}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setSearchKeyword=function(t){return this.searchKeyword=t,this},t.prototype.joinedOnly=function(t){return this.hasJoined=t,this},t.prototype.setTags=function(t){return this.tags=t,this},t.prototype.withTags=function(t){return this.showTags=t,this},t.prototype.build=function(){return new E(this)},t}();e.GroupsRequestBuilder=c},function(t,e,n){"use strict";e.__esModule=!0,e.GroupMembersRequestBuilder=e.GroupMembersRequest=void 0;var s=n(6),o=n(0),r=n(14),i=n(2),a=n(33),E=n(1),c=function(){function t(t){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=r.LocalStorage.getInstance(),o.isFalsy(t)||(this.limit=t.limit,this.guid=t.guid,o.isFalsy(t.searchKeyword)||(this.searchKeyword=t.searchKeyword),o.isFalsy(t.scopes)||(this.scopes=t.scopes))}return t.prototype.validateGroupMembersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.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(o.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(o.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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(o.isFalsy(this.guid))return new i.CometChatException(JSON.parse(o.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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},t.prototype.fetchNext=function(){var o=this;return new Promise(function(n,e){try{var t=o.validateGroupMembersBuilder();if(t instanceof i.CometChatException)return void e(t);s.makeApiCall("getGroupMembers",{guid:o.guid},o.getNextData()).then(function(t){if(t.meta&&(o.total_pages=t.meta.pagination.total_pages),0<t.data.length){o.pagination=t.meta.pagination;var e=[];t.data.map(function(t){t.guid=o.guid,e.push(a.GroupMembersController.trasformJSONGroupMember(t))}),n(e)}else n([])},function(t){e(new i.CometChatException(t.error))})}catch(t){e(new i.CometChatException(t))}})},t.prototype.getNextData=function(){var t={};if(t.per_page=this.limit,o.isFalsy(this.searchKeyword)||(t.searchKey=this.searchKeyword),o.isFalsy(this.scopes)||(t.scopes=this.scopes),1==this.current_page)t.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return t.page=this.next_page,t;t.page=this.next_page++}return t},t.MAX_LIMIT=2,t.DEFAULT_LIMIT=1,t}();e.GroupMembersRequest=c;var u=function(){function t(t){this.guid=t}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setSearchKeyword=function(t){return this.searchKeyword=t,this},t.prototype.setScopes=function(t){return this.scopes=t,this},t.prototype.build=function(){return new c(this)},t}();e.GroupMembersRequestBuilder=u},function(t,e,n){"use strict";e.__esModule=!0,e.BannedMembersRequestBuilder=e.BannedMembersRequest=void 0;var s=n(6),o=n(0),r=n(2),i=n(33),a=n(1),E=function(){function t(t){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:[]},o.isFalsy(t)||(this.limit=t.limit,this.guid=t.guid,o.isFalsy(t.searchKeyword)||(this.searchKeyword=t.searchKeyword),o.isFalsy(t.scopes)||(this.scopes=t.scopes))}return t.prototype.validateBannedMembersBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(o.isFalsy(this.guid))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},t.prototype.fetchNext=function(){var o=this;return new Promise(function(n,e){try{var t=o.validateBannedMembersBuilder();if(t instanceof r.CometChatException)return void e(t);s.makeApiCall("getBannedGroupMembers",{guid:o.guid},o.getNextData()).then(function(t){if(t.meta&&(o.total_pages=t.meta.pagination.total_pages),0<t.data.length){o.pagination=t.meta.pagination;var e=[];t.data.map(function(t){t.guid=o.guid,e.push(i.GroupMembersController.trasformJSONGroupMember(t))}),n(e)}else n([])},function(t){e(new r.CometChatException(t.error))})}catch(t){e(new r.CometChatException(t))}})},t.prototype.getNextData=function(){var t={};if(t.per_page=this.limit,o.isFalsy(this.searchKeyword)||(t.searchKey=this.searchKeyword),o.isFalsy(this.scopes)||(t.scopes=this.scopes),1==this.current_page)t.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return t.page=this.next_page,t;t.page=this.next_page++}return t},t.MAX_LIMIT=2,t.DEFAULT_LIMIT=1,t}();e.BannedMembersRequest=E;var c=function(){function t(t){this.guid=t}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setSearchKeyword=function(t){return this.searchKeyword=t,this},t.prototype.setScopes=function(t){return this.scopes=t,this},t.prototype.build=function(){return new E(this)},t}();e.BannedMembersRequestBuilder=c},function(t,e,n){"use strict";e.__esModule=!0,e.UsersRequestBuilder=e.UsersRequest=void 0;var s=n(6),o=n(0),r=n(11),i=n(2),a=n(44),E=n(1),c=function(){function e(t){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:[]},e.userStore=a.UserStore.getInstance(),o.isFalsy(t)||(this.limit=t.limit,o.isFalsy(t.searchKeyword)||(this.searchKeyword=t.searchKeyword),o.isFalsy(t.status)||(t.status==e.USER_STATUS.ONLINE?this.status=E.PresenceConstatnts.STATUS.AVAILABLE:this.status=t.status),o.isFalsy(t.shouldHideBlockedUsers)||(this.hideBlockedUsers=t.shouldHideBlockedUsers),o.isFalsy(t.showFriendsOnly)||(this.friendsOnly=t.showFriendsOnly),o.isFalsy(t.showTags)||(this.withTags=t.showTags),o.isFalsy(t.role)||(this.role=t.role),o.isFalsy(t.roles)||(this.roles=t.roles),o.isFalsy(t.tags)||(this.tags=t.tags),o.isFalsy(t.UIDs)||(this.UIDs=t.UIDs),o.isFalsy(t.SortBy)||(this.sortBy=t.SortBy),o.isFalsy(t.SearchIn)||(this.searchIn=t.SearchIn),o.isFalsy(t.SortOrder)||(this.sortOrder=t.SortOrder))}return e.prototype.validateUserBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.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(o.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(o.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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));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(o.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(o.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(o.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(o.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(o.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(o.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(o.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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY","SORT_BY","sortBy()")));if(o.isFalsy(this.sortBy.trim()))return new i.CometChatException(JSON.parse(o.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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY_ORDER","SORT_BY_ORDER","sortByOrder()")));if(o.isFalsy(this.sortOrder.trim()))return new i.CometChatException(JSON.parse(o.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(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SEARCH_IN","SEARCH_IN","searchIn()"))):void 0},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,e){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var t=o.validateUserBuilder();if(t instanceof i.CometChatException)return void e(t);s.makeApiCall("users",{},o.getNextData()).then(function(t){if(t.meta&&(o.total_pages=t.meta.pagination.total_pages),0<t.data.length){o.pagination=t.meta.pagination;var e=[];t.data.map(function(t){e.push(r.UsersController.trasformJSONUser(t))}),n(e)}else n([]);o.fetchingInProgress=!1},function(t){o.fetchingInProgress=!1,e(new i.CometChatException(t.error))})}}catch(t){o.fetchingInProgress=!1,e(new i.CometChatException(t))}})},e.prototype.getNextData=function(){var t={};if(t.per_page=this.limit,o.isFalsy(this.searchKeyword)||(t.searchKey=this.searchKeyword),o.isFalsy(this.status)||(t.status=this.status),o.isFalsy(this.hideBlockedUsers)||(t.hideBlockedUsers=1),o.isFalsy(this.role)||(t.roles=this.role),o.isFalsy(this.roles)||(t.roles=this.roles),o.isFalsy(this.tags)||(t.tags=this.tags),o.isFalsy(this.friendsOnly)||(t.friendsOnly=1),o.isFalsy(this.withTags)||(t.withTags=1),o.isFalsy(this.UIDs)||(t.uids=this.UIDs),o.isFalsy(this.sortBy)||(t.sortBy=this.sortBy),o.isFalsy(this.sortOrder)||(t.sortOrder=this.sortOrder),o.isFalsy(this.searchIn)||(t.searchIn=this.searchIn),1==this.current_page)t.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return t.page=this.next_page,t;t.page=this.next_page++}return t},e.USER_STATUS={ONLINE:E.PresenceConstatnts.STATUS.ONLINE,OFFLINE:E.PresenceConstatnts.STATUS.OFFLINE},e}();e.UsersRequest=c;var u=function(){function t(){this.shouldHideBlockedUsers=!1}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setStatus=function(t){return this.status=t,this},t.prototype.setSearchKeyword=function(t){return this.searchKeyword=t,this},t.prototype.hideBlockedUsers=function(t){return this.shouldHideBlockedUsers=t,this},t.prototype.setRole=function(t){return this.role=t,this},t.prototype.setRoles=function(t){return this.roles=t,this},t.prototype.friendsOnly=function(t){return this.showFriendsOnly=t,this},t.prototype.setTags=function(t){return this.tags=t,this},t.prototype.withTags=function(t){return this.showTags=t,this},t.prototype.setUIDs=function(t){return this.UIDs=t,this},t.prototype.sortBy=function(t){return this.SortBy=t,this},t.prototype.sortByOrder=function(t){return this.SortOrder=t,this},t.prototype.searchIn=function(t){return this.SearchIn=t,this},t.prototype.build=function(){return this.role&&this.roles&&this.roles.push(this.role),new c(this)},t}();e.UsersRequestBuilder=u},function(t,e,n){"use strict";e.__esModule=!0,e.UserStore=void 0;var o=n(3),s=n(0),r=n(1),i=n(12),a=function(){function t(t){this.store=r.constants.DEFAULT_STORE,s.isFalsy(t)||(this.store=t),this.userStore=i.createInstance({name:s.format(r.LOCAL_STORE.STORE_STRING,o.CometChat.getAppId(),r.LOCAL_STORE.USERS_STORE)}),this.userStore.setDriver([i.LOCALSTORAGE,i.INDEXEDDB,i.WEBSQL])}return t.getInstance=function(){return null==t.UserStore&&(t.UserStore=new t),t.UserStore},t.prototype.set=function(t,e){return this.userStore.setItem(t,e)},t.prototype.remove=function(t){this.userStore.removeItem(t)},t.prototype.get=function(t){return this.userStore.getItem(t)},t.prototype.clearStore=function(){var n=this;return new Promise(function(t,e){n.userStore.clear().then(function(){t(!0)}).catch(function(t){e(t)})})},t.prototype.clear=function(t){},t.prototype.selectStore=function(t){this.store=t},t.prototype.storeUsers=function(t){var e=this;return t.map(function(t){e.set(t.getUid(),t)}),!0},t.prototype.storeUser=function(t){return this.set(t.getUid(),t),!0},t}();e.UserStore=a},function(t,e,n){"use strict";e.__esModule=!0,e.ConversationsRequestBuilder=e.ConversationsRequest=void 0;var s=n(6),o=n(0),r=n(2),i=n(24),a=n(1),E=function(){function t(t){this.limit=100,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:[]},o.isFalsy(t)||(this.limit=t.limit,o.isFalsy(t.conversationType)||(this.conversationType=t.conversationType),o.isFalsy(t.getUserAndGroupTags)||(this.getUserAndGroupTags=t.getUserAndGroupTags),t.tags&&(this.tags=t.tags),o.isFalsy(t.WithTags)||(this.withTags=t.WithTags),t.groupTags&&(this.groupTags=t.groupTags),t.userTags&&(this.userTags=t.userTags))}return t.prototype.validateConversationBuilder=function(){return void 0===this.limit?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))):isNaN(this.limit)?new r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.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 r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):void 0},t.prototype.fetchNext=function(){var o=this;return new Promise(function(n,e){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var t=o.validateConversationBuilder();if(t instanceof r.CometChatException)return void e(t);s.makeApiCall("getConversations",{},o.getNextData()).then(function(t){if(t.meta&&(o.total_pages=t.meta.pagination.total_pages),0<t.data.length){o.pagination=t.meta.pagination;var e=[];t.data.map(function(t){e.push(i.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[]))}),n(e)}else n([]);o.fetchingInProgress=!1},function(t){o.fetchingInProgress=!1,e(new r.CometChatException(t.error))})}}catch(t){o.fetchingInProgress=!1,e(new r.CometChatException(t))}})},t.prototype.getNextData=function(){var t={};if(t.per_page=this.limit,o.isFalsy(this.conversationType)||(t.conversationType=this.conversationType),o.isFalsy(this.getUserAndGroupTags)||(t.withUserAndGroupTags=this.getUserAndGroupTags),o.isFalsy(this.tags)||(t.tags=this.tags),o.isFalsy(this.withTags)||(t.withTags=this.withTags),o.isFalsy(this.userTags)||(t.userTags=this.userTags),o.isFalsy(this.groupTags)||(t.groupTags=this.groupTags),1==this.current_page)t.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return t.page=this.next_page,t;t.page=this.next_page++}return t},t}();e.ConversationsRequest=E;var c=function(){function t(){this.WithTags=!1}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setConversationType=function(t){return this.conversationType=t,this},t.prototype.withUserAndGroupTags=function(t){return"boolean"==typeof t&&(this.getUserAndGroupTags=t),this},t.prototype.setTags=function(t){return this.tags=t,this},t.prototype.withTags=function(t){return this.WithTags=t,this},t.prototype.setGroupTags=function(t){return this.groupTags=t,this},t.prototype.setUserTags=function(t){return this.userTags=t,this},t.prototype.build=function(){return new E(this)},t}();e.ConversationsRequestBuilder=c},function(t,e,n){"use strict";var h=this&&this.__awaiter||function(t,i,a,E){return new(a||(a=Promise))(function(n,e){function o(t){try{r(E.next(t))}catch(t){e(t)}}function s(t){try{r(E.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,s)}r((E=E.apply(t,i||[])).next())})},A=this&&this.__generator||function(n,o){var s,r,i,t,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&e[0]?r.return:e[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,e[1])).done)return i;switch(r=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,r=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){a.label=e[1];break}if(6===e[0]&&a.label<i[1]){a.label=i[1],i=e;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(e);break}i[2]&&a.ops.pop(),a.trys.pop();continue}e=o.call(n,a)}catch(t){e=[6,t],r=0}finally{s=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}},s=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var o=Array(t),s=0;for(e=0;e<n;e++)for(var r=arguments[e],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};e.__esModule=!0,e.MessagesRequestBuilder=e.MessagesRequest=void 0;var R=n(2),I=n(6),f=n(10),O=n(0),r=n(47),N=n(1),i=n(13),y=n(25),o=function(){function t(t){this.limit=N.DEFAULT_VALUES.MSGS_LIMIT,this.timestamp=0,this.id=N.DEFAULT_VALUES.DEFAULT_MSG_ID,this.messageStore=r.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.limit=t.limit,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,this.uid=t.uid,this.guid=t.guid,this.parentMessageId=t.parentMessageId,this.timestamp=t.timestamp,this.timestamp&&(this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.id=t.id,this.id!=N.DEFAULT_VALUES.DEFAULT_MSG_ID&&(this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.hideMessagesFromBlockedUsers=t.HideMessagesFromBlockedUsers,this.hideMessagesFromBlockedUsers&&(this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=this.hideMessagesFromBlockedUsers),this.unread=t.unread,this.unread&&(this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.UNREAD]=this.unread),t.searchKey&&(this.searchKey=t.searchKey,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=this.searchKey),t.onlyUpdate&&(this.onlyUpdates=t.onlyUpdate,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.ONLY_UPDATES]=this.onlyUpdates),t.updatedAt&&(this.updatedAt=t.updatedAt,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),t.category&&(this.category=t.category),t.categories&&(this.categories=t.categories),t.type&&(this.type=t.type),t.types&&(this.types=t.types),t.WithTags&&(this.WithTags=t.WithTags),t.tags&&(this.tags=t.tags),t.HideReplies&&(this.hideReplies=t.HideReplies,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES]=this.hideReplies),this.hideDeletedMessages=t.HideDeletedMessages,this.hideDeletedMessages&&(this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=this.hideDeletedMessages)}return t.prototype.fetchNext=function(){var t=this;return new Promise(function(s,r){return h(t,void 0,void 0,function(){var e,n,o;return A(this,function(t){switch(t.label){case 0:if(t.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,r(new R.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,this.onlyUpdates){if(0==this.updatedAt)return this.inProgress=!1,r(new R.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2]}else if(0==this.timestamp&&0==this.id&&0==this.updatedAt)return this.inProgress=!1,r(new R.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=N.MessageConstatnts.PAGINATION.AFFIX.APPEND,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=N.MessageConstatnts.PAGINATION.AFFIX.APPEND,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return e=t.sent(),s(e),this.inProgress=!1,[3,4];case 3:return n=t.sent(),this.inProgress=!1,r(new R.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return o=t.sent(),this.inProgress=!1,r(new R.CometChatException(o)),[3,6];case 6:return[2]}})})})},t.prototype.fetchPrevious=function(){var t=this;return new Promise(function(s,r){return h(t,void 0,void 0,function(){var e,n,o;return A(this,function(t){switch(t.label){case 0:if(t.trys.push([0,5,,6]),this.inProgress)return r(new R.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,r(new R.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=N.MessageConstatnts.PAGINATION.AFFIX.PREPEND,this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=N.MessageConstatnts.PAGINATION.AFFIX.PREPEND,t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return e=t.sent(),s(e),this.inProgress=!1,[3,4];case 3:return n=t.sent(),this.inProgress=!1,r(new R.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return o=t.sent(),this.inProgress=!1,r(new R.CometChatException(o)),[3,6];case 6:return[2]}})})})},t.prototype.makeAPICall=function(){var g=this;return new Promise(function(s,e){try{var t=g.uid;if(void 0!==t){if(typeof t!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"UID","UID","setUID()"))));if(O.isFalsy(t.trim()))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.INVALID),"UID","UID","UID","UID"))));g.uid=t.trim()}var n=g.guid;if(void 0!==n){if(typeof n!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","setGUID()"))));if(O.isFalsy(n.trim()))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID"))));g.guid=n.trim()}var o=g.parentMessageId;if(void 0!==o){if(isNaN(o))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))));if(o<N.DEFAULT_VALUES.ZERO)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))))}var r=g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.PER_PAGE];if(void 0===r)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(r))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(r>N.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",N.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(r<N.DEFAULT_VALUES.ZERO)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));var i=g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY];if(void 0!==i){if(typeof i!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))));if(O.isFalsy(i.trim()))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=i.trim()}var a=g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.ID];if(void 0!==a){if(isNaN(a))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))));if(a<N.DEFAULT_VALUES.ZERO)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))))}var E=g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.SENT_AT];if(void 0!==E){if(isNaN(E))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))));if(E<N.DEFAULT_VALUES.ZERO)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))))}var c=g.hideMessagesFromBlockedUsers;if(void 0!==c){if(typeof c!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers()"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=1==c?1:0}var u=g.unread;if(void 0!==u){if(typeof u!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"UNREAD","UNREAD","setUnread()"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.UNREAD]=1==u?1:0}var S=g.category;if(void 0!==S){if(typeof S!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_CATEGORY","SET_CATEGORY","setCategory()"))));if(O.isFalsy(S.trim()))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.INVALID),"SET_CATEGORY","SET_CATEGORY","category","category"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=S.trim()}var l=g.categories;if(void 0!==l){if(!Array.isArray(l))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_CATEGORIES","SET_CATEGORIES","setCategories()"))));0<l.length&&(g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=l)}var p=g.type;if(void 0!==p){if(typeof p!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_TYPE","SET_TYPE","setType()"))));if(O.isFalsy(p.trim()))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.INVALID),"SET_TYPE","SET_TYPE","type","type"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.TYPES]=p.trim()}var C=g.types;if(void 0!==C){if(!Array.isArray(C))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<C.length&&(g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.TYPES]=C)}var T=g.tags;if(void 0!==T){if(!Array.isArray(T))return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TAGS","SET_TAGS","setTags()"))));0<T.length&&(g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.TAGS]=T)}var d=g.WithTags;if(void 0!==d){if(typeof d!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.WITH_TAGS]=1==d?1:0}var _=g.hideDeletedMessages;if(void 0!==_){if(typeof _!==N.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void e(new R.CometChatException(JSON.parse(O.format(JSON.stringify(N.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_DELETED_MESSAGES","HIDE_DELETED_MESSAGES","hideDeletedMessages()"))));g.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=1==_?1:0}if(g.createEndpoint(),g.totalPages)if(1!=g.totalPages);else if(g.lastAffix==g.affix)return void s([]);I.makeApiCall(g.endpointName,{listId:g.listId},g.paginationMeta).then(function(e){return h(g,void 0,void 0,function(){var n,o=this;return A(this,function(t){return n=[],e[N.ResponseConstants.RESPONSE_KEYS.KEY_META][N.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(N.MessageConstatnts.PAGINATION.KEYS.ID)&&0==this.id&&(this.id=parseInt(e.meta.cursor[N.MessageConstatnts.PAGINATION.KEYS.ID])),e[N.ResponseConstants.RESPONSE_KEYS.KEY_META][N.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(N.MessageConstatnts.PAGINATION.KEYS.SENT_AT)&&0==this.timestamp&&(this.timestamp=e.meta.cursor[N.MessageConstatnts.PAGINATION.KEYS.SENT_AT]),e.meta.pagination.hasOwnProperty("total_pages")&&(this.totalPages=e.meta.pagination.total_pages),e.meta.cursor.hasOwnProperty("affix")&&(this.lastAffix=e.meta.cursor.affix),e.data[0]?(0<this.id&&(this.id=parseInt(e.data[0].id)),0<this.timestamp&&(this.timestamp=e.data[0].sentAt),e.data.map(function(e){y.MessageListnerMaping.getInstance().get(N.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST).then(function(t){parseInt(e.id)>t&&y.MessageListnerMaping.getInstance().set(N.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(e.id))},function(t){y.MessageListnerMaping.getInstance().set(N.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(e.id))}),o.affix==N.MessageConstatnts.PAGINATION.AFFIX.APPEND?(o.id<parseInt(e.id)&&0<o.id&&(o.id=parseInt(e.id)),o.timestamp<e.sentAt&&0<o.timestamp&&(o.timestamp=e.sentAt),o.updatedAt<e.updatedAt&&0<o.updatedAt&&(o.updatedAt=e.updatedAt)):(o.id>parseInt(e.id)&&(o.id=parseInt(e.id)),o.timestamp>e.sentAt&&(o.timestamp=e.sentAt),o.updatedAt>e.updatedAt&&(o.updatedAt=e.updatedAt)),o.id&&(o.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.ID]=o.id),o.timestamp&&(o.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=o.timestamp),o.updatedAt&&(o.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=o.updatedAt),n.push(f.MessageController.trasformJSONMessge(e))})):n=[],s(n),[2]})})},function(t){e(new R.CometChatException(t.error))})}catch(t){e(new R.CometChatException(t))}})},t.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[N.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(O.isFalsy(this.guid)||O.isFalsy(this.uid))&&O.isFalsy(this.guid)?(O.isFalsy(this.uid)?this.endpointName="getMessages":this.endpointName="getUserMessages",this.listId=this.uid):(this.endpointName="getGroupMessages",this.listId=this.guid)},t.prototype.makeData=function(){var t={};t[N.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,t[N.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(O.isFalsy(this.guid)||O.isFalsy(this.uid))&&O.isFalsy(this.guid)&&O.isFalsy(this.uid)},t.prototype.getFilteredPreviousDataByReceiverId=function(e){return h(this,void 0,void 0,function(){var n,o=this;return A(this,function(t){switch(t.label){case 0:switch(n=[],e){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,r.MessagesStore.getInstance().get(this.uid).then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).map(function(t){n=s(n,[e[t]])})})];case 2:return t.sent(),[3,9];case 3:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).map(function(t){n=s(n,[e[t]])})})];case 4:t.sent(),t.label=5;case 5:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).filter(function(t){return e[t].sender.uid==o.uid}).map(function(t){n=s(n,[e[t]])})})];case 6:return t.sent(),[3,9];case 7:return[4,r.MessagesStore.getInstance().getAllMessages().then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).map(function(t){n=s(n,[e[t]])})})];case 8:return t.sent(),[3,9];case 9:return[2,n]}})})},t.prototype.getFilteredNextDataByReceiverId=function(e){return h(this,void 0,void 0,function(){var n,o=this;return A(this,function(t){switch(t.label){case 0:switch(n=[],e){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,r.MessagesStore.getInstance().get(this.uid).then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).map(function(t){n=s(n,[e[t]])})})];case 2:return t.sent(),[3,9];case 3:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).map(function(t){n=s(n,[e[t]])})})];case 4:t.sent(),t.label=5;case 5:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).filter(function(t){return e[t].sender.uid==o.uid}).map(function(t){n=s(n,[e[t]])})})];case 6:return t.sent(),[3,9];case 7:return[4,r.MessagesStore.getInstance().getAllMessages().then(function(e){Object.keys(e).filter(function(t){return parseInt(t)>o.id}).map(function(t){n=s(n,[e[t]])})})];case 8:return t.sent(),[3,9];case 9:return[2,n]}})})},t}();e.MessagesRequest=o;var a=function(){function t(){this.maxLimit=N.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=N.DEFAULT_VALUES.DEFAULT_MSG_ID,this.unread=!1,this.HideMessagesFromBlockedUsers=!1,this.onlyUpdate=0,this.HideDeletedMessages=!1,this.WithTags=!1}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setGUID=function(t){return this.guid=t,this},t.prototype.setUID=function(t){return this.uid=t,this},t.prototype.setParentMessageId=function(t){return this.parentMessageId=t,this},t.prototype.setTimestamp=function(t){return void 0===t&&(t=O.getCurrentTime()),this.timestamp=t,this},t.prototype.setMessageId=function(t){return void 0===t&&(t=N.DEFAULT_VALUES.DEFAULT_MSG_ID),this.id=t,this},t.prototype.setUnread=function(t){return void 0===t&&(t=!1),this.unread=t,this},t.prototype.hideMessagesFromBlockedUsers=function(t){return void 0===t&&(t=!1),this.HideMessagesFromBlockedUsers=t,this},t.prototype.setSearchKeyword=function(t){return this.searchKey=t,this},t.prototype.setUpdatedAfter=function(t){return this.updatedAt=t,this},t.prototype.updatesOnly=function(t){return t&&(this.onlyUpdate=1),this},t.prototype.setCategory=function(t){return this.category=t,this},t.prototype.setCategories=function(t){return this.categories=t,this},t.prototype.setType=function(t){return this.type=t,this},t.prototype.setTypes=function(t){return this.types=t,this},t.prototype.hideReplies=function(t){return this.HideReplies=t,this},t.prototype.hideDeletedMessages=function(t){return this.HideDeletedMessages=t,this},t.prototype.setTags=function(t){return this.tags=t,this},t.prototype.withTags=function(t){return this.WithTags=t,this},t.prototype.build=function(){return this.category&&this.categories&&this.categories.push(this.category),this.type&&this.types&&this.types.push(this.type),new o(this)},t}();e.MessagesRequestBuilder=a},function(t,e,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};e.__esModule=!0,e.MessagesStore=void 0;var o=n(3),E=n(0),c=n(1),s=n(12),r=function(){function t(t){this.store=c.constants.DEFAULT_STORE,E.isFalsy(t)||(this.store=t),this.messagesStore=s.createInstance({name:E.format(c.LOCAL_STORE.STORE_STRING,o.CometChat.getAppId(),c.LOCAL_STORE.MESSAGES_STORE)}),this.messagesStore.setDriver([s.LOCALSTORAGE,s.INDEXEDDB,s.WEBSQL])}return t.getInstance=function(){return null==t.MessagesStore&&(t.MessagesStore=new t),t.MessagesStore},t.prototype.set=function(t,e){return this.messagesStore.setItem(t,e)},t.prototype.remove=function(t){this.messagesStore.removeItem(t)},t.prototype.get=function(t){return this.messagesStore.getItem(t)},t.prototype.clearStore=function(){var n=this;return new Promise(function(t,e){n.messagesStore.clear().then(function(){t(!0)}).catch(function(t){e(t)})})},t.prototype.getAllMessages=function(){var n=this,o={};return new Promise(function(t,e){n.messagesStore.iterate(function(t,e,n){e!=c.constants.MSG_VER_POST&&e!=c.constants.MSG_VER_POST&&(o=a(a({},o),t))}).then(function(){t(o)})})},t.prototype.clear=function(t){},t.prototype.selectStore=function(t){this.store=t},t.prototype.storeMessages=function(t){var n=this;if(o.CometChat.user.getUid()){var s=o.CometChat.user.getUid(),r={},i=0;return this.get(c.constants.MSG_VER_POST).then(function(o){t.map(function(t){var e;if(!E.isFalsy(t)){0==i&&(i=parseInt(t.getId().toString())),i>t.getId()&&(i=parseInt(t.getId().toString())),o<t.getId()&&(o=parseInt(t.getId().toString()));var n=void 0;n=t.getSender()instanceof Object?t.getSender().getUid():t.getSender(),t.getReceiverType()==c.MessageConstatnts.RECEIVER_TYPE.GROUP&&(n=t.getReceiver()),t.getSender()instanceof Object?t.getSender().getUid()==s&&(n=t.getReceiver()):t.getSender()==s&&(n=t.getReceiver()),r[n]||(r[n]={}),r[n]=a(a({},r[n]),((e={})[t.getId()]=t,e))}}),n.get(c.constants.MSG_VER_PRE).then(function(t){(0<i&&i<t||null==t)&&n.set(c.constants.MSG_VER_PRE,i)})&&0<o&&n.set(c.constants.MSG_VER_POST,o),Object.keys(r).map(function(e){n.get(e).then(function(t){null==t&&(t={}),n.set(e,a(a({},r[e]),t))})})}),!0}},t}();e.MessagesStore=r},function(t,e,n){"use strict";e.__esModule=!0,e.BlockedUsersRequestBuilder=e.BlockedUsersRequest=void 0;var s=n(6),o=n(0),r=n(11),i=n(2),a=n(1),E=function(){function t(t){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:[]},o.isFalsy(t)||(this.limit=t.limit,o.isFalsy(t.searchKeyword)||(this.searchKeyword=t.searchKeyword),o.isFalsy(t.direction)||(this.direction=t.direction))}return t.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.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(o.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(o.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(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));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(o.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)}},t.prototype.fetchNext=function(){var o=this;return new Promise(function(n,e){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var t=o.validateBlockedUsersBuilder();if(t instanceof i.CometChatException)return void e(t);s.makeApiCall("blockedUsersList",{},o.getNextData()).then(function(t){if(t.meta&&(o.total_pages=t.meta.pagination.total_pages),0<t.data.length){o.pagination=t.meta.pagination;var e=[];t.data.map(function(t){e.push(r.UsersController.trasformJSONUser(t))}),n(e)}else n([]);o.fetchingInProgress=!1},function(t){o.fetchingInProgress=!1,e(new i.CometChatException(t.error))})}}catch(t){o.fetchingInProgress=!1,e(new i.CometChatException(t))}})},t.prototype.getNextData=function(){var t={};if(t.per_page=this.limit,o.isFalsy(this.direction)||(t.direction=this.direction),o.isFalsy(this.searchKeyword)||(t.searchKey=this.searchKeyword),1==this.current_page)t.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return t.page=this.next_page,t;t.page=this.next_page++}return t},t.MAX_LIMIT=2,t.DEFAULT_LIMIT=1,t.directions=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS,t}();e.BlockedUsersRequest=E;var c=function(){function t(){}return t.prototype.setLimit=function(t){return this.limit=t,this},t.prototype.setSearchKeyword=function(t){return this.searchKeyword=t,this},t.prototype.setDirection=function(t){return this.direction=t,this},t.prototype.blockedByMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME,this},t.prototype.hasBlockedMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME,this},t.prototype.build=function(){return new E(this)},t}();e.BlockedUsersRequestBuilder=c},function(t,e,n){"use strict";e.__esModule=!0,e.AppSettingsBuilder=e.AppSettings=void 0;var o=n(1),s=function(){function e(t){this.subscriptionType=e.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=o.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null,this.subscriptionType=t.subscriptionType,this.roles=t.roles,this.region=t.region,this.autoJoinGroup=t.autoJoinGroup,this.establishSocketConnection=t.establishSocketConnection,this.adminHost=t.adminHost,this.clientHost=t.clientHost}return e.prototype.getSubscriptionType=function(){return this.subscriptionType},e.prototype.getRoles=function(){return this.roles},e.prototype.getRegion=function(){return this.region},e.prototype.getIsAutoJoinEnabled=function(){return this.autoJoinGroup},e.prototype.shouldAutoEstablishSocketConnection=function(){return this.establishSocketConnection},e.prototype.getAdminHost=function(){return this.adminHost},e.prototype.getClientHost=function(){return this.clientHost},e.SUBSCRIPTION_TYPE_NONE="NONE",e.SUBSCRIPTION_TYPE_ALL_USERS="ALL_USERS",e.SUBSCRIPTION_TYPE_ROLES="ROLES",e.SUBSCRIPTION_TYPE_FRIENDS="FRIENDS",e.REGION_EU=o.DEFAULT_VALUES.REGION_DEFAULT_EU,e.REGION_US=o.DEFAULT_VALUES.REGION_DEFAULT_US,e.REGION_IN=o.DEFAULT_VALUES.REGION_DEFAULT_IN,e.REGION_PRIVATE=o.DEFAULT_VALUES.REGION_DEFAULT_PRIVATE,e}();e.AppSettings=s;var r=function(){function t(){this.subscriptionType=s.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=o.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null}return t.prototype.subscribePresenceForAllUsers=function(){return this.subscriptionType=s.SUBSCRIPTION_TYPE_ALL_USERS,this},t.prototype.subscribePresenceForRoles=function(t){return this.subscriptionType=s.SUBSCRIPTION_TYPE_ROLES,this.roles=t,this},t.prototype.subscribePresenceForFriends=function(){return this.subscriptionType=s.SUBSCRIPTION_TYPE_FRIENDS,this},t.prototype.setRegion=function(t){return void 0===t&&(t=o.DEFAULT_VALUES.REGION_DEFAULT),this.region=t.toLowerCase(),this},t.prototype.enableAutoJoinForGroups=function(t){return void 0===t&&(t=!0),this.autoJoinGroup=t,this},t.prototype.autoEstablishSocketConnection=function(t){return void 0===t&&(t=!0),this.establishSocketConnection=t,this},t.prototype.overrideAdminHost=function(t){return this.adminHost=t,this},t.prototype.overrideClientHost=function(t){return this.clientHost=t,this},t.prototype.build=function(){return new s(this)},t}();e.AppSettingsBuilder=r},function(t,e,n){"use strict";e.__esModule=!0,e.CometChatHelper=void 0;var S=n(10),l=n(1),p=n(11),C=n(15),T=n(24),o=n(3),s=n(2),r=n(0),i=function(){function t(){}return t.processMessage=function(t){try{return S.MessageController.trasformJSONMessge(t)}catch(t){r.Logger.error("CometChatHelper: processMessage",t)}},t.getConversationFromMessage=function(u){return new Promise(function(E,c){try{o.CometChat.getLoggedinUser().then(function(t){if(null!==t){var e=S.MessageController.trasformJSONMessge(u),n=e.receiverType,o=e.conversationId,s=void 0,r=S.MessageController.trasformJSONMessge(u);if(n==l.MessageConstatnts.RECEIVER_TYPE.USER){var i=p.UsersController.trasformJSONUser(e[l.MessageConstatnts.KEYS.SENDER]);s=i.getUid()==t.getUid()?p.UsersController.trasformJSONUser(e[l.MessageConstatnts.KEYS.RECEIVER]):i}else s=C.GroupsController.trasformJSONGroup(e[l.MessageConstatnts.KEYS.RECEIVER]);var a=T.ConversationController.trasformJSONConversation(o,n,r,s,0,[]);E(a)}else c(l.UserErrors.USER_NOT_LOGGED_IN)},function(t){c(new s.CometChatException(t.error))})}catch(t){c(new s.CometChatException(t))}})},t}();e.CometChatHelper=i},function(t,e,n){"use strict";e.__esModule=!0,e.MainVideoContainerSetting=e.VirtualBackgroundBuilder=e.VirtualBackground=e.CallSettingsBuilder=e.CallSettings=void 0;var o=n(1),s=n(0),r=function(){function t(t){this.sessionID=t.sessionID,this.defaultLayout=t.defaultLayout,this.isAudioOnly=t.isAudioOnly,this.region=t.region,this.user=t.user,this.mode=t.mode,this.domain=t.domain,this.ShowEndCallButton=t.ShowEndCallButton,this.ShowMuteAudioButton=t.ShowMuteAudioButton,this.ShowPauseVideoButton=t.ShowPauseVideoButton,this.ShowScreenShareButton=t.ShowScreenShareButton,this.ShowSwitchModeButton=t.ShowSwitchModeButton,this.StartAudioMuted=t.StartAudioMuted,this.StartVideoMuted=t.StartVideoMuted,this.localizedObject=t.localizedObject,this.analyticsSettings=t.analyticsSettings,this.appId=t.appId,this.customCSS=t.customCSS,this.ShowRecordingButton=t.ShowRecordingButton,this.StartRecordingOnCallStart=t.StartRecordingOnCallStart,this.useLegacyUI=t.useLegacyUI,this.ShowSwitchToVideoCallButton=t.ShowSwitchToVideoCallButton,this.VirtualBackground=t.virtualBackground,this.ShowVirtualBackgroundSetting=t.ShowVirtualBackgroundSetting,this.MainVideoContainerSetting=t.MainVideoContainerSetting}return t.prototype.shouldUseLegacyUI=function(){return this.useLegacyUI},t.prototype.isRecordingButtonEnabled=function(){return this.ShowRecordingButton},t.prototype.shouldStartRecordingOnCallStart=function(){return this.StartRecordingOnCallStart},t.prototype.getCustomCSS=function(){return this.customCSS},t.prototype.getSessionId=function(){return this.sessionID},t.prototype.isAudioOnlyCall=function(){return this.isAudioOnly},t.prototype.getUser=function(){return this.user},t.prototype.getRegion=function(){return this.region},t.prototype.getAppId=function(){return this.appId},t.prototype.getDomain=function(){return this.domain},t.prototype.isDefaultLayoutEnabled=function(){return this.defaultLayout},t.prototype.getMode=function(){return this.mode},t.prototype.getStartWithAudioMuted=function(){return this.StartAudioMuted},t.prototype.getStartWithVideoMuted=function(){return this.StartVideoMuted},t.prototype.isEndCallButtonEnabled=function(){return this.ShowEndCallButton},t.prototype.isMuteAudioButtonEnabled=function(){return this.ShowMuteAudioButton},t.prototype.isPauseVideoButtonEnabled=function(){return this.ShowPauseVideoButton},t.prototype.isScreenShareButtonEnabled=function(){return this.ShowScreenShareButton},t.prototype.isModeButtonEnabled=function(){return this.ShowSwitchModeButton},t.prototype.getLocalizedStringObject=function(){return this.localizedObject},t.prototype.getAnalyticsSettings=function(){return this.analyticsSettings},t.prototype.isAudioToVideoButtonEnabled=function(){return this.ShowSwitchToVideoCallButton},t.prototype.getVirtualBackground=function(){return this.VirtualBackground},t.prototype.isVirtualBackgroundSettingEnabled=function(){return this.ShowVirtualBackgroundSetting},t.prototype.getMainVideoContainerSetting=function(){return this.MainVideoContainerSetting},t.POSITION_TOP_LEFT="top-left",t.POSITION_TOP_RIGHT="top-right",t.POSITION_BOTTOM_LEFT="bottom-left",t.POSITION_BOTTOM_RIGHT="bottom-right",t.ASPECT_RATIO_DEFAULT="default",t.ASPECT_RATIO_CONTAIN="contain",t.ASPECT_RATIO_COVER="cover",t}();e.CallSettings=r;var i=function(){function t(){this.defaultLayout=!0,this.isAudioOnly=!1,this.mode=o.CallConstants.CALL_MODE.DEFAULT,this.ShowEndCallButton=!0,this.ShowMuteAudioButton=!0,this.ShowPauseVideoButton=!0,this.ShowScreenShareButton=!0,this.ShowSwitchModeButton=!0,this.StartAudioMuted=!1,this.StartVideoMuted=!1,this.localizedObject={},this.analyticsSettings={},this.ShowRecordingButton=!1,this.StartRecordingOnCallStart=!1,this.useLegacyUI=!1,this.ShowSwitchToVideoCallButton=!0,this.virtualBackground=(new E).build(),this.ShowVirtualBackgroundSetting=!0,this.MainVideoContainerSetting=new c}return t.prototype.setSessionID=function(t){return this.sessionID=t,this},t.prototype.enableDefaultLayout=function(t){return this.defaultLayout=t,this},t.prototype.setIsAudioOnlyCall=function(t){return this.isAudioOnly=t,this},t.prototype.setRegion=function(t){return this.region=t,this},t.prototype.setDomain=function(t){return this.domain=t,this},t.prototype.setUser=function(t){return this.user=t,this},t.prototype.setMode=function(t){return this.mode=t,this},t.prototype.showEndCallButton=function(t){return this.ShowEndCallButton=t,this},t.prototype.showMuteAudioButton=function(t){return this.ShowMuteAudioButton=t,this},t.prototype.showPauseVideoButton=function(t){return this.ShowPauseVideoButton=t,this},t.prototype.showScreenShareButton=function(t){return this.ShowScreenShareButton=t,this},t.prototype.showModeButton=function(t){return this.ShowSwitchModeButton=t,this},t.prototype.setLocalizedStringObject=function(t){return this.localizedObject=t,this},t.prototype.setAnalyticsSettings=function(t){return this.analyticsSettings=t,this},t.prototype.setAppId=function(t){return this.appId=t,this},t.prototype.startWithAudioMuted=function(t){return this.StartAudioMuted=t,this},t.prototype.startWithVideoMuted=function(t){return this.StartVideoMuted=t,this},t.prototype.setCustomCSS=function(t){return this.customCSS=t,this},t.prototype.showRecordingButton=function(t){return this.ShowRecordingButton=t,this},t.prototype.startRecordingOnCallStart=function(t){return this.StartRecordingOnCallStart=t,this},t.prototype.forceLegacyUI=function(t){return this.useLegacyUI=t,this},t.prototype.showSwitchToVideoCallButton=function(t){return this.ShowSwitchToVideoCallButton=t,this},t.prototype.setVirtualBackground=function(t){return this.virtualBackground=t,this},t.prototype.showVirtualBackgroundSetting=function(t){return this.ShowVirtualBackgroundSetting=t,this},t.prototype.setMainVideoContainerSetting=function(t){return this.MainVideoContainerSetting=t,this},t.prototype.build=function(){return new r(this)},t}();e.CallSettingsBuilder=i;var a=function(){function t(t){this.AllowBackgroundBlur=t.AllowBackgroundBlur,this.AllowUserImages=t.AllowUserImages,this.ShowDefaultImages=t.ShowDefaultImages,this.SetImages=t.SetImages,this.EnforceBackgroundBlur=t.EnforceBackgroundBlur,this.EnforceBackgroundImage=t.EnforceBackgroundImage}return t.prototype.shouldAllowBackgroundBlur=function(){return this.AllowBackgroundBlur},t.prototype.shouldAllowUserImages=function(){return this.AllowUserImages},t.prototype.shouldShowDefaultImages=function(){return this.ShowDefaultImages},t.prototype.getImages=function(){return this.SetImages},t.prototype.isBackgroundBlurEnforced=function(){return this.EnforceBackgroundBlur},t.prototype.getEnforcedBackgroundImage=function(){return this.EnforceBackgroundImage},t}();e.VirtualBackground=a;var E=function(){function t(){this.AllowBackgroundBlur=!0,this.AllowUserImages=!0,this.ShowDefaultImages=!0,this.SetImages=[],this.EnforceBackgroundBlur=0,this.EnforceBackgroundImage=""}return t.prototype.allowBackgroundBlur=function(t){return this.AllowBackgroundBlur=t,this},t.prototype.allowUserImages=function(t){return this.AllowUserImages=t,this},t.prototype.showDefaultImages=function(t){return this.ShowDefaultImages=t,this},t.prototype.setImages=function(t){return this.SetImages=t,this},t.prototype.enforceBackgroundBlur=function(t){return this.EnforceBackgroundBlur=t,this},t.prototype.enforceBackgroundImage=function(t){return this.EnforceBackgroundImage=t,this},t.prototype.build=function(){return new a(this)},t}();e.VirtualBackgroundBuilder=E;var c=function(){function t(){this.videoFit=r.ASPECT_RATIO_CONTAIN,this.zoomButton=o.CallConstants.ZOOM_BUTTON_DEFAULT_PARAMS,this.nameLabel=o.CallConstants.NAME_LABEL_DEFAULT_PARAMS,this.network=o.CallConstants.NETWORK_LABEL_DEFAULT_PARAMS}return t.prototype.setMainVideoAspectRatio=function(t){this.videoFit=t},t.prototype.setFullScreenButtonParams=function(t,e){s.isFalsy(t)||(this.zoomButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=t),null!=e&&null!=e&&(this.zoomButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=e)},t.prototype.setNameLabelParams=function(t,e,n){s.isFalsy(t)||(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=t),null!=e&&null!=e&&(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=e),s.isFalsy(n)||(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.COLOR]=n)},t.prototype.setNetworkLabelParams=function(t,e){s.isFalsy(t)||(this.network[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=t),null!=e&&null!=e&&(this.network[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=e)},t}();e.MainVideoContainerSetting=c},function(t,e,n){"use strict";e.__esModule=!0,e.RTCUser=void 0;var o=n(0),s=function(){function t(t){this.avatar="",o.isFalsy(t)||(this.uid=t.toString())}return t.prototype.setUID=function(t){this.uid=t?t.toString():""},t.prototype.getUID=function(){return this.uid.toString()},t.prototype.setName=function(t){this.name=t?t.toString():""},t.prototype.getName=function(){return this.name.toString()},t.prototype.setAvatar=function(t){this.avatar=t?t.toString():""},t.prototype.getAvatar=function(){return this.avatar.toString()},t.prototype.setJWT=function(t){this.jwt=t?t.toString():""},t.prototype.getJWT=function(){return this.jwt.toString()},t.prototype.setResource=function(t){this.resource=t?t.toString():""},t.prototype.getResource=function(){return this.resource.toString()},t}();e.RTCUser=s},function(t,e,n){"use strict";var o=this&&this.__awaiter||function(t,i,a,E){return new(a||(a=Promise))(function(n,e){function o(t){try{r(E.next(t))}catch(t){e(t)}}function s(t){try{r(E.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,s)}r((E=E.apply(t,i||[])).next())})},s=this&&this.__generator||function(n,o){var s,r,i,t,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&e[0]?r.return:e[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,e[1])).done)return i;switch(r=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,r=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){a.label=e[1];break}if(6===e[0]&&a.label<i[1]){a.label=i[1],i=e;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(e);break}i[2]&&a.ops.pop(),a.trys.pop();continue}e=o.call(n,a)}catch(t){e=[6,t],r=0}finally{s=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};e.__esModule=!0,e.WSConnectionHelper=void 0;var l=n(3),p=n(1),r=n(31),i=n(36),C=n(0),a=n(37),E=n(30),c=n(25),u=n(20),S=n(21),T=n(54),d=n(55),_=n(56),g=n(57),h=n(58),A=n(59),R=n(60),I=n(22),f=n(27),O=n(26),N=n(5),y=n(61),m=a.ListenerHandlers.getInstance(),L=function(){function e(){}return e.getInstance=function(){try{return null!=this.wsConnectionHelper&&null!=this.wsConnectionHelper||(this.wsConnectionHelper=new e),this.wsConnectionHelper}catch(t){C.Logger.error("WSConnectionHelper: getInstance",t)}},e.prototype.WSLogin=function(e,n){var o=this;try{y.getWSURL().then(function(t){o.connection=new WebSocket(t),n&&o.connection&&o.connection.readyState==N.READY_STATE.CONNECTING&&n(o.connection.readyState),o.connection.onopen=function(t){o.onOpen(t,n),o.authenticateUser(e)},o.connection.onclose=function(t){o.onClose(t,n)},o.connection.onmessage=function(t){o.onMessage(t)}},function(t){C.Logger.error("WSConnectionHelper :: WSLogin",t)})}catch(t){C.Logger.error("WSConnectionHelper: WSLogin",t)}},e.prototype.onOpen=function(t,e){try{e&&this.connection&&e(this.connection.readyState)}catch(t){C.Logger.error("WSConnectionHelper: onOpen",t)}},e.prototype.onClose=function(t,e){try{e&&this.connection&&e(this.connection.readyState)}catch(t){C.Logger.error("WSConnectionHelper: onClose",t)}},e.prototype.onMessage=function(t){if(t.data&&"string"==typeof t.data)try{var e=JSON.parse(t.data);if(e&&e.action&&e.action===N.KEYS.PONG)return;var n=this.getCometChatEventFromMessage(JSON.parse(t.data));if(n.getDeviceId()===l.CometChat.getSessionId()&&n.getType()!==N.AUTH.TYPE)return;switch(n.getType()){case N.TYPING_INDICATOR.TYPE:this.publishTypingIndicator(n);break;case N.RECEIPTS.TYPE:this.publishReceipts(n);break;case N.PRESENCE.TYPE:this.publishPresence(n);break;case N.AUTH.TYPE:this.authResponseReceived(n);break;case N.MESSAGE.TYPE:this.publishMessages(n);break;case N.TRANSIENT_MESSAGE.TYPE:this.publishTransientMessage(n);break;default:C.Logger.log("WSHelper: onMessage :: unknown type",t.data)}}catch(t){C.Logger.error("WSHelper: onMessage",t)}else C.Logger.log("WSHelper: onMessage :: object data",t.data)},e.prototype.authenticateUser=function(u){var S=this;try{l.CometChat.getLoggedinUser().then(function(c){c?E.KeyStore.getInstance().get("deviceId").then(function(E){C.getAppSettings().then(function(t){var e=null;window&&window.location&&window.location.origin&&(e=window.location.origin);var n="",o=E,s={version:p.SDKHeader.sdkVersion,apiVersion:t[p.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:e,uts:(new Date).getTime()};C.isFalsy(l.CometChat.resource)||(s.resource=l.CometChat.resource),C.isFalsy(l.CometChat.platform)||(s.platform=l.CometChat.platform),C.isFalsy(l.CometChat.language)||(s.language=l.CometChat.language),navigator&&(n=navigator.userAgent);var r={appInfo:s,userAgent:n,deviceId:o,platform:p.SDKHeader.platform},i=new T.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(r),y.checkConnection(S.connection)){var a=i.getAsString();S.connection.send(a)}})}):C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: startTypingIndicator",t)}},e.prototype.authResponseReceived=function(t){try{"200"===t.getCode()&&"OK"===t.getStatus()&&this.startPingingWS()}catch(t){C.Logger.error("WSConnectionHelper: authResponseReceived",t)}},e.prototype.WSLogout=function(){try{this.clearPingTimer(),y.checkConnection(this.connection)&&this.connection.close(N.LOGOUT_CODE,N.LOGOUT_REASON)}catch(t){C.Logger.error("WSConnectionHelper: WSLogout",t)}},e.prototype.startPingingWS=function(){var t=this;try{e.pingTimer||(e.pingTimer=setInterval(function(){return o(t,void 0,void 0,function(){var e,n;return s(this,function(t){switch(t.label){case 0:return y.checkConnection(this.connection)?(e=new _.CometChatPingEvent("","","","",""),n=e.getAsString(),this.connection.send(n),[4,this.listenForPong()]):[3,2];case 1:t.sent()?(C.Logger.log("WSConnectionHelper :: startPingingWS","pong success"),l.CometChat.getConnectionStatus()!=p.CONNECTION_STATUS.CONNECTED&&(this.WSLogout(),this.connection=null,l.CometChat.getInstance().makeWSConnection())):(C.Logger.log("WSConnectionHelper :: startPingingWS","pong failure"),this.WSLogout(),this.connection=null,l.CometChat.getInstance().setConnectionStatus(p.CONNECTION_STATUS.DISCONNECTED),m.connectionHandlers.map(function(t){try{t._eventListener&&(C.isFalsy(t._eventListener.onDisconnected)||t._eventListener.onDisconnected())}catch(t){C.Logger.error("WSConnectionHandlers: Disconnected Status",t)}}),l.CometChat.getInstance().accidentallyDisconnected()),t.label=2;case 2:return[2]}})})},15e3))}catch(t){C.Logger.error("WSConnectionHelper: startPingingWS",t)}},e.prototype.listenForPong=function(){var o=this;return new Promise(function(e,t){var n=setTimeout(function(){e(!1)},3e3);o.connection.addEventListener("message",function(t){t&&t.data&&"string"==typeof t.data&&(JSON.parse(t.data).action===N.KEYS.PONG&&(clearTimeout(n),e(!0)))})})},e.prototype.clearPingTimer=function(){e.pingTimer&&(clearInterval(e.pingTimer),e.pingTimer=void 0)},e.prototype.sendOnlineEvent=function(){var o=this;try{y.checkConnection(this.connection)&&l.CometChat.getLoggedinUser().then(function(t){if(t){t.authToken&&delete t.authToken;var e={appId:l.CometChat.getAppId(),deviceId:l.CometChat.getSessionId(),type:N.PRESENCE.TYPE,body:{action:N.PRESENCE.ACTION.ONLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:t}};if(y.checkConnection(o.connection)){var n=y.stringifyMessage(e);o.connection.send(n)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: sendOnlineEvent",t)}},e.prototype.sendOfflineEvent=function(){var o=this;try{y.checkConnection(this.connection)&&l.CometChat.getLoggedinUser().then(function(t){if(t){t.authToken&&delete t.authToken;var e={appId:l.CometChat.getAppId(),deviceId:l.CometChat.getSessionId(),type:N.PRESENCE.TYPE,body:{action:N.PRESENCE.ACTION.OFFLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:t}};if(y.checkConnection(o.connection)){var n=y.stringifyMessage(e);o.connection.send(n)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: sendOfflineEvent",t)}},e.prototype.startTypingIndicator=function(s,r,i){var a=this;try{l.CometChat.getLoggedinUser().then(function(t){if(t){var e=new O.TypingIndicator(s,r);t.authToken&&delete t.authToken,e.setSender(t),i&&e.setMetadata(i);var n=new R.CometChatTypingEvent(l.CometChat.getAppId(),s,r,t.getUid(),l.CometChat.getSessionId());if(n.setAction(N.TYPING_INDICATOR.ACTION.STARTED),n.setTypingIndicator(e),y.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: startTypingIndicator",t)}},e.prototype.pauseTypingIndicator=function(s,r,i){var a=this;try{l.CometChat.getLoggedinUser().then(function(t){if(t){var e=new O.TypingIndicator(s,r);t.authToken&&delete t.authToken,e.setSender(t),i&&e.setMetadata(i);var n=new R.CometChatTypingEvent(l.CometChat.getAppId(),s,r,t.getUid(),l.CometChat.getSessionId());if(n.setAction(N.TYPING_INDICATOR.ACTION.ENDED),n.setTypingIndicator(e),y.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: pauseTypingIndicator",t)}},e.prototype.markAsRead=function(s,r,i,a){var E=this;try{l.CometChat.getMode();l.CometChat.getLoggedinUser().then(function(t){if(t){var e=new h.CometChatReceiptEvent(l.CometChat.getAppId(),s,r,t.getUid(),l.CometChat.getSessionId(),a);e.setAction(N.RECEIPTS.ACTION.READ);var n=new I.MessageReceipt;if(t.authToken&&delete t.authToken,n.setSender(t),n.setReceiverType(r),n.setReceiver(s),n.setReceiptType(N.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),e.setMessageReceipt(n),y.checkConnection(E.connection)){var o=e.getAsString();E.connection.send(o)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: markAsRead",t)}},e.prototype.markAsDelivered=function(s,r,i,a){var E=this;try{l.CometChat.getMode();l.CometChat.getLoggedinUser().then(function(t){if(t){var e=new h.CometChatReceiptEvent(l.CometChat.getAppId(),s,r,t.getUid(),l.CometChat.getSessionId(),a);e.setAction(N.RECEIPTS.ACTION.DELIVERED);var n=new I.MessageReceipt;if(t.authToken&&delete t.authToken,n.setSender(t),n.setReceiverType(r),n.setReceiver(s),n.setReceiptType(N.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),e.setMessageReceipt(n),y.checkConnection(E.connection)){var o=e.getAsString();E.connection.send(o)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: markAsDelivered",t)}},e.prototype.sendTransientMessage=function(s,r,i){var a=this;try{l.CometChat.getLoggedinUser().then(function(t){if(t){var e=new f.TransientMessage(s,r,i);t.authToken&&delete t.authToken,e.setSender(t);var n=new A.CometChatTransientEvent(l.CometChat.getAppId(),s,r,t.getUid(),l.CometChat.getSessionId());if(n.setTransientMessage(e),y.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else C.Logger.log("no logged-in user","null")},function(t){C.Logger.log("error in fetching logged-in user",t)})}catch(t){C.Logger.error("WSConnectionHelper: sendTransientMessage",t)}},e.prototype.publishTypingIndicator=function(t){try{var e=t.getTypingIndicator();switch(t.getAction()){case N.TYPING_INDICATOR.ACTION.STARTED:m.messageHandlers.map(function(t){t._eventListener.onTypingStarted&&t._eventListener.onTypingStarted(e)}),i.TypingNotificationController.addIncomingTypingStarted(e);break;case N.TYPING_INDICATOR.ACTION.ENDED:m.messageHandlers.map(function(t){t._eventListener.onTypingEnded&&t._eventListener.onTypingEnded(e)}),i.TypingNotificationController.removeIncomingTypingStarted(e)}}catch(t){C.Logger.error("WSHelper: publishTypingIndicator",t)}},e.prototype.publishReceipts=function(t){try{var e=t.getMessageReceipt();switch(t.getAction()){case N.RECEIPTS.ACTION.DELIVERED:m.messageHandlers.map(function(t){t._eventListener.onMessagesDelivered&&t._eventListener.onMessagesDelivered(e)});break;case N.RECEIPTS.ACTION.READ:m.messageHandlers.map(function(t){t._eventListener.onMessagesRead&&t._eventListener.onMessagesRead(e)})}}catch(t){C.Logger.error("WSHelper: publishReceipts",t)}},e.prototype.publishPresence=function(t){try{var e=t.getUser();switch(e.setLastActiveAt(t.getTimestamp()),t.getAction()){case N.PRESENCE.ACTION.ONLINE:case N.PRESENCE.ACTION.AVAILABLE:e.setStatus(p.PresenceConstatnts.STATUS.ONLINE),m.userHandlers.map(function(t){C.isFalsy(t._eventListener.onUserOnline)||t._eventListener.onUserOnline(e)});break;case N.PRESENCE.ACTION.OFFLINE:e.setStatus(p.PresenceConstatnts.STATUS.OFFLINE),m.userHandlers.map(function(t){C.isFalsy(t._eventListener.onUserOffline)||t._eventListener.onUserOffline(e)})}}catch(t){C.Logger.error("WSHelper: publishPresence",t)}},e.prototype.publishMessages=function(t){try{var e=t.getMessage();e&&e.getId()&&c.MessageListnerMaping.getInstance().set("all",e.getId()),e instanceof S.Call?this.publishCallMessage(e):e instanceof u.Action?this.publishActionMessage(e):this.publishMessage(e)}catch(t){C.Logger.error("WSHelper: publishMessages",t)}},e.prototype.publishMessage=function(n){try{m.messageHandlers.map(function(t){if(t._eventListener){var e=n;switch(e.getType()){case p.MessageConstatnts.TYPE.TEXT:C.isFalsy(t._eventListener.onTextMessageReceived)||t._eventListener.onTextMessageReceived(n);break;case p.MessageConstatnts.TYPE.CUSTOM:C.isFalsy(t._eventListener.onCustomMessageReceived)||t._eventListener.onCustomMessageReceived(n);break;default:e.getCategory()==p.MessageCategory.CUSTOM?C.isFalsy(t._eventListener.onCustomMessageReceived)||t._eventListener.onCustomMessageReceived(n):C.isFalsy(t._eventListener.onMediaMessageReceived)||t._eventListener.onMediaMessageReceived(n)}}})}catch(t){C.Logger.error("WSHelper: publishMessage",t)}},e.prototype.publishCallMessage=function(e){try{var n=r.CallController.getInstance().getActiveCall();switch(e.getStatus()){case p.CallConstants.CALL_STATUS.INITIATED:e.getReceiverType()==p.CallConstants.RECEIVER_TYPE_GROUP?m.callHandlers.map(function(t){e.getCallInitiator().getUid().toLocaleLowerCase()!=l.CometChat.user.getUid().toLocaleLowerCase()&&(C.isFalsy(t._eventListener.onIncomingCallReceived)||t._eventListener.onIncomingCallReceived(e))}):m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onIncomingCallReceived)||t._eventListener.onIncomingCallReceived(e)});break;case p.CallConstants.CALL_STATUS.ONGOING:e.getReceiverType()==p.CallConstants.RECEIVER_TYPE_GROUP?e.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase()&&m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onOutgoingCallAccepted)||t._eventListener.onOutgoingCallAccepted(e)}):m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onOutgoingCallAccepted)||t._eventListener.onOutgoingCallAccepted(e)});break;case p.CallConstants.CALL_STATUS.UNANSWERED:if(e.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase())m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)});else{if(null!==n&&n.getSessionId()===e.getSessionId())try{r.CallController.getInstance().endCall()}catch(t){C.Logger.error("CallError",t)}m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onIncomingCallCancelled)||t._eventListener.onIncomingCallCancelled(e)})}break;case p.CallConstants.CALL_STATUS.REJECTED:if(e.getReceiverType()==p.CallConstants.RECEIVER_TYPE_GROUP)e.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase()&&m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)});else{if(null!==n&&n.getSessionId()===e.getSessionId())try{r.CallController.getInstance().endCall()}catch(t){C.Logger.error("CallError",t)}m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)})}break;case p.CallConstants.CALL_STATUS.BUSY:e.getReceiverType()==p.CallConstants.RECEIVER_TYPE_GROUP?e.getCallInitiator().getUid().toLocaleLowerCase()==l.CometChat.user.getUid().toLocaleLowerCase()&&m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)}):m.callHandlers.map(function(t){if(null!==n&&n.getSessionId()===e.getSessionId())try{r.CallController.getInstance().endCall()}catch(t){C.Logger.error("CallError",t)}C.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)});break;case p.CallConstants.CALL_STATUS.CANCELLED:if(m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onIncomingCallCancelled)||t._eventListener.onIncomingCallCancelled(e)}),null!==n&&n.getSessionId()===e.getSessionId())try{r.CallController.getInstance().endCall()}catch(t){C.Logger.error("CallError",t)}break;case p.CallConstants.CALL_STATUS.ENDED:if(m.callHandlers.map(function(t){C.isFalsy(t._eventListener.onCallEndedMessageReceived)||t._eventListener.onCallEndedMessageReceived(e)}),r.CallController.getInstance().getCallListner()&&r.CallController.getInstance().getCallListner()._eventListener.onCallEnded(e),null!==n&&n.getSessionId()===e.getSessionId())try{r.CallController.getInstance().endCall()}catch(t){C.Logger.error("CallError",t)}break;default:C.Logger.log("WSHelper: publishCallMessage :: unknown status",e)}}catch(t){C.Logger.error("WSHelper: publishCallMessage",t)}},e.prototype.publishActionMessage=function(e){try{switch(e.getAction()){case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_JOINED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberJoined)||t._eventListener.onGroupMemberJoined(e,e.getActionBy(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_INVITED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberJoined)||t._eventListener.onGroupMemberJoined(e,e.getActionBy(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_LEFT:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberLeft)||t._eventListener.onGroupMemberLeft(e,e.getActionBy(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_BANNED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberBanned)||t._eventListener.onGroupMemberBanned(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_KICKED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberKicked)||t._eventListener.onGroupMemberKicked(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_UNBANNED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberUnbanned)||t._eventListener.onGroupMemberUnbanned(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_SCOPE_CHANGED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberScopeChanged)||t._eventListener.onGroupMemberScopeChanged(e,e.getActionOn(),e.getNewScope(),e.getOldScope(),e.getActionFor())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_EDITED:m.messageHandlers.map(function(t){C.isFalsy(t._eventListener.onMessageEdited)||t._eventListener.onMessageEdited(e.getActionOn())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_DELETED:m.messageHandlers.map(function(t){C.isFalsy(t._eventListener.onMessageDeleted)||t._eventListener.onMessageDeleted(e.getActionOn())});break;case p.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_ADDED:m.groupHandlers.map(function(t){C.isFalsy(t._eventListener.onGroupMemberAddedToGroup)||t._eventListener.onGroupMemberAddedToGroup(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;default:C.Logger.log("WSHelper: publishActionMessage :: unknown action",e)}}catch(t){C.Logger.error("WSHelper: publishActionMessage",t)}},e.prototype.publishTransientMessage=function(t){try{var e=t.getTransientMessage();m.messageHandlers.map(function(t){t._eventListener.onTransientMessageReceived&&t._eventListener.onTransientMessageReceived(e)})}catch(t){C.Logger.error("WSHelper: publishTransientMessage",t)}},e.prototype.getCometChatEventFromMessage=function(t){try{if(t.hasOwnProperty(N.KEYS.TYPE))switch(t.type){case N.TYPING_INDICATOR.TYPE:return R.CometChatTypingEvent.getTypingEventFromJSON(t);case N.RECEIPTS.TYPE:return h.CometChatReceiptEvent.getReceiptEventFromJSON(t);case N.PRESENCE.TYPE:return g.CometChatPresenceEvent.getPresenceEventFromJSON(t);case N.MESSAGE.TYPE:return d.CometChatMessageEvent.getMessageEventFromJSON(t);case N.AUTH.TYPE:return T.CometChatAuthEvent.getAuthEventFromJSON(t);case N.TRANSIENT_MESSAGE.TYPE:return A.CometChatTransientEvent.getTransientEventFromJSON(t)}}catch(t){C.Logger.error("WSConnectionHelper: getCometChatEventFromMessage",t)}},e.wsConnectionHelper=new e,e}();e.WSConnectionHelper=L},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatAuthEvent=void 0;var S=n(5),r=function(i){function u(t,e,n,o,s){var r=i.call(this,t,e,n,o,s)||this;return r.setType(S.AUTH.TYPE),r}return s(u,i),u.prototype.getStatus=function(){return this.status},u.prototype.setStatus=function(t){this.status=t},u.prototype.getCode=function(){return this.code},u.prototype.setCode=function(t){this.code=t},u.prototype.setAuth=function(t){this.auth=t},u.prototype.getAuth=function(){return this.auth},u.prototype.setPresenceSubscription=function(t){this.presenceSubscription=t},u.prototype.getPresenceSubscription=function(){return this.presenceSubscription},u.prototype.setDeviceId=function(t){this.deviceId=t},u.prototype.getdeviceId=function(){return this.deviceId},u.prototype.setExtraParmaeters=function(t){this.params=t},u.prototype.getExtraParameters=function(){return this.params},u.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},u.prototype.getAsJSONObject=function(){var t=this.getCometChatEventJSON(),e={};return e[S.KEYS.AUTH]=this.auth,e[S.KEYS.DEVICE_ID]=this.deviceId,e[S.KEYS.PRESENCE_SUBSCRIPTION]=this.presenceSubscription,e[S.KEYS.PARAMS]=this.params,t[S.KEYS.BODY]=e,t},u.getAuthEventFromJSON=function(t){var e=t[S.KEYS.APP_ID],n=t[S.KEYS.RECEIVER],o=t[S.KEYS.RECEIVER_TYPE],s=t[S.KEYS.DEVICE_ID],r=t[S.KEYS.SENDER],i=t[S.KEYS.BODY],a=i[S.KEYS.STATUS],E=i[S.KEYS.CODE],c=new u(e,n,o,r,s);return c.setStatus(a),c.setCode(E),c},u}(n(9).CometChatEvent);e.CometChatAuthEvent=r},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatMessageEvent=void 0;var u=n(10),S=n(5),r=function(i){function c(t,e,n,o,s){var r=i.call(this,t,e,n,o,s)||this;return r.setType(S.MESSAGE.TYPE),r}return s(c,i),c.prototype.getMessage=function(){return this.message},c.prototype.setMessage=function(t){this.message=t},c.getMessageEventFromJSON=function(t){var e=t[S.KEYS.APP_ID],n=t[S.KEYS.RECEIVER],o=t[S.KEYS.RECEIVER_TYPE],s=t[S.KEYS.DEVICE_ID],r=t[S.KEYS.SENDER],i=t[S.KEYS.BODY],a=new c(e,n,o,r,s),E=u.MessageController.trasformJSONMessge(i);return a.setMessage(E),a},c}(n(9).CometChatEvent);e.CometChatMessageEvent=r},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatPingEvent=void 0;var i=n(5),r=function(r){function t(t,e,n,o,s){return r.call(this,t,e,n,o,s)||this}return s(t,r),t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var t={};return t[i.KEYS.ACTION]=i.KEYS.PING,t[i.KEYS.ACK]="true",t},t}(n(9).CometChatEvent);e.CometChatPingEvent=r},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatPresenceEvent=void 0;var u=n(5),r=n(9),S=n(4),i=function(i){function c(t,e,n,o,s){var r=i.call(this,t,e,n,o,s)||this;return r.setType(u.PRESENCE.TYPE),r}return s(c,i),c.prototype.getAction=function(){return this.action},c.prototype.setAction=function(t){this.action=t},c.prototype.getUser=function(){return this.user},c.prototype.setUser=function(t){this.user=t},c.prototype.getTimestamp=function(){return this.timestamp},c.prototype.setTimestamp=function(t){this.timestamp=t},c.getPresenceEventFromJSON=function(t){var e=t[u.KEYS.APP_ID],n=t[u.KEYS.DEVICE_ID],o=t[u.KEYS.SENDER],s=t[u.KEYS.BODY],r=s[u.KEYS.ACTION],i=s[u.KEYS.USER],a=s[u.KEYS.TIMESTAMP],E=new c(e,"","",o,n);return E.setAction(r),E.setUser(new S.User(i)),E.setTimestamp(a),E},c}(r.CometChatEvent);e.CometChatPresenceEvent=i},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatReceiptEvent=void 0;var C=n(5),r=n(9),T=n(22),d=n(4),i=function(a){function p(t,e,n,o,s,r){var i=a.call(this,t,e,n,o,s,r)||this;return i.setType(C.RECEIPTS.TYPE),i}return s(p,a),p.prototype.getAction=function(){return this.action},p.prototype.setAction=function(t){this.action=t},p.prototype.getMessageReceipt=function(){return this.receipt},p.prototype.setMessageReceipt=function(t){this.receipt=t},p.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},p.prototype.getAsJSONObject=function(){var t=this.getCometChatEventJSON(),e={};return e[C.KEYS.ACTION]=this.action,e[C.KEYS.MESSAGE_ID]=this.receipt.getMessageId(),e[C.KEYS.USER]=this.receipt.getSender(),t[C.KEYS.BODY]=e,t},p.getReceiptEventFromJSON=function(t){var e=t[C.KEYS.APP_ID],n=t[C.KEYS.RECEIVER],o=t[C.KEYS.RECEIVER_TYPE],s=t[C.KEYS.DEVICE_ID],r=t[C.KEYS.SENDER],i=t[C.KEYS.BODY],a=i[C.KEYS.ACTION],E=i[C.KEYS.USER],c=i[C.KEYS.MESSAGE_ID],u=i[C.KEYS.TIMESTAMP],S=new p(e,n,o,r,s);S.setAction(a);var l=new T.MessageReceipt;return l.setSender(new d.User(E)),l.setReceiverType(o),l.setReceiver(n),a===C.RECEIPTS.ACTION.DELIVERED&&(l.setReceiptType(C.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),l.setDeliveredAt(u)),a===C.RECEIPTS.ACTION.READ&&(l.setReceiptType(C.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),l.setReadAt(u)),l.setMessageId(c.toString()),l.setTimestamp(u),S.setMessageReceipt(l),S},p}(r.CometChatEvent);e.CometChatReceiptEvent=i},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatTransientEvent=void 0;var l=n(5),r=n(9),p=n(27),C=n(4),i=function(i){function S(t,e,n,o,s){var r=i.call(this,t,e,n,o,s)||this;return r.setType(l.TRANSIENT_MESSAGE.TYPE),r}return s(S,i),S.prototype.getTransientMessage=function(){return this.transientMessage},S.prototype.setTransientMessage=function(t){this.transientMessage=t},S.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},S.prototype.getAsJSONObject=function(){var t=this.getCometChatEventJSON(),e={};return e[l.KEYS.USER]=this.transientMessage.getSender(),this.transientMessage.getData()&&(e[l.KEYS.DATA]=this.transientMessage.getData()),t[l.KEYS.BODY]=e,t},S.getTransientEventFromJSON=function(t){var e=t[l.KEYS.APP_ID],n=t[l.KEYS.RECEIVER],o=t[l.KEYS.RECEIVER_TYPE],s=t[l.KEYS.DEVICE_ID],r=t[l.KEYS.SENDER],i=t[l.KEYS.BODY],a=i[l.KEYS.USER],E=i[l.KEYS.DATA],c=new S(e,n,o,r,s),u=new p.TransientMessage(n,o,E);return u.setSender(new C.User(a)),i.hasOwnProperty(l.KEYS.DATA)&&i[l.KEYS.DATA]&&u.setData(E),c.setTransientMessage(u),c},S}(r.CometChatEvent);e.CometChatTransientEvent=i},function(t,e,n){"use strict";var o,s=this&&this.__extends||(o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.CometChatTypingEvent=void 0;var p=n(5),r=n(9),C=n(26),T=n(4),i=function(i){function l(t,e,n,o,s){var r=i.call(this,t,e,n,o,s)||this;return r.setType(p.TYPING_INDICATOR.TYPE),r}return s(l,i),l.prototype.getAction=function(){return this.action},l.prototype.setAction=function(t){this.action=t},l.prototype.getTypingIndicator=function(){return this.typingIndicator},l.prototype.setTypingIndicator=function(t){this.typingIndicator=t},l.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},l.prototype.getAsJSONObject=function(){var t=this.getCometChatEventJSON(),e={};return e[p.KEYS.ACTION]=this.action,e[p.KEYS.USER]=this.typingIndicator.getSender(),this.typingIndicator.getMetadata()&&(e[p.KEYS.METADATA]=this.typingIndicator.getMetadata()),t[p.KEYS.BODY]=e,t},l.getTypingEventFromJSON=function(t){var e=t[p.KEYS.APP_ID],n=t[p.KEYS.RECEIVER],o=t[p.KEYS.RECEIVER_TYPE],s=t[p.KEYS.DEVICE_ID],r=t[p.KEYS.SENDER],i=t[p.KEYS.BODY],a=i[p.KEYS.ACTION],E=i[p.KEYS.USER],c=i[p.KEYS.METADATA],u=new l(e,n,o,r,s);u.setAction(a);var S=new C.TypingIndicator(n,o);return S.setSender(new T.User(E)),i.hasOwnProperty(p.KEYS.METADATA)&&i[p.KEYS.METADATA]&&S.setMetadata(c),u.setTypingIndicator(S),u},l}(r.CometChatEvent);e.CometChatTypingEvent=i},function(t,e,n){"use strict";e.__esModule=!0,e.getWSURL=e.stringifyMessage=e.checkConnection=void 0;var o=n(1),s=n(0),r=n(5);e.checkConnection=function(t){return t&&t.readyState===r.READY_STATE.OPEN},e.stringifyMessage=function(t){return JSON.stringify(t)},e.getWSURL=function(){return new Promise(function(n,t){s.getAppSettings().then(function(t){var e=r.WS.protocol+s.getChatHost(t)+":"+t[o.APP_SETTINGS.KEYS.CHAT_WSS_PORT];n(e)},function(t){s.Logger.error("WSHelper :: getWSURL",t)})})}},function(t,e,n){"use strict";e.__esModule=!0,e.CCExtension=void 0;var o=n(0),s=function(){function t(t){this.id="",this.name="",t&&(o.isFalsy(t.id)||(this.id=t.id),o.isFalsy(t.name)||(this.name=t.name))}return t.prototype.getId=function(){return this.id},t.prototype.getName=function(){return this.name},t}();e.CCExtension=s},function(t,e,n){var i=n(64),a=n(65);t.exports=function(t,e,n){var o=e&&n||0;"string"==typeof t&&(e="binary"===t?new Array(16):null,t=null);var s=(t=t||{}).random||(t.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,e)for(var r=0;r<16;++r)e[o+r]=s[r];return e||a(s)}},function(t,e){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 o=new Uint8Array(16);t.exports=function(){return n(o),o}}else{var s=new Array(16);t.exports=function(){for(var t,e=0;e<16;e++)0==(3&e)&&(t=4294967296*Math.random()),s[e]=t>>>((3&e)<<3)&255;return s}}},function(t,e){for(var s=[],n=0;n<256;++n)s[n]=(n+256).toString(16).substr(1);t.exports=function(t,e){var n=e||0,o=s;return[o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],"-",o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]],o[t[n++]]].join("")}}])});