3 lines
66 KiB
JavaScript
3 lines
66 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function e(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var p=function(){return(p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function f(e,a,s,c){return new(s=s||Promise)(function(n,t){function r(e){try{o(c.next(e))}catch(e){t(e)}}function i(e){try{o(c.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,i)}o((c=c.apply(e,a||[])).next())})}function h(n,r){var i,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=r.call(n,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&r>=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function a(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||((r=r||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}var t,n=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t},i={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:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<e.length;i+=3){var o=e[i],a=i+1<e.length,s=a?e[i+1]:0,c=i+2<e.length,u=c?e[i+2]:0,l=(15&s)<<2|u>>6,u=63&u;c||(u=64,a||(l=64)),r.push(n[o>>2],n[(3&o)<<4|s>>4],n[l],n[u])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var i,o,a,s=e[n++];s<128?t[r++]=String.fromCharCode(s):191<s&&s<224?(o=e[n++],t[r++]=String.fromCharCode((31&s)<<6|63&o)):239<s&&s<365?(i=((7&s)<<18|(63&(o=e[n++]))<<12|(63&(a=e[n++]))<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))):(o=e[n++],a=e[n++],t[r++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<e.length;){var o=n[e.charAt(i++)],a=i<e.length?n[e.charAt(i)]:0,s=++i<e.length?n[e.charAt(i)]:64,c=++i<e.length?n[e.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==c)throw new u;r.push(o<<2|a>>4),64!==s&&(r.push(a<<4&240|s>>2),64!==c&&r.push(s<<6&192|c))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},u=(e(o,t=Error),o);function o(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="DecodeBase64StringError",e}var s=function(e){return t=n(e),i.encodeByteArray(t,!0).replace(/\./g,"");var t};function c(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(var n in t)t.hasOwnProperty(n)&&"__proto__"!==n&&(e[n]=c(e[n],t[n]));return e}function l(){return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__}function g(){if("undefined"!=typeof document){try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var e=e&&function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return e&&JSON.parse(e)}}var m=function(){try{return l()||function(){if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||g()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: ".concat(e))}},b=function(){var e;return null===(e=m())||void 0===e?void 0:e.config},y=(_.prototype.wrapCallback=function(n){var r=this;return function(e,t){e?r.reject(e):r.resolve(t),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(e):n(e,t))}},_);function _(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}function w(){try{return"object"==typeof indexedDB}catch(e){return}}function E(){return new Promise(function(e,t){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}var I,S=(e(C,I=Error),C);function C(e,t,n){var r=I.call(this,t)||this;return r.code=e,r.customData=n,r.name="FirebaseError",Object.setPrototypeOf(r,C.prototype),Error.captureStackTrace&&Error.captureStackTrace(r,T.prototype.create),r}var T=(A.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r,i=t[0]||{},o="".concat(this.service,"/").concat(e),a=this.errors[e],a=a?(r=i,a.replace(O,function(e,t){var n=r[t];return null!=n?String(n):"<".concat(t,"?>")})):"Error",a="".concat(this.serviceName,": ").concat(a," (").concat(o,").");return new S(o,a,i)},A);function A(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var O=/\{\$([^}]+)}/g;function D(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function N(e,t){if(e===t)return 1;for(var n=Object.keys(e),r=Object.keys(t),i=0,o=n;i<o.length;i++){var a=o[i];if(!r.includes(a))return;var s=e[a],c=t[a];if(P(s)&&P(c)){if(!N(s,c))return}else if(s!==c)return}for(var u=0,l=r;u<l.length;u++){a=l[u];if(!n.includes(a))return}return 1}function P(e){return null!==e&&"object"==typeof e}function k(e,t){var n=new M(e,t);return n.subscribe.bind(n)}var M=(L.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},L.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},L.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},L.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!=typeof e||null===e)return!1;for(var n=0,r=t;n<r.length;n++){var i=r[n];if(i in e&&"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=B),void 0===r.error&&(r.error=B),void 0===r.complete&&(r.complete=B);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(e){}}),this.observers.push(r),o},L.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},L.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},L.prototype.sendOne=function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},L.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},L);function L(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}function B(){}var R=(j.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},j.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},j.prototype.setServiceProps=function(e){return this.serviceProps=e,this},j.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},j);function j(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}var F="[DEFAULT]",x=(U.prototype.get=function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var n=new y;if(this.instancesDeferred.set(t,n),this.isInitialized(t)||this.shouldAutoInitialize())try{var r=this.getOrInitializeService({instanceIdentifier:t});r&&n.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise},U.prototype.getImmediate=function(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(n=null==e?void 0:e.optional)&&void 0!==n&&n;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(n)return null;throw Error("Service ".concat(this.name," is not available"))}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)return null;throw e}},U.prototype.getComponent=function(){return this.component},U.prototype.setComponent=function(e){var t,n;if(e.name!==this.name)throw Error("Mismatching Component ".concat(e.name," for Provider ").concat(this.name,"."));if(this.component)throw Error("Component for ".concat(this.name," has already been provided"));if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:F})}catch(e){}try{for(var r=d(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=v(i.value,2),a=o[0],s=o[1],c=this.normalizeInstanceIdentifier(a);try{var u=this.getOrInitializeService({instanceIdentifier:c});s.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}}},U.prototype.clearInstance=function(e){this.instancesDeferred.delete(e=void 0===e?F:e),this.instancesOptions.delete(e),this.instances.delete(e)},U.prototype.delete=function(){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(a(a([],v(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()})),!1),v(t.filter(function(e){return"_delete"in e}).map(function(e){return e._delete()})),!1))];case 1:return e.sent(),[2]}})})},U.prototype.isComponentSet=function(){return null!=this.component},U.prototype.isInitialized=function(e){return this.instances.has(e=void 0===e?F:e)},U.prototype.getOptions=function(e){return this.instancesOptions.get(e=void 0===e?F:e)||{}},U.prototype.initialize=function(e){var t,n,r=(e=void 0===e?{}:e).options,r=void 0===r?{}:r,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error("".concat(this.name,"(").concat(i,") has already been initialized"));if(!this.isComponentSet())throw Error("Component ".concat(this.name," has not been registered yet"));var o=this.getOrInitializeService({instanceIdentifier:i,options:r});try{for(var a=d(this.instancesDeferred.entries()),s=a.next();!s.done;s=a.next()){var c=v(s.value,2),u=c[0],l=c[1];i===this.normalizeInstanceIdentifier(u)&&l.resolve(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},U.prototype.onInit=function(e,t){var n=this.normalizeInstanceIdentifier(t),r=null!==(i=this.onInitCallbacks.get(n))&&void 0!==i?i:new Set;r.add(e),this.onInitCallbacks.set(n,r);var i=this.instances.get(n);return i&&e(i,n),function(){r.delete(e)}},U.prototype.invokeOnInitCallbacks=function(e,t){var n,r,i=this.onInitCallbacks.get(t);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next()){var s=a.value;try{s(e,t)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},U.prototype.getOrInitializeService=function(e){var t=e.instanceIdentifier,n=e.options,r=void 0===n?{}:n,n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(e=t)===F?void 0:e,options:r}),this.instances.set(t,n),this.instancesOptions.set(t,r),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(e){}return n||null},U.prototype.normalizeInstanceIdentifier=function(e){return void 0===e&&(e=F),!this.component||this.component.multipleInstances?e:F},U.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},U);function U(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}var V=(H.prototype.addComponent=function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component ".concat(e.name," has already been registered with ").concat(this.name));t.setComponent(e)},H.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},H.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new x(e,this);return this.providers.set(e,t),t},H.prototype.getProviders=function(){return Array.from(this.providers.values())},H);function H(e){this.name=e,this.providers=new Map}var z,q=[];(un=z=z||{})[un.DEBUG=0]="DEBUG",un[un.VERBOSE=1]="VERBOSE",un[un.INFO=2]="INFO",un[un.WARN=3]="WARN",un[un.ERROR=4]="ERROR",un[un.SILENT=5]="SILENT";function W(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(t<e.logLevel)){var i=(new Date).toISOString(),o=G[t];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: ".concat(t,")"));console[o].apply(console,a(["[".concat(i,"] ").concat(e.name,":")],n,!1))}}var $,K={debug:z.DEBUG,verbose:z.VERBOSE,info:z.INFO,warn:z.WARN,error:z.ERROR,silent:z.SILENT},J=z.INFO,G=((it={})[z.DEBUG]="log",it[z.VERBOSE]="log",it[z.INFO]="info",it[z.WARN]="warn",it[z.ERROR]="error",it),Y=(Object.defineProperty(X.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in z))throw new TypeError('Invalid value "'.concat(e,'" assigned to `logLevel`'));this._logLevel=e},enumerable:!1,configurable:!0}),X.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?K[e]:e},Object.defineProperty(X.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!1,configurable:!0}),Object.defineProperty(X.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),X.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,z.DEBUG],e,!1)),this._logHandler.apply(this,a([this,z.DEBUG],e,!1))},X.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,z.VERBOSE],e,!1)),this._logHandler.apply(this,a([this,z.VERBOSE],e,!1))},X.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,z.INFO],e,!1)),this._logHandler.apply(this,a([this,z.INFO],e,!1))},X.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,z.WARN],e,!1)),this._logHandler.apply(this,a([this,z.WARN],e,!1))},X.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,z.ERROR],e,!1)),this._logHandler.apply(this,a([this,z.ERROR],e,!1))},X);function X(e){this.name=e,this._logLevel=J,this._logHandler=W,this._userLogHandler=null,q.push(this)}function Z(a,t){for(var e=0,n=q;e<n.length;e++)!function(e){var o=null;t&&t.level&&(o=K[t.level]),e.userLogHandler=null===a?null:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.map(function(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(function(e){return e}).join(" ");t>=(null!=o?o:e.logLevel)&&a({level:z[t].toLowerCase(),message:i,args:n,type:e.name})}}(n[e])}const Q=(t,e)=>e.some(e=>t instanceof e);let ee,te;const ne=new WeakMap,re=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakMap;let se={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return re.get(e);if("objectStoreNames"===t)return e.objectStoreNames||ie.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return le(e[t])},set(e,t,n){return e[t]=n,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function ce(r){return r!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(te=te||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(r)?function(...e){return r.apply(fe(this),e),le(ne.get(this))}:function(...e){return le(r.apply(fe(this),e))}:function(e,...t){var n=r.call(fe(this),e,...t);return ie.set(n,e.sort?e.sort():[e]),le(n)}}function ue(e){return"function"==typeof e?ce(e):(e instanceof IDBTransaction&&(o=e,re.has(o)||(t=new Promise((e,t)=>{const n=()=>{o.removeEventListener("complete",r),o.removeEventListener("error",i),o.removeEventListener("abort",i)},r=()=>{e(),n()},i=()=>{t(o.error||new DOMException("AbortError","AbortError")),n()};o.addEventListener("complete",r),o.addEventListener("error",i),o.addEventListener("abort",i)}),re.set(o,t))),Q(e,ee=ee||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,se):e);var o,t}function le(e){if(e instanceof IDBRequest)return function(o){const e=new Promise((e,t)=>{const n=()=>{o.removeEventListener("success",r),o.removeEventListener("error",i)},r=()=>{e(le(o.result)),n()},i=()=>{t(o.error),n()};o.addEventListener("success",r),o.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&ne.set(e,o)}).catch(()=>{}),ae.set(e,o),e}(e);if(oe.has(e))return oe.get(e);var t=ue(e);return t!==e&&(oe.set(e,t),ae.set(t,e)),t}const fe=e=>ae.get(e);function pe(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const a=indexedDB.open(e,t),s=le(a);return r&&a.addEventListener("upgradeneeded",e=>{r(le(a.result),e.oldVersion,e.newVersion,le(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}const he=["get","getKey","getAll","getAllKeys","count"],de=["put","add","delete","clear"],ve=new Map;function ge(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(ve.get(t))return ve.get(t);const i=t.replace(/FromIndex$/,""),o=t!==i,a=de.includes(i);if(i in(o?IDBIndex:IDBObjectStore).prototype&&(a||he.includes(i))){var n=async function(e,...t){var n=this.transaction(e,a?"readwrite":"readonly");let r=n.store;return o&&(r=r.index(t.shift())),(await Promise.all([r[i](...t),a&&n.done]))[0]};return ve.set(t,n),n}}}se={...$=se,get:(e,t,n)=>ge(e,t)||$.get(e,t,n),has:(e,t)=>!!ge(e,t)||$.has(e,t)};var me=(be.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(e){if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return"".concat(t.library,"/").concat(t.version)}).filter(function(e){return e}).join(" ")},be);function be(e){this.container=e}var ye="@firebase/app",_e=new Y("@firebase/app"),we="[DEFAULT]",Ee=((De={})[ye]="fire-core",De["@firebase/app-compat"]="fire-core-compat",De["@firebase/analytics"]="fire-analytics",De["@firebase/analytics-compat"]="fire-analytics-compat",De["@firebase/app-check"]="fire-app-check",De["@firebase/app-check-compat"]="fire-app-check-compat",De["@firebase/auth"]="fire-auth",De["@firebase/auth-compat"]="fire-auth-compat",De["@firebase/database"]="fire-rtdb",De["@firebase/database-compat"]="fire-rtdb-compat",De["@firebase/functions"]="fire-fn",De["@firebase/functions-compat"]="fire-fn-compat",De["@firebase/installations"]="fire-iid",De["@firebase/installations-compat"]="fire-iid-compat",De["@firebase/messaging"]="fire-fcm",De["@firebase/messaging-compat"]="fire-fcm-compat",De["@firebase/performance"]="fire-perf",De["@firebase/performance-compat"]="fire-perf-compat",De["@firebase/remote-config"]="fire-rc",De["@firebase/remote-config-compat"]="fire-rc-compat",De["@firebase/storage"]="fire-gcs",De["@firebase/storage-compat"]="fire-gcs-compat",De["@firebase/firestore"]="fire-fst",De["@firebase/firestore-compat"]="fire-fst-compat",De["fire-js"]="fire-js",De.firebase="fire-js-all",De),Ie=new Map,Se=new Map;function Ce(t,n){try{t.container.addComponent(n)}catch(e){_e.debug("Component ".concat(n.name," failed to register with FirebaseApp ").concat(t.name),e)}}function Te(e,t){e.container.addOrOverwriteComponent(t)}function Ae(e){var t,n,r=e.name;if(Se.has(r))return _e.debug("There were multiple attempts to register component ".concat(r,".")),!1;Se.set(r,e);try{for(var i=d(Ie.values()),o=i.next();!o.done;o=i.next())Ce(o.value,e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return!0}function Oe(e,t){var n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}var De=((it={})["no-app"]="No Firebase App '{$appName}' has been created - call initializeApp() first",it["bad-app-name"]="Illegal App name: '{$appName}",it["duplicate-app"]="Firebase App named '{$appName}' already exists with different options or config",it["app-deleted"]="Firebase App named '{$appName}' already deleted",it["no-options"]="Need to provide options, when not being deployed to hosting via source.",it["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",it["invalid-log-argument"]="First argument to `onLog` must be null or a function.",it["idb-open"]="Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",it["idb-get"]="Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",it["idb-set"]="Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",it["idb-delete"]="Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",it),Ne=new T("app","Firebase",De),Pe=(Object.defineProperty(ke.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(ke.prototype,"name",{get:function(){return this.checkDestroyed(),this._name},enumerable:!1,configurable:!0}),Object.defineProperty(ke.prototype,"options",{get:function(){return this.checkDestroyed(),this._options},enumerable:!1,configurable:!0}),Object.defineProperty(ke.prototype,"config",{get:function(){return this.checkDestroyed(),this._config},enumerable:!1,configurable:!0}),Object.defineProperty(ke.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(ke.prototype,"isDeleted",{get:function(){return this._isDeleted},set:function(e){this._isDeleted=e},enumerable:!1,configurable:!0}),ke.prototype.checkDestroyed=function(){if(this.isDeleted)throw Ne.create("app-deleted",{appName:this._name})},ke);function ke(e,t,n){var r=this;this._isDeleted=!1,this._options=p({},e),this._config=p({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new R("app",function(){return r},"PUBLIC"))}var Me="10.8.0";function Le(e,t){var n,r,i=e,o=p({name:we,automaticDataCollectionEnabled:!1},t="object"!=typeof(t=void 0===t?{}:t)?{name:t}:t),a=o.name;if("string"!=typeof a||!a)throw Ne.create("bad-app-name",{appName:String(a)});if(!(i=i||b()))throw Ne.create("no-options");var s=Ie.get(a);if(s){if(N(i,s.options)&&N(o,s.config))return s;throw Ne.create("duplicate-app",{appName:a})}var c=new V(a);try{for(var u=d(Se.values()),l=u.next();!l.done;l=u.next()){var f=l.value;c.addComponent(f)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}o=new Pe(i,o,c);return Ie.set(a,o),o}function Be(n){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return(t=n.name,Ie.has(t))?(Ie.delete(t),[4,Promise.all(n.container.getProviders().map(function(e){return e.delete()}))]):[3,2];case 1:e.sent(),n.isDeleted=!0,e.label=2;case 2:return[2]}})})}function Re(e,t,n){var r=null!==(a=Ee[e])&&void 0!==a?a:e;n&&(r+="-".concat(n));var i=r.match(/\s|\//),o=t.match(/\s|\//);if(i||o){var a=['Unable to register library "'.concat(r,'" with version "').concat(t,'":')];return i&&a.push('library name "'.concat(r,'" contains illegal characters (whitespace or "/")')),i&&o&&a.push("and"),o&&a.push('version name "'.concat(t,'" contains illegal characters (whitespace or "/")')),void _e.warn(a.join(" "))}Ae(new R("".concat(r,"-version"),function(){return{library:r,version:t}},"VERSION"))}function je(e,t){if(null!==e&&"function"!=typeof e)throw Ne.create("invalid-log-argument");Z(e,t)}function Fe(e){var t;t=e,q.forEach(function(e){e.setLogLevel(t)})}var xe="firebase-heartbeat-database",Ue=1,Ve="firebase-heartbeat-store",He=null;function ze(){return He=He||pe(xe,Ue,{upgrade:function(e,t){if(0===t)try{e.createObjectStore(Ve)}catch(e){console.warn(e)}}}).catch(function(e){throw Ne.create("idb-open",{originalErrorMessage:e.message})})}function qe(r,i){return f(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),[4,ze()];case 1:return n=e.sent(),t=n.transaction(Ve,"readwrite"),[4,t.objectStore(Ve).put(i,We(r))];case 2:return e.sent(),[4,t.done];case 3:return e.sent(),[3,5];case 4:return(n=e.sent())instanceof S?_e.warn(n.message):(n=Ne.create("idb-set",{originalErrorMessage:null==n?void 0:n.message}),_e.warn(n.message)),[3,5];case 5:return[2]}})})}function We(e){return"".concat(e.name,"!").concat(e.options.appId)}var $e=(Ke.prototype.triggerHeartbeat=function(){var i;return f(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return(t=this.container.getProvider("platform-logger").getImmediate(),t=t.getPlatformInfoString(),n=Je(),null!=(null===(i=this._heartbeatsCache)||void 0===i?void 0:i.heartbeats))?[3,2]:[4,(r=this)._heartbeatsCachePromise];case 1:if(r._heartbeatsCache=e.sent(),null==(null===(i=this._heartbeatsCache)||void 0===i?void 0:i.heartbeats))return[2];e.label=2;case 2:return this._heartbeatsCache.lastSentHeartbeatDate===n||this._heartbeatsCache.heartbeats.some(function(e){return e.date===n})?[2]:(this._heartbeatsCache.heartbeats.push({date:n,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),[2,this._storage.overwrite(this._heartbeatsCache)])}})})},Ke.prototype.getHeartbeatsHeader=function(){var i;return f(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return null!==this._heartbeatsCache?[3,2]:[4,this._heartbeatsCachePromise];case 1:e.sent(),e.label=2;case 2:return null==(null===(i=this._heartbeatsCache)||void 0===i?void 0:i.heartbeats)||0===this._heartbeatsCache.heartbeats.length?[2,""]:(t=Je(),n=function(e,n){var t,r;void 0===n&&(n=1024);var i=[],o=e.slice();try{for(var a=d(e),s=a.next();!s.done;s=a.next())if("break"===function(t){var e=i.find(function(e){return e.agent===t.agent});if(e){if(e.dates.push(t.date),Ze(i)>n)return e.dates.pop(),"break"}else if(i.push({agent:t.agent,dates:[t.date]}),Ze(i)>n)return i.pop(),"break";o=o.slice(1)}(s.value))break}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return{heartbeatsToSend:i,unsentEntries:o}}(this._heartbeatsCache.heartbeats),r=n.heartbeatsToSend,n=n.unsentEntries,r=s(JSON.stringify({version:2,heartbeats:r})),this._heartbeatsCache.lastSentHeartbeatDate=t,0<n.length?(this._heartbeatsCache.heartbeats=n,[4,this._storage.overwrite(this._heartbeatsCache)]):[3,4]);case 3:return e.sent(),[3,5];case 4:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache),e.label=5;case 5:return[2,r]}})})},Ke);function Ke(e){var t=this;this.container=e,this._heartbeatsCache=null;var n=this.container.getProvider("app").getImmediate();this._storage=new Ye(n),this._heartbeatsCachePromise=this._storage.read().then(function(e){return t._heartbeatsCache=e})}function Je(){return(new Date).toISOString().substring(0,10)}var Ge,Ye=(Xe.prototype.runIndexedDBEnvironmentCheck=function(){return f(this,void 0,void 0,function(){return h(this,function(e){return w()?[2,E().then(function(){return!0}).catch(function(){return!1})]:[2,!1]})})},Xe.prototype.read=function(){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2,{heartbeats:[]}];case 2:return[4,function(i){return f(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,4,,5]),[4,ze()];case 1:return r=e.sent(),[4,(t=r.transaction(Ve)).objectStore(Ve).get(We(i))];case 2:return n=e.sent(),[4,t.done];case 3:return e.sent(),[2,n];case 4:return(r=e.sent())instanceof S?_e.warn(r.message):(r=Ne.create("idb-get",{originalErrorMessage:null==r?void 0:r.message}),_e.warn(r.message)),[3,5];case 5:return[2]}})})}(this.app)];case 3:return null!=(t=e.sent())&&t.heartbeats?[2,t]:[2,{heartbeats:[]}];case 4:return[2]}})})},Xe.prototype.overwrite=function(n){var r;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,qe(this.app,{lastSentHeartbeatDate:null!==(r=n.lastSentHeartbeatDate)&&void 0!==r?r:t.lastSentHeartbeatDate,heartbeats:n.heartbeats})]}})})},Xe.prototype.add=function(n){var r;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,qe(this.app,{lastSentHeartbeatDate:null!==(r=n.lastSentHeartbeatDate)&&void 0!==r?r:t.lastSentHeartbeatDate,heartbeats:a(a([],v(t.heartbeats),!1),v(n.heartbeats),!1)})]}})})},Xe);function Xe(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}function Ze(e){return s(JSON.stringify({version:2,heartbeats:e})).length}Ge="",Ae(new R("platform-logger",function(e){return new me(e)},"PRIVATE")),Ae(new R("heartbeat",function(e){return new $e(e)},"PRIVATE")),Re(ye,"0.9.27",Ge),Re(ye,"0.9.27","esm5"),Re("fire-js","");var Qe=Object.freeze({__proto__:null,SDK_VERSION:Me,_DEFAULT_ENTRY_NAME:we,_addComponent:Ce,_addOrOverwriteComponent:Te,_apps:Ie,_clearComponents:function(){Se.clear()},_components:Se,_getProvider:Oe,_registerComponent:Ae,_removeServiceInstance:function(e,t,n){void 0===n&&(n=we),Oe(e,t).clearInstance(n)},deleteApp:Be,getApp:function(e){var t=Ie.get(e=void 0===e?we:e);if(!t&&e===we&&b())return Le();if(!t)throw Ne.create("no-app",{appName:e});return t},getApps:function(){return Array.from(Ie.values())},initializeApp:Le,onLog:je,registerVersion:Re,setLogLevel:Fe,FirebaseError:S}),et=(Object.defineProperty(tt.prototype,"automaticDataCollectionEnabled",{get:function(){return this._delegate.automaticDataCollectionEnabled},set:function(e){this._delegate.automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(tt.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(tt.prototype,"options",{get:function(){return this._delegate.options},enumerable:!1,configurable:!0}),tt.prototype.delete=function(){var t=this;return new Promise(function(e){t._delegate.checkDestroyed(),e()}).then(function(){return t.firebase.INTERNAL.removeApp(t.name),Be(t._delegate)})},tt.prototype._getService=function(e,t){var n;void 0===t&&(t=we),this._delegate.checkDestroyed();var 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})},tt.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=we),this._delegate.container.getProvider(e).clearInstance(t)},tt.prototype._addComponent=function(e){Ce(this._delegate,e)},tt.prototype._addOrOverwriteComponent=function(e){Te(this._delegate,e)},tt.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},tt);function tt(e,t){var n=this;this._delegate=e,this.firebase=t,Ce(e,new R("app-compat",function(){return n},"PUBLIC")),this.container=e.container}var De=((it={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",it["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",it),nt=new T("app-compat","Firebase",De);function rt(i){var o={},a={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});var n=Le(e,t);if(D(o,n.name))return o[n.name];var r=new i(n,a);return o[n.name]=r},app:s,registerVersion:Re,setLogLevel:Fe,onLog:je,apps:null,SDK_VERSION:Me,INTERNAL:{registerComponent:function(n){var r=n.name,t=r.replace("-compat","");{var e;Ae(n)&&"PUBLIC"===n.type&&(e=function(e){if("function"!=typeof(e=void 0===e?s():e)[t])throw nt.create("invalid-app-argument",{appName:r});return e[t]()},void 0!==n.serviceProps&&c(e,n.serviceProps),a[t]=e,i.prototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,r).apply(this,n.multipleInstances?e:[])})}return"PUBLIC"===n.type?a[t]:null},removeApp:function(e){delete o[e]},useAsService:function(e,t){return"serverAuth"!==t?t:null},modularAPIs:Qe}};function s(e){if(!D(o,e=e||we))throw nt.create("no-app",{appName:e});return o[e]}return a.default=a,Object.defineProperty(a,"apps",{get:function(){return Object.keys(o).map(function(e){return o[e]})}}),s.App=i,a}var it=function e(){var t=rt(et);return t.INTERNAL=p(p({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:k,ErrorFactory:T,deepExtend:c}),t}(),De=new Y("@firebase/app-compat");"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(De.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(at=self.firebase.SDK_VERSION)&&0<=at.indexOf("LITE")&&De.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 "));var ot=it;Re("@firebase/app-compat","0.2.27",void 0);ot.registerVersion("firebase","10.8.0","app-compat");var at="@firebase/installations",De="0.6.5",st=1e4,ct="w:".concat(De),ut="FIS_v2",lt="https://firebaseinstallations.googleapis.com/v1",ft=36e5,it=((it={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',it["not-registered"]="Firebase Installation is not registered.",it["installation-not-found"]="Firebase Installation not found.",it["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',it["app-offline"]="Could not process request. Application offline.",it["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",it),pt=new T("installations","Installations",it);function ht(e){return e instanceof S&&e.code.includes("request-failed")}function dt(e){var t=e.projectId;return"".concat(lt,"/projects/").concat(t,"/installations")}function vt(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}function gt(n,r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,r.json()];case 1:return t=e.sent(),t=t.error,[2,pt.create("request-failed",{requestName:n,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function mt(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function bt(e,t){var n=t.refreshToken,r=mt(e);return r.append("Authorization",(e=n,"".concat(ut," ").concat(e))),r}function yt(n){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,n()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,n()]:[2,t]}})})}function _t(t){return new Promise(function(e){setTimeout(e,t)})}var wt=/^[cdef][\w-]{21}$/,Et="";function It(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return btoa(String.fromCharCode.apply(String,a([],v(e),!1))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22);return wt.test(t)?t:Et}catch(e){return Et}}function St(e){return"".concat(e.appName,"!").concat(e.appId)}var Ct=new Map;function Tt(e,t){var n=St(e);At(n,t),function(e,t){var n=function(){!Ot&&"BroadcastChannel"in self&&((Ot=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){At(e.data.key,e.data.fid)});return Ot}();n&&n.postMessage({key:e,fid:t});0===Ct.size&&Ot&&(Ot.close(),Ot=null)}(n,t)}function At(e,t){var n,r,i=Ct.get(e);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next())(0,a.value)(t)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var Ot=null;var Dt="firebase-installations-store",Nt=null;function Pt(){return Nt=Nt||pe("firebase-installations-database",1,{upgrade:function(e,t){0===t&&e.createObjectStore(Dt)}})}function kt(o,a){return f(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(e){switch(e.label){case 0:return t=St(o),[4,Pt()];case 1:return r=e.sent(),n=r.transaction(Dt,"readwrite"),[4,(r=n.objectStore(Dt)).get(t)];case 2:return i=e.sent(),[4,r.put(a,t)];case 3:return e.sent(),[4,n.done];case 4:return e.sent(),i&&i.fid===a.fid||Tt(o,a.fid),[2,a]}})})}function Mt(r){return f(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return t=St(r),[4,Pt()];case 1:return n=e.sent(),[4,(n=n.transaction(Dt,"readwrite")).objectStore(Dt).delete(t)];case 2:return e.sent(),[4,n.done];case 3:return e.sent(),[2]}})})}function Lt(a,s){return f(this,void 0,void 0,function(){var t,n,r,i,o;return h(this,function(e){switch(e.label){case 0:return t=St(a),[4,Pt()];case 1:return r=e.sent(),n=r.transaction(Dt,"readwrite"),[4,(r=n.objectStore(Dt)).get(t)];case 2:return i=e.sent(),void 0!==(o=s(i))?[3,4]:[4,r.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,r.put(o,t)];case 5:e.sent(),e.label=6;case 6:return[4,n.done];case 7:return e.sent(),!o||i&&i.fid===o.fid||Tt(a,o.fid),[2,o]}})})}function Bt(i){return f(this,void 0,void 0,function(){var n,t,r;return h(this,function(e){switch(e.label){case 0:return[4,Lt(i.appConfig,function(e){var t=jt(e||{fid:It(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return f(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return[4,Rt(i.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,_t(100)];case 3:return e.sent(),[4,Rt(i.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,Bt(i)];case 6:return r=e.sent(),n=r.installationEntry,(r=r.registrationPromise)?[2,r]:[2,n];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(pt.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=function(r,i){return f(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(e,t){var s=e.appConfig,c=e.heartbeatServiceProvider,u=t.fid;return f(this,void 0,void 0,function(){var t,n,r,i,o,a;return h(this,function(e){switch(e.label){case 0:return t=dt(s),n=mt(s),(r=c.getImmediate({optional:!0}))?[4,r.getHeartbeatsHeader()]:[3,2];case 1:(r=e.sent())&&n.append("x-firebase-client",r),e.label=2;case 2:return a={fid:u,authVersion:ut,appId:s.appId,sdkVersion:ct},i={method:"POST",headers:n,body:JSON.stringify(a)},[4,yt(function(){return fetch(t,i)})];case 3:return(o=e.sent()).ok?[4,o.json()]:[3,5];case 4:return a=e.sent(),[2,{fid:a.fid||u,registrationStatus:2,refreshToken:a.refreshToken,authToken:vt(a.authToken)}];case 5:return[4,gt("Create Installation",o)];case 6:throw e.sent()}})})}(r,i)];case 1:return t=e.sent(),[2,kt(r.appConfig,t)];case 2:return ht(n=e.sent())&&409===n.customData.serverCode?[4,Mt(r.appConfig)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,kt(r.appConfig,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw n;case 7:return[2]}})})}(e,r);return{installationEntry:r,registrationPromise:n}}}(i,t);return n=t.registrationPromise,t.installationEntry})];case 1:return(t=e.sent()).fid!==Et?[3,3]:(r={},[4,n]);case 2:return[2,(r.installationEntry=e.sent(),r)];case 3:return[2,{installationEntry:t,registrationPromise:n}]}})})}function Rt(e){return Lt(e,function(e){if(!e)throw pt.create("installation-not-found");return jt(e)})}function jt(e){return 1===(t=e).registrationStatus&&t.registrationTime+st<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}function Ft(e,c){var u=e.appConfig,l=e.heartbeatServiceProvider;return f(this,void 0,void 0,function(){var n,r,i,o,a,s;return h(this,function(e){switch(e.label){case 0:return t=c.fid,n="".concat(dt(u),"/").concat(t,"/authTokens:generate"),r=bt(u,c),(i=l.getImmediate({optional:!0}))?[4,i.getHeartbeatsHeader()]:[3,2];case 1:(i=e.sent())&&r.append("x-firebase-client",i),e.label=2;case 2:return s={installation:{sdkVersion:ct,appId:u.appId}},o={method:"POST",headers:r,body:JSON.stringify(s)},[4,yt(function(){return fetch(n,o)})];case 3:return(a=e.sent()).ok?[4,a.json()]:[3,5];case 4:return s=e.sent(),[2,vt(s)];case 5:return[4,gt("Generate Auth Token",a)];case 6:throw e.sent()}var t})})}function xt(i,o){return void 0===o&&(o=!1),f(this,void 0,void 0,function(){var r,t,n;return h(this,function(e){switch(e.label){case 0:return[4,Lt(i.appConfig,function(e){if(!Vt(e))throw pt.create("not-registered");var t,n=e.authToken;if(o||2!==(t=n).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+ft}(t)){if(1===n.requestStatus)return r=function(r,i){return f(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return[4,Ut(r.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,_t(100)];case 3:return e.sent(),[4,Ut(r.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0===(n=t.authToken).requestStatus?[2,xt(r,i)]:[2,n]}})})}(i,o),e;if(!navigator.onLine)throw pt.create("app-offline");n=(t=e,n={requestStatus:1,requestTime:Date.now()},p(p({},t),{authToken:n}));return r=function(i,o){return f(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,Ft(i,o)];case 1:return t=e.sent(),r=p(p({},o),{authToken:t}),[4,kt(i.appConfig,r)];case 2:return e.sent(),[2,t];case 3:return!ht(n=e.sent())||401!==n.customData.serverCode&&404!==n.customData.serverCode?[3,5]:[4,Mt(i.appConfig)];case 4:return e.sent(),[3,7];case 5:return r=p(p({},o),{authToken:{requestStatus:0}}),[4,kt(i.appConfig,r)];case 6:e.sent(),e.label=7;case 7:throw n;case 8:return[2]}})})}(i,n),n}return e})];case 1:return t=e.sent(),r?[4,r]:[3,3];case 2:return n=e.sent(),[3,4];case 3:n=t.authToken,e.label=4;case 4:return[2,n]}})})}function Ut(e){return Lt(e,function(e){if(!Vt(e))throw pt.create("not-registered");var t,n=e.authToken;return 1===(t=n).requestStatus&&t.requestTime+st<Date.now()?p(p({},e),{authToken:{requestStatus:0}}):e})}function Vt(e){return void 0!==e&&2===e.registrationStatus}function Ht(n,r){return void 0===r&&(r=!1),f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,function(n){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,Bt(n)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t=n)];case 1:return e.sent(),[4,xt(t,r)];case 2:return[2,e.sent().token]}})})}function zt(e){return pt.create("missing-app-config-values",{valueName:e})}function qt(e){var t=Oe(e.getProvider("app").getImmediate(),Wt).getImmediate();return{getId:function(){return function(i){return f(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return[4,Bt(t=i)];case 1:return n=e.sent(),r=n.installationEntry,(n.registrationPromise||xt(t)).catch(console.error),[2,r.fid]}})})}(t)},getToken:function(e){return Ht(t,e)}}}var Wt="installations";Ae(new R(Wt,function(e){var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){var t,n;if(!e||!e.options)throw zt("App Configuration");if(!e.name)throw zt("App Name");try{for(var r=d(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!e.options[o])throw zt(o)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:Oe(t,"heartbeat"),_delete:function(){return Promise.resolve()}}},"PUBLIC")),Ae(new R("installations-internal",qt,"PRIVATE")),Re(at,De),Re(at,De,"esm5");var $t,Kt,Jt="@firebase/performance",Gt="0.6.5",Yt=Gt,Xt="FB-PERF-TRACE-MEASURE",Zt="@firebase/performance/config",Qt="@firebase/performance/configexpire",at="Performance",De=((De={})["trace started"]="Trace {$traceName} was started before.",De["trace stopped"]="Trace {$traceName} is not running.",De["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",De["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",De["no window"]="Window is not available.",De["no app id"]="App id is not available.",De["no project id"]="Project id is not available.",De["no api key"]="Api key is not available.",De["invalid cc log"]="Attempted to queue invalid cc event",De["FB not default"]="Performance can only start when Firebase app instance is the default one.",De["RC response not ok"]="RC response is not ok",De["invalid attribute name"]="Attribute name {$attributeName} is invalid.",De["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",De["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",De["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",De["already initialized"]="initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance.",De),en=new T("performance",at,De),tn=new Y(at);tn.logLevel=z.INFO;var nn,rn,on=(an.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},an.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},an.prototype.measure=function(e,t,n){this.performance&&this.performance.measure&&this.performance.measure(e,t,n)},an.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},an.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},an.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},an.prototype.requiredApisAvailable=function(){return fetch&&Promise&&"undefined"!=typeof navigator&&navigator.cookieEnabled?!!w()||(tn.info("IndexedDB is not supported by current browser"),!1):(tn.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},an.prototype.setupObserver=function(e,i){this.PerformanceObserver&&new this.PerformanceObserver(function(e){for(var t=0,n=e.getEntries();t<n.length;t++){var r=n[t];i(r)}}).observe({entryTypes:[e]})},an.getInstance=function(){return $t=void 0===$t?new an(Kt):$t},an);function an(e){if(!(this.window=e))throw en.create("no window");this.performance=e.performance,this.PerformanceObserver=e.PerformanceObserver,this.windowLocation=e.location,this.navigator=e.navigator,this.document=e.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=e.localStorage),e.perfMetrics&&e.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=e.perfMetrics.onFirstInputDelay)}function sn(e,t){var n=e.length-t.length;if(n<0||1<n)throw en.create("invalid String merger input");for(var r=[],i=0;i<e.length;i++)r.push(e.charAt(i)),t.length>i&&r.push(t.charAt(i));return r.join("")}var cn,un,ln=(fn.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},fn.getInstance=function(){return rn=void 0===rn?new fn:rn},fn);function fn(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=sn("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=sn("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(un=cn=cn||{})[un.UNKNOWN=0]="UNKNOWN",un[un.VISIBLE=1]="VISIBLE",un[un.HIDDEN=2]="HIDDEN";var pn=["firebase_","google_","ga_"],hn=new RegExp("^[a-zA-Z]\\w*$");function dn(){switch(on.getInstance().document.visibilityState){case"visible":return cn.VISIBLE;case"hidden":return cn.HIDDEN;default:return cn.UNKNOWN}}function vn(e){var t=null===(t=e.options)||void 0===t?void 0:t.appId;if(!t)throw en.create("no app id");return t}var gn="0.0.1",mn={loggingEnabled:!0},bn="FIREBASE_INSTALLATIONS_AUTH";function yn(e,t){var r,i,n=function(){var e=on.getInstance().localStorage;if(e){var t=e.getItem(Qt);if(t&&function(e){return Number(e)>Date.now()}(t)){e=e.getItem(Zt);if(e)try{return JSON.parse(e)}catch(e){return}}}}();return n?(wn(n),Promise.resolve()):(i=t,function(e){var t=e.getToken();return t.then(function(e){}),t}((r=e).installations).then(function(e){var t=function(e){var t=null===(t=e.options)||void 0===t?void 0:t.projectId;if(!t)throw en.create("no project id");return t}(r.app),n=function(e){var t=null===(t=e.options)||void 0===t?void 0:t.apiKey;if(!t)throw en.create("no api key");return t}(r.app),n="https://firebaseremoteconfig.googleapis.com/v1/projects/".concat(t,"/namespaces/fireperf:fetch?key=").concat(n),n=new Request(n,{method:"POST",headers:{Authorization:"".concat(bn," ").concat(e)},body:JSON.stringify({app_instance_id:i,app_instance_id_token:e,app_id:vn(r.app),app_version:Yt,sdk_version:gn})});return fetch(n).then(function(e){if(e.ok)return e.json();throw en.create("RC response not ok")})}).catch(function(){tn.info(_n)}).then(wn).then(function(e){var t;e=e,t=on.getInstance().localStorage,e&&t&&(t.setItem(Zt,JSON.stringify(e)),t.setItem(Qt,String(Date.now()+60*ln.getInstance().configTimeToLive*60*1e3)))},function(){}))}var _n="Could not fetch config, will use default configs";function wn(e){if(!e)return e;var t=ln.getInstance(),n=e.entries||{};return void 0!==n.fpr_enabled?t.loggingEnabled="true"===String(n.fpr_enabled):t.loggingEnabled=mn.loggingEnabled,n.fpr_log_source?t.logSource=Number(n.fpr_log_source):mn.logSource&&(t.logSource=mn.logSource),n.fpr_log_endpoint_url?t.logEndPointUrl=n.fpr_log_endpoint_url:mn.logEndPointUrl&&(t.logEndPointUrl=mn.logEndPointUrl),n.fpr_log_transport_key?t.transportKey=n.fpr_log_transport_key:mn.transportKey&&(t.transportKey=mn.transportKey),void 0!==n.fpr_vc_network_request_sampling_rate?t.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate):void 0!==mn.networkRequestsSamplingRate&&(t.networkRequestsSamplingRate=mn.networkRequestsSamplingRate),void 0!==n.fpr_vc_trace_sampling_rate?t.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate):void 0!==mn.tracesSamplingRate&&(t.tracesSamplingRate=mn.tracesSamplingRate),t.logTraceAfterSampling=En(t.tracesSamplingRate),t.logNetworkAfterSampling=En(t.networkRequestsSamplingRate),e}function En(e){return Math.random()<=e}var In,Sn=1;function Cn(e){var n;return Sn=2,In=In||(n=e,function(){var n=on.getInstance().document;return new Promise(function(e){var t;n&&"complete"!==n.readyState?(t=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",t),e())},n.addEventListener("readystatechange",t)):e()})}().then(function(){return e=n.installations,(t=e.getId()).then(function(e){nn=e}),t;var e,t}).then(function(e){return yn(n,e)}).then(Tn,Tn))}function Tn(){Sn=3}var An,On=1e4,Dn=3,Nn=1e3,Pn=Dn,kn=[],Mn=!1;function Ln(e){setTimeout(function(){var e,t;if(0!==Pn)return kn.length?(e=kn.splice(0,Nn),t=e.map(function(e){return{source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)}}),void function(e,r){return function(e){var t=ln.getInstance().getFlTransportFullUrl();return fetch(t,{method:"POST",body:JSON.stringify(e)})}(e).then(function(e){return e.ok||tn.info("Call to Firebase backend failed."),e.json()}).then(function(e){var t=Number(e.nextRequestWaitMillis),n=On;isNaN(t)||(n=Math.max(t,n));t=e.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(kn=a(a([],r,!0),kn,!0),tn.info("Retry transport request later.")),Pn=Dn,Ln(n)})}({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:ln.getInstance().logSource,log_event:t},e).catch(function(){kn=a(a([],e,!0),kn,!0),Pn--,tn.info("Tries left: ".concat(Pn,".")),Ln(On)})):Ln(On)},e)}function Bn(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!function(e){if(!e.eventTime||!e.message)throw en.create("invalid cc log");kn=a(a([],kn,!0),[e],!1)}({message:n.apply(void 0,e),eventTime:Date.now()})}}function Rn(e,t){(An=An||Bn(xn))(e,t)}function jn(e){var t=ln.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&on.getInstance().requiredApisAvailable()&&(e.isAuto&&dn()!==cn.VISIBLE||(3===Sn?Fn(e):Cn(e.performanceController).then(function(){return Fn(e)},function(){return Fn(e)})))}function Fn(e){var t;!nn||(t=ln.getInstance()).loggingEnabled&&t.logTraceAfterSampling&&setTimeout(function(){return Rn(e,1)},0)}function xn(e,t){return 0===t?(n={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},n={application_info:Un(e.performanceController.app),network_request_metric:n},JSON.stringify(n)):function(e){var t={name:e.name,is_auto:e.isAuto,client_start_time_us:e.startTimeUs,duration_us:e.durationUs};0!==Object.keys(e.counters).length&&(t.counters=e.counters);var n=e.getAttributes();0!==Object.keys(n).length&&(t.custom_attributes=n);t={application_info:Un(e.performanceController.app),trace_metric:t};return JSON.stringify(t)}(e);var n}function Un(e){return{google_app_id:vn(e),app_instance_id:nn,web_app_info:{sdk_version:Yt,page_url:on.getInstance().getUrl(),service_worker_status:null!=(t=on.getInstance().navigator)&&t.serviceWorker?t.serviceWorker.controller?2:3:1,visibility_state:dn(),effective_connection_type:function(){var e=on.getInstance().navigator.connection;switch(e&&e.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}()},application_process_state:0};var t}var Vn=["_fp","_fcp","_fid"];var Hn=(zn.prototype.start=function(){if(1!==this.state)throw en.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},zn.prototype.stop=function(){if(2!==this.state)throw en.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),jn(this)},zn.prototype.record=function(e,t,n){if(e<=0)throw en.create("nonpositive trace startTime",{traceName:this.name});if(t<=0)throw en.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),n&&n.attributes&&(this.customAttributes=p({},n.attributes)),n&&n.metrics)for(var r=0,i=Object.keys(n.metrics);r<i.length;r++){var o=i[r];isNaN(Number(n.metrics[o]))||(this.counters[o]=Math.floor(Number(n.metrics[o])))}jn(this)},zn.prototype.incrementMetric=function(e,t){void 0===t&&(t=1),void 0===this.counters[e]?this.putMetric(e,t):this.putMetric(e,this.counters[e]+t)},zn.prototype.putMetric=function(e,t){if(r=e,i=this.name,0===r.length||100<r.length||!(i&&i.startsWith("_wt_")&&-1<Vn.indexOf(r))&&r.startsWith("_"))throw en.create("invalid custom metric name",{customMetricName:e});var n,r,i;this.counters[e]=(t=null!=t?t:0,(n=Math.floor(t))<t&&tn.info("Metric value should be an Integer, setting the value as : ".concat(n,".")),n)},zn.prototype.getMetric=function(e){return this.counters[e]||0},zn.prototype.putAttribute=function(e,t){var n,r,i=!(0===(n=e).length||40<n.length)&&(!pn.some(function(e){return n.startsWith(e)})&&!!n.match(hn)),o=0!==(r=t).length&&r.length<=100;if(i&&o)this.customAttributes[e]=t;else{if(!i)throw en.create("invalid attribute name",{attributeName:e});if(!o)throw en.create("invalid attribute value",{attributeValue:t})}},zn.prototype.getAttribute=function(e){return this.customAttributes[e]},zn.prototype.removeAttribute=function(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]},zn.prototype.getAttributes=function(){return p({},this.customAttributes)},zn.prototype.setStartTime=function(e){this.startTimeUs=e},zn.prototype.setDuration=function(e){this.durationUs=e},zn.prototype.calculateTraceMetrics=function(){var e=this.api.getEntriesByName(this.traceMeasure),e=e&&e[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},zn.createOobTrace=function(e,t,n,r){var i,o=on.getInstance().getUrl();o&&(i=new zn(e,"_wt_"+o,!0),o=Math.floor(1e3*on.getInstance().getTimeOrigin()),i.setStartTime(o),t&&t[0]&&(i.setDuration(Math.floor(1e3*t[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),n&&((o=n.find(function(e){return"first-paint"===e.name}))&&o.startTime&&i.putMetric("_fp",Math.floor(1e3*o.startTime)),(o=n.find(function(e){return"first-contentful-paint"===e.name}))&&o.startTime&&i.putMetric("_fcp",Math.floor(1e3*o.startTime)),r&&i.putMetric("_fid",Math.floor(1e3*r))),jn(i))},zn.createUserTimingTrace=function(e,t){jn(new zn(e,t,!1,t))},zn);function zn(e,t,n,r){void 0===n&&(n=!1),this.performanceController=e,this.name=t,this.isAuto=n,this.state=1,this.customAttributes={},this.counters={},this.api=on.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark="".concat("FB-PERF-TRACE-START","-").concat(this.randomId,"-").concat(this.name),this.traceStopMark="".concat("FB-PERF-TRACE-STOP","-").concat(this.randomId,"-").concat(this.name),this.traceMeasure=r||"".concat(Xt,"-").concat(this.randomId,"-").concat(this.name),r&&this.calculateTraceMetrics())}function qn(e,t){var n,r,i,o,a=t;a&&void 0!==a.responseStart&&(i=on.getInstance().getTimeOrigin(),o=Math.floor(1e3*(a.startTime+i)),r=a.responseStart?Math.floor(1e3*(a.responseStart-a.startTime)):void 0,i=Math.floor(1e3*(a.responseEnd-a.startTime)),a={performanceController:e,url:a.name&&a.name.split("?")[0],responsePayloadBytes:a.transferSize,startTimeUs:o,timeToResponseInitiatedUs:r,timeToResponseCompletedUs:i},n=a,(o=ln.getInstance()).instrumentationEnabled&&(r=n.url,i=o.logEndPointUrl.split("?")[0],a=o.flTransportEndpointUrl.split("?")[0],r!==i&&r!==a&&o.loggingEnabled&&o.logNetworkAfterSampling&&setTimeout(function(){return Rn(n,0)},0)))}var Wn=5e3;function $n(e){nn&&(setTimeout(function(){return function(t){var e=on.getInstance(),n=e.getEntriesByType("navigation"),r=e.getEntriesByType("paint");{var i;e.onFirstInputDelay?(i=setTimeout(function(){Hn.createOobTrace(t,n,r),i=void 0},Wn),e.onFirstInputDelay(function(e){i&&(clearTimeout(i),Hn.createOobTrace(t,n,r,e))})):Hn.createOobTrace(t,n,r)}}(e)},0),setTimeout(function(){return function(t){for(var e=on.getInstance(),n=e.getEntriesByType("resource"),r=0,i=n;r<i.length;r++){var o=i[r];qn(t,o)}e.setupObserver("resource",function(e){return qn(t,e)})}(e)},0),setTimeout(function(){return function(t){for(var e=on.getInstance(),n=e.getEntriesByType("measure"),r=0,i=n;r<i.length;r++){var o=i[r];Kn(t,o)}e.setupObserver("measure",function(e){return Kn(t,e)})}(e)},0))}function Kn(e,t){var n=t.name;n.substring(0,Xt.length)!==Xt&&Hn.createUserTimingTrace(e,n)}var Jn=(Gn.prototype._init=function(e){var t=this;this.initialized||(void 0!==(null==e?void 0:e.dataCollectionEnabled)&&(this.dataCollectionEnabled=e.dataCollectionEnabled),void 0!==(null==e?void 0:e.instrumentationEnabled)&&(this.instrumentationEnabled=e.instrumentationEnabled),on.getInstance().requiredApisAvailable()?E().then(function(e){e&&(Mn||(Ln(5500),Mn=!0),Cn(t).then(function(){return $n(t)},function(){return $n(t)}),t.initialized=!0)}).catch(function(e){tn.info("Environment doesn't support IndexedDB: ".concat(e))}):tn.info('Firebase Performance cannot start if the browser does not support "Fetch" and "Promise", or cookies are disabled.'))},Object.defineProperty(Gn.prototype,"instrumentationEnabled",{get:function(){return ln.getInstance().instrumentationEnabled},set:function(e){ln.getInstance().instrumentationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Gn.prototype,"dataCollectionEnabled",{get:function(){return ln.getInstance().dataCollectionEnabled},set:function(e){ln.getInstance().dataCollectionEnabled=e},enumerable:!1,configurable:!0}),Gn);function Gn(e,t){this.app=e,this.installations=t,this.initialized=!1}var Yn="[DEFAULT]";Ae(new R("performance",function(e,t){var n=t.options,r=e.getProvider("app").getImmediate(),i=e.getProvider("installations-internal").getImmediate();if(r.name!==Yn)throw en.create("FB not default");if("undefined"==typeof window)throw en.create("no window");Kt=window;i=new Jn(r,i);return i._init(n),i},"PUBLIC")),Re(Jt,Gt),Re(Jt,Gt,"esm5");var Xn=(Object.defineProperty(Zn.prototype,"instrumentationEnabled",{get:function(){return this._delegate.instrumentationEnabled},set:function(e){this._delegate.instrumentationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Zn.prototype,"dataCollectionEnabled",{get:function(){return this._delegate.dataCollectionEnabled},set:function(e){this._delegate.dataCollectionEnabled=e},enumerable:!1,configurable:!0}),Zn.prototype.trace=function(e){return t=this._delegate,t=(n=t)&&n._delegate?n._delegate:n,new Hn(t,e);var t,n},Zn);function Zn(e,t){this.app=e,this._delegate=t}var Qn;function er(e){var t=e.getProvider("app-compat").getImmediate(),n=e.getProvider("performance").getImmediate();return new Xn(t,n)}(Qn=ot).INTERNAL.registerComponent(new R("performance-compat",er,"PUBLIC")),Qn.registerVersion("@firebase/performance-compat","0.2.5");return ot.registerVersion("firebase","10.8.0","compat-lite"),ot});
|
|
//# sourceMappingURL=firebase-performance-standalone-compat.js.map
|