/*! For license information please see sdk_product.js.LICENSE.txt */ !function(){var e={669:function(e,t,n){e.exports=n(609)},448:function(e,t,n){"use strict";var r=n(867),i=n(26),o=n(372),a=n(327),s=n(97),c=n(109),u=n(985),d=n(61);e.exports=function(e){return new Promise((function(t,n){var l=e.data,p=e.headers,f=e.responseType;r.isFormData(l)&&delete p["Content-Type"];var h=new XMLHttpRequest;if(e.auth){var g=e.auth.username||"",m=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";p.Authorization="Basic "+btoa(g+":"+m)}var v=s(e.baseURL,e.url);function w(){if(h){var r="getAllResponseHeaders"in h?c(h.getAllResponseHeaders()):null,o={data:f&&"text"!==f&&"json"!==f?h.response:h.responseText,status:h.status,statusText:h.statusText,headers:r,config:e,request:h};i(t,n,o),h=null}}if(h.open(e.method.toUpperCase(),a(v,e.params,e.paramsSerializer),!0),h.timeout=e.timeout,"onloadend"in h?h.onloadend=w:h.onreadystatechange=function(){h&&4===h.readyState&&(0!==h.status||h.responseURL&&0===h.responseURL.indexOf("file:"))&&setTimeout(w)},h.onabort=function(){h&&(n(d("Request aborted",e,"ECONNABORTED",h)),h=null)},h.onerror=function(){n(d("Network Error",e,null,h)),h=null},h.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(d(t,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",h)),h=null},r.isStandardBrowserEnv()){var b=(e.withCredentials||u(v))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;b&&(p[e.xsrfHeaderName]=b)}"setRequestHeader"in h&&r.forEach(p,(function(e,t){void 0===l&&"content-type"===t.toLowerCase()?delete p[t]:h.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(h.withCredentials=!!e.withCredentials),f&&"json"!==f&&(h.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&h.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&h.upload&&h.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){h&&(h.abort(),n(e),h=null)})),l||(l=null),h.send(l)}))}},609:function(e,t,n){"use strict";var r=n(867),i=n(849),o=n(321),a=n(185);function s(e){var t=new o(e),n=i(o.prototype.request,t);return r.extend(n,o.prototype,t),r.extend(n,t),n}var c=s(n(655));c.Axios=o,c.create=function(e){return s(a(c.defaults,e))},c.Cancel=n(263),c.CancelToken=n(972),c.isCancel=n(502),c.all=function(e){return Promise.all(e)},c.spread=n(713),c.isAxiosError=n(268),e.exports=c,e.exports.default=c},263:function(e){"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},972:function(e,t,n){"use strict";var r=n(263);function i(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.source=function(){var e;return{token:new i((function(t){e=t})),cancel:e}},e.exports=i},502:function(e){"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},321:function(e,t,n){"use strict";var r=n(867),i=n(327),o=n(782),a=n(572),s=n(185),c=n(875),u=c.validators;function d(e){this.defaults=e,this.interceptors={request:new o,response:new o}}d.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=s(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&c.assertOptions(t,{silentJSONParsing:u.transitional(u.boolean,"1.0.0"),forcedJSONParsing:u.transitional(u.boolean,"1.0.0"),clarifyTimeoutError:u.transitional(u.boolean,"1.0.0")},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var i,o=[];if(this.interceptors.response.forEach((function(e){o.push(e.fulfilled,e.rejected)})),!r){var d=[a,void 0];for(Array.prototype.unshift.apply(d,n),d=d.concat(o),i=Promise.resolve(e);d.length;)i=i.then(d.shift(),d.shift());return i}for(var l=e;n.length;){var p=n.shift(),f=n.shift();try{l=p(l)}catch(e){f(e);break}}try{i=a(l)}catch(e){return Promise.reject(e)}for(;o.length;)i=i.then(o.shift(),o.shift());return i},d.prototype.getUri=function(e){return e=s(this.defaults,e),i(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){d.prototype[e]=function(t,n){return this.request(s(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){d.prototype[e]=function(t,n,r){return this.request(s(r||{},{method:e,url:t,data:n}))}})),e.exports=d},782:function(e,t,n){"use strict";var r=n(867);function i(){this.handlers=[]}i.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},i.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=i},97:function(e,t,n){"use strict";var r=n(793),i=n(303);e.exports=function(e,t){return e&&!r(t)?i(e,t):t}},61:function(e,t,n){"use strict";var r=n(481);e.exports=function(e,t,n,i,o){var a=new Error(e);return r(a,t,n,i,o)}},572:function(e,t,n){"use strict";var r=n(867),i=n(527),o=n(502),a=n(655);function s(e){e.cancelToken&&e.cancelToken.throwIfRequested()}e.exports=function(e){return s(e),e.headers=e.headers||{},e.data=i.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return s(e),t.data=i.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(s(e),t&&t.response&&(t.response.data=i.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},481:function(e){"use strict";e.exports=function(e,t,n,r,i){return e.config=t,n&&(e.code=n),e.request=r,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}},185:function(e,t,n){"use strict";var r=n(867);e.exports=function(e,t){t=t||{};var n={},i=["url","method","data"],o=["headers","auth","proxy","params"],a=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],s=["validateStatus"];function c(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function u(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=c(void 0,e[i])):n[i]=c(e[i],t[i])}r.forEach(i,(function(e){r.isUndefined(t[e])||(n[e]=c(void 0,t[e]))})),r.forEach(o,u),r.forEach(a,(function(i){r.isUndefined(t[i])?r.isUndefined(e[i])||(n[i]=c(void 0,e[i])):n[i]=c(void 0,t[i])})),r.forEach(s,(function(r){r in t?n[r]=c(e[r],t[r]):r in e&&(n[r]=c(void 0,e[r]))}));var d=i.concat(o).concat(a).concat(s),l=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===d.indexOf(e)}));return r.forEach(l,u),n}},26:function(e,t,n){"use strict";var r=n(61);e.exports=function(e,t,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},527:function(e,t,n){"use strict";var r=n(867),i=n(655);e.exports=function(e,t,n){var o=this||i;return r.forEach(n,(function(n){e=n.call(o,e,t)})),e}},655:function(e,t,n){"use strict";var r=n(867),i=n(16),o=n(481),a={"Content-Type":"application/x-www-form-urlencoded"};function s(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,u={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(c=n(448)),c),transformRequest:[function(e,t){return i(t,"Accept"),i(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(s(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(s(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(0,JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional,n=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,a=!n&&"json"===this.responseType;if(a||i&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(a){if("SyntaxError"===e.name)throw o(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){u.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){u.headers[e]=r.merge(a)})),e.exports=u},849:function(e){"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r=0)return;a[t]="set-cookie"===t?(a[t]?a[t]:[]).concat([n]):a[t]?a[t]+", "+n:n}})),a):a}},713:function(e){"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},875:function(e,t,n){"use strict";var r=n(593),i={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){i[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var o={},a=r.version.split(".");function s(e,t){for(var n=t?t.split("."):a,r=e.split("."),i=0;i<3;i++){if(n[i]>r[i])return!0;if(n[i]0;){var o=r[i],a=t[o];if(a){var s=e[o],c=void 0===s||a(s,o,e);if(!0!==c)throw new TypeError("option "+o+" must be "+c)}else if(!0!==n)throw Error("Unknown option "+o)}},validators:i}},867:function(e,t,n){"use strict";var r=n(849),i=Object.prototype.toString;function o(e){return"[object Array]"===i.call(e)}function a(e){return void 0===e}function s(e){return null!==e&&"object"==typeof e}function c(e){if("[object Object]"!==i.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function u(e){return"[object Function]"===i.call(e)}function d(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),o(e))for(var n=0,r=e.length;n(((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot access private method")})(e,t),n);class s{constructor(e=""){((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,void 0)})(this,t),this.setToken(e),this.baseUrl="https://api.icalendars.app/"}register(e){return o().post(this.baseUrl+"api/v1/register",e,{headers:{"Content-Type":"application/json"}})}sendFirebaseToken(e){return e.token_receive_ms=Date.now().toString(),o().post(this.baseUrl+"api/v1/firebase/token",e,{headers:{Authorization:`Bearer ${this.getToken()}`,"Content-Type":"application/json"}})}sendFirebaseReaction(e,n,i){return e.push_popup_event_id=n,e.product_id=this.productId,e.host=a(this,t,r).call(this),e.event_trigger_ms=Date.now().toString(),void 0!==i&&(e.error_reason=i),o().post(this.baseUrl+"api/v1/firebase/popup",e,{headers:{"Content-Type":"application/json"}})}sendPwaReaction(e,t){return e.pwa_popup_event_id=t,o().post(this.baseUrl+"api/v1/pwa/popup",e,{headers:{"Content-Type":"application/json"}})}sendPwaStatus(e,t){return e.status_id=t,o().post(this.baseUrl+"api/v1/pwa/status",e,{headers:{"Content-Type":"application/json"}})}sendPwaLaunch(e){return o().post(this.baseUrl+"api/v1/pwa/launch",e,{headers:{"Content-Type":"application/json"}})}sendPwaRecreate(e){return o().post(this.baseUrl+"api/v1/pwa/recreate",e,{headers:{"Content-Type":"application/json"}})}sendPwaCreateEvent(e){return o().post(this.baseUrl+"api/v1/pwa/event",e,{headers:{"Content-Type":"application/json"}})}getToken(){return this.token}setToken(e){0!==e.length&&(this.token=e)}sendWebPushToken(e){return o().post(this.baseUrl+"api/v1/web-push/token",e,{headers:{Authorization:`Bearer ${this.getToken()}`,"Content-Type":"application/json"}})}sendWebPushReaction(e,n){return e.web_push_popup_event_id=n,e.product_id=this.productId,e.host=a(this,t,r).call(this),o().post(this.baseUrl+"api/v1/web-push/popup",e,{headers:{"Content-Type":"application/json"}})}}t=new WeakSet,r=function(){let e=new URL(window.location.href).host.split(".").reverse();return e[1]+"."+e[0]};class c{constructor(e){this.storageService=e,this.receiverIdStorageName="receiver_id"}setReceiverId(e){let t=this.storageService.getFromStorage(this.receiverIdStorageName);return t?(e.receiver_id=t,e):(e.receiver_id=null,e)}setUpReceiverIdToStorage(e){e&&this.storageService.setToStorage(this.receiverIdStorageName,e)}}class u{constructor(e){this.storageService=e,this.productReceiverIdCookie="product_receiver_id"}setUpProductReceiverIdToStorage(e){e&&this.storageService.setToStorage(this.productReceiverIdCookie,e)}}class d{makeRedirect(e){window.location.href=e}}function l(e,t,n){var r;if(!("Notification"in window))return void t.sendFirebaseReaction(e,7);let i="visit_count",o=null==(r=null==window?void 0:window.Notification)?void 0:r.permission,a=n.getFromStorage(i);a=""===a?0:++a,n.setToStorage(i,a);let s={apiKey:"AIzaSyBFXU9kz3Bf0LWFx8hiEPHf2Vpf3bqVeYE",authDomain:"fir-mailkeeper.firebaseapp.com",projectId:"firebase-mailkeeper",storageBucket:"firebase-mailkeeper.appspot.com",messagingSenderId:"186893845137",appId:"1:186893845137:web:f2979e942d8bf29a2f7530",measurementId:"G-3M8S6CEHRX"};"object"==typeof firebase?0!==a||"denied"!==o?((0===a&&"denied"!==o||a>0&&"default"===o)&&t.sendFirebaseReaction(e,4),"denied"!==o?Notification.requestPermission().then((function(n){if("granted"===n&&"default"===o&&t.sendFirebaseReaction(e,1),"denied"===n)return void t.sendFirebaseReaction(e,2);if("default"===n)return void t.sendFirebaseReaction(e,3);firebase.initializeApp(s);const r=firebase.messaging();navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:`${window.location.origin}/firebase-cloud-messaging-push-scope`}).then((n=>{r.getToken(r,{vapidKey:"BBnPulNRKwLXGwr6pbnHBa6Mh2Wzui1XhVGjjoDSJ7cfqbRIua2JqnXj03tYKPzE4sGUCvPjCMMVsA056S81GTc",serviceWorkerRegistration:n}).then((n=>{n?(e.token=n,t.sendFirebaseToken(e)):t.sendFirebaseReaction(e,6,"empty_token")})).catch((n=>{t.sendFirebaseReaction(e,6,n.message),console.log(n)}))})).catch(console.error)})):console.log("auto-blocked by user")):t.sendFirebaseReaction(e,5):console.log("Error load firebase")}const p=function(e){const t=[];let n=0;for(let r=0;r>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=63&i|128)}return t},f={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t>2,d=(3&i)<<4|a>>4;let l=(15&a)<<2|c>>6,p=63&c;s||(p=64,o||(l=64)),r.push(n[u],n[d],n[l],n[p])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(p(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n191&&i<224){const o=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){const o=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{const o=e[n++],a=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t>4;if(r.push(c),64!==a){const e=o<<4&240|a>>2;if(r.push(e),64!==s){const e=a<<6&192|s;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class h extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const g=function(e){return function(e){const t=p(e);return f.encodeByteArray(t,!0)}(e).replace(/\./g,"")};function m(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(const n in t)t.hasOwnProperty(n)&&"__proto__"!==n&&(e[n]=m(e[n],t[n]));return e}const v=()=>{try{return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__||(()=>{if("undefined"==typeof process)return;const e="MISSING_ENV_VAR".__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&function(e){try{return f.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},w=()=>{var e;return null===(e=v())||void 0===e?void 0:e.config};class b{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function y(){return"object"==typeof self&&self.self===self}function S(){try{return"object"==typeof indexedDB}catch(e){return!1}}class _ extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,_.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,k.prototype.create)}}class k{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],o=i?function(e,t){return e.replace(I,((e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",a=`${this.serviceName}: ${o} (${r}).`;return new _(r,a,n)}}const I=/\{\$([^}]+)}/g;function E(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],o=t[i];if(T(n)&&T(o)){if(!C(n,o))return!1}else if(n!==o)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function T(e){return null!==e&&"object"==typeof e}function D(e,t){const n=new O(e,t);return n.subscribe.bind(n)}class O{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const t of["next","error","complete"])if(t in e&&"function"==typeof e[t])return!0;return!1}(e)?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=A),void 0===r.error&&(r.error=A),void 0===r.complete&&(r.complete=A);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}})),this.observers.push(r),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}}))}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function A(){}function R(e){return e&&e._delegate?e._delegate:e}class N{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const P="[DEFAULT]";class j{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new b;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:P})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e="[DEFAULT]"){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter((e=>"INTERNAL"in e)).map((e=>e.INTERNAL.delete())),...e.filter((e=>"_delete"in e)).map((e=>e._delete()))])}isComponentSet(){return null!=this.component}isInitialized(e="[DEFAULT]"){return this.instances.has(e)}getOptions(e="[DEFAULT]"){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);const o=this.instances.get(r);return o&&e(o,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===P?void 0:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e="[DEFAULT]"){return this.component?this.component.multipleInstances?e:P:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class x{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new j(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const L=[];var F;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(F||(F={}));const M={debug:F.DEBUG,verbose:F.VERBOSE,info:F.INFO,warn:F.WARN,error:F.ERROR,silent:F.SILENT},B=F.INFO,U={[F.DEBUG]:"log",[F.VERBOSE]:"log",[F.INFO]:"info",[F.WARN]:"warn",[F.ERROR]:"error"},W=(e,t,...n)=>{if(t(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Y(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(K||(K=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(Z(this),e),Q($.get(this))}:function(...e){return Q(t.apply(Z(this),e))}:function(e,...n){const r=t.call(Z(this),e,...n);return z.set(r,e.sort?e.sort():[e]),Q(r)}:(e instanceof IDBTransaction&&function(e){if(V.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)}));V.set(e,t)}(e),n=e,(q||(q=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>n instanceof e))?new Proxy(e,X):e);var t,n}function Q(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(Q(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)}));return t.then((t=>{t instanceof IDBCursor&&$.set(t,e)})).catch((()=>{})),J.set(t,e),t}(e);if(G.has(e))return G.get(e);const t=Y(e);return t!==e&&(G.set(e,t),J.set(t,e)),t}const Z=e=>J.get(e);function ee(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const a=indexedDB.open(e,t),s=Q(a);return r&&a.addEventListener("upgradeneeded",(e=>{r(Q(a.result),e.oldVersion,e.newVersion,Q(a.transaction),e)})),n&&a.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),s.then((e=>{o&&e.addEventListener("close",(()=>o())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),s}function te(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(e=>t(e.oldVersion,e))),Q(n).then((()=>{}))}const ne=["get","getKey","getAll","getAllKeys","count"],re=["put","add","delete","clear"],ie=new Map;function oe(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ie.get(t))return ie.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=re.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!ne.includes(n))return;const o=async function(e,...t){const o=this.transaction(e,i?"readwrite":"readonly");let a=o.store;return r&&(a=a.index(t.shift())),(await Promise.all([a[n](...t),i&&o.done]))[0]};return ie.set(t,o),o}var ae;ae=X,X={...ae,get:(e,t,n)=>oe(e,t)||ae.get(e,t,n),has:(e,t)=>!!oe(e,t)||ae.has(e,t)};class se{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const ce="@firebase/app",ue="0.10.1",de=new H("@firebase/app"),le="[DEFAULT]",pe={[ce]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},fe=new Map,he=new Map,ge=new Map;function me(e,t){try{e.container.addComponent(t)}catch(n){de.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function ve(e,t){e.container.addOrOverwriteComponent(t)}function we(e){const t=e.name;if(ge.has(t))return de.debug(`There were multiple attempts to register component ${t}.`),!1;ge.set(t,e);for(const t of fe.values())me(t,e);for(const t of he.values())me(t,e);return!0}function be(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function ye(e,t,n=le){be(e,t).clearInstance(n)}function Se(e){return void 0!==e.options}function _e(e){return void 0!==e.settings}function ke(){ge.clear()}const Ie=new k("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class Ee{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new N("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Ie.create("app-deleted",{appName:this._name})}}class Ce extends Ee{constructor(e,t,n,r){const i=void 0!==t.automaticDataCollectionEnabled&&t.automaticDataCollectionEnabled,o={name:n,automaticDataCollectionEnabled:i};void 0!==e.apiKey?super(e,o,r):super(e.options,o,r),this._serverConfig=Object.assign({automaticDataCollectionEnabled:i},t),this._finalizationRegistry=new FinalizationRegistry((()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,t.releaseOnDeref=void 0,Pe(ce,ue,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,void 0!==e&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){Ne(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw Ie.create("server-app-deleted")}}const Te="10.11.0";function De(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});const r=Object.assign({name:le,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw Ie.create("bad-app-name",{appName:String(i)});if(n||(n=w()),!n)throw Ie.create("no-options");const o=fe.get(i);if(o){if(C(n,o.options)&&C(r,o.config))return o;throw Ie.create("duplicate-app",{appName:i})}const a=new x(i);for(const e of ge.values())a.addComponent(e);const s=new Ee(n,r,a);return fe.set(i,s),s}function Oe(e,t){if(y())throw Ie.create("invalid-server-app-environment");let n;void 0===t.automaticDataCollectionEnabled&&(t.automaticDataCollectionEnabled=!1),n=Se(e)?e.options:e;const r=Object.assign(Object.assign({},t),n);if(void 0!==r.releaseOnDeref&&delete r.releaseOnDeref,void 0!==t.releaseOnDeref&&"undefined"==typeof FinalizationRegistry)throw Ie.create("finalization-registry-not-supported",{});const i=""+(o=JSON.stringify(r),[...o].reduce(((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0),0));var o;const a=he.get(i);if(a)return a.incRefCount(t.releaseOnDeref),a;const s=new x(i);for(const e of ge.values())s.addComponent(e);const c=new Ce(n,t,i,s);return he.set(i,c),c}function Ae(e=le){const t=fe.get(e);if(!t&&e===le&&w())return De();if(!t)throw Ie.create("no-app",{appName:e});return t}function Re(){return Array.from(fe.values())}async function Ne(e){let t=!1;const n=e.name;fe.has(n)?(t=!0,fe.delete(n)):he.has(n)&&e.decRefCount()<=0&&(he.delete(n),t=!0),t&&(await Promise.all(e.container.getProviders().map((e=>e.delete()))),e.isDeleted=!0)}function Pe(e,t,n){var r;let i=null!==(r=pe[e])&&void 0!==r?r:e;n&&(i+=`-${n}`);const o=i.match(/\s|\//),a=t.match(/\s|\//);if(o||a){const e=[`Unable to register library "${i}" with version "${t}":`];return o&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void de.warn(e.join(" "))}we(new N(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}function je(e,t){if(null!==e&&"function"!=typeof e)throw Ie.create("invalid-log-argument");!function(e,t){for(const n of L){let r=null;t&&t.level&&(r=M[t.level]),n.userLogHandler=null===e?null:(t,n,...i)=>{const o=i.map((e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}})).filter((e=>e)).join(" ");n>=(null!=r?r:t.logLevel)&&e({level:F[n].toLowerCase(),message:o,args:i,type:t.name})}}}(e,t)}function xe(e){var t;t=e,L.forEach((e=>{e.setLogLevel(t)}))}const Le="firebase-heartbeat-store";let Fe=null;function Me(){return Fe||(Fe=ee("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Le)}catch(e){console.warn(e)}}}).catch((e=>{throw Ie.create("idb-open",{originalErrorMessage:e.message})}))),Fe}async function Be(e,t){try{const n=(await Me()).transaction(Le,"readwrite"),r=n.objectStore(Le);await r.put(t,Ue(e)),await n.done}catch(e){if(e instanceof _)de.warn(e.message);else{const t=Ie.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});de.warn(t.message)}}}function Ue(e){return`${e.name}!${e.options.appId}`}class We{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new qe(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){var e,t;const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=He();if((null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))&&this._heartbeatsCache.lastSentHeartbeatDate!==r&&!this._heartbeatsCache.heartbeats.some((e=>e.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=He(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),Ke(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Ke(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=g(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function He(){return(new Date).toISOString().substring(0,10)}class qe{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!S()&&new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Me()).transaction(Le),n=await t.objectStore(Le).get(Ue(e));return await t.done,n}catch(e){if(e instanceof _)de.warn(e.message);else{const t=Ie.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});de.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Be(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Be(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function Ke(e){return g(JSON.stringify({version:2,heartbeats:e})).length}we(new N("platform-logger",(e=>new se(e)),"PRIVATE")),we(new N("heartbeat",(e=>new We(e)),"PRIVATE")),Pe(ce,ue,""),Pe(ce,ue,"esm2017"),Pe("fire-js","");class $e{constructor(e,t){this._delegate=e,this.firebase=t,me(e,new N("app-compat",(()=>this),"PUBLIC")),this.container=e.container}get automaticDataCollectionEnabled(){return this._delegate.automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}get name(){return this._delegate.name}get options(){return this._delegate.options}delete(){return new Promise((e=>{this._delegate.checkDestroyed(),e()})).then((()=>(this.firebase.INTERNAL.removeApp(this.name),Ne(this._delegate))))}_getService(e,t=le){var n;this._delegate.checkDestroyed();const r=this._delegate.container.getProvider(e);return r.isInitialized()||"EXPLICIT"!==(null===(n=r.getComponent())||void 0===n?void 0:n.instantiationMode)||r.initialize(),r.getImmediate({identifier:t})}_removeServiceInstance(e,t=le){this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){me(this._delegate,e)}_addOrOverwriteComponent(e){ve(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}const Ve=new k("app-compat","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."}),ze=function t(){const n=function(t){const n={},r={__esModule:!0,initializeApp:function(e,i={}){const o=De(e,i);if(E(n,o.name))return n[o.name];const a=new t(o,r);return n[o.name]=a,a},app:i,registerVersion:Pe,setLogLevel:xe,onLog:je,apps:null,SDK_VERSION:Te,INTERNAL:{registerComponent:function(e){const n=e.name,o=n.replace("-compat","");if(we(e)&&"PUBLIC"===e.type){const a=(e=i())=>{if("function"!=typeof e[o])throw Ve.create("invalid-app-argument",{appName:n});return e[o]()};void 0!==e.serviceProps&&m(a,e.serviceProps),r[o]=a,t.prototype[o]=function(...t){return this._getService.bind(this,n).apply(this,e.multipleInstances?t:[])}}return"PUBLIC"===e.type?r[o]:null},removeApp:function(e){delete n[e]},useAsService:function(e,t){return"serverAuth"===t?null:t},modularAPIs:e}};function i(e){if(!E(n,e=e||le))throw Ve.create("no-app",{appName:e});return n[e]}return r.default=r,Object.defineProperty(r,"apps",{get:function(){return Object.keys(n).map((e=>n[e]))}}),i.App=t,r}($e);return n.INTERNAL=Object.assign(Object.assign({},n.INTERNAL),{createFirebaseNamespace:t,extendNamespace:function(e){m(n,e)},createSubscribe:D,ErrorFactory:k,deepExtend:m}),n}(),Ge=new H("@firebase/app-compat");if(y()&&void 0!==self.firebase){Ge.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n ");const e=self.firebase.SDK_VERSION;e&&e.indexOf("LITE")>=0&&Ge.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ")}const Je=ze;Pe("@firebase/app-compat","0.2.31",void 0),Je.registerVersion("firebase","10.11.0","app-compat");const Xe="@firebase/installations",Ye="0.6.6",Qe="w:0.6.6",Ze=new k("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function et(e){return e instanceof _&&e.code.includes("request-failed")}function tt({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function nt(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function rt(e,t){const n=(await t.json()).error;return Ze.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function it({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}async function ot(e){const t=await e();return t.status>=500&&t.status<600?e():t}function at(e){return new Promise((t=>{setTimeout(t,e)}))}const st=/^[cdef][\w-]{21}$/;function ct(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return st.test(t)?t:""}catch(e){return""}}function ut(e){return`${e.appName}!${e.appId}`}const dt=new Map;function lt(e,t){const n=ut(e);pt(n,t),function(e,t){const n=(!ft&&"BroadcastChannel"in self&&(ft=new BroadcastChannel("[Firebase] FID Change"),ft.onmessage=e=>{pt(e.data.key,e.data.fid)}),ft);n&&n.postMessage({key:e,fid:t}),0===dt.size&&ft&&(ft.close(),ft=null)}(n,t)}function pt(e,t){const n=dt.get(e);if(n)for(const e of n)e(t)}let ft=null;const ht="firebase-installations-store";let gt=null;function mt(){return gt||(gt=ee("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(ht)}})),gt}async function vt(e,t){const n=ut(e),r=(await mt()).transaction(ht,"readwrite"),i=r.objectStore(ht),o=await i.get(n);return await i.put(t,n),await r.done,o&&o.fid===t.fid||lt(e,t.fid),t}async function wt(e){const t=ut(e),n=(await mt()).transaction(ht,"readwrite");await n.objectStore(ht).delete(t),await n.done}async function bt(e,t){const n=ut(e),r=(await mt()).transaction(ht,"readwrite"),i=r.objectStore(ht),o=await i.get(n),a=t(o);return void 0===a?await i.delete(n):await i.put(a,n),await r.done,!a||o&&o.fid===a.fid||lt(e,a.fid),a}async function yt(e){let t;const n=await bt(e.appConfig,(n=>{const r=function(e){return kt(e||{fid:ct(),registrationStatus:0})}(n),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine)return{installationEntry:t,registrationPromise:Promise.reject(Ze.create("app-offline"))};const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=tt(e),i=it(e),o=t.getImmediate({optional:!0});if(o){const e=await o.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const a={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:Qe},s={method:"POST",headers:i,body:JSON.stringify(a)},c=await ot((()=>fetch(r,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:nt(e.authToken)}}throw await rt("Create Installation",c)}(e,t);return vt(e.appConfig,n)}catch(n){throw et(n)&&409===n.customData.serverCode?await wt(e.appConfig):await vt(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:r}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:St(e)}:{installationEntry:t}}(e,r);return t=i.registrationPromise,i.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function St(e){let t=await _t(e.appConfig);for(;1===t.registrationStatus;)await at(100),t=await _t(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await yt(e);return n||t}return t}function _t(e){return bt(e,(e=>{if(!e)throw Ze.create("installation-not-found");return kt(e)}))}function kt(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4fetch(r,s)));if(c.ok)return nt(await c.json());throw await rt("Generate Auth Token",c)}async function Et(e,t=!1){let n;const r=await bt(e.appConfig,(r=>{if(!Tt(r))throw Ze.create("not-registered");const i=r.authToken;if(!t&&(2===(o=i).requestStatus&&!function(e){const t=Date.now();return t{if(!Tt(e))throw Ze.create("not-registered");return 1===(t=e.authToken).requestStatus&&t.requestTime+1e4{const t=e.getProvider("app").getImmediate(),n=function(e){if(!e||!e.options)throw Dt("App Configuration");if(!e.name)throw Dt("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw Dt(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:n,heartbeatServiceProvider:be(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),we(new N("installations-internal",(e=>{const t=be(e.getProvider("app").getImmediate(),Ot).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:r}=await yt(t);return r?r.catch(console.error):Et(t).catch(console.error),n.fid}(t),getToken:e=>async function(e,t=!1){const n=e;return await async function(e){const{registrationPromise:t}=await yt(e);t&&await t}(n),(await Et(n,t)).token}(t,e)}}),"PRIVATE")),Pe(Xe,Ye),Pe(Xe,Ye,"esm2017");const At="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";var Rt,Nt;function Pt(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function jt(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e{0===t&&e.createObjectStore(Ft)}})),Mt}async function Ut(e){const t=Ht(e),n=await Bt(),r=await n.transaction(Ft).objectStore(Ft).get(t);if(r)return r;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes(xt))return null}let t=null;return(await ee(xt,5,{upgrade:async(n,r,i,o)=>{var a;if(r<2)return;if(!n.objectStoreNames.contains(Lt))return;const s=o.objectStore(Lt),c=await s.index("fcmSenderId").get(e);if(await s.clear(),c)if(2===r){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:Pt(e.vapidKey)}}}else if(3===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:Pt(e.auth),p256dh:Pt(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:Pt(e.vapidKey)}}}else if(4===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:Pt(e.auth),p256dh:Pt(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:Pt(e.vapidKey)}}}}})).close(),await te(xt),await te("fcm_vapid_details_db"),await te("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await Wt(e,t),t}}async function Wt(e,t){const n=Ht(e),r=(await Bt()).transaction(Ft,"readwrite");return await r.objectStore(Ft).put(t,n),await r.done,t}function Ht({appConfig:e}){return e.appId}const qt=new k("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function Kt(e,t){const n={method:"DELETE",headers:await Vt(e)};try{const r=await fetch(`${$t(e.appConfig)}/${t}`,n),i=await r.json();if(i.error){const e=i.error.message;throw qt.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw qt.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function $t({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function Vt({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function zt({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const i={web:{endpoint:n,auth:t,p256dh:e}};return r!==At&&(i.web.applicationPubKey=r),i}async function Gt(e,t){const n=await async function(e,t){const n=await Vt(e),r=zt(t),i={method:"POST",headers:n,body:JSON.stringify(r)};let o;try{const t=await fetch($t(e.appConfig),i);o=await t.json()}catch(e){throw qt.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw qt.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw qt.create("token-subscribe-no-token");return o.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await Wt(e,r),r.token}function Jt(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const i=t.notification.image;i&&(e.notification.image=i);const o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,r,i,o,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const s=null!==(i=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==i?i:null===(o=t.notification)||void 0===o?void 0:o.click_action;s&&(e.fcmOptions.link=s);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}function Xt(e,t){const n=[];for(let r=0;r{}))}catch(e){throw qt.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}async function en(e,t){if(!navigator)throw qt.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw qt.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=At)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await Zt(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw qt.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),async function(e){const t=await async function(e,t){return await e.pushManager.getSubscription()||e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:jt(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:Pt(t.getKey("auth")),p256dh:Pt(t.getKey("p256dh"))},r=await Ut(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,i=t.auth===e.auth,o=t.p256dh===e.p256dh;return n&&r&&i&&o}(r.subscriptionOptions,n))return Date.now()>=r.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await Vt(e),r=zt(t.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)};let o;try{const n=await fetch(`${$t(e.appConfig)}/${t.token}`,i);o=await n.json()}catch(e){throw qt.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw qt.create("token-update-failed",{errorInfo:e})}if(!o.token)throw qt.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),r=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await Wt(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await Kt(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return Gt(e.firebaseDependencies,n)}return Gt(e.firebaseDependencies,n)}(e)}async function tn(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===Nt.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(Jt(n)):e.onMessageHandler.next(Jt(n)));const r=n.data;var i;"object"==typeof(i=r)&&i&&"google.c.a.c_id"in i&&"1"===r["google.c.a.e"]&&await async function(e,t,n){const r=function(e){switch(e){case Nt.NOTIFICATION_CLICKED:return"notification_open";case Nt.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n["google.c.a.c_id"],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}(e,n.messageType,r)}const nn="@firebase/messaging",rn="0.12.8";function on(e){return async function(e){if(!navigator)throw qt.create("only-available-in-window");return e.swRegistration||await Zt(e),async function(e){const t=await Ut(e.firebaseDependencies);t&&(await Kt(e.firebaseDependencies,t.token),await async function(e){const t=Ht(e),n=(await Bt()).transaction(Ft,"readwrite");await n.objectStore(Ft).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}(e)}(e=R(e))}we(new N("messaging",(e=>{const t=new Qt(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",(e=>tn(t,e))),t}),"PUBLIC")),we(new N("messaging-internal",(e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>en(t,e)}}),"PRIVATE")),Pe(nn,rn),Pe(nn,rn,"esm2017");const an="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";var sn,cn;function un(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function dn(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length);for(let e=0;e{0===t&&e.createObjectStore(fn)}})),hn}async function mn(e){const t=wn(e),n=await gn(),r=await n.transaction(fn).objectStore(fn).get(t);if(r)return r;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes(ln))return null}let t=null;return(await ee(ln,5,{upgrade:async(n,r,i,o)=>{var a;if(r<2)return;if(!n.objectStoreNames.contains(pn))return;const s=o.objectStore(pn),c=await s.index("fcmSenderId").get(e);if(await s.clear(),c)if(2===r){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(a=e.createTime)&&void 0!==a?a:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:un(e.vapidKey)}}}else if(3===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:un(e.auth),p256dh:un(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:un(e.vapidKey)}}}else if(4===r){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:un(e.auth),p256dh:un(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:un(e.vapidKey)}}}}})).close(),await te(ln),await te("fcm_vapid_details_db"),await te("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await vn(e,t),t}}async function vn(e,t){const n=wn(e),r=(await gn()).transaction(fn,"readwrite");return await r.objectStore(fn).put(t,n),await r.done,t}function wn({appConfig:e}){return e.appId}const bn=new k("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function yn(e,t){const n={method:"DELETE",headers:await _n(e)};try{const r=await fetch(`${Sn(e.appConfig)}/${t}`,n),i=await r.json();if(i.error){const e=i.error.message;throw bn.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw bn.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function Sn({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function _n({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function kn({p256dh:e,auth:t,endpoint:n,vapidKey:r}){const i={web:{endpoint:n,auth:t,p256dh:e}};return r!==an&&(i.web.applicationPubKey=r),i}async function In(e){const t=await mn(e.firebaseDependencies);t&&(await yn(e.firebaseDependencies,t.token),await async function(e){const t=wn(e),n=(await gn()).transaction(fn,"readwrite");await n.objectStore(fn).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function En(e,t){const n=await async function(e,t){const n=await _n(e),r=kn(t),i={method:"POST",headers:n,body:JSON.stringify(r)};let o;try{const t=await fetch(Sn(e.appConfig),i);o=await t.json()}catch(e){throw bn.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw bn.create("token-subscribe-failed",{errorInfo:e})}if(!o.token)throw bn.create("token-subscribe-no-token");return o.token}(e,t),r={token:n,createTime:Date.now(),subscriptionOptions:t};return await vn(e,r),r.token}function Cn(e,t){const n=[];for(let r=0;r"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")))}(r))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=cn.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(r,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:r}=Notification;return n&&r&&n.length>r&&console.warn(`This browser only supports ${r} actions. The remaining actions will not be displayed.`),self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={FCM_MSG:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const r=t.notification.body;r&&(e.notification.body=r);const i=t.notification.image;i&&(e.notification.image=i);const o=t.notification.icon;o&&(e.notification.icon=o)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,r,i,o,a;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const s=null!==(i=null===(r=t.fcmOptions)||void 0===r?void 0:r.link)&&void 0!==i?i:null===(o=t.notification)||void 0===o?void 0:o.click_action;s&&(e.fcmOptions.link=s);const c=null===(a=t.fcmOptions)||void 0===a?void 0:a.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}function Dn(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function On(e){return bn.create("missing-app-config-values",{valueName:e})}Cn("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),Cn("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class An{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const r=function(e){if(!e||!e.options)throw On("App Configuration Object");if(!e.name)throw On("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw On(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:r,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}we(new N("messaging-sw",(e=>{const t=new An(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",(e=>{e.waitUntil(Tn(e,t))})),self.addEventListener("pushsubscriptionchange",(e=>{e.waitUntil(async function(e,t){var n,r;const{newSubscription:i}=e;if(!i)return void await In(t);const o=await mn(t.firebaseDependencies);await In(t),t.vapidKey=null!==(r=null===(n=null==o?void 0:o.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==r?r:an,await async function(e){const t=await async function(e,t){return await e.pushManager.getSubscription()||e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:dn(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:un(t.getKey("auth")),p256dh:un(t.getKey("p256dh"))},r=await mn(e.firebaseDependencies);if(r){if(function(e,t){const n=t.vapidKey===e.vapidKey,r=t.endpoint===e.endpoint,i=t.auth===e.auth,o=t.p256dh===e.p256dh;return n&&r&&i&&o}(r.subscriptionOptions,n))return Date.now()>=r.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await _n(e),r=kn(t.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)};let o;try{const n=await fetch(`${Sn(e.appConfig)}/${t.token}`,i);o=await n.json()}catch(e){throw bn.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(o.error){const e=o.error.message;throw bn.create("token-update-failed",{errorInfo:e})}if(!o.token)throw bn.create("token-update-no-token");return o.token}(e.firebaseDependencies,t),r=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await vn(e.firebaseDependencies,r),n}catch(e){throw e}}(e,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await yn(e.firebaseDependencies,r.token)}catch(e){console.warn(e)}return En(e.firebaseDependencies,n)}return En(e.firebaseDependencies,n)}(t)}(e,t))})),self.addEventListener("notificationclick",(e=>{e.waitUntil(async function(e){var t,n;const r=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n.FCM_MSG;if(!r)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const i=function(e){var t,n,r;return(null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(r=e.notification)||void 0===r?void 0:r.click_action)||("object"==typeof(i=e.data)&&i&&"google.c.a.c_id"in i?self.location.origin:null);var i}(r);if(!i)return;const o=new URL(i,self.location.href),a=new URL(self.location.origin);if(o.host!==a.host)return;let s=await async function(e){const t=await Dn();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(o);return s?s=await s.focus():(s=await self.clients.openWindow(i),await new Promise((e=>{setTimeout(e,3e3)}))),s?(r.messageType=cn.NOTIFICATION_CLICKED,r.isFirebaseMessaging=!0,s.postMessage(r)):void 0}(e))})),t}),"PUBLIC"));class Rn{constructor(e,t){this.app=e,this._delegate=t,this.app=e,this._delegate=t}async getToken(e){return async function(e,t){return en(e=R(e),t)}(this._delegate,e)}async deleteToken(){return on(this._delegate)}onMessage(e){return function(e,t){return function(e,t){if(!navigator)throw qt.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=R(e),t)}(this._delegate,e)}onBackgroundMessage(e){return function(e,t){return function(e,t){if(void 0!==self.document)throw bn.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=R(e),t)}(this._delegate,e)}}const Nn={isSupported:function(){return self&&"ServiceWorkerGlobalScope"in self?S()&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):"undefined"!=typeof window&&S()&&!("undefined"==typeof navigator||!navigator.cookieEnabled)&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}};Je.INTERNAL.registerComponent(new N("messaging-compat",(e=>self&&"ServiceWorkerGlobalScope"in self?new Rn(e.getProvider("app-compat").getImmediate(),e.getProvider("messaging-sw").getImmediate()):new Rn(e.getProvider("app-compat").getImmediate(),e.getProvider("messaging").getImmediate())),"PUBLIC").setServiceProps(Nn)),Je.registerVersion("@firebase/messaging-compat","0.2.8");const Pn=["messaging/token-update-failed","Subscription failed - no active Service Worker","Failed to fetch","installations/app-offline"];function jn(e,t,n){var r;if(!("Notification"in window))return void t.sendFirebaseReaction(e,7);let i="visit_count",o=null==(r=null==window?void 0:window.Notification)?void 0:r.permission,a=n.getFromStorage(i);a=""===a?0:++a,n.setToStorage(i,a);let s="granted"===o;var c=Je.initializeApp({apiKey:"AIzaSyCn_7c5dyilasdCcdbkXhn_mx27Ng3ykp8",authDomain:"spdate-162314.firebaseapp.com",databaseURL:"https://spdate-162314.firebaseio.com",projectId:"spdate-162314",storageBucket:"spdate-162314.appspot.com",messagingSenderId:"1041850479028",appId:"1:1041850479028:web:77f7129afa6a3563b282e1"});"object"==typeof c&&c?0!==a||"denied"!==o?((0===a&&"denied"!==o||a>0&&"default"===o)&&t.sendFirebaseReaction(e,4),"denied"!==o?Notification.requestPermission().then((function(r){if("granted"===r&&"default"===o&&t.sendFirebaseReaction(e,1),"denied"!==r)return"default"===r?(t.sendFirebaseReaction(e,3),void function(){let e=new CustomEvent("closepromt");window.dispatchEvent(e)}()):void xn(c.messaging(),e,t,s,n);t.sendFirebaseReaction(e,2)})).catch(console.error):console.log("auto-blocked by user")):t.sendFirebaseReaction(e,5):console.log("Error load firebase")}function xn(e,t,n,r,i,o=!1){navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:`${window.location.origin}/firebase-cloud-messaging-push-scope`}).then((a=>{setTimeout((function(){e.getToken(e,{vapidKey:"BBnPulNRKwLXGwr6pbnHBa6Mh2Wzui1XhVGjjoDSJ7cfqbRIua2JqnXj03tYKPzE4sGUCvPjCMMVsA056S81GTc",serviceWorkerRegistration:a}).then((e=>{e?(t.token=e,t.is_granted=r,n.sendFirebaseToken(t)):n.sendFirebaseReaction(t,6,"empty_token")})).catch((a=>{n.sendFirebaseReaction(t,6,a.message),Pn.forEach((s=>{a.message.includes(s)&&!o&&xn(e,t,n,r,i,!0)})),console.log(a)}))}),10)}))}function Ln(e,t,n){let r=l;return r=jn,r(e,t,n)}class Fn{setCookie(e,t,n=700,r="/"){const i=new Date(Date.now()+864e5*n).toUTCString();document.cookie=e+"="+encodeURIComponent(t)+"; expires="+i+"; path="+r}getCookie(e){return document.cookie.split("; ").reduce(((t,n)=>{const r=n.split("=");return r[0]===e?decodeURIComponent(r[1]):t}),"")}deleteCookie(e,t){setCookie(e,"",-1,t)}}class Mn{setLocalStorage(e,t){window.localStorage.setItem(e,t)}getLocalStorage(e){let t=window.localStorage.getItem(e);return null===t?"":t}}class Bn{constructor(e,t){this.cookie=e,this.localStorage=t}setToStorage(e,t,n=700,r="/"){this.cookie.setCookie(e,t,n,r),this.localStorage.setLocalStorage(e,t)}getFromStorage(e){let t=this.cookie.getCookie(e);if(""!==t)return this.localStorage.setLocalStorage(e,t),t;let n=this.localStorage.getLocalStorage(e);return""!==n?(this.cookie.setCookie(e,n),n):""}}function Un(e){window.removeEventListener("click",Un),window.pwaEvent?(window.pwaEvent.prompt(),window.transport.sendPwaReaction(window.responseData,1),window.pwaEvent.userChoice.then((function(e){"accepted"!==e.outcome&&(window.transport.sendPwaReaction(window.responseData,4),window.transport.sendPwaStatus(window.responseData,6)),delete window.responseData,delete window.transport,delete window.storageService}))):window.transport.sendPwaReaction(window.responseData,2)}var Wn=(e,t,n)=>new Promise(((r,i)=>{var o=e=>{try{s(n.next(e))}catch(e){i(e)}},a=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(o,a);s((n=n.apply(e,t)).next())}));function Hn(e,t,n,r,i){let o=JSON.stringify(e.toJSON()),a=JSON.parse(o);t.is_first_subscription=r,t.endpoint=a.endpoint,t.p256dh=a.keys.p256dh,t.auth=a.keys.auth,t.is_granted=i,t.type="undefined"==typeof LandingPlatform?null:void 0!==LandingPlatform.type?LandingPlatform.type:null,n.sendWebPushToken(t)}function qn(e){const t=e.installing||e.waiting||e.active;return new Promise((n=>{if(!t)return void console.log("NO_SW_IN_REG");if("activated"===t.state)return void n(e);if("redundant"===t.state)return void console.log("SW_REG_REDUNDANT");const r=()=>{if("activated"!==t.state)return"redundant"===t.state?void console.log("SW_REG_REDUNDANT"):void 0;n(e),t.removeEventListener("statechange",r)};t.addEventListener("statechange",r)}))}var Kn,$n;class Vn{constructor(){((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,void 0)})(this,Kn)}process(e,t,n,r){if(1===e.provider_id&&(function(e,t){window.responseData=e,window.transport=t;var n=setInterval((function(){window.addEventListener("click",Un),clearInterval(n)}),100)}(e,t),n.setToStorage("subscription_id",e.subscription_id),n.setToStorage("campaign_id",e.campaign_id),n.setToStorage("product_id",t.productId),n.setToStorage("is_need_to_change_pwa_status",1)),2===e.provider_id){let t=e.data;t&&(new d).makeRedirect(t)}if(3===e.provider_id){if(void 0!==r.init_timer&&Number(r.init_timer)>0)return void setTimeout((function(){Ln(e,t,n)}),1e3*r.init_timer);if(void 0!==r.init_on_click&&Number(r.init_on_click))return void addEventListener("click",(function(){Ln(e,t,n)}),{once:!0});Ln(e,t,n),(i=this,o=Kn,a=$n,((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot access private method")})(i,o),a).call(this,e,t,n)}var i,o,a;4===e.provider_id&&function(e,t,n){!function(e,t,n){var r;let i="visit_count",o=null==(r=null==window?void 0:window.Notification)?void 0:r.permission,a=n.getFromStorage(i);a=""===a?0:++a,n.setToStorage(i,a);let s=function(e){return"granted"===e?1:0}(o);if("serviceWorker"in navigator&&"Notification"in window){if(0===a&&"denied"===o)return void t.sendWebPushReaction(e,5);if("denied"===o)return;(0===a&&"denied"!==o||a>0&&"default"===o)&&t.sendWebPushReaction(e,4),Notification.requestPermission().then((function(n){"granted"===n&&"default"===o&&t.sendWebPushReaction(e,1),"denied"!==n?"default"!==n?function(e){return Wn(this,arguments,(function*(e,t={}){return navigator.serviceWorker.register(e,t).catch((e=>{console.log(e)})).then((e=>qn(e).then((()=>(e.update(),e)))))}))}("/web-push-messaging-sw.js",{updateViaCache:"none",scope:`${window.location.origin}/web-push-messaging-scope`}).then((function(n){let r={userVisibleOnly:!0,applicationServerKey:"BCu5aErcrg9Z8gbdVBx3sMmzf4PVin_pjvBSKPCHGGaQF20gI396ibiQZaEgEK3neucBe8xNiz6lJjyAG1s66AU"};n.pushManager.getSubscription().then((i=>{if(i)return console.log("already subscribed"),void Hn(i,e,t,!1,s);n.pushManager.subscribe(r).then((function(n){Hn(n,e,t,!0,s)}),(function(n){t.sendWebPushReaction(e,6),console.log(n)}))}))})):t.sendWebPushReaction(e,3):t.sendWebPushReaction(e,2)}))}else t.sendWebPushReaction(e,7),console.log("serviceWorker not supported")}(e,t,n)}(e,t,n)}}Kn=new WeakSet,$n=function(e,t,n){window.addEventListener("closepromt",(function(r){let i=window.sessionStorage.getItem("reopen_popup");"2"!==i&&("1"!==i?(window.sessionStorage.setItem("reopen_popup","1"),Ln(e,t,n)):setTimeout((function(){window.sessionStorage.setItem("reopen_popup","2"),Ln(e,t,n)}),3e3))}))};class zn{constructor(e,t=null){this.receiverId=new c(e),this.productReceiverId=new u(e),this.reactionService=new Vn,this.transport=t,this.storageService=e}process(e,t){var n,r;this.receiverId.setUpReceiverIdToStorage(null!=(n=e.receiver_id)?n:null),this.productReceiverId.setUpProductReceiverIdToStorage(null!=(r=e.product_receiver_id)?r:null),this.reactionService.process(e,this.transport,this.storageService,t)}}class Gn{constructor(e){this.transport=new s,this.responseService=new zn(e,this.transport),this.productRequestRepeatTime=0,this.productRequestRepeats=0,this.campaignRequestRepeatTime=0,this.campaignRequestRepeats=0}register(e){this.transport.productId=e.product_id,!function(){let e=function(){const e=window.matchMedia("(display-mode: standalone)").matches;return document.referrer.startsWith("android-app://")?"pwa":navigator.standalone||e?"standalone":"browser"}();return-1!==location.search.indexOf("is_pwa=1")&&"browser"!==e}()||this.isMobileSafari()?this.registerUser(e):function(e){let t=new Fn,n=new Mn,r=new Bn(t,n),i=new s,o={product_id:e,subscription_id:r.getFromStorage("subscription_id"),product_receiver_id:r.getFromStorage("product_receiver_id")};i.sendPwaLaunch(o),function(){let e=new Fn,t=new Mn,n=new Bn(e,t),r=new s,i=n.getFromStorage("pwa_hash");void 0!==i&&0!==i.length&&(window.location.href=r.baseUrl+1+"/"+i)}()}(e.product_id)}registerUser(e){let t=this;t.sendRegisterRequest(e).then((n=>{n?t.registerRequestLoop(e,t.campaignRequestRepeatTime,t.campaignRequestRepeats):setTimeout((function(){t.registerUser(e)}),5e3)}))}sendRegisterRequest(e,t=!1){e.request_ms=Date.now().toString();let n=this;return n.transport.register(e).then((function(t){return n.transport.setToken(t.data.data.auth.access_token),n.productRequestRepeatTime=t.data.data.auth.reg_request_repeat_time,n.productRequestRepeats=t.data.data.auth.reg_request_repeats,n.responseService.process(t.data.data,e),n.campaignRequestRepeatTime=t.data.data.request_repeat_time,n.campaignRequestRepeats=t.data.data.request_repeats,!0})).catch((function(t){console.log(t),t.response&&t.response.data&&t.response.data.data&&n.responseService.process(t.response.data.data,e);let r=void 0!==t.response?t.response.status:0;return 401===r||400===r||422===r}))}registerRequestLoop(e,t,n){let r=this;if(0===t)return;let i=0,o=1e3*t,a=setTimeout((function s(){i>=n?clearTimeout(a):r.sendRegisterRequest(e,!0).then((c=>{c?(++i,a=setTimeout(s,o)):r.registerRequestLoopWhileSuccess(e,r.productRequestRepeatTime,r.productRequestRepeats).then((()=>{++i,r.registerRequestLoop(e,t,n-i)}))}))}),o)}registerRequestLoopWhileSuccess(e,t,n){let r=this;return new Promise((i=>{if(0===t)return void i();let o=0,a=1e3*t,s=setTimeout((function t(){if(o>=n)return clearTimeout(s),void i();r.sendRegisterRequest(e,!0).then((e=>{if(e)return clearTimeout(s),void i();++o,s=setTimeout(t,a)}))}),a)}))}sendFirebaseToken(e){this.transport.sendFirebaseToken(e)}sendFirebaseReaction(e,t,n){this.transport.sendFirebaseReaction(e,t,n)}sendPwaReaction(e,t){this.transport.sendPwaReaction(e,t)}sendWebPushReaction(e,t){this.transport.sendWebPushReaction(e,t)}sendWebPushToken(e){this.transport.sendWebPushToken(e)}isMobileSafari(){let e=window.navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),n=!!e.match(/WebKit/i);return t&&n&&!e.match(/CriOS/i)}}class Jn{constructor(e){e=e||{},this.seq=0,this.mid=(e.mid||1)%1023,this.offset=e.offset||0,this.lastTime=0}generate(){const e=Date.now(),t=(e-this.offset).toString(2);if(this.lastTime==e){if(this.seq++,this.seq>4095)for(this.seq=0;Date.now()<=e;);}else this.seq=0;this.lastTime=e;let n=this.seq.toString(2),r=this.mid.toString(2);for(;n.length<12;)n="0"+n;for(;r.length<10;)r="0"+r;const i=t+r+n;let o="";for(let e=i.length;e>0;e-=4)o=parseInt(i.substring(e-4,e),2).toString(16)+o;return parseInt(o,16)}}class Xn{constructor(e){this.storageService=e,this.userIdStorageName="user_id",this.isGeneratedStorageName="is_generated"}setUserId(e){let t=e.user_id;if(t)return e.user_id=e.user_id.toString(),e.is_generated=0,this.storageService.setToStorage(this.userIdStorageName,t),this.storageService.setToStorage(this.isGeneratedStorageName,e.is_generated),e;let n=this.storageService.getFromStorage(this.userIdStorageName),r=this.storageService.getFromStorage(this.isGeneratedStorageName);return n?(e.user_id=n,e.is_generated=parseInt(r),e):(e.user_id=this.generateSnowflake().toString(),e.is_generated=1,this.storageService.setToStorage(this.userIdStorageName,e.user_id),this.storageService.setToStorage(this.isGeneratedStorageName,e.is_generated),e)}generateSnowflake(){return(new Jn).generate().toString()}}class Yn{constructor(e){this.storageService=e,this.adIdStorageName="AD_ID"}setAdId(e){let t=this.storageService.getFromStorage(this.adIdStorageName);return e.ad_id=t||"",e}}class Qn{registerOrGetServiceWorker(e){return t=this,null,n=function*(){return navigator.serviceWorker.register(e,{updateViaCache:"none"}).catch((e=>{console.log(e)})).then((e=>this.waitForRegistrationToActivate(e).then((()=>(e.update(),e)))))},new Promise(((e,r)=>{var i=e=>{try{a(n.next(e))}catch(e){r(e)}},o=e=>{try{a(n.throw(e))}catch(e){r(e)}},a=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,o);a((n=n.apply(t,null)).next())}));var t,n}waitForRegistrationToActivate(e){const t=e.installing||e.waiting||e.active;return new Promise((n=>{if(!t)return void console.log("NO_SW_IN_REG");if("activated"===t.state)return void n(e);if("redundant"===t.state)return void console.log("SW_REG_REDUNDANT");const r=()=>{if("activated"!==t.state)return"redundant"===t.state?void console.log("SW_REG_REDUNDANT"):void 0;n(e),t.removeEventListener("statechange",r)};t.addEventListener("statechange",r)}))}sendServiceWorkerRequest(e,t,n){let r={event:e,data:t};this.registerOrGetServiceWorker(n).then((e=>{e.active.postMessage(r)}))}}var Zn,er;const tr={6:"string_attr_1=camp_id,string_attr_2=ban_id,string_attr_3=source_id,string_attr_4=cat_id,string_attr_5=key_id"};class nr{constructor(){((e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,void 0)})(this,Zn)}getUrlParams(e){let t=e.product_id;if(void 0===tr[t])return e;let n=(r=this,i=Zn,o=er,((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot access private method")})(r,i),o).call(this,tr[t]);var r,i,o;for(let t in n)e[t]=this.getUrlParamValue(n[t]);return e}getUrlParamValue(e){let t=window.location.href,n=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),r=new RegExp("[\\?&]"+n+"=([^&#]*)").exec(t);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))}}Zn=new WeakSet,er=function(e){let t={},n=e.split(",");for(let e=0;e{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,void 0)})(this,rr);let e=new Fn,t=new Mn,n=new Bn(e,t);var r,i,o;this.transportClient=new Gn(n),this.user=new Xn(n),this.adId=new Yn(n),this.receiverId=new c(n),this.serviceWorkerService=new Qn,(r=this,i=rr,o=ir,((e,t,n)=>{if(!t.has(e))throw TypeError("Cannot access private method")})(r,i),o).call(this),this.registrationParamsService=new nr}register(e){void 0!==e.use_pwa&&e.use_pwa&&(window.pwaEvent=null,"serviceWorker"in navigator&&(navigator.serviceWorker.register("/pwa-sw.js"),window.addEventListener("beforeinstallprompt",(function(e){e.preventDefault(),window.pwaEvent=e})),window.addEventListener("appinstalled",(function(e){let t=new Fn,n=new Mn,r=new Bn(t,n),i=new s,o=new c(r),a={product_id:r.getFromStorage("product_id"),subscription_id:r.getFromStorage("subscription_id"),product_receiver_id:r.getFromStorage("product_receiver_id"),campaign_id:r.getFromStorage("campaign_id")};a=o.setReceiverId(a),i.sendPwaReaction(a,3),i.sendPwaStatus(a,1),function(){let e=new Fn,t=new Mn,n=new Bn(e,t),r=new s,i=n.getFromStorage("user_id"),o=n.getFromStorage("product_id"),a={user_id:i,product_id:o};return r.sendPwaRecreate(a).then((function(e){void 0!==e&&(n.setToStorage("install_user_id",i),n.setToStorage("sub_id",e.data.data.sub_id),n.setToStorage("partner_event_id",e.data.data.partner_event_id))}))}().then((function(){!function(){let e=new Fn,t=new Mn,n=new Bn(e,t),r=new s,i={user_id:n.getFromStorage("user_id"),partner_event_id:n.getFromStorage("partner_event_id"),campaign_id:n.getFromStorage("campaign_id"),product_id:n.getFromStorage("product_id"),sub_id:n.getFromStorage("sub_id"),subscription_id:n.getFromStorage("subscription_id")};r.sendPwaCreateEvent(i).then((function(e){void 0!==e&&n.setToStorage("pwa_hash",e.data.data.pwa_hash)}))}()}))})))),e=this.registrationParamsService.getUrlParams(e),this.params=e,this.params=this.user.setUserId(this.params),this.params=this.adId.setAdId(this.params),this.params=this.receiverId.setReceiverId(this.params),this.params.referer=window.location.href,this.params.is_granted=this.isGranted(),this.transportClient.register(this.params)}isGranted(){return"Notification"in window?"granted"===Notification.permission?1:0:null}}}()}();