firebase 9.6.11 → 9.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/app/dist/index.cjs.js +1 -1
  3. package/app/dist/index.esm.js +1 -1
  4. package/app/dist/index.mjs +1 -1
  5. package/compat/app/dist/index.cjs.js +1 -1
  6. package/compat/app/dist/index.esm.js +1 -1
  7. package/compat/app/dist/index.mjs +1 -1
  8. package/compat/dist/index.esm.js +2 -2
  9. package/compat/dist/index.node.cjs +2 -2
  10. package/compat/dist/index.rn.cjs.js +2 -2
  11. package/firebase-analytics.js +3 -3
  12. package/firebase-app-check-compat.js +2 -2
  13. package/firebase-app-check-compat.js.map +1 -1
  14. package/firebase-app-check.js +9 -9
  15. package/firebase-app-check.js.map +1 -1
  16. package/firebase-app-compat.js +2 -2
  17. package/firebase-app-compat.js.map +1 -1
  18. package/firebase-app.js +9 -9
  19. package/firebase-auth-cordova.js +1 -1
  20. package/firebase-auth-react-native.js +1 -1
  21. package/firebase-auth.js +2 -2
  22. package/firebase-compat.js +4 -4
  23. package/firebase-compat.js.map +1 -1
  24. package/firebase-database.js +4 -4
  25. package/firebase-firestore-compat.js +1 -1
  26. package/firebase-firestore-compat.js.map +1 -1
  27. package/firebase-firestore-lite.js +127 -121
  28. package/firebase-firestore-lite.js.map +1 -1
  29. package/firebase-firestore.js +4115 -4023
  30. package/firebase-firestore.js.map +1 -1
  31. package/firebase-functions-compat.js +1 -1
  32. package/firebase-functions-compat.js.map +1 -1
  33. package/firebase-functions.js +31 -5
  34. package/firebase-functions.js.map +1 -1
  35. package/firebase-messaging-sw.js +1 -1
  36. package/firebase-messaging.js +1 -1
  37. package/firebase-performance-standalone-compat.es2017.js +5 -5
  38. package/firebase-performance-standalone-compat.es2017.js.map +1 -1
  39. package/firebase-performance-standalone-compat.js +1 -1
  40. package/firebase-performance-standalone-compat.js.map +1 -1
  41. package/firebase-performance.js +3 -3
  42. package/firebase-remote-config.js +2 -2
  43. package/firebase-storage.js +1 -1
  44. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # firebase
2
2
 
3
+ ## 9.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`e76305a0f`](https://github.com/firebase/firebase-js-sdk/commit/e76305a0f2523a9dafe93c091708abcf14ac5b31) [#6191](https://github.com/firebase/firebase-js-sdk/pull/6191) - Minor version bump to umbrella package to match functions bump.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`c69c6898a`](https://github.com/firebase/firebase-js-sdk/commit/c69c6898a3d14ddcc6c6cafd3a219064b500c4f6), [`38da5d9be`](https://github.com/firebase/firebase-js-sdk/commit/38da5d9be4a001038548947a85c9b612e5275e32)]:
12
+ - @firebase/app@0.7.22
13
+ - @firebase/functions-compat@0.2.0
14
+ - @firebase/functions@0.8.0
15
+ - @firebase/app-check@0.5.7
16
+ - @firebase/app-compat@0.1.23
17
+ - @firebase/app-check-compat@0.2.7
18
+
3
19
  ## 9.6.11
4
20
 
5
21
  ### Patch Changes
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var app = require('@firebase/app');
6
6
 
7
7
  var name = "firebase";
8
- var version = "9.6.11";
8
+ var version = "9.7.0";
9
9
 
10
10
  /**
11
11
  * @license
@@ -2,7 +2,7 @@ import { registerVersion } from '@firebase/app';
2
2
  export * from '@firebase/app';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.6.11";
5
+ var version = "9.7.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -2,7 +2,7 @@ import { registerVersion } from '@firebase/app';
2
2
  export * from '@firebase/app';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.6.11";
5
+ var version = "9.7.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -7,7 +7,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
7
7
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
8
8
 
9
9
  var name = "firebase";
10
- var version = "9.6.11";
10
+ var version = "9.7.0";
11
11
 
12
12
  /**
13
13
  * @license
@@ -2,7 +2,7 @@ import firebase from '@firebase/app-compat';
2
2
  export { default } from '@firebase/app-compat';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.6.11";
5
+ var version = "9.7.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -2,7 +2,7 @@ import firebase from '@firebase/app-compat';
2
2
  export { default } from '@firebase/app-compat';
3
3
 
4
4
  var name = "firebase";
5
- var version = "9.6.11";
5
+ var version = "9.7.0";
6
6
 
7
7
  /**
8
8
  * @license
@@ -12,7 +12,7 @@ import '@firebase/performance-compat';
12
12
  import '@firebase/remote-config-compat';
13
13
 
14
14
  var name$1 = "firebase";
15
- var version$1 = "9.6.11";
15
+ var version$1 = "9.7.0";
16
16
 
17
17
  /**
18
18
  * @license
@@ -33,7 +33,7 @@ var version$1 = "9.6.11";
33
33
  firebase.registerVersion(name$1, version$1, 'app-compat');
34
34
 
35
35
  var name = "firebase";
36
- var version = "9.6.11";
36
+ var version = "9.7.0";
37
37
 
38
38
  /**
39
39
  * @license
@@ -12,7 +12,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
12
12
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
13
13
 
14
14
  var name$1 = "firebase";
15
- var version$1 = "9.6.11";
15
+ var version$1 = "9.7.0";
16
16
 
17
17
  /**
18
18
  * @license
@@ -33,7 +33,7 @@ var version$1 = "9.6.11";
33
33
  firebase__default["default"].registerVersion(name$1, version$1, 'app-compat');
34
34
 
35
35
  var name = "firebase";
36
- var version = "9.6.11";
36
+ var version = "9.7.0";
37
37
 
38
38
  /**
39
39
  * @license
@@ -10,7 +10,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
10
10
  var firebase__default = /*#__PURE__*/_interopDefaultLegacy(firebase);
