firebase
Version:
Firebase JavaScript library for web and Node.js
7 lines • 779 kB
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";const t={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},f=function(e,t){if(!e)throw u(t)},u=function(e){return new Error("Firebase Database ("+t.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},n=function(t){const n=[];let r=0;for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);e<128?n[r++]=e:(e<2048?n[r++]=e>>6|192:(55296==(64512&e)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++i)),n[r++]=e>>18|240,n[r++]=e>>12&63|128):n[r++]=e>>12|224,n[r++]=e>>6&63|128),n[r++]=63&e|128)}return n},r={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(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();var r=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const i=[];for(let u=0;u<n.length;u+=3){var s=n[u],a=u+1<n.length,o=a?n[u+1]:0,c=u+2<n.length,l=c?n[u+2]:0;let e=(15&o)<<2|l>>6,t=63&l;c||(t=64,a||(e=64)),i.push(r[s>>2],r[(3&s)<<4|o>>4],r[e],r[t])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){var i,s,a=e[n++];a<128?t[r++]=String.fromCharCode(a):191<a&&a<224?(i=e[n++],t[r++]=String.fromCharCode((31&a)<<6|63&i)):239<a&&a<365?(s=((7&a)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))):(i=e[n++],s=e[n++],t[r++]=String.fromCharCode((15&a)<<12|(63&i)<<6|63&s))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var n=t?this.charToByteMapWebSafe_:this.charToByteMap_;const r=[];for(let c=0;c<e.length;){var i=n[e.charAt(c++)],s=c<e.length?n[e.charAt(c)]:0;++c;var a=c<e.length?n[e.charAt(c)]:64;++c;var o=c<e.length?n[e.charAt(c)]:64;if(++c,null==i||null==s||null==a||null==o)throw new l;r.push(i<<2|s>>4),64!==a&&(r.push(s<<4&240|a>>2),64!==o&&r.push(a<<6&192|o))}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let 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,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class l extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}function i(e){var t=n(e);return r.encodeByteArray(t,!0)}const s=function(e){return i(e).replace(/\./g,"")},a=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:const n=t;return new Date(n.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(const r in t)t.hasOwnProperty(r)&&"__proto__"!==r&&(e[r]=c(e[r],t[r]));return e}function o(){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.")}const e=()=>o().__FIREBASE_DEFAULTS__,h=()=>{if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}},d=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&a(e[1]);return t&&JSON.parse(t)}},p=()=>{try{return e()||h()||d()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},g=()=>{var e;return null===(e=p())||void 0===e?void 0:e.config};var m,v,_;class y{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(n){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof n&&(this.promise.catch(()=>{}),1===n.length?n(e):n(e,t))}}}function w(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[s(JSON.stringify({alg:"none",type:"JWT"})),s(JSON.stringify(i)),""].join(".")}function b(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function I(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(b())}function T(){var e=null===(e=p())||void 0===e?void 0:e.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function E(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function C(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function S(){const e=b();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function k(){return!0===t.NODE_ADMIN}function A(){try{return"object"==typeof indexedDB}catch(e){return!1}}function N(){return new Promise((t,n)=>{try{let e=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),e||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{e=!1},i.onerror=()=>{var e;n((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){n(e)}})}function R(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class P extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,P.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,D.prototype.create)}}class D{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var r,n=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],s=s?(r=n,s.replace(x,(e,t)=>{var n=r[t];return null!=n?String(n):`<${t}?>`})):"Error",s=`${this.serviceName}: ${s} (${i}).`;return new P(i,s,n)}}const x=/\{\$([^}]+)}/g;function O(e){return JSON.parse(e)}function M(e){return JSON.stringify(e)}function L(e){let t={},n={},r={},i="";try{var s=e.split(".");t=O(a(s[0])||""),n=O(a(s[1])||""),i=s[2],r=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:i}}function F(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function U(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function V(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function q(e,t,n){const r={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r}function B(e,t){if(e===t)return 1;const n=Object.keys(e),r=Object.keys(t);for(const a of n){if(!r.includes(a))return;var i=e[a],s=t[a];if(j(i)&&j(s)){if(!B(i,s))return}else if(i!==s)return}for(const o of r)if(!n.includes(o))return;return 1}function j(e){return null!==e&&"object"==typeof e}function z(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function $(e){const r={},t=e.replace(/^\?/,"").split("&");return t.forEach(e=>{var t,n;e&&([t,n]=e.split("="),r[decodeURIComponent(t)]=decodeURIComponent(n))}),r}function K(e){var t=e.indexOf("?");if(!t)return"";var n=e.indexOf("#",t);return e.substring(t,0<n?n:void 0)}class W{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(n,r){r=r||0;const i=this.W_;if("string"==typeof n)for(let e=0;e<16;e++)i[e]=n.charCodeAt(r)<<24|n.charCodeAt(r+1)<<16|n.charCodeAt(r+2)<<8|n.charCodeAt(r+3),r+=4;else for(let t=0;t<16;t++)i[t]=n[r]<<24|n[r+1]<<16|n[r+2]<<8|n[r+3],r+=4;for(let d=16;d<80;d++){var e=i[d-3]^i[d-8]^i[d-14]^i[d-16];i[d]=4294967295&(e<<1|e>>>31)}let t=this.chain_[0],s=this.chain_[1],a=this.chain_[2],o=this.chain_[3],c=this.chain_[4],l,u;for(let p=0;p<80;p++){u=p<40?p<20?(l=o^s&(a^o),1518500249):(l=s^a^o,1859775393):p<60?(l=s&a|o&(s|a),2400959708):(l=s^a^o,3395469782);var h=(t<<5|t>>>27)+l+c+u+i[p]&4294967295;c=o,o=a,a=4294967295&(s<<30|s>>>2),s=t,t=h}this.chain_[0]=this.chain_[0]+t&4294967295,this.chain_[1]=this.chain_[1]+s&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+o&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295}update(n,r){if(null!=n){var i=(r=void 0===r?n.length:r)-this.blockSize;let e=0;const s=this.buf_;let t=this.inbuf_;for(;e<r;){if(0===t)for(;e<=i;)this.compress_(n,e),e+=this.blockSize;if("string"==typeof n){for(;e<r;)if(s[t]=n.charCodeAt(e),++t,++e,t===this.blockSize){this.compress_(s),t=0;break}}else for(;e<r;)if(s[t]=n[e],++t,++e,t===this.blockSize){this.compress_(s),t=0;break}}this.inbuf_=t,this.total_+=r}}digest(){const t=[];let e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let r=this.blockSize-1;56<=r;r--)this.buf_[r]=255&e,e/=256;this.compress_(this.buf_);let n=0;for(let i=0;i<5;i++)for(let e=24;0<=e;e-=8)t[n]=this.chain_[i]>>e&255,++n;return t}}function G(e,t){const n=new H(e,t);return n.subscribe.bind(n)}class H{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(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}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 n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=Q),void 0===r.error&&(r.error=Q),void 0===r.complete&&(r.complete=Q);var 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,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(e,t){this.task.then(()=>{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 Q(){}function Y(e,t,n,r){let i;if(r<t?i="at least "+t:n<r&&(i=0===n?"none":"no more than "+n),i){var s=e+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".";throw new Error(s)}}function J(e,t){return`${e} failed: ${t} argument `}function X(e,t,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(J(e,t)+"must be a valid function.")}function Z(e,t,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(J(e,t)+"must be a valid context object.")}function ee(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0,n="x"===e?t:3&t|8;return n.toString(16)})}const te=function(e){let t=0;for(let r=0;r<e.length;r++){var n=e.charCodeAt(r);n<128?t++:n<2048?t+=2:55296<=n&&n<=56319?(t+=4,r++):t+=3}return t},ne=1e3,re=2,ie=144e5,se=.5;function ae(e,t=ne,n=re){var r=t*Math.pow(n,e),i=Math.round(se*r*(Math.random()-.5)*2);return Math.min(ie,r+i)}function oe(e){return e&&e._delegate?e._delegate:e}class ce{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 le="[DEFAULT]";class ue{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){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const r=new y;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{var n=this.getOrInitializeService({instanceIdentifier:t});n&&r.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(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 ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(n)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("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:le})}catch(e){}for(var[t,n]of this.instancesDeferred.entries()){t=this.normalizeInstanceIdentifier(t);try{var r=this.getOrInitializeService({instanceIdentifier:t});n.resolve(r)}catch(e){}}}}clearInstance(e=le){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=le){return this.instances.has(e)}getOptions(e=le){return this.instancesOptions.get(e)||{}}initialize(e={}){var{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`);var r,i,s=this.getOrInitializeService({instanceIdentifier:n,options:t});for([r,i]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(r)&&i.resolve(s);return s}onInit(e,t){var n=this.normalizeInstanceIdentifier(t);const 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),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){var 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)===le?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=le){return!this.component||this.component.multipleInstances?e:le}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class he{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){const t=this.getProvider(e.name);t.isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);var t=new ue(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const de=[];(v=m=m||{})[v.DEBUG=0]="DEBUG",v[v.VERBOSE=1]="VERBOSE",v[v.INFO=2]="INFO",v[v.WARN=3]="WARN",v[v.ERROR=4]="ERROR",v[v.SILENT=5]="SILENT";const pe={debug:m.DEBUG,verbose:m.VERBOSE,info:m.INFO,warn:m.WARN,error:m.ERROR,silent:m.SILENT},fe=m.INFO,ge={[m.DEBUG]:"log",[m.VERBOSE]:"log",[m.INFO]:"info",[m.WARN]:"warn",[m.ERROR]:"error"},me=(e,t,...n)=>{if(!(t<e.logLevel)){var r=(new Date).toISOString(),i=ge[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}] ${e.name}:`,...n)}};class ve{constructor(e){this.name=e,this._logLevel=fe,this._logHandler=me,this._userLogHandler=null,de.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in m))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?pe[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,m.DEBUG,...e),this._logHandler(this,m.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,m.VERBOSE,...e),this._logHandler(this,m.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,m.INFO,...e),this._logHandler(this,m.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,m.WARN,...e),this._logHandler(this,m.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,m.ERROR,...e),this._logHandler(this,m.ERROR,...e)}}const _e=(t,e)=>e.some(e=>t instanceof e);let ye,we;const be=new WeakMap,Ie=new WeakMap,Te=new WeakMap,Ee=new WeakMap,Ce=new WeakMap;let Se={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return Ie.get(e);if("objectStoreNames"===t)return e.objectStoreNames||Te.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Ne(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 ke(r){return r!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(we=we||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(r)?function(...e){return r.apply(Re(this),e),Ne(be.get(this))}:function(...e){return Ne(r.apply(Re(this),e))}:function(e,...t){var n=r.call(Re(this),e,...t);return Te.set(n,e.sort?e.sort():[e]),Ne(n)}}function Ae(e){return"function"==typeof e?ke(e):(e instanceof IDBTransaction&&(s=e,Ie.has(s)||(t=new Promise((e,t)=>{const n=()=>{s.removeEventListener("complete",r),s.removeEventListener("error",i),s.removeEventListener("abort",i)},r=()=>{e(),n()},i=()=>{t(s.error||new DOMException("AbortError","AbortError")),n()};s.addEventListener("complete",r),s.addEventListener("error",i),s.addEventListener("abort",i)}),Ie.set(s,t))),_e(e,ye=ye||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,Se):e);var s,t}function Ne(e){if(e instanceof IDBRequest)return function(s){const e=new Promise((e,t)=>{const n=()=>{s.removeEventListener("success",r),s.removeEventListener("error",i)},r=()=>{e(Ne(s.result)),n()},i=()=>{t(s.error),n()};s.addEventListener("success",r),s.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&be.set(e,s)}).catch(()=>{}),Ce.set(e,s),e}(e);if(Ee.has(e))return Ee.get(e);var t=Ae(e);return t!==e&&(Ee.set(e,t),Ce.set(t,e)),t}const Re=e=>Ce.get(e);function Pe(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const a=indexedDB.open(e,t),o=Ne(a);return r&&a.addEventListener("upgradeneeded",e=>{r(Ne(a.result),e.oldVersion,e.newVersion,Ne(a.transaction),e)}),n&&a.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}function De(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",e=>t(e.oldVersion,e)),Ne(n).then(()=>{})}const xe=["get","getKey","getAll","getAllKeys","count"],Oe=["put","add","delete","clear"],Me=new Map;function Le(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(Me.get(t))return Me.get(t);const i=t.replace(/FromIndex$/,""),s=t!==i,a=Oe.includes(i);if(i in(s?IDBIndex:IDBObjectStore).prototype&&(a||xe.includes(i))){var n=async function(e,...t){var n=this.transaction(e,a?"readwrite":"readonly");let r=n.store;return s&&(r=r.index(t.shift())),(await Promise.all([r[i](...t),a&&n.done]))[0]};return Me.set(t,n),n}}}Se={..._=Se,get:(e,t,n)=>Le(e,t)||_.get(e,t,n),has:(e,t)=>!!Le(e,t)||_.has(e,t)};class Fe{constructor(e){this.container=e}getPlatformInfoString(){const e=this.container.getProviders();return e.map(e=>{if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return`${t.library}/${t.version}`}).filter(e=>e).join(" ")}}const Ue="@firebase/app",Ve=new ve("@firebase/app");var qe;const Be="[DEFAULT]",je={"@firebase/app":"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"},ze=new Map,$e=new Map;function Ke(t,n){try{t.container.addComponent(n)}catch(e){Ve.debug(`Component ${n.name} failed to register with FirebaseApp ${t.name}`,e)}}function We(e,t){e.container.addOrOverwriteComponent(t)}function Ge(e){var t=e.name;if($e.has(t))return Ve.debug(`There were multiple attempts to register component ${t}.`),!1;$e.set(t,e);for(const n of ze.values())Ke(n,e);return!0}function He(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const Qe=new D("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","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}."});class Ye{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 ce("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 Qe.create("app-deleted",{appName:this._name})}}const Je="10.7.0";function Xe(e,t={}){let n=e;if("object"!=typeof t){const i=t;t={name:i}}var r=Object.assign({name:Be,automaticDataCollectionEnabled:!1},t);const i=r.name;if("string"!=typeof i||!i)throw Qe.create("bad-app-name",{appName:String(i)});if(n=n||g(),!n)throw Qe.create("no-options");var s=ze.get(i);if(s){if(B(n,s.options)&&B(r,s.config))return s;throw Qe.create("duplicate-app",{appName:i})}const a=new he(i);for(const o of $e.values())a.addComponent(o);r=new Ye(n,r,a);return ze.set(i,r),r}function Ze(e=Be){var t=ze.get(e);if(!t&&e===Be&&g())return Xe();if(!t)throw Qe.create("no-app",{appName:e});return t}async function et(e){var t=e.name;ze.has(t)&&(ze.delete(t),await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function tt(e,t,n){let r=null!==(s=je[e])&&void 0!==s?s:e;n&&(r+=`-${n}`);var i=r.match(/\s|\//),s=t.match(/\s|\//);if(i||s){const a=[`Unable to register library "${r}" with version "${t}":`];return i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Ve.warn(a.join(" "))}Ge(new ce(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}function nt(e,t){if(null!==e&&"function"!=typeof e)throw Qe.create("invalid-log-argument");!function(s,e){for(const t of de){let i=null;e&&e.level&&(i=pe[e.level]),t.userLogHandler=null===s?null:(e,t,...n)=>{var r=n.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(" ");t>=(null!==i&&void 0!==i?i:e.logLevel)&&s({level:m[t].toLowerCase(),message:r,args:n,type:e.name})}}}(e,t)}function rt(e){var t;t=e,de.forEach(e=>{e.setLogLevel(t)})}const it="firebase-heartbeat-database",st=1,at="firebase-heartbeat-store";let ot=null;function ct(){return ot=ot||Pe(it,st,{upgrade:(e,t)=>{0===t&&e.createObjectStore(at)}}).catch(e=>{throw Qe.create("idb-open",{originalErrorMessage:e.message})}),ot}async function lt(e,t){try{const r=await ct(),i=r.transaction(at,"readwrite"),s=i.objectStore(at);await s.put(t,ut(e)),await i.done}catch(e){var n;e instanceof P?Ve.warn(e.message):(n=Qe.create("idb-set",{originalErrorMessage:null==e?void 0:e.message}),Ve.warn(n.message))}}function ut(e){return`${e.name}!${e.options.appId}`}class ht{constructor(e){this.container=e,this._heartbeatsCache=null;var t=this.container.getProvider("app").getImmediate();this._storage=new pt(t),this._heartbeatsCachePromise=this._storage.read().then(e=>this._heartbeatsCache=e)}async triggerHeartbeat(){var e;const t=this.container.getProvider("platform-logger").getImmediate();var n=t.getPlatformInfoString();const r=dt();if((null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.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=>{var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";var e=dt(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const i of e){const s=n.find(e=>e.agent===i.agent);if(s){if(s.dates.push(i.date),ft(n)>t){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),ft(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),t=s(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,0<n.length?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),t}}function dt(){const e=new Date;return e.toISOString().substring(0,10)}class pt{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!A()&&N().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){var e=await async function(e){try{const n=await ct();return await n.transaction(at).objectStore(at).get(ut(e))}catch(e){var t;e instanceof P?Ve.warn(e.message):(t=Qe.create("idb-get",{originalErrorMessage:null==e?void 0:e.message}),Ve.warn(t.message))}}(this.app);return null!=e&&e.heartbeats?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){var n=await this.read();return lt(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){var n=await this.read();return lt(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function ft(e){return s(JSON.stringify({version:2,heartbeats:e})).length}qe="",Ge(new ce("platform-logger",e=>new Fe(e),"PRIVATE")),Ge(new ce("heartbeat",e=>new ht(e),"PRIVATE")),tt(Ue,"0.9.24",qe),tt(Ue,"0.9.24","esm2017"),tt("fire-js","");var gt=Object.freeze({__proto__:null,SDK_VERSION:Je,_DEFAULT_ENTRY_NAME:Be,_addComponent:Ke,_addOrOverwriteComponent:We,_apps:ze,_clearComponents:function(){$e.clear()},_components:$e,_getProvider:He,_registerComponent:Ge,_removeServiceInstance:function(e,t,n=Be){He(e,t).clearInstance(n)},deleteApp:et,getApp:Ze,getApps:function(){return Array.from(ze.values())},initializeApp:Xe,onLog:nt,registerVersion:tt,setLogLevel:rt,FirebaseError:P});class mt{constructor(e,t){this._delegate=e,this.firebase=t,Ke(e,new ce("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),et(this._delegate)))}_getService(e,t=Be){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=Be){this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){Ke(this._delegate,e)}_addOrOverwriteComponent(e){We(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}const vt=new D("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."});function _t(i){const s={},a={__esModule:!0,initializeApp:function(e,t={}){var n=Xe(e,t);if(F(s,n.name))return s[n.name];var r=new i(n,a);return s[n.name]=r},app:o,registerVersion:tt,setLogLevel:rt,onLog:nt,apps:null,SDK_VERSION:Je,INTERNAL:{registerComponent:function(n){const r=n.name,t=r.replace("-compat","");{var e;Ge(n)&&"PUBLIC"===n.type&&(e=(e=o())=>{if("function"!=typeof e[t])throw vt.create("invalid-app-argument",{appName:r});return e[t]()},void 0!==n.serviceProps&&c(e,n.serviceProps),a[t]=e,i.prototype[t]=function(...e){const t=this._getService.bind(this,r);return t.apply(this,n.multipleInstances?e:[])})}return"PUBLIC"===n.type?a[t]:null},removeApp:function(e){delete s[e]},useAsService:function(e,t){if("serverAuth"===t)return null;var n=t;return n},modularAPIs:gt}};function o(e){if(e=e||Be,!F(s,e))throw vt.create("no-app",{appName:e});return s[e]}return a.default=a,Object.defineProperty(a,"apps",{get:function(){return Object.keys(s).map(e=>s[e])}}),o.App=i,a}var yt=function e(){const t=_t(mt);return t.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:G,ErrorFactory:D,deepExtend:c}),t}();const wt=new ve("@firebase/app-compat");if("object"==typeof self&&self.self===self&&void 0!==self.firebase){wt.warn(`
Warning: Firebase is already defined in the global scope. Please make sure
Firebase library is only loaded once.
`);const Y1=self.firebase.SDK_VERSION;Y1&&0<=Y1.indexOf("LITE")&&wt.warn(`
Warning: You are trying to load Firebase while using Firebase Performance standalone script.
You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.
`)}const bt=yt;tt("@firebase/app-compat","0.2.24",void 0);bt.registerVersion("firebase","10.7.0","app-compat");var It="@firebase/installations",Tt="0.6.4";const Et=1e4,Ct="w:0.6.4",St="FIS_v2",kt="https://firebaseinstallations.googleapis.com/v1",At=36e5;const Nt=new D("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 Rt(e){return e instanceof P&&e.code.includes("request-failed")}function Pt({projectId:e}){return`${kt}/projects/${e}/installations`}function Dt(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}async function xt(e,t){var n=(await t.json()).error;return Nt.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function Ot({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function Mt(e,{refreshToken:t}){const n=Ot(e);return n.append("Authorization",(t=t,`${St} ${t}`)),n}async function Lt(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function Ft(t){return new Promise(e=>{setTimeout(e,t)})}const Ut=/^[cdef][\w-]{21}$/,Vt="";function qt(){try{const t=new Uint8Array(17),n=self.crypto||self.msCrypto;n.getRandomValues(t),t[0]=112+t[0]%16;var e=function(e){const t=function(e){const t=btoa(String.fromCharCode(...e));return t.replace(/\+/g,"-").replace(/\//g,"_")}(e);return t.substr(0,22)}(t);return Ut.test(e)?e:Vt}catch(e){return Vt}}function Bt(e){return`${e.appName}!${e.appId}`}const jt=new Map;function zt(e,t){var n=Bt(e);$t(n,t),function(e,t){const n=function(){!Kt&&"BroadcastChannel"in self&&(Kt=new BroadcastChannel("[Firebase] FID Change"),Kt.onmessage=e=>{$t(e.data.key,e.data.fid)});return Kt}();n&&n.postMessage({key:e,fid:t});0===jt.size&&Kt&&(Kt.close(),Kt=null)}(n,t)}function $t(e,t){var n=jt.get(e);if(n)for(const r of n)r(t)}let Kt=null;const Wt="firebase-installations-store";let Gt=null;function Ht(){return Gt=Gt||Pe("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(Wt)}}),Gt}async function Qt(e,t){var n=Bt(e);const r=await Ht(),i=r.transaction(Wt,"readwrite"),s=i.objectStore(Wt);var a=await s.get(n);return await s.put(t,n),await i.done,a&&a.fid===t.fid||zt(e,t.fid),t}async function Yt(e){var t=Bt(e);const n=await Ht(),r=n.transaction(Wt,"readwrite");await r.objectStore(Wt).delete(t),await r.done}async function Jt(e,t){var n=Bt(e);const r=await Ht(),i=r.transaction(Wt,"readwrite"),s=i.objectStore(Wt);var a=await s.get(n),o=t(a);return void 0===o?await s.delete(n):await s.put(o,n),await i.done,!o||a&&a.fid===o.fid||zt(e,o.fid),o}async function Xt(n){let r;var e=await Jt(n.appConfig,e=>{var t=en(e||{fid:qt(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:async function(e){let t=await Zt(e.appConfig);for(;1===t.registrationStatus;)await Ft(100),t=await Zt(e.appConfig);if(0!==t.registrationStatus)return t;{var{installationEntry:n,registrationPromise:r}=await Xt(e);return r||n}}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(Nt.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=async function(t,n){try{var e=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const r=Pt(e),i=Ot(e),s=t.getImmediate({optional:!0});!s||(a=await s.getHeartbeatsHeader())&&i.append("x-firebase-client",a);var a={fid:n,authVersion:St,appId:e.appId,sdkVersion:Ct};const o={method:"POST",headers:i,body:JSON.stringify(a)},c=await Lt(()=>fetch(r,o));if(c.ok){a=await c.json();return{fid:a.fid||n,registrationStatus:2,refreshToken:a.refreshToken,authToken:Dt(a.authToken)}}throw await xt("Create Installation",c)}(t,n);return Qt(t.appConfig,e)}catch(e){throw Rt(e)&&409===e.customData.serverCode?await Yt(t.appConfig):await Qt(t.appConfig,{fid:n.fid,registrationStatus:0}),e}}(e,r);return{installationEntry:r,registrationPromise:n}}}(n,t);return r=t.registrationPromise,t.installationEntry});return e.fid===Vt?{installationEntry:await r}:{installationEntry:e,registrationPromise:r}}function Zt(e){return Jt(e,e=>{if(!e)throw Nt.create("installation-not-found");return en(e)})}function en(e){return 1===(t=e).registrationStatus&&t.registrationTime+Et<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function tn({appConfig:e,heartbeatServiceProvider:t},n){const r=([i,s]=[e,n["fid"]],`${Pt(i)}/${s}/authTokens:generate`);var i,s;const a=Mt(e,n),o=t.getImmediate({optional:!0});!o||(c=await o.getHeartbeatsHeader())&&a.append("x-firebase-client",c);var c={installation:{sdkVersion:Ct,appId:e.appId}};const l={method:"POST",headers:a,body:JSON.stringify(c)},u=await Lt(()=>fetch(r,l));if(u.ok)return Dt(await u.json());throw await xt("Generate Auth Token",u)}async function nn(r,i=!1){let s;var e=await Jt(r.appConfig,e=>{if(!sn(e))throw Nt.create("not-registered");var t,n=e.authToken;if(i||2!==(t=n).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+At}(t)){if(1===n.requestStatus)return s=async function(e,t){let n=await rn(e.appConfig);for(;1===n.authToken.requestStatus;)await Ft(100),n=await rn(e.appConfig);var r=n.authToken;return 0===r.requestStatus?nn(e,t):r}(r,i),e;if(!navigator.onLine)throw Nt.create("app-offline");n=(t=e,n={requestStatus:1,requestTime:Date.now()},Object.assign(Object.assign({},t),{authToken:n}));return s=async function(t,n){try{var r=await tn(t,n),e=Object.assign(Object.assign({},n),{authToken:r});return await Qt(t.appConfig,e),r}catch(e){throw!Rt(e)||401!==e.customData.serverCode&&404!==e.customData.serverCode?(r=Object.assign(Object.assign({},n),{authToken:{requestStatus:0}}),await Qt(t.appConfig,r)):await Yt(t.appConfig),e}}(r,n),n}return e});return s?await s:e.authToken}function rn(e){return Jt(e,e=>{if(!sn(e))throw Nt.create("not-registered");var t,n=e.authToken;return 1===(t=n).requestStatus&&t.requestTime+Et<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}function sn(e){return void 0!==e&&2===e.registrationStatus}async function an(e,t=!1){var n,r=e;return await((n=(await Xt(r)).registrationPromise)&&await n),(await nn(r,t)).token}function on(e){return Nt.create("missing-app-config-values",{valueName:e})}const cn="installations",ln=e=>{var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){if(!e||!e.options)throw on("App Configuration");if(!e.name)throw on("App Name");for(const t of["projectId","apiKey","appId"])if(!e.options[t])throw on(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:He(t,"heartbeat"),_delete:()=>Promise.resolve()}},un=e=>{const t=He(e.getProvider("app").getImmediate(),cn).getImmediate();return{getId:()=>async function(e){var t=e;const{installationEntry:n,registrationPromise:r}=await Xt(t);return(r||nn(t)).catch(console.error),n.fid}(t),getToken:e=>an(t,e)}};Ge(new ce(cn,ln,"PUBLIC")),Ge(new ce("installations-internal",un,"PRIVATE")),tt(It,Tt),tt(It,Tt,"esm2017");const hn="analytics",dn="firebase_id",pn="origin",fn="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",gn="https://www.googletagmanager.com/gtag/js",mn=new ve("@firebase/analytics"),vn=new D("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-intialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."});function _n(e){if(e.startsWith(gn))return e;var t=vn.create("invalid-gtag-resource",{gtagURL:e});return mn.warn(t.message),""}function yn(e){return Promise.all(e.map(e=>e.catch(e=>e)))}function wn(e,t){const n=function(e,t){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(e,t)),n}("firebase-js-sdk-policy",{createScriptURL:_n}),r=document.createElement("script");var i=`${gn}?l=${e}&id=${t}`;r.src=n?null===n||void 0===n?void 0:n.createScriptURL(i):i,r.async=!0,document.head.appendChild(r)}function bn(h,d,p,f){return async function(e,...t){try{var n,r,i,s,a,o,c,l,u;"event"===e?([n,r]=t,await async function(e,n,r,i,s){try{let t=[];if(s&&s.send_to){let e=s.send_to;Array.isArray(e)||(e=[e]);const c=await yn(r);for(const l of e){var a=c.find(e=>e.measurementId===l),o=a&&n[a.appId];if(!o){t=[];break}t.push(o)}}0===t.length&&(t=Object.values(n)),await Promise.all(t),e("event",i,s||{})}catch(e){mn.error(e)}}(h,d,p,n,r)):"config"===e?([i,s]=t,await async function(e,t,n,r,i,s){var a=r[i];try{if(a)await t[a];else{const c=await yn(n);var o=c.find(e=>e.measurementId===i);o&&await t[o.appId]}}catch(e){mn.error(e)}e("config",i,s)}(h,d,p,f,i,s)):"consent"===e?([a]=t,h("consent","update",a)):"get"===e?([o,c,l]=t,h("get",o,c,l)):"set"===e?([u]=t,h("set",u)):h(e,...t)}catch(e){mn.error(e)}}}const In=30;const Tn=new class{constructor(e={},t=1e3){this.throttleMetadata=e,this.intervalMillis=t}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,t){this.throttleMetadata[e]=t}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}};async function En(e){var t,{appId:n,apiKey:r}=e,r={method:"GET",headers:new Headers({Accept:"application/json","x-goog-api-key":r})},n=fn.replace("{app-id}",n);const i=await fetch(n,r);if(200===i.status||304===i.status)return i.json();{let e="";try{var s=await i.json();null!==(t=s.error)&&void 0!==t&&t.message&&(e=s.error.message)}catch(e){}throw vn.create("config-fetch-failed",{httpStatus:i.status,responseMessage:e})}}async function Cn(e,t=Tn,n){var{appId:r,apiKey:i,measurementId:s}=e.options;if(!r)throw vn.create("no-app-id");if(!i){if(s)return{measurementId:s,appId:r};throw vn.create("no-api-key")}var a=t.getThrottleMetadata(r)||{backoffCount:0,throttleEndTimeMillis:Date.now()};const o=new An;return setTimeout(async()=>{o.abort()},void 0!==n?n:6e4),async function t(n,{throttleEndTimeMillis:e,backoffCount:r},i,s=Tn){var a;const{appId:o,measurementId:c}=n;try{await Sn(i,e)}catch(e){if(c)return mn.warn("Timed out fetching this Firebase app's measurement ID from the server."+` Falling back to the measurement ID ${c}`+` provided in the "measurementId" field in the local Firebase config. [${null==e?void 0:e.message}]`),{appId:o,measurementId:c};throw e}try{const l=await En(n);return s.deleteThrottleMetadata(o),l}catch(e){const u=e;if(!kn(u)){if(s.deleteThrottleMetadata(o),c)return mn.warn("Failed to fetch this Firebase app's measurement ID from the server."+` Falling back to the measurement ID ${c}`+` provided in the "measurementId" field in the local Firebase config. [${null===u||void 0===u?void 0:u.message}]`),{appId:o,measurementId:c};throw e}const h=503===Number(null===(a=null===u||void 0===u?void 0:u.customData)||void 0===a?void 0:a.httpStatus)?ae(r,s.intervalMillis,In):ae(r,s.intervalMillis),d={throttleEndTimeMillis:Date.now()+h,backoffCount:r+1};return s.setThrottleMetadata(o,d),mn.debug(`Calling attemptFetch again in ${h} millis`),t(n,d,i,s)}}({appId:r,apiKey:i,measurementId:s},a,o,t)}function Sn(i,s){return new Promise((e,t)=>{var n=Math.max(s-Date.now(),0);const r=setTimeout(e,n);i.addEventListener(()=>{clearTimeout(r),t(vn.create("fetch-throttle",{throttleEndTimeMillis:s}))})})}function kn(e){if(!(e instanceof P&&e.customData))return!1;var t=Number(e.customData.httpStatus);return 429===t||500===t||503===t||504===t}class An{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function Nn(t,e,n,r,i,s,a){const o=Cn(t);o.then(e=>{n[e.measurementId]=e.appId,t.options.measurementId&&e.measurementId!==t.options.measurementId&&mn.warn(`The measurement ID in the local Firebase config (${t.options.measurementId})`+` does not match the measurement ID fetched from the server (${e.measurementId}).`+" To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.")}).catch(e=>mn.error(e)),e.push(o);var c=async function(){if(!A())return mn.warn(vn.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;try{await N()}catch(e){return mn.warn(vn.create("indexeddb-unavailable",{errorInfo:null==e?void 0:e.toString()}).message),!1}return!0}().then(e=>{if(e)return r.getId()}),[l,u]=await Promise.all([o,c]);!function(e){var t=window.document.getElementsByTagName("script");for(const n of Object.values(t))if(n.src&&n.src.includes(gn)&&n.src.includes(e))return n}(s)&&wn(s,l.measurementId),i("js",new Date);const h=null!==(c=null==a?void 0:a.config)&&void 0!==c?c:{};return h[pn]="firebase",h.update=!0,null!=u&&(h[dn]=u),i("config",l.measurementId,h),l.measurementId}class Rn{constructor(e){this.app=e}_delete(){return delete Pn[this.app.options.appId],Promise.resolve()}}let Pn={},Dn=[];const