web-push-notifications 3.38.0 → 3.39.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1 +1,2 @@
1
- !function(root,factory){if("object"==typeof exports&&"object"==typeof module)module.exports=factory();else if("function"==typeof define&&define.amd)define([],factory);else{var a=factory();for(var i in a)("object"==typeof exports?exports:root)[i]=a[i]}}(this,function(){return function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value:value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=31)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG=exports.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT=exports.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET=exports.PAGE_VISITED_URL=exports.MANUAL_UNSUBSCRIBE=exports.EVENT_PW_SITE_OPENED=exports.EVENT_GDPR_DELETE=exports.EVENT_GDPR_CONSENT=exports.EVENT_CLICK_SUBSCRIBE_BUTTON=exports.EVENT_SHOW_SUBSCRIBE_BUTTON=exports.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET=exports.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET=exports.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG=exports.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG=exports.EVENT_ON_UPDATE_INBOX_MESSAGES=exports.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE=exports.EVENT_ON_CHANGE_COMMUNICATION_ENABLED=exports.EVENT_ON_NOTIFICATION_CLOSE=exports.EVENT_ON_NOTIFICATION_CLICK=exports.EVENT_ON_PUSH_DELIVERY=exports.EVENT_ON_SW_INIT_ERROR=exports.EVENT_ON_PERMISSION_GRANTED=exports.EVENT_ON_PERMISSION_DENIED=exports.EVENT_ON_PERMISSION_PROMPT=exports.EVENT_ON_REGISTER=exports.EVENT_ON_UNSUBSCRIBE=exports.EVENT_ON_SUBSCRIBE=exports.EVENT_ON_READY=exports.EVENT_ON_LOAD=exports.PERMISSION_PROMPT=exports.PERMISSION_GRANTED=exports.PERMISSION_DENIED=exports.DEVICE_REGISTRATION_STATUS_UNREGISTERED=exports.DEVICE_REGISTRATION_STATUS_REGISTERED=exports.MANUAL_SET_LOGGER_LEVEL=exports.KEY_SAFARI_PREVIOUS_PERMISSION=exports.KEY_DEVICE_REGISTRATION_STATUS=exports.KEY_CLICK_SUBSCRIBE_WIDGET=exports.KEY_SHOW_SUBSCRIBE_WIDGET=exports.DEFAULT_NOTIFICATION_IMAGE=exports.DEFAULT_NOTIFICATION_TITLE=exports.PERIOD_GOAL_EVENT=exports.PERIOD_SEND_APP_OPEN=exports.DEFAULT_API_URL=exports.DEFAULT_SERVICE_WORKER_URL=void 0,exports.DEFAULT_SERVICE_WORKER_URL="/pushwoosh-service-worker.js",exports.DEFAULT_API_URL="https://cp.pushwoosh.com/json/1.3/",exports.PERIOD_SEND_APP_OPEN=36e5,exports.PERIOD_GOAL_EVENT=864e5,exports.DEFAULT_NOTIFICATION_TITLE="Pushwoosh notification",exports.DEFAULT_NOTIFICATION_IMAGE="https://cp.pushwoosh.com/img/logo-medium.png",exports.KEY_SHOW_SUBSCRIBE_WIDGET="WIDGET_SHOWED",exports.KEY_CLICK_SUBSCRIBE_WIDGET="WIDGET_CLICKED",exports.KEY_DEVICE_REGISTRATION_STATUS="deviceRegistrationStatus",exports.KEY_SAFARI_PREVIOUS_PERMISSION="safariPreviousPermission",exports.MANUAL_SET_LOGGER_LEVEL="PW_SET_LOGGER_LEVEL",exports.DEVICE_REGISTRATION_STATUS_REGISTERED="registered",exports.DEVICE_REGISTRATION_STATUS_UNREGISTERED="unregistered",exports.PERMISSION_DENIED="denied",exports.PERMISSION_GRANTED="granted",exports.PERMISSION_PROMPT="default",exports.EVENT_ON_LOAD="onLoad",exports.EVENT_ON_READY="onReady",exports.EVENT_ON_SUBSCRIBE="onSubscribe",exports.EVENT_ON_UNSUBSCRIBE="onUnsubscribe",exports.EVENT_ON_REGISTER="onRegister",exports.EVENT_ON_PERMISSION_PROMPT="onPermissionPrompt",exports.EVENT_ON_PERMISSION_DENIED="onPermissionDenied",exports.EVENT_ON_PERMISSION_GRANTED="onPermissionGranted",exports.EVENT_ON_SW_INIT_ERROR="onSWInitError",exports.EVENT_ON_PUSH_DELIVERY="onPushDelivery",exports.EVENT_ON_NOTIFICATION_CLICK="onNotificationClick",exports.EVENT_ON_NOTIFICATION_CLOSE="onNotificationClose",exports.EVENT_ON_CHANGE_COMMUNICATION_ENABLED="onChangeCommunicationEnabled",exports.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE="onPutNewMessageToInboxStore",exports.EVENT_ON_UPDATE_INBOX_MESSAGES="onUpdateInboxMessages",exports.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG="onShowNotificationPermissionDialog",exports.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG="onHideNotificationPermissionDialog",exports.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET="onShowSubscriptionWidget",exports.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET="onHideSubscriptionWidget",exports.EVENT_SHOW_SUBSCRIBE_BUTTON="showSubscribeButton",exports.EVENT_CLICK_SUBSCRIBE_BUTTON="clickSubscribeButton",exports.EVENT_GDPR_CONSENT="GDPRConsent",exports.EVENT_GDPR_DELETE="GDPRDelete",exports.EVENT_PW_SITE_OPENED="PW_SiteOpened",exports.MANUAL_UNSUBSCRIBE="MANUAL_UNSUBSCRIBE",exports.PAGE_VISITED_URL="PAGE_VISITED_URL",exports.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET="not-set",exports.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT="default",exports.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(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Data=void 0;var storage_1=__webpack_require__(2),CONSTANTS=__webpack_require__(0),Data=function(){function Data(store){void 0===store&&(store=storage_1.keyValue),this.store=store}return Data.prototype.clearAll=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationCode",void 0)];case 1:return _a.sent(),[4,this.store.set("params.hwid",void 0)];case 2:return _a.sent(),[4,this.store.set("params.deviceType",void 0)];case 3:return _a.sent(),[4,this.store.set("params.deviceModel",void 0)];case 4:return _a.sent(),[4,this.store.set("params.language",void 0)];case 5:return _a.sent(),[4,this.store.set("params.apiEntrypoint",void 0)];case 6:return _a.sent(),[4,this.store.set("params.tokens",void 0)];case 7:return _a.sent(),[4,this.store.set("params.applicationServerKey",void 0)];case 8:return _a.sent(),[4,this.store.set("params.senderId",void 0)];case 9:return _a.sent(),[4,this.store.set("params.webSitePushId",void 0)];case 10:return _a.sent(),[4,this.store.set("params.defaultNotificationImage",void 0)];case 11:return _a.sent(),[4,this.store.set("params.defaultNotificationTitle",void 0)];case 12:return _a.sent(),[4,this.store.set("params.userId",void 0)];case 13:return _a.sent(),[4,this.store.set("params.email",void 0)];case 14:return _a.sent(),[4,this.store.set("params.userIdWasChanged",void 0)];case 15:return _a.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 16:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 17:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 18:return _a.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 19:return _a.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 20:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 21:return _a.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 22:return _a.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 23:return _a.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 24:return _a.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 25:return _a.sent(),[4,this.store.set("params.features",void 0)];case 26:return _a.sent(),[4,this.store.set("params.init",void 0)];case 27:return _a.sent(),[4,this.store.set("API_PARAMS",void 0)];case 28:return _a.sent(),[4,this.store.set("SENDER_ID",void 0)];case 29:return _a.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 30:return _a.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 31:return _a.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 32:return _a.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 33:return _a.sent(),[2]}})})},Data.prototype.setApplicationCode=function(application){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationCode",application)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApplicationCode=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.applicationCode")];case 1:return[2,_a.sent()]}})})},Data.prototype.setApiToken=function(token){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.apiToken",token)];case 1:return[2,_a.sent()]}})})},Data.prototype.getApiToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.apiToken")];case 1:return[2,_a.sent()]}})})},Data.prototype.setHwid=function(hwid){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.hwid",hwid)];case 1:return _a.sent(),[2]}})})},Data.prototype.getHwid=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.hwid")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDeviceType=function(type){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.deviceType",type)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDeviceType=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.deviceType")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDeviceModel=function(model){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.deviceModel",model)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDeviceModel=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.deviceModel")];case 1:return[2,_a.sent()]}})})},Data.prototype.setLanguage=function(language){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.language",language)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLanguage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.language","en")];case 1:return[2,_a.sent()]}})})},Data.prototype.setApiEntrypoint=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.apiEntrypoint",url)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApiEntrypoint=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.apiEntrypoint",CONSTANTS.DEFAULT_API_URL)];case 1:return[2,_a.sent()]}})})},Data.prototype.setTokens=function(tokens){return __awaiter(this,void 0,void 0,function(){var hwid;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getHwid()];case 1:return hwid=_a.sent(),[4,this.store.set("API_PARAMS",__assign({hwid:hwid},tokens))];case 2:return _a.sent(),[4,this.store.set("params.tokens",tokens)];case 3:return _a.sent(),[2]}})})},Data.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("API_PARAMS")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.tokens")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setApplicationServerKey=function(key){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.applicationServerKey",key)];case 1:return _a.sent(),[2]}})})},Data.prototype.getApplicationServerKey=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.applicationServerKey")];case 1:return[2,_a.sent()]}})})},Data.prototype.setIsVapidChanged=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.isVapidChanged",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getIsVapidChanged=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.isVapidChanged",!1)];case 1:return[2,_a.sent()]}})})},Data.prototype.setWebSitePushId=function(senderId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.webSitePushId",senderId)];case 1:return _a.sent(),[2]}})})},Data.prototype.getWebSitePushId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.webSitePushId")];case 1:return[2,_a.sent()]}})})},Data.prototype.setDefaultNotificationImage=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.defaultNotificationImage",url)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDefaultNotificationImage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.defaultNotificationImage",CONSTANTS.DEFAULT_NOTIFICATION_IMAGE)];case 1:return[2,_a.sent()]}})})},Data.prototype.setDefaultNotificationTitle=function(text){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.defaultNotificationTitle",text)];case 1:return _a.sent(),[2]}})})},Data.prototype.getDefaultNotificationTitle=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.defaultNotificationTitle",CONSTANTS.DEFAULT_NOTIFICATION_TITLE)];case 1:return[2,_a.sent()]}})})},Data.prototype.setUserId=function(userId){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return userId?[3,2]:[4,this.store.set("params.userId",void 0)];case 1:return _a.sent(),[2];case 2:return[4,this.store.set("params.userId",userId.toString())];case 3:return _a.sent(),[2]}})})},Data.prototype.getUserId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.userId")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusUserIdWasChanged=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.userIdWasChanged",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getStatusUserIdWasChanged=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.userIdWasChanged",!1)];case 1:return[2,_a.sent()]}})})},Data.prototype.setEmail=function(email){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return email?[3,2]:[4,this.store.set("params.email",void 0)];case 1:return _a.sent(),[2];case 2:return[4,this.store.set("params.email",email.toString())];case 3:return _a.sent(),[2]}})})},Data.prototype.getEmail=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.email")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusEmailWasChanged=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.emailWasChanged",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getStatusEmailWasChanged=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.emailWasChanged",!1)];case 1:return[2,_a.sent()]}})})},Data.prototype.setLastPermissionStatus=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.isLastPermissionStatus",status)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLastPermissionStatus=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.isLastPermissionStatus")];case 1:return[2,_a.sent()]}})})},Data.prototype.setStatusManualUnsubscribed=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("MANUAL_UNSUBSCRIBE",status)];case 1:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("MANUAL_UNSUBSCRIBE",!1)];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isManualUnsubscribed",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setStatusCommunicationDisabled=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("COMMUNICATION_ENABLED",status?0:1)];case 1:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusCommunicationDisabled=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("COMMUNICATION_ENABLED")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isCommunicationDisabled",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:0==oldValue]}})})},Data.prototype.setStatusDropAllData=function(status){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("DEVICE_DATA_REMOVED",status)];case 1:return _a.sent(),[4,this.store.set("params.isDropAllData",status)];case 2:return _a.sent(),[2]}})})},Data.prototype.getStatusDropAllData=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("DEVICE_DATA_REMOVED",!1)];case 1:return oldValue=_a.sent(),[4,this.store.get("params.isDropAllData",!1)];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setSdkVersion=function(version){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.sdkVersion",version)];case 1:return _a.sent(),[2]}})})},Data.prototype.getSdkVersion=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.sdkVersion")];case 1:return[2,_a.sent()]}})})},Data.prototype.setServiceWorkerVersion=function(version){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("WORKER_VERSION",version)];case 1:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",version)];case 2:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerVersion=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("WORKER_VERSION")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.serviceWorkerVersion")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setServiceWorkerUrl=function(url){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return url?[4,this.store.set("params.serviceWorkerUrl",url)]:[2];case 1:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerUrl=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.serviceWorkerUrl",CONSTANTS.DEFAULT_SERVICE_WORKER_URL)];case 1:return[2,_a.sent()]}})})},Data.prototype.setServiceWorkerScope=function(scope){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return scope?[4,this.store.set("params.serviceWorkerScope",scope)]:[2];case 1:return _a.sent(),[2]}})})},Data.prototype.getServiceWorkerScope=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.serviceWorkerScope")];case 1:return[2,_a.sent()]}})})},Data.prototype.setLastOpenMessage=function(message){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("LAST_OPEN_MESSAGE",message)];case 1:return _a.sent(),[4,this.store.set("params.lastOpenMessage",message)];case 2:return _a.sent(),[2]}})})},Data.prototype.getLastOpenMessage=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("LAST_OPEN_MESSAGE")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.lastOpenMessage")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setLastOpenApplicationTime=function(time){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.lastOpenApplicationTime",time)];case 1:return _a.sent(),[2]}})})},Data.prototype.getLastOpenApplicationTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.lastOpenApplicationTime")];case 1:return[2,_a.sent()]}})})},Data.prototype.setFeatures=function(features){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.features",features)];case 1:return _a.sent(),[2]}})})},Data.prototype.getFeatures=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.features")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInitParams=function(params){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.init",params)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInitParams=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.init")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInboxLastRequestCode=function(lastCode){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.lastRequestCode",lastCode)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxLastRequestCode=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("params.inbox.lastRequestCode","")];case 1:return[2,_a.sent()]}})})},Data.prototype.setInboxLastRequestTime=function(lastRequestTime){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.lastRequestTime",lastRequestTime)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxLastRequestTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.inbox.lastRequestTime",0)]})})},Data.prototype.setInboxNewMessagesCount=function(count){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.inbox.newMessagesCount",count)];case 1:return _a.sent(),[2]}})})},Data.prototype.getInboxNewMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.inbox.newMessagesCount",0)]})})},Data.prototype.setDelayedEvent=function(event){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("DELAYED_EVENT",event)];case 1:return _a.sent(),[4,this.store.set("params.delayedEvent",event)];case 2:return _a.sent(),[2]}})})},Data.prototype.getDelayedEvent=function(){return __awaiter(this,void 0,void 0,function(){var oldValue,newValue;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.get("DELAYED_EVENT")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.delayedEvent")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},Data.prototype.setPromptDisplayCount=function(count){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.promptDisplayCount",count)];case 1:return _a.sent(),[2]}})})},Data.prototype.getPromptDisplayCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.promptDisplayCount",0)]})})},Data.prototype.setPromptLastSeenTime=function(time){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.store.set("params.promptLastSeenTime",time)];case 1:return _a.sent(),[2]}})})},Data.prototype.getPromptLastSeenTime=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.store.get("params.promptLastSeenTime",0)]})})},Data}();exports.Data=Data},function(module,exports,__webpack_require__){"use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}}(),__assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__rest=this&&this.__rest||function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.message=exports.log=exports.keyValue=exports.LogMessage=exports.LogLog=exports.LogBase=exports.getInstance=void 0;var databasePromise,version_1=__webpack_require__(10),MigrationExecutor_1=__webpack_require__(11),constants_1=__webpack_require__(5);function onversionchange(database,event){console.info("onversionchange",event),database.close()}function getInstance(){return databasePromise||(databasePromise=new Promise(function(resolve,reject){var request=indexedDB.open("PUSHWOOSH_SDK_STORE",version_1.default);request.onsuccess=function(event){var database=event.target.result;database.onversionchange=onversionchange.bind(null,database,reject),resolve(database)},request.onerror=function(){return reject(request.error)},request.onupgradeneeded=function(event){var database=event.target.result;database.onversionchange=onversionchange.bind(null,database,reject),new MigrationExecutor_1.default(database).applyMigrations()}})),databasePromise}function getInstanceWithPromise(executor){return getInstance().then(function(database){return new Promise(function(resolve,reject){return executor(database,resolve,reject)})})}exports.getInstance=getInstance;var LogBase=function(){function LogBase(){}return LogBase.prototype._add=function(obj){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var request=database.transaction([_this.name],"readwrite").objectStore(_this.name).add(obj);request.onsuccess=function(){resolve(obj)},request.onerror=function(){reject(request.error)}}).then(function(obj){return _this.getAll().then(function(items){if(Array.isArray(items)){var ids=items.map(function(i){return i.id}).sort(function(a,b){return a==b?0:a<b?1:-1});if(ids.length>_this.maxItems)return Promise.all(ids.slice(_this.maxItems).map(function(id){return _this.delete(id)})).then(function(){return obj})}return obj})})},LogBase.prototype.delete=function(key){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var request=database.transaction([_this.name],"readwrite").objectStore(_this.name).delete(key);request.onsuccess=function(){resolve(request.result)},request.onerror=function(){reject(request.error)}})},LogBase.prototype.getAll=function(){var _this=this;return getInstanceWithPromise(function(database,resolve,reject){var result=[],cursor=database.transaction(_this.name).objectStore(_this.name).openCursor();cursor.onsuccess=function(ev){var cursorResult=ev.target.result;cursorResult?(cursorResult.value&&result.push(cursorResult.value),cursorResult.continue()):resolve(result)},cursor.onerror=function(){reject(cursor.error)}})},LogBase}();exports.LogBase=LogBase;var LogLog=function(_super){function LogLog(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.name=constants_1.STORE_NAME_MAIN_LOG,_this.maxItems=100,_this.environment="undefined"!=typeof self&&self.registration?"worker":"browser",_this}return __extends(LogLog,_super),LogLog.prototype.add=function(type,message,additional){var obj={type:type,environment:this.environment,message:""+message,date:new Date};return message instanceof Error&&(obj.stack=message.stack),additional&&(obj.additional=additional),this._add(obj)},LogLog}(LogBase);exports.LogLog=LogLog;var LogMessage=function(_super){function LogMessage(){var _this=null!==_super&&_super.apply(this,arguments)||this;return _this.name=constants_1.STORE_NAME_MESSAGE_LOG,_this.maxItems=25,_this}return __extends(LogMessage,_super),LogMessage.prototype.add=function(log){return this._add(__assign(__assign({},log),{date:new Date}))},LogMessage}(LogBase);exports.LogMessage=LogMessage,exports.keyValue=function(name){return{get:function(key,defaultValue){return getInstanceWithPromise(function(database,resolve,reject){var timeout,request=database.transaction(name).objectStore(name).get(key),isComplete=!1,isError=!1,check=function(){if(clearTimeout(timeout),isComplete){var result=request.result;resolve(result&&result.value||defaultValue)}else isError?reject(request.error):timeout=setTimeout(check,0)};request.onsuccess=function(){return isComplete=!0},request.onerror=function(){return isError=!0},check()})},getAll:function(){return getInstanceWithPromise(function(database,resolve,reject){var timeout,result={},cursor=database.transaction(name).objectStore(name).openCursor(),isComplete=!1,isError=!1,check=function(){clearTimeout(timeout),isComplete?resolve(result):isError?reject(cursor.error):timeout=setTimeout(check,0)};cursor.onsuccess=function(event){var cursorResult=event.target.result;cursorResult?(result[cursorResult.key]=cursorResult.value.value,cursorResult.continue()):isComplete=!0},cursor.onerror=function(){return isError=!0},check()})},extend:function(key,value){return __awaiter(this,void 0,void 0,function(){var oldValues,newValues;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.get(key)];case 1:return oldValues=_a.sent(),newValues=__rest(value,[]),[4,this.set(key,__assign(__assign({},oldValues),newValues))];case 2:return _a.sent(),[2]}})})},set:function(key,value){return getInstanceWithPromise(function(database,resolve,reject){var timeout,request=database.transaction([name],"readwrite").objectStore(name).put({key:key,value:value}),isComplete=!1,isError=!1,check=function(){clearTimeout(timeout),isComplete?resolve(key):isError?reject(request.error):timeout=setTimeout(check,0)};request.onsuccess=function(){return isComplete=!0},request.onerror=function(){return isError=!0},check()})}}}(constants_1.STORE_NAME_KEY_VALUE),exports.log=new LogLog,exports.message=new LogMessage},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var DateModule=function(){function DateModule(date){void 0===date&&(date=new Date),this._date=date}return Object.defineProperty(DateModule.prototype,"date",{get:function(){return this._date},set:function(date){this._date=date},enumerable:!1,configurable:!0}),DateModule.prototype.getUtcTimestamp=function(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)},DateModule.prototype.getTimestamp=function(){return Math.round(this.date.getTime()/1e3)},DateModule.prototype.setLocal=function(){var newDateTimestamp=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(newDateTimestamp)},DateModule.prototype.addDays=function(days){var newDateTimestamp=this._date.getTime()+24*days*60*60*1e3;this._date=new Date(newDateTimestamp)},DateModule.prototype.getInboxFakeOrder=function(){return(100*this._date.getTime()+9e9).toString()},DateModule}();exports.default=DateModule},function(module,exports,__webpack_require__){"use strict";var __spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Logger=exports.logAndRejectError=exports.logAndThrowError=void 0;var storage_1=__webpack_require__(2),levels={error:1,info:2,debug:3},limitLevel=3;__webpack_require__(6).patchConsole();var Logger={setLevel:function(level){levels[level]||(level="error"),limitLevel=levels[level]},write:function(type,message,additional){return"error"===type?this.error(message):this.info(message),storage_1.log.add(type,message,additional)}};exports.Logger=Logger,Object.keys(levels).forEach(function(levelName){var levelNumber=levels[levelName];Logger[levelName]=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];levelNumber<=limitLevel&&(console.groupCollapsed(levelName),console.info.apply(console,__spreadArrays([""],args)),console.trace("trace"),console.groupEnd())}}),exports.logAndThrowError=function(error){var logText=new Error(error);throw Logger.write("error",logText,"logAndThrowError"),logText},exports.logAndRejectError=function(error,reject){var logText=new Error(error);Logger.write("error",logText,"logAndRejectError"),reject(logText)}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.KEY_PATH_BASE_INCREMENT=exports.STORE_NAME_INBOX_MESSAGES=exports.STORE_NAME_MAIN_LOG=exports.STORE_NAME_MESSAGE_LOG=exports.STORE_NAME_KEY_VALUE=void 0,exports.STORE_NAME_KEY_VALUE="keyValue",exports.STORE_NAME_MESSAGE_LOG="messages",exports.STORE_NAME_MAIN_LOG="log",exports.STORE_NAME_INBOX_MESSAGES="inboxMessages",exports.KEY_PATH_BASE_INCREMENT="id"},function(module,exports,__webpack_require__){"use strict";function getGlobal(){return globalThis}Object.defineProperty(exports,"__esModule",{value:!0}),exports.generateUUID=exports.clearLocationHash=exports.patchConsole=exports.parseSerializedNotificationParams=exports.getVersion=exports.getGlobal=void 0,exports.getGlobal=getGlobal,exports.getVersion=function(){return"3.38.0"},exports.parseSerializedNotificationParams=function(param,defaultValue){if("string"==typeof param)try{return JSON.parse(param)}catch(e){console.log(e)}return void 0===param&&void 0!==defaultValue?defaultValue:param},exports.patchConsole=function(){for(var method,noop=function(){},methods=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],len=methods.length,global=getGlobal(),console=global.console=global.console||{};len--;)console[method=methods[len]]||(console[method]=noop)},exports.clearLocationHash=function(){"history"in getGlobal()&&history.pushState?history.pushState(null,"","#"):location.hash="#"},exports.generateUUID=function(){var d=(new Date).getTime();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(d+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)})}},function(module,exports,__webpack_require__){var v1=__webpack_require__(15),v4=__webpack_require__(16),uuid=v4;uuid.v1=v1,uuid.v4=v4,module.exports=uuid},function(module,exports){var getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function(){return getRandomValues(rnds8),rnds8}}else{var rnds=new Array(16);module.exports=function(){for(var r,i=0;i<16;i++)0==(3&i)&&(r=4294967296*Math.random()),rnds[i]=r>>>((3&i)<<3)&255;return rnds}}},function(module,exports){for(var byteToHex=[],i=0;i<256;++i)byteToHex[i]=(i+256).toString(16).substr(1);module.exports=function(buf,offset){var i=offset||0,bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=7},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Migrations_1=__webpack_require__(20),MigrationExecutor=function(){function MigrationExecutor(db,migrationsBuilder){void 0===migrationsBuilder&&(migrationsBuilder=new Migrations_1.default),this.db=db,this.migrationsBuilder=migrationsBuilder}return MigrationExecutor.prototype.applyMigrations=function(){var _this=this;this.applyMigrationsPack(this.migrationsBuilder.initial),this.migrationsBuilder.dateSorted.forEach(function(migrationsPack){_this.applyMigrationsPack(migrationsPack)})},MigrationExecutor.prototype.applyMigrationsPack=function(migrationsPack){var _this=this;migrationsPack.forEach(function(migration){migration(_this.db)})},MigrationExecutor}();exports.default=MigrationExecutor},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.storeCreatorDecorator=void 0,exports.storeCreatorDecorator=function(name,storeCreator){return function(database){database.objectStoreNames.contains(name)||storeCreator(database)}}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__spreadArrays=this&&this.__spreadArrays||function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r};Object.defineProperty(exports,"__esModule",{value:!0});var DateModule_1=__webpack_require__(3),InboxMessages=function(){function InboxMessages(data,api,inboxModel,dateModule){void 0===dateModule&&(dateModule=new DateModule_1.default),this.data=data,this.api=api,this.inboxModel=inboxModel,this.dateModule=dateModule,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}return InboxMessages.prototype.messageTypeFactory=function(action_type,actionParams){var messageType=0;return 2===action_type?messageType=1:"l"in actionParams&&null!=actionParams.l&&(messageType=actionParams.l.startsWith("http")?2:3),messageType},InboxMessages.prototype.updateMessagesStatusWithCodes=function(codes,messages,status){return __awaiter(this,void 0,void 0,function(){var updatedMessages,inboxStatusQueries,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return updatedMessages=[],inboxStatusQueries=[],messages.forEach(function(msg){return __awaiter(_this,void 0,void 0,function(){return __generator(this,function(_a){return-1===codes.indexOf(msg.inbox_id)?[2]:(msg.status=status,updatedMessages.push(msg),inboxStatusQueries.push(this.api.inboxStatus(msg.order,msg.status)),[2])})})}),[4,this.inboxModel.putBulkMessages(updatedMessages)];case 1:return _a.sent(),[4,Promise.all(inboxStatusQueries)];case 2:return _a.sent(),[2]}})})},InboxMessages.prototype.publicMessageBuilder=function(_a){var action_type=_a.action_type,action_params=_a.action_params,image=_a.image,title=_a.title,send_date=_a.send_date,inbox_id=_a.inbox_id,text=_a.text,status=_a.status;return __awaiter(this,void 0,void 0,function(){var imageUrl,_b,inboxTitle,_c,actionParams;return __generator(this,function(_d){switch(_d.label){case 0:return(_b=image)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:_b=_d.sent(),_d.label=2;case 2:return imageUrl=_b,(_c=title)?[3,4]:[4,this.data.getDefaultNotificationTitle()];case 3:_c=_d.sent(),_d.label=4;case 4:return inboxTitle=_c,actionParams=JSON.parse(action_params),this.dateModule.date=new Date(1e3*parseInt(send_date)),this.dateModule.setLocal(),[2,{title:inboxTitle,imageUrl:imageUrl,code:inbox_id,message:text,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(action_type,actionParams),link:(null===actionParams||void 0===actionParams?void 0:actionParams.l)||"/",isRead:2===status||3===status,isActionPerformed:3===status}]}})})},InboxMessages.prototype.messagesWithNoActionPerformedCount=function(){return this.inboxModel.getDeliveredReadMessagesCount()},InboxMessages.prototype.unreadMessagesCount=function(){return this.inboxModel.getDeliveredMessagesCount()},InboxMessages.prototype.messagesCount=function(){return this.inboxModel.messagesCount()},InboxMessages.prototype.loadMessages=function(){return __awaiter(this,void 0,void 0,function(){var readMessages,unreadMessages,buildMessagePromises;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return readMessages=_a.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return unreadMessages=_a.sent(),buildMessagePromises=__spreadArrays(readMessages,unreadMessages).sort(function(msgA,msgB){return parseInt(msgB.send_date,10)-parseInt(msgA.send_date,10)}).sort(function(msgA,msgB){return parseInt(msgB.order||"0",10)-parseInt(msgA.order||"0",10)}).map(this.publicMessageBuilder),[2,Promise.all(buildMessagePromises)]}})})},InboxMessages.prototype.readMessagesWithCodes=function(codes){return __awaiter(this,void 0,void 0,function(){var unreadMessages,statusRead;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getDeliveredMessages()];case 1:return unreadMessages=_a.sent(),statusRead=2,[4,this.updateMessagesStatusWithCodes(codes,unreadMessages,statusRead)];case 2:return _a.sent(),[2]}})})},InboxMessages.prototype.performActionForMessageWithCode=function(code){return __awaiter(this,void 0,void 0,function(){var message,actionParams,messageType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getMessage(code)];case 1:return message=_a.sent(),actionParams=JSON.parse(message.action_params),2===(messageType=this.messageTypeFactory(message.action_type,actionParams))&&null!=actionParams.l?document.location.href=actionParams.l:3===messageType&&null!=actionParams.l&&window.history.go(actionParams.l),message.status=3,[4,this.inboxModel.putMessage(message)];case 2:return _a.sent(),[4,this.api.inboxStatus(message.order,message.status)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.deleteMessagesWithCodes=function(codes){return __awaiter(this,void 0,void 0,function(){var readMessages,unreadMessages,statusDeleted;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return readMessages=_a.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return unreadMessages=_a.sent(),statusDeleted=4,[4,this.updateMessagesStatusWithCodes(codes,__spreadArrays(readMessages,unreadMessages),statusDeleted)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.syncMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.inboxModel.updateMessages()];case 1:return _a.sent(),[2]}})})},InboxMessages}();exports.default=InboxMessages},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.ApiClient=void 0;var Data_1=__webpack_require__(1),logger_1=__webpack_require__(4),ApiClient=function(){function ApiClient(data,logger){void 0===data&&(data=new Data_1.Data),void 0===logger&&(logger=logger_1.Logger),this.data=data,this.logger=logger}return ApiClient.prototype.checkDevice=function(options){return this.createRequest("checkDevice",options)},ApiClient.prototype.getConfig=function(options){return this.createRequest("getConfig",options,"",!0)},ApiClient.prototype.applicationOpen=function(options){return this.createRequest("applicationOpen",options)},ApiClient.prototype.registerDevice=function(options){return this.createRequest("registerDevice",options)},ApiClient.prototype.unregisterDevice=function(options){return this.createRequest("unregisterDevice",options)},ApiClient.prototype.deleteDevice=function(options){return this.createRequest("deleteDevice",options)},ApiClient.prototype.messageDeliveryEvent=function(options){return this.createRequest("messageDeliveryEvent",options)},ApiClient.prototype.pushStat=function(options){return this.createRequest("pushStat",options)},ApiClient.prototype.setTags=function(options){return this.createRequest("setTags",options)},ApiClient.prototype.getTags=function(options){return this.createRequest("getTags",options)},ApiClient.prototype.registerUser=function(options){return this.createRequest("registerUser",options)},ApiClient.prototype.registerEmail=function(options){return this.createRequest("registerEmail",options)},ApiClient.prototype.registerEmailUser=function(options){return this.createRequest("registerEmailUser",options)},ApiClient.prototype.setEmailTags=function(options){return this.createRequest("setEmailTags",options)},ApiClient.prototype.postEvent=function(options){return this.createRequest("postEvent",options)},ApiClient.prototype.getInboxMessages=function(options){return this.createRequest("getInboxMessages",options)},ApiClient.prototype.inboxStatus=function(options){return this.createRequest("inboxStatus",options)},ApiClient.prototype.pageVisit=function(options,url){return this.createRequest("pageVisit",options,url)},ApiClient.prototype.setPurchase=function(options){return this.createRequest("setPurchase",options)},ApiClient.prototype.createRequest=function(methodName,request,customUrl,ignoreAuth){return __awaiter(this,void 0,void 0,function(){var entrypoint,apiToken,_a,url,authRequestOptions,response,result;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return entrypoint=_b.sent(),ignoreAuth?(_a="",[3,4]):[3,2];case 2:return[4,this.data.getApiToken()];case 3:_a=_b.sent(),_b.label=4;case 4:return apiToken=_a,url=customUrl||entrypoint+methodName,authRequestOptions=apiToken?{headers:{Authorization:"Token "+apiToken,"Content-Type":"text/plain;charset=UTF-8",Origin:window.location.origin},credentials:"include"}:{},[4,fetch(url,__assign({method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:request})},authRequestOptions))];case 5:return response=_b.sent(),[4,this.checkResponse(response)];case 6:return(result=_b.sent()).base_url?[4,this.data.setApiEntrypoint(result.base_url)]:[3,8];case 7:_b.sent(),_b.label=8;case 8:return[4,this.logger.write("apirequest",methodName+" call with arguments: "+JSON.stringify(request)+" to Pushwoosh has been successful. Result: "+JSON.stringify(result.response))];case 9:return _b.sent(),[2,result.response]}})})},ApiClient.prototype.checkResponse=function(response){return __awaiter(this,void 0,void 0,function(){var data;return __generator(this,function(_a){switch(_a.label){case 0:if(200!==response.status)throw new Error("Error code: "+response.status+". Error text: "+response.statusText);return[4,response.json()];case 1:if(200!==(data=_a.sent()).status_code)throw new Error("Error code: "+data.status_code+". Error text: "+data.status_message);return[2,data]}})})},ApiClient}();exports.ApiClient=ApiClient},function(module,exports,__webpack_require__){var _nodeId,_clockseq,rng=__webpack_require__(8),bytesToUuid=__webpack_require__(9),_lastMSecs=0,_lastNSecs=0;module.exports=function(options,buf,offset){var i=buf&&offset||0,b=buf||[],node=(options=options||{}).node||_nodeId,clockseq=void 0!==options.clockseq?options.clockseq:_clockseq;if(null==node||null==clockseq){var seedBytes=rng();null==node&&(node=_nodeId=[1|seedBytes[0],seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]),null==clockseq&&(clockseq=_clockseq=16383&(seedBytes[6]<<8|seedBytes[7]))}var msecs=void 0!==options.msecs?options.msecs:(new Date).getTime(),nsecs=void 0!==options.nsecs?options.nsecs:_lastNSecs+1,dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&void 0===options.clockseq&&(clockseq=clockseq+1&16383),(dt<0||msecs>_lastMSecs)&&void 0===options.nsecs&&(nsecs=0),nsecs>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=msecs,_lastNSecs=nsecs,_clockseq=clockseq;var tl=(1e4*(268435455&(msecs+=122192928e5))+nsecs)%4294967296;b[i++]=tl>>>24&255,b[i++]=tl>>>16&255,b[i++]=tl>>>8&255,b[i++]=255&tl;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255,b[i++]=255&tmh,b[i++]=tmh>>>24&15|16,b[i++]=tmh>>>16&255,b[i++]=clockseq>>>8|128,b[i++]=255&clockseq;for(var n=0;n<6;++n)b[i+n]=node[n];return buf||bytesToUuid(b)}},function(module,exports,__webpack_require__){var rng=__webpack_require__(8),bytesToUuid=__webpack_require__(9);module.exports=function(options,buf,offset){var i=buf&&offset||0;"string"==typeof options&&(buf="binary"===options?new Array(16):null,options=null);var rnds=(options=options||{}).random||(options.rng||rng)();if(rnds[6]=15&rnds[6]|64,rnds[8]=63&rnds[8]|128,buf)for(var ii=0;ii<16;++ii)buf[i+ii]=rnds[ii];return buf||bytesToUuid(rnds)}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var EventBus_1=__webpack_require__(18);Object.defineProperty(exports,"EventBus",{enumerable:!0,get:function(){return EventBus_1.EventBus}})},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};Object.defineProperty(exports,"__esModule",{value:!0}),exports.EventBus=void 0;var uuid_1=__webpack_require__(7),EventBus=function(){return function(){var _this=this;this.addEventHandler=function(name,handler){var savedEventHandlers=_this.savedEventHandlersMap[name];savedEventHandlers||(savedEventHandlers=[]),savedEventHandlers.push(handler),_this.savedEventHandlersMap[name]=savedEventHandlers},this.removeEventHandler=function(name,handler){var savedEventHandlers=_this.savedEventHandlersMap[name];savedEventHandlers&&(_this.savedEventHandlersMap[name]=savedEventHandlers.filter(function(savedEventHandler){return savedEventHandler!==handler}))},this.dispatchEvent=function(name,payload){var eventId=payload.eventId||uuid_1.v4(),savedEventHandlers=_this.savedEventHandlersMap[name];return savedEventHandlers?(savedEventHandlers.forEach(function(element){"function"==typeof element&&setTimeout(function(){element(__assign(__assign({},payload),{eventId:eventId}))},0)}),eventId):eventId},this.savedEventHandlersMap={}}}();exports.EventBus=EventBus},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}},__rest=this&&this.__rest||function(s,e){var t={};for(var p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(p=Object.getOwnPropertySymbols(s);i<p.length;i++)e.indexOf(p[i])<0&&Object.prototype.propertyIsEnumerable.call(s,p[i])&&(t[p[i]]=s[p[i]])}return t};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Api=void 0;var Data_1=__webpack_require__(1),ApiClient_1=__webpack_require__(14),CONSTANTS=__webpack_require__(0),Api=function(){function Api(eventBus,data,apiClient){void 0===data&&(data=new Data_1.Data),void 0===apiClient&&(apiClient=new ApiClient_1.ApiClient),this.eventBus=eventBus,this.data=data,this.apiClient=apiClient}return Api.prototype.checkDevice=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.checkDevice(params)];case 2:return[2,_a.sent()]}})})},Api.prototype.checkDeviceSubscribeForPushNotifications=function(useCache){return void 0===useCache&&(useCache=!0),__awaiter(this,void 0,void 0,function(){var status,_a,exist,push_token_exist;return __generator(this,function(_b){switch(_b.label){case 0:return void 0!==(status=localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS))&&useCache?[3,2]:[4,this.checkDevice()];case 1:_a=_b.sent(),exist=_a.exist,push_token_exist=_a.push_token_exist,localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,exist&&push_token_exist?CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED:CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),status=localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS),_b.label=2;case 2:return[2,status===CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED]}})})},Api.prototype.getConfig=function(features){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.getConfig(__assign(__assign({},params),{features:features}))]}})})},Api.prototype.applicationOpen=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.setLastOpenApplicationTime(Date.now())];case 2:return _a.sent(),[2,this.apiClient.applicationOpen(params)]}})})},Api.prototype.registerDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,tokens,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:if(_a.sent())throw new Error("Can't register device: Communication is disabled!");return[4,this.getRequestParams()];case 2:return params=_a.sent(),[4,this.data.getTokens()];case 3:if(!(tokens=_a.sent()).pushToken)throw new Error("Can't register device: pushToken is not exist!");return[4,this.apiClient.registerDevice(__assign(__assign({},params),{push_token:tokens.pushToken,auth_token:tokens.authToken,public_key:tokens.publicKey}))];case 4:return response=_a.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 5:return _a.sent(),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED),this.eventBus.dispatchEvent("register",{}),[2,response]}})})},Api.prototype.unregisterDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),response=this.apiClient.unregisterDevice(params),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,response]}})})},Api.prototype.deleteDevice=function(){return __awaiter(this,void 0,void 0,function(){var params,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),response=this.apiClient.deleteDevice(params),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return _a.sent(),localStorage.setItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS,CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED),this.eventBus.dispatchEvent("unsubscribe",{}),[2,response]}})})},Api.prototype.messageDeliveryEvent=function(hash,isTrackingLogOnFailure,metaData){return void 0===metaData&&(metaData={}),__awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.messageDeliveryEvent(__assign(__assign({},params),{hash:hash,metaData:metaData}))];case 2:return[2,_a.sent()]}})})},Api.prototype.pushStat=function(hash,isTrackingLogOnFailure,metaData){return void 0===metaData&&(metaData={}),__awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return Math.round(+new Date),[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.apiClient.pushStat(__assign(__assign({},params),{hash:hash,metaData:metaData}))];case 2:return[2,_a.sent()]}})})},Api.prototype.setTags=function(tags){return __awaiter(this,void 0,void 0,function(){var _a,hwid,device_type,params,email;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.getRequestParams()];case 1:return _a=_b.sent(),hwid=_a.hwid,device_type=_a.device_type,params=__rest(_a,["hwid","device_type"]),[4,this.data.getEmail()];case 2:return(email=_b.sent())?[4,this.apiClient.setEmailTags(__assign(__assign({},params),{email:email,tags:tags}))]:[3,4];case 3:_b.sent(),_b.label=4;case 4:return[2,this.apiClient.setTags(__assign(__assign({},params),{hwid:hwid,device_type:device_type,tags:tags}))]}})})},Api.prototype.getTags=function(){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.getTags(params)]}})})},Api.prototype.registerUser=function(userId){return __awaiter(this,void 0,void 0,function(){var _a,hwid,params,deviceType,id,email,response;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.getRequestParams()];case 1:return _a=_b.sent(),hwid=_a.hwid,_a.device_type,params=__rest(_a,["hwid","device_type"]),[4,this.data.getDeviceType()];case 2:return deviceType=_b.sent(),id=""+userId,[4,this.data.getEmail()];case 3:return email=_b.sent(),[4,this.apiClient.registerUser(__assign(__assign({},params),{hwid:hwid,userId:id,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:deviceType}))];case 4:return response=_b.sent(),email?[4,this.apiClient.registerEmailUser(__assign(__assign({},params),{email:email,userId:id,ts_offset:60*-(new Date).getTimezoneOffset()}))]:[3,6];case 5:_b.sent(),_b.label=6;case 6:return[4,this.data.setUserId(""+userId)];case 7:return _b.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 8:return _b.sent(),[2,response]}})})},Api.prototype.registerEmail=function(email){return __awaiter(this,void 0,void 0,function(){var _a,params,response;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.getRequestParams()];case 1:return _a=_b.sent(),_a.hwid,_a.device_type,params=__rest(_a,["hwid","device_type"]),[4,this.apiClient.registerEmail(__assign(__assign({},params),{email:email,ts_offset:60*-(new Date).getTimezoneOffset()}))];case 2:return response=_b.sent(),[4,this.data.setEmail(""+email)];case 3:return _b.sent(),[4,this.data.setStatusEmailWasChanged(!0)];case 4:return _b.sent(),[2,response]}})})},Api.prototype.postEvent=function(event,attributes){return __awaiter(this,void 0,void 0,function(){var params,date,time,timestampUTC,timestampCurrent,lastOpenMessage,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),date=new Date,time=date.getTime(),timestampUTC=Math.floor(time/1e3),timestampCurrent=timestampUTC-date.getTimezoneOffset()/60*3600,[4,this.data.getLastOpenMessage()];case 2:if((lastOpenMessage=_a.sent())&&lastOpenMessage.expiry>Date.now()){if(attributes.msgHash)return[2,Promise.reject("attribute msgHash already defined")];attributes=__assign(__assign({},attributes),{msgHash:lastOpenMessage.messageHash})}return[4,this.data.setLastOpenMessage(void 0)];case 3:return _a.sent(),[4,this.apiClient.postEvent(__assign(__assign({},params),{event:event,timestampUTC:timestampUTC,timestampCurrent:timestampCurrent,attributes:attributes}))];case 4:return(response=_a.sent())&&response.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:response.code}),[2,response]}})})},Api.prototype.getInboxMessages=function(count){return void 0===count&&(count=0),__awaiter(this,void 0,void 0,function(){var params,lastCode,lastRequestTime;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getInboxLastRequestCode()];case 2:return lastCode=_a.sent(),[4,this.data.getInboxLastRequestTime()];case 3:return lastRequestTime=_a.sent(),[2,this.apiClient.getInboxMessages(__assign(__assign({},params),{count:count,last_code:lastCode,last_request_time:lastRequestTime}))]}})})},Api.prototype.inboxStatus=function(order,status){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.inboxStatus(__assign(__assign({},params),{inbox_code:order,status:status,time:(new Date).getTime()}))]}})})},Api.prototype.triggerEvent=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){throw new Error("Method has been deprecated, because we don't aggregate this statistics.")})})},Api.prototype.pageVisit=function(config){return __awaiter(this,void 0,void 0,function(){var params,features,url;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getFeatures()];case 2:return features=_a.sent(),(url=features&&features.page_visit&&features.page_visit.entrypoint)?[2,this.apiClient.pageVisit(__assign(__assign({},params),config),url)]:[2]}})})},Api.prototype.setPurchase=function(attributes){return __awaiter(this,void 0,void 0,function(){var params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setPurchase(__assign(__assign({},params),attributes))]}})})},Api.prototype.getParams=function(){return __awaiter(this,void 0,void 0,function(){var applicationCode,hwid,apiParams,initParams;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),[4,this.data.getTokens()];case 3:return apiParams=_a.sent(),[4,this.data.getInitParams()];case 4:return initParams=_a.sent(),[2,__assign(__assign({applicationCode:applicationCode,hwid:hwid},apiParams),initParams)]}})})},Object.defineProperty(Api.prototype,"params",{get:function(){throw new Error('Property "Pushwoosh.api.params" have been deprecated. Use the async method "Pushwoosh.api.getParams()"')},enumerable:!1,configurable:!0}),Api.prototype.getRequestParams=function(){return __awaiter(this,void 0,void 0,function(){var applicationCode,hwid,userId,deviceType,deviceModel,language,version,timezone;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),[4,this.data.getUserId()];case 3:return userId=_a.sent(),[4,this.data.getDeviceType()];case 4:return deviceType=_a.sent(),[4,this.data.getDeviceModel()];case 5:return deviceModel=_a.sent(),[4,this.data.getLanguage()];case 6:return language=_a.sent(),[4,this.data.getSdkVersion()];case 7:return version=_a.sent(),timezone=60*-(new Date).getTimezoneOffset(),[2,{application:applicationCode,hwid:hwid,userId:userId||hwid,device_type:deviceType,device_model:deviceModel,timezone:timezone,language:language,v:version}]}})})},Api}();exports.Api=Api},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var initial_1=__webpack_require__(21),_26_11_2018_1=__webpack_require__(22),DateModule_1=__webpack_require__(3),Migrations=function(){function Migrations(dateModule){void 0===dateModule&&(dateModule=new DateModule_1.default),this.migrations={initial:initial_1.default,"2018/11/26":_26_11_2018_1.default},this.dateModule=dateModule}return Object.defineProperty(Migrations.prototype,"initial",{get:function(){return this.migrations.initial},enumerable:!1,configurable:!0}),Object.defineProperty(Migrations.prototype,"dateSorted",{get:function(){var _this=this;return Object.keys(this.migrations).filter(function(key){return"initial"!==key}).sort(function(a,b){var dateA=new DateModule_1.default(new Date(a)),dateB=new DateModule_1.default(new Date(b));return dateA.getTimestamp()-dateB.getTimestamp()}).map(function(key){return _this.migrations[key]})},enumerable:!1,configurable:!0}),Migrations}();exports.default=Migrations},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(12),constants_1=__webpack_require__(5);exports.default=[helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_KEY_VALUE,function(database){database.createObjectStore(constants_1.STORE_NAME_KEY_VALUE,{keyPath:"key"})}),helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_MAIN_LOG,function(database){var logStore=database.createObjectStore(constants_1.STORE_NAME_MAIN_LOG,{keyPath:constants_1.KEY_PATH_BASE_INCREMENT,autoIncrement:!0});logStore.createIndex("environment","environment",{unique:!1}),logStore.createIndex("date","date",{unique:!1}),logStore.createIndex("type","type",{unique:!1})}),helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_MESSAGE_LOG,function(database){database.createObjectStore(constants_1.STORE_NAME_MESSAGE_LOG,{keyPath:constants_1.KEY_PATH_BASE_INCREMENT,autoIncrement:!0}).createIndex("date","date",{unique:!1})})]},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(12),constants_1=__webpack_require__(5);exports.default=[helpers_1.storeCreatorDecorator(constants_1.STORE_NAME_INBOX_MESSAGES,function(database){var store=database.createObjectStore(constants_1.STORE_NAME_INBOX_MESSAGES,{keyPath:"inbox_id",autoIncrement:!1});store.createIndex("status","status",{unique:!1,multiEntry:!0}),store.createIndex("rt","rt",{unique:!1,multiEntry:!0})})]},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushServiceDefault=void 0;var uuid_1=__webpack_require__(7),logger_1=__webpack_require__(4),CONSTANTS=__webpack_require__(0),PushServiceDefault=function(){function PushServiceDefault(api,data,config){this.api=api,this.data=data,this.config=config}return PushServiceDefault.prototype.getPermission=function(){return Notification.permission},PushServiceDefault.prototype.checkIsPermissionGranted=function(){return this.getPermission()===CONSTANTS.PERMISSION_GRANTED},PushServiceDefault.prototype.checkIsPermissionDefault=function(){return this.getPermission()===CONSTANTS.PERMISSION_PROMPT},PushServiceDefault.prototype.checkIsManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getStatusManualUnsubscribed()]})})},PushServiceDefault.prototype.askPermission=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Notification.requestPermission()];case 1:return _a.sent(),[2]}})})},PushServiceDefault.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getTokens()]})})},PushServiceDefault.prototype.subscribe=function(subscription){return __awaiter(this,void 0,void 0,function(){var currentSubscription,_a,pushToken,_p256dn,_auth,p256dh,auth;return __generator(this,function(_b){switch(_b.label){case 0:return(_a=subscription)?[3,2]:[4,this.trySubscribe()];case 1:_a=_b.sent(),_b.label=2;case 2:if(currentSubscription=_a,!this.checkIsPermissionGranted())return logger_1.Logger.error("You must have permission granted before subscribe!"),[2];if(pushToken=this.getPushToken(currentSubscription),_p256dn=currentSubscription.getKey("p256dh"),_auth=currentSubscription.getKey("auth"),!_p256dn||!_auth)throw new Error("Can't get subscription keys!");return p256dh=btoa(String.fromCharCode.apply(String,new Uint8Array(_p256dn))),auth=btoa(String.fromCharCode.apply(String,new Uint8Array(_auth))),[4,this.data.setTokens({publicKey:p256dh,pushToken:pushToken,authToken:auth,endpoint:currentSubscription.endpoint})];case 3:return _b.sent(),[4,this.api.registerDevice()];case 4:return _b.sent(),[2]}})})},PushServiceDefault.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){var subscription;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,_a.sent().pushManager.getSubscription()];case 2:return subscription=_a.sent(),[4,this.data.setTokens({})];case 3:return _a.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 4:return _a.sent(),[4,this.api.unregisterDevice()];case 5:return _a.sent(),subscription?[4,subscription.unsubscribe()]:[2];case 6:return _a.sent(),[2]}})})},PushServiceDefault.prototype.checkIsRegister=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},PushServiceDefault.prototype.checkIsNeedResubscribe=function(){return __awaiter(this,void 0,void 0,function(){var lastPermission,permission,credentials,pushTokenFromSubscription,subscriptionTokensFromStore,pushTokenFromStore,isEqualPushTokens,isVapidChanged;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getLastPermissionStatus()];case 1:return lastPermission=_a.sent(),permission=this.getPermission(),lastPermission===permission?[3,3]:[4,this.data.setLastPermissionStatus(permission)];case 2:return _a.sent(),[2,!0];case 3:return[4,this.getCredentials()];case 4:return credentials=_a.sent(),pushTokenFromSubscription=this.getPushToken(credentials),[4,this.data.getTokens()];case 5:return subscriptionTokensFromStore=_a.sent(),pushTokenFromStore=subscriptionTokensFromStore&&subscriptionTokensFromStore.pushToken||"",isEqualPushTokens=pushTokenFromSubscription===pushTokenFromStore,[4,this.data.getIsVapidChanged()];case 6:return isVapidChanged=_a.sent(),[2,!isEqualPushTokens||isVapidChanged]}})})},PushServiceDefault.prototype.getServiceWorkerRegistration=function(){return __awaiter(this,void 0,void 0,function(){var url,_a;return __generator(this,function(_b){switch(_b.label){case 0:return this.registration?[3,5]:[4,this.registerServiceWorker()];case 1:return _b.sent(),[4,this.data.getServiceWorkerUrl()];case 2:return url=_b.sent(),_a=this,[4,navigator.serviceWorker.getRegistration(url)];case 3:return _a.registration=_b.sent(),[4,this.registration.update()];case 4:_b.sent(),_b.label=5;case 5:if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return[2,this.registration]}})})},PushServiceDefault.prototype.registerServiceWorker=function(){return __awaiter(this,void 0,void 0,function(){var url,scope,sdkVersion,serviceWorkerVersion,cleanCache;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getServiceWorkerUrl()];case 1:return url=_a.sent(),[4,this.data.getServiceWorkerScope()];case 2:return scope=_a.sent(),[4,this.data.getSdkVersion()];case 3:return sdkVersion=_a.sent(),[4,this.data.getServiceWorkerVersion()];case 4:return serviceWorkerVersion=_a.sent(),cleanCache="",sdkVersion!==serviceWorkerVersion&&(cleanCache="?cache_clean="+uuid_1.v4()),[4,navigator.serviceWorker.register(""+url+cleanCache,{scope:scope})];case 5:return _a.sent(),[2]}})})},PushServiceDefault.prototype.trySubscribe=function(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,4]),[4,this.subscribePushManager()];case 1:return[2,_a.sent()];case 2:return error_1=_a.sent(),console.error(error_1),[4,this.unsubscribe()];case 3:return _a.sent(),[2,this.subscribePushManager()];case 4:return[2]}})})},PushServiceDefault.prototype.subscribePushManager=function(){return __awaiter(this,void 0,void 0,function(){var registration,applicationServerKey;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return registration=_a.sent(),[4,this.getApplicationServerKey()];case 2:return applicationServerKey=_a.sent(),[2,registration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:applicationServerKey?this.urlBase64ToUint8Array(applicationServerKey):null})]}})})},PushServiceDefault.prototype.getCredentials=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getServiceWorkerRegistration()];case 1:return[4,_a.sent().pushManager.getSubscription()];case 2:return[2,_a.sent()]}})})},PushServiceDefault.prototype.getPushToken=function(subscription){return subscription?subscription.endpoint:""},PushServiceDefault.prototype.getApplicationServerKey=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return 11!==_a.sent()?[2]:[4,this.data.getApplicationServerKey()];case 2:return[2,_a.sent()]}})})},PushServiceDefault.prototype.urlBase64ToUint8Array=function(base64String){for(var base64=(base64String+"=".repeat((4-base64String.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),rawData=window.atob(base64),outputArray=new Uint8Array(rawData.length),i=0;i<rawData.length;++i)outputArray[i]=rawData.charCodeAt(i);return outputArray},PushServiceDefault}();exports.PushServiceDefault=PushServiceDefault},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var Storage_1=__webpack_require__(25),DateModule_1=__webpack_require__(3),InboxMessagesPublic_1=__webpack_require__(13),InboxMessages=function(){function InboxMessages(eventBus,data,api,storage,dateModule){void 0===storage&&(storage=new Storage_1.default),void 0===dateModule&&(dateModule=new DateModule_1.default),this.eventBus=eventBus,this.data=data,this.api=api,this.storage=storage,this.storeName="inboxMessages",this.dateModule=dateModule}return InboxMessages.prototype.getInboxMessages=function(){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.api.getInboxMessages()];case 1:return response=_a.sent(),[4,this.storeGetInboxMessagesRequestParams(response.next,response.new_inbox)];case 2:return _a.sent(),[2,response]}})})},InboxMessages.prototype.storeGetInboxMessagesRequestParams=function(next,newMessagesCount){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,[4,this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp())];case 1:return _a.sent(),[4,this.data.setInboxLastRequestCode(next)];case 2:return _a.sent(),[4,this.data.setInboxNewMessagesCount(newMessagesCount)];case 3:return _a.sent(),[2]}})})},InboxMessages.prototype.putServerMessages=function(messages){return __awaiter(this,void 0,void 0,function(){var putTransactions,_this=this;return __generator(this,function(_a){return putTransactions=messages.map(function(message){return __awaiter(_this,void 0,void 0,function(){var localMessage;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.get(this.storeName,message.inbox_id,{})];case 1:return"status"in(localMessage=_a.sent())&&(message.status=localMessage.status),[2,this.putMessage(message)]}})})}),[2,Promise.all(putTransactions)]})})},InboxMessages.prototype.putMessage=function(message){return this.storage.put(this.storeName,message)},InboxMessages.prototype.putBulkMessages=function(messages){var _this=this,putTransactions=messages.map(function(message){return _this.putMessage(message)});return Promise.all(putTransactions)},InboxMessages.prototype.deleteMessages=function(codes){var _this=this,deleteTransactions=codes.map(function(code){return _this.storage.delete(_this.storeName,code)});return Promise.all(deleteTransactions)},InboxMessages.prototype.deleteExpiredMessages=function(){return __awaiter(this,void 0,void 0,function(){var upperBound,allMessages,codesToDelete;return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,upperBound=this.dateModule.getTimestamp().toString(),[4,this.storage.getAll(this.storeName)];case 1:return allMessages=_a.sent(),codesToDelete=allMessages.filter(function(msg){return msg.rt<upperBound}).map(function(msg){return msg.inbox_id}),[2,this.deleteMessages(codesToDelete)]}})})},InboxMessages.prototype.getMessage=function(code){return this.storage.get(this.storeName,code)},InboxMessages.prototype.getReadOpenMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,_a.sent().filter(function(msg){return 2===msg.status||3===msg.status})]}})})},InboxMessages.prototype.getDeliveredMessages=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.storage.getAll(this.storeName)];case 1:return[2,_a.sent().filter(function(msg){return 1===msg.status})]}})})},InboxMessages.prototype.messagesCount=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.storage.count(this.storeName)]})})},InboxMessages.prototype.getDeliveredMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var deliveredStatus,statusIndexName;return __generator(this,function(_a){return deliveredStatus=1,statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,deliveredStatus)]})})},InboxMessages.prototype.getReadMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var readStatus,statusIndexName;return __generator(this,function(_a){return readStatus=2,statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,readStatus)]})})},InboxMessages.prototype.getDeliveredReadMessagesCount=function(){return __awaiter(this,void 0,void 0,function(){var _a,readStatus,openStatus,keyRange,statusIndexName;return __generator(this,function(_b){return readStatus=(_a=[2,3])[0],openStatus=_a[1],keyRange=IDBKeyRange.bound(readStatus,openStatus),statusIndexName="status",[2,this.storage.countByIndex(this.storeName,statusIndexName,keyRange)]})})},InboxMessages.prototype.updateMessages=function(){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getInboxMessages()];case 1:return response=_a.sent(),[4,this.deleteExpiredMessages()];case 2:return _a.sent(),response.deleted?[4,this.deleteMessages(response.deleted)]:[3,4];case 3:_a.sent(),_a.label=4;case 4:return[4,this.putServerMessages(response.messages)];case 5:return _a.sent(),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new InboxMessagesPublic_1.default(this.data,this.api,this)}),[2]}})})},InboxMessages}();exports.default=InboxMessages},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var version_1=__webpack_require__(10),MigrationExecutor_1=__webpack_require__(11),Store_1=__webpack_require__(26),Storage=function(){function Storage(){}return Storage.prototype.dbVersionChangeHandler=function(db,event){console.info("onversionchange",event),db.close()},Storage.prototype.dbRequestSuccessHandler=function(resolve,event){var _this=this,database=event.target.result;database.onversionchange=function(event){_this.dbVersionChangeHandler(database,event)},resolve(database)},Storage.prototype.dbRequestUpgradeNeededHandler=function(event){var _this=this,database=event.target.result;database.onversionchange=function(event){_this.dbVersionChangeHandler(database,event)},new MigrationExecutor_1.default(database).applyMigrations()},Storage.prototype.getDB=function(){var _this=this;return new Promise(function(resolve,reject){var request=indexedDB.open("PUSHWOOSH_SDK_STORE",version_1.default);request.onsuccess=function(event){_this.dbRequestSuccessHandler(resolve,event)},request.onupgradeneeded=function(event){_this.dbRequestUpgradeNeededHandler(event)},request.onerror=function(){return reject(request.error)}})},Storage.prototype.put=function(storeName,data,key){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).put(data,key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.delete=function(storeName,key){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).delete(key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.get=function(storeName,key,defaultValue){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).get(key,defaultValue)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.getAll=function(storeName){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).getAll()];case 2:return result=_a.sent(),db.close(),[2,result||[]]}})})},Storage.prototype.count=function(storeName,query){return __awaiter(this,void 0,void 0,function(){var db,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),[4,new Store_1.default(db,storeName).count(query)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage.prototype.countByIndex=function(storeName,indexName,key){return __awaiter(this,void 0,void 0,function(){var db,store,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getDB()];case 1:return db=_a.sent(),(store=new Store_1.default(db,storeName)).index=indexName,[4,store.countByIndex(key)];case 2:return result=_a.sent(),db.close(),[2,result]}})})},Storage}();exports.default=Storage},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Store=function(){function Store(db,name){this.name=name,this.store=db.transaction(this.name,"readwrite").objectStore(this.name)}return Object.defineProperty(Store.prototype,"index",{set:function(index){this.store.indexNames.contains(index)?this._index=this.store.index(index):console.warn('Index "'+index+'" in ')},enumerable:!1,configurable:!0}),Store.prototype.writeRequestPromise=function(request,result){return new Promise(function(resolve,reject){request.onsuccess=function(){resolve(result)},request.onerror=function(){reject(request.error)}})},Store.prototype.readRequestPromise=function(request,defaultValue){return new Promise(function(resolve,reject){request.onsuccess=function(event){var target=event.target;resolve(target.result||defaultValue)},request.onerror=function(){reject(request.error)}})},Store.prototype.put=function(data,key){var request=this.store.put(data,key);return this.writeRequestPromise(request,key)},Store.prototype.add=function(data,key){return this.put(data,key)},Store.prototype.delete=function(key){var request=this.store.delete(key);return this.writeRequestPromise(request)},Store.prototype.get=function(key,defaultValue){var request=this.store.get(key);return this.readRequestPromise(request,defaultValue)},Store.prototype.getAll=function(){var cursor=this.store.openCursor(),result=[];return new Promise(function(resolve,reject){cursor.onsuccess=function(event){var cursorResult=event.target.result;cursorResult?(result.push(cursorResult.value),cursorResult.continue()):resolve(result)},cursor.onerror=function(){reject(cursor.error)}})},Store.prototype.count=function(query){var request=this.store.count(query);return this.readRequestPromise(request,0)},Store.prototype.countByIndex=function(key){var request=this._index.count(key);return this.readRequestPromise(request,0)},Store}();exports.default=Store},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE=void 0,exports.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE="pushwoosh-subscription-widget"},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PlatformChecker_1=__webpack_require__(29),PlatformChecker_2=__webpack_require__(29);Object.defineProperty(exports,"PlatformChecker",{enumerable:!0,get:function(){return PlatformChecker_2.PlatformChecker}}),exports.default=PlatformChecker_1.platformChecker},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.platformChecker=exports.PlatformChecker=void 0;var functions_1=__webpack_require__(6),PlatformChecker=function(){function PlatformChecker(global){this.global=global,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(PlatformChecker.prototype,"isEdge",{get:function(){return this._isEdge},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isSafari",{get:function(){return this._isSafari},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isOpera",{get:function(){return this._isOpera},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailablePromise",{get:function(){return this._isAvailablePromise},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailableServiceWorker",{get:function(){return this._isAvailableServiceWorker},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"isAvailableNotifications",{get:function(){return this._isAvailableNotifications},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"platform",{get:function(){return this._platform},enumerable:!1,configurable:!0}),Object.defineProperty(PlatformChecker.prototype,"browserVersion",{get:function(){return this._browserVersion},enumerable:!1,configurable:!0}),PlatformChecker.prototype.isSafariBrowser=function(){return"safari"in this.global&&navigator.userAgent.indexOf("Safari")>-1},PlatformChecker.prototype.isOperaBrowser=function(){return-1!==navigator.userAgent.indexOf("Opera")||-1!==navigator.userAgent.indexOf("OPR")},PlatformChecker.prototype.isEdgeBrowser=function(){return navigator.userAgent.indexOf("Edge")>-1},PlatformChecker.prototype.isFirefoxBrowser=function(){return-1!==navigator.userAgent.toLowerCase().indexOf("firefox")},PlatformChecker.prototype.isChromeBrowser=function(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)&&!this._isOpera&&!this._isEdge},PlatformChecker.prototype.isMacOS=function(){return"platform"in navigator&&-1!==navigator.platform.toLowerCase().indexOf("mac")},PlatformChecker.prototype.canUseServiceWorkers=function(){return!!navigator.serviceWorker&&"PushManager"in this.global&&"Notification"in this.global},PlatformChecker.prototype.canUsePromise=function(){return"Promise"in this.global},PlatformChecker.prototype.canReceiveNotifications=function(){return this._isSafari&&this._isMacOS||this._isAvailableServiceWorker&&!this._isEdge},PlatformChecker.prototype.getPlatformType=function(){var platform=11;switch(!0){case this._isSafari:platform=10;break;case this._isOpera||this._isChrome:platform=11;break;case this._isFirefox:platform=12;break;case this._isEdge:platform=150}return platform},PlatformChecker.prototype.getBrowserVersion=function(){var userAgent=navigator.userAgent,matchOperaVersion=userAgent.match(/\bOPR\/(\d+)/);if(null!==matchOperaVersion)return"Opera "+matchOperaVersion[1];var matchEdgeVersion=userAgent.match(/\bEdge\/(\d+)/);if(null!==matchEdgeVersion)return"Edge "+matchEdgeVersion[1];var matchEdgVersion=userAgent.match(/\bEdg\/(\d+)/);if(null!==matchEdgVersion)return"Edge "+matchEdgVersion[1];var match=userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],_a=(match[0],match[1]),browser=void 0===_a?"":_a;if(/trident/i.test(userAgent)){var matchIeVersion=/trident\/([.\d]+)/gi.exec(userAgent)||[];return"IE "+(("7.0"===matchIeVersion[1]?"11":matchIeVersion[1])||"")}match=match[2]?[browser,match[2]]:[navigator.appName,navigator.appVersion,"-?"];var version=userAgent.match(/version\/([.\d]+)/i);return null!==version&&match.splice(1,1,version[1]),match.join(" ")},PlatformChecker}();exports.PlatformChecker=PlatformChecker,exports.platformChecker=new PlatformChecker(functions_1.getGlobal())},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SUBSCRIBE_WIDGET_DEFAULT_CONFIG=exports.WIDGET_CONTAINER_ID=exports.BELL_POSITION_TOP_LEFT=exports.BELL_POSITION_TOP_RIGHT=exports.BELL_POSITION_BOTTOM_LEFT=exports.BELL_POSITION_BOTTOM_RIGHT=void 0,exports.BELL_POSITION_BOTTOM_RIGHT="bottomRight",exports.BELL_POSITION_BOTTOM_LEFT="bottomLeft",exports.BELL_POSITION_TOP_RIGHT="topRight",exports.BELL_POSITION_TOP_LEFT="topLeft",exports.WIDGET_CONTAINER_ID="pushwooshBellWidget",exports.SUBSCRIBE_WIDGET_DEFAULT_CONFIG={position:exports.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(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Pushwoosh_1=__webpack_require__(32);Object.defineProperty(exports,"Pushwoosh",{enumerable:!0,get:function(){return Pushwoosh_1.default}}),__webpack_require__(37),__webpack_require__(43),__webpack_require__(45)},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var uuid_1=__webpack_require__(7),EventBus_1=__webpack_require__(17),Api_1=__webpack_require__(19),Data_1=__webpack_require__(1),ApiClient_1=__webpack_require__(14),PushService_1=__webpack_require__(33),SubscriptionPromptWidget_1=__webpack_require__(35),CONSTANTS=__webpack_require__(0),functions_1=__webpack_require__(6),PlatformChecker_1=__webpack_require__(28),logger_1=__webpack_require__(4),storage_1=__webpack_require__(2),InboxMessages_1=__webpack_require__(24),InboxMessagesPublic_1=__webpack_require__(13),Pushwoosh=function(){function Pushwoosh(){var _this=this;this.ready=!1,this.addEventHandler=function(name,handler){return _this.eventBus.addEventHandler(name,handler)},this.removeEventHandler=function(name,handler){return _this.eventBus.removeEventHandler(name,handler)},this.dispatchEvent=function(name,payload){return _this.eventBus.dispatchEvent(name,payload)},this.debug={showLog:function(){return __awaiter(this,void 0,void 0,function(){var items;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.log.getAll()];case 1:return items=_a.sent(),console.log(items),[2]}})})},showKeyValues:function(){return __awaiter(this,void 0,void 0,function(){var items;return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.keyValue.getAll()];case 1:return items=_a.sent(),console.log(items),[2]}})})},showMessages:function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,storage_1.message.getAll()];case 1:return _a.sent().forEach(function(i){return console.log(i)}),[2]}})})}},this.eventBus=new EventBus_1.EventBus,this.data=new Data_1.Data,this.apiClient=new ApiClient_1.ApiClient(this.data),this.api=new Api_1.Api(this.eventBus,this.data,this.apiClient),this.platformChecker=new PlatformChecker_1.PlatformChecker(functions_1.getGlobal()),this.inboxModel=new InboxMessages_1.default(this.eventBus,this.data,this.api),this.pwinbox=new InboxMessagesPublic_1.default(this.data,this.api,this.inboxModel),this.onServiceWorkerMessage=this.onServiceWorkerMessage.bind(this),this.subscriptionPromptWidget=new SubscriptionPromptWidget_1.SubscriptionPromptWidget(this.eventBus,this)}return Pushwoosh.prototype.push=function(command){if("function"!=typeof command){if(!Array.isArray(command))throw new Error("Invalid command!");switch(command[0]){case"init":this.initialize(command[1]);break;case CONSTANTS.EVENT_ON_LOAD:case CONSTANTS.EVENT_ON_READY:case CONSTANTS.EVENT_ON_REGISTER:case CONSTANTS.EVENT_ON_SUBSCRIBE:case CONSTANTS.EVENT_ON_UNSUBSCRIBE:case CONSTANTS.EVENT_ON_SW_INIT_ERROR:case CONSTANTS.EVENT_ON_PUSH_DELIVERY:case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:case CONSTANTS.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:case CONSTANTS.EVENT_ON_UPDATE_INBOX_MESSAGES:case CONSTANTS.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:case CONSTANTS.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:case CONSTANTS.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:case CONSTANTS.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:case CONSTANTS.EVENT_ON_PERMISSION_DENIED:case CONSTANTS.EVENT_ON_PERMISSION_PROMPT:case CONSTANTS.EVENT_ON_PERMISSION_GRANTED:this.subscribeToLegacyEvents(command[0],command[1]);break;default:throw new Error("Unknown command!")}}else this.subscribeToLegacyEvents("onReady",command)},Pushwoosh.prototype.subscribe=function(isForceSubscribe){return void 0===isForceSubscribe&&(isForceSubscribe=!0),__awaiter(this,void 0,void 0,function(){var permission_1,permission,isManualUnsubscribed,isDeviceRegister;return __generator(this,function(_a){switch(_a.label){case 0:return this.isCommunicationDisabled&&logger_1.Logger.error("Communication is disabled!"),this.driver.checkIsPermissionDefault()?(this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),[4,this.driver.askPermission()]):[3,2];case 1:_a.sent(),permission_1=this.driver.getPermission(),this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:permission_1}),_a.label=2;case 2:return permission=this.driver.getPermission(),[4,this.data.getStatusManualUnsubscribed()];case 3:return isManualUnsubscribed=_a.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 4:return isDeviceRegister=_a.sent(),permission!==CONSTANTS.PERMISSION_GRANTED?[3,7]:(this.eventBus.dispatchEvent("permission-granted",{}),!isDeviceRegister&&!isManualUnsubscribed||isForceSubscribe?[4,this.driver.subscribe()]:[3,6]);case 5:_a.sent(),_a.label=6;case 6:return this.eventBus.dispatchEvent("subscribe",{}),[2];case 7:return permission!==CONSTANTS.PERMISSION_DENIED?[3,10]:(this.eventBus.dispatchEvent("permission-denied",{}),isDeviceRegister?[4,this.driver.unsubscribe()]:[3,9]);case 8:_a.sent(),_a.label=9;case 9:case 10:return[2]}})})},Pushwoosh.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){var error_1;return __generator(this,function(_a){switch(_a.label){case 0:return _a.trys.push([0,2,,3]),[4,this.driver.unsubscribe()];case 1:return _a.sent(),[3,3];case 2:return error_1=_a.sent(),logger_1.Logger.error(error_1,"Error occurred during the unsubscribe"),[3,3];case 3:return[2]}})})},Pushwoosh.prototype.forceSubscribe=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.subscribe(!0)];case 1:return _a.sent(),[2]}})})},Pushwoosh.prototype.isDeviceRegistered=function(){return localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS)===CONSTANTS.DEVICE_REGISTRATION_STATUS_REGISTERED},Pushwoosh.prototype.isDeviceUnregistered=function(){return localStorage.getItem(CONSTANTS.KEY_DEVICE_REGISTRATION_STATUS)===CONSTANTS.DEVICE_REGISTRATION_STATUS_UNREGISTERED},Pushwoosh.prototype.isSubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},Pushwoosh.prototype.isCommunicationEnabled=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:return[2,!_a.sent()]}})})},Pushwoosh.prototype.setCommunicationEnabled=function(isEnabled){return void 0===isEnabled&&(isEnabled=!0),__awaiter(this,void 0,void 0,function(){var deviceType,isPermissionGranted;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),isPermissionGranted=this.driver.checkIsPermissionGranted(),[4,this.data.setStatusCommunicationDisabled(!isEnabled)];case 2:return _a.sent(),isEnabled?[4,this.data.setStatusDropAllData(!1)]:[3,6];case 3:return _a.sent(),isPermissionGranted?[4,this.api.registerDevice()]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[3,8];case 6:return[4,this.api.unregisterDevice()];case 7:_a.sent(),_a.label=8;case 8:return this.eventBus.dispatchEvent("change-enabled-communication",{isEnabled:isEnabled}),[4,this.api.postEvent(CONSTANTS.EVENT_GDPR_CONSENT,{channel:isEnabled,device_type:deviceType})];case 9:return _a.sent(),[2]}})})},Pushwoosh.prototype.removeAllDeviceData=function(){return __awaiter(this,void 0,void 0,function(){var deviceType;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getDeviceType()];case 1:return deviceType=_a.sent(),[4,this.api.postEvent(CONSTANTS.EVENT_GDPR_DELETE,{status:!0,device_type:deviceType})];case 2:return _a.sent(),[4,this.api.deleteDevice()];case 3:return _a.sent(),[4,this.data.clearAll()];case 4:return _a.sent(),[4,this.data.setStatusDropAllData(!0)];case 5:return _a.sent(),[2]}})})},Pushwoosh.prototype.getHWID=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getHwid()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.getPushToken=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getTokens()];case 1:return[2,_a.sent().pushToken]}})})},Pushwoosh.prototype.getUserId=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getUserId()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.getParams=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.api.getParams()];case 1:return[2,_a.sent()]}})})},Pushwoosh.prototype.isAvailableNotifications=function(){return this.platformChecker.isAvailableNotifications},Pushwoosh.prototype.sendStatisticsVisitedPage=function(){return __awaiter(this,void 0,void 0,function(){var title,_a,origin,pathname,href;return __generator(this,function(_b){switch(_b.label){case 0:return title=window.document.title,_a=window.location,origin=_a.origin,pathname=_a.pathname,href=_a.href,[4,this.api.pageVisit({title:title,url_path:""+origin+pathname,url:href})];case 1:return _b.sent(),[2]}})})},Pushwoosh.prototype.initialize=function(params){return __awaiter(this,void 0,void 0,function(){var manualDebug,applicationCode,notSavedApplicationCode,isChangeApplicationCode,id,config,_a,userIdWasChange,emailWasChange,applicationServerKey,error_2,delayedEvent,type,payload,hashReg,hash;return __generator(this,function(_b){switch(_b.label){case 0:return manualDebug=localStorage.getItem(CONSTANTS.MANUAL_SET_LOGGER_LEVEL),logger_1.Logger.setLevel(manualDebug||params.logLevel||"error"),this.platformChecker.isAvailableNotifications?[4,this.data.getApplicationCode()]:[2];case 1:if(applicationCode=_b.sent(),!params.applicationCode)throw new Error("Can't find application code!");return notSavedApplicationCode=!applicationCode,isChangeApplicationCode=applicationCode&&applicationCode!==params.applicationCode,notSavedApplicationCode||isChangeApplicationCode?[4,this.data.clearAll()]:[3,4];case 2:return _b.sent(),[4,this.data.setApplicationCode(params.applicationCode)];case 3:_b.sent(),_b.label=4;case 4:return[4,this.data.getHwid()];case 5:return _b.sent()?[3,7]:(id=params.applicationCode+"_"+uuid_1.v4(),[4,this.data.setHwid(id)]);case 6:_b.sent(),_b.label=7;case 7:return[4,this.data.setDeviceType(this.platformChecker.getPlatformType())];case 8:return _b.sent(),[4,this.data.setDeviceModel(this.platformChecker.getBrowserVersion())];case 9:return _b.sent(),[4,this.data.setLanguage(params.tags&&params.tags.Language||navigator.language)];case 10:return _b.sent(),[4,this.data.setApiEntrypoint(params.pushwooshUrl||"")];case 11:return _b.sent(),[4,this.data.setApiToken(params.apiToken||"")];case 12:return _b.sent(),[4,this.data.setSdkVersion("3.38.0")];case 13:return _b.sent(),[4,this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt"])];case 14:return config=_b.sent(),this.onGetConfig(config&&config.features),this.subscribeWidgetConfig=__assign({enable:!1},params.subscribeWidget),this.inboxWidgetConfig=__assign({enable:!1},params.inboxWidget),this.subscribePopupConfig=__assign({enable:!1},params.subscribePopup),_a=this,[4,this.data.getStatusCommunicationDisabled()];case 15:return _a.isCommunicationDisabled=_b.sent(),[4,this.open()];case 16:return _b.sent(),[4,this.data.getStatusUserIdWasChanged()];case 17:return userIdWasChange=_b.sent(),!params.userId||"user_id"===params.userId||userIdWasChange?[3,19]:[4,this.api.registerUser(params.userId)];case 18:_b.sent(),_b.label=19;case 19:return[4,this.data.getStatusEmailWasChanged()];case 20:return emailWasChange=_b.sent(),!params.email||""===params.email||emailWasChange?[3,23]:/^\S+@\S+\.\S+$/.test(params.email)?[4,this.api.registerEmail(params.email)]:[3,22];case 21:return _b.sent(),[3,23];case 22:logger_1.Logger.write("error","can't register invalid email: "+params.email),_b.label=23;case 23:return params.tags&&this.api.setTags(params.tags),[4,this.data.getApplicationServerKey()];case 24:return applicationServerKey=_b.sent(),this.platformChecker.isAvailableNotifications&&applicationServerKey?[4,this.initPushNotifications(params)]:[3,26];case 25:_b.sent(),_b.label=26;case 26:return _b.trys.push([26,28,,29]),[4,this.inboxModel.updateMessages()];case 27:return _b.sent(),[3,29];case 28:return error_2=_b.sent(),logger_1.Logger.write("error",error_2),[3,29];case 29:return this.ready=!0,this.eventBus.dispatchEvent("ready",{}),[4,this.data.getDelayedEvent()];case 30:return(delayedEvent=_b.sent())?(type=delayedEvent.type,payload=delayedEvent.payload,[4,this.emitLegacyEventsFromServiceWorker(type,payload)]):[3,33];case 31:return _b.sent(),[4,this.data.setDelayedEvent(null)];case 32:_b.sent(),_b.label=33;case 33: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&&(hashReg=/#P(.*)/,hash=decodeURIComponent(document.location.hash),hashReg.test(hash)&&this.api.pushStat(hashReg.exec(hash)[1]).then(functions_1.clearLocationHash)),[2]}})})},Pushwoosh.prototype.defaultProcess=function(initParams){return __awaiter(this,void 0,void 0,function(){var permission,isCommunicationDisabled,isDropAllData,isNeedResubscribe,features,currentPromptUseCase,autoSubscribe,isManualUnsubscribed,isRegister,widgetConfig,isDefaultUseCase,isNotSetUseCase;return __generator(this,function(_b){switch(_b.label){case 0:return"granted"!==(permission=this.driver.getPermission())?[3,2]:[4,this.data.setLastPermissionStatus(permission)];case 1:_b.sent(),_b.label=2;case 2:return[4,this.data.getStatusCommunicationDisabled()];case 3:return isCommunicationDisabled=_b.sent(),[4,this.data.getStatusDropAllData()];case 4:return isDropAllData=_b.sent(),[4,this.driver.checkIsNeedResubscribe()];case 5:return isNeedResubscribe=_b.sent(),[4,this.data.getFeatures()];case 6:return features=_b.sent(),currentPromptUseCase=features.subscription_prompt&&features.subscription_prompt.use_case,isCommunicationDisabled||isDropAllData?[4,this.unsubscribe()]:[3,8];case 7:return _b.sent(),[2];case 8:return isNeedResubscribe?[4,this.unsubscribe()]:[3,12];case 9:return _b.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 10:return _b.sent(),[4,this.data.setIsVapidChanged(!1)];case 11:_b.sent(),_b.label=12;case 12:return autoSubscribe=initParams.autoSubscribe,[4,this.data.getStatusManualUnsubscribed()];case 13:return isManualUnsubscribed=_b.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 14:switch(isRegister=_b.sent(),permission){case CONSTANTS.PERMISSION_PROMPT:return[3,15];case CONSTANTS.PERMISSION_DENIED:return[3,21];case CONSTANTS.PERMISSION_GRANTED:return[3,24]}return[3,29];case 15:return this.eventBus.dispatchEvent("permission-default",{}),isRegister?[4,this.unsubscribe()]:[3,17];case 16:_b.sent(),_b.label=17;case 17:return[4,this.getWidgetConfig()];case 18:return widgetConfig=_b.sent(),[4,this.checkCanShowByCapping(widgetConfig)];case 19:return _b.sent()?(isDefaultUseCase=currentPromptUseCase===CONSTANTS.SUBSCRIPTION_WIDGET_USE_CASE_DEFAULT,isNotSetUseCase=currentPromptUseCase===CONSTANTS.SUBSCRIPTION_WIDGET_USE_CASE_NOT_SET&&autoSubscribe,(isDefaultUseCase||isNotSetUseCase)&&(this.subscriptionPromptWidget.init(widgetConfig),this.subscriptionPromptWidget.show()),[4,this.updateCappingParams()]):[3,29];case 20:return _b.sent(),[3,29];case 21:return this.eventBus.dispatchEvent("permission-denied",{}),isRegister?[4,this.unsubscribe()]:[3,23];case 22:_b.sent(),_b.label=23;case 23:return[3,29];case 24:return this.eventBus.dispatchEvent("permission-granted",{}),isManualUnsubscribed&&isRegister?[4,this.unsubscribe()]:[3,26];case 25:_b.sent(),_b.label=26;case 26:return!isRegister&&!isManualUnsubscribed||isNeedResubscribe?[4,this.subscribe(!0)]:[3,28];case 27:_b.sent(),_b.label=28;case 28:return[3,29];case 29:return[2]}})})},Pushwoosh.prototype.getWidgetConfig=function(){return __awaiter(this,void 0,void 0,function(){var features,currentConfig,configWithDefaultCapping;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getFeatures()];case 1:return features=_a.sent(),currentConfig=features.subscription_prompt_widget&&features.subscription_prompt_widget.params,configWithDefaultCapping=__assign({cappingCount:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingCount,cappingDelay:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG.cappingDelay},currentConfig),[2,currentConfig?configWithDefaultCapping:CONSTANTS.SUBSCRIPTION_PROMPT_WIDGET_DEFAULT_CONFIG]}})})},Pushwoosh.prototype.checkCanShowByCapping=function(widgetConfig){return __awaiter(this,void 0,void 0,function(){var currentTime,displayCount,lastSeenTime,canShowByCapping,canShowByLastTime;return __generator(this,function(_a){switch(_a.label){case 0:return currentTime=(new Date).getTime(),[4,this.data.getPromptDisplayCount()];case 1:return displayCount=_a.sent(),[4,this.data.getPromptLastSeenTime()];case 2:return lastSeenTime=_a.sent(),canShowByCapping=widgetConfig.cappingCount>displayCount,canShowByLastTime=currentTime-lastSeenTime>widgetConfig.cappingDelay,[2,canShowByCapping&&canShowByLastTime]}})})},Pushwoosh.prototype.updateCappingParams=function(){return __awaiter(this,void 0,void 0,function(){var displayCount,currentTime;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getPromptDisplayCount()];case 1:return displayCount=_a.sent(),currentTime=(new Date).getTime(),[4,this.data.setPromptDisplayCount(displayCount+1)];case 2:return _a.sent(),[4,this.data.setPromptLastSeenTime(currentTime)];case 3:return _a.sent(),[2]}})})},Pushwoosh.prototype.onServiceWorkerMessage=function(event){var _a=(event||{}).data,_b=(void 0===_a?{}:_a)||{},_c=_b.type,type=void 0===_c?"":_c,_d=_b.payload,payload=void 0===_d?{}:_d;this.emitLegacyEventsFromServiceWorker(type,payload)},Pushwoosh.prototype.open=function(isForce){return __awaiter(this,void 0,void 0,function(){var lastApplicationOpenTime,currentTime,isSendingPeriodExceeded;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getLastOpenApplicationTime()];case 1:return lastApplicationOpenTime=_a.sent(),currentTime=Date.now(),lastApplicationOpenTime||(lastApplicationOpenTime=0),isSendingPeriodExceeded=currentTime-lastApplicationOpenTime<CONSTANTS.PERIOD_SEND_APP_OPEN,isForce||!isSendingPeriodExceeded?[4,this.data.setLastOpenApplicationTime(currentTime)]:[2];case 2:return _a.sent(),[4,this.api.applicationOpen()];case 3:return _a.sent(),[2]}})})},Pushwoosh.prototype.onGetConfig=function(features){return __awaiter(this,void 0,void 0,function(){var previousServerKey;return __generator(this,function(_b){switch(_b.label){case 0:return[4,this.data.setFeatures(features)];case 1:return _b.sent(),features?features.page_visit&&features.page_visit.enabled?[4,storage_1.keyValue.set(CONSTANTS.PAGE_VISITED_URL,features.page_visit.entrypoint)]:[3,3]:[3,8];case 2:_b.sent(),this.sendStatisticsVisitedPage(),_b.label=3;case 3:return features.events&&features.events.length&&features.events.some(function(event){return event===CONSTANTS.EVENT_PW_SITE_OPENED})&&this.sendPostEventVisitedPage(),features.vapid_key?[4,this.data.getApplicationServerKey()]:[3,8];case 4:return previousServerKey=_b.sent(),[4,this.data.setApplicationServerKey(features.vapid_key)];case 5:return _b.sent(),previousServerKey!==features.vapid_key?[4,this.data.setIsVapidChanged(!0)]:[3,7];case 6:_b.sent(),_b.label=7;case 7:_b.label=8;case 8:return[2]}})})},Pushwoosh.prototype.initPushNotifications=function(params){return __awaiter(this,void 0,void 0,function(){var error_3;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setDefaultNotificationImage(params.defaultNotificationImage)];case 1:return _a.sent(),[4,this.data.setDefaultNotificationTitle(params.defaultNotificationTitle)];case 2:return _a.sent(),[4,this.data.setServiceWorkerUrl(params.serviceWorkerUrl)];case 3:return _a.sent(),[4,this.data.setServiceWorkerScope(params.scope)];case 4:return _a.sent(),[4,this.data.setInitParams(__assign({autoSubscribe:!0},params))];case 5:return _a.sent(),[4,this.initDriver()];case 6:_a.sent(),_a.label=7;case 7:return _a.trys.push([7,9,,10]),[4,this.defaultProcess(params)];case 8:return _a.sent(),[3,10];case 9:return error_3=_a.sent(),logger_1.Logger.error(error_3,"Internal error: defaultProcess fail"),[3,10];case 10:return[2]}})})},Pushwoosh.prototype.initDriver=function(){return __awaiter(this,void 0,void 0,function(){var webSitePushId;return __generator(this,function(_a){switch(_a.label){case 0:return this.platformChecker.isSafari?[4,this.data.getInitParams()]:[3,2];case 1:return(webSitePushId=_a.sent().safariWebsitePushID)?(this.driver=new PushService_1.PushServiceSafari(this.api,this.data,{webSitePushId:webSitePushId}),[2]):(logger_1.Logger.info("For work with Safari Push Notification add safariWebsitePushID to initParams!"),[2]);case 2:return this.platformChecker.isAvailableServiceWorker?(this.driver=new PushService_1.PushServiceDefault(this.api,this.data,{}),[2]):[2]}})})},Pushwoosh.prototype.sendPostEventVisitedPage=function(){return __awaiter(this,void 0,void 0,function(){var title,href;return __generator(this,function(_a){return title=window.document.title,href=window.location.href,this.api.postEvent(CONSTANTS.EVENT_PW_SITE_OPENED,{url:href,title:title,device_type:this.platformChecker.platform}),[2]})})},Pushwoosh.prototype.subscribeToLegacyEvents=function(type,handler){var _this=this;switch(type){case CONSTANTS.EVENT_ON_LOAD:handler();break;case CONSTANTS.EVENT_ON_READY:if(this.ready){handler(this.api);break}this.eventBus.addEventHandler("ready",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_REGISTER:this.eventBus.addEventHandler("register",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_SUBSCRIBE:this.eventBus.addEventHandler("subscribe",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_UNSUBSCRIBE:this.eventBus.addEventHandler("unsubscribe",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_SW_INIT_ERROR:this.eventBus.addEventHandler("initialize-service-worker-error",function(_a){var error=_a.error;return handler(_this.api,error)});break;case CONSTANTS.EVENT_ON_PUSH_DELIVERY:this.eventBus.addEventHandler("receive-push",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.addEventHandler("open-notification",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.addEventHandler("hide-notification",function(_a){var notification=_a.notification;return handler(_this.api,notification)});break;case CONSTANTS.EVENT_ON_CHANGE_COMMUNICATION_ENABLED:this.eventBus.addEventHandler("change-enabled-communication",function(_a){var isEnabled=_a.isEnabled;return handler(_this.api,isEnabled)});break;case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.addEventHandler("receive-inbox-message",function(_a){var message=_a.message;return handler(_this.api,message)});break;case CONSTANTS.EVENT_ON_UPDATE_INBOX_MESSAGES:this.eventBus.addEventHandler("update-inbox-messages",function(_a){var messages=_a.messages;return handler(_this.api,messages)});break;case CONSTANTS.EVENT_ON_SHOW_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("show-notification-permission-dialog",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_HIDE_NOTIFICATION_PERMISSION_DIALOG:this.eventBus.addEventHandler("hide-notification-permission-dialog",function(_a){var permission=_a.permission;return handler(_this.api,permission)});break;case CONSTANTS.EVENT_ON_SHOW_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("show-subscription-widget",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_HIDE_SUBSCRIPTION_WIDGET:this.eventBus.addEventHandler("hide-subscription-widget",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_DENIED:this.eventBus.addEventHandler("permission-denied",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_PROMPT:this.eventBus.addEventHandler("permission-default",function(){return handler(_this.api)});break;case CONSTANTS.EVENT_ON_PERMISSION_GRANTED:this.eventBus.addEventHandler("permission-granted",function(){return handler(_this.api)})}},Pushwoosh.prototype.emitLegacyEventsFromServiceWorker=function(type,payload){switch(type){case CONSTANTS.EVENT_ON_PUSH_DELIVERY:this.eventBus.dispatchEvent("receive-push",{notification:payload});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLICK:this.eventBus.dispatchEvent("open-notification",{notification:payload});break;case CONSTANTS.EVENT_ON_NOTIFICATION_CLOSE:this.eventBus.dispatchEvent("hide-notification",{notification:payload});break;case CONSTANTS.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE:this.eventBus.dispatchEvent("receive-inbox-message",{message:payload})}},Pushwoosh}();exports.default=Pushwoosh},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var PushServiceDefault_1=__webpack_require__(23);Object.defineProperty(exports,"PushServiceDefault",{enumerable:!0,get:function(){return PushServiceDefault_1.PushServiceDefault}});var PushServiceSafari_1=__webpack_require__(34);Object.defineProperty(exports,"PushServiceSafari",{enumerable:!0,get:function(){return PushServiceSafari_1.PushServiceSafari}})},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.PushServiceSafari=void 0;var logger_1=__webpack_require__(4),CONSTANTS=__webpack_require__(0),PushServiceSafari=function(){function PushServiceSafari(api,data,config){this.api=api,this.config=config,this.data=data}return PushServiceSafari.prototype.getPermission=function(){return this.getPermissionInfo().permission},PushServiceSafari.prototype.checkIsPermissionGranted=function(){return this.getPermission()===CONSTANTS.PERMISSION_GRANTED},PushServiceSafari.prototype.checkIsPermissionDefault=function(){return this.getPermission()===CONSTANTS.PERMISSION_PROMPT},PushServiceSafari.prototype.checkIsManualUnsubscribed=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getStatusManualUnsubscribed()];case 1:return[2,_a.sent()]}})})},PushServiceSafari.prototype.askPermission=function(){return __awaiter(this,void 0,void 0,function(){var application,hwid,payload,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return application=_a.sent(),[4,this.data.getHwid()];case 2:return hwid=_a.sent(),payload={application:application,hwid:hwid},[2,new Promise(function(resolve){safari.pushNotification.requestPermission(_this.config.entrypoint||"https://cp.pushwoosh.com/json/1.3/safari",_this.config.webSitePushId,payload,function(){return resolve()})})]}})})},PushServiceSafari.prototype.getTokens=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.data.getTokens()]})})},PushServiceSafari.prototype.subscribe=function(){return __awaiter(this,void 0,void 0,function(){var deviceToken;return __generator(this,function(_a){switch(_a.label){case 0:return this.checkIsPermissionGranted()?[4,this.getPermissionInfo()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return deviceToken=_a.sent().deviceToken,[4,this.data.setTokens({pushToken:deviceToken})];case 2:return _a.sent(),[4,this.api.registerDevice()];case 3:return _a.sent(),[2]}})})},PushServiceSafari.prototype.unsubscribe=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.setTokens({})];case 1:return _a.sent(),[4,this.data.setStatusManualUnsubscribed(!0)];case 2:return _a.sent(),[4,this.api.unregisterDevice()];case 3:return _a.sent(),[2]}})})},PushServiceSafari.prototype.checkIsRegister=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,this.api.checkDeviceSubscribeForPushNotifications()]})})},PushServiceSafari.prototype.checkIsNeedResubscribe=function(){return __awaiter(this,void 0,void 0,function(){var savedWebSitePushId,isChangeWebSitePushId,lastPermission,permission;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getWebSitePushId()];case 1:return savedWebSitePushId=_a.sent(),isChangeWebSitePushId=void 0!==savedWebSitePushId&&this.config.webSitePushId!==savedWebSitePushId,[4,this.data.setWebSitePushId(this.config.webSitePushId)];case 2:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 3:return lastPermission=_a.sent(),permission=this.getPermission(),lastPermission===permission?[3,5]:[4,this.data.setLastPermissionStatus(permission)];case 4:return _a.sent(),[2,!0];case 5:return[2,isChangeWebSitePushId]}})})},PushServiceSafari.prototype.getPermissionInfo=function(){return safari.pushNotification.permission(this.config.webSitePushId)},PushServiceSafari}();exports.PushServiceSafari=PushServiceSafari},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.SubscriptionPromptWidget=void 0;var SubscriptionPromptWidget_helpers_1=__webpack_require__(36),SubscriptionPromptWidget_constants_1=__webpack_require__(27),SubscriptionPromptWidget=function(){function SubscriptionPromptWidget(eventBus,pw){this.eventBus=eventBus,this.pw=pw}return SubscriptionPromptWidget.prototype.init=function(params){if(!this.getRootElement()){var html=SubscriptionPromptWidget_helpers_1.getHTML(params),styles=SubscriptionPromptWidget_helpers_1.getStyles(params);document.body.insertAdjacentHTML("beforeend",html),document.head.appendChild(styles)}this.addEventListeners()},SubscriptionPromptWidget.prototype.show=function(){var rootElement=this.getRootElementWithCheckExist();this.eventBus.dispatchEvent("show-subscription-widget",{}),rootElement.classList.add(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")},SubscriptionPromptWidget.prototype.hide=function(){var rootElement=this.getRootElementWithCheckExist();rootElement.classList.contains(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show")&&(this.eventBus.dispatchEvent("hide-subscription-widget",{}),rootElement.classList.remove(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show"))},SubscriptionPromptWidget.prototype.getRootElement=function(){return document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-root")},SubscriptionPromptWidget.prototype.getRootElementWithCheckExist=function(){var element=this.getRootElement();if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root", please use method init first.');return element},SubscriptionPromptWidget.prototype.getDeclineButtonWithCheckExist=function(){var element=document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-decline");if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline", please use method init first.');return element},SubscriptionPromptWidget.prototype.getAcceptButtonWithCheckExist=function(){var element=document.getElementById(SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"-accept");if(!element)throw new Error("Can't find element by id \""+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept", please use method init first.');return element},SubscriptionPromptWidget.prototype.addEventListeners=function(){var _this=this,rootElement=this.getRootElementWithCheckExist(),declineElement=this.getDeclineButtonWithCheckExist(),acceptElement=this.getAcceptButtonWithCheckExist();document.addEventListener("click",function(event){rootElement.contains(event.target)||_this.hide()}),declineElement.addEventListener("click",function(){_this.hide()}),acceptElement.addEventListener("click",function(){_this.hide(),_this.pw.subscribe()})},SubscriptionPromptWidget}();exports.SubscriptionPromptWidget=SubscriptionPromptWidget},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStyles=exports.getHTML=void 0;var SubscriptionPromptWidget_constants_1=__webpack_require__(27);exports.getHTML=function(params){return'\n <div id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-root" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'">\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__body">\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__header">\n '+params.headerText+'\n </div>\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__description">\n '+params.subheaderText+'\n </div>\n <div class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__controls">\n <button type="button" id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-decline" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control "+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__control_decline">\n '+params.buttonCancelText+'\n </button>\n <button type="button" id="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'-accept" class="'+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control "+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+'__control_accept">\n '+params.buttonAcceptText+"\n </button>\n </div>\n </div>\n </div>\n "},exports.getStyles=function(params){var styles=document.createElement("style");return styles.innerHTML="\n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+" * {\n box-sizing: border-box!important;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+" {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 320px;\n display: none;\n z-index: 2147483648;\n opacity: 0.99;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"_show {\n display: block;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__body {\n width: 320px;\n background-color: "+(params.backgroundColor?params.backgroundColor:"#FFFFFF")+";\n box-shadow: 0 9px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n padding: 20px 20px 12px;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__header {\n color: "+params.headerTextColor+";\n font-size: 18px;\n font-weight: bold; \n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__description {\n color: "+params.subheaderTextColor+";\n font-size: 14px;\n line-height: 1.5;\n margin-top: 14px;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__description:empty {\n display: none;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-end;\n margin: 20px 0 0;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control {\n -webkit-appearance: none;\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n padding: 0 20px;\n height: 32px;\n cursor: pointer;\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control_decline {\n color: "+params.buttonCancelTextColor+";\n background-color: "+params.buttonCancelBackgroundColor+";\n border-radius: "+params.buttonCancelRound+";\n border-color: "+params.buttonCancelBorderColor+";\n }\n \n ."+SubscriptionPromptWidget_constants_1.SUBSCRIPTION_PROMPT_WIDGET_NAMESPACE+"__control_accept {\n color: "+params.buttonAcceptTextColor+";\n background-color: "+params.buttonAcceptBackgroundColor+";\n border-radius: "+params.buttonAcceptRound+";\n border-color: "+params.buttonAcceptBorderColor+";\n margin: 0 0 0 12px;\n }\n ",styles}},function(module,exports,__webpack_require__){"use strict";var __awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):function(value){return value instanceof P?value:new P(function(resolve){resolve(value)})}(result.value).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),PlatformChecker_1=__webpack_require__(28),constants_2=__webpack_require__(30),positioning_1=__webpack_require__(38),bell_1=__webpack_require__(39),storage_1=__webpack_require__(2),SubscribeWidget=function(){function SubscribeWidget(pw){var _this=this;if(this.pw=pw,PlatformChecker_1.default.isAvailableNotifications){this.clickBell=this.clickBell.bind(this),this.onSubscribeEvent=this.onSubscribeEvent.bind(this),this.onUnsubscribeEvent=this.onUnsubscribeEvent.bind(this),this.onPermissionDeniedEvent=this.onPermissionDeniedEvent.bind(this),this.clickOutOfPopover=this.clickOutOfPopover.bind(this);var tooltipText=Object.assign(constants_2.SUBSCRIBE_WIDGET_DEFAULT_CONFIG.tooltipText,pw.subscribeWidgetConfig.tooltipText);this.config=Object.assign({},constants_2.SUBSCRIBE_WIDGET_DEFAULT_CONFIG,pw.subscribeWidgetConfig),this.config.tooltipText=tooltipText,pw.isSubscribed().then(function(isSubscribed){isSubscribed||_this.render()})}else console.warn("Browser does not support push notifications")}return SubscribeWidget.prototype.addStylesToElement=function(styles,element){Object.keys(styles).forEach(function(st){element.style[st]=styles[st]})},SubscribeWidget.prototype.createContainer=function(){var container=document.createElement("div");container.id=constants_2.WIDGET_CONTAINER_ID,container.className="pushwoosh-subscribe-widget";var position=positioning_1.default.getBellPosition(this.config.position,this.config.indent),styles=Object.assign({zIndex:this.config.zIndex},position);return this.addStylesToElement(styles,container),container},SubscribeWidget.prototype.createStyle=function(){var styles=__webpack_require__(40),styleNode=document.createElement("style");return styleNode.innerHTML=styles,styleNode},SubscribeWidget.prototype.createBell=function(){var bell,config=this.config;return config.buttonImage?(bell=document.createElement("img")).src=config.buttonImage:(bell=document.createElement("div"),this.addStylesToElement({backgroundColor:config.bgColor,boxShadow:config.shadow,lineHeight:config.size,border:config.bellButtonBorder},bell),bell.innerHTML=bell_1.default(config.bellColor,config.bellStrokeColor)),this.addStylesToElement({width:config.size,height:config.size},bell),bell.className="pushwoosh-subscribe-widget__bell-button",bell},SubscribeWidget.prototype.createTooltip=function(){return __awaiter(this,void 0,void 0,function(){var tooltip,_a,position,modification,_b,_c;return __generator(this,function(_d){switch(_d.label){case 0:return tooltip=document.createElement("div"),_a=positioning_1.default.getTooltipPosition(this.config.position,this.config.size),position=_a[0],modification=_a[1],tooltip.className="pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__"+modification,this.addStylesToElement(position,tooltip),_c=(_b=tooltip).appendChild,[4,this.createTooltipContent()];case 1:return _c.apply(_b,[_d.sent()]),[2,tooltip]}})})},SubscribeWidget.prototype.createTooltipContent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return tooltipContent=document.createElement("div"),_a=tooltipContent,[4,this.tooltipTextFactory()];case 1:return _a.innerText=_b.sent(),tooltipContent.className="pushwoosh-subscribe-widget__tooltip-content",[2,tooltipContent]}})})},SubscribeWidget.prototype.tooltipTextFactory=function(){return __awaiter(this,void 0,void 0,function(){var permission,tooltipText,isManuallyUnsubscribed;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.pw.driver.getPermission()];case 1:return permission=_a.sent(),tooltipText=this.config.tooltipText,[4,storage_1.keyValue.get(constants_1.MANUAL_UNSUBSCRIBE)];case 2:switch(isManuallyUnsubscribed=_a.sent(),permission){case constants_1.PERMISSION_GRANTED:return[2,isManuallyUnsubscribed?tooltipText.needSubscribe:tooltipText.alreadySubscribed];case constants_1.PERMISSION_PROMPT:return[2,tooltipText.needSubscribe];case constants_1.PERMISSION_DENIED:return[2,tooltipText.blockSubscribe];default:return[2,tooltipText.needSubscribe]}return[2]}})})},SubscribeWidget.prototype.createPopover=function(){var popoverContentWrapper=document.createElement("div"),popover=document.createElement("div"),_a=positioning_1.default.getPopoverPosition(this.config.position,this.config.size),position=_a[0],modification=_a[1];popover.className="pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__"+modification,popoverContentWrapper.className="pushwoosh-subscribe-widget__popover-content-wrapper",this.style.innerHTML+=positioning_1.default.getPopoverArrowPosition(this.config.position,this.config.size);var styles=Object.assign({maxWidth:"calc(100vw - "+this.config.indent+" - "+this.config.indent+")"},position);return this.addStylesToElement(styles,popover),popoverContentWrapper.appendChild(this.createPopoverContent()),popover.appendChild(popoverContentWrapper),popover},SubscribeWidget.prototype.getBrowserName=function(){return PlatformChecker_1.default.isOpera?"opera":11===PlatformChecker_1.default.platform&&navigator.userAgent.match(/Android/i)?"mobileChrome":12===PlatformChecker_1.default.platform?"firefox":10===PlatformChecker_1.default.platform?"safari":150===PlatformChecker_1.default.platform?"edge":"chrome"},SubscribeWidget.prototype.createPopoverContent=function(){var config=this.config,popoverContent=document.createElement("div");popoverContent.className="pushwoosh-subscribe-widget__popover-content";var browser=this.getBrowserName(),userImageSrc=config.contentImages&&config.contentImages[browser];if(userImageSrc){var image=document.createElement("img");image.src=userImageSrc,popoverContent.appendChild(image)}else{var standardImage={opera:"opera",mobileChrome:"mobile_chrome",firefox:"FF",safari:"safari"}[browser]||"chrome";[{src:this.getImageSrc(standardImage),width:500,height:130},{src:this.getImageSrc(standardImage+"_unlock"),width:500,height:230}].forEach(function(imageAttrs){var image=document.createElement("img");Object.assign(image,imageAttrs),popoverContent.appendChild(image)})}return popoverContent},SubscribeWidget.prototype.getImageSrc=function(img){return"https://cdn.pushwoosh.com/webpush/img/"+img+".jpg"},SubscribeWidget.prototype.render=function(){return __awaiter(this,void 0,void 0,function(){var bell,_a,_b;return __generator(this,function(_c){switch(_c.label){case 0:return this.widget=this.createContainer(),this.style=this.createStyle(),bell=this.createBell(),_a=this,[4,this.createTooltip()];case 1:return _a.tooltip=_c.sent(),_b=this,[4,this.createPopover()];case 2:return _b.popover=_c.sent(),this.widget.appendChild(this.style),this.widget.appendChild(bell),this.widget.appendChild(this.tooltip),this.widget.appendChild(this.popover),document.body.appendChild(this.widget),this.pw.push(["onSubscribe",this.onSubscribeEvent]),this.pw.push(["onUnsubscribe",this.onUnsubscribeEvent]),this.pw.push(["onPermissionDenied",this.onPermissionDeniedEvent]),this.addEventListeners(),[2]}})})},SubscribeWidget.prototype.addEventListeners=function(){this.widget.addEventListener("click",this.clickBell),window.addEventListener("click",this.clickOutOfPopover)},SubscribeWidget.prototype.toggleHelpPopover=function(){this.popover.classList.toggle("pushwoosh-subscribe-widget__popover__visible")},SubscribeWidget.prototype.clickBell=function(){return __awaiter(this,void 0,void 0,function(){var permission;return __generator(this,function(_b){switch(_b.label){case 0:switch(permission=this.pw.driver.getPermission(),permission){case constants_1.PERMISSION_GRANTED:return[3,1];case constants_1.PERMISSION_PROMPT:return[3,3];case constants_1.PERMISSION_DENIED:return[3,5]}return[3,6];case 1:return[4,this.pw.subscribe()];case 2:return _b.sent(),[3,7];case 3:return[4,this.pw.subscribe()];case 4:return _b.sent(),[3,7];case 5:return this.toggleHelpPopover(),[3,7];case 6:console.warn("Unknown browser notification permission"),_b.label=7;case 7:return[2]}})})},SubscribeWidget.prototype.onSubscribeEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_this=this;return __generator(this,function(_a){return null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(tooltipContent.innerText=this.config.tooltipText.successSubscribe,this.tooltip.classList.add("pushwoosh-subscribe-widget__tooltip__visible"),setTimeout(function(){return __awaiter(_this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return this.tooltip.classList.remove("pushwoosh-subscribe-widget__tooltip__visible"),_a=tooltipContent,[4,this.tooltipTextFactory()];case 1:return _a.innerText=_b.sent(),this.widget.classList.add("pushwoosh-subscribe-widget__subscribed"),[2]}})})},2e3),[2])})})},SubscribeWidget.prototype.onPermissionDeniedEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return this.addEventListeners(),null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(_a=tooltipContent,[4,this.tooltipTextFactory()]);case 1:return _a.innerText=_b.sent(),[2]}})})},SubscribeWidget.prototype.clickOutOfPopover=function(ev){this.popover.classList.contains("pushwoosh-subscribe-widget__popover__visible")&&!ev.target.classList.contains("pushwoosh-subscribe-widget__popover")&&null===ev.target.closest(".pushwoosh-subscribe-widget__popover")&&!ev.target.classList.contains("pushwoosh-subscribe-widget__bell-button")&&null===ev.target.closest(".pushwoosh-subscribe-widget__bell-button")&&this.popover.classList.remove("pushwoosh-subscribe-widget__popover__visible")},SubscribeWidget.prototype.onUnsubscribeEvent=function(){return __awaiter(this,void 0,void 0,function(){var tooltipContent,_a;return __generator(this,function(_b){switch(_b.label){case 0:return null===(tooltipContent=this.tooltip.querySelector("div"))?[2]:(_a=tooltipContent,[4,this.tooltipTextFactory()]);case 1:return _a.innerText=_b.sent(),[2]}})})},SubscribeWidget}();document.addEventListener("pushwoosh.initialized",function(ev){ev.detail.pw.subscribeWidgetConfig.enable&&new SubscribeWidget(ev.detail.pw)})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(30),Positioning=function(){function Positioning(){}return Positioning.getBellPosition=function(position,indent){var positionStyles;switch(position){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={top:"auto",left:"auto",bottom:indent,right:indent};break;case constants_1.BELL_POSITION_BOTTOM_LEFT:positionStyles={top:"auto",left:indent,bottom:indent,right:"auto"};break;case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={top:indent,left:indent,bottom:"auto",right:"auto"};break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={top:indent,left:"auto",bottom:"auto",right:indent};break;default:positionStyles={top:"auto",left:"auto",bottom:indent,right:indent}}return positionStyles},Positioning.getTooltipPosition=function(bellPosition,bellSize){var positionStyles,tooltipModification,increaseIndent=parseInt(bellSize)+12+"px";switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={right:increaseIndent},tooltipModification="right";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={left:increaseIndent},tooltipModification="left";break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={right:increaseIndent},tooltipModification="right";break;default:positionStyles={right:increaseIndent},tooltipModification="right"}return[positionStyles,tooltipModification]},Positioning.getPopoverPosition=function(bellPosition,bellSize){var positionStyles,popoverModification,increaseIndent=parseInt(bellSize)+15+"px";switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:positionStyles={bottom:increaseIndent,right:"0",left:"auto",top:"auto"},popoverModification="bottom";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:positionStyles={bottom:increaseIndent,left:"0",right:"auto",top:"auto"},popoverModification="bottom";break;case constants_1.BELL_POSITION_TOP_LEFT:positionStyles={top:increaseIndent,left:"0",right:"auto",bottom:"auto"},popoverModification="top";break;case constants_1.BELL_POSITION_TOP_RIGHT:positionStyles={top:increaseIndent,right:"0",left:"auto",bottom:"auto"},popoverModification="top";break;default:positionStyles={bottom:increaseIndent,right:"0",left:"auto",top:"auto"},popoverModification="bottom"}return[positionStyles,popoverModification]},Positioning.getPopoverArrowPosition=function(bellPosition,bellSize){var arrowAdditionalStyles;switch(bellPosition){case constants_1.BELL_POSITION_BOTTOM_RIGHT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px";break;case constants_1.BELL_POSITION_BOTTOM_LEFT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: "+(parseInt(bellSize)/2-12)+"px";break;case constants_1.BELL_POSITION_TOP_LEFT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: "+(parseInt(bellSize)/2-12)+"px";break;case constants_1.BELL_POSITION_TOP_RIGHT:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px";break;default:arrowAdditionalStyles="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: "+(parseInt(bellSize)/2-4)+"px"}return arrowAdditionalStyles},Positioning}();exports.default=Positioning},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=function(fillColor,strokeColor){return'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n id="Capa_1"\n x="0px"\n y="0px"\n viewBox="0 0 346.013 346.013"\n style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n xml:space="preserve"\n inkscape:version="0.91 r13725"\n sodipodi:docname="alarm_white.svg"><metadata\n id="metadata51"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs49" /><sodipodi:namedview\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1618"\n inkscape:window-height="828"\n id="namedview47"\n showgrid="false"\n inkscape:zoom="0.6820553"\n inkscape:cx="173.0065"\n inkscape:cy="173.0065"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="0"\n inkscape:current-layer="g3" /><g\n id="g3"><path\n d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n id="path5"\n inkscape:connector-curvature="0"\n vector-effect="non-scaling-stroke"\n style="fill:'+fillColor+"; stroke: "+strokeColor+'; stroke-width: 1; " /><path\n vector-effect="non-scaling-stroke"\n d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n id="path7"\n inkscape:connector-curvature="0"\n style="fill:'+fillColor+"; stroke: "+strokeColor+'; stroke-width: 1;" /></g><g\n id="g17" /><g\n id="g19" /><g\n id="g21" /><g\n id="g23" /><g\n id="g25" /><g\n id="g27" /><g\n id="g29" /><g\n id="g31" /><g\n id="g33" /><g\n id="g35" /><g\n id="g37" /><g\n id="g39" /><g\n id="g41" /><g\n id="g43" /><g\n id="g45" /></svg>'}},function(module,exports,__webpack_require__){var result=__webpack_require__(41);result&&result.__esModule&&(result=result.default),module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(42)(!1)).push([module.i,'/* Widget */\n.pushwoosh-subscribe-widget {\n position: fixed;\n display: block;\n -webkit-transform: translate3d(0, 0, 0);\n transform: translate3d(0, 0, 0);\n}\n\n.pushwoosh-subscribe-widget__subscribed {\n display: none;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {\n -webkit-border-radius: 50%;\n border-radius: 50%;\n cursor: pointer;\n font-size: 0;\n text-align: center;\n -webkit-transform: scale(0.9) translate3d(0, 0, 0);\n transform: scale(0.9) translate3d(0, 0, 0);\n -webkit-transition: -webkit-transform .3s ease-in-out;\n transition: -webkit-transform .3s ease-in-out;\n -o-transition: transform .3s ease-in-out;\n transition: transform .3s ease-in-out;\n transition: transform .3s ease-in-out, -webkit-transform .3s ease-in-out;\n position: relative;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {\n -webkit-transform: scale(1);\n -ms-transform: scale(1);\n transform: scale(1);\n}\n\n/* Tooltip */\n.pushwoosh-subscribe-widget__tooltip {\n position: absolute;\n height: 48px;\n max-width: 300px;\n min-width: 200px;\n padding: 5px 7px;\n background-color: #3b444b;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n line-height: 38px;\n font-size: 0;\n font-weight: normal;\n visibility: hidden;\n opacity: 0;\n -webkit-transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n -o-transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n top: 50%;\n -webkit-transform: translate(0, -50%);\n -ms-transform: translate(0, -50%);\n transform: translate(0, -50%);\n -webkit-box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after,\n.pushwoosh-subscribe-widget__tooltip__left:after {\n content: "";\n top: 50%;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n background: #3b444b;\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after {\n left: calc(100% - 7px);\n border-top: 5px solid #3b444b;\n border-left: 5px solid #3b444b;\n border-right: 5px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__tooltip__left:after {\n left: -7px;\n border-top: 5px solid #3b444b;\n border-right: 5px solid #3b444b;\n border-left: 5px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n -webkit-box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,\n.pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n -webkit-transition-delay: 0s;\n -o-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {\n display: inline-block;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1.4;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 5px;\n -o-text-overflow: ellipsis;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n/* Popover */\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {\n position: absolute;\n right: auto;\n -webkit-box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n background: #9ca8b1;\n visibility: hidden;\n opacity: 0;\n -webkit-transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n -o-transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n -webkit-transition-delay: 0s;\n -o-transition-delay: 0s;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after,\n.pushwoosh-subscribe-widget__popover__top:after {\n content: "";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-right: 8px solid transparent;\n border-left: 8px solid #9ca8b1;\n background: #9ca8b1;\n -webkit-transform-origin: 0 0;\n -ms-transform-origin: 0 0;\n transform-origin: 0 0;\n -webkit-transform: rotate(-45deg);\n -ms-transform: rotate(-45deg);\n transform: rotate(-45deg);\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after {\n border-bottom: 8px solid #9ca8b1;\n border-top: 8px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n bottom: -16px;\n}\n\n.pushwoosh-subscribe-widget__popover__top:after {\n top: 0;\n border-top: 8px solid #9ca8b1;\n border-bottom: 8px solid transparent;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n -webkit-box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__popover-content-wrapper {\n overflow: auto;\n max-width: 100%;\n}\n\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n padding: 14px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n float: left;\n min-width: 100%;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n display: block;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-bottom: 14px;\n}\n\n@media (max-width: 767px) and (orientation: portrait) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 0;\n margin-bottom: 14px;\n }\n}\n@media (max-width: 767px) and (orientation: landscape) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 14px;\n margin-bottom: 0;\n }\n}\n',""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var pwInboxWidget=__webpack_require__(44);document.addEventListener("pushwoosh.initialized",function(ev){ev.detail.pw.pwinbox&&ev.detail.pw.inboxWidgetConfig.enable&&(ev.detail.pw.pwinboxWidget=new pwInboxWidget.PWInboxWidget(ev.detail.pw))})},function(module,exports,__webpack_require__){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=2)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(1);exports.isElementFixed=function isElementFixed(element){var isFixed="fixed"===window.getComputedStyle(element).position;return!isFixed&&element.parentElement&&(isFixed=isElementFixed(element.parentElement)),isFixed},exports.getGlobal=function(){return globalThis},exports.getMessageTime=function(date){var localDate=new Date(date),localTime=localDate.getHours()+localDate.getTimezoneOffset()/60;localDate.setHours(localTime);var gap=(new Date).getTime()-localDate.getTime();return gap<=6e4?"Just now":gap<constants_1.MILLISECONDS_IN_HOUR&&gap>0?Math.floor(gap/6e4)+" minutes ago":gap<constants_1.MILLISECONDS_IN_DAY&&gap>0?Math.floor(gap/36e5)+" hours ago":localDate.getDate()+" "+constants_1.MONTHS[localDate.getMonth()]+" "+localDate.getFullYear()+", "+localDate.getHours()+":"+("0"+localDate.getMinutes().toString()).slice(-2)},exports.getValidColor=function(color){return"transparent"===color?color:constants_1.COLOR_TEST_REGEXP.test(color)?color:"#333"},exports.compareBySendDate=function(dateOne,dateTwo){var localDateOne=new Date(dateOne),localTimeOne=localDateOne.getHours()+localDateOne.getTimezoneOffset()/60,localDateTwo=new Date(dateTwo),localTimeTwo=localDateTwo.getHours()+localDateTwo.getTimezoneOffset()/60;return localDateOne.setHours(localTimeOne),localDateTwo.setHours(localTimeTwo),localDateTwo.getTime()-localDateOne.getTime()}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.MILLISECONDS_IN_DAY=864e5,exports.MILLISECONDS_IN_HOUR=36e5,exports.MONTHS=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],exports.CONFIG_STYLES=[{name:"widgetWidth",type:"size"},{name:"borderRadius",type:"size"},{name:"zIndex",type:"number"},{name:"fontFamily",type:"string"},{name:"bgColor",type:"color"},{name:"textColor",type:"color"},{name:"arrowBorderColor",type:"color"},{name:"borderColor",type:"color"},{name:"badgeBgColor",type:"color"},{name:"badgeTextColor",type:"color"},{name:"timeTextColor",type:"color"},{name:"messageTitleColor",type:"color"},{name:"emptyInboxTitleColor",type:"color"},{name:"emptyInboxTextColor",type:"color"}],exports.DEFAULT_CONFIG={enable:!1,triggerId:"pwInbox",position:"bottom",appendTo:"body",title:"Inbox",bgColor:"#ffffff",textColor:"#333333",fontFamily:"inherit",borderRadius:4,borderColor:"transparent",badgeBgColor:"#ff4c00",badgeTextColor:"#ffffff",widgetWidth:350,zIndex:100,messageTitleColor:"#7a7a7a",timeTextColor:"#c4c4c4",emptyInboxTitle:"You're all caught up",emptyInboxTitleColor:"#333333",emptyInboxText:"There are no new messages. Stay tuned!",emptyInboxTextColor:"#7a7a7a",emptyInboxIconUrl:"https://pushon.pushwoosh.com/images/icon-empty-inbox.png",arrowBorderColor:"rgba(0,0,0,.1)"},exports.COLOR_TEST_REGEXP=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var InboxWidget_1=__webpack_require__(3);exports.PWInboxWidget=InboxWidget_1.default},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t};Object.defineProperty(exports,"__esModule",{value:!0});var widgetTemplates_1=__webpack_require__(4),constants_1=__webpack_require__(1),helpers_1=__webpack_require__(0),InboxWidget=function(){function InboxWidget(pw){this.pw=pw,this.config=__assign({},constants_1.DEFAULT_CONFIG,{arrowBorderColor:this.pw.inboxWidgetConfig.borderColor&&"transparent"!==this.pw.inboxWidgetConfig.borderColor?this.pw.inboxWidgetConfig.borderColor:"rgba(0,0,0,.1)"},this.pw.inboxWidgetConfig),this.updateInbox=this.updateInbox.bind(this),this.markVisibleItemsAsRead=this.markVisibleItemsAsRead.bind(this),this.onWidgetClickHandler=this.onWidgetClickHandler.bind(this),this.onTriggerClickHandler=this.onTriggerClickHandler.bind(this),this.onWindowScrollHandler=this.onWindowScrollHandler.bind(this),this.toggle=this.toggle.bind(this);try{this.initTrigger(),this.updateInbox(),this.addListeners()}catch(err){console.warn(err)}}return InboxWidget.prototype.toggle=function(isOpened){(void 0===isOpened?!this.isOpened:isOpened)?this.openWidget():this.closeWidget()},InboxWidget.prototype.initTrigger=function(){if(!this.pw.pwinbox)throw new Error("Web inbox is not allowed.");var trigger=document.getElementById(this.config.triggerId);if(!trigger)throw new Error("Inbox trigger element doesn't exist. You must set triggerId in inboxWidget config. See the documentation.");this.trigger=trigger,this.trigger.classList.add("pw-inbox-trigger"),this.defaultMargin=12,this.messagesElements={},this.messages=[],this.readItems=[],this.updateCounter(0),this.isOpened=!1,this.renderWidget(),this.isFixed=helpers_1.isElementFixed(this.trigger)},InboxWidget.prototype.renderWidget=function(){this.widget=document.createElement("div"),this.widget.id="pwInboxWidget",this.widget.className="pw-inbox-widget",this.widget.classList.toggle("pw-open",this.isOpened),this.widgetParent=document.querySelector(this.config.appendTo)||document.body,this.widgetParent.appendChild(this.widget),this.widgetParent.appendChild(this.getStyle()),this.renderWidgetInner()},InboxWidget.prototype.getStyle=function(){var styles=__webpack_require__(5),styleNode=document.createElement("style");return styleNode.innerHTML=this.configureStyle(styles),styleNode},InboxWidget.prototype.configureStyle=function(styles){var _this=this,resultStyles=styles.toString();return constants_1.CONFIG_STYLES.forEach(function(style){var template=new RegExp("var\\(--"+style.name+"\\)","ig"),result=_this.getStyleFormatter(style);resultStyles=resultStyles.replace(template,result)}),resultStyles},InboxWidget.prototype.getStyleFormatter=function(style){switch(style.type){case"size":return(this.config[style.name]||0)+"px";case"number":return parseFloat(this.config[style.name].toString()).toString();case"string":return this.config[style.name].toString();case"color":return helpers_1.getValidColor(this.config[style.name].toString());default:return"none"}},InboxWidget.prototype.renderWidgetInner=function(){if(this.messages.length>0)this.widget.classList.remove("pw-inbox-widget--empty"),this.widget.innerHTML=widgetTemplates_1.widgetTemplate(this.config.title),this.renderMessages();else{this.widget.classList.add("pw-inbox-widget--empty");var _a=this.config,emptyInboxTitle=_a.emptyInboxTitle,emptyInboxText=_a.emptyInboxText,emptyInboxIconUrl=_a.emptyInboxIconUrl;this.widget.innerHTML=widgetTemplates_1.widgetTemplateEmpty(emptyInboxIconUrl,emptyInboxTitle,emptyInboxText)}},InboxWidget.prototype.renderMessages=function(){var _this=this;this.list=this.widget.querySelector(".pw-inbox_list")||document.createElement("ul"),this.messages.forEach(function(message){var messageElement=document.createElement("li");messageElement.className="pw-inbox_item",messageElement.classList.toggle("pw-new",!message.isRead),messageElement.classList.toggle("pw-unread",!message.isActionPerformed),messageElement.setAttribute("data-pw-inbox-message-id",message.code),messageElement.innerHTML=widgetTemplates_1.messageTemplate(message),_this.list.appendChild(messageElement),_this.messagesElements[message.code]=messageElement})},InboxWidget.prototype.updateCounter=function(count){this.count=count,this.trigger.setAttribute("data-pw-count",""+this.count),this.trigger.classList.toggle("pw-empty",0===this.count)},InboxWidget.prototype.updateInboxMessages=function(messages){this.messages=messages.sort(function(_a,_b){var sendDateOne=_a.sendDate,sendDateTwo=_b.sendDate;return helpers_1.compareBySendDate(sendDateOne,sendDateTwo)}),this.renderWidgetInner()},InboxWidget.prototype.openWidget=function(){this.isOpened=!0,this.widget.classList.add("pw-open"),document.addEventListener("click",this.onWidgetClickHandler),window.addEventListener("scroll",this.onWindowScrollHandler),window.addEventListener("resize",this.onWindowScrollHandler),this.markVisibleItemsAsRead(),this.messages.length>0&&this.list.addEventListener("scroll",this.markVisibleItemsAsRead),this.positionWidget()},InboxWidget.prototype.closeWidget=function(){this.isOpened=!1,document.removeEventListener("click",this.onWidgetClickHandler),document.removeEventListener("click",this.onWindowScrollHandler),window.removeEventListener("resize",this.onWindowScrollHandler),this.updateReadStatus(),this.messages.length>0&&this.list.removeEventListener("scroll",this.markVisibleItemsAsRead),this.widget.classList.remove("pw-open","pw-top","pw-bottom","pw-right","pw-left"),this.widget.removeAttribute("style")},InboxWidget.prototype.positionWidget=function(){this.isOpened&&(this.widgetParent===document.body?this.defaultPlaceWidget():this.customPlaceWidget())},InboxWidget.prototype.customPlaceWidget=function(){var position=this.config.position;this.widgetParent.style.position="relative",this.widget.classList.add("pw-inbox-widget--inset"),this.widget.classList.add("pw-"+position)},InboxWidget.prototype.defaultPlaceWidget=function(){var position=this.pw.inboxWidgetConfig.position?this.config.position:this.getDefaultPosition(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0);switch(widgetRect.width+2*this.defaultMargin>windowWidth&&(this.widget.style.width=windowWidth-2*this.defaultMargin+"px"),widgetRect.height+24>windowHeight&&(this.widget.style.height=windowHeight-2*this.defaultMargin+"px"),position){case"top":this.alignWidgetTop();break;case"right":this.alignWidgetRight();break;case"left":this.alignWidgetLeft();break;case"bottom":this.alignWidgetBottom()}}},InboxWidget.prototype.alignWidgetTop=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-top");var left=pageXOffset+triggerRect.left+Math.floor(triggerRect.width/2)-Math.floor(widgetRect.width/2),isUnderLeft=left<pageXOffset,isUnderRight=left+widgetRect.width>pageXOffset+windowWidth;isUnderLeft&&(left=pageXOffset+this.defaultMargin),isUnderRight&&(left=pageXOffset+windowWidth-widgetRect.width-this.defaultMargin);var top=pageYOffset+triggerRect.top-widgetRect.height;this.alignWidgetElement(left,top),arrow.style.left=triggerRect.left+Math.floor(triggerRect.width/2)-left+"px";var topMargin=this.widget.getBoundingClientRect().top;if(topMargin<0){var newHeight=this.widget.getBoundingClientRect().height+topMargin-this.defaultMargin,newTop=this.widget.getBoundingClientRect().top-topMargin+this.defaultMargin;this.widget.style.height=newHeight+"px",this.widget.style.top=newTop+"px"}}},InboxWidget.prototype.alignWidgetRight=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-right");var top=pageYOffset+triggerRect.top+Math.floor(triggerRect.height/2)-Math.floor(widgetRect.height/2),isUnderTop=top<pageYOffset,isUnderBottom=pageYOffset+windowHeight<top+widgetRect.height;isUnderTop&&(top=pageYOffset+this.defaultMargin),isUnderBottom&&(top=pageYOffset+windowHeight-widgetRect.height-this.defaultMargin);var left=pageXOffset+triggerRect.left+triggerRect.width;this.alignWidgetElement(left,top),arrow.style.top=triggerRect.top+Math.floor(triggerRect.height/2)-top+"px";var rightMargin=windowWidth-this.widget.getBoundingClientRect().right;if(rightMargin<this.defaultMargin){var newWidth=this.widget.getBoundingClientRect().width+rightMargin-this.defaultMargin;this.widget.style.width=newWidth+"px"}}},InboxWidget.prototype.alignWidgetLeft=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-left");var top=pageYOffset+triggerRect.top+Math.floor(triggerRect.height/2)-Math.floor(widgetRect.height/2),isUnderTop=top<pageYOffset,isUnderBottom=pageYOffset+windowHeight<top+widgetRect.height;isUnderTop&&(top=pageYOffset+this.defaultMargin),isUnderBottom&&(top=pageYOffset+windowHeight-widgetRect.height-this.defaultMargin);var left=pageXOffset+triggerRect.left-widgetRect.width;this.alignWidgetElement(left,top),arrow.style.top=triggerRect.top+Math.floor(triggerRect.height/2)-top+"px";var leftMargin=this.widget.getBoundingClientRect().left;if(leftMargin<0){var newWidth=this.widget.getBoundingClientRect().width+leftMargin-this.defaultMargin,newLeft=this.widget.getBoundingClientRect().left-leftMargin;this.widget.style.width=newWidth+"px",this.widget.style.left=newLeft+"px"}}},InboxWidget.prototype.alignWidgetBottom=function(){var triggerRect=this.trigger.getBoundingClientRect(),widgetRect=this.widget.getBoundingClientRect();if(document.documentElement){var windowWidth=Math.max(document.documentElement.clientWidth,window.innerWidth||0),windowHeight=Math.max(document.documentElement.clientHeight,window.innerHeight||0),arrow=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-bottom");var left=pageXOffset+triggerRect.left+Math.floor(triggerRect.width/2)-Math.floor(widgetRect.width/2),isUnderLeft=left<pageXOffset,isUnderRight=left+widgetRect.width>pageXOffset+windowWidth;isUnderLeft&&(left=pageXOffset+this.defaultMargin),isUnderRight&&(left=pageXOffset+windowWidth-widgetRect.width-12);var top=pageYOffset+triggerRect.top+triggerRect.height;this.alignWidgetElement(left,top),arrow.style.left=triggerRect.left+Math.floor(triggerRect.width/2)-left+"px";var bottomRange=windowHeight-this.widget.getBoundingClientRect().bottom;if(bottomRange<this.defaultMargin){var newHeight=this.widget.getBoundingClientRect().height+bottomRange-this.defaultMargin;this.widget.style.height=newHeight+"px"}}},InboxWidget.prototype.alignWidgetElement=function(left,top){this.widget.style.left=left+"px",this.widget.style.top=top+"px"},InboxWidget.prototype.getDefaultPosition=function(){var _a=this.trigger.getBoundingClientRect(),left=_a.left,top=_a.top,width=_a.width,height=_a.height;if(!document.documentElement)return"";var antiMargins={right:left,bottom:top,left:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-(left+width),top:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(top+height)},leastMargin=Math.min(left,top,antiMargins.left,antiMargins.top),position="bottom";return Object.keys(antiMargins).forEach(function(key){antiMargins[key]===leastMargin&&(position=key)}),position},InboxWidget.prototype.addListeners=function(){var _this=this;this.trigger.addEventListener("click",this.onTriggerClickHandler),this.pw.push(["onPutNewMessageToInboxStore",function(){_this.updateInbox()}]),this.pw.push(["onUpdateInboxMessages",function(){_this.updateInbox()}])},InboxWidget.prototype.markVisibleItemsAsRead=function(){var _this=this;if(0!==this.messages.length){var scrollTop=this.list.clientHeight+this.list.scrollTop-50;Object.keys(this.messagesElements).forEach(function(code){if(_this.messagesElements[code]&&!(_this.messagesElements[code].offsetTop>scrollTop)){var message=_this.messages.find(function(message){return message.code===code});!message||message.isRead||_this.readItems.indexOf(code)+1||_this.readItems.push(code)}})}},InboxWidget.prototype.updateReadStatus=function(){this.pw.pwinbox.readMessagesWithCodes(this.readItems).then(this.updateInbox)},InboxWidget.prototype.updateInbox=function(){var _this=this;this.pw.pwinbox.loadMessages().then(function(messages){_this.updateInboxMessages(messages)}),this.pw.pwinbox.unreadMessagesCount().then(function(count){_this.updateCounter(count)})},InboxWidget.prototype.performMessageAction=function(code){var _this=this;this.pw.pwinbox.performActionForMessageWithCode(code).then(function(){_this.updateInbox()})},InboxWidget.prototype.removeMessages=function(messages){var _this=this;messages.forEach(function(code){_this.readItems=_this.readItems.slice(_this.readItems.indexOf(code),1)}),this.pw.pwinbox.deleteMessagesWithCodes(messages).then(function(){_this.updateInbox()})},InboxWidget.prototype.onTriggerClickHandler=function(event){event.stopPropagation(),event.target&&this.toggle()},InboxWidget.prototype.onWidgetClickHandler=function(event){if(event.target){var itemElement=event.target.closest(".pw-inbox_item");if(itemElement){var messageCode=itemElement.getAttribute("data-pw-inbox-message-id");messageCode&&(event.target.closest(".pw-inbox_item-remove")?this.removeMessages([messageCode]):this.performMessageAction(messageCode))}else this.toggle()}},InboxWidget.prototype.onWindowScrollHandler=function(){this.isFixed&&this.isOpened?this.toggle():this.positionWidget()},InboxWidget}();exports.default=InboxWidget},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var helpers_1=__webpack_require__(0);exports.widgetTemplate=function(title){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_inner">\n <div class="pw-inbox_title">\n '+title+'\n </div>\n <ul class="pw-inbox_list">\n \n </ul>\n</div>'},exports.widgetTemplateEmpty=function(emptyInboxIconUrl,emptyInboxTitle,emptyInboxText){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_list--empty">\n <div class="pw-inbox_list-icon">\n <img src="'+emptyInboxIconUrl+'" alt="'+emptyInboxTitle+'">\n </div>\n <div class="pw-inbox_list-title">\n '+emptyInboxTitle+'\n </div>\n <div class="ipw-inbox_list-body">\n '+emptyInboxText+"\n </div>\n</div>"},exports.messageTemplate=function(_a){var imageUrl=_a.imageUrl,title=_a.title,message=_a.message,sendDate=_a.sendDate;return'\n<div class="pw-inbox_item-inner">\n <div class="pw-inbox_icon">\n <img src="'+imageUrl+'" alt="'+(title||message)+'" class="pw-inbox_message-image">\n </div>\n <div class="pw-inbox_content">\n '+(title?'<div class="pw-inbox_item-title">\n '+title+"\n </div>":null)+'\n <div class="pw-inbox_item-body">\n '+message+'\n </div>\n <div class="pw-inbox_item-time">\n '+helpers_1.getMessageTime(sendDate)+'\n </div>\n </div>\n</div>\n<span class="pw-inbox_item-remove"></span>'}},function(module,exports,__webpack_require__){var result=__webpack_require__(6);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(7)(void 0)).push([module.i,".pw-inbox-trigger {\n position: relative;\n cursor: pointer;\n}\n\n.pw-inbox-trigger:after {\n content: attr(data-pw-count);\n display: block;\n position: absolute;\n right: 0;\n top: 0;\n background: var(--badgeBgColor);\n -webkit-border-radius: 8px;\n border-radius: 8px;\n color: var(--badgeTextColor);\n font-size: 10px;\n font-weight: normal;\n line-height: 16px;\n width: 16px;\n padding: 0 2px;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n text-align: center;\n}\n\n.pw-inbox-trigger.pw-empty:after {\n display: none;\n}\n\n.pw-inbox-widget * {\n position: static;\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n font-size: 1em;\n outline: none;\n font-family: var(--fontFamily);\n}\n.pw-inbox-widget {\n font-size: 14px;\n position: absolute;\n top: 0;\n left: -1000px;\n background: var(--bgColor);\n border: solid 1px var(--borderColor);\n -webkit-border-radius: var(--borderRadius);\n border-radius: var(--borderRadius);\n width: var(--widgetWidth);\n -webkit-box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n z-index: var(--zIndex);\n opacity: 0;\n -webkit-transition: opacity .6s ease;\n -o-transition: opacity .6s ease;\n transition: opacity .6s ease;\n -webkit-transition-delay: 100ms;\n -o-transition-delay: 100ms;\n transition-delay: 100ms;\n}\n.pw-inbox-widget.pw-open {\n opacity: 1;\n -webkit-transition-delay: 0ms;\n -o-transition-delay: 0ms;\n transition-delay: 0ms;\n}\n.pw-inbox-widget.pw-inbox-widget--inset {\n top: auto;\n left: auto;\n display: none;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-open {\n display: block;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-bottom {\n top: 100%;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-top {\n bottom: 100%;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-right {\n left: 100%;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-left {\n right: 100%;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--empty {\n max-height: none;\n}\n.pw-inbox-widget .pw-inbox__arrow {\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget .pw-inbox__arrow:before {\n content: \"\";\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget.pw-top {\n margin-top: -12px;\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow {\n border-top-color: var(--arrowBorderColor);\n bottom: -21px;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow:before {\n border-top-color: var(--bgColor);\n top: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-bottom {\n margin-top: 12px;\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow {\n border-bottom-color: var(--arrowBorderColor);\n top: -21px;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow:before {\n border-bottom-color: var(--bgColor);\n bottom: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-left {\n margin-left: -12px;\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow {\n border-left-color: var(--arrowBorderColor);\n right: -21px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow:before {\n border-left-color: var(--bgColor);\n left: -11px;\n top: -10px;\n}\n.pw-inbox-widget.pw-right {\n margin-left: 12px;\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow {\n border-right-color: var(--arrowBorderColor);\n left: -21px;\n top: 50%;\n -webkit-transform: translateY(-50%);\n -ms-transform: translateY(-50%);\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow:before {\n border-right-color: var(--bgColor);\n right: -11px;\n top: -10px;\n}\n.pw-inbox_inner {\n overflow: hidden;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: vertical;\n -webkit-box-direction: normal;\n -ms-flex-direction: column;\n flex-direction: column;\n height: 100%;\n}\n.pw-inbox_title {\n color: var(--textColor);\n margin: 0;\n padding: 28px 32px 12px;\n font-size: 24px;\n font-weight: 500;\n line-height: 1.1;\n text-align: left;\n -webkit-box-flex: 0;\n -ms-flex: 0 0 66px;\n flex: 0 0 66px;\n}\n.pw-inbox_list {\n overflow-x: hidden;\n overflow-y: auto;\n min-width: 200px;\n max-height: 300px;\n padding: 0;\n margin: 0;\n list-style: none;\n position: relative;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n}\n\n.pw-inbox_item {\n position: relative;\n padding: 8px 32px;\n margin: 0;\n text-align: left;\n}\n.pw-inbox_item-inner {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n cursor: pointer;\n}\n.pw-inbox_icon {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 40px;\n flex: 0 0 40px;\n}\n.pw-inbox_message-image {\n width: 28px;\n}\n.pw-inbox_content {\n -webkit-box-flex: 0;\n -ms-flex: 0 1 100%;\n flex: 0 1 100%;\n}\n.pw-inbox_item-title {\n color: var(--messageTitleColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-body {\n color: var(--textColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-time {\n color: var(--timeTextColor);\n font-size: 12px;\n line-height: 17px;\n}\n.pw-inbox_item-remove {\n position: absolute;\n z-index: 2;\n top: 8px;\n right: 8px;\n display: none;\n width: 10px;\n height: 10px;\n background: transparent url('https://cdn.pushwoosh.com/webpush/img/iconClose.svg') 50% no-repeat;\n cursor: pointer;\n}\n.pw-inbox_item:hover .pw-inbox_item-remove {\n display: block;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-title {\n color: var(--textColor);\n font-weight: 700;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-body {\n font-weight: 700;\n}\n\n.pw-inbox_list--empty {\n padding: 50px 16px;\n text-align: center;\n max-height: 100%;\n overflow: auto;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-icon {\n text-align: center;\n margin-bottom: 30px;\n}\n.pw-inbox_list--empty .pw-inbox_list-icon img {\n max-width: 100%;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-title {\n font-size: 28px;\n line-height: 36px;\n color: var(--emptyInboxTitleColor);\n margin-bottom: 20px;\n}\n\n.pw-inbox_list--empty .ipw-inbox_list-body {\n font-size: 14px;\n line-height: 18px;\n color: var(--emptyInboxTextColor);\n}\n",""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}}])},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var web_push_subscribe_popup_1=__webpack_require__(46);document.addEventListener("pushwoosh.initialized",function(ev){if(ev.detail.pw.subscribePopupConfig&&ev.detail.pw.subscribePopupConfig.enable){var popup_1=new web_push_subscribe_popup_1.PWSubscribePopup(ev.detail.pw);popup_1.initPopup().then(function(){ev.detail.pw.subscribePopup=popup_1})}})},function(module,exports,__webpack_require__){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{configurable:!1,enumerable:!0,get:getter})},__webpack_require__.r=function(exports){Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=1)}([function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.DEFAULT_CONFIG={text:"Don’t miss out on our news and updates! Enable push notifications",askLaterButtonText:"Not now",confirmSubscriptionButtonText:"Subscribe",delay:5,retryOffset:604800,overlay:!1,position:"top",mobileViewMargin:"0",bgColor:"#fff",borderColor:"transparent",boxShadow:"0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)",textColor:"#000",textSize:"inherit",textWeight:"normal",fontFamily:"inherit",subscribeBtnBgColor:"#4285f4",subscribeBtnTextColor:"#fff",subscribeBtnTextWeight:"normal",subscribeBtnBorderColor:"transparent",subscribeBtnBorderRadius:"2px",askLaterBtnBgColor:"transparent",askLaterBtnTextColor:"#000",askLaterBtnTextWeight:"normal",askLaterBtnBorderColor:"transparent",askLaterBtnBorderRadius:"2px",theme:"material",viewport:"html"},exports.COLOR_TEST_REGEXP=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/,exports.PERMISSION_DENIED="denied",exports.PERMISSION_GRANTED="granted",exports.CONFIG_STYLES=[{name:"mobileViewMargin",type:"string"},{name:"mobileViewPosition",type:"string"},{name:"mobileViewTransition",type:"string"},{name:"bgColor",type:"color"},{name:"borderColor",type:"color"},{name:"boxShadow",type:"string"},{name:"textColor",type:"color"},{name:"textSize",type:"string"},{name:"textWeight",type:"string"},{name:"fontFamily",type:"string"},{name:"subscribeBtnBgColor",type:"color"},{name:"subscribeBtnTextColor",type:"color"},{name:"subscribeBtnTextWeight",type:"string"},{name:"subscribeBtnBorderColor",type:"color"},{name:"subscribeBtnBorderRadius",type:"string"},{name:"askLaterBtnBgColor",type:"color"},{name:"askLaterBtnTextColor",type:"color"},{name:"askLaterBtnTextWeight",type:"string"},{name:"askLaterBtnBorderColor",type:"color"},{name:"askLaterBtnBorderRadius",type:"string"}]},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var SubscribePopup_1=__webpack_require__(2);exports.PWSubscribePopup=SubscribePopup_1.default},function(module,exports,__webpack_require__){"use strict";var __assign=this&&this.__assign||Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t},__awaiter=this&&this.__awaiter||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value)}).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})},__generator=this&&this.__generator||function(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=(t=_.trys).length>0&&t[t.length-1])&&(6===op[0]||2===op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}};Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0),popupTemplates_1=__webpack_require__(3),constants_2=__webpack_require__(0),helpers_1=__webpack_require__(4),SubscribePopup=function(){function SubscribePopup(pw){this.pw=pw;var _a=(pw.subscribePopupConfig||{}).mobileViewMargin,mobileViewMargin=void 0===_a?"":_a;this.config=__assign({},constants_1.DEFAULT_CONFIG,this.pw.subscribePopupConfig,{mobileViewTransition:mobileViewMargin?"none":"bottom .4s ease-out",mobileViewPosition:mobileViewMargin?"auto!important":"auto"}),this.onAskLaterClick=this.onAskLaterClick.bind(this),this.onSubscribeClick=this.onSubscribeClick.bind(this)}return SubscribePopup.prototype.initPopup=function(){return __awaiter(this,void 0,void 0,function(){var isSubscribed,isManualUnsubscribed,permission,lastPopupOpen,lastPopupOpenTime,now,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.pw.isSubscribed()];case 1:return isSubscribed=_a.sent(),[4,this.pw.data.getStatusManualUnsubscribed()];case 2:return isManualUnsubscribed=_a.sent(),isSubscribed||isManualUnsubscribed?[2]:[4,this.pw.driver.getPermission()];case 3:return(permission=_a.sent())===constants_2.PERMISSION_GRANTED||permission===constants_2.PERMISSION_DENIED?[2]:(this.renderPopup(),this.appendStyles(),lastPopupOpen=localStorage.getItem("LAST_OPEN_SUBSCRIPTION_POPUP"),lastPopupOpenTime=lastPopupOpen?parseInt(lastPopupOpen):0,now=(new Date).getTime(),lastPopupOpenTime+1e3*this.config.retryOffset<now&&!this.config.manualToggle&&setTimeout(function(){_this.toggle(!0)},1e3*this.config.delay),[2])}})})},SubscribePopup.prototype.toggle=function(isShown){("boolean"==typeof isShown?isShown:!this.isShown)?(this.showPopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-show",{})):(this.closePopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-hide",{}))},SubscribePopup.prototype.showPopup=function(){this.isShown=!0,this.popup.classList.add("pw-show"),document.body.classList.add("pw-popup-opened");var event=new CustomEvent("showPopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});if(this.popup.dispatchEvent(event),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var _a=this.config,theme=_a.theme,viewport=_a.viewport,position=_a.position;if("topbar"===theme&&"top"===position){var viewportElement=document.querySelector(viewport)||document.createElement("div"),currentMarginTop=window.getComputedStyle(viewportElement).marginTop||"0";viewportElement.style.transition="margin-top .3s ease-out",viewportElement.style.marginTop=parseInt(currentMarginTop)+this.popup.getBoundingClientRect().height+"px"}}},SubscribePopup.prototype.closePopup=function(){this.isShown=!1,this.popup.classList.remove("pw-show"),document.body.classList.remove("pw-popup-opened");var event=new CustomEvent("hidePopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});this.popup.dispatchEvent(event);var now=(new Date).getTime().toString();if(localStorage.setItem("LAST_OPEN_SUBSCRIPTION_POPUP",now),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var _a=this.config,theme=_a.theme,viewport=_a.viewport,position=_a.position;if("topbar"===theme&&"top"===position){var viewportElement=document.querySelector(viewport)||document.createElement("div"),currentMarginTop=window.getComputedStyle(viewportElement).marginTop||"0";viewportElement.style.marginTop=parseInt(currentMarginTop)-this.popup.getBoundingClientRect().height+"px"}}},SubscribePopup.prototype.renderPopup=function(){this.popup=document.createElement("div"),this.popup.id="pwSubscribePopup";var _a=this.config,text=_a.text,askLaterButtonText=_a.askLaterButtonText,confirmSubscriptionButtonText=_a.confirmSubscriptionButtonText,iconUrl=_a.iconUrl,position=_a.position,overlay=_a.overlay,theme=_a.theme;this.popup.className="pw-subscribe-popup pw-position-"+position+" pw-subscribe-popup-"+theme,this.popup.classList.toggle("pw-subscribe-popup__overlay",overlay),this.popup.innerHTML=popupTemplates_1.innerTemplate({text:text,askLaterButtonText:askLaterButtonText,confirmSubscriptionButtonText:confirmSubscriptionButtonText,iconUrl:iconUrl}),document.body.appendChild(this.popup),this.addListeners()},SubscribePopup.prototype.appendStyles=function(){var styles=__webpack_require__(5),style=document.createElement("style");style.innerHTML=this.configureStyle(styles),document.body.appendChild(style)},SubscribePopup.prototype.getStyleFormatter=function(style){switch(style.type){case"size":return(this.config[style.name]||0)+"px";case"number":return parseFloat(this.config[style.name].toString()).toString();case"string":return this.config[style.name].toString();case"color":return helpers_1.getValidColor(this.config[style.name].toString());default:return"none"}},SubscribePopup.prototype.configureStyle=function(styles){var _this=this,resultStyles=styles.toString();return constants_1.CONFIG_STYLES.forEach(function(style){var template=new RegExp("var\\(--"+style.name+"\\)","ig"),result=_this.getStyleFormatter(style);resultStyles=resultStyles.replace(template,result)}),resultStyles},SubscribePopup.prototype.addListeners=function(){var askLaterButton=this.popup.querySelector('button[name="pwAskLater"]')||document.createElement("button"),subscribeButton=this.popup.querySelector('button[name="pwSubscribe"]')||document.createElement("button");askLaterButton.addEventListener("click",this.onAskLaterClick),subscribeButton.addEventListener("click",this.onSubscribeClick)},SubscribePopup.prototype.onAskLaterClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-decline",{})},SubscribePopup.prototype.onSubscribeClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-accept",{}),this.pw.subscribe()},SubscribePopup}();exports.default=SubscribePopup},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.innerTemplate=function(_a){var iconUrl=_a.iconUrl,text=_a.text,askLaterButtonText=_a.askLaterButtonText,confirmSubscriptionButtonText=_a.confirmSubscriptionButtonText;return'<div class="pw-subscription-popup-inner">\n <div class="pw-subscription-popup-content">\n '+(iconUrl?'<div class="pw-subscription-popup-icon">\n <img src="'+iconUrl+'">\n </div>':"")+'\n <div class="pw-subscription-popup-text">\n '+text+'\n </div>\n </div>\n <div class="pw-subscription-popup-controls">\n <button name="pwAskLater" class="pw-subscribe-popup-button">'+askLaterButtonText+'</button>\n <button name="pwSubscribe" class="pw-subscribe-popup-button pw-subscribe-popup-button-active">'+confirmSubscriptionButtonText+"</button>\n </div>\n </div>"}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var constants_1=__webpack_require__(0);exports.getValidColor=function(color){return"transparent"===color?color:constants_1.COLOR_TEST_REGEXP.test(color)?color:"#333"},exports.getGlobal=function(){return globalThis}},function(module,exports,__webpack_require__){var result=__webpack_require__(6);module.exports="string"==typeof result?result:result.toString()},function(module,exports,__webpack_require__){(module.exports=__webpack_require__(7)(void 0)).push([module.i,".pw-subscribe-popup {\n position: fixed;\n left: 50%;\n -webkit-transform: translateX(-50%);\n -ms-transform: translateX(-50%);\n transform: translateX(-50%);\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n z-index: 1000000;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-transition: all .4s ease-out;\n -o-transition: all .4s ease-out;\n transition: all .4s ease-out;\n}\n\n.pw-subscribe-popup.pw-position-top {\n top: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-top.pw-show {\n top: 0;\n}\n\n.pw-subscribe-popup.pw-position-bottom {\n bottom: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-bottom.pw-show {\n bottom: 0;\n}\n\n.pw-subscribe-popup.pw-position-center {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n\n -webkit-transform: none;\n\n -ms-transform: none;\n\n transform: none;\n}\n\n.pw-subscribe-popup__overlay {\n background: rgba(0,0,0,.4);\n z-index: 1000000;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-subscribe-popup__overlay) {\n pointer-events: none;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-show) {\n display: none;\n}\n\n\n.pw-subscribe-popup__overlay.pw-position-top {\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n}\n\n.pw-subscribe-popup__overlay.pw-position-bottom {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n}\n\n.pw-subscribe-popup__overlay.pw-position-center {\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n}\n\n.pw-subscription-popup-inner {\n max-width: 400px;\n font-size: var(--textSize);\n color: var(--textColor);\n font-weight: var(--textWeight);\n font-family: var(--fontFamily);\n border-style: solid;\n border-width: 1px;\n border-color: var(--borderColor);\n background: var(--bgColor);\n -webkit-box-shadow: var(--boxShadow);\n box-shadow: var(--boxShadow);\n pointer-events: auto;\n}\n\n.pw-subscription-popup-content {\n padding: 16px 16px 4px;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: stretch;\n -ms-flex-pack: stretch;\n justify-content: stretch;\n}\n\n.pw-subscription-popup-icon {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 50px;\n flex: 0 0 50px;\n margin-right: 12px;\n padding-top: 4px;\n}\n\n.pw-subscription-popup-icon img {\n max-width: 60px;\n max-height: 60px;\n}\n\n.pw-subscription-popup-text {\n -webkit-box-flex: 1;\n -ms-flex: 1 1 300px;\n flex: 1 1 300px;\n}\n\n.pw-subscription-popup-controls {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n padding: 8px 16px 16px;\n}\n\nbutton.pw-subscribe-popup-button {\n border: solid 1px var(--askLaterBtnBorderColor);\n -webkit-border-radius: var(--askLaterBtnBorderRadius);\n border-radius: var(--askLaterBtnBorderRadius);\n display: inline-block;\n height: 36px;\n line-height: 36px;\n padding: 0 16px;\n text-transform: uppercase;\n font-weight: var(--askLaterBtnTextWeight);\n vertical-align: middle;\n -webkit-tap-highlight-color: transparent;\n font-size: 14px;\n outline: 0;\n text-decoration: none;\n color: var(--askLaterBtnTextColor);\n text-align: center;\n letter-spacing: .5px;\n cursor: pointer;\n background: var(--askLaterBtnBgColor);\n margin: 4px 8px;\n}\nbutton.pw-subscribe-popup-button:hover {\n background: rgba(0,0,0,.04);\n}\nbutton.pw-subscribe-popup-button:active {\n background: rgba(0,0,0,.12);\n}\n\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active {\n color: var(--subscribeBtnTextColor);\n background: var(--subscribeBtnBgColor);\n -webkit-border-radius: var(--subscribeBtnBorderRadius);\n border-radius: var(--subscribeBtnBorderRadius);\n border: solid 1px var(--subscribeBtnBorderColor);\n -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n font-weight: var(--subscribeBtnTextWeight);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:hover {\n -webkit-box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:active {\n -webkit-box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n}\n\n@media screen and (min-width: 541px) {\n\n .pw-subscribe-popup-topbar {\n width: 100%;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n padding: 2px 40px;\n -webkit-box-pack: center;\n -ms-flex-pack: center;\n justify-content: center;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-content {\n padding: 0;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-icon img {\n max-width: 28px;\n max-height: 28px;\n }\n\n .pw-subscribe-popup-topbar button.pw-subscribe-popup-button {\n height: 32px;\n line-height: 32px;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-controls {\n padding: 0 0 0 16px;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n }\n}\n@media screen and (max-width: 540px) {\n .pw-subscribe-popup,\n .pw-subscribe-popup.pw-position-top,\n .pw-subscribe-popup.pw-position-center,\n .pw-subscribe-popup.pw-position-bottom {\n top: var(--mobileViewPosition);\n bottom: -110%;\n left: 0;\n right: 0;\n -webkit-transform: none;\n -ms-transform: none;\n transform: none;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-transition: var(--mobileViewTransition);\n -o-transition: var(--mobileViewTransition);\n transition: var(--mobileViewTransition);\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-subscribe-popup__overlay {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-show {\n bottom: var(--mobileViewMargin);\n }\n\n .pw-subscribe-popup__overlay .pw-subscription-popup-inner {\n -webkit-box-align: end;\n -ms-flex-align: end;\n align-items: flex-end;\n -webkit-box-pack: stretch;\n -ms-flex-pack: stretch;\n justify-content: stretch;\n }\n\n .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n }\n}\n",""])},function(module,exports){module.exports=function(useSourceMap){var list=[];return list.toString=function(){return this.map(function(item){var content=function(item,useSourceMap){var content=item[1]||"",cssMapping=item[3];if(!cssMapping)return content;if(useSourceMap&&"function"==typeof btoa){var sourceMapping=function(sourceMap){return"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))))+" */"}(cssMapping),sourceURLs=cssMapping.sources.map(function(source){return"/*# sourceURL="+cssMapping.sourceRoot+source+" */"});return[content].concat(sourceURLs).concat([sourceMapping]).join("\n")}return[content].join("\n")}(item,useSourceMap);return item[2]?"@media "+item[2]+"{"+content+"}":content}).join("")},list.i=function(modules,mediaQuery){"string"==typeof modules&&(modules=[[null,modules,""]]);for(var alreadyImportedModules={},i=0;i<this.length;i++){var id=this[i][0];"number"==typeof id&&(alreadyImportedModules[id]=!0)}for(i=0;i<modules.length;i++){var item=modules[i];"number"==typeof item[0]&&alreadyImportedModules[item[0]]||(mediaQuery&&!item[2]?item[2]=mediaQuery:mediaQuery&&(item[2]="("+item[2]+") and ("+mediaQuery+")"),list.push(item))}},list}}])}])});
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(this,(()=>(()=>{"use strict";var t={d:(e,n)=>{for(var i in n)t.o(n,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:n[i]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Pushwoosh:()=>Bt});var n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}var r=function(){return r=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},r.apply(this,arguments)};function s(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n}function o(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{c(i.next(t))}catch(t){s(t)}}function a(t){try{c(i.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((i=i.apply(t,e||[])).next())}))}function a(t,e){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=e.call(t,s)}catch(t){a=[6,t],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}Object.create;function c(t,e,n){if(n||2===arguments.length)for(var i,r=0,s=e.length;r<s;r++)!i&&r in e||(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}Object.create;"function"==typeof SuppressedError&&SuppressedError;const u={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let p;const d=new Uint8Array(16);const h=[];for(let t=0;t<256;++t)h.push((t+256).toString(16).slice(1));function l(t,e=0){return(h[t[e+0]]+h[t[e+1]]+h[t[e+2]]+h[t[e+3]]+"-"+h[t[e+4]]+h[t[e+5]]+"-"+h[t[e+6]]+h[t[e+7]]+"-"+h[t[e+8]]+h[t[e+9]]+"-"+h[t[e+10]]+h[t[e+11]]+h[t[e+12]]+h[t[e+13]]+h[t[e+14]]+h[t[e+15]]).toLowerCase()}const g=function(t,e,n){if(u.randomUUID&&!e&&!t)return u.randomUUID();const i=(t=t||{}).random??t.rng?.()??function(){if(!p){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");p=crypto.getRandomValues.bind(crypto)}return p(d)}();if(i.length<16)throw new Error("Random bytes length must be >= 16");if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,e){if((n=n||0)<0||n+16>e.length)throw new RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let t=0;t<16;++t)e[n+t]=i[t];return e}return l(i)};var f="deviceRegistrationStatus",b="registered",v="unregistered",m="denied",w="granted",y="default",x="onLoad",_="onReady",C="onSubscribe",S="onUnsubscribe",E="onRegister",k="onPermissionPrompt",P="onPermissionDenied",T="onPermissionGranted",I="onSWInitError",M="onPushDelivery",B="onNotificationClick",D="onNotificationClose",O="onChangeCommunicationEnabled",W="onPutNewMessageToInboxStore",R="onUpdateInboxMessages",A="onShowNotificationPermissionDialog",L="onHideNotificationPermissionDialog",N="onShowSubscriptionWidget",U="onHideSubscriptionWidget",H="PW_SiteOpened",q={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"},F=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 i=n.eventId||g(),s=t.savedEventHandlersMap[e];return s?(s.forEach((function(t){"function"==typeof t&&setTimeout((function(){t(r(r({},n),{eventId:i}))}),0)})),i):i},this.savedEventHandlersMap={}},z="pushwoosh-subscription-widget",V=function(){function t(t,e){this.eventBus=t,this.pw=e}return t.prototype.init=function(t){if(!this.getRootElement()){var e=function(t){return'\n <div id="'.concat(z,'-root" class="').concat(z,'">\n <div class="').concat(z,'__body">\n <div class="').concat(z,'__header">\n ').concat(t.headerText,'\n </div>\n <div class="').concat(z,'__description">\n ').concat(t.subheaderText,'\n </div>\n <div class="').concat(z,'__controls">\n <button type="button" id="').concat(z,'-decline" class="').concat(z,"__control ").concat(z,'__control_decline">\n ').concat(t.buttonCancelText,'\n </button>\n <button type="button" id="').concat(z,'-accept" class="').concat(z,"__control ").concat(z,'__control_accept">\n ').concat(t.buttonAcceptText,"\n </button>\n </div>\n </div>\n </div>\n ")}(t),n=function(t){var e=document.createElement("style");return e.innerHTML="\n .".concat(z," * {\n box-sizing: border-box!important;\n }\n \n .").concat(z," {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n margin: 0 auto;\n width: 320px;\n display: none;\n z-index: 2147483648;\n opacity: 0.99;\n }\n \n .").concat(z,"_show {\n display: block;\n }\n \n .").concat(z,"__body {\n width: 320px;\n background-color: ").concat(t.backgroundColor?t.backgroundColor:"#FFFFFF",";\n box-shadow: 0 9px 15px rgba(0, 0, 0, 0.1), 0 0 6px rgba(0, 0, 0, 0.06);\n border-radius: 4px;\n padding: 20px 20px 12px;\n }\n \n .").concat(z,"__header {\n color: ").concat(t.headerTextColor,";\n font-size: 18px;\n font-weight: bold; \n }\n \n .").concat(z,"__description {\n color: ").concat(t.subheaderTextColor,";\n font-size: 14px;\n line-height: 1.5;\n margin-top: 14px;\n }\n \n .").concat(z,"__description:empty {\n display: none;\n }\n \n .").concat(z,"__controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: flex-end;\n margin: 20px 0 0;\n }\n \n .").concat(z,"__control {\n -webkit-appearance: none;\n border: 1px solid transparent;\n font-size: 12px;\n font-weight: bold;\n padding: 0 20px;\n height: 32px;\n cursor: pointer;\n }\n \n .").concat(z,"__control_decline {\n color: ").concat(t.buttonCancelTextColor,";\n background-color: ").concat(t.buttonCancelBackgroundColor,";\n border-radius: ").concat(t.buttonCancelRound,";\n border-color: ").concat(t.buttonCancelBorderColor,";\n }\n \n .").concat(z,"__control_accept {\n color: ").concat(t.buttonAcceptTextColor,";\n background-color: ").concat(t.buttonAcceptBackgroundColor,";\n border-radius: ").concat(t.buttonAcceptRound,";\n border-color: ").concat(t.buttonAcceptBorderColor,";\n margin: 0 0 0 12px;\n }\n "),e}(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("".concat(z,"_show"))},t.prototype.hide=function(){var t=this.getRootElementWithCheckExist();t.classList.contains("".concat(z,"_show"))&&(this.eventBus.dispatchEvent("hide-subscription-widget",{}),t.classList.remove("".concat(z,"_show")))},t.prototype.getRootElement=function(){return document.getElementById("".concat(z,"-root"))},t.prototype.getRootElementWithCheckExist=function(){var t=this.getRootElement();if(!t)throw new Error("Can't find element by id \"".concat(z,'-root", please use method init first.'));return t},t.prototype.getDeclineButtonWithCheckExist=function(){var t=document.getElementById("".concat(z,"-decline"));if(!t)throw new Error("Can't find element by id \"".concat(z,'-decline", please use method init first.'));return t},t.prototype.getAcceptButtonWithCheckExist=function(){var t=document.getElementById("".concat(z,"-accept"));if(!t)throw new Error("Can't find element by id \"".concat(z,'-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}();function j(){return globalThis}function Y(){"history"in j()&&history.pushState?history.pushState(null,"","#"):location.hash="#"}var K="keyValue",G="messages",X="log",J="inboxMessages";function $(t,e){return function(n){n.objectStoreNames.contains(t)||e(n)}}const Q=[$(J,(function(t){var e="status",n=t.createObjectStore(J,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(e,e,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})}))];const Z=[$(K,(function(t){t.createObjectStore(K,{keyPath:"key"})})),$(X,(function(t){var e=t.createObjectStore(X,{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})})),$(G,(function(t){t.createObjectStore(G,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}))];const tt=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).toString()},t}();const et=function(){function t(t){void 0===t&&(t=new tt),this.migrations={initial:Z,"2018/11/26":Q},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 tt(new Date(t)),i=new tt(new Date(e));return n.getTimestamp()-i.getTimestamp()})).map((function(e){return t.migrations[e]}))},enumerable:!1,configurable:!0}),t}();const nt=function(){function t(t,e){void 0===e&&(e=new et),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}();function it(t,e){console.info("onversionchange",e),t.close()}var rt;function st(t){return(rt||(rt=new Promise((function(t,e){var n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=function(n){var i=n.target.result;i.onversionchange=it.bind(null,i,e),t(i)},n.onerror=function(){return e(n.error)},n.onupgradeneeded=function(t){var n=t.target.result;n.onversionchange=it.bind(null,n,e),new nt(n).applyMigrations()}}))),rt).then((function(e){return new Promise((function(n,i){return t(e,n,i)}))}))}var ot,at=function(){function t(){}return t.prototype._add=function(t){var e=this;return st((function(n,i,r){var s=n.transaction([e.name],"readwrite").objectStore(e.name).add(t);s.onsuccess=function(){i(t)},s.onerror=function(){r(s.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:t<e?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 st((function(n,i,r){var s=n.transaction([e.name],"readwrite").objectStore(e.name).delete(t);s.onsuccess=function(){i(s.result)},s.onerror=function(){r(s.error)}}))},t.prototype.getAll=function(){var t=this;return st((function(e,n,i){var r=[],s=e.transaction(t.name).objectStore(t.name).openCursor();s.onsuccess=function(t){var e=t.target.result;e?(e.value&&r.push(e.value),e.continue()):n(r)},s.onerror=function(){i(s.error)}}))},t}(),ct=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name=X,e.maxItems=100,e.environment="undefined"!=typeof self&&self.registration?"worker":"browser",e}return i(e,t),e.prototype.add=function(t,e,n){var i={type:t,environment:this.environment,message:"".concat(e),date:new Date};return e instanceof Error&&(i.stack=e.stack),n&&(i.additional=n),this._add(i)},e}(at),ut=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.name=G,e.maxItems=25,e}return i(e,t),e.prototype.add=function(t){return this._add(r(r({},t),{date:new Date}))},e}(at),pt=(ot=K,{get:function(t,e){return st((function(n,i,r){var s,o=n.transaction(ot).objectStore(ot).get(t),a=!1,c=!1,u=function(){if(clearTimeout(s),a){var t=o.result;i(t&&t.value||e)}else c?r(o.error):s=setTimeout(u,0)};o.onsuccess=function(){return a=!0},o.onerror=function(){return c=!0},u()}))},getAll:function(){return st((function(t,e,n){var i,r={},s=t.transaction(ot).objectStore(ot).openCursor(),o=!1,a=!1,c=function(){clearTimeout(i),o?e(r):a?n(s.error):i=setTimeout(c,0)};s.onsuccess=function(t){var e=t.target.result;e?(r[e.key]=e.value.value,e.continue()):o=!0},s.onerror=function(){return a=!0},c()}))},extend:function(t,e){return o(this,void 0,void 0,(function(){var n,i;return a(this,(function(o){switch(o.label){case 0:return[4,this.get(t)];case 1:return n=o.sent(),i=s(e,[]),[4,this.set(t,r(r({},n),i))];case 2:return o.sent(),[2]}}))}))},set:function(t,e){return st((function(n,i,r){var s,o=n.transaction([ot],"readwrite").objectStore(ot).put({key:t,value:e}),a=!1,c=!1,u=function(){clearTimeout(s),a?i(t):c?r(o.error):s=setTimeout(u,0)};o.onsuccess=function(){return a=!0},o.onerror=function(){return c=!0},u()}))}}),dt=new ct,ht=new ut,lt={error:1,info:2,debug:3},gt=3;!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"],i=n.length,r=j(),s=r.console=r.console||{};i--;)s[t=n[i]]||(s[t]=e)}();var ft={setLevel:function(t){lt[t]||(t="error"),gt=lt[t]},write:function(t,e,n){return"error"===t?this.error(e):this.info(e),dt.add(t,e,n)}};Object.keys(lt).forEach((function(t){var e=lt[t];ft[t]=function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];e<=gt&&(console.groupCollapsed(t),console.info.apply(console,c([""],n,!1)),console.trace("trace"),console.groupEnd())}}));var bt=function(){function t(t,e,n,i){void 0===i&&(i=new tt),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 o(this,void 0,void 0,(function(){var i,r,s=this;return a(this,(function(c){switch(c.label){case 0:return i=[],r=[],e.forEach((function(e){return o(s,void 0,void 0,(function(){return a(this,(function(s){return-1===t.indexOf(e.inbox_id)||(e.status=n,i.push(e),r.push(this.api.inboxStatus(e.order,e.status))),[2]}))}))})),[4,this.inboxModel.putBulkMessages(i)];case 1:return c.sent(),[4,Promise.all(r)];case 2:return c.sent(),[2]}}))}))},t.prototype.publicMessageBuilder=function(t){return o(this,arguments,void 0,(function(t){var e,n,i,r,s,o=t.action_type,c=t.action_params,u=t.image,p=t.title,d=t.send_date,h=t.inbox_id,l=t.text,g=t.status;return a(this,(function(t){switch(t.label){case 0:return(n=u)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:n=t.sent(),t.label=2;case 2:return e=n,(r=p)?[3,4]:[4,this.data.getDefaultNotificationTitle()];case 3:r=t.sent(),t.label=4;case 4:return i=r,s=JSON.parse(c),this.dateModule.date=new Date(1e3*parseInt(d)),this.dateModule.setLocal(),[2,{title:i,imageUrl:e,code:h,message:l,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(o,s),link:(null==s?void 0:s.l)||"/",isRead:2===g||3===g,isActionPerformed:3===g}]}}))}))},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 o(this,void 0,void 0,(function(){var t,e,n;return a(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=c(c([],t,!0),e,!0).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 o(this,void 0,void 0,(function(){var e;return a(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 o(this,void 0,void 0,(function(){var e,n,i;return a(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 o(this,void 0,void 0,(function(){var e,n;return a(this,(function(i){switch(i.label){case 0:return[4,this.inboxModel.getReadOpenMessages()];case 1:return e=i.sent(),[4,this.inboxModel.getDeliveredMessages()];case 2:return n=i.sent(),[4,this.updateMessagesStatusWithCodes(t,c(c([],e,!0),n,!0),4)];case 3:return i.sent(),[2]}}))}))},t.prototype.syncMessages=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.inboxModel.updateMessages()];case 1:return t.sent(),[2]}}))}))},t}();const vt=bt;var mt=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 "'.concat(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){var i=t.target;n(i.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}();const wt=mt;const yt=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 nt(n).applyMigrations()},t.prototype.getDB=function(){var t=this;return new Promise((function(e,n){var i=indexedDB.open("PUSHWOOSH_SDK_STORE",7);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 o(this,void 0,void 0,(function(){var i,r;return a(this,(function(s){switch(s.label){case 0:return[4,this.getDB()];case 1:return i=s.sent(),[4,new wt(i,t).put(e,n)];case 2:return r=s.sent(),i.close(),[2,r]}}))}))},t.prototype.delete=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return a(this,(function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return n=r.sent(),[4,new wt(n,t).delete(e)];case 2:return i=r.sent(),n.close(),[2,i]}}))}))},t.prototype.get=function(t,e,n){return o(this,void 0,void 0,(function(){var i,r;return a(this,(function(s){switch(s.label){case 0:return[4,this.getDB()];case 1:return i=s.sent(),[4,new wt(i,t).get(e,n)];case 2:return r=s.sent(),i.close(),[2,r]}}))}))},t.prototype.getAll=function(t){return o(this,void 0,void 0,(function(){var e,n;return a(this,(function(i){switch(i.label){case 0:return[4,this.getDB()];case 1:return e=i.sent(),[4,new wt(e,t).getAll()];case 2:return n=i.sent(),e.close(),[2,n||[]]}}))}))},t.prototype.count=function(t,e){return o(this,void 0,void 0,(function(){var n,i;return a(this,(function(r){switch(r.label){case 0:return[4,this.getDB()];case 1:return n=r.sent(),[4,new wt(n,t).count(e)];case 2:return i=r.sent(),n.close(),[2,i]}}))}))},t.prototype.countByIndex=function(t,e,n){return o(this,void 0,void 0,(function(){var i,r,s;return a(this,(function(o){switch(o.label){case 0:return[4,this.getDB()];case 1:return i=o.sent(),(r=new wt(i,t)).index=e,[4,r.countByIndex(n)];case 2:return s=o.sent(),i.close(),[2,s]}}))}))},t}();var xt=function(){function t(t,e,n,i,r){void 0===i&&(i=new yt),void 0===r&&(r=new tt),this.eventBus=t,this.data=e,this.api=n,this.storage=i,this.storeName="inboxMessages",this.dateModule=r}return t.prototype.getInboxMessages=function(){return o(this,void 0,void 0,(function(){var t;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var e,n=this;return a(this,(function(i){return e=t.map((function(t){return o(n,void 0,void 0,(function(){var e;return a(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 o(this,void 0,void 0,(function(){var t,e,n;return a(this,(function(i){switch(i.label){case 0:return this.dateModule.date=new Date,t=this.dateModule.getTimestamp().toString(),[4,this.storage.getAll(this.storeName)];case 1:return e=i.sent(),n=e.filter((function(e){return e.rt<t})).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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.storage.count(this.storeName)]}))}))},t.prototype.getDeliveredMessagesCount=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.storage.countByIndex(this.storeName,"status",1)]}))}))},t.prototype.getReadMessagesCount=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.storage.countByIndex(this.storeName,"status",2)]}))}))},t.prototype.getDeliveredReadMessagesCount=function(){return o(this,void 0,void 0,(function(){var t,e,n,i;return a(this,(function(r){return e=(t=[2,3])[0],n=t[1],i=IDBKeyRange.bound(e,n),[2,this.storage.countByIndex(this.storeName,"status",i)]}))}))},t.prototype.updateMessages=function(){return o(this,void 0,void 0,(function(){var t;return a(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 vt(this.data,this.api,this)}),[2]}}))}))},t}();const _t=xt;var Ct=function(){function t(t){void 0===t&&(t=pt),this.store=t}return t.prototype.clearAll=function(){return o(this,void 0,void 0,(function(){return a(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.email",void 0)];case 14:return t.sent(),[4,this.store.set("params.userIdWasChanged",void 0)];case 15:return t.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 16:return t.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 17:return t.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 18:return t.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 19:return t.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 20:return t.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 21:return t.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 22:return t.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 23:return t.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 24:return t.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 25:return t.sent(),[4,this.store.set("params.features",void 0)];case 26:return t.sent(),[4,this.store.set("params.init",void 0)];case 27:return t.sent(),[4,this.store.set("API_PARAMS",void 0)];case 28:return t.sent(),[4,this.store.set("SENDER_ID",void 0)];case 29:return t.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 30:return t.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 31:return t.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 32:return t.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 33:return t.sent(),[2]}}))}))},t.prototype.setApplicationCode=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.applicationCode")];case 1:return[2,t.sent()]}}))}))},t.prototype.setApiToken=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.store.set("params.apiToken",t)];case 1:return[2,e.sent()]}}))}))},t.prototype.getApiToken=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.apiToken")];case 1:return[2,t.sent()]}}))}))},t.prototype.setHwid=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.apiEntrypoint","https://cp.pushwoosh.com/json/1.3/")];case 1:return[2,t.sent()]}}))}))},t.prototype.setTokens=function(t){return o(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return[4,this.getHwid()];case 1:return e=n.sent(),[4,this.store.set("API_PARAMS",r({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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.applicationServerKey")];case 1:return[2,t.sent()]}}))}))},t.prototype.setIsVapidChanged=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.store.set("params.isVapidChanged",t)];case 1:return e.sent(),[2]}}))}))},t.prototype.getIsVapidChanged=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.isVapidChanged",!1)];case 1:return[2,t.sent()]}}))}))},t.prototype.setWebSitePushId=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.defaultNotificationImage","https://cp.pushwoosh.com/img/logo-medium.png")];case 1:return[2,t.sent()]}}))}))},t.prototype.setDefaultNotificationTitle=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.defaultNotificationTitle","Pushwoosh notification")];case 1:return[2,t.sent()]}}))}))},t.prototype.setUserId=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return t?[3,2]:[4,this.store.set("params.userId",void 0)];case 1:case 3:return e.sent(),[2];case 2:return[4,this.store.set("params.userId",t.toString())]}}))}))},t.prototype.getUserId=function(){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.userIdWasChanged",!1)];case 1:return[2,t.sent()]}}))}))},t.prototype.setEmail=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return t?[3,2]:[4,this.store.set("params.email",void 0)];case 1:case 3:return e.sent(),[2];case 2:return[4,this.store.set("params.email",t.toString())]}}))}))},t.prototype.getEmail=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.email")];case 1:return[2,t.sent()]}}))}))},t.prototype.setStatusEmailWasChanged=function(t){return o(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.store.set("params.emailWasChanged",t)];case 1:return e.sent(),[2]}}))}))},t.prototype.getStatusEmailWasChanged=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.emailWasChanged",!1)];case 1:return[2,t.sent()]}}))}))},t.prototype.setLastPermissionStatus=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.store.get("params.serviceWorkerUrl","/pushwoosh-service-worker.js")];case 1:return[2,t.sent()]}}))}))},t.prototype.setServiceWorkerScope=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.store.get("params.inbox.lastRequestTime",0)]}))}))},t.prototype.setInboxNewMessagesCount=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.store.get("params.inbox.newMessagesCount",0)]}))}))},t.prototype.setDelayedEvent=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.store.get("params.promptDisplayCount",0)]}))}))},t.prototype.setPromptLastSeenTime=function(t){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.store.get("params.promptLastSeenTime",0)]}))}))},t}(),St=function(){function t(t,e){void 0===t&&(t=new Ct),void 0===e&&(e=ft),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,"",!0)},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.registerEmail=function(t){return this.createRequest("registerEmail",t)},t.prototype.registerEmailUser=function(t){return this.createRequest("registerEmailUser",t)},t.prototype.setEmailTags=function(t){return this.createRequest("setEmailTags",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,i){return o(this,void 0,void 0,(function(){var s,o,c,u,p,d,h;return a(this,(function(a){switch(a.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return s=a.sent(),i?(c="",[3,4]):[3,2];case 2:return[4,this.data.getApiToken()];case 3:c=a.sent(),a.label=4;case 4:return u=n||s+t,p=(o=c)?{headers:{Authorization:"Token ".concat(o),"Content-Type":"text/plain;charset=UTF-8",Origin:globalThis.location.origin},credentials:"include"}:{},[4,fetch(u,r({method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:e})},p))];case 5:return d=a.sent(),[4,this.checkResponse(d)];case 6:return(h=a.sent()).base_url?[4,this.data.setApiEntrypoint(h.base_url)]:[3,8];case 7:a.sent(),a.label=8;case 8:return[4,this.logger.write("apirequest","".concat(t," call with arguments: ").concat(JSON.stringify(e)," to Pushwoosh has been successful. Result: ").concat(JSON.stringify(h.response)))];case 9:return a.sent(),[2,h.response]}}))}))},t.prototype.checkResponse=function(t){return o(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:if(200!==t.status)throw new Error("Error code: ".concat(t.status,". Error text: ").concat(t.statusText));return[4,t.json()];case 1:if(200!==(e=n.sent()).status_code)throw new Error("Error code: ".concat(e.status_code,". Error text: ").concat(e.status_message));return[2,e]}}))}))},t}(),Et=function(){function t(t,e,n){void 0===e&&(e=new Ct),void 0===n&&(n=new St),this.eventBus=t,this.data=e,this.apiClient=n}return t.prototype.checkDevice=function(){return o(this,void 0,void 0,(function(){var t;return a(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(){return o(this,arguments,void 0,(function(t){var e,n,i,r;return void 0===t&&(t=!0),a(this,(function(s){switch(s.label){case 0:return void 0!==(e=localStorage.getItem(f))&&t?[3,2]:[4,this.checkDevice()];case 1:n=s.sent(),i=n.exist,r=n.push_token_exist,localStorage.setItem(f,i&&r?b:v),e=localStorage.getItem(f),s.label=2;case 2:return[2,e===b]}}))}))},t.prototype.getConfig=function(t){return o(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return e=n.sent(),[2,this.apiClient.getConfig(r(r({},e),{features:t}))]}}))}))},t.prototype.applicationOpen=function(){return o(this,void 0,void 0,(function(){var t;return a(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 o(this,void 0,void 0,(function(){var t,e,n;return a(this,(function(i){switch(i.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:if(i.sent())throw new Error("Can't register device: Communication is disabled!");return[4,this.getRequestParams()];case 2:return t=i.sent(),[4,this.data.getTokens()];case 3:if(!(e=i.sent()).pushToken)throw new Error("Can't register device: pushToken is not exist!");return[4,this.apiClient.registerDevice(r(r({},t),{push_token:e.pushToken,auth_token:e.authToken,public_key:e.publicKey}))];case 4:return n=i.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 5:return i.sent(),localStorage.setItem(f,b),this.eventBus.dispatchEvent("register",{}),[2,n]}}))}))},t.prototype.unregisterDevice=function(){return o(this,void 0,void 0,(function(){var t,e;return a(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(f,v),this.eventBus.dispatchEvent("unsubscribe",{}),[2,e]}}))}))},t.prototype.deleteDevice=function(){return o(this,void 0,void 0,(function(){var t,e;return a(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(f,v),this.eventBus.dispatchEvent("unsubscribe",{}),[2,e]}}))}))},t.prototype.messageDeliveryEvent=function(t,e){return o(this,arguments,void 0,(function(t,e,n){var i;return void 0===n&&(n={}),a(this,(function(e){switch(e.label){case 0:return[4,this.getRequestParams()];case 1:return i=e.sent(),[4,this.apiClient.messageDeliveryEvent(r(r({},i),{hash:t,metaData:n}))];case 2:return[2,e.sent()]}}))}))},t.prototype.pushStat=function(t,e){return o(this,arguments,void 0,(function(t,e,n){var i;return void 0===n&&(n={}),a(this,(function(e){switch(e.label){case 0:return[4,this.getRequestParams()];case 1:return i=e.sent(),[4,this.apiClient.pushStat(r(r({},i),{hash:t,metaData:n}))];case 2:return[2,e.sent()]}}))}))},t.prototype.setTags=function(t){return o(this,void 0,void 0,(function(){var e,n,i,o,c;return a(this,(function(a){switch(a.label){case 0:return[4,this.getRequestParams()];case 1:return e=a.sent(),n=e.hwid,i=e.device_type,o=s(e,["hwid","device_type"]),[4,this.data.getEmail()];case 2:return(c=a.sent())?[4,this.apiClient.setEmailTags(r(r({},o),{email:c,tags:t}))]:[3,4];case 3:a.sent(),a.label=4;case 4:return[2,this.apiClient.setTags(r(r({},o),{hwid:n,device_type:i,tags:t}))]}}))}))},t.prototype.getTags=function(){return o(this,void 0,void 0,(function(){var t;return a(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 o(this,void 0,void 0,(function(){var e,n,i,o,c,u,p;return a(this,(function(a){switch(a.label){case 0:return[4,this.getRequestParams()];case 1:return e=a.sent(),n=e.hwid,e.device_type,i=s(e,["hwid","device_type"]),[4,this.data.getDeviceType()];case 2:return o=a.sent(),c="".concat(t),[4,this.data.getEmail()];case 3:return u=a.sent(),[4,this.apiClient.registerUser(r(r({},i),{hwid:n,userId:c,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:o}))];case 4:return p=a.sent(),u?[4,this.apiClient.registerEmailUser(r(r({},i),{email:u,userId:c,ts_offset:60*-(new Date).getTimezoneOffset()}))]:[3,6];case 5:a.sent(),a.label=6;case 6:return[4,this.data.setUserId("".concat(t))];case 7:return a.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 8:return a.sent(),[2,p]}}))}))},t.prototype.registerEmail=function(t){return o(this,void 0,void 0,(function(){var e,n,i;return a(this,(function(o){switch(o.label){case 0:return[4,this.getRequestParams()];case 1:return e=o.sent(),e.hwid,e.device_type,n=s(e,["hwid","device_type"]),[4,this.apiClient.registerEmail(r(r({},n),{email:t,ts_offset:60*-(new Date).getTimezoneOffset()}))];case 2:return i=o.sent(),[4,this.data.setEmail("".concat(t))];case 3:return o.sent(),[4,this.data.setStatusEmailWasChanged(!0)];case 4:return o.sent(),[2,i]}}))}))},t.prototype.postEvent=function(t,e){return o(this,void 0,void 0,(function(){var n,i,s,o,c,u,p;return a(this,(function(a){switch(a.label){case 0:return[4,this.getRequestParams()];case 1:return n=a.sent(),i=new Date,s=i.getTime(),o=Math.floor(s/1e3),c=o-i.getTimezoneOffset()/60*3600,[4,this.data.getLastOpenMessage()];case 2:if((u=a.sent())&&u.expiry>Date.now()){if(e.msgHash)return[2,Promise.reject("attribute msgHash already defined")];e=r(r({},e),{msgHash:u.messageHash})}return[4,this.data.setLastOpenMessage(void 0)];case 3:return a.sent(),[4,this.apiClient.postEvent(r(r({},n),{event:t,timestampUTC:o,timestampCurrent:c,attributes:e}))];case 4:return(p=a.sent())&&p.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:p.code}),[2,p]}}))}))},t.prototype.getInboxMessages=function(){return o(this,arguments,void 0,(function(t){var e,n,i;return void 0===t&&(t=0),a(this,(function(s){switch(s.label){case 0:return[4,this.getRequestParams()];case 1:return e=s.sent(),[4,this.data.getInboxLastRequestCode()];case 2:return n=s.sent(),[4,this.data.getInboxLastRequestTime()];case 3:return i=s.sent(),[2,this.apiClient.getInboxMessages(r(r({},e),{count:t,last_code:n,last_request_time:i}))]}}))}))},t.prototype.inboxStatus=function(t,e){return o(this,void 0,void 0,(function(){var n;return a(this,(function(i){switch(i.label){case 0:return[4,this.getRequestParams()];case 1:return n=i.sent(),[2,this.apiClient.inboxStatus(r(r({},n),{inbox_code:t,status:e,time:(new Date).getTime()}))]}}))}))},t.prototype.triggerEvent=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){throw new Error("Method has been deprecated, because we don't aggregate this statistics.")}))}))},t.prototype.pageVisit=function(t){return o(this,void 0,void 0,(function(){var e,n,i;return a(this,(function(s){switch(s.label){case 0:return[4,this.getRequestParams()];case 1:return e=s.sent(),[4,this.data.getFeatures()];case 2:return n=s.sent(),(i=n&&n.page_visit&&n.page_visit.entrypoint)?[2,this.apiClient.pageVisit(r(r({},e),t),i)]:[2]}}))}))},t.prototype.setPurchase=function(t){return o(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return[4,this.getRequestParams()];case 1:return e=n.sent(),[2,this.apiClient.setPurchase(r(r({},e),t))]}}))}))},t.prototype.getParams=function(){return o(this,void 0,void 0,(function(){var t,e,n,i;return a(this,(function(s){switch(s.label){case 0:return[4,this.data.getApplicationCode()];case 1:return t=s.sent(),[4,this.data.getHwid()];case 2:return e=s.sent(),[4,this.data.getTokens()];case 3:return n=s.sent(),[4,this.data.getInitParams()];case 4:return i=s.sent(),[2,r(r({applicationCode:t,hwid:e},n),i)]}}))}))},Object.defineProperty(t.prototype,"params",{get:function(){throw new Error('Property "Pushwoosh.api.params" have been deprecated. Use the async method "Pushwoosh.api.getParams()"')},enumerable:!1,configurable:!0}),t.prototype.getRequestParams=function(){return o(this,void 0,void 0,(function(){var t,e,n,i,r,s,o,c;return a(this,(function(a){switch(a.label){case 0:return[4,this.data.getApplicationCode()];case 1:return t=a.sent(),[4,this.data.getHwid()];case 2:return e=a.sent(),[4,this.data.getUserId()];case 3:return n=a.sent(),[4,this.data.getDeviceType()];case 4:return i=a.sent(),[4,this.data.getDeviceModel()];case 5:return r=a.sent(),[4,this.data.getLanguage()];case 6:return s=a.sent(),[4,this.data.getSdkVersion()];case 7:return o=a.sent(),c=60*-(new Date).getTimezoneOffset(),[2,{application:t,hwid:e,userId:n||e,device_type:i,device_model:r,timezone:c,language:s,v:o}]}}))}))},t}(),kt=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 ".concat(e[1]);var n=t.match(/\bEdge\/(\d+)/);if(null!==n)return"Edge ".concat(n[1]);var i=t.match(/\bEdg\/(\d+)/);if(null!==i)return"Edge ".concat(i[1]);var r=t.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],s=r[1],o=void 0===s?"":s;if(/trident/i.test(t)){var a=/trident\/([.\d]+)/gi.exec(t)||[],c="7.0"===a[1]?"11":a[1];return"IE ".concat(c||"")}r=r[2]?[o,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}();const Pt=new kt(j());var Tt=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()===w},t.prototype.checkIsPermissionDefault=function(){return this.getPermission()===y},t.prototype.checkIsManualUnsubscribed=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.data.getStatusManualUnsubscribed()]}))}))},t.prototype.askPermission=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,Notification.requestPermission()];case 1:return t.sent(),[2]}}))}))},t.prototype.getTokens=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.data.getTokens()]}))}))},t.prototype.subscribe=function(t){return o(this,void 0,void 0,(function(){var e,n,i,r,s,o,c;return a(this,(function(a){switch(a.label){case 0:return(n=t)?[3,2]:[4,this.trySubscribe()];case 1:n=a.sent(),a.label=2;case 2:if(e=n,!this.checkIsPermissionGranted())return ft.error("You must have permission granted before subscribe!"),[2];if(i=this.getPushToken(e),r=e.getKey("p256dh"),s=e.getKey("auth"),!r||!s)throw new Error("Can't get subscription keys!");return o=btoa(String.fromCharCode.apply(String,new Uint8Array(r))),c=btoa(String.fromCharCode.apply(String,new Uint8Array(s))),[4,this.data.setTokens({publicKey:o,pushToken:i,authToken:c,endpoint:e.endpoint})];case 3:return a.sent(),[4,this.api.registerDevice()];case 4:return a.sent(),[2]}}))}))},t.prototype.unsubscribe=function(){return o(this,void 0,void 0,(function(){var t;return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.api.checkDeviceSubscribeForPushNotifications()]}))}))},t.prototype.checkIsNeedResubscribe=function(){return o(this,void 0,void 0,(function(){var t,e,n,i,r,s,o,c;return a(this,(function(a){switch(a.label){case 0:return[4,this.data.getLastPermissionStatus()];case 1:return t=a.sent(),e=this.getPermission(),t===e?[3,3]:[4,this.data.setLastPermissionStatus(e)];case 2:return a.sent(),[2,!0];case 3:return[4,this.getCredentials()];case 4:return n=a.sent(),i=this.getPushToken(n),[4,this.data.getTokens()];case 5:return r=a.sent(),s=r&&r.pushToken||"",o=i===s,[4,this.data.getIsVapidChanged()];case 6:return c=a.sent(),[2,!o||c]}}))}))},t.prototype.getServiceWorkerRegistration=function(){return o(this,void 0,void 0,(function(){var t,e;return a(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 new Error("Internal Error: Can't register service worker!");return[2,this.registration]}}))}))},t.prototype.registerServiceWorker=function(){return o(this,void 0,void 0,(function(){var t,e,n,i,r;return a(this,(function(s){switch(s.label){case 0:return[4,this.data.getServiceWorkerUrl()];case 1:return t=s.sent(),[4,this.data.getServiceWorkerScope()];case 2:return e=s.sent(),[4,this.data.getSdkVersion()];case 3:return n=s.sent(),[4,this.data.getServiceWorkerVersion()];case 4:return i=s.sent(),r="",n!==i&&(r="?cache_clean=".concat(g())),[4,navigator.serviceWorker.register("".concat(t).concat(r),{scope:e})];case 5:return s.sent(),[2]}}))}))},t.prototype.trySubscribe=function(){return o(this,void 0,void 0,(function(){var t;return a(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 o(this,void 0,void 0,(function(){var t,e;return a(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 o(this,void 0,void 0,(function(){return a(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.getPushToken=function(t){return t?t.endpoint:""},t.prototype.getApplicationServerKey=function(){return o(this,void 0,void 0,(function(){return a(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.urlBase64ToUint8Array=function(t){for(var e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),n=atob(e),i=new Uint8Array(n.length),r=0;r<n.length;++r)i[r]=n.charCodeAt(r);return i},t}(),It=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()===w},t.prototype.checkIsPermissionDefault=function(){return this.getPermission()===y},t.prototype.checkIsManualUnsubscribed=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.data.getStatusManualUnsubscribed()];case 1:return[2,t.sent()]}}))}))},t.prototype.askPermission=function(){return o(this,void 0,void 0,(function(){var t,e,n,i=this;return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.data.getTokens()]}))}))},t.prototype.subscribe=function(){return o(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return this.checkIsPermissionGranted()?[4,this.getPermissionInfo()]:(ft.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 o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.api.checkDeviceSubscribeForPushNotifications()]}))}))},t.prototype.checkIsNeedResubscribe=function(){return o(this,void 0,void 0,(function(){var t,e,n,i;return a(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}(),Mt=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 o(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return[4,dt.getAll()];case 1:return t=e.sent(),console.log(t),[2]}}))}))},showKeyValues:function(){return o(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return[4,pt.getAll()];case 1:return t=e.sent(),console.log(t),[2]}}))}))},showMessages:function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,ht.getAll()];case 1:return t.sent().forEach((function(t){return console.log(t)})),[2]}}))}))}},this.eventBus=new F,this.data=new Ct,this.apiClient=new St(this.data),this.api=new Et(this.eventBus,this.data,this.apiClient),this.platformChecker=new kt(j()),this.inboxModel=new _t(this.eventBus,this.data,this.api),this.pwinbox=new vt(this.data,this.api,this.inboxModel),this.onServiceWorkerMessage=this.onServiceWorkerMessage.bind(this),this.subscriptionPromptWidget=new V(this.eventBus,this)}return t.prototype.push=function(t){if("function"!=typeof t){if(!Array.isArray(t))throw new Error("Invalid command!");switch(t[0]){case"init":this.initialize(t[1]);break;case x:case _:case E:case C:case S:case I:case M:case B:case D:case O:case W:case R:case A:case L:case N:case U:case P:case k:case T:this.subscribeToLegacyEvents(t[0],t[1]);break;default:throw new Error("Unknown command!")}}else this.subscribeToLegacyEvents("onReady",t)},t.prototype.subscribe=function(){return o(this,arguments,void 0,(function(t){var e,n,i,r;return void 0===t&&(t=!0),a(this,(function(s){switch(s.label){case 0:return this.isCommunicationDisabled&&ft.error("Communication is disabled!"),this.driver.checkIsPermissionDefault()?(this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),[4,this.driver.askPermission()]):[3,2];case 1:s.sent(),e=this.driver.getPermission(),this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:e}),s.label=2;case 2:return n=this.driver.getPermission(),[4,this.data.getStatusManualUnsubscribed()];case 3:return i=s.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 4:return r=s.sent(),n!==w?[3,7]:(this.eventBus.dispatchEvent("permission-granted",{}),!r&&!i||t?[4,this.driver.subscribe()]:[3,6]);case 5:s.sent(),s.label=6;case 6:return this.eventBus.dispatchEvent("subscribe",{}),[2];case 7:return n!==m?[3,10]:(this.eventBus.dispatchEvent("permission-denied",{}),r?[4,this.driver.unsubscribe()]:[3,9]);case 8:s.sent(),s.label=9;case 9:case 10:return[2]}}))}))},t.prototype.unsubscribe=function(){return o(this,void 0,void 0,(function(){var t;return a(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(),ft.error(t,"Error occurred during the unsubscribe"),[3,3];case 3:return[2]}}))}))},t.prototype.forceSubscribe=function(){return o(this,void 0,void 0,(function(){return a(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(f)===b},t.prototype.isDeviceUnregistered=function(){return localStorage.getItem(f)===v},t.prototype.isSubscribed=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.api.checkDeviceSubscribeForPushNotifications()]}))}))},t.prototype.isCommunicationEnabled=function(){return o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.data.getStatusCommunicationDisabled()];case 1:return[2,!t.sent()]}}))}))},t.prototype.setCommunicationEnabled=function(){return o(this,arguments,void 0,(function(t){var e,n;return void 0===t&&(t=!0),a(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("GDPRConsent",{channel:t,device_type:e})];case 9:return i.sent(),[2]}}))}))},t.prototype.removeAllDeviceData=function(){return o(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return[4,this.data.getDeviceType()];case 1:return t=e.sent(),[4,this.api.postEvent("GDPRDelete",{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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.data.getHwid()];case 1:return[2,t.sent()]}}))}))},t.prototype.getPushToken=function(){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){return a(this,(function(t){switch(t.label){case 0:return[4,this.data.getUserId()];case 1:return[2,t.sent()]}}))}))},t.prototype.getParams=function(){return o(this,void 0,void 0,(function(){return a(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 o(this,void 0,void 0,(function(){var t,e,n,i,r;return a(this,(function(s){switch(s.label){case 0:return t=window.document.title,e=window.location,n=e.origin,i=e.pathname,r=e.href,[4,this.api.pageVisit({title:t,url_path:"".concat(n).concat(i),url:r})];case 1:return s.sent(),[2]}}))}))},t.prototype.initialize=function(t){return o(this,void 0,void 0,(function(){var e,n,i,s,o,c,u,p,d,h,l,f,b,v,m,w;return a(this,(function(a){switch(a.label){case 0:return e=localStorage.getItem("PW_SET_LOGGER_LEVEL"),ft.setLevel(e||t.logLevel||"error"),this.platformChecker.isAvailableNotifications?[4,this.data.getApplicationCode()]:[2];case 1:if(n=a.sent(),!t.applicationCode)throw new Error("Can't find application code!");return i=!n,s=n&&n!==t.applicationCode,i||s?[4,this.data.clearAll()]:[3,4];case 2:return a.sent(),[4,this.data.setApplicationCode(t.applicationCode)];case 3:a.sent(),a.label=4;case 4:return[4,this.data.getHwid()];case 5:return a.sent()?[3,7]:(o=t.applicationCode+"_"+g(),[4,this.data.setHwid(o)]);case 6:a.sent(),a.label=7;case 7:return[4,this.data.setDeviceType(this.platformChecker.getPlatformType())];case 8:return a.sent(),[4,this.data.setDeviceModel(this.platformChecker.getBrowserVersion())];case 9:return a.sent(),[4,this.data.setLanguage(t.tags&&t.tags.Language||navigator.language)];case 10:return a.sent(),[4,this.data.setApiEntrypoint(t.pushwooshUrl||"")];case 11:return a.sent(),[4,this.data.setApiToken(t.apiToken||"")];case 12:return a.sent(),[4,this.data.setSdkVersion("3.39.5")];case 13:return a.sent(),[4,this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt"])];case 14:return c=a.sent(),this.onGetConfig(c&&c.features),this.subscribeWidgetConfig=r({enable:!1},t.subscribeWidget),this.inboxWidgetConfig=r({enable:!1},t.inboxWidget),this.subscribePopupConfig=r({enable:!1},t.subscribePopup),u=this,[4,this.data.getStatusCommunicationDisabled()];case 15:return u.isCommunicationDisabled=a.sent(),[4,this.open()];case 16:return a.sent(),[4,this.data.getStatusUserIdWasChanged()];case 17:return p=a.sent(),!t.userId||"user_id"===t.userId||p?[3,19]:[4,this.api.registerUser(t.userId)];case 18:a.sent(),a.label=19;case 19:return[4,this.data.getStatusEmailWasChanged()];case 20:return d=a.sent(),!t.email||""===t.email||d?[3,23]:/^\S+@\S+\.\S+$/.test(t.email)?[4,this.api.registerEmail(t.email)]:[3,22];case 21:return a.sent(),[3,23];case 22:ft.write("error","can't register invalid email: ".concat(t.email)),a.label=23;case 23:return t.tags&&this.api.setTags(t.tags),[4,this.data.getApplicationServerKey()];case 24:return h=a.sent(),this.platformChecker.isAvailableNotifications&&h?[4,this.initPushNotifications(t)]:[3,26];case 25:a.sent(),a.label=26;case 26:return a.trys.push([26,28,,29]),[4,this.inboxModel.updateMessages()];case 27:return a.sent(),[3,29];case 28:return l=a.sent(),ft.write("error",l),[3,29];case 29:return this.ready=!0,this.eventBus.dispatchEvent("ready",{}),[4,this.data.getDelayedEvent()];case 30:return(f=a.sent())?(b=f.type,v=f.payload,[4,this.emitLegacyEventsFromServiceWorker(b,v)]):[3,33];case 31:return a.sent(),[4,this.data.setDelayedEvent(null)];case 32:a.sent(),a.label=33;case 33: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&&(m=/#P(.*)/,w=decodeURIComponent(document.location.hash),m.test(w)&&this.api.pushStat(m.exec(w)[1]).then(Y)),[2]}}))}))},t.prototype.defaultProcess=function(t){return o(this,void 0,void 0,(function(){var e,n,i,r,s,o,c,u,p,d,h;return a(this,(function(a){switch(a.label){case 0:return"granted"!==(e=this.driver.getPermission())?[3,2]:[4,this.data.setLastPermissionStatus(e)];case 1:a.sent(),a.label=2;case 2:return[4,this.data.getStatusCommunicationDisabled()];case 3:return n=a.sent(),[4,this.data.getStatusDropAllData()];case 4:return i=a.sent(),[4,this.driver.checkIsNeedResubscribe()];case 5:return r=a.sent(),[4,this.data.getFeatures()];case 6:return s=a.sent(),o=s.subscription_prompt&&s.subscription_prompt.use_case,n||i?[4,this.unsubscribe()]:[3,8];case 7:return a.sent(),[2];case 8:return r?[4,this.unsubscribe()]:[3,12];case 9:return a.sent(),[4,this.data.setStatusManualUnsubscribed(!1)];case 10:return a.sent(),[4,this.data.setIsVapidChanged(!1)];case 11:a.sent(),a.label=12;case 12:return c=t.autoSubscribe,[4,this.data.getStatusManualUnsubscribed()];case 13:return u=a.sent(),[4,this.api.checkDeviceSubscribeForPushNotifications(!1)];case 14:switch(p=a.sent(),e){case y:return[3,15];case m:return[3,21];case w:return[3,24]}return[3,29];case 15:return this.eventBus.dispatchEvent("permission-default",{}),p?[4,this.unsubscribe()]:[3,17];case 16:a.sent(),a.label=17;case 17:return[4,this.getWidgetConfig()];case 18:return d=a.sent(),[4,this.checkCanShowByCapping(d)];case 19:return a.sent()?(h="not-set"===o&&c,("default"===o||h)&&(this.subscriptionPromptWidget.init(d),this.subscriptionPromptWidget.show()),[4,this.updateCappingParams()]):[3,29];case 20:return a.sent(),[3,29];case 21:return this.eventBus.dispatchEvent("permission-denied",{}),p?[4,this.unsubscribe()]:[3,23];case 22:a.sent(),a.label=23;case 23:return[3,29];case 24:return this.eventBus.dispatchEvent("permission-granted",{}),u&&p?[4,this.unsubscribe()]:[3,26];case 25:a.sent(),a.label=26;case 26:return!p&&!u||r?[4,this.subscribe(!0)]:[3,28];case 27:a.sent(),a.label=28;case 28:return[3,29];case 29:return[2]}}))}))},t.prototype.getWidgetConfig=function(){return o(this,void 0,void 0,(function(){var t,e,n;return a(this,(function(i){switch(i.label){case 0:return[4,this.data.getFeatures()];case 1:return t=i.sent(),e=t.subscription_prompt_widget&&t.subscription_prompt_widget.params,n=r({cappingCount:q.cappingCount,cappingDelay:q.cappingDelay},e),[2,e?n:q]}}))}))},t.prototype.checkCanShowByCapping=function(t){return o(this,void 0,void 0,(function(){var e,n,i,r,s;return a(this,(function(o){switch(o.label){case 0:return e=(new Date).getTime(),[4,this.data.getPromptDisplayCount()];case 1:return n=o.sent(),[4,this.data.getPromptLastSeenTime()];case 2:return i=o.sent(),r=t.cappingCount>n,s=e-i>t.cappingDelay,[2,r&&s]}}))}))},t.prototype.updateCappingParams=function(){return o(this,void 0,void 0,(function(){var t,e;return a(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=void 0===i?"":i,s=n.payload,o=void 0===s?{}:s;this.emitLegacyEventsFromServiceWorker(r,o)},t.prototype.open=function(t){return o(this,void 0,void 0,(function(){var e,n,i;return a(this,(function(r){switch(r.label){case 0:return[4,this.data.getLastOpenApplicationTime()];case 1:return e=r.sent(),n=Date.now(),e||(e=0),i=n-e<36e5,t||!i?[4,this.data.setLastOpenApplicationTime(n)]:[2];case 2:return r.sent(),[4,this.api.applicationOpen()];case 3:return r.sent(),[2]}}))}))},t.prototype.onGetConfig=function(t){return o(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return[4,this.data.setFeatures(t)];case 1:return n.sent(),t?t.page_visit&&t.page_visit.enabled?[4,pt.set("PAGE_VISITED_URL",t.page_visit.entrypoint)]:[3,3]:[3,7];case 2:n.sent(),this.sendStatisticsVisitedPage(),n.label=3;case 3:return t.events&&t.events.length&&t.events.some((function(t){return t===H}))&&this.sendPostEventVisitedPage(),t.vapid_key?[4,this.data.getApplicationServerKey()]:[3,7];case 4:return e=n.sent(),[4,this.data.setApplicationServerKey(t.vapid_key)];case 5:return n.sent(),e===t.vapid_key?[3,7]:[4,this.data.setIsVapidChanged(!0)];case 6:n.sent(),n.label=7;case 7:return[2]}}))}))},t.prototype.initPushNotifications=function(t){return o(this,void 0,void 0,(function(){var e;return a(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(r({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(),ft.error(e,"Internal error: defaultProcess fail"),[3,10];case 10:return[2]}}))}))},t.prototype.initDriver=function(){return o(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:return this.platformChecker.isSafari?[4,this.data.getInitParams()]:[3,2];case 1:return(t=e.sent().safariWebsitePushID)?(this.driver=new It(this.api,this.data,{webSitePushId:t}),[2]):(ft.info("For work with Safari Push Notification add safariWebsitePushID to initParams!"),[2]);case 2:return this.platformChecker.isAvailableServiceWorker?(this.driver=new Tt(this.api,this.data,{}),[2]):[2]}}))}))},t.prototype.sendPostEventVisitedPage=function(){return o(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){return t=window.document.title,e=window.location.href,this.api.postEvent(H,{url:e,title:t,device_type:this.platformChecker.platform}),[2]}))}))},t.prototype.subscribeToLegacyEvents=function(t,e){var n=this;switch(t){case x:e();break;case _:if(this.ready){e(this.api);break}this.eventBus.addEventHandler("ready",(function(){return e(n.api)}));break;case E:this.eventBus.addEventHandler("register",(function(){return e(n.api)}));break;case C:this.eventBus.addEventHandler("subscribe",(function(){return e(n.api)}));break;case S:this.eventBus.addEventHandler("unsubscribe",(function(){return e(n.api)}));break;case I:this.eventBus.addEventHandler("initialize-service-worker-error",(function(t){var i=t.error;return e(n.api,i)}));break;case M:this.eventBus.addEventHandler("receive-push",(function(t){var i=t.notification;return e(n.api,i)}));break;case B:this.eventBus.addEventHandler("open-notification",(function(t){var i=t.notification;return e(n.api,i)}));break;case D:this.eventBus.addEventHandler("hide-notification",(function(t){var i=t.notification;return e(n.api,i)}));break;case O:this.eventBus.addEventHandler("change-enabled-communication",(function(t){var i=t.isEnabled;return e(n.api,i)}));break;case W:this.eventBus.addEventHandler("receive-inbox-message",(function(t){var i=t.message;return e(n.api,i)}));break;case R:this.eventBus.addEventHandler("update-inbox-messages",(function(t){var i=t.messages;return e(n.api,i)}));break;case A:this.eventBus.addEventHandler("show-notification-permission-dialog",(function(){return e(n.api)}));break;case L:this.eventBus.addEventHandler("hide-notification-permission-dialog",(function(t){var i=t.permission;return e(n.api,i)}));break;case N:this.eventBus.addEventHandler("show-subscription-widget",(function(){return e(n.api)}));break;case U:this.eventBus.addEventHandler("hide-subscription-widget",(function(){return e(n.api)}));break;case P:this.eventBus.addEventHandler("permission-denied",(function(){return e(n.api)}));break;case k:this.eventBus.addEventHandler("permission-default",(function(){return e(n.api)}));break;case T:this.eventBus.addEventHandler("permission-granted",(function(){return e(n.api)}))}},t.prototype.emitLegacyEventsFromServiceWorker=function(t,e){switch(t){case M:this.eventBus.dispatchEvent("receive-push",{notification:e});break;case B:this.eventBus.dispatchEvent("open-notification",{notification:e});break;case D:this.eventBus.dispatchEvent("hide-notification",{notification:e});break;case W:this.eventBus.dispatchEvent("receive-inbox-message",{message:e})}},t}();const Bt=Mt;var Dt=["Jan","Feb","Mar","Apr","May","June","July","Aug","Sept","Oct","Nov","Dec"],Ot=[{name:"widgetWidth",type:"size"},{name:"borderRadius",type:"size"},{name:"zIndex",type:"number"},{name:"fontFamily",type:"string"},{name:"bgColor",type:"color"},{name:"textColor",type:"color"},{name:"arrowBorderColor",type:"color"},{name:"borderColor",type:"color"},{name:"badgeBgColor",type:"color"},{name:"badgeTextColor",type:"color"},{name:"timeTextColor",type:"color"},{name:"messageTitleColor",type:"color"},{name:"emptyInboxTitleColor",type:"color"},{name:"emptyInboxTextColor",type:"color"}],Wt={enable:!1,triggerId:"pwInbox",position:"bottom",appendTo:"body",title:"Inbox",bgColor:"#ffffff",textColor:"#333333",fontFamily:"inherit",borderRadius:4,borderColor:"transparent",badgeBgColor:"#ff4c00",badgeTextColor:"#ffffff",widgetWidth:350,zIndex:100,messageTitleColor:"#7a7a7a",timeTextColor:"#c4c4c4",emptyInboxTitle:"You're all caught up",emptyInboxTitleColor:"#333333",emptyInboxText:"There are no new messages. Stay tuned!",emptyInboxTextColor:"#7a7a7a",emptyInboxIconUrl:"https://pushon.pushwoosh.com/images/icon-empty-inbox.png",arrowBorderColor:"rgba(0,0,0,.1)"},Rt=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/;function At(t){var e="fixed"===window.getComputedStyle(t).position;return!e&&t.parentElement&&(e=At(t.parentElement)),e}var Lt=function(t){var e=t.imageUrl,n=t.title,i=t.message,r=t.sendDate;return'\n<div class="pw-inbox_item-inner">\n <div class="pw-inbox_icon">\n <img src="'.concat(e,'" alt="').concat(n||i,'" class="pw-inbox_message-image">\n </div>\n <div class="pw-inbox_content">\n ').concat(n?'<div class="pw-inbox_item-title">\n '.concat(n,"\n </div>"):null,'\n <div class="pw-inbox_item-body">\n ').concat(i,'\n </div>\n <div class="pw-inbox_item-time">\n ').concat(function(t){var e=new Date(t),n=e.getHours()+e.getTimezoneOffset()/60;e.setHours(n);var i=(new Date).getTime()-e.getTime();if(i<=6e4)return"Just now";if(i<36e5&&i>0){var r=Math.floor(i/6e4);return"".concat(r," minutes ago")}if(i<864e5&&i>0){var s=Math.floor(i/36e5);return"".concat(s," hours ago")}var o=e.getDate(),a=Dt[e.getMonth()],c=e.getFullYear(),u=e.getHours(),p="0".concat(e.getMinutes().toString()).slice(-2);return"".concat(o," ").concat(a," ").concat(c,", ").concat(u,":").concat(p)}(r),'\n </div>\n </div>\n</div>\n<span class="pw-inbox_item-remove"></span>')},Nt=function(){function t(t){this.pw=t,this.config=r(r(r({},Wt),{arrowBorderColor:this.pw.inboxWidgetConfig.borderColor&&"transparent"!==this.pw.inboxWidgetConfig.borderColor?this.pw.inboxWidgetConfig.borderColor:"rgba(0,0,0,.1)"}),this.pw.inboxWidgetConfig),this.updateInbox=this.updateInbox.bind(this),this.markVisibleItemsAsRead=this.markVisibleItemsAsRead.bind(this),this.onWidgetClickHandler=this.onWidgetClickHandler.bind(this),this.onTriggerClickHandler=this.onTriggerClickHandler.bind(this),this.onWindowScrollHandler=this.onWindowScrollHandler.bind(this),this.toggle=this.toggle.bind(this);try{this.initTrigger(),this.updateInbox(),this.addListeners()}catch(t){console.warn(t)}}return t.prototype.toggle=function(t){(void 0===t?!this.isOpened:t)?this.openWidget():this.closeWidget()},t.prototype.initTrigger=function(){if(!this.pw.pwinbox)throw new Error("Web inbox is not allowed.");var t=document.getElementById(this.config.triggerId);if(!t)throw new Error("Inbox trigger element doesn't exist. You must set triggerId in inboxWidget config. See the documentation.");this.trigger=t,this.trigger.classList.add("pw-inbox-trigger"),this.defaultMargin=12,this.messagesElements={},this.messages=[],this.readItems=[],this.updateCounter(0),this.isOpened=!1,this.renderWidget(),this.isFixed=At(this.trigger)},t.prototype.renderWidget=function(){this.widget=document.createElement("div"),this.widget.id="pwInboxWidget",this.widget.className="pw-inbox-widget",this.widget.classList.toggle("pw-open",this.isOpened),this.widgetParent=document.querySelector(this.config.appendTo)||document.body,this.widgetParent.appendChild(this.widget),this.widgetParent.appendChild(this.getStyle()),this.renderWidgetInner()},t.prototype.getStyle=function(){var t=document.createElement("style");return t.innerHTML=this.configureStyle(".pw-inbox-trigger {\n position: relative;\n cursor: pointer;\n}\n\n.pw-inbox-trigger:after {\n content: attr(data-pw-count);\n display: block;\n position: absolute;\n right: 0;\n top: 0;\n background: var(--badgeBgColor);\n border-radius: 8px;\n color: var(--badgeTextColor);\n font-size: 10px;\n font-weight: normal;\n line-height: 16px;\n width: 16px;\n padding: 0 2px;\n box-sizing: border-box;\n text-align: center;\n}\n\n.pw-inbox-trigger.pw-empty:after {\n display: none;\n}\n\n.pw-inbox-widget * {\n position: static;\n box-sizing: border-box;\n font-size: 1em;\n outline: none;\n font-family: var(--fontFamily);\n}\n.pw-inbox-widget {\n font-size: 14px;\n position: absolute;\n top: 0;\n left: -1000px;\n background: var(--bgColor);\n border: solid 1px var(--borderColor);\n border-radius: var(--borderRadius);\n width: var(--widgetWidth);\n box-shadow: 0 1px 4px 0 rgba(0,0,0,.25);\n z-index: var(--zIndex);\n opacity: 0;\n transition: opacity .6s ease;\n transition-delay: 100ms;\n}\n.pw-inbox-widget.pw-open {\n opacity: 1;\n transition-delay: 0ms;\n}\n.pw-inbox-widget.pw-inbox-widget--inset {\n top: auto;\n left: auto;\n display: none;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-open {\n display: block;\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-bottom {\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-top {\n bottom: 100%;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-right {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--inset.pw-left {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-inbox-widget--empty {\n max-height: none;\n}\n.pw-inbox-widget .pw-inbox__arrow {\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget .pw-inbox__arrow:before {\n content: \"\";\n display: block;\n width: 0;\n height: 0;\n border-width: 10px;\n border-style: solid;\n border-color: transparent;\n position: absolute;\n}\n.pw-inbox-widget.pw-top {\n margin-top: -12px;\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow {\n border-top-color: var(--arrowBorderColor);\n bottom: -21px;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-top .pw-inbox__arrow:before {\n border-top-color: var(--bgColor);\n top: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-bottom {\n margin-top: 12px;\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow {\n border-bottom-color: var(--arrowBorderColor);\n top: -21px;\n left: 50%;\n transform: translateX(-50%);\n}\n.pw-inbox-widget.pw-bottom .pw-inbox__arrow:before {\n border-bottom-color: var(--bgColor);\n bottom: -11px;\n left: -10px;\n}\n.pw-inbox-widget.pw-left {\n margin-left: -12px;\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow {\n border-left-color: var(--arrowBorderColor);\n right: -21px;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-left .pw-inbox__arrow:before {\n border-left-color: var(--bgColor);\n left: -11px;\n top: -10px;\n}\n.pw-inbox-widget.pw-right {\n margin-left: 12px;\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow {\n border-right-color: var(--arrowBorderColor);\n left: -21px;\n top: 50%;\n transform: translateY(-50%);\n}\n.pw-inbox-widget.pw-right .pw-inbox__arrow:before {\n border-right-color: var(--bgColor);\n right: -11px;\n top: -10px;\n}\n.pw-inbox_inner {\n overflow: hidden;\n display: flex;\n flex-direction: column;\n height: 100%;\n}\n.pw-inbox_title {\n color: var(--textColor);\n margin: 0;\n padding: 28px 32px 12px;\n font-size: 24px;\n font-weight: 500;\n line-height: 1.1;\n text-align: left;\n flex: 0 0 66px;\n}\n.pw-inbox_list {\n overflow-x: hidden;\n overflow-y: auto;\n min-width: 200px;\n max-height: 300px;\n padding: 0;\n margin: 0;\n list-style: none;\n position: relative;\n flex: 1 1 auto;\n}\n\n.pw-inbox_item {\n position: relative;\n padding: 8px 32px;\n margin: 0;\n text-align: left;\n}\n.pw-inbox_item-inner {\n display: flex;\n cursor: pointer;\n}\n.pw-inbox_icon {\n flex: 0 0 40px;\n}\n.pw-inbox_message-image {\n width: 28px;\n}\n.pw-inbox_content {\n flex: 0 1 100%;\n}\n.pw-inbox_item-title {\n color: var(--messageTitleColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-body {\n color: var(--textColor);\n font-size: 14px;\n line-height: 20px;\n margin-bottom: 4px;\n}\n.pw-inbox_item-time {\n color: var(--timeTextColor);\n font-size: 12px;\n line-height: 17px;\n}\n.pw-inbox_item-remove {\n position: absolute;\n z-index: 2;\n top: 8px;\n right: 8px;\n display: none;\n width: 10px;\n height: 10px;\n background: transparent url('https://cdn.pushwoosh.com/webpush/img/iconClose.svg') 50% no-repeat;\n cursor: pointer;\n}\n.pw-inbox_item:hover .pw-inbox_item-remove {\n display: block;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-title {\n color: var(--textColor);\n font-weight: 700;\n}\n\n.pw-inbox_item.pw-new .pw-inbox_item-body {\n font-weight: 700;\n}\n\n.pw-inbox_list--empty {\n padding: 50px 16px;\n text-align: center;\n max-height: 100%;\n overflow: auto;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-icon {\n text-align: center;\n margin-bottom: 30px;\n}\n.pw-inbox_list--empty .pw-inbox_list-icon img {\n max-width: 100%;\n}\n\n.pw-inbox_list--empty .pw-inbox_list-title {\n font-size: 28px;\n line-height: 36px;\n color: var(--emptyInboxTitleColor);\n margin-bottom: 20px;\n}\n\n.pw-inbox_list--empty .ipw-inbox_list-body {\n font-size: 14px;\n line-height: 18px;\n color: var(--emptyInboxTextColor);\n}\n"),t},t.prototype.configureStyle=function(t){var e=this,n=t.toString();return Ot.forEach((function(t){var i=new RegExp("var\\(--".concat(t.name,"\\)"),"ig"),r=e.getStyleFormatter(t);n=n.replace(i,r)})),n},t.prototype.getStyleFormatter=function(t){switch(t.type){case"size":return"".concat(this.config[t.name]||0,"px");case"number":return parseFloat(this.config[t.name].toString()).toString();case"string":return this.config[t.name].toString();case"color":return"transparent"===(e=this.config[t.name].toString())||Rt.test(e)?e:"#333";default:return"none"}var e},t.prototype.renderWidgetInner=function(){if(this.messages.length>0)this.widget.classList.remove("pw-inbox-widget--empty"),this.widget.innerHTML=(r=this.config.title,'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_inner">\n <div class="pw-inbox_title">\n '.concat(r,'\n </div>\n <ul class="pw-inbox_list">\n\n </ul>\n</div>')),this.renderMessages();else{this.widget.classList.add("pw-inbox-widget--empty");var t=this.config,e=t.emptyInboxTitle,n=t.emptyInboxText,i=t.emptyInboxIconUrl;this.widget.innerHTML=function(t,e,n){return'\n<div class="pw-inbox__arrow"></div>\n<div class="pw-inbox_list--empty">\n <div class="pw-inbox_list-icon">\n <img src="'.concat(t,'" alt="').concat(e,'">\n </div>\n <div class="pw-inbox_list-title">\n ').concat(e,'\n </div>\n <div class="ipw-inbox_list-body">\n ').concat(n,"\n </div>\n</div>")}(i,e,n)}var r},t.prototype.renderMessages=function(){var t=this;this.list=this.widget.querySelector(".pw-inbox_list")||document.createElement("ul"),this.messages.forEach((function(e){var n=document.createElement("li");n.className="pw-inbox_item",n.classList.toggle("pw-new",!e.isRead),n.classList.toggle("pw-unread",!e.isActionPerformed),n.setAttribute("data-pw-inbox-message-id",e.code),n.innerHTML=Lt(e),t.list.appendChild(n),t.messagesElements[e.code]=n}))},t.prototype.updateCounter=function(t){this.count=t,this.trigger.setAttribute("data-pw-count","".concat(this.count)),this.trigger.classList.toggle("pw-empty",0===this.count)},t.prototype.updateInboxMessages=function(t){this.messages=t.sort((function(t,e){var n,i,r,s,o,a=t.sendDate,c=e.sendDate;return n=c,i=new Date(a),r=i.getHours()+i.getTimezoneOffset()/60,s=new Date(n),o=s.getHours()+s.getTimezoneOffset()/60,i.setHours(r),s.setHours(o),s.getTime()-i.getTime()})),this.renderWidgetInner()},t.prototype.openWidget=function(){this.isOpened=!0,this.widget.classList.add("pw-open"),document.addEventListener("click",this.onWidgetClickHandler),window.addEventListener("scroll",this.onWindowScrollHandler),window.addEventListener("resize",this.onWindowScrollHandler),this.markVisibleItemsAsRead(),this.messages.length>0&&this.list.addEventListener("scroll",this.markVisibleItemsAsRead),this.positionWidget()},t.prototype.closeWidget=function(){this.isOpened=!1,document.removeEventListener("click",this.onWidgetClickHandler),document.removeEventListener("click",this.onWindowScrollHandler),window.removeEventListener("resize",this.onWindowScrollHandler),this.updateReadStatus(),this.messages.length>0&&this.list.removeEventListener("scroll",this.markVisibleItemsAsRead),this.widget.classList.remove("pw-open","pw-top","pw-bottom","pw-right","pw-left"),this.widget.removeAttribute("style")},t.prototype.positionWidget=function(){this.isOpened&&(this.widgetParent===document.body?this.defaultPlaceWidget():this.customPlaceWidget())},t.prototype.customPlaceWidget=function(){var t=this.config.position;this.widgetParent.style.position="relative",this.widget.classList.add("pw-inbox-widget--inset"),this.widget.classList.add("pw-".concat(t))},t.prototype.defaultPlaceWidget=function(){var t=this.pw.inboxWidgetConfig.position?this.config.position:this.getDefaultPosition(),e=this.widget.getBoundingClientRect();if(document.documentElement){var n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight,window.innerHeight||0);switch(e.width+2*this.defaultMargin>n&&(this.widget.style.width="".concat(n-2*this.defaultMargin,"px")),e.height+24>i&&(this.widget.style.height="".concat(i-2*this.defaultMargin,"px")),t){case"top":this.alignWidgetTop();break;case"right":this.alignWidgetRight();break;case"left":this.alignWidgetLeft();break;case"bottom":this.alignWidgetBottom()}}},t.prototype.alignWidgetTop=function(){var t=this.trigger.getBoundingClientRect(),e=this.widget.getBoundingClientRect();if(document.documentElement){var n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-top");var r=pageXOffset+t.left+Math.floor(t.width/2)-Math.floor(e.width/2),s=r<pageXOffset,o=r+e.width>pageXOffset+n;s&&(r=pageXOffset+this.defaultMargin),o&&(r=pageXOffset+n-e.width-this.defaultMargin);var a=pageYOffset+t.top-e.height;this.alignWidgetElement(r,a),i.style.left="".concat(t.left+Math.floor(t.width/2)-r,"px");var c=this.widget.getBoundingClientRect().top;if(c<0){var u=this.widget.getBoundingClientRect().height+c-this.defaultMargin,p=this.widget.getBoundingClientRect().top-c+this.defaultMargin;this.widget.style.height="".concat(u,"px"),this.widget.style.top="".concat(p,"px")}}},t.prototype.alignWidgetRight=function(){var t=this.trigger.getBoundingClientRect(),e=this.widget.getBoundingClientRect();if(document.documentElement){var n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight,window.innerHeight||0),r=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-right");var s=pageYOffset+t.top+Math.floor(t.height/2)-Math.floor(e.height/2),o=s<pageYOffset,a=pageYOffset+i<s+e.height;o&&(s=pageYOffset+this.defaultMargin),a&&(s=pageYOffset+i-e.height-this.defaultMargin);var c=pageXOffset+t.left+t.width;this.alignWidgetElement(c,s),r.style.top="".concat(t.top+Math.floor(t.height/2)-s,"px");var u=n-this.widget.getBoundingClientRect().right;if(u<this.defaultMargin){var p=this.widget.getBoundingClientRect().width+u-this.defaultMargin;this.widget.style.width="".concat(p,"px")}}},t.prototype.alignWidgetLeft=function(){var t=this.trigger.getBoundingClientRect(),e=this.widget.getBoundingClientRect();if(document.documentElement){var n=Math.max(document.documentElement.clientHeight,window.innerHeight||0),i=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-left");var r=pageYOffset+t.top+Math.floor(t.height/2)-Math.floor(e.height/2),s=r<pageYOffset,o=pageYOffset+n<r+e.height;s&&(r=pageYOffset+this.defaultMargin),o&&(r=pageYOffset+n-e.height-this.defaultMargin);var a=pageXOffset+t.left-e.width;this.alignWidgetElement(a,r),i.style.top="".concat(t.top+Math.floor(t.height/2)-r,"px");var c=this.widget.getBoundingClientRect().left;if(c<0){var u=this.widget.getBoundingClientRect().width+c-this.defaultMargin,p=this.widget.getBoundingClientRect().left-c;this.widget.style.width="".concat(u,"px"),this.widget.style.left="".concat(p,"px")}}},t.prototype.alignWidgetBottom=function(){var t=this.trigger.getBoundingClientRect(),e=this.widget.getBoundingClientRect();if(document.documentElement){var n=Math.max(document.documentElement.clientWidth,window.innerWidth||0),i=Math.max(document.documentElement.clientHeight,window.innerHeight||0),r=this.widget.querySelector(".pw-inbox__arrow")||document.createElement("div");this.widget.classList.add("pw-bottom");var s=pageXOffset+t.left+Math.floor(t.width/2)-Math.floor(e.width/2),o=s<pageXOffset,a=s+e.width>pageXOffset+n;o&&(s=pageXOffset+this.defaultMargin),a&&(s=pageXOffset+n-e.width-12);var c=pageYOffset+t.top+t.height;this.alignWidgetElement(s,c),r.style.left="".concat(t.left+Math.floor(t.width/2)-s,"px");var u=i-this.widget.getBoundingClientRect().bottom;if(u<this.defaultMargin){var p=this.widget.getBoundingClientRect().height+u-this.defaultMargin;this.widget.style.height="".concat(p,"px")}}},t.prototype.alignWidgetElement=function(t,e){this.widget.style.left="".concat(t,"px"),this.widget.style.top="".concat(e,"px")},t.prototype.getDefaultPosition=function(){var t=this.trigger.getBoundingClientRect(),e=t.left,n=t.top,i=t.width,r=t.height;if(!document.documentElement)return"";var s={right:e,bottom:n,left:Math.max(document.documentElement.clientWidth,window.innerWidth||0)-(e+i),top:Math.max(document.documentElement.clientHeight,window.innerHeight||0)-(n+r)},o=Math.min(e,n,s.left,s.top),a="bottom";return Object.keys(s).forEach((function(t){s[t]===o&&(a=t)})),a},t.prototype.addListeners=function(){var t=this;this.trigger.addEventListener("click",this.onTriggerClickHandler),this.pw.push(["onPutNewMessageToInboxStore",function(){t.updateInbox()}]),this.pw.push(["onUpdateInboxMessages",function(){t.updateInbox()}])},t.prototype.markVisibleItemsAsRead=function(){var t=this;if(0!==this.messages.length){var e=this.list.clientHeight+this.list.scrollTop-50;Object.keys(this.messagesElements).forEach((function(n){if(t.messagesElements[n]&&!(t.messagesElements[n].offsetTop>e)){var i=t.messages.find((function(t){return t.code===n}));!i||i.isRead||t.readItems.indexOf(n)+1||t.readItems.push(n)}}))}},t.prototype.updateReadStatus=function(){this.pw.pwinbox.readMessagesWithCodes(this.readItems).then(this.updateInbox)},t.prototype.updateInbox=function(){var t=this;this.pw.pwinbox.loadMessages().then((function(e){t.updateInboxMessages(e)})),this.pw.pwinbox.unreadMessagesCount().then((function(e){t.updateCounter(e)}))},t.prototype.performMessageAction=function(t){var e=this;this.pw.pwinbox.performActionForMessageWithCode(t).then((function(){e.updateInbox()}))},t.prototype.removeMessages=function(t){var e=this;t.forEach((function(t){e.readItems=e.readItems.slice(e.readItems.indexOf(t),1)})),this.pw.pwinbox.deleteMessagesWithCodes(t).then((function(){e.updateInbox()}))},t.prototype.onTriggerClickHandler=function(t){t.stopPropagation(),t.target&&this.toggle()},t.prototype.onWidgetClickHandler=function(t){if(t.target){var e=t.target.closest(".pw-inbox_item");if(e){var n=e.getAttribute("data-pw-inbox-message-id");if(n)t.target.closest(".pw-inbox_item-remove")?this.removeMessages([n]):this.performMessageAction(n)}else this.toggle()}},t.prototype.onWindowScrollHandler=function(){this.isFixed&&this.isOpened?this.toggle():this.positionWidget()},t}();const Ut=Nt;var Ht="bottomRight",qt="bottomLeft",Ft="topRight",zt="topLeft",Vt={position:qt,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"}};const jt=function(){function t(){}return t.getBellPosition=function(t,e){var n;switch(t){case Ht:n={top:"auto",left:"auto",bottom:e,right:e};break;case qt:n={top:"auto",left:e,bottom:e,right:"auto"};break;case zt:n={top:e,left:e,bottom:"auto",right:"auto"};break;case Ft:n={top:e,left:"auto",bottom:"auto",right:e};break;default:n={top:"auto",left:"auto",bottom:e,right:e}}return n},t.getTooltipPosition=function(t,e){var n,i,r=parseInt(e)+12+"px";switch(t){case Ht:n={right:r},i="right";break;case qt:case zt:n={left:r},i="left";break;default:n={right:r},i="right"}return[n,i]},t.getPopoverPosition=function(t,e){var n,i,r=parseInt(e)+15+"px";switch(t){case Ht:n={bottom:r,right:"0",left:"auto",top:"auto"},i="bottom";break;case qt:n={bottom:r,left:"0",right:"auto",top:"auto"},i="bottom";break;case zt:n={top:r,left:"0",right:"auto",bottom:"auto"},i="top";break;case Ft:n={top:r,right:"0",left:"auto",bottom:"auto"},i="top";break;default:n={bottom:r,right:"0",left:"auto",top:"auto"},i="bottom"}return[n,i]},t.getPopoverArrowPosition=function(t,e){var n;switch(t){case Ht:n="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ".concat(parseInt(e)/2-4+"px");break;case qt:n="\n.pushwoosh-subscribe-widget__popover__bottom:after {right: auto; left: ".concat(parseInt(e)/2-12+"px");break;case zt:n="\n.pushwoosh-subscribe-widget__popover__top:after {right: auto; left: ".concat(parseInt(e)/2-12+"px");break;case Ft:n="\n.pushwoosh-subscribe-widget__popover__top:after {left: auto; right: ".concat(parseInt(e)/2-4+"px");break;default:n="\n.pushwoosh-subscribe-widget__popover__bottom:after {left: auto; right: ".concat(parseInt(e)/2-4+"px")}return n},t}();var Yt=function(){function t(t){var e=this;if(this.pw=t,Pt.isAvailableNotifications){this.clickBell=this.clickBell.bind(this),this.onSubscribeEvent=this.onSubscribeEvent.bind(this),this.onUnsubscribeEvent=this.onUnsubscribeEvent.bind(this),this.onPermissionDeniedEvent=this.onPermissionDeniedEvent.bind(this),this.clickOutOfPopover=this.clickOutOfPopover.bind(this);var n=Object.assign(Vt.tooltipText,t.subscribeWidgetConfig.tooltipText);this.config=Object.assign({},Vt,t.subscribeWidgetConfig),this.config.tooltipText=n,t.isSubscribed().then((function(t){t||e.render()}))}else console.warn("Browser does not support push notifications")}return t.prototype.addStylesToElement=function(t,e){Object.keys(t).forEach((function(n){e.style[n]=t[n]}))},t.prototype.createContainer=function(){var t=document.createElement("div");t.id="pushwooshBellWidget",t.className="pushwoosh-subscribe-widget";var e=jt.getBellPosition(this.config.position,this.config.indent),n=Object.assign({zIndex:this.config.zIndex},e);return this.addStylesToElement(n,t),t},t.prototype.createStyle=function(){var t=document.createElement("style");return t.innerHTML='/* Widget */\n.pushwoosh-subscribe-widget {\n position: fixed;\n display: block;\n transform: translate3d(0, 0, 0);\n}\n\n.pushwoosh-subscribe-widget__subscribed {\n display: none;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button {\n border-radius: 50%;\n cursor: pointer;\n font-size: 0;\n text-align: center;\n transform: scale(0.9) translate3d(0, 0, 0);\n transition: transform .3s ease-in-out;\n position: relative;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__bell-button:hover {\n transform: scale(1);\n}\n\n/* Tooltip */\n.pushwoosh-subscribe-widget__tooltip {\n position: absolute;\n height: 48px;\n max-width: 300px;\n min-width: 200px;\n padding: 5px 7px;\n background-color: #3b444b;\n color: #ffffff;\n text-align: center;\n vertical-align: middle;\n box-sizing: border-box;\n line-height: 38px;\n font-size: 0;\n font-weight: normal;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0s ease-in .3s,\n opacity .3s ease-in;\n top: 50%;\n transform: translate(0, -50%);\n box-shadow: 1px 1px 5px 0 rgba(0,0,0,0.5);\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after,\n.pushwoosh-subscribe-widget__tooltip__left:after {\n content: "";\n top: 50%;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n background: #3b444b;\n}\n\n.pushwoosh-subscribe-widget__tooltip__right:after {\n left: calc(100% - 7px);\n border-top: 5px solid #3b444b;\n border-left: 5px solid #3b444b;\n border-right: 5px solid transparent;\n box-sizing: border-box;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n box-shadow: 2px 2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__tooltip__left:after {\n left: -7px;\n border-top: 5px solid #3b444b;\n border-right: 5px solid #3b444b;\n border-left: 5px solid transparent;\n box-sizing: border-box;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n box-shadow: -2px -2px 2px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__bell-button:hover + .pushwoosh-subscribe-widget__tooltip,\n.pushwoosh-subscribe-widget__tooltip.pushwoosh-subscribe-widget__tooltip__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__tooltip-content {\n display: inline-block;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1.4;\n white-space: nowrap;\n overflow: hidden;\n padding-right: 5px;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n/* Popover */\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover {\n position: absolute;\n right: auto;\n box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.5);\n box-sizing: border-box;\n background: #9ca8b1;\n visibility: hidden;\n opacity: 0;\n transition: visibility 0s ease-in .5s,\n opacity .5s ease-in;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover__visible {\n display: block;\n visibility: visible;\n opacity: 1;\n transition-delay: 0s;\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after,\n.pushwoosh-subscribe-widget__popover__top:after {\n content: "";\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-right: 8px solid transparent;\n border-left: 8px solid #9ca8b1;\n background: #9ca8b1;\n transform-origin: 0 0;\n transform: rotate(-45deg);\n}\n\n.pushwoosh-subscribe-widget__popover__bottom:after {\n border-bottom: 8px solid #9ca8b1;\n border-top: 8px solid transparent;\n box-sizing: border-box;\n box-shadow: -2px 2px 1px 0 rgba(0, 0, 0, 0.25);\n bottom: -16px;\n}\n\n.pushwoosh-subscribe-widget__popover__top:after {\n top: 0;\n border-top: 8px solid #9ca8b1;\n border-bottom: 8px solid transparent;\n box-sizing: border-box;\n box-shadow: 1px -1px 1px 0 rgba(0, 0, 0, 0.25);\n}\n\n.pushwoosh-subscribe-widget__popover-content-wrapper {\n overflow: auto;\n max-width: 100%;\n}\n\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n display: flex;\n flex-direction: column;\n padding: 14px;\n box-sizing: border-box;\n float: left;\n min-width: 100%;\n align-items: center;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n display: block;\n}\n\n.pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-bottom: 14px;\n}\n\n@media (max-width: 767px) and (orientation: portrait) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n flex-direction: column;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 0;\n margin-bottom: 14px;\n }\n}\n@media (max-width: 767px) and (orientation: landscape) {\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover-content {\n flex-direction: row;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img {\n max-width: 280px;\n height: auto;\n }\n .pushwoosh-subscribe-widget .pushwoosh-subscribe-widget__popover img:first-child {\n margin-right: 14px;\n margin-bottom: 0;\n }\n}\n',t},t.prototype.createBell=function(){var t,e,n,i=this.config;return i.buttonImage?(t=document.createElement("img")).src=i.buttonImage:(t=document.createElement("div"),this.addStylesToElement({backgroundColor:i.bgColor,boxShadow:i.shadow,lineHeight:i.size,border:i.bellButtonBorder},t),t.innerHTML=(e=i.bellColor,n=i.bellStrokeColor,'<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<svg\n xmlns:dc="http://purl.org/dc/elements/1.1/"\n xmlns:cc="http://creativecommons.org/ns#"\n xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n xmlns:svg="http://www.w3.org/2000/svg"\n xmlns="http://www.w3.org/2000/svg"\n xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"\n xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"\n version="1.1"\n id="Capa_1"\n x="0px"\n y="0px"\n viewBox="0 0 346.013 346.013"\n style="enable-background:new 0 0 346.013 346.013;width: 80%; height: auto; vertical-align: middle;"\n xml:space="preserve"\n inkscape:version="0.91 r13725"\n sodipodi:docname="alarm_white.svg"><metadata\n id="metadata51"><rdf:RDF><cc:Work\n rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id="defs49" /><sodipodi:namedview\n borderopacity="1"\n objecttolerance="10"\n gridtolerance="10"\n guidetolerance="10"\n inkscape:pageopacity="0"\n inkscape:pageshadow="2"\n inkscape:window-width="1618"\n inkscape:window-height="828"\n id="namedview47"\n showgrid="false"\n inkscape:zoom="0.6820553"\n inkscape:cx="173.0065"\n inkscape:cy="173.0065"\n inkscape:window-x="0"\n inkscape:window-y="0"\n inkscape:window-maximized="0"\n inkscape:current-layer="g3" /><g\n id="g3"><path\n d="m 256.76227,220.19006 c -1.77513,-2.69766 -3.45154,-5.24564 -3.98966,-7.46382 -0.042,-0.17861 -0.0911,-0.36128 -0.16237,-0.61436 -2.28354,-7.67647 0.69147,-24.43921 2.46886,-34.45124 0.26788,-1.50394 0.52274,-2.94197 0.75286,-4.29035 0.0232,-0.13675 0.044,-0.27211 0.0724,-0.48006 1.95582,-15.28051 2.58811,-37.91956 -5.51044,-58.99147 -5.6032,-14.57978 -14.45978,-25.82612 -26.3559,-33.48393 1.26598,-9.812938 -4.85967,-19.343691 -14.66682,-22.0511 -9.80715,-2.70741 -19.95724,2.33226 -23.90298,11.405413 -14.1382,0.467533 -27.51111,5.577097 -39.80114,15.219267 -17.76129,13.9298 -28.83431,33.68757 -34.99389,47.80757 l -0.0479,0.11335 c -0.0512,0.12175 -0.0998,0.24114 -0.13249,0.32962 -0.49733,1.28292 -1.01552,2.64514 -1.55689,4.07255 -3.61311,9.51043 -9.66004,25.42824 -15.611995,30.89342 -0.106524,0.10027 -0.208228,0.20187 -0.362362,0.35435 -1.636243,1.66563 -4.382941,2.99463 -7.288979,4.40101 -7.145531,3.45301 -22.013613,10.64166 -17.206389,31.67844 0.929154,4.07105 4.008437,7.29057 8.033861,8.40185 l 167.570804,46.2604 c 4.02253,1.11048 8.31521,-0.0729 11.2052,-3.08958 14.91617,-15.58874 5.84693,-29.38668 1.48625,-36.02133 z"\n id="path5"\n inkscape:connector-curvature="0"\n vector-effect="non-scaling-stroke"\n'+' style="fill:'.concat(e,"; stroke: ").concat(n,'; stroke-width: 1; " /><path\n')+' vector-effect="non-scaling-stroke"\n d="m 174.26737,259.72378 -38.76399,-10.70137 c -1.59243,-0.43962 -3.28183,-0.15596 -4.63548,0.7754 -2.53909,1.7494 -2.84182,4.93159 -3.02304,6.83188 l -0.0151,0.15247 c -1.22819,12.67106 6.79854,24.33046 19.08688,27.72284 12.51583,3.45518 25.8324,-2.91586 30.9681,-14.80385 l 0.0935,-0.19205 c 0.52305,-1.06418 1.74613,-3.55554 0.50882,-6.31116 -0.44302,-0.98439 -1.5794,-2.74529 -4.21964,-3.47416 z"\n id="path7"\n inkscape:connector-curvature="0"\n'+' style="fill:'.concat(e,"; stroke: ").concat(n,'; stroke-width: 1;" /></g><g\n')+' id="g17" /><g\n id="g19" /><g\n id="g21" /><g\n id="g23" /><g\n id="g25" /><g\n id="g27" /><g\n id="g29" /><g\n id="g31" /><g\n id="g33" /><g\n id="g35" /><g\n id="g37" /><g\n id="g39" /><g\n id="g41" /><g\n id="g43" /><g\n id="g45" /></svg>')),this.addStylesToElement({width:i.size,height:i.size},t),t.className="pushwoosh-subscribe-widget__bell-button",t},t.prototype.createTooltip=function(){return o(this,void 0,void 0,(function(){var t,e,n,i,r,s;return a(this,(function(o){switch(o.label){case 0:return t=document.createElement("div"),e=jt.getTooltipPosition(this.config.position,this.config.size),n=e[0],i=e[1],t.className="pushwoosh-subscribe-widget__tooltip pushwoosh-subscribe-widget__tooltip__".concat(i),this.addStylesToElement(n,t),s=(r=t).appendChild,[4,this.createTooltipContent()];case 1:return s.apply(r,[o.sent()]),[2,t]}}))}))},t.prototype.createTooltipContent=function(){return o(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return t=document.createElement("div"),e=t,[4,this.tooltipTextFactory()];case 1:return e.innerText=n.sent(),t.className="pushwoosh-subscribe-widget__tooltip-content",[2,t]}}))}))},t.prototype.tooltipTextFactory=function(){return o(this,void 0,void 0,(function(){var t,e,n;return a(this,(function(i){switch(i.label){case 0:return[4,this.pw.driver.getPermission()];case 1:return t=i.sent(),e=this.config.tooltipText,[4,pt.get("MANUAL_UNSUBSCRIBE")];case 2:switch(n=i.sent(),t){case w:return[2,n?e.needSubscribe:e.alreadySubscribed];case y:return[2,e.needSubscribe];case m:return[2,e.blockSubscribe];default:return[2,e.needSubscribe]}return[2]}}))}))},t.prototype.createPopover=function(){var t=document.createElement("div"),e=document.createElement("div"),n=jt.getPopoverPosition(this.config.position,this.config.size),i=n[0],r=n[1];e.className="pushwoosh-subscribe-widget__popover pushwoosh-subscribe-widget__popover__".concat(r),t.className="pushwoosh-subscribe-widget__popover-content-wrapper",this.style.innerHTML+=jt.getPopoverArrowPosition(this.config.position,this.config.size);var s=Object.assign({maxWidth:"calc(100vw - ".concat(this.config.indent," - ").concat(this.config.indent,")")},i);return this.addStylesToElement(s,e),t.appendChild(this.createPopoverContent()),e.appendChild(t),e},t.prototype.getBrowserName=function(){return Pt.isOpera?"opera":11===Pt.platform&&navigator.userAgent.match(/Android/i)?"mobileChrome":12===Pt.platform?"firefox":10===Pt.platform?"safari":150===Pt.platform?"edge":"chrome"},t.prototype.createPopoverContent=function(){var t=this.config,e=document.createElement("div");e.className="pushwoosh-subscribe-widget__popover-content";var n=this.getBrowserName(),i=t.contentImages&&t.contentImages[n];if(i){var r=document.createElement("img");r.src=i,e.appendChild(r)}else{var s={opera:"opera",mobileChrome:"mobile_chrome",firefox:"FF",safari:"safari"}[n]||"chrome";[{src:this.getImageSrc(s),width:500,height:130},{src:this.getImageSrc("".concat(s,"_unlock")),width:500,height:230}].forEach((function(t){var n=document.createElement("img");Object.assign(n,t),e.appendChild(n)}))}return e},t.prototype.getImageSrc=function(t){return"https://cdn.pushwoosh.com/webpush/img/".concat(t,".jpg")},t.prototype.render=function(){return o(this,void 0,void 0,(function(){var t,e,n;return a(this,(function(i){switch(i.label){case 0:return this.widget=this.createContainer(),this.style=this.createStyle(),t=this.createBell(),e=this,[4,this.createTooltip()];case 1:return e.tooltip=i.sent(),n=this,[4,this.createPopover()];case 2:return n.popover=i.sent(),this.widget.appendChild(this.style),this.widget.appendChild(t),this.widget.appendChild(this.tooltip),this.widget.appendChild(this.popover),document.body.appendChild(this.widget),this.pw.push(["onSubscribe",this.onSubscribeEvent]),this.pw.push(["onUnsubscribe",this.onUnsubscribeEvent]),this.pw.push(["onPermissionDenied",this.onPermissionDeniedEvent]),this.addEventListeners(),[2]}}))}))},t.prototype.addEventListeners=function(){this.widget.addEventListener("click",this.clickBell),window.addEventListener("click",this.clickOutOfPopover)},t.prototype.toggleHelpPopover=function(){this.popover.classList.toggle("pushwoosh-subscribe-widget__popover__visible")},t.prototype.clickBell=function(){return o(this,void 0,void 0,(function(){var t;return a(this,(function(e){switch(e.label){case 0:switch(t=this.pw.driver.getPermission(),t){case w:return[3,1];case y:return[3,3];case m:return[3,5]}return[3,6];case 1:return[4,this.pw.subscribe()];case 2:return e.sent(),[3,7];case 3:return[4,this.pw.subscribe()];case 4:return e.sent(),[3,7];case 5:return this.toggleHelpPopover(),[3,7];case 6:console.warn("Unknown browser notification permission"),e.label=7;case 7:return[2]}}))}))},t.prototype.onSubscribeEvent=function(){return o(this,void 0,void 0,(function(){var t,e=this;return a(this,(function(n){return null===(t=this.tooltip.querySelector("div"))||(t.innerText=this.config.tooltipText.successSubscribe,this.tooltip.classList.add("pushwoosh-subscribe-widget__tooltip__visible"),setTimeout((function(){return o(e,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:return this.tooltip.classList.remove("pushwoosh-subscribe-widget__tooltip__visible"),e=t,[4,this.tooltipTextFactory()];case 1:return e.innerText=n.sent(),this.widget.classList.add("pushwoosh-subscribe-widget__subscribed"),[2]}}))}))}),2e3)),[2]}))}))},t.prototype.onPermissionDeniedEvent=function(){return o(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return this.addEventListeners(),null===(t=this.tooltip.querySelector("div"))?[2]:(e=t,[4,this.tooltipTextFactory()]);case 1:return e.innerText=n.sent(),[2]}}))}))},t.prototype.clickOutOfPopover=function(t){this.popover.classList.contains("pushwoosh-subscribe-widget__popover__visible")&&!t.target.classList.contains("pushwoosh-subscribe-widget__popover")&&null===t.target.closest(".pushwoosh-subscribe-widget__popover")&&!t.target.classList.contains("pushwoosh-subscribe-widget__bell-button")&&null===t.target.closest(".pushwoosh-subscribe-widget__bell-button")&&this.popover.classList.remove("pushwoosh-subscribe-widget__popover__visible")},t.prototype.onUnsubscribeEvent=function(){return o(this,void 0,void 0,(function(){var t,e;return a(this,(function(n){switch(n.label){case 0:return null===(t=this.tooltip.querySelector("div"))?[2]:(e=t,[4,this.tooltipTextFactory()]);case 1:return e.innerText=n.sent(),[2]}}))}))},t}(),Kt={text:"Don’t miss out on our news and updates! Enable push notifications",askLaterButtonText:"Not now",confirmSubscriptionButtonText:"Subscribe",delay:5,retryOffset:604800,overlay:!1,position:"top",mobileViewMargin:"0",bgColor:"#fff",borderColor:"transparent",boxShadow:"0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23)",textColor:"#000",textSize:"inherit",textWeight:"normal",fontFamily:"inherit",subscribeBtnBgColor:"#4285f4",subscribeBtnTextColor:"#fff",subscribeBtnTextWeight:"normal",subscribeBtnBorderColor:"transparent",subscribeBtnBorderRadius:"2px",askLaterBtnBgColor:"transparent",askLaterBtnTextColor:"#000",askLaterBtnTextWeight:"normal",askLaterBtnBorderColor:"transparent",askLaterBtnBorderRadius:"2px",theme:"material",viewport:"html"},Gt=/^(#([\da-f]{3}){1,2}$|(rgb|hsl)a\((\d{1,3}%?,\s?){3}(1|0?\.\d+)\)$|(rgb|hsl)\(\d{1,3}%?(,\s?\d{1,3}%?){2}\)$)/,Xt=[{name:"mobileViewMargin",type:"string"},{name:"mobileViewPosition",type:"string"},{name:"mobileViewTransition",type:"string"},{name:"bgColor",type:"color"},{name:"borderColor",type:"color"},{name:"boxShadow",type:"string"},{name:"textColor",type:"color"},{name:"textSize",type:"string"},{name:"textWeight",type:"string"},{name:"fontFamily",type:"string"},{name:"subscribeBtnBgColor",type:"color"},{name:"subscribeBtnTextColor",type:"color"},{name:"subscribeBtnTextWeight",type:"string"},{name:"subscribeBtnBorderColor",type:"color"},{name:"subscribeBtnBorderRadius",type:"string"},{name:"askLaterBtnBgColor",type:"color"},{name:"askLaterBtnTextColor",type:"color"},{name:"askLaterBtnTextWeight",type:"string"},{name:"askLaterBtnBorderColor",type:"color"},{name:"askLaterBtnBorderRadius",type:"string"}];const Jt=function(){function t(t){this.pw=t;var e=(t.subscribePopupConfig||{}).mobileViewMargin,n=void 0===e?"":e;this.config=r(r(r({},Kt),this.pw.subscribePopupConfig),{mobileViewTransition:n?"none":"bottom .4s ease-out",mobileViewPosition:n?"auto!important":"auto"}),this.onAskLaterClick=this.onAskLaterClick.bind(this),this.onSubscribeClick=this.onSubscribeClick.bind(this)}return t.prototype.initPopup=function(){return o(this,void 0,void 0,(function(){var t,e,n,i,r,s,o=this;return a(this,(function(a){switch(a.label){case 0:return[4,this.pw.isSubscribed()];case 1:return t=a.sent(),[4,this.pw.data.getStatusManualUnsubscribed()];case 2:return e=a.sent(),t||e?[2]:[4,this.pw.driver.getPermission()];case 3:return"granted"===(n=a.sent())||"denied"===n||(this.renderPopup(),this.appendStyles(),i=localStorage.getItem("LAST_OPEN_SUBSCRIPTION_POPUP"),r=i?parseInt(i):0,s=(new Date).getTime(),r+1e3*this.config.retryOffset<s&&!this.config.manualToggle&&setTimeout((function(){o.toggle(!0)}),1e3*this.config.delay)),[2]}}))}))},t.prototype.toggle=function(t){("boolean"==typeof t?t:!this.isShown)?(this.showPopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-show",{})):(this.closePopup(),this.pw.eventBus.dispatchEvent("subscribe-popup-hide",{}))},t.prototype.showPopup=function(){this.isShown=!0,this.popup.classList.add("pw-show"),document.body.classList.add("pw-popup-opened");var t=new CustomEvent("showPopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});if(this.popup.dispatchEvent(t),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var e=this.config,n=e.theme,i=e.viewport,r=e.position;if("topbar"===n&&"top"===r){var s=document.querySelector(i)||document.createElement("div"),o=window.getComputedStyle(s).marginTop||"0";s.style.transition="margin-top .3s ease-out",s.style.marginTop="".concat(parseInt(o)+this.popup.getBoundingClientRect().height,"px")}}},t.prototype.closePopup=function(){this.isShown=!1,this.popup.classList.remove("pw-show"),document.body.classList.remove("pw-popup-opened");var t=new CustomEvent("hidePopup",{bubbles:!1,cancelable:!1,detail:{popup:this.popup}});this.popup.dispatchEvent(t);var e=(new Date).getTime().toString();if(localStorage.setItem("LAST_OPEN_SUBSCRIPTION_POPUP",e),!(Math.max(document.documentElement.clientWidth,window.innerWidth||0)<541)){var n=this.config,i=n.theme,r=n.viewport,s=n.position;if("topbar"===i&&"top"===s){var o=document.querySelector(r)||document.createElement("div"),a=window.getComputedStyle(o).marginTop||"0";o.style.marginTop="".concat(parseInt(a)-this.popup.getBoundingClientRect().height,"px")}}},t.prototype.renderPopup=function(){this.popup=document.createElement("div"),this.popup.id="pwSubscribePopup";var t=this.config,e=t.text,n=t.askLaterButtonText,i=t.confirmSubscriptionButtonText,r=t.iconUrl,s=t.position,o=t.overlay,a=t.theme;this.popup.className="pw-subscribe-popup pw-position-".concat(s," pw-subscribe-popup-").concat(a),this.popup.classList.toggle("pw-subscribe-popup__overlay",o),this.popup.innerHTML=function(t){var e=t.iconUrl,n=t.text,i=t.askLaterButtonText,r=t.confirmSubscriptionButtonText;return'<div class="pw-subscription-popup-inner">\n <div class="pw-subscription-popup-content">\n '.concat(e?'<div class="pw-subscription-popup-icon"><img src="'.concat(e,'" alt="Subscribe"></div>'):"",'\n <div class="pw-subscription-popup-text">\n ').concat(n,'\n </div>\n </div>\n <div class="pw-subscription-popup-controls">\n <button name="pwAskLater" class="pw-subscribe-popup-button">').concat(i,'</button>\n <button name="pwSubscribe" class="pw-subscribe-popup-button pw-subscribe-popup-button-active">').concat(r,"</button>\n </div>\n </div>")}({text:e,askLaterButtonText:n,confirmSubscriptionButtonText:i,iconUrl:r}),document.body.appendChild(this.popup),this.addListeners()},t.prototype.appendStyles=function(){var t=document.createElement("style");t.innerHTML=this.configureStyle(".pw-subscribe-popup {\n position: fixed;\n left: 50%;\n transform: translateX(-50%);\n justify-content: center;\n z-index: 1000000;\n display: flex;\n transition: all .4s ease-out;\n}\n\n.pw-subscribe-popup.pw-position-top {\n top: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-top.pw-show {\n top: 0;\n}\n\n.pw-subscribe-popup.pw-position-bottom {\n bottom: calc(-100% - 24px);\n}\n.pw-subscribe-popup.pw-position-bottom.pw-show {\n bottom: 0;\n}\n\n.pw-subscribe-popup.pw-position-center {\n display: flex;\n\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n justify-content: center;\n align-items: center;\n\n transform: none;\n}\n\n.pw-subscribe-popup__overlay {\n background: rgba(0,0,0,.4);\n z-index: 1000000;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-subscribe-popup__overlay) {\n pointer-events: none;\n}\n\n.pw-subscribe-popup.pw-position-center:not(.pw-show) {\n display: none;\n}\n\n\n.pw-subscribe-popup__overlay.pw-position-top {\n align-items: flex-start;\n}\n\n.pw-subscribe-popup__overlay.pw-position-bottom {\n align-items: flex-end;\n}\n\n.pw-subscribe-popup__overlay.pw-position-center {\n align-items: center;\n}\n\n.pw-subscription-popup-inner {\n max-width: 400px;\n font-size: var(--textSize);\n color: var(--textColor);\n font-weight: var(--textWeight);\n font-family: var(--fontFamily);\n border-style: solid;\n border-width: 1px;\n border-color: var(--borderColor);\n background: var(--bgColor);\n box-shadow: var(--boxShadow);\n pointer-events: auto;\n}\n\n.pw-subscription-popup-content {\n padding: 16px 16px 4px;\n display: flex;\n justify-content: stretch;\n}\n\n.pw-subscription-popup-icon {\n flex: 0 0 50px;\n margin-right: 12px;\n padding-top: 4px;\n}\n\n.pw-subscription-popup-icon img {\n max-width: 60px;\n max-height: 60px;\n}\n\n.pw-subscription-popup-text {\n flex: 1 1 300px;\n}\n\n.pw-subscription-popup-controls {\n display: flex;\n flex-wrap: nowrap;\n justify-content: center;\n padding: 8px 16px 16px;\n}\n\nbutton.pw-subscribe-popup-button {\n border: solid 1px var(--askLaterBtnBorderColor);\n border-radius: var(--askLaterBtnBorderRadius);\n display: inline-block;\n height: 36px;\n line-height: 36px;\n padding: 0 16px;\n text-transform: uppercase;\n font-weight: var(--askLaterBtnTextWeight);\n vertical-align: middle;\n -webkit-tap-highlight-color: transparent;\n font-size: 14px;\n outline: 0;\n text-decoration: none;\n color: var(--askLaterBtnTextColor);\n text-align: center;\n letter-spacing: .5px;\n cursor: pointer;\n background: var(--askLaterBtnBgColor);\n margin: 4px 8px;\n}\nbutton.pw-subscribe-popup-button:hover {\n background: rgba(0,0,0,.04);\n}\nbutton.pw-subscribe-popup-button:active {\n background: rgba(0,0,0,.12);\n}\n\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active {\n color: var(--subscribeBtnTextColor);\n background: var(--subscribeBtnBgColor);\n border-radius: var(--subscribeBtnBorderRadius);\n border: solid 1px var(--subscribeBtnBorderColor);\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n font-weight: var(--subscribeBtnTextWeight);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:hover {\n box-shadow: 0 3px 3px 0 rgba(0,0,0,0.14),\n 0 1px 7px 0 rgba(0,0,0,0.12),\n 0 3px 1px -1px rgba(0,0,0,0.2);\n}\nbutton.pw-subscribe-popup-button.pw-subscribe-popup-button-active:active {\n box-shadow: 0 2px 2px 0 rgba(0,0,0,0.14),\n 0 3px 1px -2px rgba(0,0,0,0.12),\n 0 1px 5px 0 rgba(0,0,0,0.2);\n}\n\n@media screen and (min-width: 541px) {\n\n .pw-subscribe-popup-topbar {\n width: 100%;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n display: flex;\n flex-direction: row;\n padding: 2px 40px;\n justify-content: center;\n align-items: center;\n flex-wrap: nowrap;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-content {\n padding: 0;\n justify-content: flex-start;\n align-items: center;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-icon img {\n max-width: 28px;\n max-height: 28px;\n }\n\n .pw-subscribe-popup-topbar button.pw-subscribe-popup-button {\n height: 32px;\n line-height: 32px;\n }\n\n .pw-subscribe-popup-topbar .pw-subscription-popup-controls {\n padding: 0 0 0 16px;\n align-items: center;\n }\n}\n@media screen and (max-width: 540px) {\n .pw-subscribe-popup,\n .pw-subscribe-popup.pw-position-top,\n .pw-subscribe-popup.pw-position-center,\n .pw-subscribe-popup.pw-position-bottom {\n top: var(--mobileViewPosition);\n bottom: -110%;\n left: 0;\n right: 0;\n transform: none;\n display: flex;\n transition: var(--mobileViewTransition);\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-subscribe-popup__overlay {\n align-items: flex-end;\n }\n\n .pw-subscribe-popup.pw-show {\n bottom: var(--mobileViewMargin);\n }\n\n .pw-subscribe-popup__overlay .pw-subscription-popup-inner {\n align-items: flex-end;\n justify-content: stretch;\n }\n\n .pw-subscription-popup-inner {\n max-width: 100%;\n width: 100%;\n }\n}\n"),document.body.appendChild(t)},t.prototype.getStyleFormatter=function(t){switch(t.type){case"size":return"".concat(this.config[t.name]||0,"px");case"number":return parseFloat(this.config[t.name].toString()).toString();case"string":return this.config[t.name].toString();case"color":return"transparent"===(e=this.config[t.name].toString())||Gt.test(e)?e:"#333";default:return"none"}var e},t.prototype.configureStyle=function(t){var e=this,n=t.toString();return Xt.forEach((function(t){var i=new RegExp("var\\(--".concat(t.name,"\\)"),"ig"),r=e.getStyleFormatter(t);n=n.replace(i,r)})),n},t.prototype.addListeners=function(){var t=this.popup.querySelector('button[name="pwAskLater"]')||document.createElement("button"),e=this.popup.querySelector('button[name="pwSubscribe"]')||document.createElement("button");t.addEventListener("click",this.onAskLaterClick),e.addEventListener("click",this.onSubscribeClick)},t.prototype.onAskLaterClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-decline",{})},t.prototype.onSubscribeClick=function(){this.toggle(!1),this.pw.eventBus.dispatchEvent("subscribe-popup-accept",{}),this.pw.subscribe()},t}();return document.addEventListener("pushwoosh.initialized",(function(t){if(t.detail.pw.subscribeWidgetConfig.enable&&new Yt(t.detail.pw),t.detail.pw.subscribePopupConfig&&t.detail.pw.subscribePopupConfig.enable){var e=new Jt(t.detail.pw);e.initPopup().then((function(){t.detail.pw.subscribePopup=e}))}t.detail.pw.pwinbox&&t.detail.pw.inboxWidgetConfig.enable&&(t.detail.pw.pwinboxWidget=new Ut(t.detail.pw))})),e})()));
2
+ //# sourceMappingURL=index.js.map