11
11
 
12
12
  var name$1 = "firebase";
13
- var version$1 = "9.6.11";
13
+ var version$1 = "9.7.0";
14
14
 
15
15
  /**
16
16
  * @license
@@ -31,7 +31,7 @@ var version$1 = "9.6.11";
31
31
  firebase__default["default"].registerVersion(name$1, version$1, 'app-compat');
32
32
 
33
33
  var name = "firebase";
34
- var version = "9.6.11";
34
+ var version = "9.7.0";
35
35
 
36
36
  /**
37
37
  * @license
@@ -1,4 +1,4 @@
1
- import { registerVersion, _registerComponent, _getProvider, getApp } from 'https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js';
1
+ import { registerVersion, _registerComponent, _getProvider, getApp } from 'https://www.gstatic.com/firebasejs/9.7.0/firebase-app.js';
2
2
 
3
3
  /**
4
4
  * @license
@@ -2554,7 +2554,7 @@ async function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) {
2554
2554
  *
2555
2555
  * @public
2556
2556
  *
2557
- * @param app - The {@link https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js#FirebaseApp} to use.
2557
+ * @param app - The {@link https://www.gstatic.com/firebasejs/9.7.0/firebase-app.js#FirebaseApp} to use.
2558
2558
  */
2559
2559
  function getAnalytics(app = getApp()) {
2560
2560
  app = getModularInstance(app);
@@ -2570,7 +2570,7 @@ function getAnalytics(app = getApp()) {
2570
2570
  *
2571
2571
  * @public
2572
2572
  *
2573
- * @param app - The {@link https://www.gstatic.com/firebasejs/9.6.11/firebase-app.js#FirebaseApp} to use.
2573
+ * @param app - The {@link https://www.gstatic.com/firebasejs/9.7.0/firebase-app.js#FirebaseApp} to use.
2574
2574
  */
2575
2575
  function initializeAnalytics(app, options = {}) {
2576
2576
  // Dependencies
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(ke,ye){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,r,a=e(ke);const h={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(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var a=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const n=[];for(let l=0;l<r.length;l+=3){var o=r[l],i=l+1<r.length,s=i?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&s)<<2|h>>6,t=63&h;c||(t=64,i||(e=64)),n.push(a[o>>2],a[(3&o)<<4|s>>4],a[e],a[t])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(t){const r=[];let a=0;for(let n=0;n<t.length;n++){let e=t.charCodeAt(n);e<128?r[a++]=e:(e<2048?r[a++]=e>>6|192:(55296==(64512&e)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++n)),r[a++]=e>>18|240,r[a++]=e>>12&63|128):r[a++]=e>>12|224,r[a++]=e>>6&63|128),r[a++]=63&e|128)}return r}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,a=0;for(;r<e.length;){var n,o,i=e[r++];i<128?t[a++]=String.fromCharCode(i):191<i&&i<224?(n=e[r++],t[a++]=String.fromCharCode((31&i)<<6|63&n)):239<i&&i<365?(o=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[a++]=String.fromCharCode(55296+(o>>10)),t[a++]=String.fromCharCode(56320+(1023&o))):(n=e[r++],o=e[r++],t[a++]=String.fromCharCode((15&i)<<12|(63&n)<<6|63&o))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const a=[];for(let c=0;c<e.length;){var n=r[e.charAt(c++)],o=c<e.length?r[e.charAt(c)]:0;++c;var i=c<e.length?r[e.charAt(c)]:64;++c;var s=c<e.length?r[e.charAt(c)]:64;if(++c,null==n||null==o||null==i||null==s)throw Error();a.push(n<<2|o>>4),64!==i&&(a.push(o<<4&240|i>>2),64!==s&&a.push(i<<6&192|s))}return a},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)}}},i=function(e){try{return h.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class o{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(r){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof r&&(this.promise.catch(()=>{}),1===r.length?r(e):r(e,t))}}}function n(){return"object"==typeof indexedDB}class s extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,s.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var a,r=t[0]||{},n=`${this.service}/${e}`,o=this.errors[e],o=o?(a=r,o.replace(l,(e,t)=>{var r=a[t];return null!=r?String(r):`<${t}?>`})):"Error",o=`${this.serviceName}: ${o} (${n}).`;return new s(n,o,r)}}const l=/\{\$([^}]+)}/g;function p(e){return JSON.parse(e)}function u(e){const t=function(e){let t={},r={},a={},n="";try{var o=e.split(".");t=p(i(o[0])||""),r=p(i(o[1])||""),n=o[2],a=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:a,signature:n}}(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null}const d=144e5,g=.5;class f{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,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}}(r=t=t||{})[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const v={debug:t.DEBUG,verbose:t.VERBOSE,info:t.INFO,warn:t.WARN,error:t.ERROR,silent:t.SILENT},b=t.INFO,E={[t.DEBUG]:"log",[t.VERBOSE]:"log",[t.INFO]:"info",[t.WARN]:"warn",[t.ERROR]:"error"},_=(e,t,...r)=>{if(!(t<e.logLevel)){var a=(new Date).toISOString(),n=E[t];if(!n)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[n](`[${a}] ${e.name}:`,...r)}};const w=new Map,m={activated:!1,tokenObservers:[]},k={initialized:!1,enabled:!1};function y(e){return w.get(e)||m}function A(e,t){w.set(e,t)}const T="https://content-firebaseappcheck.googleapis.com/v1beta",C="exchangeDebugToken",S={OFFSET_DURATION:3e5,RETRIAL_MIN_WAIT:3e4,RETRIAL_MAX_WAIT:96e4};class O{constructor(e,t,r,a,n){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=a,this.upperBound=n,this.pending=null,n<(this.nextErrorWaitInterval=a))throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{this.pending=new o,t=this.getNextRun(e),await new Promise(e=>{setTimeout(e,t)}),this.pending.resolve(),await this.pending.promise,this.pending=new o,await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch(()=>{})}catch(e){this.retryPolicy(e)?this.process(!1).catch(()=>{}):this.stop()}var t}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();var t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}const R=new c("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"});function P(e=!1){var t;return e?null===(t=self.grecaptcha)||void 0===t?void 0:t.enterprise:self.grecaptcha}function I(e){if(!y(e).activated)throw R.create("use-before-activation",{appName:e.name})}function D(e){var t=Math.round(e/1e3),r=Math.floor(t/86400),a=Math.floor((t-3600*r*24)/3600),n=Math.floor((t-3600*r*24-3600*a)/60),t=t-3600*r*24-3600*a-60*n;let o="";return r&&(o+=x(r)+"d:"),a&&(o+=x(a)+"h:"),o+=x(n)+"m:"+x(t)+"s",o}function x(e){return 0===e?"00":10<=e?e.toString():"0"+e}async function N({url:e,body:t},r){const a={"Content-Type":"application/json"},n=r.getImmediate({optional:!0});!n||(c=await n.getHeartbeatsHeader())&&(a["X-Firebase-Client"]=c);var o={method:"POST",body:JSON.stringify(t),headers:a};let i;try{i=await fetch(e,o)}catch(e){throw R.create("fetch-network-error",{originalErrorMessage:e.message})}if(200!==i.status)throw R.create("fetch-status-error",{httpStatus:i.status});let s;try{s=await i.json()}catch(e){throw R.create("fetch-parse-error",{originalErrorMessage:e.message})}var c=s.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw R.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+`format: ${s.ttl}`});o=1e3*Number(c[1]),c=Date.now();return{token:s.attestationToken,expireTimeMillis:c+o,issuedAtTimeMillis:c}}const M="firebase-app-check-database",L=1,B="firebase-app-check-store",j="debug-token";let H=null;function $(){return H||(H=new Promise((t,r)=>{try{const e=indexedDB.open(M,L);e.onsuccess=e=>{t(e.target.result)},e.onerror=e=>{var t;r(R.create("storage-open",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))},e.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(B,{keyPath:"compositeKey"})}}catch(e){r(R.create("storage-open",{originalErrorMessage:e.message}))}}),H)}async function W(e,t){const r=await $(),a=r.transaction(B,"readwrite"),n=a.objectStore(B),o=n.put({compositeKey:e,value:t});return new Promise((t,r)=>{o.onsuccess=e=>{t()},a.onerror=e=>{var t;r(R.create("storage-set",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}async function F(e){const t=await $(),n=t.transaction(B,"readonly"),r=n.objectStore(B),o=r.get(e);return new Promise((r,a)=>{o.onsuccess=e=>{var t=e.target.result;r(t?t.value:void 0)},n.onerror=e=>{var t;a(R.create("storage-get",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}function V(e){return`${e.options.appId}-${e.name}`}const K=new class{constructor(e){this.name=e,this._logLevel=b,this._logHandler=_,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in t))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?v[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,t.DEBUG,...e),this._logHandler(this,t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,t.VERBOSE,...e),this._logHandler(this,t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,t.INFO,...e),this._logHandler(this,t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,t.WARN,...e),this._logHandler(this,t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,t.ERROR,...e),this._logHandler(this,t.ERROR,...e)}}("@firebase/app-check");async function z(t){if(n()){let e=void 0;try{e=await F(V(t))}catch(e){K.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return e}}function U(e,t){return n()?W(V(e),t).catch(e=>{K.warn(`Failed to write token to IndexedDB. Error: ${e}`)}):Promise.resolve()}async function q(){let e=void 0;try{e=await F(j)}catch(e){}if(e)return e;var t,r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0,r="x"===e?t:3&t|8;return r.toString(16)});return t=r,W(j,t).catch(e=>K.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),r}function G(){return k.enabled}async function X(){var e=k;if(e.enabled&&e.token)return e.token.promise;throw Error(`
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app-compat"),require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app-compat","@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase,e.firebase.INTERNAL.modularAPIs)}(this,function(ke,ye){"use strict";try{!(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t,r,a=e(ke);const h={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(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var a=e?this.byteToCharMapWebSafe_:this.byteToCharMap_;const n=[];for(let l=0;l<r.length;l+=3){var o=r[l],i=l+1<r.length,s=i?r[l+1]:0,c=l+2<r.length,h=c?r[l+2]:0;let e=(15&s)<<2|h>>6,t=63&h;c||(t=64,i||(e=64)),n.push(a[o>>2],a[(3&o)<<4|s>>4],a[e],a[t])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(function(t){const r=[];let a=0;for(let n=0;n<t.length;n++){let e=t.charCodeAt(n);e<128?r[a++]=e:(e<2048?r[a++]=e>>6|192:(55296==(64512&e)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++n)),r[a++]=e>>18|240,r[a++]=e>>12&63|128):r[a++]=e>>12|224,r[a++]=e>>6&63|128),r[a++]=63&e|128)}return r}(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,a=0;for(;r<e.length;){var n,o,i=e[r++];i<128?t[a++]=String.fromCharCode(i):191<i&&i<224?(n=e[r++],t[a++]=String.fromCharCode((31&i)<<6|63&n)):239<i&&i<365?(o=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536,t[a++]=String.fromCharCode(55296+(o>>10)),t[a++]=String.fromCharCode(56320+(1023&o))):(n=e[r++],o=e[r++],t[a++]=String.fromCharCode((15&i)<<12|(63&n)<<6|63&o))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_;const a=[];for(let c=0;c<e.length;){var n=r[e.charAt(c++)],o=c<e.length?r[e.charAt(c)]:0;++c;var i=c<e.length?r[e.charAt(c)]:64;++c;var s=c<e.length?r[e.charAt(c)]:64;if(++c,null==n||null==o||null==i||null==s)throw Error();a.push(n<<2|o>>4),64!==i&&(a.push(o<<4&240|i>>2),64!==s&&a.push(i<<6&192|s))}return a},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)}}},i=function(e){try{return h.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};class o{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(r){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof r&&(this.promise.catch(()=>{}),1===r.length?r(e):r(e,t))}}}function n(){return"object"==typeof indexedDB}class s extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,s.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var a,r=t[0]||{},n=`${this.service}/${e}`,o=this.errors[e],o=o?(a=r,o.replace(l,(e,t)=>{var r=a[t];return null!=r?String(r):`<${t}?>`})):"Error",o=`${this.serviceName}: ${o} (${n}).`;return new s(n,o,r)}}const l=/\{\$([^}]+)}/g;function p(e){return JSON.parse(e)}function u(e){const t=function(e){let t={},r={},a={},n="";try{var o=e.split(".");t=p(i(o[0])||""),r=p(i(o[1])||""),n=o[2],a=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:a,signature:n}}(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null}const d=144e5,g=.5;class f{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,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}}(r=t=t||{})[r.DEBUG=0]="DEBUG",r[r.VERBOSE=1]="VERBOSE",r[r.INFO=2]="INFO",r[r.WARN=3]="WARN",r[r.ERROR=4]="ERROR",r[r.SILENT=5]="SILENT";const v={debug:t.DEBUG,verbose:t.VERBOSE,info:t.INFO,warn:t.WARN,error:t.ERROR,silent:t.SILENT},b=t.INFO,E={[t.DEBUG]:"log",[t.VERBOSE]:"log",[t.INFO]:"info",[t.WARN]:"warn",[t.ERROR]:"error"},_=(e,t,...r)=>{if(!(t<e.logLevel)){var a=(new Date).toISOString(),n=E[t];if(!n)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[n](`[${a}] ${e.name}:`,...r)}};const w=new Map,m={activated:!1,tokenObservers:[]},k={initialized:!1,enabled:!1};function y(e){return w.get(e)||m}function A(e,t){w.set(e,t)}const T="https://content-firebaseappcheck.googleapis.com/v1",C="exchangeDebugToken",S={OFFSET_DURATION:3e5,RETRIAL_MIN_WAIT:3e4,RETRIAL_MAX_WAIT:96e4};class O{constructor(e,t,r,a,n){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=a,this.upperBound=n,this.pending=null,n<(this.nextErrorWaitInterval=a))throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{this.pending=new o,t=this.getNextRun(e),await new Promise(e=>{setTimeout(e,t)}),this.pending.resolve(),await this.pending.promise,this.pending=new o,await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch(()=>{})}catch(e){this.retryPolicy(e)?this.process(!1).catch(()=>{}):this.stop()}var t}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();var t=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),t}}const R=new c("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.",throttled:"Requests throttled due to {$httpStatus} error. Attempts allowed again after {$time}"});function P(e=!1){var t;return e?null===(t=self.grecaptcha)||void 0===t?void 0:t.enterprise:self.grecaptcha}function I(e){if(!y(e).activated)throw R.create("use-before-activation",{appName:e.name})}function D(e){var t=Math.round(e/1e3),r=Math.floor(t/86400),a=Math.floor((t-3600*r*24)/3600),n=Math.floor((t-3600*r*24-3600*a)/60),t=t-3600*r*24-3600*a-60*n;let o="";return r&&(o+=x(r)+"d:"),a&&(o+=x(a)+"h:"),o+=x(n)+"m:"+x(t)+"s",o}function x(e){return 0===e?"00":10<=e?e.toString():"0"+e}async function N({url:e,body:t},r){const a={"Content-Type":"application/json"},n=r.getImmediate({optional:!0});!n||(c=await n.getHeartbeatsHeader())&&(a["X-Firebase-Client"]=c);var o={method:"POST",body:JSON.stringify(t),headers:a};let i;try{i=await fetch(e,o)}catch(e){throw R.create("fetch-network-error",{originalErrorMessage:e.message})}if(200!==i.status)throw R.create("fetch-status-error",{httpStatus:i.status});let s;try{s=await i.json()}catch(e){throw R.create("fetch-parse-error",{originalErrorMessage:e.message})}var c=s.ttl.match(/^([\d.]+)(s)$/);if(!c||!c[2]||isNaN(Number(c[1])))throw R.create("fetch-parse-error",{originalErrorMessage:"ttl field (timeToLive) is not in standard Protobuf Duration "+`format: ${s.ttl}`});o=1e3*Number(c[1]),c=Date.now();return{token:s.token,expireTimeMillis:c+o,issuedAtTimeMillis:c}}const M="firebase-app-check-database",L=1,B="firebase-app-check-store",j="debug-token";let H=null;function $(){return H||(H=new Promise((t,r)=>{try{const e=indexedDB.open(M,L);e.onsuccess=e=>{t(e.target.result)},e.onerror=e=>{var t;r(R.create("storage-open",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))},e.onupgradeneeded=e=>{const t=e.target.result;0===e.oldVersion&&t.createObjectStore(B,{keyPath:"compositeKey"})}}catch(e){r(R.create("storage-open",{originalErrorMessage:e.message}))}}),H)}async function W(e,t){const r=await $(),a=r.transaction(B,"readwrite"),n=a.objectStore(B),o=n.put({compositeKey:e,value:t});return new Promise((t,r)=>{o.onsuccess=e=>{t()},a.onerror=e=>{var t;r(R.create("storage-set",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}async function F(e){const t=await $(),n=t.transaction(B,"readonly"),r=n.objectStore(B),o=r.get(e);return new Promise((r,a)=>{o.onsuccess=e=>{var t=e.target.result;r(t?t.value:void 0)},n.onerror=e=>{var t;a(R.create("storage-get",{originalErrorMessage:null===(t=e.target.error)||void 0===t?void 0:t.message}))}})}function V(e){return`${e.options.appId}-${e.name}`}const K=new class{constructor(e){this.name=e,this._logLevel=b,this._logHandler=_,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in t))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?v[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,t.DEBUG,...e),this._logHandler(this,t.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,t.VERBOSE,...e),this._logHandler(this,t.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,t.INFO,...e),this._logHandler(this,t.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,t.WARN,...e),this._logHandler(this,t.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,t.ERROR,...e),this._logHandler(this,t.ERROR,...e)}}("@firebase/app-check");async function z(t){if(n()){let e=void 0;try{e=await F(V(t))}catch(e){K.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return e}}function U(e,t){return n()?W(V(e),t).catch(e=>{K.warn(`Failed to write token to IndexedDB. Error: ${e}`)}):Promise.resolve()}async function q(){let e=void 0;try{e=await F(j)}catch(e){}if(e)return e;var t,r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=16*Math.random()|0,r="x"===e?t:3&t|8;return r.toString(16)});return t=r,W(j,t).catch(e=>K.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),r}function G(){return k.enabled}async function X(){var e=k;if(e.enabled&&e.token)return e.token.promise;throw Error(`
2
2
  Can't get debug token in production mode.
3
- `)}function J(){var e=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.")}();const t=k;if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;const r=new o;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(q())}}const Y={error:"UNKNOWN_ERROR"};async function Z(e,t=!1){var r=e.app;I(r);const a=y(r);let n=a.token,o=void 0;if(n||(s=await a.cachedTokenPromise)&&ae(s)&&(n=s),!t&&n&&ae(n))return{token:n.token};let i=!1;if(G()){a.exchangeTokenPromise||(a.exchangeTokenPromise=N(function(e,t){var{projectId:r,appId:a,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${a}:${C}?key=${n}`,body:{debug_token:t}}}(r,await X()),e.heartbeatServiceProvider).then(e=>(a.exchangeTokenPromise=void 0,e)),i=!0);var s=await a.exchangeTokenPromise;return await U(r,s),A(r,Object.assign(Object.assign({},a),{token:s})),{token:s.token}}try{a.exchangeTokenPromise||(a.exchangeTokenPromise=a.provider.getToken().then(e=>(a.exchangeTokenPromise=void 0,e)),i=!0),n=await a.exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?K.warn(e.message):K.error(e),o=e}let c;return n?(c={token:n.token},A(r,Object.assign(Object.assign({},a),{token:n})),await U(r,n)):c=(e=o,{token:function(e){return h.encodeString(JSON.stringify(e),!1)}(Y),error:e}),i&&re(r,c),c}function Q(e,t,r,a){var n=e["app"];const o=y(n);var i={next:r,error:a,type:t};if(A(n,Object.assign(Object.assign({},o),{tokenObservers:[...o.tokenObservers,i]})),o.token&&ae(o.token)){const s=o.token;Promise.resolve().then(()=>{r({token:s.token}),te(e)}).catch(()=>{})}o.cachedTokenPromise.then(()=>te(e))}function ee(e,t){const r=y(e);var a=r.tokenObservers.filter(e=>e.next!==t);0===a.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),A(e,Object.assign(Object.assign({},r),{tokenObservers:a}))}function te(e){var t=e["app"],r=y(t);let a=r.tokenRefresher;a||(a=function(r){const a=r["app"];return new O(async()=>{var e=y(a);let t;if(t=e.token?await Z(r,!0):await Z(r),t.error)throw t.error},()=>!0,()=>{var e=y(a);if(e.token){var t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,e=e.token.expireTimeMillis-3e5,t=Math.min(t,e);return Math.max(0,t-Date.now())}return 0},S.RETRIAL_MIN_WAIT,S.RETRIAL_MAX_WAIT)}(e),A(t,Object.assign(Object.assign({},r),{tokenRefresher:a}))),!a.isRunning()&&r.isTokenAutoRefreshEnabled&&a.start()}function re(e,t){for(const r of y(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function ae(e){return 0<e.expireTimeMillis-Date.now()}class ne{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){var e=y(this.app)["tokenObservers"];for(const t of e)ee(this.app,t.next);return Promise.resolve()}}const oe="https://www.google.com/recaptcha/api.js",ie="https://www.google.com/recaptcha/enterprise.js";function se(t,r){var e=y(t);const a=new o;A(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:a}}));const n=le(t);e=P(!1);return e?he(t,r,e,n,a):function(e){const t=document.createElement("script");t.src=oe,t.onload=e,document.head.appendChild(t)}(()=>{var e=P(!1);if(!e)throw new Error("no recaptcha");he(t,r,e,n,a)}),a.promise}function ce(t,r){var e=y(t);const a=new o;A(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:a}}));const n=le(t);e=P(!0);return e?he(t,r,e,n,a):function(e){const t=document.createElement("script");t.src=ie,t.onload=e,document.head.appendChild(t)}(()=>{var e=P(!0);if(!e)throw new Error("no recaptcha");he(t,r,e,n,a)}),a.promise}function he(a,n,o,i,s){o.ready(()=>{var e,t,r;e=a,t=o.render(i,{sitekey:n,size:"invisible"}),r=y(e),A(e,Object.assign(Object.assign({},r),{reCAPTCHAState:Object.assign(Object.assign({},r.reCAPTCHAState),{widgetId:t})})),s.resolve(o)})}function le(e){var t=`fire_app_check_${e.name}`;const r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function pe(a){I(a);const n=await y(a).reCAPTCHAState.initialized.promise;return new Promise((e,t)=>{const r=y(a).reCAPTCHAState;n.ready(()=>{e(n.execute(r.widgetId,{action:"fire_app_check"}))})})}class ue{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){ve(this._throttleData);var t=await pe(this._app).catch(e=>{throw R.create("recaptcha-error")});let e;try{e=await N(function(e,t){var{projectId:r,appId:a,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${a}:exchangeRecaptchaToken?key=${n}`,body:{recaptcha_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){throw"fetch-status-error"===e.code?(this._throttleData=fe(Number(null===(t=e.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),R.create("throttled",{time:D(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):e}return this._throttleData=null,e}initialize(e){this._app=e,this._heartbeatServiceProvider=ye._getProvider(e,"heartbeat"),se(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof ue&&this._siteKey===e._siteKey}}class de{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){ve(this._throttleData);var t=await pe(this._app).catch(e=>{throw R.create("recaptcha-error")});let e;try{e=await N(function(e,t){var{projectId:r,appId:a,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${a}:exchangeRecaptchaEnterpriseToken?key=${n}`,body:{recaptcha_enterprise_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){throw"fetch-status-error"===e.code?(this._throttleData=fe(Number(null===(t=e.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),R.create("throttled",{time:D(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):e}return this._throttleData=null,e}initialize(e){this._app=e,this._heartbeatServiceProvider=ye._getProvider(e,"heartbeat"),ce(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof de&&this._siteKey===e._siteKey}}class ge{constructor(e){this._customProviderOptions=e}async getToken(){var e=await this._customProviderOptions.getToken(),t=u(e.token),t=null!==t&&t<Date.now()&&0<t?1e3*t:Date.now();return Object.assign(Object.assign({},e),{issuedAtTimeMillis:t})}initialize(e){this._app=e}isEqual(e){return e instanceof ge&&this._customProviderOptions.getToken.toString()===e._customProviderOptions.getToken.toString()}}function fe(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};var r,a,n=t?t.backoffCount:0,a=(t=2,r=1e3*Math.pow(t,n),a=Math.round(g*r*(Math.random()-.5)*2),Math.min(d,r+a));return{backoffCount:n+1,allowRequestsAfter:Date.now()+a,httpStatus:e}}function ve(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw R.create("throttled",{time:D(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function be(e=ye.getApp(),t){var r;e=(r=e)&&r._delegate?r._delegate:r;const a=ye._getProvider(e,"app-check");if(k.initialized||J(),G()&&X().then(e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)),a.isInitialized()){var n=a.getImmediate();const o=a.getOptions();if(o.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&o.provider.isEqual(t.provider))return n;throw R.create("already-initialized",{appName:e.name})}n=a.initialize({options:t});return function(t,e,r){const a=y(t),n=Object.assign(Object.assign({},a),{activated:!0});n.provider=e,n.cachedTokenPromise=z(t).then(e=>(e&&ae(e)&&(A(t,Object.assign(Object.assign({},y(t)),{token:e})),re(t,{token:e.token})),e)),n.isTokenAutoRefreshEnabled=void 0===r?t.automaticDataCollectionEnabled:r,A(t,n),n.provider.initialize(t)}(e,t.provider,t.isTokenAutoRefreshEnabled),y(e).isTokenAutoRefreshEnabled&&Q(n,"INTERNAL",()=>{}),n}const Ee="app-check-internal";ye._registerComponent(new f("app-check",e=>{var t,r=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat");return t=r,e=a,new ne(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(Ee).initialize()})),ye._registerComponent(new f(Ee,e=>{var t,r=e.getProvider("app-check").getImmediate();return t=r,{getToken:e=>Z(t,e),addTokenListener:e=>Q(t,"INTERNAL",e),removeTokenListener:e=>ee(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),ye.registerVersion("@firebase/app-check","0.5.6");const _e=new c("appCheck","AppCheck",{"use-before-activation":"App Check is being used before activate() is called for FirebaseApp {$appName}. Call activate() before instantiating other Firebase services."});class we{constructor(e){this.app=e}activate(e,t){let r;r="string"==typeof e?new ue(e):e instanceof de||e instanceof ue||e instanceof ge?e:new ge({getToken:e.getToken}),this._delegate=be(this.app,{provider:r,isTokenAutoRefreshEnabled:t})}setTokenAutoRefreshEnabled(e){if(!this._delegate)throw _e.create("use-before-activation",{appName:this.app.name});!function(e,t){var r=e.app;const a=y(r);a.tokenRefresher&&(!0===t?a.tokenRefresher.start():a.tokenRefresher.stop()),A(r,Object.assign(Object.assign({},a),{isTokenAutoRefreshEnabled:t}))}(this._delegate,e)}getToken(e){if(!this._delegate)throw _e.create("use-before-activation",{appName:this.app.name});return async function(e,t){var r=await Z(e,t);if(r.error)throw r.error;return{token:r.token}}(this._delegate,e)}onTokenChanged(e,t,r){if(!this._delegate)throw _e.create("use-before-activation",{appName:this.app.name});return function(e,t,r){let a=()=>{},n=()=>{};return a=null!=t.next?t.next.bind(t):t,null!=t.error?n=t.error.bind(t):r&&(n=r),Q(e,"EXTERNAL",a,n),()=>ee(e.app,a)}(this._delegate,e,t)}}const me=e=>{var t=e.getProvider("app-compat").getImmediate();return new we(t)};a.default.INTERNAL.registerComponent(new f("appCheck-compat",me,"PUBLIC").setServiceProps({ReCaptchaEnterpriseProvider:de,ReCaptchaV3Provider:ue,CustomProvider:ge})),a.default.registerVersion("@firebase/app-check-compat","0.2.6")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-app-check-compat.js - be sure to load firebase-app.js first.")}});
3
+ `)}function J(){var e=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.")}();const t=k;if(t.initialized=!0,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN||!0===e.FIREBASE_APPCHECK_DEBUG_TOKEN){t.enabled=!0;const r=new o;t.token=r,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?r.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):r.resolve(q())}}const Y={error:"UNKNOWN_ERROR"};async function Z(e,t=!1){var r=e.app;I(r);const a=y(r);let n=a.token,o=void 0;if(n||(s=await a.cachedTokenPromise)&&ae(s)&&(n=s),!t&&n&&ae(n))return{token:n.token};let i=!1;if(G()){a.exchangeTokenPromise||(a.exchangeTokenPromise=N(function(e,t){var{projectId:r,appId:a,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${a}:${C}?key=${n}`,body:{debug_token:t}}}(r,await X()),e.heartbeatServiceProvider).then(e=>(a.exchangeTokenPromise=void 0,e)),i=!0);var s=await a.exchangeTokenPromise;return await U(r,s),A(r,Object.assign(Object.assign({},a),{token:s})),{token:s.token}}try{a.exchangeTokenPromise||(a.exchangeTokenPromise=a.provider.getToken().then(e=>(a.exchangeTokenPromise=void 0,e)),i=!0),n=await a.exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code?K.warn(e.message):K.error(e),o=e}let c;return n?(c={token:n.token},A(r,Object.assign(Object.assign({},a),{token:n})),await U(r,n)):c=(e=o,{token:function(e){return h.encodeString(JSON.stringify(e),!1)}(Y),error:e}),i&&re(r,c),c}function Q(e,t,r,a){var n=e["app"];const o=y(n);var i={next:r,error:a,type:t};if(A(n,Object.assign(Object.assign({},o),{tokenObservers:[...o.tokenObservers,i]})),o.token&&ae(o.token)){const s=o.token;Promise.resolve().then(()=>{r({token:s.token}),te(e)}).catch(()=>{})}o.cachedTokenPromise.then(()=>te(e))}function ee(e,t){const r=y(e);var a=r.tokenObservers.filter(e=>e.next!==t);0===a.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),A(e,Object.assign(Object.assign({},r),{tokenObservers:a}))}function te(e){var t=e["app"],r=y(t);let a=r.tokenRefresher;a||(a=function(r){const a=r["app"];return new O(async()=>{var e=y(a);let t;if(t=e.token?await Z(r,!0):await Z(r),t.error)throw t.error},()=>!0,()=>{var e=y(a);if(e.token){var t=e.token.issuedAtTimeMillis+.5*(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)+3e5,e=e.token.expireTimeMillis-3e5,t=Math.min(t,e);return Math.max(0,t-Date.now())}return 0},S.RETRIAL_MIN_WAIT,S.RETRIAL_MAX_WAIT)}(e),A(t,Object.assign(Object.assign({},r),{tokenRefresher:a}))),!a.isRunning()&&r.isTokenAutoRefreshEnabled&&a.start()}function re(e,t){for(const r of y(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function ae(e){return 0<e.expireTimeMillis-Date.now()}class ne{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){var e=y(this.app)["tokenObservers"];for(const t of e)ee(this.app,t.next);return Promise.resolve()}}const oe="https://www.google.com/recaptcha/api.js",ie="https://www.google.com/recaptcha/enterprise.js";function se(t,r){var e=y(t);const a=new o;A(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:a}}));const n=le(t);e=P(!1);return e?he(t,r,e,n,a):function(e){const t=document.createElement("script");t.src=oe,t.onload=e,document.head.appendChild(t)}(()=>{var e=P(!1);if(!e)throw new Error("no recaptcha");he(t,r,e,n,a)}),a.promise}function ce(t,r){var e=y(t);const a=new o;A(t,Object.assign(Object.assign({},e),{reCAPTCHAState:{initialized:a}}));const n=le(t);e=P(!0);return e?he(t,r,e,n,a):function(e){const t=document.createElement("script");t.src=ie,t.onload=e,document.head.appendChild(t)}(()=>{var e=P(!0);if(!e)throw new Error("no recaptcha");he(t,r,e,n,a)}),a.promise}function he(a,n,o,i,s){o.ready(()=>{var e,t,r;e=a,t=o.render(i,{sitekey:n,size:"invisible"}),r=y(e),A(e,Object.assign(Object.assign({},r),{reCAPTCHAState:Object.assign(Object.assign({},r.reCAPTCHAState),{widgetId:t})})),s.resolve(o)})}function le(e){var t=`fire_app_check_${e.name}`;const r=document.createElement("div");return r.id=t,r.style.display="none",document.body.appendChild(r),t}async function pe(a){I(a);const n=await y(a).reCAPTCHAState.initialized.promise;return new Promise((e,t)=>{const r=y(a).reCAPTCHAState;n.ready(()=>{e(n.execute(r.widgetId,{action:"fire_app_check"}))})})}class ue{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){ve(this._throttleData);var t=await pe(this._app).catch(e=>{throw R.create("recaptcha-error")});let e;try{e=await N(function(e,t){var{projectId:r,appId:a,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${a}:exchangeRecaptchaV3Token?key=${n}`,body:{recaptcha_v3_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){throw"fetch-status-error"===e.code?(this._throttleData=fe(Number(null===(t=e.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),R.create("throttled",{time:D(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):e}return this._throttleData=null,e}initialize(e){this._app=e,this._heartbeatServiceProvider=ye._getProvider(e,"heartbeat"),se(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof ue&&this._siteKey===e._siteKey}}class de{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){ve(this._throttleData);var t=await pe(this._app).catch(e=>{throw R.create("recaptcha-error")});let e;try{e=await N(function(e,t){var{projectId:r,appId:a,apiKey:n}=e.options;return{url:`${T}/projects/${r}/apps/${a}:exchangeRecaptchaEnterpriseToken?key=${n}`,body:{recaptcha_enterprise_token:t}}}(this._app,t),this._heartbeatServiceProvider)}catch(e){throw"fetch-status-error"===e.code?(this._throttleData=fe(Number(null===(t=e.customData)||void 0===t?void 0:t.httpStatus),this._throttleData),R.create("throttled",{time:D(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):e}return this._throttleData=null,e}initialize(e){this._app=e,this._heartbeatServiceProvider=ye._getProvider(e,"heartbeat"),ce(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof de&&this._siteKey===e._siteKey}}class ge{constructor(e){this._customProviderOptions=e}async getToken(){var e=await this._customProviderOptions.getToken(),t=u(e.token),t=null!==t&&t<Date.now()&&0<t?1e3*t:Date.now();return Object.assign(Object.assign({},e),{issuedAtTimeMillis:t})}initialize(e){this._app=e}isEqual(e){return e instanceof ge&&this._customProviderOptions.getToken.toString()===e._customProviderOptions.getToken.toString()}}function fe(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};var r,a,n=t?t.backoffCount:0,a=(t=2,r=1e3*Math.pow(t,n),a=Math.round(g*r*(Math.random()-.5)*2),Math.min(d,r+a));return{backoffCount:n+1,allowRequestsAfter:Date.now()+a,httpStatus:e}}function ve(e){if(e&&Date.now()-e.allowRequestsAfter<=0)throw R.create("throttled",{time:D(e.allowRequestsAfter-Date.now()),httpStatus:e.httpStatus})}function be(e=ye.getApp(),t){var r;e=(r=e)&&r._delegate?r._delegate:r;const a=ye._getProvider(e,"app-check");if(k.initialized||J(),G()&&X().then(e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)),a.isInitialized()){var n=a.getImmediate();const o=a.getOptions();if(o.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&o.provider.isEqual(t.provider))return n;throw R.create("already-initialized",{appName:e.name})}n=a.initialize({options:t});return function(t,e,r){const a=y(t),n=Object.assign(Object.assign({},a),{activated:!0});n.provider=e,n.cachedTokenPromise=z(t).then(e=>(e&&ae(e)&&(A(t,Object.assign(Object.assign({},y(t)),{token:e})),re(t,{token:e.token})),e)),n.isTokenAutoRefreshEnabled=void 0===r?t.automaticDataCollectionEnabled:r,A(t,n),n.provider.initialize(t)}(e,t.provider,t.isTokenAutoRefreshEnabled),y(e).isTokenAutoRefreshEnabled&&Q(n,"INTERNAL",()=>{}),n}const Ee="app-check-internal";ye._registerComponent(new f("app-check",e=>{var t,r=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat");return t=r,e=a,new ne(t,e)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(Ee).initialize()})),ye._registerComponent(new f(Ee,e=>{var t,r=e.getProvider("app-check").getImmediate();return t=r,{getToken:e=>Z(t,e),addTokenListener:e=>Q(t,"INTERNAL",e),removeTokenListener:e=>ee(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),ye.registerVersion("@firebase/app-check","0.5.7");const _e=new c("appCheck","AppCheck",{"use-before-activation":"App Check is being used before activate() is called for FirebaseApp {$appName}. Call activate() before instantiating other Firebase services."});class we{constructor(e){this.app=e}activate(e,t){let r;r="string"==typeof e?new ue(e):e instanceof de||e instanceof ue||e instanceof ge?e:new ge({getToken:e.getToken}),this._delegate=be(this.app,{provider:r,isTokenAutoRefreshEnabled:t})}setTokenAutoRefreshEnabled(e){if(!this._delegate)throw _e.create("use-before-activation",{appName:this.app.name});!function(e,t){var r=e.app;const a=y(r);a.tokenRefresher&&(!0===t?a.tokenRefresher.start():a.tokenRefresher.stop()),A(r,Object.assign(Object.assign({},a),{isTokenAutoRefreshEnabled:t}))}(this._delegate,e)}getToken(e){if(!this._delegate)throw _e.create("use-before-activation",{appName:this.app.name});return async function(e,t){var r=await Z(e,t);if(r.error)throw r.error;return{token:r.token}}(this._delegate,e)}onTokenChanged(e,t,r){if(!this._delegate)throw _e.create("use-before-activation",{appName:this.app.name});return function(e,t,r){let a=()=>{},n=()=>{};return a=null!=t.next?t.next.bind(t):t,null!=t.error?n=t.error.bind(t):r&&(n=r),Q(e,"EXTERNAL",a,n),()=>ee(e.app,a)}(this._delegate,e,t)}}const me=e=>{var t=e.getProvider("app-compat").getImmediate();return new we(t)};a.default.INTERNAL.registerComponent(new f("appCheck-compat",me,"PUBLIC").setServiceProps({ReCaptchaEnterpriseProvider:de,ReCaptchaV3Provider:ue,CustomProvider:ge})),a.default.registerVersion("@firebase/app-check-compat","0.2.7")}).apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-app-check-compat.js - be sure to load firebase-app.js first.")}});
4
4
  //# sourceMappingURL=firebase-app-check-compat.js.map