!function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=31)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG=e.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT=e.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET=e.PAGE_VISITED_URL=e.MANUAL_UNSUBSCRIBE=e.EVENT_PW_SITE_OPENED=e.EVENT_GDPR_DELETE=e.EVENT_GDPR_CONSENT=e.EVENT_CLICK_SUBSCRIBE_BUTTON=e.EVENT_SHOW_SUBSCRIBE_BUTTON=e.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET=e.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET=e.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG=e.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG=e.EVENT_ON_UPDATE_INBOX_MESSAGES=e.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE=e.EVENT_ON_CHANGE_COMMUNICATION_ENABLED=e.EVENT_ON_NOTIFICATION_CLOSE=e.EVENT_ON_NOTIFICATION_CLICK=e.EVENT_ON_PUSH_DELIVERY=e.EVENT_ON_SW_INIT_ERROR=e.EVENT_ON_PERMISSION_GRANTED=e.EVENT_ON_PERMISSION_DENIED=e.EVENT_ON_PERMISSION_PROMPT=e.EVENT_ON_REGISTER=e.EVENT_ON_UNSUBSCRIBE=e.EVENT_ON_SUBSCRIBE=e.EVENT_ON_READY=e.EVENT_ON_LOAD=e.PERMISSION_PROMPT=e.PERMISSION_GRANTED=e.PERMISSION_DENIED=e.DEVICE_REGISTRATION_STATUS_UNREGISTERED=e.DEVICE_REGISTRATION_STATUS_REGISTERED=e.MANUAL_SET_LOGGER_LEVEL=e.KEY_SAFARI_PREVIOUS_PERMISSION=e.KEY_DEVICE_REGISTRATION_STATUS=e.KEY_CLICK_SUBSCRIBE_WIDGET=e.KEY_SHOW_SUBSCRIBE_WIDGET=e.DEFAULT_NOTIFICATION_IMAGE=e.DEFAULT_NOTIFICATION_TITLE=e.PERIOD_GOAL_EVENT=e.PERIOD_SEND_APP_OPEN=e.DEFAULT_API_URL=e.DEFAULT_SERVICE_WORKER_URL=void 0,e.DEFAULT_SERVICE_WORKER_URL="/pushwoosh-service-worker.js",e.DEFAULT_API_URL="https://cp.pushwoosh.com/json/1.3/",e.PERIOD_SEND_APP_OPEN=36e5,e.PERIOD_GOAL_EVENT=864e5,e.DEFAULT_NOTIFICATION_TITLE="Pushwoosh notification",e.DEFAULT_NOTIFICATION_IMAGE="https://cp.pushwoosh.com/img/logo-medium.png",e.KEY_SHOW_SUBSCRIBE_WIDGET="WIDGET_SHOWED",e.KEY_CLICK_SUBSCRIBE_WIDGET="WIDGET_CLICKED",e.KEY_DEVICE_REGISTRATION_STATUS="deviceRegistrationStatus",e.KEY_SAFARI_PREVIOUS_PERMISSION="safariPreviousPermission",e.MANUAL_SET_LOGGER_LEVEL="PW_SET_LOGGER_LEVEL",e.DEVICE_REGISTRATION_STATUS_REGISTERED="registered",e.DEVICE_REGISTRATION_STATUS_UNREGISTERED="unregistered",e.PERMISSION_DENIED="denied",e.PERMISSION_GRANTED="granted",e.PERMISSION_PROMPT="default",e.EVENT_ON_LOAD="onLoad",e.EVENT_ON_READY="onReady",e.EVENT_ON_SUBSCRIBE="onSubscribe",e.EVENT_ON_UNSUBSCRIBE="onUnsubscribe",e.EVENT_ON_REGISTER="onRegister",e.EVENT_ON_PERMISSION_PROMPT="onPermissionPrompt",e.EVENT_ON_PERMISSION_DENIED="onPermissionDenied",e.EVENT_ON_PERMISSION_GRANTED="onPermissionGranted",e.EVENT_ON_SW_INIT_ERROR="onSWInitError",e.EVENT_ON_PUSH_DELIVERY="onPushDelivery",e.EVENT_ON_NOTIFICATION_CLICK="onNotificationClick",e.EVENT_ON_NOTIFICATION_CLOSE="onNotificationClose",e.EVENT_ON_CHANGE_COMMUNICATION_ENABLED="onChangeCommunicationEnabled",e.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE="onPutNewMessageToInboxStore",e.EVENT_ON_UPDATE_INBOX_MESSAGES="onUpdateInboxMessages",e.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG="onShowNotificationPermissionDialog",e.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG="onHideNotificationPermissionDialog",e.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET="onShowSubscriptionWidget",e.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET="onHideSubscriptionWidget",e.EVENT_SHOW_SUBSCRIBE_BUTTON="showSubscribeButton",e.EVENT_CLICK_SUBSCRIBE_BUTTON="clickSubscribeButton",e.EVENT_GDPR_CONSENT="GDPRConsent",e.EVENT_GDPR_DELETE="GDPRDelete",e.EVENT_PW_SITE_OPENED="PW_SiteOpened",e.MANUAL_UNSUBSCRIBE="MANUAL_UNSUBSCRIBE",e.PAGE_VISITED_URL="PAGE_VISITED_URL",e.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET="not-set",e.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT="default",e.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG={headerText:"Subscribe to our news",headerTextColor:"#000000",subheaderText:"Don't miss out on the latest news and updates!",subheaderTextColor:"#000000",buttonAcceptText:"Agree",buttonAcceptTextColor:"#1A72E8",buttonAcceptRound:"4px",buttonAcceptBackgroundColor:"#FFFFFF",buttonAcceptBorderColor:"#E3E4E8",buttonCancelText:"Deny",buttonCancelTextColor:"#1A72E8",buttonCancelRound:"4px",buttonCancelBackgroundColor:"#FFFFFF",buttonCancelBorderColor:"#E3E4E8",cappingCount:3,cappingDelay:144e5,backgroundColor:"#FFFFFF"}},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;i>n;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},o=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.Data=void 0;var s=n(2),a=n(0),u=function(){function t(t){void 0===t&&(t=s.keyValue),this.store=t}return t.prototype.clearAll=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.set("params.applicationCode",void 0)];case 1:return t.sent(),[4,this.store.set("params.hwid",void 0)];case 2:return t.sent(),[4,this.store.set("params.deviceType",void 0)];case 3:return t.sent(),[4,this.store.set("params.deviceModel",void 0)];case 4:return t.sent(),[4,this.store.set("params.language",void 0)];case 5:return t.sent(),[4,this.store.set("params.apiEntrypoint",void 0)];case 6:return t.sent(),[4,this.store.set("params.tokens",void 0)];case 7:return t.sent(),[4,this.store.set("params.applicationServerKey",void 0)];case 8:return t.sent(),[4,this.store.set("params.senderId",void 0)];case 9:return t.sent(),[4,this.store.set("params.webSitePushId",void 0)];case 10:return t.sent(),[4,this.store.set("params.defaultNotificationImage",void 0)];case 11:return t.sent(),[4,this.store.set("params.defaultNotificationTitle",void 0)];case 12:return t.sent(),[4,this.store.set("params.userId",void 0)];case 13:return t.sent(),[4,this.store.set("params.userIdWasChanged",void 0)];case 14:return t.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 15:return t.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 16:return t.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 17:return t.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 18:return t.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 19:return t.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 20:return t.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 21:return t.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 22:return t.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 23:return t.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 24:return t.sent(),[4,this.store.set("params.features",void 0)];case 25:return t.sent(),[4,this.store.set("params.init",void 0)];case 26:return t.sent(),[4,this.store.set("API_PARAMS",void 0)];case 27:return t.sent(),[4,this.store.set("SENDER_ID",void 0)];case 28:return t.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 29:return t.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 30:return t.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 31:return t.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 32:return t.sent(),[2]}})})},t.prototype.setApplicationCode=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.applicationCode",t)];case 1:return e.sent(),[2]}})})},t.prototype.getApplicationCode=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.applicationCode")];case 1:return[2,t.sent()]}})})},t.prototype.setHwid=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.hwid",t)];case 1:return e.sent(),[2]}})})},t.prototype.getHwid=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.hwid")];case 1:return[2,t.sent()]}})})},t.prototype.setDeviceType=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.deviceType",t)];case 1:return e.sent(),[2]}})})},t.prototype.getDeviceType=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.deviceType")];case 1:return[2,t.sent()]}})})},t.prototype.setDeviceModel=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.deviceModel",t)];case 1:return e.sent(),[2]}})})},t.prototype.getDeviceModel=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.deviceModel")];case 1:return[2,t.sent()]}})})},t.prototype.setLanguage=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.language",t)];case 1:return e.sent(),[2]}})})},t.prototype.getLanguage=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.language","en")];case 1:return[2,t.sent()]}})})},t.prototype.setApiEntrypoint=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.apiEntrypoint",t)];case 1:return e.sent(),[2]}})})},t.prototype.getApiEntrypoint=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.apiEntrypoint",a.DEFAULT_API_URL)];case 1:return[2,t.sent()]}})})},t.prototype.setTokens=function(t){return r(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,this.getHwid()];case 1:return e=n.sent(),[4,this.store.set("API_PARAMS",i({hwid:e},t))];case 2:return n.sent(),[4,this.store.set("params.tokens",t)];case 3:return n.sent(),[2]}})})},t.prototype.getTokens=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("API_PARAMS")];case 1:return t=n.sent(),[4,this.store.get("params.tokens")];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setApplicationServerKey=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.applicationServerKey",t)];case 1:return e.sent(),[2]}})})},t.prototype.getApplicationServerKey=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.applicationServerKey")];case 1:return[2,t.sent()]}})})},t.prototype.setSenderId=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("GCM_SENDER_ID",t)];case 1:return e.sent(),[4,this.store.set("params.senderId",t)];case 2:return e.sent(),[2]}})})},t.prototype.getSenderId=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("GCM_SENDER_ID")];case 1:return t=n.sent(),[4,this.store.get("params.senderId")];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setWebSitePushId=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.webSitePushId",t)];case 1:return e.sent(),[2]}})})},t.prototype.getWebSitePushId=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.webSitePushId")];case 1:return[2,t.sent()]}})})},t.prototype.setDefaultNotificationImage=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.defaultNotificationImage",t)];case 1:return e.sent(),[2]}})})},t.prototype.getDefaultNotificationImage=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.defaultNotificationImage",a.DEFAULT_NOTIFICATION_IMAGE)];case 1:return[2,t.sent()]}})})},t.prototype.setDefaultNotificationTitle=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.defaultNotificationTitle",t)];case 1:return e.sent(),[2]}})})},t.prototype.getDefaultNotificationTitle=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.defaultNotificationTitle",a.DEFAULT_NOTIFICATION_TITLE)];case 1:return[2,t.sent()]}})})},t.prototype.setUserId=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return t?[3,2]:[4,this.store.set("params.userId",void 0)];case 1:return e.sent(),[2];case 2:return[4,this.store.set("params.userId",""+t)];case 3:return e.sent(),[2]}})})},t.prototype.getUserId=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.userId")];case 1:return[2,t.sent()]}})})},t.prototype.setStatusUserIdWasChanged=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.userIdWasChanged",t)];case 1:return e.sent(),[2]}})})},t.prototype.getStatusUserIdWasChanged=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.userIdWasChanged",!1)];case 1:return[2,t.sent()]}})})},t.prototype.setLastPermissionStatus=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.isLastPermissionStatus",t)];case 1:return e.sent(),[2]}})})},t.prototype.getLastPermissionStatus=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.isLastPermissionStatus")];case 1:return[2,t.sent()]}})})},t.prototype.setStatusManualUnsubscribed=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("MANUAL_UNSUBSCRIBE",t)];case 1:return e.sent(),[4,this.store.set("params.isManualUnsubscribed",t)];case 2:return e.sent(),[2]}})})},t.prototype.getStatusManualUnsubscribed=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("MANUAL_UNSUBSCRIBE",!1)];case 1:return t=n.sent(),[4,this.store.get("params.isManualUnsubscribed",!1)];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setStatusCommunicationDisabled=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("COMMUNICATION_ENABLED",t?0:1)];case 1:return e.sent(),[4,this.store.set("params.isCommunicationDisabled",t)];case 2:return e.sent(),[2]}})})},t.prototype.getStatusCommunicationDisabled=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("COMMUNICATION_ENABLED")];case 1:return t=n.sent(),[4,this.store.get("params.isCommunicationDisabled",!1)];case 2:return[2,void 0!==(e=n.sent())?e:0==t]}})})},t.prototype.setStatusDropAllData=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("DEVICE_DATA_REMOVED",t)];case 1:return e.sent(),[4,this.store.set("params.isDropAllData",t)];case 2:return e.sent(),[2]}})})},t.prototype.getStatusDropAllData=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("DEVICE_DATA_REMOVED",!1)];case 1:return t=n.sent(),[4,this.store.get("params.isDropAllData",!1)];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setSdkVersion=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.sdkVersion",t)];case 1:return e.sent(),[2]}})})},t.prototype.getSdkVersion=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.sdkVersion")];case 1:return[2,t.sent()]}})})},t.prototype.setServiceWorkerVersion=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("WORKER_VERSION",t)];case 1:return e.sent(),[4,this.store.set("params.serviceWorkerVersion",t)];case 2:return e.sent(),[2]}})})},t.prototype.getServiceWorkerVersion=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("WORKER_VERSION")];case 1:return t=n.sent(),[4,this.store.get("params.serviceWorkerVersion")];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setServiceWorkerUrl=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return t?[4,this.store.set("params.serviceWorkerUrl",t)]:[2];case 1:return e.sent(),[2]}})})},t.prototype.getServiceWorkerUrl=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.serviceWorkerUrl",a.DEFAULT_SERVICE_WORKER_URL)];case 1:return[2,t.sent()]}})})},t.prototype.setServiceWorkerScope=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return t?[4,this.store.set("params.serviceWorkerScope",t)]:[2];case 1:return e.sent(),[2]}})})},t.prototype.getServiceWorkerScope=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.serviceWorkerScope")];case 1:return[2,t.sent()]}})})},t.prototype.setLastOpenMessage=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("LAST_OPEN_MESSAGE",t)];case 1:return e.sent(),[4,this.store.set("params.lastOpenMessage",t)];case 2:return e.sent(),[2]}})})},t.prototype.getLastOpenMessage=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("LAST_OPEN_MESSAGE")];case 1:return t=n.sent(),[4,this.store.get("params.lastOpenMessage")];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setLastOpenApplicationTime=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.lastOpenApplicationTime",t)];case 1:return e.sent(),[2]}})})},t.prototype.getLastOpenApplicationTime=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.lastOpenApplicationTime")];case 1:return[2,t.sent()]}})})},t.prototype.setFeatures=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.features",t)];case 1:return e.sent(),[2]}})})},t.prototype.getFeatures=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.features")];case 1:return[2,t.sent()]}})})},t.prototype.setInitParams=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.init",t)];case 1:return e.sent(),[2]}})})},t.prototype.getInitParams=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.init")];case 1:return[2,t.sent()]}})})},t.prototype.setInboxLastRequestCode=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.inbox.lastRequestCode",t)];case 1:return e.sent(),[2]}})})},t.prototype.getInboxLastRequestCode=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.store.get("params.inbox.lastRequestCode","")];case 1:return[2,t.sent()]}})})},t.prototype.setInboxLastRequestTime=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.inbox.lastRequestTime",t)];case 1:return e.sent(),[2]}})})},t.prototype.getInboxLastRequestTime=function(){return r(this,void 0,void 0,function(){return o(this,function(t){return[2,this.store.get("params.inbox.lastRequestTime",0)]})})},t.prototype.setInboxNewMessagesCount=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.inbox.newMessagesCount",t)];case 1:return e.sent(),[2]}})})},t.prototype.getInboxNewMessagesCount=function(){return r(this,void 0,void 0,function(){return o(this,function(t){return[2,this.store.get("params.inbox.newMessagesCount",0)]})})},t.prototype.setDelayedEvent=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("DELAYED_EVENT",t)];case 1:return e.sent(),[4,this.store.set("params.delayedEvent",t)];case 2:return e.sent(),[2]}})})},t.prototype.getDelayedEvent=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.store.get("DELAYED_EVENT")];case 1:return t=n.sent(),[4,this.store.get("params.delayedEvent")];case 2:return[2,void 0!==(e=n.sent())?e:t]}})})},t.prototype.setPromptDisplayCount=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.promptDisplayCount",t)];case 1:return e.sent(),[2]}})})},t.prototype.getPromptDisplayCount=function(){return r(this,void 0,void 0,function(){return o(this,function(t){return[2,this.store.get("params.promptDisplayCount",0)]})})},t.prototype.setPromptLastSeenTime=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.store.set("params.promptLastSeenTime",t)];case 1:return e.sent(),[2]}})})},t.prototype.getPromptLastSeenTime=function(){return r(this,void 0,void 0,function(){return o(this,function(t){return[2,this.store.get("params.promptLastSeenTime",0)]})})},t}();e.Data=u},function(t,e,n){"use strict";var i,r=this&&this.__extends||(i=function(t,e){return(i=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}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),o=this&&this.__assign||function(){return(o=Object.assign||function(t){for(var e,n=1,i=arguments.length;i>n;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},s=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},a=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},u=this&&this.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&0>e.indexOf(i)&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);i.length>r;r++)0>e.indexOf(i[r])&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.message=e.log=e.keyValue=e.LogMessage=e.LogLog=e.LogBase=e.getInstance=void 0;var c,p=n(10),l=n(11),d=n(6);function h(t,e){console.info("onversionchange",e),t.close()}function f(){return c||(c=new Promise(function(t,e){var n=indexedDB.open("PUSHWOOSH_SDK_STORE",p.default);n.onsuccess=function(n){var i=n.target.result;i.onversionchange=h.bind(null,i,e),t(i)},n.onerror=function(){return e(n.error)},n.onupgradeneeded=function(t){var n=t.target.result;n.onversionchange=h.bind(null,n,e),new l.default(n).applyMigrations()}})),c}function b(t){return f().then(function(e){return new Promise(function(n,i){return t(e,n,i)})})}e.getInstance=f;var g=function(){function t(){}return t.prototype._add=function(t){var e=this;return b(function(n,i,r){var o=n.transaction([e.name],"readwrite").objectStore(e.name).add(t);o.onsuccess=function(){i(t)},o.onerror=function(){r(o.error)}}).then(function(t){return e.getAll().then(function(n){if(Array.isArray(n)){var i=n.map(function(t){return t.id}).sort(function(t,e){return t==e?0:e>t?1:-1});if(i.length>e.maxItems)return Promise.all(i.slice(e.maxItems).map(function(t){return e.delete(t)})).then(function(){return t})}return t})})},t.prototype.delete=function(t){var e=this;return b(function(n,i,r){var o=n.transaction([e.name],"readwrite").objectStore(e.name).delete(t);o.onsuccess=function(){i(o.result)},o.onerror=function(){r(o.error)}})},t.prototype.getAll=function(){var t=this;return b(function(e,n,i){var r=[],o=e.transaction(t.name).objectStore(t.name).openCursor();o.onsuccess=function(t){var e=t.target.result;e?(e.value&&r.push(e.value),e.continue()):n(r)},o.onerror=function(){i(o.error)}})},t}();e.LogBase=g;var v=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name=d.STORE_NAME_MAIN_LOG,e.maxItems=100,e.environment="undefined"!=typeof self&&self.registration?"worker":"browser",e}return r(e,t),e.prototype.add=function(t,e,n){var i={type:t,environment:this.environment,message:""+e,date:new Date};return e instanceof Error&&(i.stack=e.stack),n&&(i.additional=n),this._add(i)},e}(g);e.LogLog=v;var w,m=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name=d.STORE_NAME_MESSAGE_LOG,e.maxItems=25,e}return r(e,t),e.prototype.add=function(t){return this._add(o(o({},t),{date:new Date}))},e}(g);e.LogMessage=m,e.keyValue=(w=d.STORE_NAME_KEY_VALUE,{get:function(t,e){return b(function(n,i,r){var o,s=n.transaction(w).objectStore(w).get(t),a=!1,u=!1,c=function(){if(clearTimeout(o),a){var t=s.result;i(t&&t.value||e)}else u?r(s.error):o=setTimeout(c,0)};s.onsuccess=function(){return a=!0},s.onerror=function(){return u=!0},c()})},getAll:function(){return b(function(t,e,n){var i,r={},o=t.transaction(w).objectStore(w).openCursor(),s=!1,a=!1,u=function(){clearTimeout(i),s?e(r):a?n(o.error):i=setTimeout(u,0)};o.onsuccess=function(t){var e=t.target.result;e?(r[e.key]=e.value.value,e.continue()):s=!0},o.onerror=function(){return a=!0},u()})},extend:function(t,e){return s(this,void 0,void 0,function(){var n,i;return a(this,function(r){switch(r.label){case 0:return[4,this.get(t)];case 1:return n=r.sent(),i=u(e,[]),[4,this.set(t,o(o({},n),i))];case 2:return r.sent(),[2]}})})},set:function(t,e){return b(function(n,i,r){var o,s=n.transaction([w],"readwrite").objectStore(w).put({key:t,value:e}),a=!1,u=!1,c=function(){clearTimeout(o),a?i(t):u?r(s.error):o=setTimeout(c,0)};s.onsuccess=function(){return a=!0},s.onerror=function(){return u=!0},c()})}}),e.log=new v,e.message=new m},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t){void 0===t&&(t=new Date),this._date=t}return Object.defineProperty(t.prototype,"date",{get:function(){return this._date},set:function(t){this._date=t},enumerable:!1,configurable:!0}),t.prototype.getUtcTimestamp=function(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)},t.prototype.getTimestamp=function(){return Math.round(this.date.getTime()/1e3)},t.prototype.setLocal=function(){var t=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(t)},t.prototype.addDays=function(t){var e=this._date.getTime()+24*t*60*60*1e3;this._date=new Date(e)},t.prototype.getInboxFakeOrder=function(){return""+(100*this._date.getTime()+9e9)},t}();e.default=i},function(t,e,n){"use strict";var i=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;n>e;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;n>e;e++)for(var o=arguments[e],s=0,a=o.length;a>s;s++,r++)i[r]=o[s];return i};Object.defineProperty(e,"__esModule",{value:!0}),e.Logger=e.logAndRejectError=e.logAndThrowError=void 0;var r=n(2),o={error:1,info:2,debug:3},s=3;n(5).patchConsole();var a={setLevel:function(t){o[t]||(t="error"),s=o[t]},write:function(t,e,n){return"error"===t?this.error(e):this.info(e),r.log.add(t,e,n)}};e.Logger=a,Object.keys(o).forEach(function(t){var e=o[t];a[t]=function(){for(var n=[],r=0;arguments.length>r;r++)n[r]=arguments[r];e>s||(console.groupCollapsed(t),console.info.apply(console,i([""],n)),console.trace("trace"),console.groupEnd())}}),e.logAndThrowError=function(t){var e=Error(t);throw a.write("error",e,"logAndThrowError"),e},e.logAndRejectError=function(t,e){var n=Error(t);a.write("error",n,"logAndRejectError"),e(n)}},function(t,e,n){"use strict";function i(){return globalThis}Object.defineProperty(e,"__esModule",{value:!0}),e.generateUUID=e.clearLocationHash=e.patchConsole=e.parseSerializedNotificationParams=e.getVersion=e.getGlobal=void 0,e.getGlobal=i,e.getVersion=function(){return"3.35.2"},e.parseSerializedNotificationParams=function(t,e){if("string"==typeof t)try{return JSON.parse(t)}catch(t){console.log(t)}return void 0===t&&void 0!==e?e:t},e.patchConsole=function(){for(var t,e=function(){},n=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],r=n.length,o=i(),s=o.console=o.console||{};r--;)s[t=n[r]]||(s[t]=e)},e.clearLocationHash=function(){"history"in i()&&history.pushState?history.pushState(null,"","#"):location.hash="#"},e.generateUUID=function(){var t=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(t+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var n=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"===e?n:3&n|8).toString(16)})}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KEY_PATH_BASE_INCREMENT=e.STORE_NAME_INBOX_MESSAGES=e.STORE_NAME_MAIN_LOG=e.STORE_NAME_MESSAGE_LOG=e.STORE_NAME_KEY_VALUE=void 0,e.STORE_NAME_KEY_VALUE="keyValue",e.STORE_NAME_MESSAGE_LOG="messages",e.STORE_NAME_MAIN_LOG="log",e.STORE_NAME_INBOX_MESSAGES="inboxMessages",e.KEY_PATH_BASE_INCREMENT="id"},function(t,e,n){var i=n(15),r=n(16),o=r;o.v1=i,o.v4=r,t.exports=o},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 i=new Uint8Array(16);t.exports=function(){return n(i),i}}else{var r=Array(16);t.exports=function(){for(var t,e=0;16>e;e++)0==(3&e)&&(t=4294967296*Math.random()),r[e]=t>>>((3&e)<<3)&255;return r}}},function(t,e){for(var n=[],i=0;256>i;++i)n[i]=(i+256).toString(16).substr(1);t.exports=function(t,e){var i=e||0;return""+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+"-"+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]+n[t[i++]]}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=7},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(20),r=function(){function t(t,e){void 0===e&&(e=new i.default),this.db=t,this.migrationsBuilder=e}return t.prototype.applyMigrations=function(){var t=this;this.applyMigrationsPack(this.migrationsBuilder.initial),this.migrationsBuilder.dateSorted.forEach(function(e){t.applyMigrationsPack(e)})},t.prototype.applyMigrationsPack=function(t){var e=this;t.forEach(function(t){t(e.db)})},t}();e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.storeCreatorDecorator=void 0,e.storeCreatorDecorator=function(t,e){return function(n){n.objectStoreNames.contains(t)||e(n)}}},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},o=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;n>e;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;n>e;e++)for(var o=arguments[e],s=0,a=o.length;a>s;s++,r++)i[r]=o[s];return i};Object.defineProperty(e,"__esModule",{value:!0});var s=n(3),a=function(){function t(t,e,n,i){void 0===i&&(i=new s.default),this.data=t,this.api=e,this.inboxModel=n,this.dateModule=i,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}return t.prototype.messageTypeFactory=function(t,e){var n=0;return 2===t?n=1:"l"in e&&null!=e.l&&(n=e.l.startsWith("http")?2:3),n},t.prototype.updateMessagesStatusWithCodes=function(t,e,n){return i(this,void 0,void 0,function(){var o,s,a=this;return r(this,function(u){switch(u.label){case 0:return o=[],s=[],e.forEach(function(e){return i(a,void 0,void 0,function(){return r(this,function(i){return-1===t.indexOf(e.inbox_id)?[2]:(e.status=n,o.push(e),s.push(this.api.inboxStatus(e.order,e.status)),[2])})})}),[4,this.inboxModel.putBulkMessages(o)];case 1:return u.sent(),[4,Promise.all(s)];case 2:return u.sent(),[2]}})})},t.prototype.publicMessageBuilder=function(t){var e=t.action_type,n=t.action_params,o=t.image,s=t.title,a=t.send_date,u=t.inbox_id,c=t.text,p=t.status;return i(this,void 0,void 0,function(){var t,i,l,d,h;return r(this,function(r){switch(r.label){case 0:return(i=o)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:i=r.sent(),r.label=2;case 2:return t=i,(d=s)?[3,4]:[4,this.data.getDefaultNotificationTitle()];case 3:d=r.sent(),r.label=4;case 4:return l=d,h=JSON.parse(n),this.dateModule.date=new Date(1e3*parseInt(a)),this.dateModule.setLocal(),[2,{title:l,imageUrl:t,code:u,message:c,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(e,h),link:(null===h||void 0===h?void 0:h.l)||"/",isRead:2===p||3===p,isActionPerformed:3===p}]}})})},t.prototype.messagesWithNoActionPerformedCount=function(){return this.inboxModel.getDeliveredReadMessagesCount()},t.prototype.unreadMessagesCount=function(){return this.inboxModel.getDeliveredMessagesCount()},t.prototype.messagesCount=function(){return this.inboxModel.messagesCount()},t.prototype.loadMessages=function(){return i(this,void 0,void 0,function(){var t,e,n;return r(this,function(i){switch(i.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return t=i.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return e=i.sent(),n=o(t,e).sort(function(t,e){return parseInt(e.send_date,10)-parseInt(t.send_date,10)}).sort(function(t,e){return parseInt(e.order||"0",10)-parseInt(t.order||"0",10)}).map(this.publicMessageBuilder),[2,Promise.all(n)]}})})},t.prototype.readMessagesWithCodes=function(t){return i(this,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:return[4,this.inboxModel.getDeliveredMessages()];case 1:return e=n.sent(),[4,this.updateMessagesStatusWithCodes(t,e,2)];case 2:return n.sent(),[2]}})})},t.prototype.performActionForMessageWithCode=function(t){return i(this,void 0,void 0,function(){var e,n,i;return r(this,function(r){switch(r.label){case 0:return[4,this.inboxModel.getMessage(t)];case 1:return e=r.sent(),n=JSON.parse(e.action_params),2===(i=this.messageTypeFactory(e.action_type,n))&&null!=n.l?document.location.href=n.l:3===i&&null!=n.l&&window.history.go(n.l),e.status=3,[4,this.inboxModel.putMessage(e)];case 2:return r.sent(),[4,this.api.inboxStatus(e.order,e.status)];case 3:return r.sent(),[2]}})})},t.prototype.deleteMessagesWithCodes=function(t){return i(this,void 0,void 0,function(){var e,n,i;return r(this,function(r){switch(r.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return e=r.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return n=r.sent(),i=4,[4,this.updateMessagesStatusWithCodes(t,o(e,n),i)];case 3:return r.sent(),[2]}})})},t.prototype.syncMessages=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.inboxModel.updateMessages()];case 1:return t.sent(),[2]}})})},t}();e.default=a},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.ApiClient=void 0;var o=n(1),s=n(4),a=function(){function t(t,e){void 0===t&&(t=new o.Data),void 0===e&&(e=s.Logger),this.data=t,this.logger=e}return t.prototype.checkDevice=function(t){return this.createRequest("checkDevice",t)},t.prototype.getConfig=function(t){return this.createRequest("getConfig",t)},t.prototype.applicationOpen=function(t){return this.createRequest("applicationOpen",t)},t.prototype.registerDevice=function(t){return this.createRequest("registerDevice",t)},t.prototype.unregisterDevice=function(t){return this.createRequest("unregisterDevice",t)},t.prototype.deleteDevice=function(t){return this.createRequest("deleteDevice",t)},t.prototype.messageDeliveryEvent=function(t){return this.createRequest("messageDeliveryEvent",t)},t.prototype.pushStat=function(t){return this.createRequest("pushStat",t)},t.prototype.setTags=function(t){return this.createRequest("setTags",t)},t.prototype.getTags=function(t){return this.createRequest("getTags",t)},t.prototype.registerUser=function(t){return this.createRequest("registerUser",t)},t.prototype.postEvent=function(t){return this.createRequest("postEvent",t)},t.prototype.getInboxMessages=function(t){return this.createRequest("getInboxMessages",t)},t.prototype.inboxStatus=function(t){return this.createRequest("inboxStatus",t)},t.prototype.pageVisit=function(t,e){return this.createRequest("pageVisit",t,e)},t.prototype.setPurchase=function(t){return this.createRequest("setPurchase",t)},t.prototype.createRequest=function(t,e,n){return i(this,void 0,void 0,function(){var i,o,s;return r(this,function(r){switch(r.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return i=r.sent(),[4,fetch(n||i+t,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:e})})];case 2:return o=r.sent(),[4,this.checkResponse(o)];case 3:return(s=r.sent()).base_url?[4,this.data.setApiEntrypoint(s.base_url)]:[3,5];case 4:r.sent(),r.label=5;case 5:return[4,this.logger.write("apirequest",t+" call with arguments: "+JSON.stringify(e)+" to Pushwoosh has been successful. Result: "+JSON.stringify(s.response))];case 6:return r.sent(),[2,s.response]}})})},t.prototype.checkResponse=function(t){return i(this,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:if(200!==t.status)throw Error("Error code: "+t.status+". Error text: "+t.statusText);return[4,t.json()];case 1:if(200!==(e=n.sent()).status_code)throw Error("Error code: "+e.status_code+". Error text: "+e.status_message);return[2,e]}})})},t}();e.ApiClient=a},function(t,e,n){var i,r,o=n(8),s=n(9),a=0,u=0;t.exports=function(t,e,n){var c=e&&n||0,p=e||[],l=(t=t||{}).node||i,d=void 0!==t.clockseq?t.clockseq:r;if(null==l||null==d){var h=o();null==l&&(l=i=[1|h[0],h[1],h[2],h[3],h[4],h[5]]),null==d&&(d=r=16383&(h[6]<<8|h[7]))}var f=void 0!==t.msecs?t.msecs:(new Date).getTime(),b=void 0!==t.nsecs?t.nsecs:u+1,g=f-a+(b-u)/1e4;if(0>g&&void 0===t.clockseq&&(d=d+1&16383),(0>g||f>a)&&void 0===t.nsecs&&(b=0),b>=1e4)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");a=f,u=b,r=d;var v=(1e4*(268435455&(f+=122192928e5))+b)%4294967296;p[c++]=v>>>24&255,p[c++]=v>>>16&255,p[c++]=v>>>8&255,p[c++]=255&v;var w=f/4294967296*1e4&268435455;p[c++]=w>>>8&255,p[c++]=255&w,p[c++]=w>>>24&15|16,p[c++]=w>>>16&255,p[c++]=d>>>8|128,p[c++]=255&d;for(var m=0;6>m;++m)p[c+m]=l[m];return e||s(p)}},function(t,e,n){var i=n(8),r=n(9);t.exports=function(t,e,n){var o=e&&n||0;"string"==typeof t&&(e="binary"===t?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 a=0;16>a;++a)e[o+a]=s[a];return e||r(s)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(18);Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return i.EventBus}})},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;i>n;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};Object.defineProperty(e,"__esModule",{value:!0}),e.EventBus=void 0;var r=n(7),o=function(){return function(){var t=this;this.addEventHandler=function(e,n){var i=t.savedEventHandlersMap[e];i||(i=[]),i.push(n),t.savedEventHandlersMap[e]=i},this.removeEventHandler=function(e,n){var i=t.savedEventHandlersMap[e];i&&(t.savedEventHandlersMap[e]=i.filter(function(t){return t!==n}))},this.dispatchEvent=function(e,n){var o=n.eventId||r.v4(),s=t.savedEventHandlersMap[e];return s?(s.forEach(function(t){"function"==typeof t&&setTimeout(function(){t(i(i({},n),{eventId:o}))},0)}),o):o},this.savedEventHandlersMap={}}}();e.EventBus=o},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;i>n;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},o=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.Api=void 0;var s=n(1),a=n(14),u=n(0),c=function(){function t(t,e,n){void 0===e&&(e=new s.Data),void 0===n&&(n=new a.ApiClient),this.eventBus=t,this.data=e,this.apiClient=n}return t.prototype.checkDevice=function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,this.getRequestParams()];case 1:return t=e.sent(),[4,this.apiClient.checkDevice(t)];case 2:return[2,e.sent()]}})})},t.prototype.checkDeviceSubscribeForPushNotifications=function(t){return void 0===t&&(t=!0),r(this,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return void 0!==(e=localStorage.getItem(u.KEY_DEVICE_REGISTRATION_STATUS))&&t?[3,2]:[4,this.checkDevice()];case 1:n=i.sent(),localStorage.setItem(u.KEY_DEVICE_REGISTRATION_STATUS,n.exist&&n.push_token_exist?u.DEVICE_REGISTRATION_STATUS_REGISTERED:u.DEVICE_REGISTRATION_STATUS_UNREGISTERED),e=localStorage.getItem(u.KEY_DEVICE_REGISTRATION_STATUS),i.label=2;case 2:return[2,e===u.DEVICE_REGISTRATION_STATUS_REGISTERED]}})})},t.prototype.getConfig=function(t){return r(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return e=n.sent(),[2,this.apiClient.getConfig(i(i({},e),{features:t}))]}})})},t.prototype.applicationOpen=function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,this.getRequestParams()];case 1:return t=e.sent(),[4,this.data.setLastOpenApplicationTime(Date.now())];case 2:return e.sent(),[2,this.apiClient.applicationOpen(t)]}})})},t.prototype.registerDevice=function(){return r(this,void 0,void 0,function(){var t,e,n;return o(this,function(r){switch(r.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:if(r.sent())throw Error("Can't register device: Communication is disabled!");return[4,this.getRequestParams()];case 2:return t=r.sent(),[4,this.data.getTokens()];case 3:if(!(e=r.sent()).pushToken)throw Error("Can't register device: pushToken is not exist!");return[4,this.apiClient.registerDevice(i(i({},t),{push_token:e.pushToken,auth_token:e.authToken,public_key:e.publicKey,fcm_push_set:e.fcmPushSet,fcm_token:e.fcmToken}))];case 4:return n=r.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 5:return r.sent(),localStorage.setItem(u.KEY_DEVICE_REGISTRATION_STATUS,u.DEVICE_REGISTRATION_STATUS_REGISTERED),this.eventBus.dispatchEvent("register",{}),[2,n]}})})},t.prototype.unregisterDevice=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return t=n.sent(),e=this.apiClient.unregisterDevice(t),localStorage.setItem(u.KEY_DEVICE_REGISTRATION_STATUS,u.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,e]}})})},t.prototype.deleteDevice=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return t=n.sent(),e=this.apiClient.deleteDevice(t),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return n.sent(),localStorage.setItem(u.KEY_DEVICE_REGISTRATION_STATUS,u.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,e]}})})},t.prototype.messageDeliveryEvent=function(t,e,n){return void 0===n&&(n={}),r(this,void 0,void 0,function(){var e;return o(this,function(r){switch(r.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return e=r.sent(),[4,this.apiClient.messageDeliveryEvent(i(i({},e),{hash:t,metaData:n}))];case 2:return[2,r.sent()]}})})},t.prototype.pushStat=function(t,e,n){return void 0===n&&(n={}),r(this,void 0,void 0,function(){var e;return o(this,function(r){switch(r.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return e=r.sent(),[4,this.apiClient.pushStat(i(i({},e),{hash:t,metaData:n}))];case 2:return[2,r.sent()]}})})},t.prototype.setTags=function(t){return r(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return e=n.sent(),[2,this.apiClient.setTags(i(i({},e),{tags:t}))]}})})},t.prototype.getTags=function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,this.getRequestParams()];case 1:return t=e.sent(),[2,this.apiClient.getTags(t)]}})})},t.prototype.registerUser=function(t){return r(this,void 0,void 0,function(){var e,n,r,s;return o(this,function(o){switch(o.label){case 0:return[4,this.getRequestParams()];case 1:return e=o.sent(),[4,this.data.getDeviceType()];case 2:return n=o.sent(),r=""+t,[4,this.apiClient.registerUser(i(i({},e),{userId:r,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:n}))];case 3:return s=o.sent(),[4,this.data.setUserId(""+t)];case 4:return o.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 5:return o.sent(),[2,s]}})})},t.prototype.postEvent=function(t,e){return r(this,void 0,void 0,function(){var n,r,s,a,u,c,p;return o(this,function(o){switch(o.label){case 0:return[4,this.getRequestParams()];case 1:return n=o.sent(),s=(r=new Date).getTime(),u=(a=Math.floor(s/1e3))-r.getTimezoneOffset()/60*3600,[4,this.data.getLastOpenMessage()];case 2:if((c=o.sent())&&c.expiry>Date.now()){if(e.msgHash)return[2,Promise.reject("attribute msgHash already defined")];e=i(i({},e),{msgHash:c.messageHash})}return[4,this.data.setLastOpenMessage(void 0)];case 3:return o.sent(),[4,this.apiClient.postEvent(i(i({},n),{event:t,timestampUTC:a,timestampCurrent:u,attributes:e}))];case 4:return(p=o.sent())&&p.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:p.code}),[2,p]}})})},t.prototype.getInboxMessages=function(t){return void 0===t&&(t=0),r(this,void 0,void 0,function(){var e,n,r;return o(this,function(o){switch(o.label){case 0:return[4,this.getRequestParams()];case 1:return e=o.sent(),[4,this.data.getInboxLastRequestCode()];case 2:return n=o.sent(),[4,this.data.getInboxLastRequestTime()];case 3:return r=o.sent(),[2,this.apiClient.getInboxMessages(i(i({},e),{count:t,last_code:n,last_request_time:r}))]}})})},t.prototype.inboxStatus=function(t,e){return r(this,void 0,void 0,function(){var n;return o(this,function(r){switch(r.label){case 0:return[4,this.getRequestParams()];case 1:return n=r.sent(),[2,this.apiClient.inboxStatus(i(i({},n),{inbox_code:t,status:e,time:(new Date).getTime()}))]}})})},t.prototype.triggerEvent=function(){return r(this,void 0,void 0,function(){return o(this,function(t){throw Error("Method has been deprecated, because we don't aggregate this statistics.")})})},t.prototype.pageVisit=function(t){return r(this,void 0,void 0,function(){var e,n,r;return o(this,function(o){switch(o.label){case 0:return[4,this.getRequestParams()];case 1:return e=o.sent(),[4,this.data.getFeatures()];case 2:return n=o.sent(),(r=n&&n.page_visit&&n.page_visit.entrypoint)?[2,this.apiClient.pageVisit(i(i({},e),t),r)]:[2]}})})},t.prototype.setPurchase=function(t){return r(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return e=n.sent(),[2,this.apiClient.setPurchase(i(i({},e),t))]}})})},t.prototype.getParams=function(){return r(this,void 0,void 0,function(){var t,e,n,r;return o(this,function(o){switch(o.label){case 0:return[4,this.data.getApplicationCode()];case 1:return t=o.sent(),[4,this.data.getHwid()];case 2:return e=o.sent(),[4,this.data.getTokens()];case 3:return n=o.sent(),[4,this.data.getInitParams()];case 4:return r=o.sent(),[2,i(i({applicationCode:t,hwid:e},n),r)]}})})},Object.defineProperty(t.prototype,"params",{get:function(){throw Error('Property "Pushwoosh.api.params" have been deprecated. Use the async method "Pushwoosh.api.getParams()"')},enumerable:!1,configurable:!0}),t.prototype.getRequestParams=function(){return r(this,void 0,void 0,function(){var t,e,n,i,r,s,a,u;return o(this,function(o){switch(o.label){case 0:return[4,this.data.getApplicationCode()];case 1:return t=o.sent(),[4,this.data.getHwid()];case 2:return e=o.sent(),[4,this.data.getUserId()];case 3:return n=o.sent(),[4,this.data.getDeviceType()];case 4:return i=o.sent(),[4,this.data.getDeviceModel()];case 5:return r=o.sent(),[4,this.data.getLanguage()];case 6:return s=o.sent(),[4,this.data.getSdkVersion()];case 7:return a=o.sent(),u=60*-(new Date).getTimezoneOffset(),[2,{application:t,hwid:e,userId:n||e,device_type:i,device_model:r,timezone:u,language:s,v:a}]}})})},t}();e.Api=c},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(21),r=n(22),o=n(3),s=function(){function t(t){void 0===t&&(t=new o.default),this.migrations={initial:i.default,"2018/11/26":r.default},this.dateModule=t}return Object.defineProperty(t.prototype,"initial",{get:function(){return this.migrations.initial},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dateSorted",{get:function(){var t=this;return Object.keys(this.migrations).filter(function(t){return"initial"!==t}).sort(function(t,e){var n=new o.default(new Date(t)),i=new o.default(new Date(e));return n.getTimestamp()-i.getTimestamp()}).map(function(e){return t.migrations[e]})},enumerable:!1,configurable:!0}),t}();e.default=s},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(12),r=n(6);e.default=[i.storeCreatorDecorator(r.STORE_NAME_KEY_VALUE,function(t){t.createObjectStore(r.STORE_NAME_KEY_VALUE,{keyPath:"key"})}),i.storeCreatorDecorator(r.STORE_NAME_MAIN_LOG,function(t){var e=t.createObjectStore(r.STORE_NAME_MAIN_LOG,{keyPath:r.KEY_PATH_BASE_INCREMENT,autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),i.storeCreatorDecorator(r.STORE_NAME_MESSAGE_LOG,function(t){t.createObjectStore(r.STORE_NAME_MESSAGE_LOG,{keyPath:r.KEY_PATH_BASE_INCREMENT,autoIncrement:!0}).createIndex("date","date",{unique:!1})})]},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(12),r=n(6);e.default=[i.storeCreatorDecorator(r.STORE_NAME_INBOX_MESSAGES,function(t){var e=t.createObjectStore(r.STORE_NAME_INBOX_MESSAGES,{keyPath:"inbox_id",autoIncrement:!1});e.createIndex("status","status",{unique:!1,multiEntry:!0}),e.createIndex("rt","rt",{unique:!1,multiEntry:!0})})]},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.PushServiceDefault=void 0;var o=n(7),s=n(4),a=n(0),u=function(){function t(t,e,n){this.api=t,this.data=e,this.config=n}return t.prototype.getPermission=function(){return Notification.permission},t.prototype.checkIsPermissionGranted=function(){return this.getPermission()===a.PERMISSION_GRANTED},t.prototype.checkIsPermissionDefault=function(){return this.getPermission()===a.PERMISSION_PROMPT},t.prototype.checkIsManualUnsubscribed=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.data.getStatusManualUnsubscribed()]})})},t.prototype.askPermission=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,Notification.requestPermission()];case 1:return t.sent(),[2]}})})},t.prototype.getTokens=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.data.getTokens()]})})},t.prototype.subscribe=function(t){return i(this,void 0,void 0,function(){var e,n,i,o,a,u,c,p,l,d;return r(this,function(r){switch(r.label){case 0:return e=t,this.checkIsPermissionGranted()?e?[3,6]:[4,this.trySubscribe()]:(s.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return e=r.sent(),[4,this.getSenderIdFromManifest()];case 2:return n=r.sent(),[4,this.checkIsChangeSenderId(n)];case 3:return r.sent()?[4,this.unsubscribe()]:[3,6];case 4:return r.sent(),[4,this.data.setSenderId(n)];case 5:r.sent(),r.label=6;case 6:return[4,this.getApplicationServerKey()];case 7:return i=r.sent(),[4,this.data.getSenderId()];case 8:return o=r.sent(),[4,this.getPushToken(e)];case 9:if(a=r.sent(),u=e.getKey("p256dh"),c=e.getKey("auth"),!u||!c)throw Error("Can't get subscription keys!");return p=btoa(String.fromCharCode.apply(String,new Uint8Array(u))),l=btoa(String.fromCharCode.apply(String,new Uint8Array(c))),[4,this.getFcmKeys({endpoint:e.endpoint,application_pub_key:i,encryption_key:p,encryption_auth:l,authorized_entity:o})];case 10:return d=r.sent(),[4,this.data.setTokens({publicKey:p,pushToken:a,authToken:l,fcmPushSet:d.pushSet,fcmToken:d.token,endpoint:e.endpoint})];case 11:return r.sent(),[4,this.api.registerDevice()];case 12:return r.sent(),[2]}})})},t.prototype.unsubscribe=function(){return i(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,e.sent().pushManager.getSubscription()];case 2:return t=e.sent(),[4,this.data.setTokens({})];case 3:return e.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 4:return e.sent(),[4,this.api.unregisterDevice()];case 5:return e.sent(),t?[4,t.unsubscribe()]:[2];case 6:return e.sent(),[2]}})})},t.prototype.checkIsRegister=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},t.prototype.checkIsNeedResubscribe=function(){return i(this,void 0,void 0,function(){var t,e,n,i,o,s,a,u,c;return r(this,function(r){switch(r.label){case 0:return[4,this.data.getSenderId()];case 1:return t=r.sent(),e=void 0!==t,[4,this.getSenderIdFromManifest()];case 2:return n=r.sent(),i=e&&n!==t,[4,this.data.setSenderId(n)];case 3:return r.sent(),[4,this.data.getLastPermissionStatus()];case 4:return o=r.sent(),s=this.getPermission(),e&&o!==s?[4,this.data.setLastPermissionStatus(s)]:[3,6];case 5:return r.sent(),[2,!0];case 6:return[4,this.getCredentials()];case 7:return a=r.sent(),[4,this.getPushToken(a)];case 8:return u=r.sent(),[4,this.data.getTokens()];case 9:return c=r.sent(),[2,i||!(u===(c&&c.pushToken||""))]}})})},t.prototype.getServiceWorkerRegistration=function(){return i(this,void 0,void 0,function(){var t,e;return r(this,function(n){switch(n.label){case 0:return this.registration?[3,5]:[4,this.registerServiceWorker()];case 1:return n.sent(),[4,this.data.getServiceWorkerUrl()];case 2:return t=n.sent(),e=this,[4,navigator.serviceWorker.getRegistration(t)];case 3:return e.registration=n.sent(),[4,this.registration.update()];case 4:n.sent(),n.label=5;case 5:if(!this.registration)throw Error("Internal Error: Can't register service worker!");return[2,this.registration]}})})},t.prototype.registerServiceWorker=function(){return i(this,void 0,void 0,function(){var t,e,n,i,s;return r(this,function(r){switch(r.label){case 0:return[4,this.data.getServiceWorkerUrl()];case 1:return t=r.sent(),[4,this.data.getServiceWorkerScope()];case 2:return e=r.sent(),[4,this.data.getSdkVersion()];case 3:return n=r.sent(),[4,this.data.getServiceWorkerVersion()];case 4:return i=r.sent(),s="",n!==i&&(s="?cache_clean="+o.v4()),[4,navigator.serviceWorker.register(""+t+s,{scope:e})];case 5:return r.sent(),[2]}})})},t.prototype.trySubscribe=function(){return i(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,4]),[4,this.subscribePushManager()];case 1:return[2,e.sent()];case 2:return t=e.sent(),console.error(t),[4,this.unsubscribe()];case 3:return e.sent(),[2,this.subscribePushManager()];case 4:return[2]}})})},t.prototype.subscribePushManager=function(){return i(this,void 0,void 0,function(){var t,e;return r(this,function(n){switch(n.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return t=n.sent(),[4,this.getApplicationServerKey()];case 2:return e=n.sent(),[2,t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e?this.urlBase64ToUint8Array(e):null})]}})})},t.prototype.getCredentials=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,t.sent().pushManager.getSubscription()];case 2:return[2,t.sent()]}})})},t.prototype.getFcmKeys=function(t){return i(this,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:return[4,fetch(this.config.entrypoint||"https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(t)})];case 1:return 200!==(e=n.sent()).status?[3,3]:[4,e.json()];case 2:return[2,n.sent()];case 3:throw Error("Internal error: Can't register device in fcm. Status: "+e.status+". Message: "+e.statusText)}})})},t.prototype.getPushToken=function(t){return i(this,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:return[4,this.data.getDeviceType()];case 1:return e=n.sent(),t?12===e?[2,t.endpoint]:[2,t.endpoint.split("/").pop()||""]:[2,""]}})})},t.prototype.getApplicationServerKey=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.data.getDeviceType()];case 1:return 11!==t.sent()?[2]:[4,this.data.getApplicationServerKey()];case 2:return[2,t.sent()]}})})},t.prototype.getSenderIdFromManifest=function(){return i(this,void 0,void 0,function(){var t,e,n,i,o;return r(this,function(r){switch(r.label){case 0:if(!(t=document.querySelector('link[rel="manifest"]')))throw Error("Error: manifest.json not found!");if(!(e=t.getAttribute("href")))throw Error("Error: manifest.json url not found!");return[4,fetch(e,{method:"GET",headers:{"Content-Type":"application/json;charset=UTF-8"}})];case 1:if(200!==(n=r.sent()).status)throw Error("Error: Can't load manifest.json! "+n.statusText);return[4,n.text()];case 2:if(i=r.sent(),!(o=i.match(/("|')?gcm_sender_id("|')?:\s*("|')?(\d+)("|')?/))||"string"!=typeof o[4])throw Error("Error: Can't find gcm_sender_id in manifest.json!");return[2,o[4]]}})})},t.prototype.checkIsChangeSenderId=function(t){return i(this,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:return[4,this.data.getSenderId()];case 1:return e=n.sent(),[2,t!==e]}})})},t.prototype.urlBase64ToUint8Array=function(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(e),i=new Uint8Array(n.length),r=0;n.length>r;++r)i[r]=n.charCodeAt(r);return i},t}();e.PushServiceDefault=u},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(25),s=n(3),a=n(13),u=function(){function t(t,e,n,i,r){void 0===i&&(i=new o.default),void 0===r&&(r=new s.default),this.eventBus=t,this.data=e,this.api=n,this.storage=i,this.storeName="inboxMessages",this.dateModule=r}return t.prototype.getInboxMessages=function(){return i(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,this.api.getInboxMessages()];case 1:return t=e.sent(),[4,this.storeGetInboxMessagesRequestParams(t.next,t.new_inbox)];case 2:return e.sent(),[2,t]}})})},t.prototype.storeGetInboxMessagesRequestParams=function(t,e){return i(this,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return this.dateModule.date=new Date,[4,this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp())];case 1:return n.sent(),[4,this.data.setInboxLastRequestCode(t)];case 2:return n.sent(),[4,this.data.setInboxNewMessagesCount(e)];case 3:return n.sent(),[2]}})})},t.prototype.putServerMessages=function(t){return i(this,void 0,void 0,function(){var e,n=this;return r(this,function(o){return e=t.map(function(t){return i(n,void 0,void 0,function(){var e;return r(this,function(n){switch(n.label){case 0:return[4,this.storage.get(this.storeName,t.inbox_id,{})];case 1:return"status"in(e=n.sent())&&(t.status=e.status),[2,this.putMessage(t)]}})})}),[2,Promise.all(e)]})})},t.prototype.putMessage=function(t){return this.storage.put(this.storeName,t)},t.prototype.putBulkMessages=function(t){var e=this,n=t.map(function(t){return e.putMessage(t)});return Promise.all(n)},t.prototype.deleteMessages=function(t){var e=this,n=t.map(function(t){return e.storage.delete(e.storeName,t)});return Promise.all(n)},t.prototype.deleteExpiredMessages=function(){return i(this,void 0,void 0,function(){var t,e,n;return r(this,function(i){switch(i.label){case 0:return this.dateModule.date=new Date,t=""+this.dateModule.getTimestamp(),[4,this.storage.getAll(this.storeName)];case 1:return e=i.sent(),n=e.filter(function(e){return t>e.rt}).map(function(t){return t.inbox_id}),[2,this.deleteMessages(n)]}})})},t.prototype.getMessage=function(t){return this.storage.get(this.storeName,t)},t.prototype.getReadOpenMessages=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,t.sent().filter(function(t){return 2===t.status||3===t.status})]}})})},t.prototype.getDeliveredMessages=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,t.sent().filter(function(t){return 1===t.status})]}})})},t.prototype.messagesCount=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.storage.count(this.storeName)]})})},t.prototype.getDeliveredMessagesCount=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.storage.countByIndex(this.storeName,"status",1)]})})},t.prototype.getReadMessagesCount=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.storage.countByIndex(this.storeName,"status",2)]})})},t.prototype.getDeliveredReadMessagesCount=function(){return i(this,void 0,void 0,function(){var t,e;return r(this,function(n){return t=[2,3],e=IDBKeyRange.bound(t[0],t[1]),[2,this.storage.countByIndex(this.storeName,"status",e)]})})},t.prototype.updateMessages=function(){return i(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return[4,this.getInboxMessages()];case 1:return t=e.sent(),[4,this.deleteExpiredMessages()];case 2:return e.sent(),t.deleted?[4,this.deleteMessages(t.deleted)]:[3,4];case 3:e.sent(),e.label=4;case 4:return[4,this.putServerMessages(t.messages)];case 5:return e.sent(),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new a.default(this.data,this.api,this)}),[2]}})})},t}();e.default=u},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var o=n(10),s=n(11),a=n(26),u=function(){function t(){}return t.prototype.dbVersionChangeHandler=function(t,e){console.info("onversionchange",e),t.close()},t.prototype.dbRequestSuccessHandler=function(t,e){var n=this,i=e.target.result;i.onversionchange=function(t){n.dbVersionChangeHandler(i,t)},t(i)},t.prototype.dbRequestUpgradeNeededHandler=function(t){var e=this,n=t.target.result;n.onversionchange=function(t){e.dbVersionChangeHandler(n,t)},new s.default(n).applyMigrations()},t.prototype.getDB=function(){var t=this;return new Promise(function(e,n){var i=indexedDB.open("PUSHWOOSH_SDK_STORE",o.default);i.onsuccess=function(n){t.dbRequestSuccessHandler(e,n)},i.onupgradeneeded=function(e){t.dbRequestUpgradeNeededHandler(e)},i.onerror=function(){return n(i.error)}})},t.prototype.put=function(t,e,n){return i(this,void 0,void 0,function(){var i,o;return r(this,function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return i=r.sent(),[4,new a.default(i,t).put(e,n)];case 2:return o=r.sent(),i.close(),[2,o]}})})},t.prototype.delete=function(t,e){return i(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return n=r.sent(),[4,new a.default(n,t).delete(e)];case 2:return i=r.sent(),n.close(),[2,i]}})})},t.prototype.get=function(t,e,n){return i(this,void 0,void 0,function(){var i,o;return r(this,function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return i=r.sent(),[4,new a.default(i,t).get(e,n)];case 2:return o=r.sent(),i.close(),[2,o]}})})},t.prototype.getAll=function(t){return i(this,void 0,void 0,function(){var e,n;return r(this,function(i){switch(i.label){case 0:return[4,this.getDB()];case 1:return e=i.sent(),[4,new a.default(e,t).getAll()];case 2:return n=i.sent(),e.close(),[2,n||[]]}})})},t.prototype.count=function(t,e){return i(this,void 0,void 0,function(){var n,i;return r(this,function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return n=r.sent(),[4,new a.default(n,t).count(e)];case 2:return i=r.sent(),n.close(),[2,i]}})})},t.prototype.countByIndex=function(t,e,n){return i(this,void 0,void 0,function(){var i,o,s;return r(this,function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return i=r.sent(),(o=new a.default(i,t)).index=e,[4,o.countByIndex(n)];case 2:return s=r.sent(),i.close(),[2,s]}})})},t}();e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){this.name=e,this.store=t.transaction(this.name,"readwrite").objectStore(this.name)}return Object.defineProperty(t.prototype,"index",{set:function(t){this.store.indexNames.contains(t)?this._index=this.store.index(t):console.warn('Index "'+t+'" in ')},enumerable:!1,configurable:!0}),t.prototype.writeRequestPromise=function(t,e){return new Promise(function(n,i){t.onsuccess=function(){n(e)},t.onerror=function(){i(t.error)}})},t.prototype.readRequestPromise=function(t,e){return new Promise(function(n,i){t.onsuccess=function(t){n(t.target.result||e)},t.onerror=function(){i(t.error)}})},t.prototype.put=function(t,e){var n=this.store.put(t,e);return this.writeRequestPromise(n,e)},t.prototype.add=function(t,e){return this.put(t,e)},t.prototype.delete=function(t){var e=this.store.delete(t);return this.writeRequestPromise(e)},t.prototype.get=function(t,e){var n=this.store.get(t);return this.readRequestPromise(n,e)},t.prototype.getAll=function(){var t=this.store.openCursor(),e=[];return new Promise(function(n,i){t.onsuccess=function(t){var i=t.target.result;i?(e.push(i.value),i.continue()):n(e)},t.onerror=function(){i(t.error)}})},t.prototype.count=function(t){var e=this.store.count(t);return this.readRequestPromise(e,0)},t.prototype.countByIndex=function(t){var e=this._index.count(t);return this.readRequestPromise(e,0)},t}();e.default=i},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE=void 0,e.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE="pushwoosh-subscription-widget"},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(29),r=n(29);Object.defineProperty(e,"PlatformChecker",{enumerable:!0,get:function(){return r.PlatformChecker}}),e.default=i.platformChecker},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.platformChecker=e.PlatformChecker=void 0;var i=n(5),r=function(){function t(t){this.global=t,this._isSafari=this.isSafariBrowser(),this._isOpera=this.isOperaBrowser(),this._isEdge=this.isEdgeBrowser(),this._isFirefox=this.isFirefoxBrowser(),this._isChrome=this.isChromeBrowser(),this._isMacOS=this.isMacOS(),this._isAvailablePromise=this.canUsePromise(),this._isAvailableServiceWorker=this.canUseServiceWorkers(),this._isAvailableNotifications=this.canReceiveNotifications(),this._platform=this.getPlatformType(),this._browserVersion=this.getBrowserVersion()}return Object.defineProperty(t.prototype,"isEdge",{get:function(){return this._isEdge},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSafari",{get:function(){return this._isSafari},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isOpera",{get:function(){return this._isOpera},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAvailablePromise",{get:function(){return this._isAvailablePromise},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAvailableServiceWorker",{get:function(){return this._isAvailableServiceWorker},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAvailableNotifications",{get:function(){return this._isAvailableNotifications},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"platform",{get:function(){return this._platform},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"browserVersion",{get:function(){return this._browserVersion},enumerable:!1,configurable:!0}),t.prototype.isSafariBrowser=function(){return"safari"in this.global&&navigator.userAgent.indexOf("Safari")>-1},t.prototype.isOperaBrowser=function(){return-1!==navigator.userAgent.indexOf("Opera")||-1!==navigator.userAgent.indexOf("OPR")},t.prototype.isEdgeBrowser=function(){return navigator.userAgent.indexOf("Edge")>-1},t.prototype.isFirefoxBrowser=function(){return-1!==navigator.userAgent.toLowerCase().indexOf("firefox")},t.prototype.isChromeBrowser=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)&&!this._isOpera&&!this._isEdge},t.prototype.isMacOS=function(){return"platform"in navigator&&-1!==navigator.platform.toLowerCase().indexOf("mac")},t.prototype.canUseServiceWorkers=function(){return!!navigator.serviceWorker&&"PushManager"in this.global&&"Notification"in this.global},t.prototype.canUsePromise=function(){return"Promise"in this.global},t.prototype.canReceiveNotifications=function(){return this._isSafari&&this._isMacOS||this._isAvailableServiceWorker&&!this._isEdge},t.prototype.getPlatformType=function(){var t=11;switch(!0){case this._isSafari:t=10;break;case this._isOpera||this._isChrome:t=11;break;case this._isFirefox:t=12;break;case this._isEdge:t=150}return t},t.prototype.getBrowserVersion=function(){var t=navigator.userAgent,e=t.match(/\bOPR\/(\d+)/);if(null!==e)return"Opera "+e[1];var n=t.match(/\bEdge\/(\d+)/);if(null!==n)return"Edge "+n[1];var i=t.match(/\bEdg\/(\d+)/);if(null!==i)return"Edge "+i[1];var r=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],o=r[1],s=void 0===o?"":o;if(/trident/i.test(t)){var a=/trident\/([.\d]+)/gi.exec(t)||[];return"IE "+(("7.0"===a[1]?"11":a[1])||"")}r=r[2]?[s,r[2]]:[navigator.appName,navigator.appVersion,"-?"];var u=t.match(/version\/([.\d]+)/i);return null!==u&&r.splice(1,1,u[1]),r.join(" ")},t}();e.PlatformChecker=r,e.platformChecker=new r(i.getGlobal())},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SUBSCRIBE_WIDGET_DEFAULT_CONFIG=e.WIDGET_CONTAINER_ID=e.BELL_POSITION_TOP_LEFT=e.BELL_POSITION_TOP_RIGHT=e.BELL_POSITION_BOTTOM_LEFT=e.BELL_POSITION_BOTTOM_RIGHT=void 0,e.BELL_POSITION_BOTTOM_RIGHT="bottomRight",e.BELL_POSITION_BOTTOM_LEFT="bottomLeft",e.BELL_POSITION_TOP_RIGHT="topRight",e.BELL_POSITION_TOP_LEFT="topLeft",e.WIDGET_CONTAINER_ID="pushwooshBellWidget",e.SUBSCRIBE_WIDGET_DEFAULT_CONFIG={position:e.BELL_POSITION_BOTTOM_LEFT,bgColor:"#12AE7E",bellColor:"white",bellStrokeColor:"#08754f",bellButtonBorder:"1px solid #379676",shadow:"0px 0px 6px rgba(0, 0, 0, 0.75)",size:"48px",indent:"20px",zIndex:"999999",tooltipText:{successSubscribe:"You are successfully subscribed!",needSubscribe:"Get notifications about important news!",blockSubscribe:"Click to see how to get notifications",alreadySubscribed:"You are already subscribed"}}},function(t,e,n){"use strict";var i=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;n>e;e++)t+=arguments[e].length;var i=Array(t),r=0;for(e=0;n>e;e++)for(var o=arguments[e],s=0,a=o.length;a>s;s++,r++)i[r]=o[s];return i};Object.defineProperty(e,"__esModule",{value:!0});var r=n(32),o=n(5);function s(){var t=o.getGlobal(),e=new r.default,n=Array.isArray(t.Pushwoosh)?i(t.Pushwoosh):[];t.Pushwoosh=e,n.forEach(function(t){return e.push(t)})}n(37),n(43),n(45),"complete"===document.readyState?s():window.addEventListener("load",s)},function(t,e,n){"use strict";var i=this&&this.__assign||function(){return(i=Object.assign||function(t){for(var e,n=1,i=arguments.length;i>n;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},r=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},o=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0});var s=n(7),a=n(17),u=n(19),c=n(1),p=n(14),l=n(33),d=n(35),h=n(0),f=n(5),b=n(28),g=n(4),v=n(2),w=n(24),m=n(13),_=function(){function t(){var t=this;this.ready=!1,this.addEventHandler=function(e,n){return t.eventBus.addEventHandler(e,n)},this.removeEventHandler=function(e,n){return t.eventBus.removeEventHandler(e,n)},this.dispatchEvent=function(e,n){return t.eventBus.dispatchEvent(e,n)},this.debug={showLog:function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,v.log.getAll()];case 1:return t=e.sent(),console.log(t),[2]}})})},showKeyValues:function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,v.keyValue.getAll()];case 1:return t=e.sent(),console.log(t),[2]}})})},showMessages:function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,v.message.getAll()];case 1:return t.sent().forEach(function(t){return console.log(t)}),[2]}})})}},this.eventBus=new a.EventBus,this.data=new c.Data,this.apiClient=new p.ApiClient(this.data),this.api=new u.Api(this.eventBus,this.data,this.apiClient),this.platformChecker=new b.PlatformChecker(f.getGlobal()),this.inboxModel=new w.default(this.eventBus,this.data,this.api),this.pwinbox=new m.default(this.data,this.api,this.inboxModel),this.onServiceWorkerMessage=this.onServiceWorkerMessage.bind(this),this.subscriptionPromptWidget=new d.SubscriptionPromptWidget(this.eventBus,this)}return t.prototype.push=function(t){if("function"!=typeof t){if(!Array.isArray(t))throw Error("Invalid command!");switch(t[0]){case"init":this.initialize(t[1]);break;case h.EVENT_ON_LOAD:case h.EVENT_ON_READY:case h.EVENT_ON_REGISTER:case h.EVENT_ON_SUBSCRIBE:case h.EVENT_ON_UNSUBSCRIBE:case h.EVENT_ON_SW_INIT_ERROR:case h.EVENT_ON_PUSH_DELIVERY:case h.EVENT_ON_NOTIFICATION_CLICK:case h.EVENT_ON_NOTIFICATION_CLOSE:case h.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:case h.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:case h.EVENT_ON_UPDATE_INBOX_MESSAGES:case h.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:case h.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:case h.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:case h.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:case h.EVENT_ON_PERMISSION_DENIED:case h.EVENT_ON_PERMISSION_PROMPT:case h.EVENT_ON_PERMISSION_GRANTED:this.subscribeToLegacyEvents(t[0],t[1]);break;default:throw Error("Unknown command!")}}else this.subscribeToLegacyEvents("onReady",t)},t.prototype.subscribe=function(t){return void 0===t&&(t=!0),r(this,void 0,void 0,function(){var e,n,i,r;return o(this,function(o){switch(o.label){case 0:return this.isCommunicationDisabled&&g.Logger.error("Communication is disabled!"),this.driver.checkIsPermissionDefault()?(this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),[4,this.driver.askPermission()]):[3,2];case 1:o.sent(),e=this.driver.getPermission(),this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:e}),o.label=2;case 2:return n=this.driver.getPermission(),[4,this.data.getStatusManualUnsubscribed()];case 3:return i=o.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 4:return r=o.sent(),n!==h.PERMISSION_GRANTED?[3,7]:(this.eventBus.dispatchEvent("permission-granted",{}),!(t||!i)||r?[3,6]:[4,this.driver.subscribe()]);case 5:o.sent(),o.label=6;case 6:return this.eventBus.dispatchEvent("subscribe",{}),[2];case 7:return n!==h.PERMISSION_DENIED?[3,10]:(this.eventBus.dispatchEvent("permission-denied",{}),r?[4,this.driver.unsubscribe()]:[3,9]);case 8:o.sent(),o.label=9;case 9:case 10:return[2]}})})},t.prototype.unsubscribe=function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.driver.unsubscribe()];case 1:return e.sent(),[3,3];case 2:return t=e.sent(),g.Logger.error(t,"Error occurred during the unsubscribe"),[3,3];case 3:return[2]}})})},t.prototype.forceSubscribe=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.subscribe(!0)];case 1:return t.sent(),[2]}})})},t.prototype.isDeviceRegistered=function(){return localStorage.getItem(h.KEY_DEVICE_REGISTRATION_STATUS)===h.DEVICE_REGISTRATION_STATUS_REGISTERED},t.prototype.isDeviceUnregistered=function(){return localStorage.getItem(h.KEY_DEVICE_REGISTRATION_STATUS)===h.DEVICE_REGISTRATION_STATUS_UNREGISTERED},t.prototype.isSubscribed=function(){return r(this,void 0,void 0,function(){return o(this,function(t){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},t.prototype.isCommunicationEnabled=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:return[2,!t.sent()]}})})},t.prototype.setCommunicationEnabled=function(t){return void 0===t&&(t=!0),r(this,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return[4,this.data.getDeviceType()];case 1:return e=i.sent(),n=this.driver.checkIsPermissionGranted(),[4,this.data.setStatusCommunicationDisabled(!t)];case 2:return i.sent(),t?[4,this.data.setStatusDropAllData(!1)]:[3,6];case 3:return i.sent(),n?[4,this.api.registerDevice()]:[3,5];case 4:i.sent(),i.label=5;case 5:return[3,8];case 6:return[4,this.api.unregisterDevice()];case 7:i.sent(),i.label=8;case 8:return this.eventBus.dispatchEvent("change-enabled-communication",{isEnabled:t}),[4,this.api.postEvent(h.EVENT_GDPR_CONSENT,{channel:t,device_type:e})];case 9:return i.sent(),[2]}})})},t.prototype.removeAllDeviceData=function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return[4,this.data.getDeviceType()];case 1:return t=e.sent(),[4,this.api.postEvent(h.EVENT_GDPR_DELETE,{status:!0,device_type:t})];case 2:return e.sent(),[4,this.api.deleteDevice()];case 3:return e.sent(),[4,this.data.clearAll()];case 4:return e.sent(),[4,this.data.setStatusDropAllData(!0)];case 5:return e.sent(),[2]}})})},t.prototype.getHWID=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.data.getHwid()];case 1:return[2,t.sent()]}})})},t.prototype.getPushToken=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.data.getTokens()];case 1:return[2,t.sent().pushToken]}})})},t.prototype.getUserId=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.data.getUserId()];case 1:return[2,t.sent()]}})})},t.prototype.getParams=function(){return r(this,void 0,void 0,function(){return o(this,function(t){switch(t.label){case 0:return[4,this.api.getParams()];case 1:return[2,t.sent()]}})})},t.prototype.isAvailableNotifications=function(){return this.platformChecker.isAvailableNotifications},t.prototype.sendStatisticsVisitedPage=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return t=window.document.title,e=window.location,[4,this.api.pageVisit({title:t,url_path:""+e.origin+e.pathname,url:e.href})];case 1:return n.sent(),[2]}})})},t.prototype.initialize=function(t){return r(this,void 0,void 0,function(){var e,n,r,a,u,c,p,l,d,b;return o(this,function(o){switch(o.label){case 0:return e=localStorage.getItem(h.MANUAL_SET_LOGGER_LEVEL),g.Logger.setLevel(e||t.logLevel||"error"),this.platformChecker.isAvailableNotifications?[4,this.data.getApplicationCode()]:[2];case 1:if(n=o.sent(),!t.applicationCode)throw Error("Can't find application code!");return!n||n&&n!==t.applicationCode?[4,this.data.clearAll()]:[3,4];case 2:return o.sent(),[4,this.data.setApplicationCode(t.applicationCode)];case 3:o.sent(),o.label=4;case 4:return[4,this.data.getHwid()];case 5:return o.sent()?[3,7]:(r=t.applicationCode+"_"+s.v4(),[4,this.data.setHwid(r)]);case 6:o.sent(),o.label=7;case 7:return[4,this.data.setDeviceType(this.platformChecker.getPlatformType())];case 8:return o.sent(),[4,this.data.setDeviceModel(this.platformChecker.getBrowserVersion())];case 9:return o.sent(),[4,this.data.setLanguage(t.tags&&t.tags.Language||navigator.language)];case 10:return o.sent(),t.pushwooshUrl?[4,this.data.setApiEntrypoint(t.pushwooshUrl)]:[3,12];case 11:o.sent(),o.label=12;case 12:return[4,this.data.setSdkVersion("3.35.2")];case 13:return o.sent(),[4,this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt"])];case 14:return a=o.sent(),this.onGetConfig(a&&a.features),this.subscribeWidgetConfig=i({enable:!1},t.subscribeWidget),this.inboxWidgetConfig=i({enable:!1},t.inboxWidget),this.subscribePopupConfig=i({enable:!1},t.subscribePopup),u=this,[4,this.data.getStatusCommunicationDisabled()];case 15:return u.isCommunicationDisabled=o.sent(),[4,this.open()];case 16:return o.sent(),[4,this.data.getStatusUserIdWasChanged()];case 17:return c=o.sent(),!t.userId||"user_id"===t.userId||c?[3,19]:[4,this.api.registerUser(t.userId)];case 18:o.sent(),o.label=19;case 19:return t.tags&&this.api.setTags(t.tags),this.platformChecker.isAvailableNotifications?[4,this.initPushNotifications(t)]:[3,21];case 20:o.sent(),o.label=21;case 21:return o.trys.push([21,23,,24]),[4,this.inboxModel.updateMessages()];case 22:return o.sent(),[3,24];case 23:return p=o.sent(),g.Logger.write("error",p),[3,24];case 24:return this.ready=!0,this.eventBus.dispatchEvent("ready",{}),[4,this.data.getDelayedEvent()];case 25:return(l=o.sent())?[4,this.emitLegacyEventsFromServiceWorker(l.type,l.payload)]:[3,28];case 26:return o.sent(),[4,this.data.setDelayedEvent(null)];case 27:o.sent(),o.label=28;case 28:return"serviceWorker"in navigator&&(navigator.serviceWorker.onmessage=this.onServiceWorkerMessage),localStorage.setItem("pushwoosh-websdk-status","init"),document.dispatchEvent(new CustomEvent("pushwoosh.initialized",{detail:{pw:this}})),this.platformChecker.isSafari&&(d=/#P(.*)/,b=decodeURIComponent(document.location.hash),d.test(b)&&this.api.pushStat(d.exec(b)[1]).then(f.clearLocationHash)),[2]}})})},t.prototype.defaultProcess=function(t){return r(this,void 0,void 0,function(){var e,n,i,r,s,a,u,c,p,l;return o(this,function(o){switch(o.label){case 0:return"granted"!==(e=this.driver.getPermission())?[3,2]:[4,this.data.setLastPermissionStatus(e)];case 1:o.sent(),o.label=2;case 2:return[4,this.data.getStatusCommunicationDisabled()];case 3:return n=o.sent(),[4,this.data.getStatusDropAllData()];case 4:return i=o.sent(),[4,this.driver.checkIsNeedResubscribe()];case 5:return r=o.sent(),[4,this.data.getFeatures()];case 6:return s=o.sent(),a=s.subscription_prompt&&s.subscription_prompt.use_case,n||i?[4,this.unsubscribe()]:[3,8];case 7:return o.sent(),[2];case 8:return r?[4,this.unsubscribe()]:[3,11];case 9:return o.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 10:o.sent(),o.label=11;case 11:return u=t.autoSubscribe,[4,this.data.getStatusManualUnsubscribed()];case 12:return c=o.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 13:switch(p=o.sent(),e){case h.PERMISSION_PROMPT:return[3,14];case h.PERMISSION_DENIED:return[3,20];case h.PERMISSION_GRANTED:return[3,23]}return[3,28];case 14:return this.eventBus.dispatchEvent("permission-default",{}),p?[4,this.unsubscribe()]:[3,16];case 15:o.sent(),o.label=16;case 16:return[4,this.getWidgetConfig()];case 17:return l=o.sent(),[4,this.checkCanShowByCapping(l)];case 18:return o.sent()?((a===h.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT||a===h.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET&&u)&&(this.subscriptionPromptWidget.init(l),this.subscriptionPromptWidget.show()),[4,this.updateCappingParams()]):[3,28];case 19:return o.sent(),[3,28];case 20:return this.eventBus.dispatchEvent("permission-denied",{}),p?[4,this.unsubscribe()]:[3,22];case 21:o.sent(),o.label=22;case 22:return[3,28];case 23:return this.eventBus.dispatchEvent("permission-granted",{}),c&&p?[4,this.unsubscribe()]:[3,25];case 24:o.sent(),o.label=25;case 25:return!p&&!c||r?[4,this.subscribe(!0)]:[3,27];case 26:o.sent(),o.label=27;case 27:return[3,28];case 28:return[2]}})})},t.prototype.getWidgetConfig=function(){return r(this,void 0,void 0,function(){var t,e,n;return o(this,function(r){switch(r.label){case 0:return[4,this.data.getFeatures()];case 1:return t=r.sent(),n=i({cappingCount:h.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingCount,cappingDelay:h.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingDelay},e=t.subscription_prompt_widget&&t.subscription_prompt_widget.params),[2,e?n:h.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG]}})})},t.prototype.checkCanShowByCapping=function(t){return r(this,void 0,void 0,function(){var e,n,i;return o(this,function(r){switch(r.label){case 0:return e=(new Date).getTime(),[4,this.data.getPromptDisplayCount()];case 1:return n=r.sent(),[4,this.data.getPromptLastSeenTime()];case 2:return i=r.sent(),[2,t.cappingCount>n&&e-i>t.cappingDelay]}})})},t.prototype.updateCappingParams=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){switch(n.label){case 0:return[4,this.data.getPromptDisplayCount()];case 1:return t=n.sent(),e=(new Date).getTime(),[4,this.data.setPromptDisplayCount(t+1)];case 2:return n.sent(),[4,this.data.setPromptLastSeenTime(e)];case 3:return n.sent(),[2]}})})},t.prototype.onServiceWorkerMessage=function(t){var e=(t||{}).data,n=(void 0===e?{}:e)||{},i=n.type,r=n.payload;this.emitLegacyEventsFromServiceWorker(void 0===i?"":i,void 0===r?{}:r)},t.prototype.open=function(t){return r(this,void 0,void 0,function(){var e,n;return o(this,function(i){switch(i.label){case 0:return[4,this.data.getLastOpenApplicationTime()];case 1:return e=i.sent(),n=Date.now(),e||(e=0),t||!(h.PERIOD_SEND_APP_OPEN>n-e)?[4,this.data.setLastOpenApplicationTime(n)]:[2];case 2:return i.sent(),[4,this.api.applicationOpen()];case 3:return i.sent(),[2]}})})},t.prototype.onGetConfig=function(t){return r(this,void 0,void 0,function(){return o(this,function(e){switch(e.label){case 0:return[4,this.data.setFeatures(t)];case 1:return e.sent(),t?t.page_visit&&t.page_visit.enabled?[4,v.keyValue.set(h.PAGE_VISITED_URL,t.page_visit.entrypoint)]:[3,3]:[3,5];case 2:e.sent(),this.sendStatisticsVisitedPage(),e.label=3;case 3:return t.events&&t.events.length&&t.events.some(function(t){return t===h.EVENT_PW_SITE_OPENED})&&this.sendPostEventVisitedPage(),t.vapid_key?[4,this.data.setApplicationServerKey(t.vapid_key)]:[3,5];case 4:e.sent(),e.label=5;case 5:return[2]}})})},t.prototype.initPushNotifications=function(t){return r(this,void 0,void 0,function(){var e;return o(this,function(n){switch(n.label){case 0:return[4,this.data.setDefaultNotificationImage(t.defaultNotificationImage)];case 1:return n.sent(),[4,this.data.setDefaultNotificationTitle(t.defaultNotificationTitle)];case 2:return n.sent(),[4,this.data.setServiceWorkerUrl(t.serviceWorkerUrl)];case 3:return n.sent(),[4,this.data.setServiceWorkerScope(t.scope)];case 4:return n.sent(),[4,this.data.setInitParams(i({autoSubscribe:!0},t))];case 5:return n.sent(),[4,this.initDriver()];case 6:n.sent(),n.label=7;case 7:return n.trys.push([7,9,,10]),[4,this.defaultProcess(t)];case 8:return n.sent(),[3,10];case 9:return e=n.sent(),g.Logger.error(e,"Internal error: defaultProcess fail"),[3,10];case 10:return[2]}})})},t.prototype.initDriver=function(){return r(this,void 0,void 0,function(){var t;return o(this,function(e){switch(e.label){case 0:return this.platformChecker.isSafari?[4,this.data.getInitParams()]:[3,2];case 1:if(!(t=e.sent().safariWebsitePushID))throw Error("For work with Safari Push Notification add safariWebsitePushID to initParams!");return this.driver=new l.PushServiceSafari(this.api,this.data,{webSitePushId:t}),[2];case 2:return this.platformChecker.isAvailableServiceWorker?(this.driver=new l.PushServiceDefault(this.api,this.data,{}),[2]):[2]}})})},t.prototype.sendPostEventVisitedPage=function(){return r(this,void 0,void 0,function(){var t,e;return o(this,function(n){return t=window.document.title,e=window.location.href,this.api.postEvent(h.EVENT_PW_SITE_OPENED,{url:e,title:t,device_type:this.platformChecker.platform}),[2]})})},t.prototype.subscribeToLegacyEvents=function(t,e){var n=this;switch(t){case h.EVENT_ON_LOAD:e();break;case h.EVENT_ON_READY:if(this.ready){e(this.api);break}this.eventBus.addEventHandler("ready",function(){return e(n.api)});break;case h.EVENT_ON_REGISTER:this.eventBus.addEventHandler("register",function(){return e(n.api)});break;case h.EVENT_ON_SUBSCRIBE:this.eventBus.addEventHandler("subscribe",function(){return e(n.api)});break;case h.EVENT_ON_UNSUBSCRIBE:this.eventBus.addEventHandler("unsubscribe",function(){return e(n.api)});break;case h.EVENT_ON_SW_INIT_ERROR:this.eventBus.addEventHandler("initialize-service-worker-error",function(t){return e(n.api,t.error)});break;case h.EVENT_ON_PUSH_DELIVERY:this.eventBus.addEventHandler("receive-push",function(t){return e(n.api,t.notification)});break;case h.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.addEventHandler("open-notification",function(t){return e(n.api,t.notification)});break;case h.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.addEventHandler("hide-notification",function(t){return e(n.api,t.notification)});break;case h.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:this.eventBus.addEventHandler("change-enabled-communication",function(t){return e(n.api,t.isEnabled)});break;case h.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.addEventHandler("receive-inbox-message",function(t){return e(n.api,t.message)});break;case h.EVENT_ON_UPDATE_INBOX_MESSAGES:this.eventBus.addEventHandler("update-inbox-messages",function(t){return e(n.api,t.messages)});break;case h.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("show-notification-permission-dialog",function(){return e(n.api)});break;case h.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("hide-notification-permission-dialog",function(t){return e(n.api,t.permission)});break;case h.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("show-subscription-widget",function(){return e(n.api)});break;case h.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("hide-subscription-widget",function(){return e(n.api)});break;case h.EVENT_ON_PERMISSION_DENIED:this.eventBus.addEventHandler("permission-denied",function(){return e(n.api)});break;case h.EVENT_ON_PERMISSION_PROMPT:this.eventBus.addEventHandler("permission-default",function(){return e(n.api)});break;case h.EVENT_ON_PERMISSION_GRANTED:this.eventBus.addEventHandler("permission-granted",function(){return e(n.api)})}},t.prototype.emitLegacyEventsFromServiceWorker=function(t,e){switch(t){case h.EVENT_ON_PUSH_DELIVERY:this.eventBus.dispatchEvent("receive-push",{notification:e});break;case h.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.dispatchEvent("open-notification",{notification:e});break;case h.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.dispatchEvent("hide-notification",{notification:e});break;case h.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.dispatchEvent("receive-inbox-message",{message:e})}},t}();e.default=_},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i=n(23);Object.defineProperty(e,"PushServiceDefault",{enumerable:!0,get:function(){return i.PushServiceDefault}});var r=n(34);Object.defineProperty(e,"PushServiceSafari",{enumerable:!0,get:function(){return r.PushServiceSafari}})},function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))(function(r,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(s,a)}u((i=i.apply(t,e||[])).next())})},r=this&&this.__generator||function(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&r[3]>o[1])){s.label=o[1];break}if(6===o[0]&&r[1]>s.label){s.label=r[1],r=o;break}if(r&&r[2]>s.label){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.PushServiceSafari=void 0;var o=n(4),s=n(0),a=function(){function t(t,e,n){this.api=t,this.config=n,this.data=e}return t.prototype.getPermission=function(){return this.getPermissionInfo().permission},t.prototype.checkIsPermissionGranted=function(){return this.getPermission()===s.PERMISSION_GRANTED},t.prototype.checkIsPermissionDefault=function(){return this.getPermission()===s.PERMISSION_PROMPT},t.prototype.checkIsManualUnsubscribed=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.data.getStatusManualUnsubscribed()];case 1:return[2,t.sent()]}})})},t.prototype.askPermission=function(){return i(this,void 0,void 0,function(){var t,e,n,i=this;return r(this,function(r){switch(r.label){case 0:return[4,this.data.getApplicationCode()];case 1:return t=r.sent(),[4,this.data.getHwid()];case 2:return e=r.sent(),n={application:t,hwid:e},[2,new Promise(function(t){safari.pushNotification.requestPermission(i.config.entrypoint||"https://cp.pushwoosh.com/json/1.3/safari",i.config.webSitePushId,n,function(){return t()})})]}})})},t.prototype.getTokens=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.data.getTokens()]})})},t.prototype.subscribe=function(){return i(this,void 0,void 0,function(){var t;return r(this,function(e){switch(e.label){case 0:return this.checkIsPermissionGranted()?[4,this.getPermissionInfo()]:(o.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return t=e.sent().deviceToken,[4,this.data.setTokens({pushToken:t})];case 2:return e.sent(),[4,this.api.registerDevice()];case 3:return e.sent(),[2]}})})},t.prototype.unsubscribe=function(){return i(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.data.setTokens({})];case 1:return t.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return t.sent(),[4,this.api.unregisterDevice()];case 3:return t.sent(),[2]}})})},t.prototype.checkIsRegister=function(){return i(this,void 0,void 0,function(){return r(this,function(t){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},t.prototype.checkIsNeedResubscribe=function(){return i(this,void 0,void 0,function(){var t,e,n,i;return r(this,function(r){switch(r.label){case 0:return[4,this.data.getWebSitePushId()];case 1:return t=r.sent(),e=void 0!==t&&this.config.webSitePushId!==t,[4,this.data.setWebSitePushId(this.config.webSitePushId)];case 2:return r.sent(),[4,this.data.getLastPermissionStatus()];case 3:return n=r.sent(),i=this.getPermission(),n===i?[3,5]:[4,this.data.setLastPermissionStatus(i)];case 4:return r.sent(),[2,!0];case 5:return[2,e]}})})},t.prototype.getPermissionInfo=function(){return safari.pushNotification.permission(this.config.webSitePushId)},t}();e.PushServiceSafari=a},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SubscriptionPromptWidget=void 0;var i=n(36),r=n(27),o=function(){function t(t,e){this.eventBus=t,this.pw=e}return t.prototype.init=function(t){if(!this.getRootElement()){var e=i.getHTML(t),n=i.getStyles(t);document.body.insertAdjacentHTML("beforeend",e),document.head.appendChild(n)}this.addEventListeners()},t.prototype.show=function(){var t=this.getRootElementWithCheckExist();this.eventBus.dispatchEvent("show-subscription-widget",{}),t.classList.add(r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")},t.prototype.hide=function(){var t=this.getRootElementWithCheckExist();t.classList.contains(r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")&&(this.eventBus.dispatchEvent("hide-subscription-widget",{}),t.classList.remove(r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show"))},t.prototype.getRootElement=function(){return document.getElementById(r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-root")},t.prototype.getRootElementWithCheckExist=function(){var t=this.getRootElement();if(!t)throw Error("Can't find element by id \""+r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root", please use method init first.');return t},t.prototype.getDeclineButtonWithCheckExist=function(){var t=document.getElementById(r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-decline");if(!t)throw Error("Can't find element by id \""+r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline", please use method init first.');return t},t.prototype.getAcceptButtonWithCheckExist=function(){var t=document.getElementById(r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-accept");if(!t)throw Error("Can't find element by id \""+r.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept", please use method init first.');return t},t.prototype.addEventListeners=function(){var t=this,e=this.getRootElementWithCheckExist(),n=this.getDeclineButtonWithCheckExist(),i=this.getAcceptButtonWithCheckExist();document.addEventListener("click",function(n){e.contains(n.target)||t.hide()}),n.addEventListener("click",function(){t.hide()}),i.addEventListener("click",function(){t.hide(),t.pw.subscribe()})},t}();e.SubscriptionPromptWidget=o},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getStyles=e.getHTML=void 0;var i=n(27);e.getHTML=function(t){return'\n