web-push-notifications 3.32.0 → 3.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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=48)}([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.WAKE_UP_SERVICE_WORKER_INTERVAL=exports.MAX_NOTIFICATION_DURATION=exports.MIN_NOTIFICATION_DURATION=exports.DEFAULT_NOTIFICATION_DURATION=exports.PERIOD_GOAL_EVENT=exports.PERIOD_SEND_APP_OPEN=exports.FACEBOOK_HWID_KEY=exports.FACEBOOK_APP_ID=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.FACEBOOK_APP_ID="436711767081797",exports.FACEBOOK_HWID_KEY="FACEBOOK_HWID_KEY",exports.PERIOD_SEND_APP_OPEN=36e5,exports.PERIOD_GOAL_EVENT=864e5,exports.DEFAULT_NOTIFICATION_DURATION=10,exports.MIN_NOTIFICATION_DURATION=10,exports.MAX_NOTIFICATION_DURATION=55,exports.WAKE_UP_SERVICE_WORKER_INTERVAL=20,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 __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__(6);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";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__(1),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.userIdWasChanged",void 0)];case 14:return _a.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 15:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 16:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 17:return _a.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 18:return _a.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 19:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 20:return _a.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 21:return _a.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 22:return _a.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 23:return _a.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 24:return _a.sent(),[4,this.store.set("params.features",void 0)];case 25:return _a.sent(),[4,this.store.set("params.init",void 0)];case 26:return _a.sent(),[4,this.store.set("API_PARAMS",void 0)];case 27:return _a.sent(),[4,this.store.set("SENDER_ID",void 0)];case 28:return _a.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 29:return _a.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 30:return _a.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 31:return _a.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 32: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.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.setSenderId=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("GCM_SENDER_ID",senderId)];case 1:return _a.sent(),[4,this.store.set("params.senderId",senderId)];case 2:return _a.sent(),[2]}})})},Data.prototype.getSenderId=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("GCM_SENDER_ID")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.senderId")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},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.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";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__(1),levels={error:1,info:2,debug:3},limitLevel=3;__webpack_require__(5).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";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.32.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__){"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__){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(actionParams){var messageType=0;return"h"in actionParams||"rm"in actionParams||"r"in actionParams?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(message){return __awaiter(this,void 0,void 0,function(){var imageUrl,_a,title,_b;return __generator(this,function(_c){switch(_c.label){case 0:return(_a=message.image)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:_a=_c.sent(),_c.label=2;case 2:return imageUrl=_a,(_b=message.title)?[3,4]:[4,this.data.getDefaultNotificationTitle()];case 3:_b=_c.sent(),_c.label=4;case 4:return title=_b,this.dateModule.date=new Date(1e3*parseInt(message.send_date)),this.dateModule.setLocal(),[2,{title:title,imageUrl:imageUrl,code:message.inbox_id,message:message.text,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(JSON.parse(message.action_params)),isRead:2===message.status||3===message.status,isActionPerformed:3===message.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(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 __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__(2),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)},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.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){return __awaiter(this,void 0,void 0,function(){var entrypoint,response,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return entrypoint=_a.sent(),[4,fetch(customUrl||entrypoint+methodName,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:request})})];case 2:return response=_a.sent(),[4,this.checkResponse(response)];case 3:return(result=_a.sent()).base_url?[4,this.data.setApiEntrypoint(result.base_url)]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[4,this.logger.write("apirequest",methodName+" call with arguments: "+JSON.stringify(request)+" to Pushwoosh has been successful. Result: "+JSON.stringify(result.response))];case 6:return _a.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])}}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.Api=void 0;var Data_1=__webpack_require__(2),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,fcm_push_set:tokens.fcmPushSet,fcm_token:tokens.fcmToken}))];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 params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setTags(__assign(__assign({},params),{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 params,deviceType,id,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getDeviceType()];case 2:return deviceType=_a.sent(),id=""+userId,[4,this.apiClient.registerUser(__assign(__assign({},params),{userId:id,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:deviceType}))];case 3:return response=_a.sent(),[4,this.data.setUserId(""+userId)];case 4:return _a.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 5:return _a.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__(6);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__(6);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,senderId_1,applicationServerKey,senderId,pushToken,_p256dn,_auth,p256dh,auth,_a,token,pushSet;return __generator(this,function(_b){switch(_b.label){case 0:return currentSubscription=subscription,this.checkIsPermissionGranted()?currentSubscription?[3,6]:[4,this.trySubscribe()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return currentSubscription=_b.sent(),[4,this.getSenderIdFromManifest()];case 2:return senderId_1=_b.sent(),[4,this.checkIsChangeSenderId(senderId_1)];case 3:return _b.sent()?[4,this.unsubscribe()]:[3,6];case 4:return _b.sent(),[4,this.data.setSenderId(senderId_1)];case 5:_b.sent(),_b.label=6;case 6:return[4,this.getApplicationServerKey()];case 7:return applicationServerKey=_b.sent(),[4,this.data.getSenderId()];case 8:return senderId=_b.sent(),[4,this.getPushToken(currentSubscription)];case 9:if(pushToken=_b.sent(),_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.getFcmKeys({endpoint:currentSubscription.endpoint,application_pub_key:applicationServerKey,encryption_key:p256dh,encryption_auth:auth,authorized_entity:senderId})];case 10:return _a=_b.sent(),token=_a.token,pushSet=_a.pushSet,[4,this.data.setTokens({publicKey:p256dh,pushToken:pushToken,authToken:auth,fcmPushSet:pushSet,fcmToken:token,endpoint:currentSubscription.endpoint})];case 11:return _b.sent(),[4,this.api.registerDevice()];case 12: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 savedSenderId,isExistSavedSenderId,manifestSenderId,isChangeSenderID,lastPermission,permission,credentials,pushTokenFromSubscription,subscriptionTokensFromStore,pushTokenFromStore;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return savedSenderId=_a.sent(),isExistSavedSenderId=void 0!==savedSenderId,[4,this.getSenderIdFromManifest()];case 2:return manifestSenderId=_a.sent(),isChangeSenderID=isExistSavedSenderId&&manifestSenderId!==savedSenderId,[4,this.data.setSenderId(manifestSenderId)];case 3:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 4:return lastPermission=_a.sent(),permission=this.getPermission(),isExistSavedSenderId&&lastPermission!==permission?[4,this.data.setLastPermissionStatus(permission)]:[3,6];case 5:return _a.sent(),[2,!0];case 6:return[4,this.getCredentials()];case 7:return credentials=_a.sent(),[4,this.getPushToken(credentials)];case 8:return pushTokenFromSubscription=_a.sent(),[4,this.data.getTokens()];case 9:return subscriptionTokensFromStore=_a.sent(),pushTokenFromStore=subscriptionTokensFromStore&&subscriptionTokensFromStore.pushToken||"",[2,isChangeSenderID||!(pushTokenFromSubscription===pushTokenFromStore)]}})})},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.getFcmKeys=function(config){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,fetch(this.config.entrypoint||"https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(config)})];case 1:return 200!==(response=_a.sent()).status?[3,3]:[4,response.json()];case 2:return[2,_a.sent()];case 3:throw new Error("Internal error: Can't register device in fcm. Status: "+response.status+". Message: "+response.statusText)}})})},PushServiceDefault.prototype.getPushToken=function(subscription){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(),subscription?12===deviceType?[2,subscription.endpoint]:[2,subscription.endpoint.split("/").pop()||""]:[2,""]}})})},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.getSenderIdFromManifest=function(){return __awaiter(this,void 0,void 0,function(){var manifest,url,response,data,match;return __generator(this,function(_a){switch(_a.label){case 0:if(!(manifest=document.querySelector('link[rel="manifest"]')))throw new Error("Error: manifest.json not found!");if(!(url=manifest.getAttribute("href")))throw new Error("Error: manifest.json url not found!");return[4,fetch(url,{method:"GET",headers:{"Content-Type":"application/json;charset=UTF-8"}})];case 1:if(200!==(response=_a.sent()).status)throw new Error("Error: Can't load manifest.json! "+response.statusText);return[4,response.text()];case 2:if(data=_a.sent(),!(match=data.match(/("|')?gcm_sender_id("|')?:\s*("|')?(\d+)("|')?/))||"string"!=typeof match[4])throw new Error("Error: Can't find gcm_sender_id in manifest.json!");return[2,match[4]]}})})},PushServiceDefault.prototype.checkIsChangeSenderId=function(currentSenderId){return __awaiter(this,void 0,void 0,function(){var senderIdFromIndexedDB;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return senderIdFromIndexedDB=_a.sent(),[2,currentSenderId!==senderIdFromIndexedDB]}})})},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";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 EventBus_1=__webpack_require__(17),Data_1=__webpack_require__(2),Api_1=__webpack_require__(19),PushServiceDefault_1=__webpack_require__(23),logger_1=__webpack_require__(49),storage_1=__webpack_require__(1),constants_1=__webpack_require__(0),functions_1=__webpack_require__(5),logger_2=__webpack_require__(4),global_1=__webpack_require__(51),notification_1=__webpack_require__(52),NotificationPayload_1=__webpack_require__(53),InboxMessages_1=__webpack_require__(24),InboxMessagesPublic_1=__webpack_require__(13),eventBus=new EventBus_1.EventBus,data=new Data_1.Data,api=new Api_1.Api(eventBus,data),Pushwoosh=self.Pushwoosh=new global_1.default(eventBus,data,api),clickedNotifications=[];function broadcastClients(msg){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,self.clients.matchAll()];case 1:return _a.sent().forEach(function(client){return client.postMessage(msg)}),[2]}})})}function parseNotificationEvent(event){return __awaiter(this,void 0,void 0,function(){var _a,notification,notificationData,notificationTag,url,button;return __generator(this,function(_b){return _a=event.notification,notificationData=(notification=void 0===_a?{}:_a).data,notificationTag=functions_1.parseSerializedNotificationParams(notification.tag,{}),url="",event.action&&Array.isArray(notificationData.buttons)?(button=notificationData.buttons.find(function(button){return button.action===event.action})||{},url=button.url):url=notificationTag.url,[2,{requireInteraction:notification.requireInteraction,title:notification.title,body:notification.body,icon:notification.icon,buttons:notificationData.buttons,duration:notificationData.duration,image:notificationData.image,code:notificationData.code,campaignCode:notificationData.campaignCode,inboxId:notificationData.inboxId,messageHash:notificationTag.messageHash,customData:notificationTag.customData,metaData:notificationTag.metaData,openUrl:notificationTag.url,tag:notification.tag,url:url}]})})}function onInstallFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onInstallEventHandler",code:"FATAL-SW-001",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function onActivateFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onActivateEventHandler",code:"FATAL-SW-002",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function onClickNotificationFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onNotificationClickEventHandler",code:"FATAL-SW-004",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function closeNotificationFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onNotificationCloseEventHandler",code:"FATAL-SW-005",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function pushSubscriptionChangeFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onPushSubscriptionChange",code:"FATAL-SW-006",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}self.addEventListener("install",function(event){return event.waitUntil(function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all([Pushwoosh.data.setServiceWorkerVersion("3.32.0"),logger_2.Logger.write("info","install")])];case 1:return _a.sent(),[4,self.skipWaiting()];case 2:return _a.sent(),[2]}})})}().catch(onInstallFailure))}),self.addEventListener("activate",function(event){event.waitUntil(function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all([logger_2.Logger.write("info","activate")])];case 1:return _a.sent(),[4,self.clients.claim()];case 2:return _a.sent(),[2]}})})}().catch(onActivateFailure))}),self.addEventListener("push",function(event){event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var payload,notificationPayload,notificationOptions,notificationShowOptions,messageHash,notification,_a,_b,onPushActions,inboxMessages,inboxMessagesPublic,inboxMessagePayload,payload_1;return __generator(this,function(_c){switch(_c.label){case 0:return[4,self.clients.claim()];case 1:return _c.sent(),[4,event.data.json()];case 2:return payload=_c.sent(),[4,(notificationPayload=new NotificationPayload_1.default(payload)).getNotificationOptionsPayload()];case 3:return notificationOptions=_c.sent(),[4,notificationPayload.getShowNotificationOptions()];case 4:return notificationShowOptions=_c.sent(),messageHash=notificationPayload.messageHash,[4,logger_2.Logger.write("info",JSON.stringify(notificationOptions),"onPush")];case 5:return _c.sent(),_a=notification_1.default.bind,_b=[void 0,notificationShowOptions,notificationPayload.duration,notificationPayload.body],[4,notificationPayload.getTitle()];case 6:return notification=new(_a.apply(notification_1.default,_b.concat([_c.sent()]))),[4,Pushwoosh.getListeners("onPush").reduce(function(pr,fun){return pr.then(function(){return fun(notification)})},Promise.resolve())];case 7:return _c.sent(),onPushActions=[notification.show(),storage_1.message.add({payload:payload,parsedPayload:notificationOptions,showOptions:notificationShowOptions}),broadcastClients({type:constants_1.EVENT_ON_PUSH_DELIVERY,payload:notificationOptions})],messageHash&&onPushActions.push(Pushwoosh.initApi().then(function(){return Pushwoosh.api.messageDeliveryEvent(messageHash,!0,notificationOptions.metaData)})),""===notificationPayload.inboxId?[3,10]:(inboxMessages=new InboxMessages_1.default(Pushwoosh.eventBus,Pushwoosh.data,Pushwoosh.api),inboxMessagesPublic=new InboxMessagesPublic_1.default(Pushwoosh.data,Pushwoosh.api,inboxMessages),[4,notificationPayload.getInboxMessage()]);case 8:return inboxMessagePayload=_c.sent(),[4,inboxMessagesPublic.publicMessageBuilder(inboxMessagePayload)];case 9:payload_1=_c.sent(),onPushActions.push(inboxMessages.putMessage(inboxMessagePayload),broadcastClients({type:constants_1.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE,payload:payload_1})),_c.label=10;case 10:return[4,Promise.all(onPushActions)];case 11:return _c.sent(),[2]}})})}(event).catch(function(error){return function(error,event){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onPushEventHandler",code:"FATAL-SW-003",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),error instanceof Error||(error=new Error(error)),[2,storage_1.message.add({error:""+error,stack:error.stack,payload:event.data&&event.data.text()})]}})})}(error,event)}))}),self.addEventListener("notificationclick",function(event){event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var notificationOptions,messageHash,metaData,url,code,inboxId,inboxMessages,message_1,message;return __generator(this,function(_a){switch(_a.label){case 0:return[4,self.clients.claim()];case 1:return _a.sent(),[4,parseNotificationEvent(event)];case 2:return notificationOptions=_a.sent(),messageHash=notificationOptions.messageHash,metaData=notificationOptions.metaData,url=notificationOptions.url,code=notificationOptions.code,inboxId=notificationOptions.inboxId,code&&clickedNotifications.push(code),""===inboxId?[3,5]:[4,(inboxMessages=new InboxMessages_1.default(Pushwoosh.eventBus,Pushwoosh.data,Pushwoosh.api)).getMessage(inboxId)];case 3:return(message_1=_a.sent()).status=3,[4,inboxMessages.putMessage(message_1)];case 4:_a.sent(),_a.label=5;case 5:return event.notification.close(),message={type:constants_1.EVENT_ON_NOTIFICATION_CLICK,payload:notificationOptions},url&&event.waitUntil(self.clients.matchAll({type:"window"}).then(function(windowClients){return function(windowClients,url){return __awaiter(this,void 0,void 0,function(){var _a,openedHostname,openedPathname,clientWithSameAddress;return __generator(this,function(_b){switch(_b.label){case 0:return _a=new URL(url,self.location.origin),openedHostname=_a.hostname,openedPathname=_a.pathname,(clientWithSameAddress=windowClients.find(function(windowClient){var _a=new URL(windowClient.url),windowClientHostname=_a.hostname,windowClientPathname=_a.pathname;return windowClientHostname===openedHostname&&windowClientPathname===openedPathname}))?[4,clientWithSameAddress.focus()]:[3,2];case 1:return _b.sent(),[2,!1];case 2:return[4,self.clients.openWindow(url).then(function(newClientWindow){newClientWindow&&newClientWindow.focus()})];case 3:return _b.sent(),[2,!0]}})})}(windowClients,url)}).then(function(isFocusOnNewWindowClient){isFocusOnNewWindowClient&&Pushwoosh.data.setDelayedEvent(message)})),[2,Promise.all([Pushwoosh.initApi().then(function(){return Pushwoosh.api.pushStat(messageHash,!0,metaData)}),Pushwoosh.data.setLastOpenMessage({url:url,messageHash:messageHash,expiry:Date.now()+constants_1.PERIOD_GOAL_EVENT}),broadcastClients(message)])]}})})}(event).catch(onClickNotificationFailure))}),self.addEventListener("notificationclose",function(event){event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var notificationOptions,code,index;return __generator(this,function(_a){switch(_a.label){case 0:return[4,self.clients.claim()];case 1:return _a.sent(),[4,parseNotificationEvent(event)];case 2:return notificationOptions=_a.sent(),code=notificationOptions.code,event.notification.close(),code?(index=clickedNotifications.indexOf(code))>=0?(clickedNotifications.splice(index,1),[2]):[2,broadcastClients({type:constants_1.EVENT_ON_NOTIFICATION_CLOSE,payload:notificationOptions})]:[2]}})})}(event).catch(closeNotificationFailure))}),self.addEventListener("pushsubscriptionchange",function(event){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var subscription;return __generator(this,function(_a){switch(_a.label){case 0:return(subscription=event.newSubscription)?[3,2]:[4,self.registration.pushManager.getSubscription()];case 1:if(!(subscription=_a.sent()))return[2];_a.label=2;case 2:return[4,new PushServiceDefault_1.PushServiceDefault(api,data,{}).subscribe(subscription)];case 3:return _a.sent(),[2]}})})}(event).catch(pushSubscriptionChangeFailure)),[2]})})})},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.sendErrorLogToRemoteServer=exports.sendFatalLogToRemoteServer=exports.logger=void 0;var logger_1=__webpack_require__(50),logger=new logger_1.Logger({level:"error",subscribers:[{level:"fatal",handler:logger_1.handlerSematext},{level:"error",handler:logger_1.handlerSematext}]});function makeMessage(params){var message=params.message,code=params.code,error=params.error,data=__rest(params,["message","code","error"]),cleanError=function(error){var cleanError=new Error("unknown error");"string"!=typeof error&&"number"!=typeof error&&"boolean"!=typeof error||(cleanError.message=error.toString());error instanceof Error&&(cleanError=error);return cleanError}(error);return{text:message,code:code,options:__assign(__assign({},data),{errorText:cleanError.message,errorStack:cleanError.stack})}}exports.logger=logger,exports.sendFatalLogToRemoteServer=function(params){return __awaiter(this,void 0,void 0,function(){var message;return __generator(this,function(_a){return message=makeMessage(params),[2,logger.fatal(message.text,message.code,message.options)]})})},exports.sendErrorLogToRemoteServer=function(params){return __awaiter(this,void 0,void 0,function(){var message;return __generator(this,function(_a){return message=makeMessage(params),[2,logger.error(message.text,message.code,message.options)]})})}},function(module,exports){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){var module;return(installedModules[moduleId]||(module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}},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=2)}([function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"__extends",function(){return __extends}),__webpack_require__.d(__webpack_exports__,"__assign",function(){return __assign}),__webpack_require__.d(__webpack_exports__,"__rest",function(){return __rest}),__webpack_require__.d(__webpack_exports__,"__decorate",function(){return __decorate}),__webpack_require__.d(__webpack_exports__,"__param",function(){return __param}),__webpack_require__.d(__webpack_exports__,"__metadata",function(){return __metadata}),__webpack_require__.d(__webpack_exports__,"__awaiter",function(){return __awaiter}),__webpack_require__.d(__webpack_exports__,"__generator",function(){return __generator}),__webpack_require__.d(__webpack_exports__,"__createBinding",function(){return __createBinding}),__webpack_require__.d(__webpack_exports__,"__exportStar",function(){return __exportStar}),__webpack_require__.d(__webpack_exports__,"__values",function(){return __values}),__webpack_require__.d(__webpack_exports__,"__read",function(){return __read}),__webpack_require__.d(__webpack_exports__,"__spread",function(){return __spread}),__webpack_require__.d(__webpack_exports__,"__spreadArrays",function(){return __spreadArrays}),__webpack_require__.d(__webpack_exports__,"__await",function(){return __await}),__webpack_require__.d(__webpack_exports__,"__asyncGenerator",function(){return __asyncGenerator}),__webpack_require__.d(__webpack_exports__,"__asyncDelegator",function(){return __asyncDelegator}),__webpack_require__.d(__webpack_exports__,"__asyncValues",function(){return __asyncValues}),__webpack_require__.d(__webpack_exports__,"__makeTemplateObject",function(){return __makeTemplateObject}),__webpack_require__.d(__webpack_exports__,"__importStar",function(){return __importStar}),__webpack_require__.d(__webpack_exports__,"__importDefault",function(){return __importDefault}),__webpack_require__.d(__webpack_exports__,"__classPrivateFieldGet",function(){return __classPrivateFieldGet}),__webpack_require__.d(__webpack_exports__,"__classPrivateFieldSet",function(){return __classPrivateFieldSet});
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=47)}([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.userIdWasChanged",void 0)];case 14:return _a.sent(),[4,this.store.set("params.isLastPermissionStatus",void 0)];case 15:return _a.sent(),[4,this.store.set("params.isManualUnsubscribed",void 0)];case 16:return _a.sent(),[4,this.store.set("params.isCommunicationDisabled",void 0)];case 17:return _a.sent(),[4,this.store.set("params.isDropAllData",void 0)];case 18:return _a.sent(),[4,this.store.set("params.sdkVersion",void 0)];case 19:return _a.sent(),[4,this.store.set("params.serviceWorkerVersion",void 0)];case 20:return _a.sent(),[4,this.store.set("params.serviceWorkerUrl",void 0)];case 21:return _a.sent(),[4,this.store.set("params.serviceWorkerScope",void 0)];case 22:return _a.sent(),[4,this.store.set("params.lastOpenMessage",void 0)];case 23:return _a.sent(),[4,this.store.set("params.lastOpenApplicationTime",void 0)];case 24:return _a.sent(),[4,this.store.set("params.features",void 0)];case 25:return _a.sent(),[4,this.store.set("params.init",void 0)];case 26:return _a.sent(),[4,this.store.set("API_PARAMS",void 0)];case 27:return _a.sent(),[4,this.store.set("SENDER_ID",void 0)];case 28:return _a.sent(),[4,this.store.set("COMMUNICATION_ENABLED",void 0)];case 29:return _a.sent(),[4,this.store.set("DEVICE_DATA_REMOVED",void 0)];case 30:return _a.sent(),[4,this.store.set("LAST_OPEN_MESSAGE",void 0)];case 31:return _a.sent(),[4,this.store.set("DELAYED_EVENT",void 0)];case 32: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.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.setSenderId=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("GCM_SENDER_ID",senderId)];case 1:return _a.sent(),[4,this.store.set("params.senderId",senderId)];case 2:return _a.sent(),[2]}})})},Data.prototype.getSenderId=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("GCM_SENDER_ID")];case 1:return oldValue=_a.sent(),[4,this.store.get("params.senderId")];case 2:return[2,void 0!==(newValue=_a.sent())?newValue:oldValue]}})})},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.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.34.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 __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)},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.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){return __awaiter(this,void 0,void 0,function(){var entrypoint,response,result;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getApiEntrypoint()];case 1:return entrypoint=_a.sent(),[4,fetch(customUrl||entrypoint+methodName,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:request})})];case 2:return response=_a.sent(),[4,this.checkResponse(response)];case 3:return(result=_a.sent()).base_url?[4,this.data.setApiEntrypoint(result.base_url)]:[3,5];case 4:_a.sent(),_a.label=5;case 5:return[4,this.logger.write("apirequest",methodName+" call with arguments: "+JSON.stringify(request)+" to Pushwoosh has been successful. Result: "+JSON.stringify(result.response))];case 6:return _a.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])}}};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,fcm_push_set:tokens.fcmPushSet,fcm_token:tokens.fcmToken}))];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 params;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[2,this.apiClient.setTags(__assign(__assign({},params),{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 params,deviceType,id,response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getRequestParams()];case 1:return params=_a.sent(),[4,this.data.getDeviceType()];case 2:return deviceType=_a.sent(),id=""+userId,[4,this.apiClient.registerUser(__assign(__assign({},params),{userId:id,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:deviceType}))];case 3:return response=_a.sent(),[4,this.data.setUserId(""+userId)];case 4:return _a.sent(),[4,this.data.setStatusUserIdWasChanged(!0)];case 5:return _a.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,senderId_1,applicationServerKey,senderId,pushToken,_p256dn,_auth,p256dh,auth,_a,token,pushSet;return __generator(this,function(_b){switch(_b.label){case 0:return currentSubscription=subscription,this.checkIsPermissionGranted()?currentSubscription?[3,6]:[4,this.trySubscribe()]:(logger_1.Logger.error("You must have permission granted before subscribe!"),[2]);case 1:return currentSubscription=_b.sent(),[4,this.getSenderIdFromManifest()];case 2:return senderId_1=_b.sent(),[4,this.checkIsChangeSenderId(senderId_1)];case 3:return _b.sent()?[4,this.unsubscribe()]:[3,6];case 4:return _b.sent(),[4,this.data.setSenderId(senderId_1)];case 5:_b.sent(),_b.label=6;case 6:return[4,this.getApplicationServerKey()];case 7:return applicationServerKey=_b.sent(),[4,this.data.getSenderId()];case 8:return senderId=_b.sent(),[4,this.getPushToken(currentSubscription)];case 9:if(pushToken=_b.sent(),_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.getFcmKeys({endpoint:currentSubscription.endpoint,application_pub_key:applicationServerKey,encryption_key:p256dh,encryption_auth:auth,authorized_entity:senderId})];case 10:return _a=_b.sent(),token=_a.token,pushSet=_a.pushSet,[4,this.data.setTokens({publicKey:p256dh,pushToken:pushToken,authToken:auth,fcmPushSet:pushSet,fcmToken:token,endpoint:currentSubscription.endpoint})];case 11:return _b.sent(),[4,this.api.registerDevice()];case 12: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 savedSenderId,isExistSavedSenderId,manifestSenderId,isChangeSenderID,lastPermission,permission,credentials,pushTokenFromSubscription,subscriptionTokensFromStore,pushTokenFromStore;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return savedSenderId=_a.sent(),isExistSavedSenderId=void 0!==savedSenderId,[4,this.getSenderIdFromManifest()];case 2:return manifestSenderId=_a.sent(),isChangeSenderID=isExistSavedSenderId&&manifestSenderId!==savedSenderId,[4,this.data.setSenderId(manifestSenderId)];case 3:return _a.sent(),[4,this.data.getLastPermissionStatus()];case 4:return lastPermission=_a.sent(),permission=this.getPermission(),isExistSavedSenderId&&lastPermission!==permission?[4,this.data.setLastPermissionStatus(permission)]:[3,6];case 5:return _a.sent(),[2,!0];case 6:return[4,this.getCredentials()];case 7:return credentials=_a.sent(),[4,this.getPushToken(credentials)];case 8:return pushTokenFromSubscription=_a.sent(),[4,this.data.getTokens()];case 9:return subscriptionTokensFromStore=_a.sent(),pushTokenFromStore=subscriptionTokensFromStore&&subscriptionTokensFromStore.pushToken||"",[2,isChangeSenderID||!(pushTokenFromSubscription===pushTokenFromStore)]}})})},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.getFcmKeys=function(config){return __awaiter(this,void 0,void 0,function(){var response;return __generator(this,function(_a){switch(_a.label){case 0:return[4,fetch(this.config.entrypoint||"https://fcm.googleapis.com/fcm/connect/subscribe",{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify(config)})];case 1:return 200!==(response=_a.sent()).status?[3,3]:[4,response.json()];case 2:return[2,_a.sent()];case 3:throw new Error("Internal error: Can't register device in fcm. Status: "+response.status+". Message: "+response.statusText)}})})},PushServiceDefault.prototype.getPushToken=function(subscription){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(),subscription?12===deviceType?[2,subscription.endpoint]:[2,subscription.endpoint.split("/").pop()||""]:[2,""]}})})},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.getSenderIdFromManifest=function(){return __awaiter(this,void 0,void 0,function(){var manifest,url,response,data,match;return __generator(this,function(_a){switch(_a.label){case 0:if(!(manifest=document.querySelector('link[rel="manifest"]')))throw new Error("Error: manifest.json not found!");if(!(url=manifest.getAttribute("href")))throw new Error("Error: manifest.json url not found!");return[4,fetch(url,{method:"GET",headers:{"Content-Type":"application/json;charset=UTF-8"}})];case 1:if(200!==(response=_a.sent()).status)throw new Error("Error: Can't load manifest.json! "+response.statusText);return[4,response.text()];case 2:if(data=_a.sent(),!(match=data.match(/("|')?gcm_sender_id("|')?:\s*("|')?(\d+)("|')?/))||"string"!=typeof match[4])throw new Error("Error: Can't find gcm_sender_id in manifest.json!");return[2,match[4]]}})})},PushServiceDefault.prototype.checkIsChangeSenderId=function(currentSenderId){return __awaiter(this,void 0,void 0,function(){var senderIdFromIndexedDB;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.data.getSenderId()];case 1:return senderIdFromIndexedDB=_a.sent(),[2,currentSenderId!==senderIdFromIndexedDB]}})})},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";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 EventBus_1=__webpack_require__(17),Data_1=__webpack_require__(1),Api_1=__webpack_require__(19),PushServiceDefault_1=__webpack_require__(23),logger_1=__webpack_require__(48),storage_1=__webpack_require__(2),constants_1=__webpack_require__(0),functions_1=__webpack_require__(6),logger_2=__webpack_require__(4),global_1=__webpack_require__(50),notification_1=__webpack_require__(51),NotificationPayload_1=__webpack_require__(52),InboxMessages_1=__webpack_require__(24),InboxMessagesPublic_1=__webpack_require__(13),eventBus=new EventBus_1.EventBus,data=new Data_1.Data,api=new Api_1.Api(eventBus,data),Pushwoosh=self.Pushwoosh=new global_1.default(eventBus,data,api),clickedNotifications=[];function broadcastClients(msg){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,self.clients.matchAll()];case 1:return _a.sent().forEach(function(client){return client.postMessage(msg)}),[2]}})})}function parseNotificationEvent(event){return __awaiter(this,void 0,void 0,function(){var _a,notification,notificationData,notificationTag,url,button;return __generator(this,function(_b){return _a=event.notification,notificationData=(notification=void 0===_a?{}:_a).data,notificationTag=functions_1.parseSerializedNotificationParams(notification.tag,{}),url="",event.action&&Array.isArray(notificationData.buttons)?(button=notificationData.buttons.find(function(button){return button.action===event.action})||{},url=button.url):url=notificationTag.url,[2,{title:notification.title,body:notification.body,icon:notification.icon,buttons:notificationData.buttons,image:notificationData.image,code:notificationData.code,campaignCode:notificationData.campaignCode,inboxId:notificationData.inboxId,messageHash:notificationTag.messageHash,customData:notificationTag.customData,metaData:notificationTag.metaData,openUrl:notificationTag.url,tag:notification.tag,url:url}]})})}function onInstallFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onInstallEventHandler",code:"FATAL-SW-001",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function onActivateFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onActivateEventHandler",code:"FATAL-SW-002",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function onClickNotificationFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onNotificationClickEventHandler",code:"FATAL-SW-004",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function closeNotificationFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onNotificationCloseEventHandler",code:"FATAL-SW-005",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}function pushSubscriptionChangeFailure(error){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onPushSubscriptionChange",code:"FATAL-SW-006",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),[2]}})})}self.addEventListener("install",function(event){return event.waitUntil(function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all([Pushwoosh.data.setServiceWorkerVersion("3.34.0"),logger_2.Logger.write("info","install")])];case 1:return _a.sent(),[4,self.skipWaiting()];case 2:return _a.sent(),[2]}})})}().catch(onInstallFailure))}),self.addEventListener("activate",function(event){event.waitUntil(function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){switch(_a.label){case 0:return[4,Promise.all([logger_2.Logger.write("info","activate")])];case 1:return _a.sent(),[4,self.clients.claim()];case 2:return _a.sent(),[2]}})})}().catch(onActivateFailure))}),self.addEventListener("push",function(event){event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var payload,notificationPayload,notificationOptions,notificationShowOptions,messageHash,notification,_a,_b,onPushActions,inboxMessages,inboxMessagesPublic,inboxMessagePayload,payload_1;return __generator(this,function(_c){switch(_c.label){case 0:return[4,self.clients.claim()];case 1:return _c.sent(),[4,event.data.json()];case 2:return payload=_c.sent(),[4,(notificationPayload=new NotificationPayload_1.default(payload)).getNotificationOptionsPayload()];case 3:return notificationOptions=_c.sent(),[4,notificationPayload.getShowNotificationOptions()];case 4:return notificationShowOptions=_c.sent(),messageHash=notificationPayload.messageHash,[4,logger_2.Logger.write("info",JSON.stringify(notificationOptions),"onPush")];case 5:return _c.sent(),_a=notification_1.default.bind,_b=[void 0,notificationShowOptions,notificationPayload.body],[4,notificationPayload.getTitle()];case 6:return notification=new(_a.apply(notification_1.default,_b.concat([_c.sent()]))),[4,Pushwoosh.getListeners("onPush").reduce(function(pr,fun){return pr.then(function(){return fun(notification)})},Promise.resolve())];case 7:return _c.sent(),onPushActions=[notification.show(),storage_1.message.add({payload:payload,parsedPayload:notificationOptions,showOptions:notificationShowOptions}),broadcastClients({type:constants_1.EVENT_ON_PUSH_DELIVERY,payload:notificationOptions})],messageHash&&onPushActions.push(Pushwoosh.initApi().then(function(){return Pushwoosh.api.messageDeliveryEvent(messageHash,!0,notificationOptions.metaData)})),""===notificationPayload.inboxId?[3,10]:(inboxMessages=new InboxMessages_1.default(Pushwoosh.eventBus,Pushwoosh.data,Pushwoosh.api),inboxMessagesPublic=new InboxMessagesPublic_1.default(Pushwoosh.data,Pushwoosh.api,inboxMessages),[4,notificationPayload.getInboxMessage()]);case 8:return inboxMessagePayload=_c.sent(),[4,inboxMessagesPublic.publicMessageBuilder(inboxMessagePayload)];case 9:payload_1=_c.sent(),onPushActions.push(inboxMessages.putMessage(inboxMessagePayload),broadcastClients({type:constants_1.EVENT_ON_PUT_NEW_MESSAGE_TO_INBOX_STORE,payload:payload_1})),_c.label=10;case 10:return[4,Promise.all(onPushActions)];case 11:return _c.sent(),[2]}})})}(event).catch(function(error){return function(error,event){return __awaiter(this,void 0,void 0,function(){var applicationCode,workerVersion;return __generator(this,function(_a){switch(_a.label){case 0:return[4,Pushwoosh.data.getApplicationCode()];case 1:return applicationCode=_a.sent(),[4,Pushwoosh.data.getServiceWorkerVersion()];case 2:return workerVersion=_a.sent(),[4,logger_1.sendFatalLogToRemoteServer({message:"Error in onPushEventHandler",code:"FATAL-SW-003",error:error,applicationCode:applicationCode,workerVersion:workerVersion})];case 3:return _a.sent(),error instanceof Error||(error=new Error(error)),[2,storage_1.message.add({error:""+error,stack:error.stack,payload:event.data&&event.data.text()})]}})})}(error,event)}))}),self.addEventListener("notificationclick",function(event){event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var notificationOptions,messageHash,metaData,url,code,inboxId,inboxMessages,message_1,message;return __generator(this,function(_a){switch(_a.label){case 0:return[4,self.clients.claim()];case 1:return _a.sent(),[4,parseNotificationEvent(event)];case 2:return notificationOptions=_a.sent(),messageHash=notificationOptions.messageHash,metaData=notificationOptions.metaData,url=notificationOptions.url,code=notificationOptions.code,inboxId=notificationOptions.inboxId,code&&clickedNotifications.push(code),""===inboxId?[3,5]:[4,(inboxMessages=new InboxMessages_1.default(Pushwoosh.eventBus,Pushwoosh.data,Pushwoosh.api)).getMessage(inboxId)];case 3:return(message_1=_a.sent()).status=3,[4,inboxMessages.putMessage(message_1)];case 4:_a.sent(),_a.label=5;case 5:return event.notification.close(),message={type:constants_1.EVENT_ON_NOTIFICATION_CLICK,payload:notificationOptions},url&&event.waitUntil(self.clients.matchAll({type:"window"}).then(function(windowClients){return function(windowClients,url){return __awaiter(this,void 0,void 0,function(){var _a,openedHostname,openedPathname,clientWithSameAddress;return __generator(this,function(_b){switch(_b.label){case 0:return _a=new URL(url,self.location.origin),openedHostname=_a.hostname,openedPathname=_a.pathname,(clientWithSameAddress=windowClients.find(function(windowClient){var _a=new URL(windowClient.url),windowClientHostname=_a.hostname,windowClientPathname=_a.pathname;return windowClientHostname===openedHostname&&windowClientPathname===openedPathname}))?[4,clientWithSameAddress.focus()]:[3,2];case 1:return _b.sent(),[2,!1];case 2:return[4,self.clients.openWindow(url).then(function(newClientWindow){newClientWindow&&newClientWindow.focus()})];case 3:return _b.sent(),[2,!0]}})})}(windowClients,url)}).then(function(isFocusOnNewWindowClient){isFocusOnNewWindowClient&&Pushwoosh.data.setDelayedEvent(message)})),[2,Promise.all([Pushwoosh.initApi().then(function(){return Pushwoosh.api.pushStat(messageHash,!0,metaData)}),Pushwoosh.data.setLastOpenMessage({url:url,messageHash:messageHash,expiry:Date.now()+constants_1.PERIOD_GOAL_EVENT}),broadcastClients(message)])]}})})}(event).catch(onClickNotificationFailure))}),self.addEventListener("notificationclose",function(event){event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var notificationOptions,code,index;return __generator(this,function(_a){switch(_a.label){case 0:return[4,self.clients.claim()];case 1:return _a.sent(),[4,parseNotificationEvent(event)];case 2:return notificationOptions=_a.sent(),code=notificationOptions.code,event.notification.close(),code?(index=clickedNotifications.indexOf(code))>=0?(clickedNotifications.splice(index,1),[2]):[2,broadcastClients({type:constants_1.EVENT_ON_NOTIFICATION_CLOSE,payload:notificationOptions})]:[2]}})})}(event).catch(closeNotificationFailure))}),self.addEventListener("pushsubscriptionchange",function(event){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return event.waitUntil(function(event){return __awaiter(this,void 0,void 0,function(){var subscription;return __generator(this,function(_a){switch(_a.label){case 0:return(subscription=event.newSubscription)?[3,2]:[4,self.registration.pushManager.getSubscription()];case 1:if(!(subscription=_a.sent()))return[2];_a.label=2;case 2:return[4,new PushServiceDefault_1.PushServiceDefault(api,data,{}).subscribe(subscription)];case 3:return _a.sent(),[2]}})})}(event).catch(pushSubscriptionChangeFailure)),[2]})})})},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.sendErrorLogToRemoteServer=exports.sendFatalLogToRemoteServer=exports.logger=void 0;var logger_1=__webpack_require__(49),logger=new logger_1.Logger({level:"error",subscribers:[{level:"fatal",handler:logger_1.handlerSematext},{level:"error",handler:logger_1.handlerSematext}]});function makeMessage(params){var message=params.message,code=params.code,error=params.error,data=__rest(params,["message","code","error"]),cleanError=function(error){var cleanError=new Error("unknown error");"string"!=typeof error&&"number"!=typeof error&&"boolean"!=typeof error||(cleanError.message=error.toString());error instanceof Error&&(cleanError=error);return cleanError}(error);return{text:message,code:code,options:__assign(__assign({},data),{errorText:cleanError.message,errorStack:cleanError.stack})}}exports.logger=logger,exports.sendFatalLogToRemoteServer=function(params){return __awaiter(this,void 0,void 0,function(){var message;return __generator(this,function(_a){return message=makeMessage(params),[2,logger.fatal(message.text,message.code,message.options)]})})},exports.sendErrorLogToRemoteServer=function(params){return __awaiter(this,void 0,void 0,function(){var message;return __generator(this,function(_a){return message=makeMessage(params),[2,logger.error(message.text,message.code,message.options)]})})}},function(module,exports){module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){var module;return(installedModules[moduleId]||(module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}},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=2)}([function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,"__extends",function(){return __extends}),__webpack_require__.d(__webpack_exports__,"__assign",function(){return __assign}),__webpack_require__.d(__webpack_exports__,"__rest",function(){return __rest}),__webpack_require__.d(__webpack_exports__,"__decorate",function(){return __decorate}),__webpack_require__.d(__webpack_exports__,"__param",function(){return __param}),__webpack_require__.d(__webpack_exports__,"__metadata",function(){return __metadata}),__webpack_require__.d(__webpack_exports__,"__awaiter",function(){return __awaiter}),__webpack_require__.d(__webpack_exports__,"__generator",function(){return __generator}),__webpack_require__.d(__webpack_exports__,"__createBinding",function(){return __createBinding}),__webpack_require__.d(__webpack_exports__,"__exportStar",function(){return __exportStar}),__webpack_require__.d(__webpack_exports__,"__values",function(){return __values}),__webpack_require__.d(__webpack_exports__,"__read",function(){return __read}),__webpack_require__.d(__webpack_exports__,"__spread",function(){return __spread}),__webpack_require__.d(__webpack_exports__,"__spreadArrays",function(){return __spreadArrays}),__webpack_require__.d(__webpack_exports__,"__await",function(){return __await}),__webpack_require__.d(__webpack_exports__,"__asyncGenerator",function(){return __asyncGenerator}),__webpack_require__.d(__webpack_exports__,"__asyncDelegator",function(){return __asyncDelegator}),__webpack_require__.d(__webpack_exports__,"__asyncValues",function(){return __asyncValues}),__webpack_require__.d(__webpack_exports__,"__makeTemplateObject",function(){return __makeTemplateObject}),__webpack_require__.d(__webpack_exports__,"__importStar",function(){return __importStar}),__webpack_require__.d(__webpack_exports__,"__importDefault",function(){return __importDefault}),__webpack_require__.d(__webpack_exports__,"__classPrivateFieldGet",function(){return __classPrivateFieldGet}),__webpack_require__.d(__webpack_exports__,"__classPrivateFieldSet",function(){return __classPrivateFieldSet});
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- 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)};function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __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)};function __rest(s,e){var t={};for(p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,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}function __decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;0<=i;i--)(d=decorators[i])&&(r=(c<3?d(r):3<c?d(target,key,r):d(target,key))||r);return 3<c&&r&&Object.defineProperty(target,key,r),r}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __metadata(metadataKey,metadataValue){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(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){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g={next:verb(0),throw:verb(1),return:verb(2)};return"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){var op=[n,v];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,(op=t?[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=0<(t=_.trys).length&&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];else if(6===op[0]&&_.label<t[1])_.label=t[1],t=op;else{if(!(t&&_.label<t[2])){t[2]&&_.ops.pop(),_.trys.pop();continue}_.label=t[2],_.ops.push(op)}}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}}}}function __createBinding(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}function __exportStar(m,exports){for(var p in m)"default"===p||exports.hasOwnProperty(p)||(exports[p]=m[p])}function __values(o){var s="function"==typeof Symbol&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&"number"==typeof o.length)return{next:function(){return{value:(o=o&&i>=o.length?void 0:o)&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,n){var m="function"==typeof Symbol&&o[Symbol.iterator];if(!m)return o;var r,e,i=m.call(o),ar=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error:error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar}function __spread(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read(arguments[i]));return ar}function __spreadArrays(){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}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){var g,q,i;if(Symbol.asyncIterator)return g=generator.apply(thisArg,_arguments||[]),q=[],i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;throw new TypeError("Symbol.asyncIterator is not defined.");function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){1<q.push([n,v,a,b])||resume(n,v)})})}function resume(n,v){try{(r=g[n](v)).value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}catch(e){settle(q[0][3],e)}var r}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function __asyncDelegator(o){var p,i={};return verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:"return"===n}:f?f(v):v}:f}}function __asyncValues(o){var m,i;if(Symbol.asyncIterator)return(m=o[Symbol.asyncIterator])?m.call(o):(o=__values(o),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);throw new TypeError("Symbol.asyncIterator is not defined.");function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){!function(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)}(resolve,reject,(v=o[n](v)).done,v.value)})}}}function __makeTemplateObject(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked}function __importStar(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)Object.hasOwnProperty.call(mod,k)&&(result[k]=mod[k]);return result.default=mod,result}function __importDefault(mod){return mod&&mod.__esModule?mod:{default:mod}}function __classPrivateFieldGet(receiver,privateMap){if(privateMap.has(receiver))return privateMap.get(receiver);throw new TypeError("attempted to get private field on non-instance")}function __classPrivateFieldSet(receiver,privateMap,value){if(privateMap.has(receiver))return privateMap.set(receiver,value),value;throw new TypeError("attempted to set private field on non-instance")}},function(module,exports,__webpack_require__){"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.loggerRelationsMap=exports.LOGGER_LEVEL_VALUE_DEBUG=exports.LOGGER_LEVEL_VALUE_INFO=exports.LOGGER_LEVEL_VALUE_WARN=exports.LOGGER_LEVEL_VALUE_ERROR=exports.LOGGER_LEVEL_VALUE_FATAL=exports.LOGGER_LEVEL_VALUE_SILENT=exports.LOGGER_LEVEL_DEBUG=exports.LOGGER_LEVEL_INFO=exports.LOGGER_LEVEL_WARN=exports.LOGGER_LEVEL_ERROR=exports.LOGGER_LEVEL_FATAL=exports.LOGGER_LEVEL_SILENT=void 0,exports.LOGGER_LEVEL_SILENT="silent",exports.LOGGER_LEVEL_FATAL="fatal",exports.LOGGER_LEVEL_ERROR="error",exports.LOGGER_LEVEL_WARN="warn",exports.LOGGER_LEVEL_INFO="info",exports.LOGGER_LEVEL_DEBUG="debug",exports.LOGGER_LEVEL_VALUE_SILENT=0,exports.LOGGER_LEVEL_VALUE_FATAL=10,exports.LOGGER_LEVEL_VALUE_ERROR=20,exports.LOGGER_LEVEL_VALUE_WARN=30,exports.LOGGER_LEVEL_VALUE_INFO=40,exports.LOGGER_LEVEL_VALUE_DEBUG=50,exports.loggerRelationsMap=((_a={})[exports.LOGGER_LEVEL_SILENT]=exports.LOGGER_LEVEL_VALUE_SILENT,_a[exports.LOGGER_LEVEL_FATAL]=exports.LOGGER_LEVEL_VALUE_FATAL,_a[exports.LOGGER_LEVEL_ERROR]=exports.LOGGER_LEVEL_VALUE_ERROR,_a[exports.LOGGER_LEVEL_WARN]=exports.LOGGER_LEVEL_VALUE_WARN,_a[exports.LOGGER_LEVEL_INFO]=exports.LOGGER_LEVEL_VALUE_INFO,_a[exports.LOGGER_LEVEL_DEBUG]=exports.LOGGER_LEVEL_VALUE_DEBUG,_a)},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=__webpack_require__(0);tslib_1.__exportStar(__webpack_require__(3),exports),tslib_1.__exportStar(__webpack_require__(5),exports),tslib_1.__exportStar(__webpack_require__(6),exports)},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Logger=void 0;var tslib_1=__webpack_require__(0),Logger_constants_1=__webpack_require__(1);tslib_1.__exportStar(__webpack_require__(4),exports),tslib_1.__exportStar(__webpack_require__(1),exports),__webpack_require__=function(){function Logger(config){this.relations=Logger_constants_1.loggerRelationsMap,this.level=config&&void 0!==config.level?config.level:Logger_constants_1.LOGGER_LEVEL_ERROR,this.applicationType=config&&void 0!==config.applicationType?config.applicationType:"sdk",this.subscribers=config&&void 0!==config.subscribers?config.subscribers:[]}return Logger.prototype.updateLogLevel=function(level){this.level=level},Logger.prototype.updateApplicationType=function(applicationType){this.applicationType=applicationType},Logger.prototype.updateApplicationCode=function(applicationCode){this.applicationCode=applicationCode},Logger.prototype.updateDomain=function(domain){this.domain=domain},Logger.prototype.updateDeviceInfo=function(deviceInfo){this.deviceInfo=deviceInfo},Logger.prototype.subscribe=function(level,handler){this.subscribers.push({handler:handler,level:level})},Logger.prototype.log=function(params){return tslib_1.__awaiter(this,void 0,void 0,function(){var actions,options,other,data,additionalData,message,_this=this;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return actions=[],options=params.options,other=tslib_1.__rest(params,["options"]),data=other,options&&(options.handler,additionalData=tslib_1.__rest(options,["handler"]),data=tslib_1.__assign(tslib_1.__assign({},other),additionalData)),message=this.getMessage(data),this.subscribers.forEach(function(subscriber){subscriber.level===params.type&&_this.relations[subscriber.level]<=_this.relations[_this.level]&&actions.push(subscriber.handler.call(null,message))}),options&&options.handler&&this.level!==Logger_constants_1.LOGGER_LEVEL_SILENT&&options.handler.call(null,message),[4,Promise.all(actions)];case 1:return _a.sent(),[2]}})})},Logger.prototype.debug=function(text,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_DEBUG,text:text,options:options})]})})},Logger.prototype.info=function(text,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_INFO,text:text,options:options})]})})},Logger.prototype.warn=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_WARN,text:text,code:code,options:options})]})})},Logger.prototype.error=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_ERROR,text:text,code:code,options:options})]})})},Logger.prototype.fatal=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_FATAL,text:text,code:code,options:options})]})})},Logger.prototype.errorAndThrow=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndThrow({type:Logger_constants_1.LOGGER_LEVEL_ERROR,text:text,code:code,options:options})]})})},Logger.prototype.errorAndReject=function(cb,text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndReject(cb,{type:Logger_constants_1.LOGGER_LEVEL_ERROR,text:text,code:code,options:options})]})})},Logger.prototype.fatalAndThrow=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndThrow({type:Logger_constants_1.LOGGER_LEVEL_FATAL,text:text,code:code,options:options})]})})},Logger.prototype.fatalAndReject=function(cb,text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndReject(cb,{type:Logger_constants_1.LOGGER_LEVEL_FATAL,text:text,code:code,options:options})]})})},Logger.prototype.logAndThrow=function(params){return tslib_1.__awaiter(this,void 0,void 0,function(){var error;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return[4,this.log(params)];case 1:throw _a.sent(),error=new Error(params.text),params.code&&(error.code=params.code),error}})})},Logger.prototype.logAndReject=function(reject,params){return tslib_1.__awaiter(this,void 0,void 0,function(){var error;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return[4,this.log(params)];case 1:return _a.sent(),error=new Error(params.text),params.code&&(error.code=params.code),reject(error),[2]}})})},Logger.prototype.getMessage=function(params){return tslib_1.__assign({applicationCode:this.applicationCode,domain:this.domain,applicationType:this.applicationType,deviceInfo:this.deviceInfo},params)},Logger}();exports.Logger=__webpack_require__},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handlerConsole=void 0,exports.handlerConsole=function(message){var code=message.code,text=message.text,log=function(type){switch(message=message.type){case"fatal":case"error":return console.error;case"warn":case"info":case"debug":return console.log}}();console.groupCollapsed(message),log(code?code+": "+text:text),console.groupEnd()}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handlerSematext=void 0;var tslib_1=__webpack_require__(0);exports.handlerSematext=function(message){return tslib_1.__awaiter(this,void 0,void 0,function(){var text,other,type,key;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:for(key in text=message.text,type=message.type,other=tslib_1.__rest(message,["text","type"]),type="https://logsene-receiver.eu.sematext.com/0ebd661c-f417-4b86-aa50-223165ac1047/"+type,other)other.hasOwnProperty(key)&&"object"==typeof other[key]&&(other[key]=JSON.stringify(other[key]));return[4,fetch(type,{method:"POST",body:JSON.stringify(tslib_1.__assign({message:text},other))})];case 1:return _a.sent(),[2]}})})}}])},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 WorkerPushwooshGlobal=function(){function WorkerPushwooshGlobal(eventBus,data,api){this._listeners={},this.eventBus=eventBus,this.data=data,this.api=api}return WorkerPushwooshGlobal.prototype.push=function(f){Array.isArray(f)&&"onPush"===f[0]&&"function"==typeof f[1]&&(this._listeners[f[0]]||(this._listeners[f[0]]=[]),this._listeners[f[0]].push(f[1]))},WorkerPushwooshGlobal.prototype.getListeners=function(eventName){return this._listeners[eventName]||[]},WorkerPushwooshGlobal.prototype.initApi=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,Promise.resolve()]})})},WorkerPushwooshGlobal}();exports.default=WorkerPushwooshGlobal},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),PushwooshNotification=function(){function PushwooshNotification(showNotificationOptions,duration,body,title){this._canceled=!1,this.showNotificationOptions=showNotificationOptions,this.duration=duration,this.body=body,this.title=title}return PushwooshNotification.prototype.show=function(){return __awaiter(this,void 0,void 0,function(){var showNotificationOptions,notifications,count,_this=this;return __generator(this,function(_a){switch(_a.label){case 0:return this._canceled?[2]:(showNotificationOptions=this.showNotificationOptions).silent?[3,2]:[4,self.registration.showNotification(this.title,showNotificationOptions)];case 1:_a.sent(),_a.label=2;case 2:return this.duration>=constants_1.MIN_NOTIFICATION_DURATION?[4,self.registration.getNotifications()]:[3,4];case 3:notifications=_a.sent(),count=Math.floor(this.duration/constants_1.WAKE_UP_SERVICE_WORKER_INTERVAL),this.wakeUpServiceWorker(count,this.body),notifications.forEach(function(notification){notification.data&&notification.data.code===_this.showNotificationOptions.data.code&&setTimeout(function(){notification.close()},1e3*_this.duration)}),_a.label=4;case 4:return[2]}})})},PushwooshNotification.prototype.wakeUpServiceWorker=function(count,body){var _this=this;(count-=1)>0&&setTimeout(function(){self.registration.active&&(self.registration.active.postMessage(""+count),_this.wakeUpServiceWorker(count,body))},1e3*constants_1.WAKE_UP_SERVICE_WORKER_INTERVAL)},PushwooshNotification.prototype.cancel=function(){this._canceled=!0},PushwooshNotification}();exports.default=PushwooshNotification},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});var unescape_1=__webpack_require__(54),constants_1=__webpack_require__(0),Data_1=__webpack_require__(2),DateModule_1=__webpack_require__(3),functions_1=__webpack_require__(5),NotificationPayload=function(){function NotificationPayload(payload,data,dateModule){if(void 0===data&&(data=new Data_1.Data),void 0===dateModule&&(dateModule=new DateModule_1.default),"data"in payload){var chromePayload=payload;this.payload=chromePayload.data}else this.payload=payload;this.data=data,this.code="notificationCode-"+Date.now()+"-"+Math.random().toString(16).slice(2,10),this.dateModule=dateModule}return NotificationPayload.prototype.getIcon=function(){return __awaiter(this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return(_a=this.payload.i)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:_a=_b.sent(),_b.label=2;case 2:return[2,_a]}})})},NotificationPayload.prototype.getTitle=function(){return __awaiter(this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return(_a=this.payload.header)?[3,2]:[4,this.data.getDefaultNotificationTitle()];case 1:_a=_b.sent(),_b.label=2;case 2:return[2,_a]}})})},Object.defineProperty(NotificationPayload.prototype,"silent",{get:function(){return Boolean(this.payload.silent)},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"body",{get:function(){return this.payload.body},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"messageHash",{get:function(){return this.payload.p||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"metaData",{get:function(){return this.payload.md?functions_1.parseSerializedNotificationParams(this.payload.md):{}},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"image",{get:function(){return this.payload.image||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"buttons",{get:function(){return this.payload.buttons?functions_1.parseSerializedNotificationParams(this.payload.buttons):[]},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"customData",{get:function(){return this.payload.u?functions_1.parseSerializedNotificationParams(this.payload.u):{}},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"campaignCode",{get:function(){return this.payload.pwcid||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"duration",{get:function(){var duration=this.payload.duration?Math.abs(parseInt(this.payload.duration,10)):constants_1.DEFAULT_NOTIFICATION_DURATION;return isNaN(duration)?constants_1.DEFAULT_NOTIFICATION_DURATION:Math.min(constants_1.MAX_NOTIFICATION_DURATION,duration)},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"link",{get:function(){return this.payload.l?unescape_1.unescape(this.payload.l):"/"},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"inboxId",{get:function(){return this.payload.pw_inbox||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"inboxParams",{get:function(){return this.payload.inbox_params?functions_1.parseSerializedNotificationParams(this.payload.inbox_params):{}},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"inboxRemovalTime",{get:function(){return this.inboxParams&&this.inboxParams.rt?this.inboxParams.rt:(this.dateModule.date=new Date,this.dateModule.addDays(1),this.dateModule.getUtcTimestamp().toString())},enumerable:!1,configurable:!0}),NotificationPayload.prototype.getInboxImage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return this.inboxParams&&this.inboxParams.image?[2,this.inboxParams.image]:[2,""]})})},Object.defineProperty(NotificationPayload.prototype,"rootParams",{get:function(){var _a=this.payload;_a.body,_a.p,_a.header,_a.duration,_a.i,_a.u,_a.l,_a.pwcid,_a.image,_a.buttons,_a.pw_inbox,_a.inbox_params;return __rest(_a,["body","p","header","duration","i","u","l","pwcid","image","buttons","pw_inbox","inbox_params"])},enumerable:!1,configurable:!0}),NotificationPayload.prototype.getNotificationOptionsPayload=function(){return __awaiter(this,void 0,void 0,function(){var title,icon;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getTitle()];case 1:return title=_a.sent(),[4,this.getIcon()];case 2:return icon=_a.sent(),[2,__assign(__assign({},this.rootParams),{body:this.body,title:title,icon:icon,image:this.image,buttons:this.buttons,customData:this.customData,metaData:this.metaData,campaignCode:this.campaignCode,duration:this.duration,openUrl:this.link,messageHash:this.messageHash})]}})})},NotificationPayload.prototype.getShowNotificationOptions=function(){return __awaiter(this,void 0,void 0,function(){var icon,buttons,requireInteraction;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getIcon()];case 1:return icon=_a.sent(),buttons=this.buttons.map(function(button,key){return button.action="action-"+key,button}),requireInteraction=0===this.duration||this.duration>=constants_1.MIN_NOTIFICATION_DURATION,[2,__assign(__assign({renotify:!0,requireInteraction:requireInteraction},this.rootParams),{body:this.body,icon:icon,tag:JSON.stringify({url:this.link,messageHash:this.messageHash,customData:this.customData,metaData:this.metaData}),data:{code:this.code,buttons:buttons,duration:this.duration,image:this.image,campaignCode:this.campaignCode,inboxId:this.inboxId},silent:this.silent,actions:buttons,image:this.image,buttons:buttons})]}})})},NotificationPayload.prototype.getInboxMessage=function(){return __awaiter(this,void 0,void 0,function(){var sendDate,title,image,actionType;return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,sendDate=this.dateModule.getTimestamp().toString(),title=this.payload.header||"",[4,this.getInboxImage()];case 1:return image=_a.sent(),actionType="URL",[2,{title:title,image:image,status:1,order:this.dateModule.getInboxFakeOrder(),inbox_id:this.inboxId,send_date:sendDate,rt:this.inboxRemovalTime,text:this.body,action_type:actionType,action_params:JSON.stringify({l:this.link})}]}})})},NotificationPayload}();exports.default=NotificationPayload},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.unescape=void 0;var htmlUnescapes={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reHasEscapedHtml=RegExp(reEscapedHtml.source);exports.unescape=function(string){return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,function(entity){return htmlUnescapes[entity]}):string}}])});
16
+ 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)};function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}var __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)};function __rest(s,e){var t={};for(p in s)Object.prototype.hasOwnProperty.call(s,p)&&e.indexOf(p)<0&&(t[p]=s[p]);if(null!=s&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,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}function __decorate(decorators,target,key,desc){var d,c=arguments.length,r=c<3?target:null===desc?desc=Object.getOwnPropertyDescriptor(target,key):desc;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(decorators,target,key,desc);else for(var i=decorators.length-1;0<=i;i--)(d=decorators[i])&&(r=(c<3?d(r):3<c?d(target,key,r):d(target,key))||r);return 3<c&&r&&Object.defineProperty(target,key,r),r}function __param(paramIndex,decorator){return function(target,key){decorator(target,key,paramIndex)}}function __metadata(metadataKey,metadataValue){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(metadataKey,metadataValue)}function __awaiter(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){var value;result.done?resolve(result.value):((value=result.value)instanceof P?value:new P(function(resolve){resolve(value)})).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())})}function __generator(thisArg,body){var f,y,t,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]},g={next:verb(0),throw:verb(1),return:verb(2)};return"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){var op=[n,v];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,(op=t?[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=0<(t=_.trys).length&&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];else if(6===op[0]&&_.label<t[1])_.label=t[1],t=op;else{if(!(t&&_.label<t[2])){t[2]&&_.ops.pop(),_.trys.pop();continue}_.label=t[2],_.ops.push(op)}}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}}}}function __createBinding(o,m,k,k2){o[k2=void 0===k2?k:k2]=m[k]}function __exportStar(m,exports){for(var p in m)"default"===p||exports.hasOwnProperty(p)||(exports[p]=m[p])}function __values(o){var s="function"==typeof Symbol&&Symbol.iterator,m=s&&o[s],i=0;if(m)return m.call(o);if(o&&"number"==typeof o.length)return{next:function(){return{value:(o=o&&i>=o.length?void 0:o)&&o[i++],done:!o}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,n){var m="function"==typeof Symbol&&o[Symbol.iterator];if(!m)return o;var r,e,i=m.call(o),ar=[];try{for(;(void 0===n||0<n--)&&!(r=i.next()).done;)ar.push(r.value)}catch(error){e={error:error}}finally{try{r&&!r.done&&(m=i.return)&&m.call(i)}finally{if(e)throw e.error}}return ar}function __spread(){for(var ar=[],i=0;i<arguments.length;i++)ar=ar.concat(__read(arguments[i]));return ar}function __spreadArrays(){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}function __await(v){return this instanceof __await?(this.v=v,this):new __await(v)}function __asyncGenerator(thisArg,_arguments,generator){var g,q,i;if(Symbol.asyncIterator)return g=generator.apply(thisArg,_arguments||[]),q=[],i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i;throw new TypeError("Symbol.asyncIterator is not defined.");function verb(n){g[n]&&(i[n]=function(v){return new Promise(function(a,b){1<q.push([n,v,a,b])||resume(n,v)})})}function resume(n,v){try{(r=g[n](v)).value instanceof __await?Promise.resolve(r.value.v).then(fulfill,reject):settle(q[0][2],r)}catch(e){settle(q[0][3],e)}var r}function fulfill(value){resume("next",value)}function reject(value){resume("throw",value)}function settle(f,v){f(v),q.shift(),q.length&&resume(q[0][0],q[0][1])}}function __asyncDelegator(o){var p,i={};return verb("next"),verb("throw",function(e){throw e}),verb("return"),i[Symbol.iterator]=function(){return this},i;function verb(n,f){i[n]=o[n]?function(v){return(p=!p)?{value:__await(o[n](v)),done:"return"===n}:f?f(v):v}:f}}function __asyncValues(o){var m,i;if(Symbol.asyncIterator)return(m=o[Symbol.asyncIterator])?m.call(o):(o=__values(o),i={},verb("next"),verb("throw"),verb("return"),i[Symbol.asyncIterator]=function(){return this},i);throw new TypeError("Symbol.asyncIterator is not defined.");function verb(n){i[n]=o[n]&&function(v){return new Promise(function(resolve,reject){!function(resolve,reject,d,v){Promise.resolve(v).then(function(v){resolve({value:v,done:d})},reject)}(resolve,reject,(v=o[n](v)).done,v.value)})}}}function __makeTemplateObject(cooked,raw){return Object.defineProperty?Object.defineProperty(cooked,"raw",{value:raw}):cooked.raw=raw,cooked}function __importStar(mod){if(mod&&mod.__esModule)return mod;var result={};if(null!=mod)for(var k in mod)Object.hasOwnProperty.call(mod,k)&&(result[k]=mod[k]);return result.default=mod,result}function __importDefault(mod){return mod&&mod.__esModule?mod:{default:mod}}function __classPrivateFieldGet(receiver,privateMap){if(privateMap.has(receiver))return privateMap.get(receiver);throw new TypeError("attempted to get private field on non-instance")}function __classPrivateFieldSet(receiver,privateMap,value){if(privateMap.has(receiver))return privateMap.set(receiver,value),value;throw new TypeError("attempted to set private field on non-instance")}},function(module,exports,__webpack_require__){"use strict";var _a;Object.defineProperty(exports,"__esModule",{value:!0}),exports.loggerRelationsMap=exports.LOGGER_LEVEL_VALUE_DEBUG=exports.LOGGER_LEVEL_VALUE_INFO=exports.LOGGER_LEVEL_VALUE_WARN=exports.LOGGER_LEVEL_VALUE_ERROR=exports.LOGGER_LEVEL_VALUE_FATAL=exports.LOGGER_LEVEL_VALUE_SILENT=exports.LOGGER_LEVEL_DEBUG=exports.LOGGER_LEVEL_INFO=exports.LOGGER_LEVEL_WARN=exports.LOGGER_LEVEL_ERROR=exports.LOGGER_LEVEL_FATAL=exports.LOGGER_LEVEL_SILENT=void 0,exports.LOGGER_LEVEL_SILENT="silent",exports.LOGGER_LEVEL_FATAL="fatal",exports.LOGGER_LEVEL_ERROR="error",exports.LOGGER_LEVEL_WARN="warn",exports.LOGGER_LEVEL_INFO="info",exports.LOGGER_LEVEL_DEBUG="debug",exports.LOGGER_LEVEL_VALUE_SILENT=0,exports.LOGGER_LEVEL_VALUE_FATAL=10,exports.LOGGER_LEVEL_VALUE_ERROR=20,exports.LOGGER_LEVEL_VALUE_WARN=30,exports.LOGGER_LEVEL_VALUE_INFO=40,exports.LOGGER_LEVEL_VALUE_DEBUG=50,exports.loggerRelationsMap=((_a={})[exports.LOGGER_LEVEL_SILENT]=exports.LOGGER_LEVEL_VALUE_SILENT,_a[exports.LOGGER_LEVEL_FATAL]=exports.LOGGER_LEVEL_VALUE_FATAL,_a[exports.LOGGER_LEVEL_ERROR]=exports.LOGGER_LEVEL_VALUE_ERROR,_a[exports.LOGGER_LEVEL_WARN]=exports.LOGGER_LEVEL_VALUE_WARN,_a[exports.LOGGER_LEVEL_INFO]=exports.LOGGER_LEVEL_VALUE_INFO,_a[exports.LOGGER_LEVEL_DEBUG]=exports.LOGGER_LEVEL_VALUE_DEBUG,_a)},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var tslib_1=__webpack_require__(0);tslib_1.__exportStar(__webpack_require__(3),exports),tslib_1.__exportStar(__webpack_require__(5),exports),tslib_1.__exportStar(__webpack_require__(6),exports)},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Logger=void 0;var tslib_1=__webpack_require__(0),Logger_constants_1=__webpack_require__(1);tslib_1.__exportStar(__webpack_require__(4),exports),tslib_1.__exportStar(__webpack_require__(1),exports),__webpack_require__=function(){function Logger(config){this.relations=Logger_constants_1.loggerRelationsMap,this.level=config&&void 0!==config.level?config.level:Logger_constants_1.LOGGER_LEVEL_ERROR,this.applicationType=config&&void 0!==config.applicationType?config.applicationType:"sdk",this.subscribers=config&&void 0!==config.subscribers?config.subscribers:[]}return Logger.prototype.updateLogLevel=function(level){this.level=level},Logger.prototype.updateApplicationType=function(applicationType){this.applicationType=applicationType},Logger.prototype.updateApplicationCode=function(applicationCode){this.applicationCode=applicationCode},Logger.prototype.updateDomain=function(domain){this.domain=domain},Logger.prototype.updateDeviceInfo=function(deviceInfo){this.deviceInfo=deviceInfo},Logger.prototype.subscribe=function(level,handler){this.subscribers.push({handler:handler,level:level})},Logger.prototype.log=function(params){return tslib_1.__awaiter(this,void 0,void 0,function(){var actions,options,other,data,additionalData,message,_this=this;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return actions=[],options=params.options,other=tslib_1.__rest(params,["options"]),data=other,options&&(options.handler,additionalData=tslib_1.__rest(options,["handler"]),data=tslib_1.__assign(tslib_1.__assign({},other),additionalData)),message=this.getMessage(data),this.subscribers.forEach(function(subscriber){subscriber.level===params.type&&_this.relations[subscriber.level]<=_this.relations[_this.level]&&actions.push(subscriber.handler.call(null,message))}),options&&options.handler&&this.level!==Logger_constants_1.LOGGER_LEVEL_SILENT&&options.handler.call(null,message),[4,Promise.all(actions)];case 1:return _a.sent(),[2]}})})},Logger.prototype.debug=function(text,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_DEBUG,text:text,options:options})]})})},Logger.prototype.info=function(text,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_INFO,text:text,options:options})]})})},Logger.prototype.warn=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_WARN,text:text,code:code,options:options})]})})},Logger.prototype.error=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_ERROR,text:text,code:code,options:options})]})})},Logger.prototype.fatal=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.log({type:Logger_constants_1.LOGGER_LEVEL_FATAL,text:text,code:code,options:options})]})})},Logger.prototype.errorAndThrow=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndThrow({type:Logger_constants_1.LOGGER_LEVEL_ERROR,text:text,code:code,options:options})]})})},Logger.prototype.errorAndReject=function(cb,text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndReject(cb,{type:Logger_constants_1.LOGGER_LEVEL_ERROR,text:text,code:code,options:options})]})})},Logger.prototype.fatalAndThrow=function(text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndThrow({type:Logger_constants_1.LOGGER_LEVEL_FATAL,text:text,code:code,options:options})]})})},Logger.prototype.fatalAndReject=function(cb,text,code,options){return tslib_1.__awaiter(this,void 0,void 0,function(){return tslib_1.__generator(this,function(_a){return[2,this.logAndReject(cb,{type:Logger_constants_1.LOGGER_LEVEL_FATAL,text:text,code:code,options:options})]})})},Logger.prototype.logAndThrow=function(params){return tslib_1.__awaiter(this,void 0,void 0,function(){var error;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return[4,this.log(params)];case 1:throw _a.sent(),error=new Error(params.text),params.code&&(error.code=params.code),error}})})},Logger.prototype.logAndReject=function(reject,params){return tslib_1.__awaiter(this,void 0,void 0,function(){var error;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:return[4,this.log(params)];case 1:return _a.sent(),error=new Error(params.text),params.code&&(error.code=params.code),reject(error),[2]}})})},Logger.prototype.getMessage=function(params){return tslib_1.__assign({applicationCode:this.applicationCode,domain:this.domain,applicationType:this.applicationType,deviceInfo:this.deviceInfo},params)},Logger}();exports.Logger=__webpack_require__},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0})},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handlerConsole=void 0,exports.handlerConsole=function(message){var code=message.code,text=message.text,log=function(type){switch(message=message.type){case"fatal":case"error":return console.error;case"warn":case"info":case"debug":return console.log}}();console.groupCollapsed(message),log(code?code+": "+text:text),console.groupEnd()}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.handlerSematext=void 0;var tslib_1=__webpack_require__(0);exports.handlerSematext=function(message){return tslib_1.__awaiter(this,void 0,void 0,function(){var text,other,type,key;return tslib_1.__generator(this,function(_a){switch(_a.label){case 0:for(key in text=message.text,type=message.type,other=tslib_1.__rest(message,["text","type"]),type="https://logsene-receiver.eu.sematext.com/0ebd661c-f417-4b86-aa50-223165ac1047/"+type,other)other.hasOwnProperty(key)&&"object"==typeof other[key]&&(other[key]=JSON.stringify(other[key]));return[4,fetch(type,{method:"POST",body:JSON.stringify(tslib_1.__assign({message:text},other))})];case 1:return _a.sent(),[2]}})})}}])},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 WorkerPushwooshGlobal=function(){function WorkerPushwooshGlobal(eventBus,data,api){this._listeners={},this.eventBus=eventBus,this.data=data,this.api=api}return WorkerPushwooshGlobal.prototype.push=function(f){Array.isArray(f)&&"onPush"===f[0]&&"function"==typeof f[1]&&(this._listeners[f[0]]||(this._listeners[f[0]]=[]),this._listeners[f[0]].push(f[1]))},WorkerPushwooshGlobal.prototype.getListeners=function(eventName){return this._listeners[eventName]||[]},WorkerPushwooshGlobal.prototype.initApi=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return[2,Promise.resolve()]})})},WorkerPushwooshGlobal}();exports.default=WorkerPushwooshGlobal},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 PushwooshNotification=function(){function PushwooshNotification(showNotificationOptions,body,title){this._canceled=!1,this.showNotificationOptions=showNotificationOptions,this.body=body,this.title=title}return PushwooshNotification.prototype.show=function(){return __awaiter(this,void 0,void 0,function(){var showNotificationOptions;return __generator(this,function(_a){switch(_a.label){case 0:return this._canceled?[2]:(showNotificationOptions=this.showNotificationOptions).silent?[3,2]:[4,self.registration.showNotification(this.title,showNotificationOptions)];case 1:_a.sent(),_a.label=2;case 2:return[2]}})})},PushwooshNotification.prototype.cancel=function(){this._canceled=!0},PushwooshNotification}();exports.default=PushwooshNotification},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});var unescape_1=__webpack_require__(53),Data_1=__webpack_require__(1),DateModule_1=__webpack_require__(3),functions_1=__webpack_require__(6),NotificationPayload=function(){function NotificationPayload(payload,data,dateModule){if(void 0===data&&(data=new Data_1.Data),void 0===dateModule&&(dateModule=new DateModule_1.default),"data"in payload){var chromePayload=payload;this.payload=chromePayload.data}else this.payload=payload;this.data=data,this.code="notificationCode-"+Date.now()+"-"+Math.random().toString(16).slice(2,10),this.dateModule=dateModule}return NotificationPayload.prototype.getIcon=function(){return __awaiter(this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return(_a=this.payload.i)?[3,2]:[4,this.data.getDefaultNotificationImage()];case 1:_a=_b.sent(),_b.label=2;case 2:return[2,_a]}})})},NotificationPayload.prototype.getTitle=function(){return __awaiter(this,void 0,void 0,function(){var _a;return __generator(this,function(_b){switch(_b.label){case 0:return(_a=this.payload.header)?[3,2]:[4,this.data.getDefaultNotificationTitle()];case 1:_a=_b.sent(),_b.label=2;case 2:return[2,_a]}})})},Object.defineProperty(NotificationPayload.prototype,"silent",{get:function(){return Boolean(this.payload.silent)},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"body",{get:function(){return this.payload.body},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"messageHash",{get:function(){return this.payload.p||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"metaData",{get:function(){return this.payload.md?functions_1.parseSerializedNotificationParams(this.payload.md):{}},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"image",{get:function(){return this.payload.image||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"buttons",{get:function(){return this.payload.buttons?functions_1.parseSerializedNotificationParams(this.payload.buttons):[]},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"customData",{get:function(){return this.payload.u?functions_1.parseSerializedNotificationParams(this.payload.u):{}},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"campaignCode",{get:function(){return this.payload.pwcid||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"link",{get:function(){return this.payload.l?unescape_1.unescape(this.payload.l):"/"},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"inboxId",{get:function(){return this.payload.pw_inbox||""},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"inboxParams",{get:function(){return this.payload.inbox_params?functions_1.parseSerializedNotificationParams(this.payload.inbox_params):{}},enumerable:!1,configurable:!0}),Object.defineProperty(NotificationPayload.prototype,"inboxRemovalTime",{get:function(){return this.inboxParams&&this.inboxParams.rt?this.inboxParams.rt:(this.dateModule.date=new Date,this.dateModule.addDays(1),this.dateModule.getUtcTimestamp().toString())},enumerable:!1,configurable:!0}),NotificationPayload.prototype.getInboxImage=function(){return __awaiter(this,void 0,void 0,function(){return __generator(this,function(_a){return this.inboxParams&&this.inboxParams.image?[2,this.inboxParams.image]:[2,""]})})},Object.defineProperty(NotificationPayload.prototype,"rootParams",{get:function(){var _a=this.payload;_a.body,_a.p,_a.header,_a.i,_a.u,_a.l,_a.pwcid,_a.image,_a.buttons,_a.pw_inbox,_a.inbox_params;return __rest(_a,["body","p","header","i","u","l","pwcid","image","buttons","pw_inbox","inbox_params"])},enumerable:!1,configurable:!0}),NotificationPayload.prototype.getNotificationOptionsPayload=function(){return __awaiter(this,void 0,void 0,function(){var title,icon;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getTitle()];case 1:return title=_a.sent(),[4,this.getIcon()];case 2:return icon=_a.sent(),[2,__assign(__assign({},this.rootParams),{body:this.body,title:title,icon:icon,image:this.image,buttons:this.buttons,customData:this.customData,metaData:this.metaData,campaignCode:this.campaignCode,openUrl:this.link,messageHash:this.messageHash})]}})})},NotificationPayload.prototype.getShowNotificationOptions=function(){return __awaiter(this,void 0,void 0,function(){var icon,buttons;return __generator(this,function(_a){switch(_a.label){case 0:return[4,this.getIcon()];case 1:return icon=_a.sent(),buttons=this.buttons.map(function(button,key){return button.action="action-"+key,button}),[2,__assign(__assign({renotify:!0},this.rootParams),{body:this.body,icon:icon,tag:JSON.stringify({url:this.link,messageHash:this.messageHash,customData:this.customData,metaData:this.metaData}),data:{code:this.code,buttons:buttons,image:this.image,campaignCode:this.campaignCode,inboxId:this.inboxId},silent:this.silent,actions:buttons,image:this.image,buttons:buttons})]}})})},NotificationPayload.prototype.getInboxMessage=function(){return __awaiter(this,void 0,void 0,function(){var sendDate,title,image,actionType;return __generator(this,function(_a){switch(_a.label){case 0:return this.dateModule.date=new Date,sendDate=this.dateModule.getTimestamp().toString(),title=this.payload.header||"",[4,this.getInboxImage()];case 1:return image=_a.sent(),actionType=1,[2,{title:title,image:image,status:1,order:this.dateModule.getInboxFakeOrder(),inbox_id:this.inboxId,send_date:sendDate,rt:this.inboxRemovalTime,text:this.body,action_type:actionType,action_params:JSON.stringify({l:this.link})}]}})})},NotificationPayload}();exports.default=NotificationPayload},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.unescape=void 0;var htmlUnescapes={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reHasEscapedHtml=RegExp(reEscapedHtml.source);exports.unescape=function(string){return string&&reHasEscapedHtml.test(string)?string.replace(reEscapedHtml,function(entity){return htmlUnescapes[entity]}):string}}])});