!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("webpush",[],t):"object"==typeof exports?exports.webpush=t():e.webpush=t()}(this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,n){(function(t){var n;e.exports=function e(t,r,o){function i(c,u){if(!r[c]){if(!t[c]){if(!u&&"function"==typeof n&&n)return n(c,!0);if(a)return a(c,!0);var s=new Error("Cannot find module '"+c+"'");throw s.code="MODULE_NOT_FOUND",s}var f=r[c]={exports:{}};t[c][0].call(f.exports,(function(e){var n=t[c][1][e];return i(n||e)}),f,f.exports,e,t,r,o)}return r[c].exports}for(var a="function"==typeof n&&n,c=0;c<o.length;c++)i(o[c]);return i}({1:[function(e,n,r){(function(e){"use strict";var t,r,o=e.MutationObserver||e.WebKitMutationObserver;if(o){var i=0,a=new o(f),c=e.document.createTextNode("");a.observe(c,{characterData:!0}),t=function(){c.data=i=++i%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){f(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(f,0)};else{var u=new e.MessageChannel;u.port1.onmessage=f,t=function(){u.port2.postMessage(0)}}var s=[];function f(){var e,t;r=!0;for(var n=s.length;n;){for(t=s,s=[],e=-1;++e<n;)t[e]();n=s.length}r=!1}n.exports=function(e){1!==s.push(e)||r||t()}}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var r=e(1);function o(){}var i={},a=["REJECTED"],c=["FULFILLED"],u=["PENDING"];function s(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,e!==o&&p(this,e)}function f(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function l(e,t,n){r((function(){var r;try{r=t(n)}catch(t){return i.reject(e,t)}r===e?i.reject(e,new TypeError("Cannot resolve promise with itself")):i.resolve(e,r)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function r(t){n||(n=!0,i.reject(e,t))}function o(t){n||(n=!0,i.resolve(e,t))}var a=h((function(){t(o,r)}));"error"===a.status&&r(a.value)}function h(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}t.exports=s,s.prototype.catch=function(e){return this.then(null,e)},s.prototype.then=function(e,t){if("function"!=typeof e&&this.state===c||"function"!=typeof t&&this.state===a)return this;var n=new this.constructor(o);return this.state!==u?l(n,this.state===c?e:t,this.outcome):this.queue.push(new f(n,e,t)),n},f.prototype.callFulfilled=function(e){i.resolve(this.promise,e)},f.prototype.otherCallFulfilled=function(e){l(this.promise,this.onFulfilled,e)},f.prototype.callRejected=function(e){i.reject(this.promise,e)},f.prototype.otherCallRejected=function(e){l(this.promise,this.onRejected,e)},i.resolve=function(e,t){var n=h(d,t);if("error"===n.status)return i.reject(e,n.value);var r=n.value;if(r)p(e,r);else{e.state=c,e.outcome=t;for(var o=-1,a=e.queue.length;++o<a;)e.queue[o].callFulfilled(t)}return e},i.reject=function(e,t){e.state=a,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},s.resolve=function(e){return e instanceof this?e:i.resolve(new this(o),e)},s.reject=function(e){var t=new this(o);return i.reject(t,e)},s.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a=new Array(n),c=0,u=-1,s=new this(o);++u<n;)f(e[u],u);return s;function f(e,o){t.resolve(e).then((function(e){a[o]=e,++c!==n||r||(r=!0,i.resolve(s,a))}),(function(e){r||(r=!0,i.reject(s,e))}))}},s.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var a,c=-1,u=new this(o);++c<n;)a=e[c],t.resolve(a).then((function(e){r||(r=!0,i.resolve(u,e))}),(function(e){r||(r=!0,i.reject(u,e))}));return u}},{1:1}],3:[function(e,n,r){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(o){if("TypeError"!==o.name)throw o;for(var n=new("undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder),r=0;r<e.length;r+=1)n.append(e[r]);return n.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var a=Promise;function c(e,t){t&&e.then((function(e){t(null,e)}),(function(e){t(e)}))}function u(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function s(e){return"string"!=typeof e&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function f(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var l="local-forage-detect-blob-support",d=void 0,p={},h=Object.prototype.toString,v="readonly",b="readwrite";function y(e){return"boolean"==typeof d?a.resolve(d):function(e){return new a((function(t){var n=e.transaction(l,b),r=i([""]);n.objectStore(l).put(r,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);t(n||!e||parseInt(e[1],10)>=43)}})).catch((function(){return!1}))}(e).then((function(e){return d=e}))}function m(e){var t=p[e.name],n={};n.promise=new a((function(e,t){n.resolve=e,n.reject=t})),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then((function(){return n.promise})):t.dbReady=n.promise}function g(e){var t=p[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function w(e,t){var n=p[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function _(e,t){return new a((function(n,r){if(p[e.name]=p[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);m(e),e.db.close()}var i=[e.name];t&&i.push(e.version);var a=o.open.apply(o,i);t&&(a.onupgradeneeded=function(t){var n=a.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(l)}catch(n){if("ConstraintError"!==n.name)throw n;console.warn('The database "'+e.name+'" has been upgraded from version '+t.oldVersion+" to version "+t.newVersion+', but the storage "'+e.storeName+'" already exists.')}}),a.onerror=function(e){e.preventDefault(),r(a.error)},a.onsuccess=function(){n(a.result),g(e)}}))}function x(e){return _(e,!1)}function S(e){return _(e,!0)}function I(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),r=e.version<e.db.version,o=e.version>e.db.version;if(r&&(e.version!==t&&console.warn('The database "'+e.name+"\" can't be downgraded from version "+e.db.version+" to version "+e.version+"."),e.version=e.db.version),o||n){if(n){var i=e.db.version+1;i>e.version&&(e.version=i)}return!0}return!1}function O(e){return i([function(e){for(var t=e.length,n=new ArrayBuffer(t),r=new Uint8Array(n),o=0;o<t;o++)r[o]=e.charCodeAt(o);return n}(atob(e.data))],{type:e.type})}function j(e){return e&&e.__local_forage_encoded_blob}function k(e){var t=this,n=t._initReady().then((function(){var e=p[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady}));return u(n,e,e),n}function E(e,t,n,r){void 0===r&&(r=1);try{var o=e.db.transaction(e.storeName,t);n(null,o)}catch(o){if(r>0&&(!e.db||"InvalidStateError"===o.name||"NotFoundError"===o.name))return a.resolve().then((function(){if(!e.db||"NotFoundError"===o.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),S(e)})).then((function(){return function(e){m(e);for(var t=p[e.name],n=t.forages,r=0;r<n.length;r++){var o=n[r];o._dbInfo.db&&(o._dbInfo.db.close(),o._dbInfo.db=null)}return e.db=null,x(e).then((function(t){return e.db=t,I(e)?S(e):t})).then((function(r){e.db=t.db=r;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=r})).catch((function(t){throw w(e,t),t}))}(e).then((function(){E(e,t,n,r-1)}))})).catch(n);n(o)}}var P={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]=e[r];var o=p[n.name];o||(o={forages:[],db:null,dbReady:null,deferredOperations:[]},p[n.name]=o),o.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=k);var i=[];function c(){return a.resolve()}for(var u=0;u<o.forages.length;u++){var s=o.forages[u];s!==t&&i.push(s._initReady().catch(c))}var f=o.forages.slice(0);return a.all(i).then((function(){return n.db=o.db,x(n)})).then((function(e){return n.db=e,I(n,t._defaultConfig.version)?S(n):e})).then((function(e){n.db=o.db=e,t._dbInfo=n;for(var r=0;r<f.length;r++){var i=f[r];i!==t&&(i._dbInfo.db=n.db,i._dbInfo.version=n.version)}}))},_support:function(){try{if(!o)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){E(n._dbInfo,v,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).openCursor(),c=1;a.onsuccess=function(){var n=a.result;if(n){var r=n.value;j(r)&&(r=O(r));var o=e(r,n.key,c++);void 0!==o?t(o):n.continue()}else t()},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=new a((function(t,r){n.ready().then((function(){E(n._dbInfo,v,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).get(e);a.onsuccess=function(){var e=a.result;void 0===e&&(e=null),j(e)&&(e=O(e)),t(e)},a.onerror=function(){r(a.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},setItem:function(e,t,n){var r=this;e=s(e);var o=new a((function(n,o){var i;r.ready().then((function(){return i=r._dbInfo,"[object Blob]"===h.call(t)?y(i.db).then((function(e){return e?t:(n=t,new a((function(e,t){var r=new FileReader;r.onerror=t,r.onloadend=function(t){var r=btoa(t.target.result||"");e({__local_forage_encoded_blob:!0,data:r,type:n.type})},r.readAsBinaryString(n)})));var n})):t})).then((function(t){E(r._dbInfo,b,(function(i,a){if(i)return o(i);try{var c=a.objectStore(r._dbInfo.storeName);null===t&&(t=void 0);var u=c.put(t,e);a.oncomplete=function(){void 0===t&&(t=null),n(t)},a.onabort=a.onerror=function(){var e=u.error?u.error:u.transaction.error;o(e)}}catch(e){o(e)}}))})).catch(o)}));return c(o,n),o},removeItem:function(e,t){var n=this;e=s(e);var r=new a((function(t,r){n.ready().then((function(){E(n._dbInfo,b,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName).delete(e);i.oncomplete=function(){t()},i.onerror=function(){r(a.error)},i.onabort=function(){var e=a.error?a.error:a.transaction.error;r(e)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){E(t._dbInfo,b,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).clear();o.oncomplete=function(){e()},o.onabort=o.onerror=function(){var e=i.error?i.error:i.transaction.error;n(e)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){E(t._dbInfo,v,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).count();i.onsuccess=function(){e(i.result)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){e<0?t(null):n.ready().then((function(){E(n._dbInfo,v,(function(o,i){if(o)return r(o);try{var a=i.objectStore(n._dbInfo.storeName),c=!1,u=a.openCursor();u.onsuccess=function(){var n=u.result;n?0===e?t(n.key):c?t(n.key):(c=!0,n.advance(e)):t(null)},u.onerror=function(){r(u.error)}}catch(e){r(e)}}))})).catch(r)}));return c(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){E(t._dbInfo,v,(function(r,o){if(r)return n(r);try{var i=o.objectStore(t._dbInfo.storeName).openCursor(),a=[];i.onsuccess=function(){var t=i.result;t?(a.push(t.key),t.continue()):e(a)},i.onerror=function(){n(i.error)}}catch(e){n(e)}}))})).catch(n)}));return c(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n,r=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||r.name,e.storeName=e.storeName||r.storeName),e.name){var i=e.name===r.name&&this._dbInfo.db?a.resolve(this._dbInfo.db):x(e).then((function(t){var n=p[e.name],r=n.forages;n.db=t;for(var o=0;o<r.length;o++)r[o]._dbInfo.db=t;return t}));n=e.storeName?i.then((function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.version+1;m(e);var r=p[e.name],i=r.forages;t.close();for(var c=0;c<i.length;c++){var u=i[c];u._dbInfo.db=null,u._dbInfo.version=n}return new a((function(t,r){var i=o.open(e.name,n);i.onerror=function(e){i.result.close(),r(e)},i.onupgradeneeded=function(){i.result.deleteObjectStore(e.storeName)},i.onsuccess=function(){var e=i.result;e.close(),t(e)}})).then((function(e){r.db=e;for(var t=0;t<i.length;t++){var n=i[t];n._dbInfo.db=e,g(n._dbInfo)}})).catch((function(t){throw(w(e,t)||a.resolve()).catch((function(){})),t}))}})):i.then((function(t){m(e);var n=p[e.name],r=n.forages;t.close();for(var i=0;i<r.length;i++)r[i]._dbInfo.db=null;return new a((function(t,n){var r=o.deleteDatabase(e.name);r.onerror=r.onblocked=function(e){var t=r.result;t&&t.close(),n(e)},r.onsuccess=function(){var e=r.result;e&&e.close(),t(e)}})).then((function(e){n.db=e;for(var t=0;t<r.length;t++)g(r[t]._dbInfo)})).catch((function(t){throw(w(e,t)||a.resolve()).catch((function(){})),t}))}))}else n=a.reject("Invalid arguments");return c(n,t),n}},N="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",A="~~local_forage_type~",R=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",T=D.length,C="arbf",M="blob",B="si08",W="ui08",F="uic8",L="si16",z="si32",U="ur16",q="ui32",H="fl32",V="fl64",K=T+C.length,X=Object.prototype.toString;function J(e){var t,n,r,o,i,a=.75*e.length,c=e.length,u=0;"="===e[e.length-1]&&(a--,"="===e[e.length-2]&&a--);var s=new ArrayBuffer(a),f=new Uint8Array(s);for(t=0;t<c;t+=4)n=N.indexOf(e[t]),r=N.indexOf(e[t+1]),o=N.indexOf(e[t+2]),i=N.indexOf(e[t+3]),f[u++]=n<<2|r>>4,f[u++]=(15&r)<<4|o>>2,f[u++]=(3&o)<<6|63&i;return s}function Q(e){var t,n=new Uint8Array(e),r="";for(t=0;t<n.length;t+=3)r+=N[n[t]>>2],r+=N[(3&n[t])<<4|n[t+1]>>4],r+=N[(15&n[t+1])<<2|n[t+2]>>6],r+=N[63&n[t+2]];return n.length%3==2?r=r.substring(0,r.length-1)+"=":n.length%3==1&&(r=r.substring(0,r.length-2)+"=="),r}var G={serialize:function(e,t){var n="";if(e&&(n=X.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===X.call(e.buffer))){var r,o=D;e instanceof ArrayBuffer?(r=e,o+=C):(r=e.buffer,"[object Int8Array]"===n?o+=B:"[object Uint8Array]"===n?o+=W:"[object Uint8ClampedArray]"===n?o+=F:"[object Int16Array]"===n?o+=L:"[object Uint16Array]"===n?o+=U:"[object Int32Array]"===n?o+=z:"[object Uint32Array]"===n?o+=q:"[object Float32Array]"===n?o+=H:"[object Float64Array]"===n?o+=V:t(new Error("Failed to get type for BinaryArray"))),t(o+Q(r))}else if("[object Blob]"===n){var i=new FileReader;i.onload=function(){var n=A+e.type+"~"+Q(this.result);t(D+M+n)},i.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(n){console.error("Couldn't convert value into a JSON string: ",e),t(null,n)}},deserialize:function(e){if(e.substring(0,T)!==D)return JSON.parse(e);var t,n=e.substring(K),r=e.substring(T,K);if(r===M&&R.test(n)){var o=n.match(R);t=o[1],n=n.substring(o[0].length)}var a=J(n);switch(r){case C:return a;case M:return i([a],{type:t});case B:return new Int8Array(a);case W:return new Uint8Array(a);case F:return new Uint8ClampedArray(a);case L:return new Int16Array(a);case U:return new Uint16Array(a);case z:return new Int32Array(a);case q:return new Uint32Array(a);case H:return new Float32Array(a);case V:return new Float64Array(a);default:throw new Error("Unkown type: "+r)}},stringToBuffer:J,bufferToString:Q};function Y(e,t,n,r){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,r)}function Z(e,t,n,r,o,i){e.executeSql(n,r,o,(function(e,a){a.code===a.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],(function(e,c){c.rows.length?i(e,a):Y(e,t,(function(){e.executeSql(n,r,o,i)}),i)}),i):i(e,a)}),i)}function $(e,t,n,r){var o=this;e=s(e);var i=new a((function(i,a){o.ready().then((function(){void 0===t&&(t=null);var c=t,u=o._dbInfo;u.serializer.serialize(t,(function(t,s){s?a(s):u.db.transaction((function(n){Z(n,u,"INSERT OR REPLACE INTO "+u.storeName+" (key, value) VALUES (?, ?)",[e,t],(function(){i(c)}),(function(e,t){a(t)}))}),(function(t){if(t.code===t.QUOTA_ERR){if(r>0)return void i($.apply(o,[e,c,n,r-1]));a(t)}}))}))})).catch(a)}));return c(i,n),i}var ee={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var r in e)n[r]="string"!=typeof e[r]?e[r].toString():e[r];var o=new a((function(e,r){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return r(e)}n.db.transaction((function(o){Y(o,n,(function(){t._dbInfo=n,e()}),(function(e,t){r(t)}))}),r)}));return n.serializer=G,o},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT * FROM "+o.storeName,[],(function(n,r){for(var i=r.rows,a=i.length,c=0;c<a;c++){var u=i.item(c),s=u.value;if(s&&(s=o.serializer.deserialize(s)),void 0!==(s=e(s,u.key,c+1)))return void t(s)}t()}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[e],(function(e,n){var r=n.rows.length?n.rows.item(0).value:null;r&&(r=o.serializer.deserialize(r)),t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},setItem:function(e,t,n){return $.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=s(e);var r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"DELETE FROM "+o.storeName+" WHERE key = ?",[e],(function(){t()}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},clear:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"DELETE FROM "+r.storeName,[],(function(){e()}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},length:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"SELECT COUNT(key) as c FROM "+r.storeName,[],(function(t,n){var r=n.rows.item(0).c;e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},key:function(e,t){var n=this,r=new a((function(t,r){n.ready().then((function(){var o=n._dbInfo;o.db.transaction((function(n){Z(n,o,"SELECT key FROM "+o.storeName+" WHERE id = ? LIMIT 1",[e+1],(function(e,n){var r=n.rows.length?n.rows.item(0).key:null;t(r)}),(function(e,t){r(t)}))}))})).catch(r)}));return c(r,t),r},keys:function(e){var t=this,n=new a((function(e,n){t.ready().then((function(){var r=t._dbInfo;r.db.transaction((function(t){Z(t,r,"SELECT key FROM "+r.storeName,[],(function(t,n){for(var r=[],o=0;o<n.rows.length;o++)r.push(n.rows.item(o).key);e(r)}),(function(e,t){n(t)}))}))})).catch(n)}));return c(n,e),n},dropInstance:function(e,t){t=f.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var r,o=this;return c(r=e.name?new a((function(t){var r;r=e.name===n.name?o._dbInfo.db:openDatabase(e.name,"","",0),e.storeName?t({db:r,storeNames:[e.storeName]}):t(function(e){return new a((function(t,n){e.transaction((function(r){r.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],(function(n,r){for(var o=[],i=0;i<r.rows.length;i++)o.push(r.rows.item(i).name);t({db:e,storeNames:o})}),(function(e,t){n(t)}))}),(function(e){n(e)}))}))}(r))})).then((function(e){return new a((function(t,n){e.db.transaction((function(r){function o(e){return new a((function(t,n){r.executeSql("DROP TABLE IF EXISTS "+e,[],(function(){t()}),(function(e,t){n(t)}))}))}for(var i=[],c=0,u=e.storeNames.length;c<u;c++)i.push(o(e.storeNames[c]));a.all(i).then((function(){t()})).catch((function(e){n(e)}))}),(function(e){n(e)}))}))})):a.reject("Invalid arguments"),t),r}};function te(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function ne(){return!function(){try{return localStorage.setItem("_localforage_support_test",!0),localStorage.removeItem("_localforage_support_test"),!1}catch(e){return!0}}()||localStorage.length>0}var re={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=te(e,this._defaultConfig),ne()?(this._dbInfo=t,t.serializer=G,a.resolve()):a.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,r=n.ready().then((function(){for(var t=n._dbInfo,r=t.keyPrefix,o=r.length,i=localStorage.length,a=1,c=0;c<i;c++){var u=localStorage.key(c);if(0===u.indexOf(r)){var s=localStorage.getItem(u);if(s&&(s=t.serializer.deserialize(s)),void 0!==(s=e(s,u.substring(o),a++)))return s}}}));return c(r,t),r},getItem:function(e,t){var n=this;e=s(e);var r=n.ready().then((function(){var t=n._dbInfo,r=localStorage.getItem(t.keyPrefix+e);return r&&(r=t.serializer.deserialize(r)),r}));return c(r,t),r},setItem:function(e,t,n){var r=this;e=s(e);var o=r.ready().then((function(){void 0===t&&(t=null);var n=t;return new a((function(o,i){var a=r._dbInfo;a.serializer.serialize(t,(function(t,r){if(r)i(r);else try{localStorage.setItem(a.keyPrefix+e,t),o(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||i(e),i(e)}}))}))}));return c(o,n),o},removeItem:function(e,t){var n=this;e=s(e);var r=n.ready().then((function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)}));return c(r,t),r},clear:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;n>=0;n--){var r=localStorage.key(n);0===r.indexOf(e)&&localStorage.removeItem(r)}}));return c(n,e),n},length:function(e){var t=this.keys().then((function(e){return e.length}));return c(t,e),t},key:function(e,t){var n=this,r=n.ready().then((function(){var t,r=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(r.keyPrefix.length)),t}));return c(r,t),r},keys:function(e){var t=this,n=t.ready().then((function(){for(var e=t._dbInfo,n=localStorage.length,r=[],o=0;o<n;o++){var i=localStorage.key(o);0===i.indexOf(e.keyPrefix)&&r.push(i.substring(e.keyPrefix.length))}return r}));return c(n,e),n},dropInstance:function(e,t){if(t=f.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var r,o=this;return c(r=e.name?new a((function(t){e.storeName?t(te(e,o._defaultConfig)):t(e.name+"/")})).then((function(e){for(var t=localStorage.length-1;t>=0;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}})):a.reject("Invalid arguments"),t),r}},oe=function(e,t){for(var n,r,o=e.length,i=0;i<o;){if((n=e[i])===(r=t)||"number"==typeof n&&"number"==typeof r&&isNaN(n)&&isNaN(r))return!0;i++}return!1},ie=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},ae={},ce={},ue={INDEXEDDB:P,WEBSQL:ee,LOCALSTORAGE:re},se=[ue.INDEXEDDB._driver,ue.WEBSQL._driver,ue.LOCALSTORAGE._driver],fe=["dropInstance"],le=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(fe),de={description:"",driver:se.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function pe(e,t){e[t]=function(){var n=arguments;return e.ready().then((function(){return e[t].apply(e,n)}))}}function he(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(ie(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var ve=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),ue)if(ue.hasOwnProperty(n)){var r=ue[n],o=r._driver;this[n]=o,ae[o]||this.defineDriver(r)}this._defaultConfig=he({},de),this._config=he({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch((function(){}))}return e.prototype.config=function(e){if("object"===(void 0===e?"undefined":r(e))){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)}return"string"==typeof e?this._config[e]:this._config},e.prototype.defineDriver=function(e,t,n){var r=new a((function(t,n){try{var r=e._driver,o=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(o);for(var i=le.concat("_initStorage"),u=0,s=i.length;u<s;u++){var f=i[u];if((!oe(fe,f)||e[f])&&"function"!=typeof e[f])return void n(o)}!function(){for(var t=function(e){return function(){var t=new Error("Method "+e+" is not implemented by the current driver"),n=a.reject(t);return c(n,arguments[arguments.length-1]),n}},n=0,r=fe.length;n<r;n++){var o=fe[n];e[o]||(e[o]=t(o))}}();var l=function(n){ae[r]&&console.info("Redefining LocalForage driver: "+r),ae[r]=e,ce[r]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(l,n):l(!!e._support):l(!0)}catch(e){n(e)}}));return u(r,t,n),r},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var r=ae[e]?a.resolve(ae[e]):a.reject(new Error("Driver not found."));return u(r,t,n),r},e.prototype.getSerializer=function(e){var t=a.resolve(G);return u(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then((function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready}));return u(n,e,e),n},e.prototype.setDriver=function(e,t,n){var r=this;ie(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function c(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var s=null!==this._driverSet?this._driverSet.catch((function(){return a.resolve()})):a.resolve();return this._driverSet=s.then((function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then((function(e){r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=function(e){return function(){var t=0;return function n(){for(;t<e.length;){var o=e[t];return t++,r._dbInfo=null,r._ready=null,r.getDriver(o).then(c).catch(n)}i();var u=new Error("No available storage method found.");return r._driverSet=a.reject(u),r._driverSet}()}}(o)}))})).catch((function(){i();var e=new Error("No available storage method found.");return r._driverSet=a.reject(e),r._driverSet})),u(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!ce[e]},e.prototype._extend=function(e){he(this,e)},e.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];this.supports(o)&&t.push(o)}return t},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=le.length;e<t;e++)pe(this,le[e])},e.prototype.createInstance=function(t){return new e(t)},e}());t.exports=ve},{3:3}]},{},[4])(4)}).call(this,n(4))},function(e,t,n){var r=n(2),o=n(3);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var c=0;c<16;++c)t[i+c]=a[c];return t||o(a)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},,function(e,t,n){"use strict";n.r(t);var r=n(1),o=n.n(r),i=n(0),a=n.n(i),c={box:{display:"flex",width:"346px",minHeight:"106px",maxHeight:"140px",borderRadius:"8px",border:"solid 1px #979797",backgroundColor:"#efefef",zIndex:"990",position:"absolute",transitionProperty:"all",transitionDuration:".5s",opacity:"0"},badge_holder:{padding:"10px 10px 5px 10px",minHeight:"96px",position:"relative",display:"inline-block"},badge:{width:"92px",minHeight:"92px",borderRadius:"8px",border:"solid 2px #d1d1d1"},text_box:{display:"inline-block",padding:"11px 6px 5px 6px",fontFamily:"Helvetica",position:"relative"},title:{color:"#3b3b3b",fontWeight:"600",lineHeight:"16px",fontSize:"12px"},description:{width:"210px",minHeight:"35px",fontSize:"12px",fontWeight:"normal",fontStretch:"normal",fontStyle:"normal",lineHeight:"1.33",letterSpacing:"normal",color:"#0a0332",padding:"2px 0px 6px 0px"},allow_btn_text:{width:"110px",minHeight:"30px",borderRadius:"25px",backgroundColor:"#718d9f",border:"none",marginLeft:"6px",color:"#ffffff",lineHeight:"1.33",fontWeight:"600",fontSize:"12px",paddingTop:"2px"},disallow_btn_text:{minWidth:"91px",minHeight:"30px",borderRadius:"25px",fontFamily:"Helvetica",border:"solid 1px #718d9f",backgroundColor:"transparent",color:"#718d9f",lineHeight:"1.33",fontWeight:"600",fontSize:"12px",paddingTop:"2px"},buttons_holder:{textAlign:"left",display:"flex",position:"relative",left:"-2px",bottom:"-4px"},background:{opacity:"0",transitionProperty:"opacity",transitionDuration:".5s",position:"absolute",top:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.75)",zIndex:"900"},fullPageWrapper:{width:"100%",height:"100%",top:"0",position:"fixed"}},u={box:{name:"box",children:[{name:"badge_holder",children:[{name:"badge",tag:"img"}]},{name:"text_box",children:["title","description",{name:"buttons_holder",children:[{name:"disallow_btn_text",tag:"button"},{name:"allow_btn_text",tag:"button"}]}]}]},background:"background"};function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function f(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?f(Object(n),!0).forEach((function(t){h(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v,b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),h(this,"htmlClassPrefix","webpush-box"),h(this,"defaultPosition","top-center");var i=t.position,a=void 0===i?this.defaultPosition:i,s=d(t,["position"]);this.params=l({},s),this.styles=l({},c,{},r),this.clickEvents=l({},n),this.template=u,this.showAfterReady=o,this.elements=null,this.position=a,this.appendTemplateToPage().init()}var t,n,r;return t=e,(n=[{key:"init",value:function(){var e=this;if(this.showAfterReady){var t=this.params.show_delay,n=void 0===t?0:t;0!==n?setTimeout((function(){return e.show()}),1e3*n):this.show()}}},{key:"appendTemplateToPage",value:function(){this.elements=this.parseTemplate(this.template);var e=this.createElement("fullPageWrapper");for(var t in document.body.appendChild(e),this.setBoxPosition(),this.elements)e.appendChild(this.elements[t]);return this}},{key:"show",value:function(){var e=this.elements,t=e.box,n=e.background;t.style.opacity=n.style.opacity="1","string"==typeof this.position&&-1!==this.position.indexOf("top")&&t.setAttribute("style",t.getAttribute("style")+";top:10px;")}},{key:"hide",value:function(){var e=this.elements,t=e.box,n=e.background;t.style.opacity=n.style.opacity="0","string"==typeof this.position&&-1!==this.position.indexOf("top")&&(t.style.top="-250px")}},{key:"parseTemplate",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var t in e)e[t]=this.createElement(e[t]);return e}},{key:"setBoxPosition",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.position,t=this.elements.box;if("object"===s(e)&&("x"in e&&"y"in e?(t.style.left="".concat(e.x,"px"),t.style.top="".concat(e.y,"px")):e=this.defaultPosition),"string"==typeof e){var n={margin:"0 auto",right:"0",left:"0"},r={margin:"auto 0",top:"0",bottom:"0"},o={top:{defaultPosition:"-250px",center:n},bottom:{center:n},left:{center:r},right:{center:r}};if("center-center"===e)return t.style.margin="50% auto",t.style.left="0",void(t.style.right="0");Object.keys(o).forEach((function(n){if(-1!==e.indexOf(n)&&(t.style[n]=o[n].defaultPosition||"10px",-1!==e.indexOf("center")))for(var r in o[n].center)t.style[r]=o[n].center[r]}))}}},{key:"createElement",value:function(e){var t=this,n=document.createElement(e.tag||"div"),r=e;return"object"===s(e)&&(r=e.name,e.children&&e.children.forEach((function(e){return n.appendChild(t.createElement(e))}))),this.addClassAndStyle(n,r),this.setElementAttributes(n,r,e.tag),"button"===e.tag&&r in this.clickEvents&&n.addEventListener("click",this.clickEvents[r]),n}},{key:"addClassAndStyle",value:function(e,t){if(e.classList.add("".concat(this.htmlClassPrefix,"-").concat(t)),t in this.styles){var n=this.styles[t];for(var r in n)e.style[r]=n[r]}return e}},{key:"setElementAttributes",value:function(e,t,n){if(t in this.params&&""!==this.params[t])switch(n){case"img":e.setAttribute("src",this.params[t]);break;default:e.innerText=this.params[t]}else""===this.params[t]&&(e.style.display="none")}}])&&p(t.prototype,n),r&&p(t,r),e}();function y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function g(e,t){var n=t.get(e);if(!n)throw new TypeError("attempted to get private field on non-instance");return n.get?n.get.call(e):n.value}function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){x(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S="/sw.js",I="prompt",O="denied",j="granted",k="BKzI77dDvwmv0XI-DlHgNieupf3_t3OBDikB6m7ODtbukwo2HyiNWF4RcqAX-UzL5-FTSuIFkRJRL0meH3ZLqOk",E=(x(v={},I,"ask"),x(v,O,"block"),v),P=x({},j,"allow"),N=_({},P,{},E),A=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),R.set(this,{writable:!0,value:null}),D.set(this,{writable:!0,value:function(){return g(n,L).call(n).then((function(){g(n,B).call(n),g(n,T).call(n)}))}}),T.set(this,{writable:!0,value:function(){if(n.application&&n.application.hasOwnProperty("opt_in_box")){var e=_({},n.application.opt_in_box),t={disallow_btn_text:function(){g(n,C).call(n)},allow_btn_text:function(){g(n,M).call(n)}},r=n.notificationPermission===I;!function(e,t,n){var r=t.get(e);if(!r)throw new TypeError("attempted to set private field on non-instance");if(r.set)r.set.call(e,n);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=n}}(n,R,new b(e,t,{},r))}}}),C.set(this,{writable:!0,value:function(){var e=n.application.opt_in_box;if(e){var t=e.disallow_url,r=e.disallow_action;r&&n.handleUserAction(r).then((function(){t&&g(n,Q).call(n,t),n.hideOptInBox()}))}}}),M.set(this,{writable:!0,value:function(){var e=n.application.opt_in_box;if(e){var t=e.allow_action;t&&n.handleUserAction(t).then((function(){Notification.requestPermission()}))}}}),B.set(this,{writable:!0,value:function(){n.notificationPermission===j?g(n,J).call(n,"allow_url"):n.notificationPermission===O&&g(n,J).call(n,"block_url")}}),W.set(this,{writable:!0,value:function(e){return n.isSubscribed=!!e,a.a.setItem("is_subscribed",n.isSubscribed)}}),F.set(this,{writable:!0,value:function(e){var t=Math.floor(Date.now()/6e4);return"".concat(e,"?hash=").concat(t)}}),L.set(this,{writable:!0,value:function(){return new Promise((function(e,t){"serviceWorker"in navigator&&"PushManager"in window?navigator.serviceWorker.register(g(n,F).call(n,S),{updateViaCache:"none"}).then((function(e){n.sw=e})).then((function(){return g(n,H).call(n)})).then((function(){g(n,U).call(n),g(n,$).call(n,"webpush-sw-registered"),e()})).catch((function(e){return t(e)})):(console.warn("Push messaging is not supported"),t())}))}}),z.set(this,{writable:!0,value:function(e){var t=e.target.state;switch(n.notificationPermission=t,t){case j:g(n,X).call(n).then((function(){return n.hideOptInBox()}));break;case I:n.showOptInBox(),g(n,Z).call(n);break;case O:g(n,Z).call(n),n.hideOptInBox();break;default:g(n,Z).call(n)}g(n,$).call(n,"webpush-sw-permission-".concat(N[t]))}}),U.set(this,{writable:!0,value:function(){"permissions"in navigator?navigator.permissions.query({name:"notifications"}).then((function(e){e.onchange=g(n,z)})):console.warn("permissions not supported")}}),q.set(this,{writable:!0,value:function(){return new Promise((function(e,t){"permissions"in navigator?navigator.permissions.query({name:"notifications"}).then((function(t){e(t.state)})).catch((function(e){return t(e)})):"Notification"in window?e(Notification.permission):t("no permissions")}))}}),H.set(this,{writable:!0,value:function(){return n.notificationPermission in E&&n.isSubscribed?g(n,Z).call(n):g(n,V).call(n).then((function(e){return e?g(n,ee).call(n,{subscription:e,action:N[n.notificationPermission]}):n.notificationPermission in P?g(n,X).call(n):void 0}))}}),V.set(this,{writable:!0,value:function(){return new Promise((function(e,t){n.sw&&n.sw.pushManager||t("no service worker, on subscription load"),e(n.sw.pushManager.getSubscription())}))}}),x(this,"handleSubscribeUser",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};n.isSubscribed||(n.data=_({},n.data,{},e),Notification.requestPermission())})),x(this,"handleUserAction",(function(e){return new Promise((function(t,r){e?g(n,ee).call(n,{action:e}).then((function(){return t(!0)})).catch((function(){return r(!1)})):r("Action is required param")}))})),x(this,"handleUnsubscribeUser",(function(){n.isSubscribed&&g(n,Z).call(n)})),K.set(this,{writable:!0,value:function(){return g(n,$).call(n,"webpush-sw-permission-".concat(N[n.notificationPermission]))}}),x(this,"handleDataUpdate",(function(e){return g(n,ee).call(n,_({action:N[n.notificationPermission]},e))})),X.set(this,{writable:!0,value:function(){return new Promise((function(e,t){n.notificationPermission in E&&t("Notifications is ".concat(N[n.notificationPermission],"!"));var r=g(n,re).call(n,k);n.sw.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:r}).then((function(e){return g(n,ee).call(n,{data:n.data,subscription:e,action:N.granted})})).then((function(r){r.ok||t(r.statusText),g(n,W).call(n,!0),g(n,K).call(n),g(n,J).call(n,"allow_url"),e()})).catch((function(e){t(e)}))}))}}),J.set(this,{writable:!0,value:function(e){n.application&&n.application[e]&&""!==n.application[e]&&g(n,Q).call(n,n.application[e])}}),Q.set(this,{writable:!0,value:function(e){return window.location.href=e}}),G.set(this,{writable:!0,value:function(){return fetch("".concat("https://server-api.push77.com/v1_0","/applications/").concat(n.appId,"/"),{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json"}}).then((function(e){return e.json()}))}}),Y.set(this,{writable:!0,value:function(){return g(n,V).call(n).then((function(e){if(e)return e.unsubscribe()}))}}),Z.set(this,{writable:!0,value:function(){return g(n,Y).call(n).then((function(){return g(n,ne).call(n)})).catch((function(e){})).then((function(){g(n,K).call(n),n.notificationPermission===O&&g(n,J).call(n,"block_url")}))}}),$.set(this,{writable:!0,value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};document.dispatchEvent(new CustomEvent(e,{detail:_({permission:n.notificationPermission},t)}))}}),ee.set(this,{writable:!0,value:function(e){return fetch("".concat("https://server-api.push77.com/v1_0","/applications/").concat(n.appId,"/action"),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(_({client_id:n.clientId},e))})}}),te.set(this,{writable:!0,value:function(){return new Promise((function(e,t){a.a.getItem("client_id").then((function(t){if(t)e(t);else{var n=o()();a.a.setItem("client_id",n).then((function(){e(n)}))}})).catch((function(){return t()}))}))}}),ne.set(this,{writable:!0,value:function(){return g(n,ee).call(n,{data:_({},n.data),action:E[n.notificationPermission]}).then((function(e){if(!e.ok)throw Error(e.statusText);g(n,W).call(n,!1)})).catch((function(e){console.error("Error",e)}))}}),re.set(this,{writable:!0,value:function(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=window.atob(t),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}}),this.sw=null,this.data=_({},r),this.clientId=null,this.isSubscribed=!1,this.notificationPermission=null,this.appId=t,this.application={},a.a.setItem("app_id",t),a.a.setItem("config",r),Promise.all([a.a.getItem("is_subscribed"),g(this,te).call(this),g(this,q).call(this),g(this,G).call(this)]).then((function(e){var t=y(e,4),r=t[0],o=t[1],i=t[2],a=t[3];n.clientId=o,n.isSubscribed=r,n.notificationPermission=i,n.application=a})).then((function(){return g(n,D).call(n)})).catch((function(e){return console.error(e)}))}var t,n,r;return t=e,(n=[{key:"showOptInBox",value:function(){g(this,R)&&g(this,R).show()}},{key:"hideOptInBox",value:function(){g(this,R)&&g(this,R).hide()}}])&&m(t.prototype,n),r&&m(t,r),e}(),R=new WeakMap,D=new WeakMap,T=new WeakMap,C=new WeakMap,M=new WeakMap,B=new WeakMap,W=new WeakMap,F=new WeakMap,L=new WeakMap,z=new WeakMap,U=new WeakMap,q=new WeakMap,H=new WeakMap,V=new WeakMap,K=new WeakMap,X=new WeakMap,J=new WeakMap,Q=new WeakMap,G=new WeakMap,Y=new WeakMap,Z=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,ne=new WeakMap,re=new WeakMap;!function(e){e.WebPush=function(e,t){return new A(e,t)}}(window)}])}));