@thefittingroom/sdk 0.0.13 → 1.0.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.
@@ -1,7 +1,8 @@
1
1
  /*!
2
- * thefittingroom v0.0.11 (2023-11-21T18:22:57.333Z)
2
+ * thefittingroom v0.0.14 (2024-02-15T22:20:33.087Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
+ var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
5
6
  /**
6
7
  * @license
7
8
  * Copyright 2017 Google LLC
@@ -34,7 +35,7 @@
34
35
  * See the License for the specific language governing permissions and
35
36
  * limitations under the License.
36
37
  */
37
- const e=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},t={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,o=i?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,n){return this.HAS_NATIVE_SUPPORT&&!n?btoa(t):this.encodeByteArray(e(t),n)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const s=n[e.charAt(t++)],i=t<e.length?n[e.charAt(t)]:0;++t;const o=t<e.length?n[e.charAt(t)]:64;++t;const a=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==i||null==o||null==a)throw Error();const c=s<<2|i>>4;if(r.push(c),64!==o){const e=i<<4&240|o>>2;if(r.push(e),64!==a){const e=o<<6&192|a;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.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)}}},n=function(n){return function(n){const r=e(n);return t.encodeByteArray(r,!0)}(n).replace(/\./g,"")},r=function(e){try{return t.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
38
+ const n=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++r)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const s=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(n(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const s=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==s||null==i||null==o||null==a)throw Error();const c=s<<2|i>>4;if(r.push(c),64!==o){const t=i<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},s=function(t){return function(t){const e=n(t);return r.encodeByteArray(e,!0)}(t).replace(/\./g,"")},i=function(t){try{return r.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
38
39
  /**
39
40
  * @license
40
41
  * Copyright 2017 Google LLC
@@ -51,7 +52,7 @@ const e=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charC
51
52
  * See the License for the specific language governing permissions and
52
53
  * limitations under the License.
53
54
  */
54
- function s(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}
55
+ function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}
55
56
  /**
56
57
  * @license
57
58
  * Copyright 2022 Google LLC
@@ -68,7 +69,7 @@ function s(){return"undefined"!=typeof navigator&&"string"==typeof navigator.use
68
69
  * See the License for the specific language governing permissions and
69
70
  * limitations under the License.
70
71
  */
71
- const i=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,o=()=>{try{return i()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&r(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},a=e=>{var t,n;return null===(n=null===(t=o())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},c=e=>{var t;return null===(t=o())||void 0===t?void 0:t[`_${e}`]};
72
+ const a=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,c=()=>{try{return a()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&i(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},u=t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]},h=t=>{var e;return null===(e=c())||void 0===e?void 0:e[`_${t}`]};
72
73
  /**
73
74
  * @license
74
75
  * Copyright 2017 Google LLC
@@ -85,7 +86,7 @@ const i=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=t
85
86
  * See the License for the specific language governing permissions and
86
87
  * limitations under the License.
87
88
  */
88
- class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}
89
+ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch((()=>{})),1===t.length?t(e):t(e,n))}}}
89
90
  /**
90
91
  * @license
91
92
  * Copyright 2021 Google LLC
@@ -101,7 +102,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
101
102
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
102
103
  * See the License for the specific language governing permissions and
103
104
  * limitations under the License.
104
- */class h extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,l.prototype.create)}}class l{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],i=s?function(e,t){return e.replace(d,((e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new h(r,o,n)}}const d=/\{\$([^}]+)}/g;function f(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const n=e[s],i=t[s];if(p(n)&&p(i)){if(!f(n,i))return!1}else if(n!==i)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function p(e){return null!==e&&"object"==typeof e}
105
+ */class d extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,d.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,f.prototype.create)}}class f{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(p,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new d(r,o,n)}}const p=/\{\$([^}]+)}/g;function g(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const n=t[s],i=e[s];if(m(n)&&m(i)){if(!g(n,i))return!1}else if(n!==i)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function m(t){return null!==t&&"object"==typeof t}
105
106
  /**
106
107
  * @license
107
108
  * Copyright 2017 Google LLC
@@ -117,7 +118,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
117
118
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
118
119
  * See the License for the specific language governing permissions and
119
120
  * limitations under the License.
120
- */function g(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 m(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}})),t}function y(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class v{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((()=>{e(this)})).catch((e=>{this.error(e)}))}next(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}complete(){this.forEachObserver((e=>{e.complete()})),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const 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=w),void 0===r.error&&(r.error=w),void 0===r.complete&&(r.complete=w);const s=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),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}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 w(){}
121
+ */function y(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function v(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function w(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class _{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=T),void 0===r.error&&(r.error=T),void 0===r.complete&&(r.complete=T);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),s}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,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(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function T(){}
121
122
  /**
122
123
  * @license
123
124
  * Copyright 2021 Google LLC
@@ -133,7 +134,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
133
134
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134
135
  * See the License for the specific language governing permissions and
135
136
  * limitations under the License.
136
- */function I(e){return e&&e._delegate?e._delegate:e}class b{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}}
137
+ */function I(t){return t&&t._delegate?t._delegate:t}class E{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
137
138
  /**
138
139
  * @license
139
140
  * Copyright 2019 Google LLC
@@ -149,7 +150,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
149
150
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
150
151
  * See the License for the specific language governing permissions and
151
152
  * limitations under the License.
152
- */const T="[DEFAULT]";
153
+ */const S="[DEFAULT]";
153
154
  /**
154
155
  * @license
155
156
  * Copyright 2019 Google LLC
@@ -165,7 +166,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
165
166
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
166
167
  * See the License for the specific language governing permissions and
167
168
  * limitations under the License.
168
- */class E{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new u;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
169
+ */class b{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new l;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
169
170
  /**
170
171
  * @license
171
172
  * Copyright 2019 Google LLC
@@ -181,7 +182,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
181
182
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
182
183
  * See the License for the specific language governing permissions and
183
184
  * limitations under the License.
184
- */(e))try{this.getOrInitializeService({instanceIdentifier:T})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=T){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=T){return this.instances.has(e)}getOptions(e=T){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(r)}return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===T?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=T){return this.component?this.component.multipleInstances?e:T:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class _{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new E(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
185
+ */(t))try{this.getOrInitializeService({instanceIdentifier:S})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=S){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=S){return this.instances.has(t)}getOptions(t=S){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(r)}return r}onInit(t,e){var n;const r=this.normalizeInstanceIdentifier(e),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(t),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&t(i,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const r of n)try{r(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===S?void 0:r),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var r;return n||null}normalizeInstanceIdentifier(t=S){return this.component?this.component.multipleInstances?t:S:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class A{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new b(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
185
186
  /**
186
187
  * @license
187
188
  * Copyright 2017 Google LLC
@@ -197,7 +198,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
197
198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198
199
  * See the License for the specific language governing permissions and
199
200
  * limitations under the License.
200
- */var S;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(S||(S={}));const C={debug:S.DEBUG,verbose:S.VERBOSE,info:S.INFO,warn:S.WARN,error:S.ERROR,silent:S.SILENT},A=S.INFO,k={[S.DEBUG]:"log",[S.VERBOSE]:"log",[S.INFO]:"info",[S.WARN]:"warn",[S.ERROR]:"error"},N=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=k[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}] ${e.name}:`,...n)};class D{constructor(e){this.name=e,this._logLevel=A,this._logHandler=N,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in S))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?C[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,S.DEBUG,...e),this._logHandler(this,S.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,S.VERBOSE,...e),this._logHandler(this,S.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,S.INFO,...e),this._logHandler(this,S.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,S.WARN,...e),this._logHandler(this,S.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,S.ERROR,...e),this._logHandler(this,S.ERROR,...e)}}let R,O;const L=new WeakMap,P=new WeakMap,M=new WeakMap,x=new WeakMap,U=new WeakMap;let F={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return P.get(e);if("objectStoreNames"===t)return e.objectStoreNames||M.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return j(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function V(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(O||(O=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(B(this),t),j(L.get(this))}:function(...t){return j(e.apply(B(this),t))}:function(t,...n){const r=e.call(B(this),t,...n);return M.set(r,t.sort?t.sort():[t]),j(r)}}function q(e){return"function"==typeof e?V(e):(e instanceof IDBTransaction&&function(e){if(P.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)}));P.set(e,t)}(e),t=e,(R||(R=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,F):e);var t}function j(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{t(j(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",s),e.addEventListener("error",i)}));return t.then((t=>{t instanceof IDBCursor&&L.set(t,e)})).catch((()=>{})),U.set(t,e),t}(e);if(x.has(e))return x.get(e);const t=q(e);return t!==e&&(x.set(e,t),U.set(t,e)),t}const B=e=>U.get(e);const z=["get","getKey","getAll","getAllKeys","count"],$=["put","add","delete","clear"],K=new Map;function H(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(K.get(t))return K.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=$.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!z.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),s&&i.done]))[0]};return K.set(t,i),i}F=(e=>({...e,get:(t,n,r)=>H(t,n)||e.get(t,n,r),has:(t,n)=>!!H(t,n)||e.has(t,n)}))(F);
201
+ */var C;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(C||(C={}));const k={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},N=C.INFO,R={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=R[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class O{constructor(t){this.name=t,this._logLevel=N,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in C))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?k[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,C.DEBUG,...t),this._logHandler(this,C.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...t),this._logHandler(this,C.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,C.INFO,...t),this._logHandler(this,C.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,C.WARN,...t),this._logHandler(this,C.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...t),this._logHandler(this,C.ERROR,...t)}}let L,P;const M=new WeakMap,x=new WeakMap,U=new WeakMap,F=new WeakMap,V=new WeakMap;let B={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return x.get(t);if("objectStoreNames"===e)return t.objectStoreNames||U.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return q(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function j(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(P||(P=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),q(M.get(this))}:function(...e){return q(t.apply(K(this),e))}:function(e,...n){const r=t.call(K(this),e,...n);return U.set(r,e.sort?e.sort():[e]),q(r)}}function H(t){return"function"==typeof t?j(t):(t instanceof IDBTransaction&&function(t){if(x.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)}));x.set(t,e)}(t),e=t,(L||(L=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,B):t);var e}function q(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(q(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&M.set(e,t)})).catch((()=>{})),V.set(e,t),e}(t);if(F.has(t))return F.get(t);const e=H(t);return e!==t&&(F.set(t,e),V.set(e,t)),e}const K=t=>V.get(t);const W=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],$=new Map;function G(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if($.get(e))return $.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!W.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return $.set(e,i),i}B=(t=>({...t,get:(e,n,r)=>G(e,n)||t.get(e,n,r),has:(e,n)=>!!G(e,n)||t.has(e,n)}))(B);
201
202
  /**
202
203
  * @license
203
204
  * Copyright 2019 Google LLC
@@ -214,7 +215,7 @@ class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
214
215
  * See the License for the specific language governing permissions and
215
216
  * limitations under the License.
216
217
  */
217
- class G{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const W="@firebase/app",Q="0.9.0",Y=new D("@firebase/app"),X="[DEFAULT]",J={[W]:"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"},Z=new Map,ee=new Map;function te(e,t){try{e.container.addComponent(t)}catch(n){Y.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function ne(e){const t=e.name;if(ee.has(t))return Y.debug(`There were multiple attempts to register component ${t}.`),!1;ee.set(t,e);for(const t of Z.values())te(t,e);return!0}function re(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}
218
+ class Q{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const J="@firebase/app",Y="0.9.0",X=new O("@firebase/app"),Z="[DEFAULT]",tt={[J]:"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"},et=new Map,nt=new Map;function rt(t,e){try{t.container.addComponent(e)}catch(n){X.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function st(t){const e=t.name;if(nt.has(e))return X.debug(`There were multiple attempts to register component ${e}.`),!1;nt.set(e,t);for(const e of et.values())rt(e,t);return!0}function it(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
218
219
  /**
219
220
  * @license
220
221
  * Copyright 2019 Google LLC
@@ -230,7 +231,7 @@ class G{constructor(e){this.container=e}getPlatformInfoString(){return this.cont
230
231
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
231
232
  * See the License for the specific language governing permissions and
232
233
  * limitations under the License.
233
- */const se=new l("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","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}."});
234
+ */const ot=new f("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","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}."});
234
235
  /**
235
236
  * @license
236
237
  * Copyright 2019 Google LLC
@@ -247,7 +248,7 @@ class G{constructor(e){this.container=e}getPlatformInfoString(){return this.cont
247
248
  * See the License for the specific language governing permissions and
248
249
  * limitations under the License.
249
250
  */
250
- class ie{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 b("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 se.create("app-deleted",{appName:this._name})}}
251
+ class at{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new E("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}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(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw ot.create("app-deleted",{appName:this._name})}}
251
252
  /**
252
253
  * @license
253
254
  * Copyright 2019 Google LLC
@@ -263,7 +264,7 @@ class ie{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
263
264
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
264
265
  * See the License for the specific language governing permissions and
265
266
  * limitations under the License.
266
- */const oe="9.15.0";function ae(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:X,automaticDataCollectionEnabled:!1},t),s=r.name;if("string"!=typeof s||!s)throw se.create("bad-app-name",{appName:String(s)});if(n||(n=(()=>{var e;return null===(e=o())||void 0===e?void 0:e.config})()),!n)throw se.create("no-options");const i=Z.get(s);if(i){if(f(n,i.options)&&f(r,i.config))return i;throw se.create("duplicate-app",{appName:s})}const a=new _(s);for(const e of ee.values())a.addComponent(e);const c=new ie(n,r,a);return Z.set(s,c),c}function ce(e=X){const t=Z.get(e);if(!t&&e===X)return ae();if(!t)throw se.create("no-app",{appName:e});return t}function ue(e,t,n){var r;let s=null!==(r=J[e])&&void 0!==r?r:e;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${s}" with version "${t}":`];return i&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void Y.warn(e.join(" "))}ne(new b(`${s}-version`,(()=>({library:s,version:t})),"VERSION"))}
267
+ */const ct="9.15.0";function ut(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:Z,automaticDataCollectionEnabled:!1},e),s=r.name;if("string"!=typeof s||!s)throw ot.create("bad-app-name",{appName:String(s)});if(n||(n=(()=>{var t;return null===(t=c())||void 0===t?void 0:t.config})()),!n)throw ot.create("no-options");const i=et.get(s);if(i){if(g(n,i.options)&&g(r,i.config))return i;throw ot.create("duplicate-app",{appName:s})}const o=new A(s);for(const t of nt.values())o.addComponent(t);const a=new at(n,r,o);return et.set(s,a),a}function ht(t=Z){const e=et.get(t);if(!e&&t===Z)return ut();if(!e)throw ot.create("no-app",{appName:t});return e}function lt(t,e,n){var r;let s=null!==(r=tt[t])&&void 0!==r?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const t=[`Unable to register library "${s}" with version "${e}":`];return i&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void X.warn(t.join(" "))}st(new E(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
267
268
  /**
268
269
  * @license
269
270
  * Copyright 2021 Google LLC
@@ -279,7 +280,7 @@ class ie{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
279
280
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
280
281
  * See the License for the specific language governing permissions and
281
282
  * limitations under the License.
282
- */const he="firebase-heartbeat-store";let le=null;function de(){return le||(le=function(e,t,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(e,t),a=j(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(j(o.result),e.oldVersion,e.newVersion,j(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),a.then((e=>{i&&e.addEventListener("close",(()=>i())),s&&e.addEventListener("versionchange",(()=>s()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(he)}}).catch((e=>{throw se.create("idb-open",{originalErrorMessage:e.message})}))),le}async function fe(e,t){try{const n=(await de()).transaction(he,"readwrite"),r=n.objectStore(he);return await r.put(t,pe(e)),n.done}catch(e){if(e instanceof h)Y.warn(e.message);else{const t=se.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});Y.warn(t.message)}}}function pe(e){return`${e.name}!${e.options.appId}`}
283
+ */const dt="firebase-heartbeat-store";let ft=null;function pt(){return ft||(ft=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=q(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(q(o.result),t.oldVersion,t.newVersion,q(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(()=>s()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(dt)}}).catch((t=>{throw ot.create("idb-open",{originalErrorMessage:t.message})}))),ft}async function gt(t,e){try{const n=(await pt()).transaction(dt,"readwrite"),r=n.objectStore(dt);return await r.put(e,mt(t)),n.done}catch(t){if(t instanceof d)X.warn(t.message);else{const e=ot.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});X.warn(e.message)}}}function mt(t){return`${t.name}!${t.options.appId}`}
283
284
  /**
284
285
  * @license
285
286
  * Copyright 2021 Google LLC
@@ -295,7 +296,7 @@ class ie{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
295
296
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
296
297
  * See the License for the specific language governing permissions and
297
298
  * limitations under the License.
298
- */class ge{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new ye(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=me();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=me(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find((e=>e.agent===s.agent));if(e){if(e.dates.push(s.date),ve(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),ve(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=n(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}}function me(){return(new Date).toISOString().substring(0,10)}class ye{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(e){try{return(await de()).transaction(he).objectStore(he).get(pe(e))}catch(e){if(e instanceof h)Y.warn(e.message);else{const t=se.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});Y.warn(t.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return fe(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return fe(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function ve(e){return n(JSON.stringify({version:2,heartbeats:e})).length}
299
+ */class yt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new wt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=vt();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==e&&!this._heartbeatsCache.heartbeats.some((t=>t.date===e)))return this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=vt(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let r=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),_t(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),_t(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=s(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function vt(){return(new Date).toISOString().substring(0,10)}class wt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){return await async function(t){try{return(await pt()).transaction(dt).objectStore(dt).get(mt(t))}catch(t){if(t instanceof d)X.warn(t.message);else{const e=ot.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});X.warn(e.message)}}}(this.app)||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return gt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function _t(t){return s(JSON.stringify({version:2,heartbeats:t})).length}
299
300
  /**
300
301
  * @license
301
302
  * Copyright 2019 Google LLC
@@ -311,7 +312,7 @@ class ie{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
311
312
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
312
313
  * See the License for the specific language governing permissions and
313
314
  * limitations under the License.
314
- */var we;we="",ne(new b("platform-logger",(e=>new G(e)),"PRIVATE")),ne(new b("heartbeat",(e=>new ge(e)),"PRIVATE")),ue(W,Q,we),ue(W,Q,"esm2017"),ue("fire-js","");var Ie=function(e,t){return Ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Ie(e,t)};function be(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Te(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,s,i=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(e){s={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var Ee,_e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Se=Se||{},Ce=_e||self;function Ae(){}function ke(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function Ne(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}var De="closure_uid_"+(1e9*Math.random()>>>0),Re=0;function Oe(e,t,n){return e.call.apply(e.bind,arguments)}function Le(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function Pe(e,t,n){return(Pe=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Oe:Le).apply(null,arguments)}function Me(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function xe(e,t){function n(){}n.prototype=t.prototype,e.X=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Wb=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}function Ue(){this.s=this.s,this.o=this.o}Ue.prototype.s=!1,Ue.prototype.na=function(){var e;!this.s&&(this.s=!0,this.M(),0)&&(e=this,Object.prototype.hasOwnProperty.call(e,De)&&e[De]||(e[De]=++Re))},Ue.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Fe=Array.prototype.indexOf?function(e,t){return Array.prototype.indexOf.call(e,t,void 0)}:function(e,t){if("string"==typeof e)return"string"!=typeof t||1!=t.length?-1:e.indexOf(t,0);for(var n=0;n<e.length;n++)if(n in e&&e[n]===t)return n;return-1};function Ve(e){var t=e.length;if(0<t){for(var n=Array(t),r=0;r<t;r++)n[r]=e[r];return n}return[]}function qe(e,t){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(ke(r)){var s=e.length||0,i=r.length||0;e.length=s+i;for(var o=0;o<i;o++)e[s+o]=r[o]}else e.push(r)}}function je(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}je.prototype.h=function(){this.defaultPrevented=!0};var Be=function(){if(!Ce.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{Ce.addEventListener("test",Ae,t),Ce.removeEventListener("test",Ae,t)}catch(e){}return e}();function ze(e){return/^[\s\xa0]*$/.test(e)}var $e=String.prototype.trim?function(e){return e.trim()}:function(e){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(e)[1]};function Ke(e,t){return e<t?-1:e>t?1:0}function He(){var e=Ce.navigator;return e&&(e=e.userAgent)?e:""}function Ge(e){return-1!=He().indexOf(e)}function We(e){return We[" "](e),e}We[" "]=Ae;var Qe,Ye,Xe=Ge("Opera"),Je=Ge("Trident")||Ge("MSIE"),Ze=Ge("Edge"),et=Ze||Je,tt=Ge("Gecko")&&!(-1!=He().toLowerCase().indexOf("webkit")&&!Ge("Edge"))&&!(Ge("Trident")||Ge("MSIE"))&&!Ge("Edge"),nt=-1!=He().toLowerCase().indexOf("webkit")&&!Ge("Edge");function rt(){var e=Ce.document;return e?e.documentMode:void 0}e:{var st="",it=(Ye=He(),tt?/rv:([^\);]+)(\)|;)/.exec(Ye):Ze?/Edge\/([\d\.]+)/.exec(Ye):Je?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ye):nt?/WebKit\/(\S+)/.exec(Ye):Xe?/(?:Version)[ \/]?(\S+)/.exec(Ye):void 0);if(it&&(st=it?it[1]:""),Je){var ot=rt();if(null!=ot&&ot>parseFloat(st)){Qe=String(ot);break e}}Qe=st}var at,ct={};function ut(){return function(e){var t=ct;return Object.prototype.hasOwnProperty.call(t,9)?t[9]:t[9]=e(9)}((function(){for(var e=0,t=$e(String(Qe)).split("."),n=$e("9").split("."),r=Math.max(t.length,n.length),s=0;0==e&&s<r;s++){var i=t[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;e=Ke(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||Ke(0==i[2].length,0==o[2].length)||Ke(i[2],o[2]),i=i[3],o=o[3]}while(0==e)}return 0<=e}))}if(Ce.document&&Je){var ht=rt();at=ht||(parseInt(Qe,10)||void 0)}else at=void 0;var lt=at;function dt(e,t){if(je.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(tt){e:{try{We(t.nodeName);var s=!0;break e}catch(e){}s=!1}s||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:ft[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&dt.X.h.call(this)}}xe(dt,je);var ft={2:"touch",3:"pen",4:"mouse"};dt.prototype.h=function(){dt.X.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var pt="closure_listenable_"+(1e6*Math.random()|0),gt=0;function mt(e,t,n,r,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=s,this.key=++gt,this.ba=this.ea=!1}function yt(e){e.ba=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function vt(e,t,n){for(var r in e)t.call(n,e[r],r,e)}function wt(e){var t={};for(var n in e)t[n]=e[n];return t}var It="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function bt(e,t){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])e[n]=r[n];for(var i=0;i<It.length;i++)n=It[i],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function Tt(e){this.src=e,this.g={},this.h=0}function Et(e,t){var n=t.type;if(n in e.g){var r,s=e.g[n],i=Fe(s,t);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(yt(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function _t(e,t,n,r){for(var s=0;s<e.length;++s){var i=e[s];if(!i.ba&&i.listener==t&&i.capture==!!n&&i.ha==r)return s}return-1}Tt.prototype.add=function(e,t,n,r,s){var i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);var o=_t(e,t,r,s);return-1<o?(t=e[o],n||(t.ea=!1)):((t=new mt(t,this.src,i,!!r,s)).ea=n,e.push(t)),t};var St="closure_lm_"+(1e6*Math.random()|0),Ct={};function At(e,t,n,r,s){if(r&&r.once)return Nt(e,t,n,r,s);if(Array.isArray(t)){for(var i=0;i<t.length;i++)At(e,t[i],n,r,s);return null}return n=xt(n),e&&e[pt]?e.N(t,n,Ne(r)?!!r.capture:!!r,s):kt(e,t,n,!1,r,s)}function kt(e,t,n,r,s,i){if(!t)throw Error("Invalid event type");var o=Ne(s)?!!s.capture:!!s,a=Pt(e);if(a||(e[St]=a=new Tt(e)),(n=a.add(t,n,r,o,i)).proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}var t=Lt;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)Be||(s=o),void 0===s&&(s=!1),e.addEventListener(t.toString(),r,s);else if(e.attachEvent)e.attachEvent(Ot(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}function Nt(e,t,n,r,s){if(Array.isArray(t)){for(var i=0;i<t.length;i++)Nt(e,t[i],n,r,s);return null}return n=xt(n),e&&e[pt]?e.O(t,n,Ne(r)?!!r.capture:!!r,s):kt(e,t,n,!0,r,s)}function Dt(e,t,n,r,s){if(Array.isArray(t))for(var i=0;i<t.length;i++)Dt(e,t[i],n,r,s);else r=Ne(r)?!!r.capture:!!r,n=xt(n),e&&e[pt]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=_t(i=e.g[t],n,r,s))&&(yt(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete e.g[t],e.h--)))):e&&(e=Pt(e))&&(t=e.g[t.toString()],e=-1,t&&(e=_t(t,n,r,s)),(n=-1<e?t[e]:null)&&Rt(n))}function Rt(e){if("number"!=typeof e&&e&&!e.ba){var t=e.src;if(t&&t[pt])Et(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Ot(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Pt(t))?(Et(n,e),0==n.h&&(n.src=null,t[St]=null)):yt(e)}}}function Ot(e){return e in Ct?Ct[e]:Ct[e]="on"+e}function Lt(e,t){if(e.ba)e=!0;else{t=new dt(t,this);var n=e.listener,r=e.ha||e.src;e.ea&&Rt(e),e=n.call(r,t)}return e}function Pt(e){return(e=e[St])instanceof Tt?e:null}var Mt="__closure_events_fn_"+(1e9*Math.random()>>>0);function xt(e){return"function"==typeof e?e:(e[Mt]||(e[Mt]=function(t){return e.handleEvent(t)}),e[Mt])}function Ut(){Ue.call(this),this.i=new Tt(this),this.P=this,this.I=null}function Ft(e,t){var n,r=e.I;if(r)for(n=[];r;r=r.I)n.push(r);if(e=e.P,r=t.type||t,"string"==typeof t)t=new je(t,e);else if(t instanceof je)t.target=t.target||e;else{var s=t;bt(t=new je(r,e),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=t.g=n[i];s=Vt(o,r,!0,t)&&s}if(s=Vt(o=t.g=e,r,!0,t)&&s,s=Vt(o,r,!1,t)&&s,n)for(i=0;i<n.length;i++)s=Vt(o=t.g=n[i],r,!1,t)&&s}function Vt(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var s=!0,i=0;i<t.length;++i){var o=t[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Et(e.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}xe(Ut,Ue),Ut.prototype[pt]=!0,Ut.prototype.removeEventListener=function(e,t,n,r){Dt(this,e,t,n,r)},Ut.prototype.M=function(){if(Ut.X.M.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)yt(n[r]);delete t.g[e],t.h--}}this.I=null},Ut.prototype.N=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},Ut.prototype.O=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};var qt=Ce.JSON.stringify;function jt(){var e=Qt,t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var Bt,zt=function(){function e(){this.h=this.g=null}return e.prototype.add=function(e,t){var n=$t.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n},e}(),$t=new(function(){function e(e,t){this.i=e,this.j=t,this.h=0,this.g=null}return e.prototype.get=function(){var e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e},e}())((function(){return new Kt}),(function(e){return e.reset()})),Kt=function(){function e(){this.next=this.g=this.h=null}return e.prototype.set=function(e,t){this.h=e,this.g=t,this.next=null},e.prototype.reset=function(){this.next=this.g=this.h=null},e}();function Ht(e){Ce.setTimeout((function(){throw e}),0)}function Gt(e,t){Bt||function(){var e=Ce.Promise.resolve(void 0);Bt=function(){e.then(Yt)}}(),Wt||(Bt(),Wt=!0),Qt.add(e,t)}var Wt=!1,Qt=new zt;function Yt(){for(var e;e=jt();){try{e.h.call(e.g)}catch(e){Ht(e)}var t=$t;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}Wt=!1}function Xt(e,t){Ut.call(this),this.h=e||1,this.g=t||Ce,this.j=Pe(this.lb,this),this.l=Date.now()}function Jt(e){e.ca=!1,e.R&&(e.g.clearTimeout(e.R),e.R=null)}function Zt(e,t,n){if("function"==typeof e)n&&(e=Pe(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=Pe(e.handleEvent,e)}return 2147483647<Number(t)?-1:Ce.setTimeout(e,t||0)}function en(e){e.g=Zt((function(){e.g=null,e.i&&(e.i=!1,en(e))}),e.j);var t=e.h;e.h=null,e.m.apply(null,t)}xe(Xt,Ut),(Ee=Xt.prototype).ca=!1,Ee.R=null,Ee.lb=function(){if(this.ca){var e=Date.now()-this.l;0<e&&e<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-e):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Ft(this,"tick"),this.ca&&(Jt(this),this.start()))}},Ee.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},Ee.M=function(){Xt.X.M.call(this),Jt(this),delete this.g};var tn=function(e){function t(t,n){var r=e.call(this)||this;return r.m=t,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Ie(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t.prototype.l=function(e){this.h=arguments,this.g?this.i=!0:en(this)},t.prototype.M=function(){e.prototype.M.call(this),this.g&&(Ce.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},t}(Ue);function nn(e){Ue.call(this),this.h=e,this.g={}}xe(nn,Ue);var rn=[];function sn(e,t,n,r){Array.isArray(n)||(n&&(rn[0]=n.toString()),n=rn);for(var s=0;s<n.length;s++){var i=At(t,n[s],r||e.handleEvent,!1,e.h||e);if(!i)break;e.g[i.key]=i}}function on(e){vt(e.g,(function(e,t){this.g.hasOwnProperty(t)&&Rt(e)}),e),e.g={}}function an(){this.g=!0}function cn(e,t,n,r){e.info((function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return qt(n)}catch(e){return t}}(e,n)+(r?" "+r:"")}))}nn.prototype.M=function(){nn.X.M.call(this),on(this)},nn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},an.prototype.Aa=function(){this.g=!1},an.prototype.info=function(){};var un={},hn=null;function ln(){return hn=hn||new Ut}function dn(e){je.call(this,un.Pa,e)}function fn(e){var t=ln();Ft(t,new dn(t))}function pn(e,t){je.call(this,un.STAT_EVENT,e),this.stat=t}function gn(e){var t=ln();Ft(t,new pn(t,e))}function mn(e,t){je.call(this,un.Qa,e),this.size=t}function yn(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return Ce.setTimeout((function(){e()}),t)}un.Pa="serverreachability",xe(dn,je),un.STAT_EVENT="statevent",xe(pn,je),un.Qa="timingevent",xe(mn,je);var vn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},wn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function bn(e){return e.h||(e.h=e.i())}function Tn(){}In.prototype.h=null;var En,_n={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Sn(){je.call(this,"d")}function Cn(){je.call(this,"c")}function An(){}function kn(e,t,n,r){this.l=e,this.j=t,this.m=n,this.U=r||1,this.S=new nn(this),this.O=Dn,e=et?125:void 0,this.T=new Xt(e),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Nn}function Nn(){this.i=null,this.g="",this.h=!1}xe(Sn,je),xe(Cn,je),xe(An,In),An.prototype.g=function(){return new XMLHttpRequest},An.prototype.i=function(){return{}},En=new An;var Dn=45e3,Rn={},On={};function Ln(e,t,n){e.K=1,e.v=Jn(Gn(t)),e.s=n,e.P=!0,Pn(e,null)}function Pn(e,t){e.F=Date.now(),Fn(e),e.A=Gn(e.v);var n=e.A,r=e.U;Array.isArray(r)||(r=[String(r)]),lr(n.i,"t",r),e.C=0,n=e.l.H,e.h=new Nn,e.g=ls(e.l,n?t:null,!e.s),0<e.N&&(e.L=new tn(Pe(e.La,e,e.g),e.N)),sn(e.S,e.g,"readystatechange",e.ib),t=e.H?wt(e.H):{},e.s?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.da(e.A,e.u,e.s,t)):(e.u="GET",e.g.da(e.A,e.u,null,t)),fn(),function(e,t,n,r,s,i){e.info((function(){if(e.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+t+"\n"+n+"\n"+o}))}(e.j,e.u,e.A,e.m,e.U,e.s)}function Mn(e){return!!e.g&&("GET"==e.u&&2!=e.K&&e.l.Da)}function xn(e,t,n){for(var r,s=!0;!e.I&&e.C<n.length;){if((r=Un(e,n))==On){4==t&&(e.o=4,gn(14),s=!1),cn(e.j,e.m,null,"[Incomplete Response]");break}if(r==Rn){e.o=4,gn(15),cn(e.j,e.m,n,"[Invalid Chunk]"),s=!1;break}cn(e.j,e.m,r,null),zn(e,r)}Mn(e)&&r!=On&&r!=Rn&&(e.h.g="",e.C=0),4!=t||0!=n.length||e.h.h||(e.o=1,gn(16),s=!1),e.i=e.i&&s,s?0<n.length&&!e.$&&(e.$=!0,(t=e.l).g==e&&t.$&&!t.K&&(t.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),rs(t),t.K=!0,gn(11))):(cn(e.j,e.m,n,"[Invalid Chunked Response]"),Bn(e),jn(e))}function Un(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?On:(n=Number(t.substring(n,r)),isNaN(n)?Rn:(r+=1)+n>t.length?On:(t=t.substr(r,n),e.C=r+n,t))}function Fn(e){e.V=Date.now()+e.O,Vn(e,e.O)}function Vn(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=yn(Pe(e.gb,e),t)}function qn(e){e.B&&(Ce.clearTimeout(e.B),e.B=null)}function jn(e){0==e.l.G||e.I||os(e.l,e)}function Bn(e){qn(e);var t=e.L;t&&"function"==typeof t.na&&t.na(),e.L=null,Jt(e.T),on(e.S),e.g&&(t=e.g,e.g=null,t.abort(),t.na())}function zn(e,t){try{var n=e.l;if(0!=n.G&&(n.g==e||vr(n.h,e)))if(!e.J&&vr(n.h,e)&&3==n.G){try{var r=n.Fa.g.parse(t)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;is(n),Qr(n)}ns(n),gn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=yn(Pe(n.cb,n),6e3));if(1>=yr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else cs(n,11)}else if((e.J||n.g==e)&&is(n),!ze(t))for(s=n.Fa.g.parse(t),t=0;t<s.length;t++){var i=s[t];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=e.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(wr(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Xn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-e.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=e;if((r=n).sa=hs(r,r.H?r.ka:null,r.V),f.J){Ir(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(qn(p),Fn(p)),r.g=f}else ts(r);0<n.i.length&&Xr(n)}else"stop"!=i[0]&&"close"!=i[0]||cs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?cs(n,7):Wr(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}fn()}catch(i){}}function $n(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(ke(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.oa&&"function"==typeof e.oa)return e.oa();if(!e.W||"function"!=typeof e.W){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(ke(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(var r in t=[],n=0,e)t[n++]=r;return t}}}(e),r=function(e){if(e.W&&"function"==typeof e.W)return e.W();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(ke(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),s=r.length,i=0;i<s;i++)t.call(void 0,r[i],n&&n[i],e)}(Ee=kn.prototype).setTimeout=function(e){this.O=e},Ee.ib=function(e){e=e.target;var t=this.L;t&&3==Br(e)?t.l():this.La(e)},Ee.La=function(e){try{if(e==this.g)e:{var t=Br(this.g),n=this.g.Ea();this.g.aa();if(!(3>t)&&(3!=t||et||this.g&&(this.h.h||this.g.fa()||zr(this.g)))){this.I||4!=t||7==n||fn(),qn(this);var r=this.g.aa();this.Y=r;t:if(Mn(this)){var s=zr(this.g);e="";var i=s.length,o=4==Br(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Bn(this),jn(this);var a="";break t}this.h.i=new Ce.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,e+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(e,t,n,r,s,i,o){e.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,t,r),this.i){if(this.Z&&!this.J){t:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!ze(c)){var h=c;break t}}h=null}if(!(r=h)){this.i=!1,this.o=3,gn(12),Bn(this),jn(this);break e}cn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,zn(this,r)}this.P?(xn(this,t,a),et&&this.i&&3==t&&(sn(this.S,this.T,"tick",this.hb),this.T.start())):(cn(this.j,this.m,a,null),zn(this,a)),4==t&&Bn(this),this.i&&!this.I&&(4==t?os(this.l,this):(this.i=!1,Fn(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,gn(12)):(this.o=0,gn(13)),Bn(this),jn(this)}}}catch(t){}},Ee.hb=function(){if(this.g){var e=Br(this.g),t=this.g.fa();this.C<t.length&&(qn(this),xn(this,e,t),this.i&&4!=e&&Fn(this))}},Ee.cancel=function(){this.I=!0,Bn(this)},Ee.gb=function(){this.B=null;var e=Date.now();0<=e-this.V?(function(e,t){e.info((function(){return"TIMEOUT: "+t}))}(this.j,this.A),2!=this.K&&(fn(),gn(17)),Bn(this),this.o=2,jn(this)):Vn(this,this.V-e)};var Kn=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Hn(e,t){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,e instanceof Hn){this.h=void 0!==t?t:e.h,Wn(this,e.j),this.s=e.s,this.g=e.g,Qn(this,e.m),this.l=e.l,t=e.i;var n=new ar;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),Yn(this,n),this.o=e.o}else e&&(n=String(e).match(Kn))?(this.h=!!t,Wn(this,n[1]||"",!0),this.s=Zn(n[2]||""),this.g=Zn(n[3]||"",!0),Qn(this,n[4]),this.l=Zn(n[5]||"",!0),Yn(this,n[6]||"",!0),this.o=Zn(n[7]||"")):(this.h=!!t,this.i=new ar(null,this.h))}function Gn(e){return new Hn(e)}function Wn(e,t,n){e.j=n?Zn(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function Qn(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.m=t}else e.m=null}function Yn(e,t,n){t instanceof ar?(e.i=t,function(e,t){t&&!e.j&&(cr(e),e.i=null,e.g.forEach((function(e,t){var n=t.toLowerCase();t!=n&&(ur(this,t),lr(this,n,e))}),e)),e.j=t}(e.i,e.h)):(n||(t=er(t,ir)),e.i=new ar(t,e.h))}function Xn(e,t,n){e.i.set(t,n)}function Jn(e){return Xn(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function Zn(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function er(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,tr),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function tr(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}Hn.prototype.toString=function(){var e=[],t=this.j;t&&e.push(er(t,nr,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.s)&&e.push(er(t,nr,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(er(n,"/"==n.charAt(0)?sr:rr,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.o)&&e.push("#",er(n,or)),e.join("")};var nr=/[#\/\?@]/g,rr=/[#\?:]/g,sr=/[#\?]/g,ir=/[#\?@]/g,or=/#/g;function ar(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function cr(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),s=null;if(0<=r){var i=e[n].substring(0,r);s=e[n].substring(r+1)}else i=e[n];t(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,(function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)})))}function ur(e,t){cr(e),t=dr(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function hr(e,t){return cr(e),t=dr(e,t),e.g.has(t)}function lr(e,t,n){ur(e,t),0<n.length&&(e.i=null,e.g.set(dr(e,t),Ve(n)),e.h+=n.length)}function dr(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}(Ee=ar.prototype).add=function(e,t){cr(this),this.i=null,e=dr(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},Ee.forEach=function(e,t){cr(this),this.g.forEach((function(n,r){n.forEach((function(n){e.call(t,n,r,this)}),this)}),this)},Ee.oa=function(){cr(this);for(var e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[],r=0;r<t.length;r++)for(var s=e[r],i=0;i<s.length;i++)n.push(t[r]);return n},Ee.W=function(e){cr(this);var t=[];if("string"==typeof e)hr(this,e)&&(t=t.concat(this.g.get(dr(this,e))));else{e=Array.from(this.g.values());for(var n=0;n<e.length;n++)t=t.concat(e[n])}return t},Ee.set=function(e,t){return cr(this),this.i=null,hr(this,e=dr(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},Ee.get=function(e,t){return e&&0<(e=this.W(e)).length?String(e[0]):t},Ee.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var e=[],t=Array.from(this.g.keys()),n=0;n<t.length;n++){var r=t[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),e.push(o)}}return this.i=e.join("&")};var fr=function(e,t){this.h=e,this.g=t};function pr(e){this.l=e||gr,Ce.PerformanceNavigationTiming?e=0<(e=Ce.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(Ce.g&&Ce.g.Ga&&Ce.g.Ga()&&Ce.g.Ga().$b),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var gr=10;function mr(e){return!!e.h||!!e.g&&e.g.size>=e.j}function yr(e){return e.h?1:e.g?e.g.size:0}function vr(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function wr(e,t){e.g?e.g.add(t):e.h=t}function Ir(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function br(e){var t,n;if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){var r=e.i;try{for(var s=be(e.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return r}return Ve(e.i)}function Tr(){}function Er(){this.g=new Tr}function _r(e,t,n){var r=n||"";try{$n(e,(function(e,n){var s=e;Ne(e)&&(s=qt(e)),t.push(r+n+"="+encodeURIComponent(s))}))}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}function Sr(e,t,n,r,s){try{t.onload=null,t.onerror=null,t.onabort=null,t.ontimeout=null,s(r)}catch(e){}}function Cr(e){this.l=e.ac||null,this.j=e.jb||!1}function Ar(e,t){Ut.call(this),this.D=e,this.u=t,this.m=void 0,this.readyState=kr,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}pr.prototype.cancel=function(){var e,t;if(this.i=br(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=be(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this.g.clear()}},Tr.prototype.stringify=function(e){return Ce.JSON.stringify(e,void 0)},Tr.prototype.parse=function(e){return Ce.JSON.parse(e,void 0)},xe(Cr,In),Cr.prototype.g=function(){return new Ar(this.l,this.j)},Cr.prototype.i=function(e){return function(){return e}}({}),xe(Ar,Ut);var kr=0;function Nr(e){e.j.read().then(e.Ta.bind(e)).catch(e.ga.bind(e))}function Dr(e){e.readyState=4,e.l=null,e.j=null,e.A=null,Rr(e)}function Rr(e){e.onreadystatechange&&e.onreadystatechange.call(e)}(Ee=Ar.prototype).open=function(e,t){if(this.readyState!=kr)throw this.abort(),Error("Error reopening a connection");this.C=e,this.B=t,this.readyState=1,Rr(this)},Ee.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var t={headers:this.v,method:this.C,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||Ce).fetch(new Request(this.B,t)).then(this.Wa.bind(this),this.ga.bind(this))},Ee.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Dr(this)),this.readyState=kr},Ee.Wa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Rr(this)),this.g&&(this.readyState=3,Rr(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ce.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Nr(this)}else e.text().then(this.Va.bind(this),this.ga.bind(this))},Ee.Ta=function(e){if(this.g){if(this.u&&e.value)this.response.push(e.value);else if(!this.u){var t=e.value?e.value:new Uint8Array(0);(t=this.A.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?Dr(this):Rr(this),3==this.readyState&&Nr(this)}},Ee.Va=function(e){this.g&&(this.response=this.responseText=e,Dr(this))},Ee.Ua=function(e){this.g&&(this.response=e,Dr(this))},Ee.ga=function(){this.g&&Dr(this)},Ee.setRequestHeader=function(e,t){this.v.append(e,t)},Ee.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},Ee.getAllResponseHeaders=function(){if(!this.h)return"";for(var e=[],t=this.h.entries(),n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Ar.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}});var Or=Ce.JSON.parse;function Lr(e){Ut.call(this),this.headers=new Map,this.u=e||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Pr,this.K=this.L=!1}xe(Lr,Ut);var Pr="",Mr=/^https?$/i,xr=["POST","PUT"];function Ur(e,t){e.h=!1,e.g&&(e.l=!0,e.g.abort(),e.l=!1),e.j=t,e.m=5,Fr(e),qr(e)}function Fr(e){e.D||(e.D=!0,Ft(e,"complete"),Ft(e,"error"))}function Vr(e){if(e.h&&void 0!==Se&&(!e.C[1]||4!=Br(e)||2!=e.aa()))if(e.v&&4==Br(e))Zt(e.Ha,0,e);else if(Ft(e,"readystatechange"),4==Br(e)){e.h=!1;try{var t,n=e.aa();e:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break e;default:r=!1}if(!(t=r)){var s;if(s=0===n){var i=String(e.H).match(Kn)[1]||null;if(!i&&Ce.self&&Ce.self.location){var o=Ce.self.location.protocol;i=o.substr(0,o.length-1)}s=!Mr.test(i?i.toLowerCase():"")}t=s}if(t)Ft(e,"complete"),Ft(e,"success");else{e.m=6;try{var a=2<Br(e)?e.g.statusText:""}catch(e){a=""}e.j=a+" ["+e.aa()+"]",Fr(e)}}finally{qr(e)}}}function qr(e,t){if(e.g){jr(e);var n=e.g,r=e.C[0]?Ae:null;e.g=null,e.C=null,t||Ft(e,"ready");try{n.onreadystatechange=r}catch(e){}}}function jr(e){e.g&&e.K&&(e.g.ontimeout=null),e.A&&(Ce.clearTimeout(e.A),e.A=null)}function Br(e){return e.g?e.g.readyState:0}function zr(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.J){case Pr:case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function $r(e){var t="";return vt(e,(function(e,n){t+=n,t+=":",t+=e,t+="\r\n"})),t}function Kr(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=$r(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):Xn(e,t,n))}function Hr(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function Gr(e){this.Ca=0,this.i=[],this.j=new an,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Hr("failFast",!1,e),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Hr("baseRetryDelayMs",5e3,e),this.bb=Hr("retryDelaySeedMs",1e4,e),this.$a=Hr("forwardChannelMaxRetries",2,e),this.ta=Hr("forwardChannelRequestTimeoutMs",2e4,e),this.ra=e&&e.xmlHttpFactory||void 0,this.Da=e&&e.Zb||!1,this.J=void 0,this.H=e&&e.supportsCrossDomainXhr||!1,this.I="",this.h=new pr(e&&e.concurrentRequestLimit),this.Fa=new Er,this.O=e&&e.fastHandshake||!1,this.N=e&&e.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=e&&e.Xb||!1,e&&e.Aa&&this.j.Aa(),e&&e.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&e&&e.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Wr(e){if(Yr(e),3==e.G){var t=e.U++,n=Gn(e.F);Xn(n,"SID",e.I),Xn(n,"RID",t),Xn(n,"TYPE","terminate"),Zr(e,n),(t=new kn(e,e.j,t,void 0)).K=2,t.v=Jn(Gn(n)),n=!1,Ce.navigator&&Ce.navigator.sendBeacon&&(n=Ce.navigator.sendBeacon(t.v.toString(),"")),!n&&Ce.Image&&((new Image).src=t.v,n=!0),n||(t.g=ls(t.l,null),t.g.da(t.v)),t.F=Date.now(),Fn(t)}us(e)}function Qr(e){e.g&&(rs(e),e.g.cancel(),e.g=null)}function Yr(e){Qr(e),e.u&&(Ce.clearTimeout(e.u),e.u=null),is(e),e.h.cancel(),e.m&&("number"==typeof e.m&&Ce.clearTimeout(e.m),e.m=null)}function Xr(e){mr(e.h)||e.m||(e.m=!0,Gt(e.Ja,e),e.C=0)}function Jr(e,t){var n;n=t?t.m:e.U++;var r=Gn(e.F);Xn(r,"SID",e.I),Xn(r,"RID",n),Xn(r,"AID",e.T),Zr(e,r),e.o&&e.s&&Kr(r,e.o,e.s),n=new kn(e,e.j,n,e.C+1),null===e.o&&(n.H=e.s),t&&(e.i=t.D.concat(e.i)),t=es(e,n,1e3),n.setTimeout(Math.round(.5*e.ta)+Math.round(.5*e.ta*Math.random())),wr(e.h,n),Ln(n,r,t)}function Zr(e,t){e.ia&&vt(e.ia,(function(e,n){Xn(t,n,e)})),e.l&&$n({},(function(e,n){Xn(t,n,e)}))}function es(e,t,n){n=Math.min(e.i.length,n);var r=e.l?Pe(e.l.Ra,e.l,e):null;e:for(var s=e.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{_r(h,o,"req"+u+"_")}catch(e){r&&r(h)}}if(a){r=o.join("&");break e}}return e=e.i.splice(0,n),t.D=e,r}function ts(e){e.g||e.u||(e.Z=1,Gt(e.Ia,e),e.A=0)}function ns(e){return!(e.g||e.u||3<=e.A)&&(e.Z++,e.u=yn(Pe(e.Ia,e),as(e,e.A)),e.A++,!0)}function rs(e){null!=e.B&&(Ce.clearTimeout(e.B),e.B=null)}function ss(e){e.g=new kn(e,e.j,"rpc",e.Z),null===e.o&&(e.g.H=e.s),e.g.N=0;var t=Gn(e.sa);Xn(t,"RID","rpc"),Xn(t,"SID",e.I),Xn(t,"CI",e.L?"0":"1"),Xn(t,"AID",e.T),Xn(t,"TYPE","xmlhttp"),Zr(e,t),e.o&&e.s&&Kr(t,e.o,e.s),e.J&&e.g.setTimeout(e.J);var n=e.g;e=e.ka,n.K=1,n.v=Jn(Gn(t)),n.s=null,n.P=!0,Pn(n,e)}function is(e){null!=e.v&&(Ce.clearTimeout(e.v),e.v=null)}function os(e,t){var n=null;if(e.g==t){is(e),rs(e),e.g=null;var r=2}else{if(!vr(e.h,t))return;n=t.D,Ir(e.h,t),r=1}if(0!=e.G)if(e.pa=t.Y,t.i)if(1==r){n=t.s?t.s.length:0,t=Date.now()-t.F;var s=e.C;Ft(r=ln(),new mn(r,n)),Xr(e)}else ts(e);else if(3==(s=t.o)||0==s&&0<e.pa||!(1==r&&function(e,t){return!(yr(e.h)>=e.h.j-(e.m?1:0)||(e.m?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.C>=(e.Za?0:e.$a)||(e.m=yn(Pe(e.Ja,e,t),as(e,e.C)),e.C++,0)))}(e,t)||2==r&&ns(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),s){case 1:cs(e,5);break;case 4:cs(e,10);break;case 3:cs(e,6);break;default:cs(e,2)}}function as(e,t){var n=e.Xa+Math.floor(Math.random()*e.bb);return e.l||(n*=2),n*t}function cs(e,t){if(e.j.info("Error code "+t),2==t){var n=null;e.l&&(n=null);var r=Pe(e.kb,e);n||(n=new Hn("//www.google.com/images/cleardot.gif"),Ce.location&&"http"==Ce.location.protocol||Wn(n,"https"),Jn(n)),function(e,t){var n=new an;if(Ce.Image){var r=new Image;r.onload=Me(Sr,n,r,"TestLoadImage: loaded",!0,t),r.onerror=Me(Sr,n,r,"TestLoadImage: error",!1,t),r.onabort=Me(Sr,n,r,"TestLoadImage: abort",!1,t),r.ontimeout=Me(Sr,n,r,"TestLoadImage: timeout",!1,t),Ce.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=e}else t(!1)}(n.toString(),r)}else gn(2);e.G=0,e.l&&e.l.va(t),us(e),Yr(e)}function us(e){if(e.G=0,e.la=[],e.l){var t=br(e.h);0==t.length&&0==e.i.length||(qe(e.la,t),qe(e.la,e.i),e.h.i.length=0,Ve(e.i),e.i.length=0),e.l.ua()}}function hs(e,t,n){var r=n instanceof Hn?Gn(n):new Hn(n,void 0);if(""!=r.g)t&&(r.g=t+"."+r.g),Qn(r,r.m);else{var s=Ce.location;r=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;var i=new Hn(null,void 0);r&&Wn(i,r),t&&(i.g=t),s&&Qn(i,s),n&&(i.l=n),r=i}return n=e.D,t=e.za,n&&t&&Xn(r,n,t),Xn(r,"VER",e.ma),Zr(e,r),r}function ls(e,t,n){if(t&&!e.H)throw Error("Can't create secondary domain capable XhrIo object.");return(t=n&&e.Da&&!e.ra?new Lr(new Cr({jb:!0})):new Lr(e.ra)).Ka(e.H),t}function ds(){}function fs(){if(Je&&!(10<=Number(lt)))throw Error("Environmental error: no available transport.")}function ps(e,t){Ut.call(this),this.g=new Gr(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.s=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.ya&&(e?e["X-WebChannel-Client-Profile"]=t.ya:e={"X-WebChannel-Client-Profile":t.ya}),this.g.S=e,(e=t&&t.Yb)&&!ze(e)&&(this.g.o=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!ze(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new ys(this)}function gs(e){Sn.call(this);var t=e.__sm__;if(t){e:{for(var n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function ms(){Cn.call(this),this.status=1}function ys(e){this.g=e}(Ee=Lr.prototype).Ka=function(e){this.L=e},Ee.da=function(e,t,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+e);t=t?t.toUpperCase():"GET",this.H=e,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():En.g(),this.C=this.u?bn(this.u):bn(En),this.g.onreadystatechange=Pe(this.Ha,this);try{this.F=!0,this.g.open(t,String(e),!0),this.F=!1}catch(l){return void Ur(this,l)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=be(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(e){s={error:e}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(e){return"content-type"==e.toLowerCase()})),c=Ce.FormData&&e instanceof Ce.FormData,!(0<=Fe(xr,t))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=be(n),f=d.next();!f.done;f=d.next()){var p=Te(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{jr(this),0<this.B&&((this.K=function(e){return Je&&ut()&&"number"==typeof e.timeout&&void 0!==e.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Pe(this.qa,this)):this.A=Zt(this.qa,this.B,this)),this.v=!0,this.g.send(e),this.v=!1}catch(l){Ur(this,l)}},Ee.qa=function(){void 0!==Se&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Ft(this,"timeout"),this.abort(8))},Ee.abort=function(e){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=e||7,Ft(this,"complete"),Ft(this,"abort"),qr(this))},Ee.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),qr(this,!0)),Lr.X.M.call(this)},Ee.Ha=function(){this.s||(this.F||this.v||this.l?Vr(this):this.fb())},Ee.fb=function(){Vr(this)},Ee.aa=function(){try{return 2<Br(this)?this.g.status:-1}catch(e){return-1}},Ee.fa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},Ee.Sa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),Or(t)}},Ee.Ea=function(){return this.m},Ee.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(Ee=Gr.prototype).ma=8,Ee.G=1,Ee.Ja=function(e){if(this.m)if(this.m=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;var t=new kn(this,this.j,e,void 0),n=this.s;if(this.S&&(n?bt(n=wt(n),this.S):n=this.S),null!==this.o||this.N||(t.H=n,n=null),this.O)e:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break e}if(4096===r||s===this.i.length-1){r=s+1;break e}}r=1e3}else r=1e3;r=es(this,t,r),Xn(s=Gn(this.F),"RID",e),Xn(s,"CVER",22),this.D&&Xn(s,"X-HTTP-Session-Id",this.D),Zr(this,s),n&&(this.N?r="headers="+encodeURIComponent(String($r(n)))+"&"+r:this.o&&Kr(s,this.o,n)),wr(this.h,t),this.Ya&&Xn(s,"TYPE","init"),this.O?(Xn(s,"$req",r),Xn(s,"SID","null"),t.Z=!0,Ln(t,s,null)):Ln(t,s,r),this.G=2}}else 3==this.G&&(e?Jr(this,e):0==this.i.length||mr(this.h)||Jr(this))},Ee.Ia=function(){if(this.u=null,ss(this),this.$&&!(this.K||null==this.g||0>=this.P)){var e=2*this.P;this.j.info("BP detection timer enabled: "+e),this.B=yn(Pe(this.eb,this),e)}},Ee.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,gn(10),Qr(this),ss(this))},Ee.cb=function(){null!=this.v&&(this.v=null,Qr(this),ns(this),gn(19))},Ee.kb=function(e){e?(this.j.info("Successfully pinged google.com"),gn(2)):(this.j.info("Failed to ping google.com"),gn(1))},(Ee=ds.prototype).xa=function(){},Ee.wa=function(){},Ee.va=function(){},Ee.ua=function(){},Ee.Ra=function(){},fs.prototype.g=function(e,t){return new ps(e,t)},xe(ps,Ut),ps.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var e=this.g,t=this.l,n=this.h||void 0;gn(0),e.V=t,e.ia=n||{},e.L=e.Y,e.F=hs(e,null,e.V),Xr(e)},ps.prototype.close=function(){Wr(this.g)},ps.prototype.u=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.v&&((n={}).__data__=qt(e),e=n);t.i.push(new fr(t.ab++,e)),3==t.G&&Xr(t)},ps.prototype.M=function(){this.g.l=null,delete this.j,Wr(this.g),delete this.g,ps.X.M.call(this)},xe(gs,Sn),xe(ms,Cn),xe(ys,ds),ys.prototype.xa=function(){Ft(this.g,"a")},ys.prototype.wa=function(e){Ft(this.g,new gs(e))},ys.prototype.va=function(e){Ft(this.g,new ms)},ys.prototype.ua=function(){Ft(this.g,"b")},fs.prototype.createWebChannel=fs.prototype.g,ps.prototype.send=ps.prototype.u,ps.prototype.open=ps.prototype.m,ps.prototype.close=ps.prototype.close,vn.NO_ERROR=0,vn.TIMEOUT=8,vn.HTTP_ERROR=6,wn.COMPLETE="complete",Tn.EventType=_n,_n.OPEN="a",_n.CLOSE="b",_n.ERROR="c",_n.MESSAGE="d",Ut.prototype.listen=Ut.prototype.N,Lr.prototype.listenOnce=Lr.prototype.O,Lr.prototype.getLastError=Lr.prototype.Oa,Lr.prototype.getLastErrorCode=Lr.prototype.Ea,Lr.prototype.getStatus=Lr.prototype.aa,Lr.prototype.getResponseJson=Lr.prototype.Sa,Lr.prototype.getResponseText=Lr.prototype.fa,Lr.prototype.send=Lr.prototype.da,Lr.prototype.setWithCredentials=Lr.prototype.Ka;var vs=vn,ws=wn,Is=un,bs=10,Ts=11,Es=Cr,_s=Tn,Ss=Lr;const Cs="@firebase/firestore";
315
+ */var Tt;Tt="",st(new E("platform-logger",(t=>new Q(t)),"PRIVATE")),st(new E("heartbeat",(t=>new yt(t)),"PRIVATE")),lt(J,Y,Tt),lt(J,Y,"esm2017"),lt("fire-js","");var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},It(t,e)};function Et(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function St(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var bt,At="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ct=Ct||{},kt=At||self;function Nt(){}function Rt(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function Dt(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ot="closure_uid_"+(1e9*Math.random()>>>0),Lt=0;function Pt(t,e,n){return t.call.apply(t.bind,arguments)}function Mt(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function xt(t,e,n){return(xt=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Pt:Mt).apply(null,arguments)}function Ut(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function Ft(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Vt(){this.s=this.s,this.o=this.o}Vt.prototype.s=!1,Vt.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ot)&&t[Ot]||(t[Ot]=++Lt))},Vt.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Bt=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function jt(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function Ht(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Rt(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function qt(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}qt.prototype.h=function(){this.defaultPrevented=!0};var Kt=function(){if(!kt.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{kt.addEventListener("test",Nt,e),kt.removeEventListener("test",Nt,e)}catch(t){}return t}();function Wt(t){return/^[\s\xa0]*$/.test(t)}var zt=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function $t(t,e){return t<e?-1:t>e?1:0}function Gt(){var t=kt.navigator;return t&&(t=t.userAgent)?t:""}function Qt(t){return-1!=Gt().indexOf(t)}function Jt(t){return Jt[" "](t),t}Jt[" "]=Nt;var Yt,Xt,Zt=Qt("Opera"),te=Qt("Trident")||Qt("MSIE"),ee=Qt("Edge"),ne=ee||te,re=Qt("Gecko")&&!(-1!=Gt().toLowerCase().indexOf("webkit")&&!Qt("Edge"))&&!(Qt("Trident")||Qt("MSIE"))&&!Qt("Edge"),se=-1!=Gt().toLowerCase().indexOf("webkit")&&!Qt("Edge");function ie(){var t=kt.document;return t?t.documentMode:void 0}t:{var oe="",ae=(Xt=Gt(),re?/rv:([^\);]+)(\)|;)/.exec(Xt):ee?/Edge\/([\d\.]+)/.exec(Xt):te?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Xt):se?/WebKit\/(\S+)/.exec(Xt):Zt?/(?:Version)[ \/]?(\S+)/.exec(Xt):void 0);if(ae&&(oe=ae?ae[1]:""),te){var ce=ie();if(null!=ce&&ce>parseFloat(oe)){Yt=String(ce);break t}}Yt=oe}var ue,he={};function le(){return function(t){var e=he;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=zt(String(Yt)).split("."),n=zt("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=$t(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||$t(0==i[2].length,0==o[2].length)||$t(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(kt.document&&te){var de=ie();ue=de||(parseInt(Yt,10)||void 0)}else ue=void 0;var fe=ue;function pe(t,e){if(qt.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(re){t:{try{Jt(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:ge[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&pe.X.h.call(this)}}Ft(pe,qt);var ge={2:"touch",3:"pen",4:"mouse"};pe.prototype.h=function(){pe.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var me="closure_listenable_"+(1e6*Math.random()|0),ye=0;function ve(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++ye,this.ba=this.ea=!1}function we(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function _e(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Te(t){var e={};for(var n in t)e[n]=t[n];return e}var Ie="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ee(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<Ie.length;i++)n=Ie[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Se(t){this.src=t,this.g={},this.h=0}function be(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Bt(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(we(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Ae(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}Se.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Ae(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new ve(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var Ce="closure_lm_"+(1e6*Math.random()|0),ke={};function Ne(t,e,n,r,s){if(r&&r.once)return De(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)Ne(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.N(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!1,r,s)}function Re(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Dt(s)?!!s.capture:!!s,a=xe(t);if(a||(t[Ce]=a=new Se(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Me;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Kt||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Pe(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function De(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)De(t,e[i],n,r,s);return null}return n=Fe(n),t&&t[me]?t.O(e,n,Dt(r)?!!r.capture:!!r,s):Re(t,e,n,!0,r,s)}function Oe(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Oe(t,e[i],n,r,s);else r=Dt(r)?!!r.capture:!!r,n=Fe(n),t&&t[me]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Ae(i=t.g[e],n,r,s))&&(we(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=xe(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Ae(e,n,r,s)),(n=-1<t?e[t]:null)&&Le(n))}function Le(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[me])be(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Pe(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=xe(e))?(be(n,t),0==n.h&&(n.src=null,e[Ce]=null)):we(t)}}}function Pe(t){return t in ke?ke[t]:ke[t]="on"+t}function Me(t,e){if(t.ba)t=!0;else{e=new pe(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&Le(t),t=n.call(r,e)}return t}function xe(t){return(t=t[Ce])instanceof Se?t:null}var Ue="__closure_events_fn_"+(1e9*Math.random()>>>0);function Fe(t){return"function"==typeof t?t:(t[Ue]||(t[Ue]=function(e){return t.handleEvent(e)}),t[Ue])}function Ve(){Vt.call(this),this.i=new Se(this),this.P=this,this.I=null}function Be(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new qt(e,t);else if(e instanceof qt)e.target=e.target||t;else{var s=e;Ee(e=new qt(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=je(o,r,!0,e)&&s}if(s=je(o=e.g=t,r,!0,e)&&s,s=je(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=je(o=e.g=n[i],r,!1,e)&&s}function je(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&be(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}Ft(Ve,Vt),Ve.prototype[me]=!0,Ve.prototype.removeEventListener=function(t,e,n,r){Oe(this,t,e,n,r)},Ve.prototype.M=function(){if(Ve.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)we(n[r]);delete e.g[t],e.h--}}this.I=null},Ve.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Ve.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var He=kt.JSON.stringify;function qe(){var t=Ye,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Ke,We=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=ze.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),ze=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new $e}),(function(t){return t.reset()})),$e=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function Ge(t){kt.setTimeout((function(){throw t}),0)}function Qe(t,e){Ke||function(){var t=kt.Promise.resolve(void 0);Ke=function(){t.then(Xe)}}(),Je||(Ke(),Je=!0),Ye.add(t,e)}var Je=!1,Ye=new We;function Xe(){for(var t;t=qe();){try{t.h.call(t.g)}catch(t){Ge(t)}var e=ze;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Je=!1}function Ze(t,e){Ve.call(this),this.h=t||1,this.g=e||kt,this.j=xt(this.lb,this),this.l=Date.now()}function tn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function en(t,e,n){if("function"==typeof t)n&&(t=xt(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=xt(t.handleEvent,t)}return 2147483647<Number(e)?-1:kt.setTimeout(t,e||0)}function nn(t){t.g=en((function(){t.g=null,t.i&&(t.i=!1,nn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ft(Ze,Ve),(bt=Ze.prototype).ca=!1,bt.R=null,bt.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Be(this,"tick"),this.ca&&(tn(this),this.start()))}},bt.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},bt.M=function(){Ze.X.M.call(this),tn(this),delete this.g};var rn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}It(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:nn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(kt.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Vt);function sn(t){Vt.call(this),this.h=t,this.g={}}Ft(sn,Vt);var on=[];function an(t,e,n,r){Array.isArray(n)||(n&&(on[0]=n.toString()),n=on);for(var s=0;s<n.length;s++){var i=Ne(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function cn(t){_e(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Le(t)}),t),t.g={}}function un(){this.g=!0}function hn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return He(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}sn.prototype.M=function(){sn.X.M.call(this),cn(this)},sn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},un.prototype.Aa=function(){this.g=!1},un.prototype.info=function(){};var ln={},dn=null;function fn(){return dn=dn||new Ve}function pn(t){qt.call(this,ln.Pa,t)}function gn(t){var e=fn();Be(e,new pn(e))}function mn(t,e){qt.call(this,ln.STAT_EVENT,t),this.stat=e}function yn(t){var e=fn();Be(e,new mn(e,t))}function vn(t,e){qt.call(this,ln.Qa,t),this.size=e}function wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return kt.setTimeout((function(){t()}),e)}ln.Pa="serverreachability",Ft(pn,qt),ln.STAT_EVENT="statevent",Ft(mn,qt),ln.Qa="timingevent",Ft(vn,qt);var _n={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Tn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function In(){}function En(t){return t.h||(t.h=t.i())}function Sn(){}In.prototype.h=null;var bn,An={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Cn(){qt.call(this,"d")}function kn(){qt.call(this,"c")}function Nn(){}function Rn(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new sn(this),this.O=On,t=ne?125:void 0,this.T=new Ze(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new Dn}function Dn(){this.i=null,this.g="",this.h=!1}Ft(Cn,qt),Ft(kn,qt),Ft(Nn,In),Nn.prototype.g=function(){return new XMLHttpRequest},Nn.prototype.i=function(){return{}},bn=new Nn;var On=45e3,Ln={},Pn={};function Mn(t,e,n){t.K=1,t.v=tr(Qn(e)),t.s=n,t.P=!0,xn(t,null)}function xn(t,e){t.F=Date.now(),Bn(t),t.A=Qn(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),fr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Dn,t.g=fs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new rn(xt(t.La,t,t.g),t.N)),an(t.S,t.g,"readystatechange",t.ib),e=t.H?Te(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),gn(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Un(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Fn(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Vn(t,n))==Pn){4==e&&(t.o=4,yn(14),s=!1),hn(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ln){t.o=4,yn(15),hn(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}hn(t.j,t.m,r,null),Wn(t,r)}Un(t)&&r!=Pn&&r!=Ln&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,yn(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),is(e),e.K=!0,yn(11))):(hn(t.j,t.m,n,"[Invalid Chunked Response]"),Kn(t),qn(t))}function Vn(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?Pn:(n=Number(e.substring(n,r)),isNaN(n)?Ln:(r+=1)+n>e.length?Pn:(e=e.substr(r,n),t.C=r+n,e))}function Bn(t){t.V=Date.now()+t.O,jn(t,t.O)}function jn(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=wn(xt(t.gb,t),e)}function Hn(t){t.B&&(kt.clearTimeout(t.B),t.B=null)}function qn(t){0==t.l.G||t.I||cs(t.l,t)}function Kn(t){Hn(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,tn(t.T),cn(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Wn(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||_r(n.h,t)))if(!t.J&&_r(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;as(n),Yr(n)}ss(n),yn(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=wn(xt(n.cb,n),6e3));if(1>=wr(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else hs(n,11)}else if((t.J||n.g==t)&&as(n),!Wt(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(Tr(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Zn(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=ds(r,r.H?r.ka:null,r.V),f.J){Ir(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(Hn(p),Bn(p)),r.g=f}else rs(r);0<n.i.length&&Zr(n)}else"stop"!=i[0]&&"close"!=i[0]||hs(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?hs(n,7):Jr(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}gn()}catch(i){}}function zn(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Rt(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Rt(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Rt(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(bt=Rn.prototype).setTimeout=function(t){this.O=t},bt.ib=function(t){t=t.target;var e=this.L;e&&3==Kr(t)?e.l():this.La(t)},bt.La=function(t){try{if(t==this.g)t:{var e=Kr(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||ne||this.g&&(this.h.h||this.g.fa()||Wr(this.g)))){this.I||4!=e||7==n||gn(),Hn(this);var r=this.g.aa();this.Y=r;e:if(Un(this)){var s=Wr(this.g);t="";var i=s.length,o=4==Kr(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Kn(this),qn(this);var a="";break e}this.h.i=new kt.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Wt(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,yn(12),Kn(this),qn(this);break t}hn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Wn(this,r)}this.P?(Fn(this,e,a),ne&&this.i&&3==e&&(an(this.S,this.T,"tick",this.hb),this.T.start())):(hn(this.j,this.m,a,null),Wn(this,a)),4==e&&Kn(this),this.i&&!this.I&&(4==e?cs(this.l,this):(this.i=!1,Bn(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,yn(12)):(this.o=0,yn(13)),Kn(this),qn(this)}}}catch(e){}},bt.hb=function(){if(this.g){var t=Kr(this.g),e=this.g.fa();this.C<e.length&&(Hn(this),Fn(this,t,e),this.i&&4!=t&&Bn(this))}},bt.cancel=function(){this.I=!0,Kn(this)},bt.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(gn(),yn(17)),Kn(this),this.o=2,qn(this)):jn(this,this.V-t)};var $n=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Gn(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Gn){this.h=void 0!==e?e:t.h,Jn(this,t.j),this.s=t.s,this.g=t.g,Yn(this,t.m),this.l=t.l,e=t.i;var n=new ur;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Xn(this,n),this.o=t.o}else t&&(n=String(t).match($n))?(this.h=!!e,Jn(this,n[1]||"",!0),this.s=er(n[2]||""),this.g=er(n[3]||"",!0),Yn(this,n[4]),this.l=er(n[5]||"",!0),Xn(this,n[6]||"",!0),this.o=er(n[7]||"")):(this.h=!!e,this.i=new ur(null,this.h))}function Qn(t){return new Gn(t)}function Jn(t,e,n){t.j=n?er(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Yn(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Xn(t,e,n){e instanceof ur?(t.i=e,function(t,e){e&&!t.j&&(hr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(lr(this,e),fr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=nr(e,ar)),t.i=new ur(e,t.h))}function Zn(t,e,n){t.i.set(e,n)}function tr(t){return Zn(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function er(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function nr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,rr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function rr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Gn.prototype.toString=function(){var t=[],e=this.j;e&&t.push(nr(e,sr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(nr(e,sr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(nr(n,"/"==n.charAt(0)?or:ir,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",nr(n,cr)),t.join("")};var sr=/[#\/\?@]/g,ir=/[#\?:]/g,or=/[#\?]/g,ar=/[#\?@]/g,cr=/#/g;function ur(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function hr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function lr(t,e){hr(t),e=pr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function dr(t,e){return hr(t),e=pr(t,e),t.g.has(e)}function fr(t,e,n){lr(t,e),0<n.length&&(t.i=null,t.g.set(pr(t,e),jt(n)),t.h+=n.length)}function pr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(bt=ur.prototype).add=function(t,e){hr(this),this.i=null,t=pr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},bt.forEach=function(t,e){hr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},bt.oa=function(){hr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},bt.W=function(t){hr(this);var e=[];if("string"==typeof t)dr(this,t)&&(e=e.concat(this.g.get(pr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},bt.set=function(t,e){return hr(this),this.i=null,dr(this,t=pr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},bt.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},bt.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var gr=function(t,e){this.h=t,this.g=e};function mr(t){this.l=t||yr,kt.PerformanceNavigationTiming?t=0<(t=kt.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(kt.g&&kt.g.Ga&&kt.g.Ga()&&kt.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var yr=10;function vr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function wr(t){return t.h?1:t.g?t.g.size:0}function _r(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Tr(t,e){t.g?t.g.add(e):t.h=e}function Ir(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Er(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=Et(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return jt(t.i)}function Sr(){}function br(){this.g=new Sr}function Ar(t,e,n){var r=n||"";try{zn(t,(function(t,n){var s=t;Dt(t)&&(s=He(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Cr(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function kr(t){this.l=t.ac||null,this.j=t.jb||!1}function Nr(t,e){Ve.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Rr,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}mr.prototype.cancel=function(){var t,e;if(this.i=Er(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Et(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Sr.prototype.stringify=function(t){return kt.JSON.stringify(t,void 0)},Sr.prototype.parse=function(t){return kt.JSON.parse(t,void 0)},Ft(kr,In),kr.prototype.g=function(){return new Nr(this.l,this.j)},kr.prototype.i=function(t){return function(){return t}}({}),Ft(Nr,Ve);var Rr=0;function Dr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Or(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Lr(t)}function Lr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(bt=Nr.prototype).open=function(t,e){if(this.readyState!=Rr)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Lr(this)},bt.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||kt).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},bt.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,Or(this)),this.readyState=Rr},bt.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Lr(this)),this.g&&(this.readyState=3,Lr(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==kt.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;Dr(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},bt.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?Or(this):Lr(this),3==this.readyState&&Dr(this)}},bt.Va=function(t){this.g&&(this.response=this.responseText=t,Or(this))},bt.Ua=function(t){this.g&&(this.response=t,Or(this))},bt.ga=function(){this.g&&Or(this)},bt.setRequestHeader=function(t,e){this.v.append(t,e)},bt.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},bt.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Nr.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Pr=kt.JSON.parse;function Mr(t){Ve.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=xr,this.K=this.L=!1}Ft(Mr,Ve);var xr="",Ur=/^https?$/i,Fr=["POST","PUT"];function Vr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Br(t),Hr(t)}function Br(t){t.D||(t.D=!0,Be(t,"complete"),Be(t,"error"))}function jr(t){if(t.h&&void 0!==Ct&&(!t.C[1]||4!=Kr(t)||2!=t.aa()))if(t.v&&4==Kr(t))en(t.Ha,0,t);else if(Be(t,"readystatechange"),4==Kr(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match($n)[1]||null;if(!i&&kt.self&&kt.self.location){var o=kt.self.location.protocol;i=o.substr(0,o.length-1)}s=!Ur.test(i?i.toLowerCase():"")}e=s}if(e)Be(t,"complete"),Be(t,"success");else{t.m=6;try{var a=2<Kr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Br(t)}}finally{Hr(t)}}}function Hr(t,e){if(t.g){qr(t);var n=t.g,r=t.C[0]?Nt:null;t.g=null,t.C=null,e||Be(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function qr(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(kt.clearTimeout(t.A),t.A=null)}function Kr(t){return t.g?t.g.readyState:0}function Wr(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case xr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function zr(t){var e="";return _e(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function $r(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=zr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Zn(t,e,n))}function Gr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Qr(t){this.Ca=0,this.i=[],this.j=new un,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=Gr("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=Gr("baseRetryDelayMs",5e3,t),this.bb=Gr("retryDelaySeedMs",1e4,t),this.$a=Gr("forwardChannelMaxRetries",2,t),this.ta=Gr("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new mr(t&&t.concurrentRequestLimit),this.Fa=new br,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function Jr(t){if(Xr(t),3==t.G){var e=t.U++,n=Qn(t.F);Zn(n,"SID",t.I),Zn(n,"RID",e),Zn(n,"TYPE","terminate"),es(t,n),(e=new Rn(t,t.j,e,void 0)).K=2,e.v=tr(Qn(n)),n=!1,kt.navigator&&kt.navigator.sendBeacon&&(n=kt.navigator.sendBeacon(e.v.toString(),"")),!n&&kt.Image&&((new Image).src=e.v,n=!0),n||(e.g=fs(e.l,null),e.g.da(e.v)),e.F=Date.now(),Bn(e)}ls(t)}function Yr(t){t.g&&(is(t),t.g.cancel(),t.g=null)}function Xr(t){Yr(t),t.u&&(kt.clearTimeout(t.u),t.u=null),as(t),t.h.cancel(),t.m&&("number"==typeof t.m&&kt.clearTimeout(t.m),t.m=null)}function Zr(t){vr(t.h)||t.m||(t.m=!0,Qe(t.Ja,t),t.C=0)}function ts(t,e){var n;n=e?e.m:t.U++;var r=Qn(t.F);Zn(r,"SID",t.I),Zn(r,"RID",n),Zn(r,"AID",t.T),es(t,r),t.o&&t.s&&$r(r,t.o,t.s),n=new Rn(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=ns(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Tr(t.h,n),Mn(n,r,e)}function es(t,e){t.ia&&_e(t.ia,(function(t,n){Zn(e,n,t)})),t.l&&zn({},(function(t,n){Zn(e,n,t)}))}function ns(t,e,n){n=Math.min(t.i.length,n);var r=t.l?xt(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{Ar(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function rs(t){t.g||t.u||(t.Z=1,Qe(t.Ia,t),t.A=0)}function ss(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=wn(xt(t.Ia,t),us(t,t.A)),t.A++,!0)}function is(t){null!=t.B&&(kt.clearTimeout(t.B),t.B=null)}function os(t){t.g=new Rn(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Qn(t.sa);Zn(e,"RID","rpc"),Zn(e,"SID",t.I),Zn(e,"CI",t.L?"0":"1"),Zn(e,"AID",t.T),Zn(e,"TYPE","xmlhttp"),es(t,e),t.o&&t.s&&$r(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=tr(Qn(e)),n.s=null,n.P=!0,xn(n,t)}function as(t){null!=t.v&&(kt.clearTimeout(t.v),t.v=null)}function cs(t,e){var n=null;if(t.g==e){as(t),is(t),t.g=null;var r=2}else{if(!_r(t.h,e))return;n=e.D,Ir(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Be(r=fn(),new vn(r,n)),Zr(t)}else rs(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=wn(xt(t.Ja,t,e),us(t,t.C)),t.C++,0)))}(t,e)||2==r&&ss(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:hs(t,5);break;case 4:hs(t,10);break;case 3:hs(t,6);break;default:hs(t,2)}}function us(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function hs(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=xt(t.kb,t);n||(n=new Gn("//www.google.com/images/cleardot.gif"),kt.location&&"http"==kt.location.protocol||Jn(n,"https"),tr(n)),function(t,e){var n=new un;if(kt.Image){var r=new Image;r.onload=Ut(Cr,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Ut(Cr,n,r,"TestLoadImage: error",!1,e),r.onabort=Ut(Cr,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Ut(Cr,n,r,"TestLoadImage: timeout",!1,e),kt.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else yn(2);t.G=0,t.l&&t.l.va(e),ls(t),Xr(t)}function ls(t){if(t.G=0,t.la=[],t.l){var e=Er(t.h);0==e.length&&0==t.i.length||(Ht(t.la,e),Ht(t.la,t.i),t.h.i.length=0,jt(t.i),t.i.length=0),t.l.ua()}}function ds(t,e,n){var r=n instanceof Gn?Qn(n):new Gn(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Yn(r,r.m);else{var s=kt.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Gn(null,void 0);r&&Jn(i,r),e&&(i.g=e),s&&Yn(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Zn(r,n,e),Zn(r,"VER",t.ma),es(t,r),r}function fs(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Mr(new kr({jb:!0})):new Mr(t.ra)).Ka(t.H),e}function ps(){}function gs(){if(te&&!(10<=Number(fe)))throw Error("Environmental error: no available transport.")}function ms(t,e){Ve.call(this),this.g=new Qr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Wt(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Wt(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ws(this)}function ys(t){Cn.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function vs(){kn.call(this),this.status=1}function ws(t){this.g=t}(bt=Mr.prototype).Ka=function(t){this.L=t},bt.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():bn.g(),this.C=this.u?En(this.u):En(bn),this.g.onreadystatechange=xt(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Vr(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=Et(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=kt.FormData&&t instanceof kt.FormData,!(0<=Bt(Fr,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Et(n),f=d.next();!f.done;f=d.next()){var p=St(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{qr(this),0<this.B&&((this.K=function(t){return te&&le()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=xt(this.qa,this)):this.A=en(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Vr(this,l)}},bt.qa=function(){void 0!==Ct&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Be(this,"timeout"),this.abort(8))},bt.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Be(this,"complete"),Be(this,"abort"),Hr(this))},bt.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Hr(this,!0)),Mr.X.M.call(this)},bt.Ha=function(){this.s||(this.F||this.v||this.l?jr(this):this.fb())},bt.fb=function(){jr(this)},bt.aa=function(){try{return 2<Kr(this)?this.g.status:-1}catch(t){return-1}},bt.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},bt.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Pr(e)}},bt.Ea=function(){return this.m},bt.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(bt=Qr.prototype).ma=8,bt.G=1,bt.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Rn(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Ee(n=Te(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=ns(this,e,r),Zn(s=Qn(this.F),"RID",t),Zn(s,"CVER",22),this.D&&Zn(s,"X-HTTP-Session-Id",this.D),es(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(zr(n)))+"&"+r:this.o&&$r(s,this.o,n)),Tr(this.h,e),this.Ya&&Zn(s,"TYPE","init"),this.O?(Zn(s,"$req",r),Zn(s,"SID","null"),e.Z=!0,Mn(e,s,null)):Mn(e,s,r),this.G=2}}else 3==this.G&&(t?ts(this,t):0==this.i.length||vr(this.h)||ts(this))},bt.Ia=function(){if(this.u=null,os(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=wn(xt(this.eb,this),t)}},bt.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,yn(10),Yr(this),os(this))},bt.cb=function(){null!=this.v&&(this.v=null,Yr(this),ss(this),yn(19))},bt.kb=function(t){t?(this.j.info("Successfully pinged google.com"),yn(2)):(this.j.info("Failed to ping google.com"),yn(1))},(bt=ps.prototype).xa=function(){},bt.wa=function(){},bt.va=function(){},bt.ua=function(){},bt.Ra=function(){},gs.prototype.g=function(t,e){return new ms(t,e)},Ft(ms,Ve),ms.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;yn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=ds(t,null,t.V),Zr(t)},ms.prototype.close=function(){Jr(this.g)},ms.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=He(t),t=n);e.i.push(new gr(e.ab++,t)),3==e.G&&Zr(e)},ms.prototype.M=function(){this.g.l=null,delete this.j,Jr(this.g),delete this.g,ms.X.M.call(this)},Ft(ys,Cn),Ft(vs,kn),Ft(ws,ps),ws.prototype.xa=function(){Be(this.g,"a")},ws.prototype.wa=function(t){Be(this.g,new ys(t))},ws.prototype.va=function(t){Be(this.g,new vs)},ws.prototype.ua=function(){Be(this.g,"b")},gs.prototype.createWebChannel=gs.prototype.g,ms.prototype.send=ms.prototype.u,ms.prototype.open=ms.prototype.m,ms.prototype.close=ms.prototype.close,_n.NO_ERROR=0,_n.TIMEOUT=8,_n.HTTP_ERROR=6,Tn.COMPLETE="complete",Sn.EventType=An,An.OPEN="a",An.CLOSE="b",An.ERROR="c",An.MESSAGE="d",Ve.prototype.listen=Ve.prototype.N,Mr.prototype.listenOnce=Mr.prototype.O,Mr.prototype.getLastError=Mr.prototype.Oa,Mr.prototype.getLastErrorCode=Mr.prototype.Ea,Mr.prototype.getStatus=Mr.prototype.aa,Mr.prototype.getResponseJson=Mr.prototype.Sa,Mr.prototype.getResponseText=Mr.prototype.fa,Mr.prototype.send=Mr.prototype.da,Mr.prototype.setWithCredentials=Mr.prototype.Ka;var _s=_n,Ts=Tn,Is=ln,Es=10,Ss=11,bs=kr,As=Sn,Cs=Mr;const ks="@firebase/firestore";
315
316
  /**
316
317
  * @license
317
318
  * Copyright 2017 Google LLC
@@ -327,7 +328,7 @@ class ie{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
327
328
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
328
329
  * See the License for the specific language governing permissions and
329
330
  * limitations under the License.
330
- */class As{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}As.UNAUTHENTICATED=new As(null),As.GOOGLE_CREDENTIALS=new As("google-credentials-uid"),As.FIRST_PARTY=new As("first-party-uid"),As.MOCK_USER=new As("mock-user");
331
+ */class Ns{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Ns.UNAUTHENTICATED=new Ns(null),Ns.GOOGLE_CREDENTIALS=new Ns("google-credentials-uid"),Ns.FIRST_PARTY=new Ns("first-party-uid"),Ns.MOCK_USER=new Ns("mock-user");
331
332
  /**
332
333
  * @license
333
334
  * Copyright 2017 Google LLC
@@ -344,7 +345,7 @@ class ie{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
344
345
  * See the License for the specific language governing permissions and
345
346
  * limitations under the License.
346
347
  */
347
- let ks="9.15.0";
348
+ let Rs="9.15.0";
348
349
  /**
349
350
  * @license
350
351
  * Copyright 2017 Google LLC
@@ -360,7 +361,7 @@ let ks="9.15.0";
360
361
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
361
362
  * See the License for the specific language governing permissions and
362
363
  * limitations under the License.
363
- */const Ns=new D("@firebase/firestore");function Ds(){return Ns.logLevel}function Rs(e,...t){if(Ns.logLevel<=S.DEBUG){const n=t.map(Ps);Ns.debug(`Firestore (${ks}): ${e}`,...n)}}function Os(e,...t){if(Ns.logLevel<=S.ERROR){const n=t.map(Ps);Ns.error(`Firestore (${ks}): ${e}`,...n)}}function Ls(e,...t){if(Ns.logLevel<=S.WARN){const n=t.map(Ps);Ns.warn(`Firestore (${ks}): ${e}`,...n)}}function Ps(e){if("string"==typeof e)return e;try{return t=e,JSON.stringify(t)}catch(t){return e}
364
+ */const Ds=new O("@firebase/firestore");function Os(){return Ds.logLevel}function Ls(t,...e){if(Ds.logLevel<=C.DEBUG){const n=e.map(xs);Ds.debug(`Firestore (${Rs}): ${t}`,...n)}}function Ps(t,...e){if(Ds.logLevel<=C.ERROR){const n=e.map(xs);Ds.error(`Firestore (${Rs}): ${t}`,...n)}}function Ms(t,...e){if(Ds.logLevel<=C.WARN){const n=e.map(xs);Ds.warn(`Firestore (${Rs}): ${t}`,...n)}}function xs(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
364
365
  /**
365
366
  * @license
366
367
  * Copyright 2020 Google LLC
@@ -376,7 +377,7 @@ let ks="9.15.0";
376
377
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
377
378
  * See the License for the specific language governing permissions and
378
379
  * limitations under the License.
379
- */var t}
380
+ */var e}
380
381
  /**
381
382
  * @license
382
383
  * Copyright 2017 Google LLC
@@ -392,7 +393,7 @@ let ks="9.15.0";
392
393
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
393
394
  * See the License for the specific language governing permissions and
394
395
  * limitations under the License.
395
- */function Ms(e="Unexpected state"){const t=`FIRESTORE (${ks}) INTERNAL ASSERTION FAILED: `+e;throw Os(t),new Error(t)}function xs(e,t){e||Ms()}function Us(e,t){return e}
396
+ */function Us(t="Unexpected state"){const e=`FIRESTORE (${Rs}) INTERNAL ASSERTION FAILED: `+t;throw Ps(e),new Error(e)}function Fs(t,e){t||Us()}function Vs(t,e){return t}
396
397
  /**
397
398
  * @license
398
399
  * Copyright 2017 Google LLC
@@ -408,7 +409,7 @@ let ks="9.15.0";
408
409
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
409
410
  * See the License for the specific language governing permissions and
410
411
  * limitations under the License.
411
- */const Fs={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Vs extends h{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
412
+ */const Bs={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class js extends d{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
412
413
  /**
413
414
  * @license
414
415
  * Copyright 2017 Google LLC
@@ -424,7 +425,7 @@ let ks="9.15.0";
424
425
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
425
426
  * See the License for the specific language governing permissions and
426
427
  * limitations under the License.
427
- */class qs{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}}
428
+ */class Hs{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
428
429
  /**
429
430
  * @license
430
431
  * Copyright 2017 Google LLC
@@ -440,7 +441,7 @@ let ks="9.15.0";
440
441
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
441
442
  * See the License for the specific language governing permissions and
442
443
  * limitations under the License.
443
- */class js{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Bs{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable((()=>t(As.UNAUTHENTICATED)))}shutdown(){}}class zs{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable((()=>t(this.token.user)))}shutdown(){this.changeListener=null}}class $s{constructor(e){this.t=e,this.currentUser=As.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let s=new qs;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new qs,e.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const t=s;e.enqueueRetryable((async()=>{await t.promise,await r(this.currentUser)}))},o=e=>{Rs("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((e=>o(e))),setTimeout((()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(Rs("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new qs)}}),0),i()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then((t=>this.i!==e?(Rs("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(xs("string"==typeof t.accessToken),new js(t.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const e=this.auth&&this.auth.getUid();return xs(null===e||"string"==typeof e),new As(e)}}class Ks{constructor(e,t,n,r){this.h=e,this.l=t,this.m=n,this.g=r,this.type="FirstParty",this.user=As.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(xs(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const e=this.I();return e&&this.p.set("Authorization",e),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Hs{constructor(e,t,n,r){this.h=e,this.l=t,this.m=n,this.g=r}getToken(){return Promise.resolve(new Ks(this.h,this.l,this.m,this.g))}start(e,t){e.enqueueRetryable((()=>t(As.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Gs{constructor(e){this.value=e,this.type="AppCheck",this.headers=new Map,e&&e.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Ws{constructor(e){this.T=e,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(e,t){const n=e=>{null!=e.error&&Rs("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.A;return this.A=e.token,Rs("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable((()=>n(t)))};const r=e=>{Rs("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.appCheck.addTokenListener(this.o)};this.T.onInit((e=>r(e))),setTimeout((()=>{if(!this.appCheck){const e=this.T.getImmediate({optional:!0});e?r(e):Rs("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((e=>e?(xs("string"==typeof e.token),this.A=e.token,new Gs(e.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
444
+ */class qs{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Ks{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Ns.UNAUTHENTICATED)))}shutdown(){}}class Ws{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class zs{constructor(t){this.t=t,this.currentUser=Ns.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new Hs;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Hs,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Ls("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Ls("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Hs)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Ls("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Fs("string"==typeof e.accessToken),new qs(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Fs(null===t||"string"==typeof t),new Ns(t)}}class $s{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Ns.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Fs(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Gs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new $s(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Ns.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Qs{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Js{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Ls("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Ls("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Ls("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Ls("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Fs("string"==typeof t.token),this.A=t.token,new Qs(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
444
445
  /**
445
446
  * @license
446
447
  * Copyright 2020 Google LLC
@@ -456,7 +457,7 @@ let ks="9.15.0";
456
457
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
457
458
  * See the License for the specific language governing permissions and
458
459
  * limitations under the License.
459
- */function Qs(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}
460
+ */function Ys(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
460
461
  /**
461
462
  * @license
462
463
  * Copyright 2017 Google LLC
@@ -472,7 +473,7 @@ let ks="9.15.0";
472
473
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
473
474
  * See the License for the specific language governing permissions and
474
475
  * limitations under the License.
475
- */class Ys{static R(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let n="";for(;n.length<20;){const r=Qs(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<t&&(n+=e.charAt(r[s]%e.length))}return n}}function Xs(e,t){return e<t?-1:e>t?1:0}function Js(e,t,n){return e.length===t.length&&e.every(((e,r)=>n(e,t[r])))}
476
+ */class Xs{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=Math.floor(256/t.length)*t.length;let n="";for(;n.length<20;){const r=Ys(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%t.length))}return n}}function Zs(t,e){return t<e?-1:t>e?1:0}function ti(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
476
477
  /**
477
478
  * @license
478
479
  * Copyright 2017 Google LLC
@@ -488,7 +489,7 @@ let ks="9.15.0";
488
489
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
489
490
  * See the License for the specific language governing permissions and
490
491
  * limitations under the License.
491
- */class Zs{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Vs(Fs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Zs.fromMillis(Date.now())}static fromDate(e){return Zs.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor(1e6*(e-1e3*t));return new Zs(t,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?Xs(this.nanoseconds,e.nanoseconds):Xs(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
492
+ */class ei{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new js(Bs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new js(Bs.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new js(Bs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new js(Bs.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return ei.fromMillis(Date.now())}static fromDate(t){return ei.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new ei(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Zs(this.nanoseconds,t.nanoseconds):Zs(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
492
493
  /**
493
494
  * @license
494
495
  * Copyright 2017 Google LLC
@@ -504,7 +505,7 @@ let ks="9.15.0";
504
505
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
505
506
  * See the License for the specific language governing permissions and
506
507
  * limitations under the License.
507
- */class ei{constructor(e){this.timestamp=e}static fromTimestamp(e){return new ei(e)}static min(){return new ei(new Zs(0,0))}static max(){return new ei(new Zs(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
508
+ */class ni{constructor(t){this.timestamp=t}static fromTimestamp(t){return new ni(t)}static min(){return new ni(new ei(0,0))}static max(){return new ni(new ei(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
508
509
  /**
509
510
  * @license
510
511
  * Copyright 2017 Google LLC
@@ -520,7 +521,7 @@ let ks="9.15.0";
520
521
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
521
522
  * See the License for the specific language governing permissions and
522
523
  * limitations under the License.
523
- */class ti{constructor(e,t,n){void 0===t?t=0:t>e.length&&Ms(),void 0===n?n=e.length-t:n>e.length-t&&Ms(),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===ti.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof ti?e.forEach((e=>{t.push(e)})):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=e.get(r),s=t.get(r);if(n<s)return-1;if(n>s)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class ni extends ti{construct(e,t,n){return new ni(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter((e=>e.length>0)))}return new ni(t)}static emptyPath(){return new ni([])}}const ri=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class si extends ti{construct(e,t,n){return new si(e,t,n)}static isValidIdentifier(e){return ri.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),si.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new si(["__name__"])}static fromServerFormat(e){const t=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let i=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new Vs(Fs.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new Vs(Fs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?(i=!i,r++):"."!==t||i?(n+=t,r++):(s(),r++)}if(s(),i)throw new Vs(Fs.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new si(t)}static emptyPath(){return new si([])}}
524
+ */class ri{constructor(t,e,n){void 0===e?e=0:e>t.length&&Us(),void 0===n?n=t.length-e:n>t.length-e&&Us(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===ri.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof ri?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),s=e.get(r);if(n<s)return-1;if(n>s)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class si extends ri{construct(t,e,n){return new si(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new js(Bs.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new si(e)}static emptyPath(){return new si([])}}const ii=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class oi extends ri{construct(t,e,n){return new oi(t,e,n)}static isValidIdentifier(t){return ii.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),oi.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new oi(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new js(Bs.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new js(Bs.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new js(Bs.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(i=!i,r++):"."!==e||i?(n+=e,r++):(s(),r++)}if(s(),i)throw new js(Bs.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new oi(e)}static emptyPath(){return new oi([])}}
524
525
  /**
525
526
  * @license
526
527
  * Copyright 2017 Google LLC
@@ -536,7 +537,7 @@ let ks="9.15.0";
536
537
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
537
538
  * See the License for the specific language governing permissions and
538
539
  * limitations under the License.
539
- */class ii{constructor(e){this.path=e}static fromPath(e){return new ii(ni.fromString(e))}static fromName(e){return new ii(ni.fromString(e).popFirst(5))}static empty(){return new ii(ni.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===ni.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return ni.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ii(new ni(e.slice()))}}function oi(e){return new ai(e.readTime,e.key,-1)}class ai{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new ai(ei.min(),ii.empty(),-1)}static max(){return new ai(ei.max(),ii.empty(),-1)}}function ci(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=ii.comparator(e.documentKey,t.documentKey),0!==n?n:Xs(e.largestBatchId,t.largestBatchId))}
540
+ */class ai{constructor(t){this.path=t}static fromPath(t){return new ai(si.fromString(t))}static fromName(t){return new ai(si.fromString(t).popFirst(5))}static empty(){return new ai(si.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===si.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return si.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new ai(new si(t.slice()))}}function ci(t){return new ui(t.readTime,t.key,-1)}class ui{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ui(ni.min(),ai.empty(),-1)}static max(){return new ui(ni.max(),ai.empty(),-1)}}function hi(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=ai.comparator(t.documentKey,e.documentKey),0!==n?n:Zs(t.largestBatchId,e.largestBatchId))}
540
541
  /**
541
542
  * @license
542
543
  * Copyright 2020 Google LLC
@@ -552,7 +553,7 @@ let ks="9.15.0";
552
553
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553
554
  * See the License for the specific language governing permissions and
554
555
  * limitations under the License.
555
- */class ui{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}
556
+ */class li{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
556
557
  /**
557
558
  * @license
558
559
  * Copyright 2017 Google LLC
@@ -568,7 +569,7 @@ let ks="9.15.0";
568
569
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
569
570
  * See the License for the specific language governing permissions and
570
571
  * limitations under the License.
571
- */async function hi(e){if(e.code!==Fs.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;Rs("LocalStore","Unexpectedly lost primary lease")}
572
+ */async function di(t){if(t.code!==Bs.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==t.message)throw t;Ls("LocalStore","Unexpectedly lost primary lease")}
572
573
  /**
573
574
  * @license
574
575
  * Copyright 2017 Google LLC
@@ -584,7 +585,7 @@ let ks="9.15.0";
584
585
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
585
586
  * See the License for the specific language governing permissions and
586
587
  * limitations under the License.
587
- */class li{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e((e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)}),(e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)}))}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&Ms(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new li(((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}}))}toPromise(){return new Promise(((e,t)=>{this.next(e,t)}))}wrapUserFunction(e){try{const t=e();return t instanceof li?t:li.resolve(t)}catch(e){return li.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction((()=>e(t))):li.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction((()=>e(t))):li.reject(t)}static resolve(e){return new li(((t,n)=>{t(e)}))}static reject(e){return new li(((t,n)=>{n(e)}))}static waitFor(e){return new li(((t,n)=>{let r=0,s=0,i=!1;e.forEach((e=>{++r,e.next((()=>{++s,i&&s===r&&t()}),(e=>n(e)))})),i=!0,s===r&&t()}))}static or(e){let t=li.resolve(!1);for(const n of e)t=t.next((e=>e?li.resolve(e):n()));return t}static forEach(e,t){const n=[];return e.forEach(((e,r)=>{n.push(t.call(this,e,r))})),this.waitFor(n)}static mapArray(e,t){return new li(((n,r)=>{const s=e.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;t(e[c]).next((e=>{i[c]=e,++o,o===s&&n(i)}),(e=>r(e)))}}))}static doWhile(e,t){return new li(((n,r)=>{const s=()=>{!0===e()?t().next((()=>{s()}),r):n()};s()}))}}function di(e){return"IndexedDbTransactionError"===e.name}
588
+ */class fi{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Us(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new fi(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof fi?e:fi.resolve(e)}catch(t){return fi.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):fi.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):fi.reject(e)}static resolve(t){return new fi(((e,n)=>{e(t)}))}static reject(t){return new fi(((e,n)=>{n(t)}))}static waitFor(t){return new fi(((e,n)=>{let r=0,s=0,i=!1;t.forEach((t=>{++r,t.next((()=>{++s,i&&s===r&&e()}),(t=>n(t)))})),i=!0,s===r&&e()}))}static or(t){let e=fi.resolve(!1);for(const n of t)e=e.next((t=>t?fi.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new fi(((n,r)=>{const s=t.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;e(t[c]).next((t=>{i[c]=t,++o,o===s&&n(i)}),(t=>r(t)))}}))}static doWhile(t,e){return new fi(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}function pi(t){return"IndexedDbTransactionError"===t.name}
588
589
  /**
589
590
  * @license
590
591
  * Copyright 2018 Google LLC
@@ -600,7 +601,7 @@ let ks="9.15.0";
600
601
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
601
602
  * See the License for the specific language governing permissions and
602
603
  * limitations under the License.
603
- */class fi{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ut(e),this.ct=e=>t.writeSequenceNumber(e))}ut(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ct&&this.ct(e),e}}fi.at=-1;
604
+ */class gi{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}gi.at=-1;
604
605
  /**
605
606
  * @license
606
607
  * Copyright 2017 Google LLC
@@ -617,7 +618,7 @@ let ks="9.15.0";
617
618
  * See the License for the specific language governing permissions and
618
619
  * limitations under the License.
619
620
  */
620
- class pi{constructor(e,t,n,r,s,i,o,a){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class gi{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new gi("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(e){return e instanceof gi&&e.projectId===this.projectId&&e.database===this.database}}
621
+ class mi{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class yi{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new yi("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof yi&&t.projectId===this.projectId&&t.database===this.database}}
621
622
  /**
622
623
  * @license
623
624
  * Copyright 2017 Google LLC
@@ -633,7 +634,7 @@ class pi{constructor(e,t,n,r,s,i,o,a){this.databaseId=e,this.appId=t,this.persis
633
634
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
634
635
  * See the License for the specific language governing permissions and
635
636
  * limitations under the License.
636
- */function mi(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function yi(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function vi(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}
637
+ */function vi(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function wi(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function _i(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
637
638
  /**
638
639
  * @license
639
640
  * Copyright 2017 Google LLC
@@ -649,7 +650,7 @@ class pi{constructor(e,t,n,r,s,i,o,a){this.databaseId=e,this.appId=t,this.persis
649
650
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
650
651
  * See the License for the specific language governing permissions and
651
652
  * limitations under the License.
652
- */function wi(e){return null==e}function Ii(e){return 0===e&&1/e==-1/0}
653
+ */function Ti(t){return null==t}function Ii(t){return 0===t&&1/t==-1/0}
653
654
  /**
654
655
  * @license
655
656
  * Copyright 2020 Google LLC
@@ -666,7 +667,7 @@ class pi{constructor(e,t,n,r,s,i,o,a){this.databaseId=e,this.appId=t,this.persis
666
667
  * See the License for the specific language governing permissions and
667
668
  * limitations under the License.
668
669
  */
669
- class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=atob(e);return new bi(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new bi(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}
670
+ class Ei{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new Ei(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new Ei(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}
670
671
  /**
671
672
  * @license
672
673
  * Copyright 2020 Google LLC
@@ -682,7 +683,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
682
683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
683
684
  * See the License for the specific language governing permissions and
684
685
  * limitations under the License.
685
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Xs(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}bi.EMPTY_BYTE_STRING=new bi("");const Ti=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Ei(e){if(xs(!!e),"string"==typeof e){let t=0;const n=Ti.exec(e);if(xs(!!n),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:_i(e.seconds),nanos:_i(e.nanos)}}function _i(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function Si(e){return"string"==typeof e?bi.fromBase64String(e):bi.fromUint8Array(e)}
686
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Zs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}Ei.EMPTY_BYTE_STRING=new Ei("");const Si=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bi(t){if(Fs(!!t),"string"==typeof t){let e=0;const n=Si.exec(t);if(Fs(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Ai(t.seconds),nanos:Ai(t.nanos)}}function Ai(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function Ci(t){return"string"==typeof t?Ei.fromBase64String(t):Ei.fromUint8Array(t)}
686
687
  /**
687
688
  * @license
688
689
  * Copyright 2020 Google LLC
@@ -698,7 +699,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
698
699
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
699
700
  * See the License for the specific language governing permissions and
700
701
  * limitations under the License.
701
- */function Ci(e){var t,n;return"server_timestamp"===(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Ai(e){const t=e.mapValue.fields.__previous_value__;return Ci(t)?Ai(t):t}function ki(e){const t=Ei(e.mapValue.fields.__local_write_time__.timestampValue);return new Zs(t.seconds,t.nanos)}
702
+ */function ki(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Ni(t){const e=t.mapValue.fields.__previous_value__;return ki(e)?Ni(e):e}function Ri(t){const e=bi(t.mapValue.fields.__local_write_time__.timestampValue);return new ei(e.seconds,e.nanos)}
702
703
  /**
703
704
  * @license
704
705
  * Copyright 2020 Google LLC
@@ -714,7 +715,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
714
715
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
715
716
  * See the License for the specific language governing permissions and
716
717
  * limitations under the License.
717
- */const Ni={fields:{__type__:{stringValue:"__max__"}}};function Di(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?Ci(e)?4:function(e){return"__max__"===(((e.mapValue||{}).fields||{}).__type__||{}).stringValue}
718
+ */const Di={fields:{__type__:{stringValue:"__max__"}}};function Oi(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?ki(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
718
719
  /**
719
720
  * @license
720
721
  * Copyright 2022 Google LLC
@@ -730,7 +731,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
730
731
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
731
732
  * See the License for the specific language governing permissions and
732
733
  * limitations under the License.
733
- */(e)?9007199254740991:10:Ms()}function Ri(e,t){if(e===t)return!0;const n=Di(e);if(n!==Di(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return ki(e).isEqual(ki(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=Ei(e.timestampValue),r=Ei(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Si(e.bytesValue).isEqual(Si(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return _i(e.geoPointValue.latitude)===_i(t.geoPointValue.latitude)&&_i(e.geoPointValue.longitude)===_i(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return _i(e.integerValue)===_i(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=_i(e.doubleValue),r=_i(t.doubleValue);return n===r?Ii(n)===Ii(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Js(e.arrayValue.values||[],t.arrayValue.values||[],Ri);case 10:return function(e,t){const n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(mi(n)!==mi(r))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===r[e]||!Ri(n[e],r[e])))return!1;return!0}(e,t);default:return Ms()}}function Oi(e,t){return void 0!==(e.values||[]).find((e=>Ri(e,t)))}function Li(e,t){if(e===t)return 0;const n=Di(e),r=Di(t);if(n!==r)return Xs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Xs(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=_i(e.integerValue||e.doubleValue),r=_i(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return Pi(e.timestampValue,t.timestampValue);case 4:return Pi(ki(e),ki(t));case 5:return Xs(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Si(e),r=Si(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let e=0;e<n.length&&e<r.length;e++){const t=Xs(n[e],r[e]);if(0!==t)return t}return Xs(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=Xs(_i(e.latitude),_i(t.latitude));return 0!==n?n:Xs(_i(e.longitude),_i(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return function(e,t){const n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){const t=Li(n[e],r[e]);if(t)return t}return Xs(n.length,r.length)}(e.arrayValue,t.arrayValue);case 10:return function(e,t){if(e===Ni&&t===Ni)return 0;if(e===Ni)return 1;if(t===Ni)return-1;const n=e.fields||{},r=Object.keys(n),s=t.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let e=0;e<r.length&&e<i.length;++e){const t=Xs(r[e],i[e]);if(0!==t)return t;const o=Li(n[r[e]],s[i[e]]);if(0!==o)return o}return Xs(r.length,i.length)}(e.mapValue,t.mapValue);default:throw Ms()}}function Pi(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Xs(e,t);const n=Ei(e),r=Ei(t),s=Xs(n.seconds,r.seconds);return 0!==s?s:Xs(n.nanos,r.nanos)}function Mi(e){return xi(e)}function xi(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=Ei(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?Si(e.bytesValue).toBase64():"referenceValue"in e?(n=e.referenceValue,ii.fromName(n).toString()):"geoPointValue"in e?`geo(${(t=e.geoPointValue).latitude},${t.longitude})`:"arrayValue"in e?function(e){let t="[",n=!0;for(const r of e.values||[])n?n=!1:t+=",",t+=xi(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",r=!0;for(const s of t)r?r=!1:n+=",",n+=`${s}:${xi(e.fields[s])}`;return n+"}"}(e.mapValue):Ms();var t,n}function Ui(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function Fi(e){return!!e&&"integerValue"in e}function Vi(e){return!!e&&"arrayValue"in e}function qi(e){return!!e&&"nullValue"in e}function ji(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function Bi(e){return!!e&&"mapValue"in e}function zi(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return yi(e.mapValue.fields,((e,n)=>t.mapValue.fields[e]=zi(n))),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=zi(e.arrayValue.values[n]);return t}return Object.assign({},e)}class $i{constructor(e,t){this.position=e,this.inclusive=t}}function Ki(e,t,n){let r=0;for(let s=0;s<e.position.length;s++){const i=t[s],o=e.position[s];if(r=i.field.isKeyField()?ii.comparator(ii.fromName(o.referenceValue),n.key):Li(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function Hi(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!Ri(e.position[n],t.position[n]))return!1;return!0}
734
+ */(t)?9007199254740991:10:Us()}function Li(t,e){if(t===e)return!0;const n=Oi(t);if(n!==Oi(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ri(t).isEqual(Ri(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=bi(t.timestampValue),r=bi(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return Ci(t.bytesValue).isEqual(Ci(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Ai(t.geoPointValue.latitude)===Ai(e.geoPointValue.latitude)&&Ai(t.geoPointValue.longitude)===Ai(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Ai(t.integerValue)===Ai(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Ai(t.doubleValue),r=Ai(e.doubleValue);return n===r?Ii(n)===Ii(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return ti(t.arrayValue.values||[],e.arrayValue.values||[],Li);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(vi(n)!==vi(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Li(n[t],r[t])))return!1;return!0}(t,e);default:return Us()}}function Pi(t,e){return void 0!==(t.values||[]).find((t=>Li(t,e)))}function Mi(t,e){if(t===e)return 0;const n=Oi(t),r=Oi(e);if(n!==r)return Zs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Zs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Ai(t.integerValue||t.doubleValue),r=Ai(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return xi(t.timestampValue,e.timestampValue);case 4:return xi(Ri(t),Ri(e));case 5:return Zs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=Ci(t),r=Ci(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Zs(n[t],r[t]);if(0!==e)return e}return Zs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Zs(Ai(t.latitude),Ai(e.latitude));return 0!==n?n:Zs(Ai(t.longitude),Ai(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Mi(n[t],r[t]);if(e)return e}return Zs(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Di&&e===Di)return 0;if(t===Di)return 1;if(e===Di)return-1;const n=t.fields||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=Zs(r[t],i[t]);if(0!==e)return e;const o=Mi(n[r[t]],s[i[t]]);if(0!==o)return o}return Zs(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Us()}}function xi(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Zs(t,e);const n=bi(t),r=bi(e),s=Zs(n.seconds,r.seconds);return 0!==s?s:Zs(n.nanos,r.nanos)}function Ui(t){return Fi(t)}function Fi(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=bi(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?Ci(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,ai.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Fi(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Fi(t.fields[s])}`;return n+"}"}(t.mapValue):Us();var e,n}function Vi(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Bi(t){return!!t&&"integerValue"in t}function ji(t){return!!t&&"arrayValue"in t}function Hi(t){return!!t&&"nullValue"in t}function qi(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Ki(t){return!!t&&"mapValue"in t}function Wi(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return wi(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Wi(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Wi(t.arrayValue.values[n]);return e}return Object.assign({},t)}class zi{constructor(t,e){this.position=t,this.inclusive=e}}function $i(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?ai.comparator(ai.fromName(o.referenceValue),n.key):Mi(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function Gi(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Li(t.position[n],e.position[n]))return!1;return!0}
734
735
  /**
735
736
  * @license
736
737
  * Copyright 2022 Google LLC
@@ -746,7 +747,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
746
747
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
747
748
  * See the License for the specific language governing permissions and
748
749
  * limitations under the License.
749
- */class Gi{}class Wi extends Gi{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new to(e,t,n):"array-contains"===t?new io(e,n):"in"===t?new oo(e,n):"not-in"===t?new ao(e,n):"array-contains-any"===t?new co(e,n):new Wi(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new no(e,n):new ro(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&this.matchesComparison(Li(t,this.value)):null!==t&&Di(this.value)===Di(t)&&this.matchesComparison(Li(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return Ms()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Qi extends Gi{constructor(e,t){super(),this.filters=e,this.op=t,this.ht=null}static create(e,t){return new Qi(e,t)}matches(e){return Yi(this)?void 0===this.filters.find((t=>!t.matches(e))):void 0!==this.filters.find((t=>t.matches(e)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((e,t)=>e.concat(t.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const e=this.lt((e=>e.isInequality()));return null!==e?e.field:null}lt(e){for(const t of this.getFlattenedFilters())if(e(t))return t;return null}}function Yi(e){return"and"===e.op}function Xi(e){return function(e){for(const t of e.filters)if(t instanceof Qi)return!1;return!0}(e)&&Yi(e)}function Ji(e){if(e instanceof Wi)return e.field.canonicalString()+e.op.toString()+Mi(e.value);{const t=e.filters.map((e=>Ji(e))).join(",");return`${e.op}(${t})`}}function Zi(e,t){return e instanceof Wi?function(e,t){return t instanceof Wi&&e.op===t.op&&e.field.isEqual(t.field)&&Ri(e.value,t.value)}(e,t):e instanceof Qi?function(e,t){return t instanceof Qi&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce(((e,n,r)=>e&&Zi(n,t.filters[r])),!0)}(e,t):void Ms()}function eo(e){return e instanceof Wi?function(e){return`${e.field.canonicalString()} ${e.op} ${Mi(e.value)}`}(e):e instanceof Qi?function(e){return e.op.toString()+" {"+e.getFilters().map(eo).join(" ,")+"}"}(e):"Filter"}class to extends Wi{constructor(e,t,n){super(e,t,n),this.key=ii.fromName(n.referenceValue)}matches(e){const t=ii.comparator(e.key,this.key);return this.matchesComparison(t)}}class no extends Wi{constructor(e,t){super(e,"in",t),this.keys=so("in",t)}matches(e){return this.keys.some((t=>t.isEqual(e.key)))}}class ro extends Wi{constructor(e,t){super(e,"not-in",t),this.keys=so("not-in",t)}matches(e){return!this.keys.some((t=>t.isEqual(e.key)))}}function so(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map((e=>ii.fromName(e.referenceValue)))}class io extends Wi{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return Vi(t)&&Oi(t.arrayValue,this.value)}}class oo extends Wi{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&Oi(this.value.arrayValue,t)}}class ao extends Wi{constructor(e,t){super(e,"not-in",t)}matches(e){if(Oi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&!Oi(this.value.arrayValue,t)}}class co extends Wi{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!Vi(t)||!t.arrayValue.values)&&t.arrayValue.values.some((e=>Oi(this.value.arrayValue,e)))}}
750
+ */class Qi{}class Ji extends Qi{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new ro(t,e,n):"array-contains"===e?new ao(t,n):"in"===e?new co(t,n):"not-in"===e?new uo(t,n):"array-contains-any"===e?new ho(t,n):new Ji(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new so(t,n):new io(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Mi(e,this.value)):null!==e&&Oi(this.value)===Oi(e)&&this.matchesComparison(Mi(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Us()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Yi extends Qi{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Yi(t,e)}matches(t){return Xi(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Xi(t){return"and"===t.op}function Zi(t){return function(t){for(const e of t.filters)if(e instanceof Yi)return!1;return!0}(t)&&Xi(t)}function to(t){if(t instanceof Ji)return t.field.canonicalString()+t.op.toString()+Ui(t.value);{const e=t.filters.map((t=>to(t))).join(",");return`${t.op}(${e})`}}function eo(t,e){return t instanceof Ji?function(t,e){return e instanceof Ji&&t.op===e.op&&t.field.isEqual(e.field)&&Li(t.value,e.value)}(t,e):t instanceof Yi?function(t,e){return e instanceof Yi&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&eo(n,e.filters[r])),!0)}(t,e):void Us()}function no(t){return t instanceof Ji?function(t){return`${t.field.canonicalString()} ${t.op} ${Ui(t.value)}`}(t):t instanceof Yi?function(t){return t.op.toString()+" {"+t.getFilters().map(no).join(" ,")+"}"}(t):"Filter"}class ro extends Ji{constructor(t,e,n){super(t,e,n),this.key=ai.fromName(n.referenceValue)}matches(t){const e=ai.comparator(t.key,this.key);return this.matchesComparison(e)}}class so extends Ji{constructor(t,e){super(t,"in",e),this.keys=oo("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class io extends Ji{constructor(t,e){super(t,"not-in",e),this.keys=oo("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function oo(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>ai.fromName(t.referenceValue)))}class ao extends Ji{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return ji(e)&&Pi(e.arrayValue,this.value)}}class co extends Ji{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Pi(this.value.arrayValue,e)}}class uo extends Ji{constructor(t,e){super(t,"not-in",e)}matches(t){if(Pi(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Pi(this.value.arrayValue,e)}}class ho extends Ji{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!ji(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Pi(this.value.arrayValue,t)))}}
750
751
  /**
751
752
  * @license
752
753
  * Copyright 2022 Google LLC
@@ -762,7 +763,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
762
763
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
763
764
  * See the License for the specific language governing permissions and
764
765
  * limitations under the License.
765
- */class uo{constructor(e,t="asc"){this.field=e,this.dir=t}}function ho(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}
766
+ */class lo{constructor(t,e="asc"){this.field=t,this.dir=e}}function fo(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
766
767
  /**
767
768
  * @license
768
769
  * Copyright 2017 Google LLC
@@ -778,7 +779,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
778
779
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
779
780
  * See the License for the specific language governing permissions and
780
781
  * limitations under the License.
781
- */class lo{constructor(e,t){this.comparator=e,this.root=t||po.EMPTY}insert(e,t){return new lo(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,po.BLACK,null,null))}remove(e){return new lo(this.comparator,this.root.remove(e,this.comparator).copy(null,null,po.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal(((t,n)=>(e(t,n),!1)))}toString(){const e=[];return this.inorderTraversal(((t,n)=>(e.push(`${t}:${n}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new fo(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new fo(this.root,e,this.comparator,!1)}getReverseIterator(){return new fo(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new fo(this.root,e,this.comparator,!0)}}class fo{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&r&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(0===s){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class po{constructor(e,t,n,r,s){this.key=e,this.value=t,this.color=null!=n?n:po.RED,this.left=null!=r?r:po.EMPTY,this.right=null!=s?s:po.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,s){return new po(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const s=n(e,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===s?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return po.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return po.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,po.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,po.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ms();if(this.right.isRed())throw Ms();const e=this.left.check();if(e!==this.right.check())throw Ms();return e+(this.isRed()?0:1)}}po.EMPTY=null,po.RED=!0,po.BLACK=!1,po.EMPTY=new class{constructor(){this.size=0}get key(){throw Ms()}get value(){throw Ms()}get color(){throw Ms()}get left(){throw Ms()}get right(){throw Ms()}copy(e,t,n,r,s){return this}insert(e,t,n){return new po(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
782
+ */class po{constructor(t,e){this.comparator=t,this.root=e||mo.EMPTY}insert(t,e){return new po(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,mo.BLACK,null,null))}remove(t){return new po(this.comparator,this.root.remove(t,this.comparator).copy(null,null,mo.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new go(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new go(this.root,t,this.comparator,!1)}getReverseIterator(){return new go(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new go(this.root,t,this.comparator,!0)}}class go{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=e?n(t.key,e):1,e&&r&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(0===s){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class mo{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:mo.RED,this.left=null!=r?r:mo.EMPTY,this.right=null!=s?s:mo.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new mo(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const s=n(t,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===s?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return mo.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return mo.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,mo.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,mo.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Us();if(this.right.isRed())throw Us();const t=this.left.check();if(t!==this.right.check())throw Us();return t+(this.isRed()?0:1)}}mo.EMPTY=null,mo.RED=!0,mo.BLACK=!1,mo.EMPTY=new class{constructor(){this.size=0}get key(){throw Us()}get value(){throw Us()}get color(){throw Us()}get left(){throw Us()}get right(){throw Us()}copy(t,e,n,r,s){return this}insert(t,e,n){return new mo(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
782
783
  /**
783
784
  * @license
784
785
  * Copyright 2017 Google LLC
@@ -795,7 +796,7 @@ class bi{constructor(e){this.binaryString=e}static fromBase64String(e){const t=a
795
796
  * See the License for the specific language governing permissions and
796
797
  * limitations under the License.
797
798
  */
798
- class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal(((t,n)=>(e(t),!1)))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new mo(this.data.getIterator())}getIteratorFrom(e){return new mo(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach((e=>{t=t.add(e)})),t}isEqual(e){if(!(e instanceof go))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach((t=>{e.push(t)})),e}toString(){const e=[];return this.forEach((t=>e.push(t))),"SortedSet("+e.toString()+")"}copy(e){const t=new go(this.comparator);return t.data=e,t}}class mo{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
799
+ class yo{constructor(t){this.comparator=t,this.data=new po(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new vo(this.data.getIterator())}getIteratorFrom(t){return new vo(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof yo))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new yo(this.comparator);return e.data=t,e}}class vo{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
799
800
  /**
800
801
  * @license
801
802
  * Copyright 2020 Google LLC
@@ -811,7 +812,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
811
812
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
812
813
  * See the License for the specific language governing permissions and
813
814
  * limitations under the License.
814
- */class yo{constructor(e){this.fields=e,e.sort(si.comparator)}static empty(){return new yo([])}unionWith(e){let t=new go(si.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new yo(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Js(this.fields,e.fields,((e,t)=>e.isEqual(t)))}}
815
+ */class wo{constructor(t){this.fields=t,t.sort(oi.comparator)}static empty(){return new wo([])}unionWith(t){let e=new yo(oi.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new wo(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return ti(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
815
816
  /**
816
817
  * @license
817
818
  * Copyright 2017 Google LLC
@@ -827,7 +828,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
827
828
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
828
829
  * See the License for the specific language governing permissions and
829
830
  * limitations under the License.
830
- */class vo{constructor(e){this.value=e}static empty(){return new vo({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!Bi(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=zi(t)}setAll(e){let t=si.emptyPath(),n={},r=[];e.forEach(((e,s)=>{if(!t.isImmediateParentOf(s)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=s.popLast()}e?n[s.lastSegment()]=zi(e):r.push(s.lastSegment())}));const s=this.getFieldsMap(t);this.applyChanges(s,n,r)}delete(e){const t=this.field(e.popLast());Bi(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Ri(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];Bi(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){yi(t,((t,n)=>e[t]=n));for(const t of n)delete e[t]}clone(){return new vo(zi(this.value))}}
831
+ */class _o{constructor(t){this.value=t}static empty(){return new _o({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Ki(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Wi(e)}setAll(t){let e=oi.emptyPath(),n={},r=[];t.forEach(((t,s)=>{if(!e.isImmediateParentOf(s)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=s.popLast()}t?n[s.lastSegment()]=Wi(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());Ki(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Li(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Ki(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){wi(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new _o(Wi(this.value))}}
831
832
  /**
832
833
  * @license
833
834
  * Copyright 2017 Google LLC
@@ -843,7 +844,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
843
844
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
844
845
  * See the License for the specific language governing permissions and
845
846
  * limitations under the License.
846
- */class wo{constructor(e,t,n,r,s,i,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(e){return new wo(e,0,ei.min(),ei.min(),ei.min(),vo.empty(),0)}static newFoundDocument(e,t,n,r){return new wo(e,1,t,ei.min(),n,r,0)}static newNoDocument(e,t){return new wo(e,2,t,ei.min(),ei.min(),vo.empty(),0)}static newUnknownDocument(e,t){return new wo(e,3,t,ei.min(),ei.min(),vo.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(ei.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=vo.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=vo.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ei.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof wo&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new wo(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
847
+ */class To{constructor(t,e,n,r,s,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(t){return new To(t,0,ni.min(),ni.min(),ni.min(),_o.empty(),0)}static newFoundDocument(t,e,n,r){return new To(t,1,e,ni.min(),n,r,0)}static newNoDocument(t,e){return new To(t,2,e,ni.min(),ni.min(),_o.empty(),0)}static newUnknownDocument(t,e){return new To(t,3,e,ni.min(),ni.min(),_o.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(ni.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=_o.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=_o.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ni.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof To&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new To(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}
847
848
  /**
848
849
  * @license
849
850
  * Copyright 2019 Google LLC
@@ -859,7 +860,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
859
860
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
860
861
  * See the License for the specific language governing permissions and
861
862
  * limitations under the License.
862
- */class Io{constructor(e,t=null,n=[],r=[],s=null,i=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function bo(e,t=null,n=[],r=[],s=null,i=null,o=null){return new Io(e,t,n,r,s,i,o)}function To(e){const t=Us(e);if(null===t.ft){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map((e=>Ji(e))).join(","),e+="|ob:",e+=t.orderBy.map((e=>function(e){return e.field.canonicalString()+e.dir}(e))).join(","),wi(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((e=>Mi(e))).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((e=>Mi(e))).join(",")),t.ft=e}return t.ft}function Eo(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!ho(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Zi(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Hi(e.startAt,t.startAt)&&Hi(e.endAt,t.endAt)}function _o(e){return ii.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}
863
+ */class Io{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function Eo(t,e=null,n=[],r=[],s=null,i=null,o=null){return new Io(t,e,n,r,s,i,o)}function So(t){const e=Vs(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>to(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),Ti(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Ui(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Ui(t))).join(",")),e.ft=t}return e.ft}function bo(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!fo(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!eo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Gi(t.startAt,e.startAt)&&Gi(t.endAt,e.endAt)}function Ao(t){return ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
863
864
  /**
864
865
  * @license
865
866
  * Copyright 2017 Google LLC
@@ -875,7 +876,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
875
876
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
876
877
  * See the License for the specific language governing permissions and
877
878
  * limitations under the License.
878
- */class So{constructor(e,t=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Co(e){return new So(e)}function Ao(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function ko(e){return e.explicitOrderBy.length>0?e.explicitOrderBy[0].field:null}function No(e){for(const t of e.filters){const e=t.getFirstInequalityField();if(null!==e)return e}return null}function Do(e){return null!==e.collectionGroup}function Ro(e){const t=Us(e);if(null===t.dt){t.dt=[];const e=No(t),n=ko(t);if(null!==e&&null===n)e.isKeyField()||t.dt.push(new uo(e)),t.dt.push(new uo(si.keyField(),"asc"));else{let e=!1;for(const n of t.explicitOrderBy)t.dt.push(n),n.field.isKeyField()&&(e=!0);if(!e){const e=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc";t.dt.push(new uo(si.keyField(),e))}}}return t.dt}function Oo(e){const t=Us(e);if(!t._t)if("F"===t.limitType)t._t=bo(t.path,t.collectionGroup,Ro(t),t.filters,t.limit,t.startAt,t.endAt);else{const e=[];for(const n of Ro(t)){const t="desc"===n.dir?"asc":"desc";e.push(new uo(n.field,t))}const n=t.endAt?new $i(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new $i(t.startAt.position,t.startAt.inclusive):null;t._t=bo(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}return t._t}function Lo(e,t){t.getFirstInequalityField(),No(e);const n=e.filters.concat([t]);return new So(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function Po(e,t,n){return new So(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function Mo(e,t){return Eo(Oo(e),Oo(t))&&e.limitType===t.limitType}function xo(e){return`${To(Oo(e))}|lt:${e.limitType}`}function Uo(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map((e=>eo(e))).join(", ")}]`),wi(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map((e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e))).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((e=>Mi(e))).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((e=>Mi(e))).join(",")),`Target(${t})`}(Oo(e))}; limitType=${e.limitType})`}function Fo(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):ii.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Ro(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=Ki(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Ro(e),t))&&!(e.endAt&&!function(e,t,n){const r=Ki(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Ro(e),t))}(e,t)}function Vo(e){return(t,n)=>{let r=!1;for(const s of Ro(e)){const e=qo(s,t,n);if(0!==e)return e;r=r||s.field.isKeyField()}return 0}}function qo(e,t,n){const r=e.field.isKeyField()?ii.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),s=n.data.field(e);return null!==r&&null!==s?Li(r,s):Ms()}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return Ms()}}
879
+ */class Co{constructor(t,e=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function ko(t){return new Co(t)}function No(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Ro(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Do(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function Oo(t){return null!==t.collectionGroup}function Lo(t){const e=Vs(t);if(null===e.dt){e.dt=[];const t=Do(e),n=Ro(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new lo(t)),e.dt.push(new lo(oi.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new lo(oi.keyField(),t))}}}return e.dt}function Po(t){const e=Vs(t);if(!e._t)if("F"===e.limitType)e._t=Eo(e.path,e.collectionGroup,Lo(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Lo(e)){const e="desc"===n.dir?"asc":"desc";t.push(new lo(n.field,e))}const n=e.endAt?new zi(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new zi(e.startAt.position,e.startAt.inclusive):null;e._t=Eo(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Mo(t,e){e.getFirstInequalityField(),Do(t);const n=t.filters.concat([e]);return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function xo(t,e,n){return new Co(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Uo(t,e){return bo(Po(t),Po(e))&&t.limitType===e.limitType}function Fo(t){return`${So(Po(t))}|lt:${t.limitType}`}function Vo(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>no(t))).join(", ")}]`),Ti(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Ui(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Ui(t))).join(",")),`Target(${e})`}(Po(t))}; limitType=${t.limitType})`}function Bo(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):ai.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Lo(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=$i(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Lo(t),e))&&!(t.endAt&&!function(t,e,n){const r=$i(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Lo(t),e))}(t,e)}function jo(t){return(e,n)=>{let r=!1;for(const s of Lo(t)){const t=Ho(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function Ho(t,e,n){const r=t.field.isKeyField()?ai.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),s=n.data.field(t);return null!==r&&null!==s?Mi(r,s):Us()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Us()}}
879
880
  /**
880
881
  * @license
881
882
  * Copyright 2020 Google LLC
@@ -891,7 +892,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
891
892
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
892
893
  * See the License for the specific language governing permissions and
893
894
  * limitations under the License.
894
- */function jo(e,t){if(e.wt){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ii(t)?"-0":t}}function Bo(e){return{integerValue:""+e}}function zo(e,t){return function(e){return"number"==typeof e&&Number.isInteger(e)&&!Ii(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}(t)?Bo(t):jo(e,t)}
895
+ */function qo(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Ii(e)?"-0":e}}function Ko(t){return{integerValue:""+t}}function Wo(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!Ii(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ko(e):qo(t,e)}
895
896
  /**
896
897
  * @license
897
898
  * Copyright 2018 Google LLC
@@ -907,7 +908,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
907
908
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
908
909
  * See the License for the specific language governing permissions and
909
910
  * limitations under the License.
910
- */class $o{constructor(){this._=void 0}}function Ko(e,t,n){return e instanceof Go?function(e,t){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&(n.fields.__previous_value__=t),{mapValue:n}}(n,t):e instanceof Wo?Qo(e,t):e instanceof Yo?Xo(e,t):function(e,t){const n=function(e,t){return e instanceof Jo?Fi(n=t)||function(e){return!!e&&"doubleValue"in e}(n)?t:{integerValue:0}:null;var n}(e,t),r=Zo(n)+Zo(e.gt);return Fi(n)&&Fi(e.gt)?Bo(r):jo(e.yt,r)}(e,t)}function Ho(e,t,n){return e instanceof Wo?Qo(e,t):e instanceof Yo?Xo(e,t):n}class Go extends $o{}class Wo extends $o{constructor(e){super(),this.elements=e}}function Qo(e,t){const n=ea(t);for(const t of e.elements)n.some((e=>Ri(e,t)))||n.push(t);return{arrayValue:{values:n}}}class Yo extends $o{constructor(e){super(),this.elements=e}}function Xo(e,t){let n=ea(t);for(const t of e.elements)n=n.filter((e=>!Ri(e,t)));return{arrayValue:{values:n}}}class Jo extends $o{constructor(e,t){super(),this.yt=e,this.gt=t}}function Zo(e){return _i(e.integerValue||e.doubleValue)}function ea(e){return Vi(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class ta{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new ta}static exists(e){return new ta(void 0,e)}static updateTime(e){return new ta(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function na(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class ra{}function sa(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new fa(e.key,ta.none()):new ca(e.key,e.data,ta.none());{const n=e.data,r=vo.empty();let s=new go(si.comparator);for(let e of t.fields)if(!s.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),s=s.add(e)}return new ua(e.key,r,new yo(s.toArray()),ta.none())}}function ia(e,t,n){e instanceof ca?function(e,t,n){const r=e.value.clone(),s=la(e.fieldTransforms,t,n.transformResults);r.setAll(s),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof ua?function(e,t,n){if(!na(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=la(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(ha(e)),s.setAll(r),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function oa(e,t,n,r){return e instanceof ca?function(e,t,n,r){if(!na(e.precondition,t))return n;const s=e.value.clone(),i=da(e.fieldTransforms,r,t);return s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,r):e instanceof ua?function(e,t,n,r){if(!na(e.precondition,t))return n;const s=da(e.fieldTransforms,r,t),i=t.data;return i.setAll(ha(e)),i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map((e=>e.field)))}(e,t,n,r):function(e,t,n){return na(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function aa(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Js(e,t,((e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Wo&&t instanceof Wo||e instanceof Yo&&t instanceof Yo?Js(e.elements,t.elements,Ri):e instanceof Jo&&t instanceof Jo?Ri(e.gt,t.gt):e instanceof Go&&t instanceof Go}(e.transform,t.transform)}(e,t)))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class ca extends ra{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class ua extends ra{constructor(e,t,n,r,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function ha(e){const t=new Map;return e.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}})),t}function la(e,t,n){const r=new Map;xs(e.length===n.length);for(let s=0;s<n.length;s++){const i=e[s],o=i.transform,a=t.data.field(i.field);r.set(i.field,Ho(o,a,n[s]))}return r}function da(e,t,n){const r=new Map;for(const s of e){const e=s.transform,i=n.data.field(s.field);r.set(s.field,Ko(e,i,t))}return r}class fa extends ra{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
911
+ */class zo{constructor(){this._=void 0}}function $o(t,e,n){return t instanceof Qo?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):function(t,e){const n=function(t,e){return t instanceof ta?Bi(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}(t,e),r=ea(n)+ea(t.gt);return Bi(n)&&Bi(t.gt)?Ko(r):qo(t.yt,r)}(t,e)}function Go(t,e,n){return t instanceof Jo?Yo(t,e):t instanceof Xo?Zo(t,e):n}class Qo extends zo{}class Jo extends zo{constructor(t){super(),this.elements=t}}function Yo(t,e){const n=na(e);for(const e of t.elements)n.some((t=>Li(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Xo extends zo{constructor(t){super(),this.elements=t}}function Zo(t,e){let n=na(e);for(const e of t.elements)n=n.filter((t=>!Li(t,e)));return{arrayValue:{values:n}}}class ta extends zo{constructor(t,e){super(),this.yt=t,this.gt=e}}function ea(t){return Ai(t.integerValue||t.doubleValue)}function na(t){return ji(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class ra{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ra}static exists(t){return new ra(void 0,t)}static updateTime(t){return new ra(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function sa(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ia{}function oa(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new ga(t.key,ra.none()):new ha(t.key,t.data,ra.none());{const n=t.data,r=_o.empty();let s=new yo(oi.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new la(t.key,r,new wo(s.toArray()),ra.none())}}function aa(t,e,n){t instanceof ha?function(t,e,n){const r=t.value.clone(),s=fa(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof la?function(t,e,n){if(!sa(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=fa(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(da(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ca(t,e,n,r){return t instanceof ha?function(t,e,n,r){if(!sa(t.precondition,e))return n;const s=t.value.clone(),i=pa(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof la?function(t,e,n,r){if(!sa(t.precondition,e))return n;const s=pa(t.fieldTransforms,r,e),i=e.data;return i.setAll(da(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return sa(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ua(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&ti(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Jo&&e instanceof Jo||t instanceof Xo&&e instanceof Xo?ti(t.elements,e.elements,Li):t instanceof ta&&e instanceof ta?Li(t.gt,e.gt):t instanceof Qo&&e instanceof Qo}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class ha extends ia{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class la extends ia{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function da(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function fa(t,e,n){const r=new Map;Fs(t.length===n.length);for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,Go(o,a,n[s]))}return r}function pa(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,$o(t,i,e))}return r}class ga extends ia{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}
911
912
  /**
912
913
  * @license
913
914
  * Copyright 2017 Google LLC
@@ -923,7 +924,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
923
924
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
924
925
  * See the License for the specific language governing permissions and
925
926
  * limitations under the License.
926
- */class pa{constructor(e){this.count=e}}
927
+ */class ma{constructor(t){this.count=t}}
927
928
  /**
928
929
  * @license
929
930
  * Copyright 2017 Google LLC
@@ -939,7 +940,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
939
940
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
940
941
  * See the License for the specific language governing permissions and
941
942
  * limitations under the License.
942
- */var ga,ma;function ya(e){if(void 0===e)return Os("GRPC error has no .code"),Fs.UNKNOWN;switch(e){case ga.OK:return Fs.OK;case ga.CANCELLED:return Fs.CANCELLED;case ga.UNKNOWN:return Fs.UNKNOWN;case ga.DEADLINE_EXCEEDED:return Fs.DEADLINE_EXCEEDED;case ga.RESOURCE_EXHAUSTED:return Fs.RESOURCE_EXHAUSTED;case ga.INTERNAL:return Fs.INTERNAL;case ga.UNAVAILABLE:return Fs.UNAVAILABLE;case ga.UNAUTHENTICATED:return Fs.UNAUTHENTICATED;case ga.INVALID_ARGUMENT:return Fs.INVALID_ARGUMENT;case ga.NOT_FOUND:return Fs.NOT_FOUND;case ga.ALREADY_EXISTS:return Fs.ALREADY_EXISTS;case ga.PERMISSION_DENIED:return Fs.PERMISSION_DENIED;case ga.FAILED_PRECONDITION:return Fs.FAILED_PRECONDITION;case ga.ABORTED:return Fs.ABORTED;case ga.OUT_OF_RANGE:return Fs.OUT_OF_RANGE;case ga.UNIMPLEMENTED:return Fs.UNIMPLEMENTED;case ga.DATA_LOSS:return Fs.DATA_LOSS;default:return Ms()}}(ma=ga||(ga={}))[ma.OK=0]="OK",ma[ma.CANCELLED=1]="CANCELLED",ma[ma.UNKNOWN=2]="UNKNOWN",ma[ma.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ma[ma.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ma[ma.NOT_FOUND=5]="NOT_FOUND",ma[ma.ALREADY_EXISTS=6]="ALREADY_EXISTS",ma[ma.PERMISSION_DENIED=7]="PERMISSION_DENIED",ma[ma.UNAUTHENTICATED=16]="UNAUTHENTICATED",ma[ma.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ma[ma.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ma[ma.ABORTED=10]="ABORTED",ma[ma.OUT_OF_RANGE=11]="OUT_OF_RANGE",ma[ma.UNIMPLEMENTED=12]="UNIMPLEMENTED",ma[ma.INTERNAL=13]="INTERNAL",ma[ma.UNAVAILABLE=14]="UNAVAILABLE",ma[ma.DATA_LOSS=15]="DATA_LOSS";
943
+ */var ya,va;function wa(t){if(void 0===t)return Ps("GRPC error has no .code"),Bs.UNKNOWN;switch(t){case ya.OK:return Bs.OK;case ya.CANCELLED:return Bs.CANCELLED;case ya.UNKNOWN:return Bs.UNKNOWN;case ya.DEADLINE_EXCEEDED:return Bs.DEADLINE_EXCEEDED;case ya.RESOURCE_EXHAUSTED:return Bs.RESOURCE_EXHAUSTED;case ya.INTERNAL:return Bs.INTERNAL;case ya.UNAVAILABLE:return Bs.UNAVAILABLE;case ya.UNAUTHENTICATED:return Bs.UNAUTHENTICATED;case ya.INVALID_ARGUMENT:return Bs.INVALID_ARGUMENT;case ya.NOT_FOUND:return Bs.NOT_FOUND;case ya.ALREADY_EXISTS:return Bs.ALREADY_EXISTS;case ya.PERMISSION_DENIED:return Bs.PERMISSION_DENIED;case ya.FAILED_PRECONDITION:return Bs.FAILED_PRECONDITION;case ya.ABORTED:return Bs.ABORTED;case ya.OUT_OF_RANGE:return Bs.OUT_OF_RANGE;case ya.UNIMPLEMENTED:return Bs.UNIMPLEMENTED;case ya.DATA_LOSS:return Bs.DATA_LOSS;default:return Us()}}(va=ya||(ya={}))[va.OK=0]="OK",va[va.CANCELLED=1]="CANCELLED",va[va.UNKNOWN=2]="UNKNOWN",va[va.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",va[va.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",va[va.NOT_FOUND=5]="NOT_FOUND",va[va.ALREADY_EXISTS=6]="ALREADY_EXISTS",va[va.PERMISSION_DENIED=7]="PERMISSION_DENIED",va[va.UNAUTHENTICATED=16]="UNAUTHENTICATED",va[va.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",va[va.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",va[va.ABORTED=10]="ABORTED",va[va.OUT_OF_RANGE=11]="OUT_OF_RANGE",va[va.UNIMPLEMENTED=12]="UNIMPLEMENTED",va[va.INTERNAL=13]="INTERNAL",va[va.UNAVAILABLE=14]="UNAVAILABLE",va[va.DATA_LOSS=15]="DATA_LOSS";
943
944
  /**
944
945
  * @license
945
946
  * Copyright 2017 Google LLC
@@ -956,7 +957,7 @@ class go{constructor(e){this.comparator=e,this.data=new lo(this.comparator)}has(
956
957
  * See the License for the specific language governing permissions and
957
958
  * limitations under the License.
958
959
  */
959
- class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,r]of n)if(this.equalsFn(t,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){yi(this.inner,((t,n)=>{for(const[t,r]of n)e(t,r)}))}isEmpty(){return vi(this.inner)}size(){return this.innerSize}}
960
+ class _a{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){wi(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return _i(this.inner)}size(){return this.innerSize}}
960
961
  /**
961
962
  * @license
962
963
  * Copyright 2017 Google LLC
@@ -972,7 +973,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
972
973
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
973
974
  * See the License for the specific language governing permissions and
974
975
  * limitations under the License.
975
- */const wa=new lo(ii.comparator);function Ia(){return wa}const ba=new lo(ii.comparator);function Ta(...e){let t=ba;for(const n of e)t=t.insert(n.key,n);return t}function Ea(e){let t=ba;return e.forEach(((e,n)=>t=t.insert(e,n.overlayedDocument))),t}function _a(){return Ca()}function Sa(){return Ca()}function Ca(){return new va((e=>e.toString()),((e,t)=>e.isEqual(t)))}new lo(ii.comparator);const Aa=new go(ii.comparator);function ka(...e){let t=Aa;for(const n of e)t=t.add(n);return t}const Na=new go(Xs);function Da(){return Na}
976
+ */const Ta=new po(ai.comparator);function Ia(){return Ta}const Ea=new po(ai.comparator);function Sa(...t){let e=Ea;for(const n of t)e=e.insert(n.key,n);return e}function ba(t){let e=Ea;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Aa(){return ka()}function Ca(){return ka()}function ka(){return new _a((t=>t.toString()),((t,e)=>t.isEqual(e)))}new po(ai.comparator);const Na=new yo(ai.comparator);function Ra(...t){let e=Na;for(const n of t)e=e.add(n);return e}const Da=new yo(Zs);function Oa(){return Da}
976
977
  /**
977
978
  * @license
978
979
  * Copyright 2017 Google LLC
@@ -988,7 +989,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
988
989
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
989
990
  * See the License for the specific language governing permissions and
990
991
  * limitations under the License.
991
- */class Ra{constructor(e,t,n,r,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const r=new Map;return r.set(e,Oa.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new Ra(ei.min(),r,Da(),Ia(),ka())}}class Oa{constructor(e,t,n,r,s){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new Oa(n,t,ka(),ka(),ka())}}
992
+ */class La{constructor(t,e,n,r,s){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Pa.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new La(ni.min(),r,Oa(),Ia(),Ra())}}class Pa{constructor(t,e,n,r,s){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Pa(n,e,Ra(),Ra(),Ra())}}
992
993
  /**
993
994
  * @license
994
995
  * Copyright 2017 Google LLC
@@ -1004,7 +1005,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1004
1005
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1005
1006
  * See the License for the specific language governing permissions and
1006
1007
  * limitations under the License.
1007
- */class La{constructor(e,t,n,r){this.It=e,this.removedTargetIds=t,this.key=n,this.Tt=r}}class Pa{constructor(e,t){this.targetId=e,this.Et=t}}class Ma{constructor(e,t,n=bi.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class xa{constructor(){this.At=0,this.Rt=Va(),this.bt=bi.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(e){e.approximateByteSize()>0&&(this.vt=!0,this.bt=e)}Ct(){let e=ka(),t=ka(),n=ka();return this.Rt.forEach(((r,s)=>{switch(s){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:Ms()}})),new Oa(this.bt,this.Pt,e,t,n)}xt(){this.vt=!1,this.Rt=Va()}Nt(e,t){this.vt=!0,this.Rt=this.Rt.insert(e,t)}kt(e){this.vt=!0,this.Rt=this.Rt.remove(e)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Ua{constructor(e){this.$t=e,this.Bt=new Map,this.Lt=Ia(),this.qt=Fa(),this.Ut=new go(Xs)}Kt(e){for(const t of e.It)e.Tt&&e.Tt.isFoundDocument()?this.Gt(t,e.Tt):this.Qt(t,e.key,e.Tt);for(const t of e.removedTargetIds)this.Qt(t,e.key,e.Tt)}jt(e){this.forEachTarget(e,(t=>{const n=this.Wt(t);switch(e.state){case 0:this.zt(t)&&n.Dt(e.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(e.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(t);break;case 3:this.zt(t)&&(n.Ft(),n.Dt(e.resumeToken));break;case 4:this.zt(t)&&(this.Ht(t),n.Dt(e.resumeToken));break;default:Ms()}}))}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Bt.forEach(((e,n)=>{this.zt(n)&&t(n)}))}Jt(e){const t=e.targetId,n=e.Et.count,r=this.Yt(t);if(r){const e=r.target;if(_o(e))if(0===n){const n=new ii(e.path);this.Qt(t,n,wo.newNoDocument(n,ei.min()))}else xs(1===n);else this.Xt(t)!==n&&(this.Ht(t),this.Ut=this.Ut.add(t))}}Zt(e){const t=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&_o(s.target)){const t=new ii(s.target.path);null!==this.Lt.get(t)||this.te(r,t)||this.Qt(r,t,wo.newNoDocument(t,e))}n.St&&(t.set(r,n.Ct()),n.xt())}}));let n=ka();this.qt.forEach(((e,t)=>{let r=!0;t.forEachWhile((e=>{const t=this.Yt(e);return!t||2===t.purpose||(r=!1,!1)})),r&&(n=n.add(e))})),this.Lt.forEach(((t,n)=>n.setReadTime(e)));const r=new Ra(e,t,this.Ut,this.Lt,n);return this.Lt=Ia(),this.qt=Fa(),this.Ut=new go(Xs),r}Gt(e,t){if(!this.zt(e))return;const n=this.te(e,t.key)?2:0;this.Wt(e).Nt(t.key,n),this.Lt=this.Lt.insert(t.key,t),this.qt=this.qt.insert(t.key,this.ee(t.key).add(e))}Qt(e,t,n){if(!this.zt(e))return;const r=this.Wt(e);this.te(e,t)?r.Nt(t,1):r.kt(t),this.qt=this.qt.insert(t,this.ee(t).delete(e)),n&&(this.Lt=this.Lt.insert(t,n))}removeTarget(e){this.Bt.delete(e)}Xt(e){const t=this.Wt(e).Ct();return this.$t.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}Ot(e){this.Wt(e).Ot()}Wt(e){let t=this.Bt.get(e);return t||(t=new xa,this.Bt.set(e,t)),t}ee(e){let t=this.qt.get(e);return t||(t=new go(Xs),this.qt=this.qt.insert(e,t)),t}zt(e){const t=null!==this.Yt(e);return t||Rs("WatchChangeAggregator","Detected inactive target",e),t}Yt(e){const t=this.Bt.get(e);return t&&t.Vt?null:this.$t.ne(e)}Ht(e){this.Bt.set(e,new xa),this.$t.getRemoteKeysForTarget(e).forEach((t=>{this.Qt(e,t,null)}))}te(e,t){return this.$t.getRemoteKeysForTarget(e).has(t)}}function Fa(){return new lo(ii.comparator)}function Va(){return new lo(ii.comparator)}
1008
+ */class Ma{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class xa{constructor(t,e){this.targetId=t,this.Et=e}}class Ua{constructor(t,e,n=Ei.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Fa{constructor(){this.At=0,this.Rt=ja(),this.bt=Ei.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Ra(),e=Ra(),n=Ra();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Us()}})),new Pa(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=ja()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Va{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zs)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Us()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ao(t))if(0===n){const n=new ai(t.path);this.Qt(e,n,To.newNoDocument(n,ni.min()))}else Fs(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&Ao(s.target)){const e=new ai(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,To.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Ra();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new La(t,e,this.Ut,this.Lt,n);return this.Lt=Ia(),this.qt=Ba(),this.Ut=new yo(Zs),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Fa,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new yo(Zs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ls("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Fa),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Ba(){return new po(ai.comparator)}function ja(){return new po(ai.comparator)}
1008
1009
  /**
1009
1010
  * @license
1010
1011
  * Copyright 2017 Google LLC
@@ -1020,7 +1021,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1020
1021
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1021
1022
  * See the License for the specific language governing permissions and
1022
1023
  * limitations under the License.
1023
- */const qa={asc:"ASCENDING",desc:"DESCENDING"},ja={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ba={and:"AND",or:"OR"};class za{constructor(e,t){this.databaseId=e,this.wt=t}}function $a(e,t){return e.wt?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ka(e,t){return e.wt?t.toBase64():t.toUint8Array()}function Ha(e){return xs(!!e),ei.fromTimestamp(function(e){const t=Ei(e);return new Zs(t.seconds,t.nanos)}(e))}function Ga(e,t){return function(e){return new ni(["projects",e.projectId,"databases",e.database])}(e).child("documents").child(t).canonicalString()}function Wa(e){const t=ni.fromString(e);return xs(uc(t)),t}function Qa(e,t){const n=Wa(t);if(n.get(1)!==e.databaseId.projectId)throw new Vs(Fs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Vs(Fs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new ii(Ja(n))}function Ya(e,t){return Ga(e.databaseId,t)}function Xa(e){return new ni(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ja(e){return xs(e.length>4&&"documents"===e.get(4)),e.popFirst(5)}function Za(e,t){return{documents:[Ya(e,t.path)]}}function ec(e,t){const n={structuredQuery:{}},r=t.path;null!==t.collectionGroup?(n.parent=Ya(e,r),n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(n.parent=Ya(e,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(e){if(0!==e.length)return cc(Qi.create(e,"and"))}(t.filters);s&&(n.structuredQuery.where=s);const i=function(e){if(0!==e.length)return e.map((e=>function(e){return{field:oc(e.field),direction:rc(e.dir)}}(e)))}(t.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(e,t){return e.wt||wi(t)?t:{value:t}}(e,t.limit);var a;return null!==o&&(n.structuredQuery.limit=o),t.startAt&&(n.structuredQuery.startAt={before:(a=t.startAt).inclusive,values:a.position}),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),n}function tc(e){let t=function(e){const t=Wa(e);return 4===t.length?ni.emptyPath():Ja(t)}(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){xs(1===r);const e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=nc(e);return t instanceof Qi&&Xi(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((e=>function(e){return new uo(ac(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,wi(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new $i(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new $i(n,t)}(n.endAt)),function(e,t,n,r,s,i,o,a){return new So(e,t,n,r,s,i,o,a)}(t,s,o,i,a,"F",c,u)}function nc(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=ac(e.unaryFilter.field);return Wi.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=ac(e.unaryFilter.field);return Wi.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=ac(e.unaryFilter.field);return Wi.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=ac(e.unaryFilter.field);return Wi.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Ms()}}(e):void 0!==e.fieldFilter?function(e){return Wi.create(ac(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Ms()}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Qi.create(e.compositeFilter.filters.map((e=>nc(e))),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return Ms()}}(e.compositeFilter.op))}(e):Ms()}function rc(e){return qa[e]}function sc(e){return ja[e]}function ic(e){return Ba[e]}function oc(e){return{fieldPath:e.canonicalString()}}function ac(e){return si.fromServerFormat(e.fieldPath)}function cc(e){return e instanceof Wi?function(e){if("=="===e.op){if(ji(e.value))return{unaryFilter:{field:oc(e.field),op:"IS_NAN"}};if(qi(e.value))return{unaryFilter:{field:oc(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(ji(e.value))return{unaryFilter:{field:oc(e.field),op:"IS_NOT_NAN"}};if(qi(e.value))return{unaryFilter:{field:oc(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:oc(e.field),op:sc(e.op),value:e.value}}}(e):e instanceof Qi?function(e){const t=e.getFilters().map((e=>cc(e)));return 1===t.length?t[0]:{compositeFilter:{op:ic(e.op),filters:t}}}(e):Ms()}function uc(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
1024
+ */const Ha={asc:"ASCENDING",desc:"DESCENDING"},qa={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Ka={and:"AND",or:"OR"};class Wa{constructor(t,e){this.databaseId=t,this.wt=e}}function za(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function $a(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Ga(t){return Fs(!!t),ni.fromTimestamp(function(t){const e=bi(t);return new ei(e.seconds,e.nanos)}(t))}function Qa(t,e){return function(t){return new si(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Ja(t){const e=si.fromString(t);return Fs(lc(e)),e}function Ya(t,e){const n=Ja(e);if(n.get(1)!==t.databaseId.projectId)throw new js(Bs.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new js(Bs.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ai(tc(n))}function Xa(t,e){return Qa(t.databaseId,e)}function Za(t){return new si(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function tc(t){return Fs(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function ec(t,e){return{documents:[Xa(t,e.path)]}}function nc(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Xa(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Xa(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return hc(Yi.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:cc(t.field),direction:ic(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||Ti(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function rc(t){let e=function(t){const e=Ja(t);return 4===e.length?si.emptyPath():tc(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Fs(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=sc(t);return e instanceof Yi&&Zi(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new lo(uc(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,Ti(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new zi(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new zi(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new Co(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function sc(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=uc(t.unaryFilter.field);return Ji.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=uc(t.unaryFilter.field);return Ji.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=uc(t.unaryFilter.field);return Ji.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=uc(t.unaryFilter.field);return Ji.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Us()}}(t):void 0!==t.fieldFilter?function(t){return Ji.create(uc(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Us()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Yi.create(t.compositeFilter.filters.map((t=>sc(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Us()}}(t.compositeFilter.op))}(t):Us()}function ic(t){return Ha[t]}function oc(t){return qa[t]}function ac(t){return Ka[t]}function cc(t){return{fieldPath:t.canonicalString()}}function uc(t){return oi.fromServerFormat(t.fieldPath)}function hc(t){return t instanceof Ji?function(t){if("=="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(qi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NAN"}};if(Hi(t.value))return{unaryFilter:{field:cc(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:cc(t.field),op:oc(t.op),value:t.value}}}(t):t instanceof Yi?function(t){const e=t.getFilters().map((t=>hc(t)));return 1===e.length?e[0]:{compositeFilter:{op:ac(t.op),filters:e}}}(t):Us()}function lc(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1024
1025
  /**
1025
1026
  * @license
1026
1027
  * Copyright 2017 Google LLC
@@ -1036,7 +1037,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1036
1037
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1037
1038
  * See the License for the specific language governing permissions and
1038
1039
  * limitations under the License.
1039
- */class hc{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const r=this.mutations[t];r.key.isEqual(e.key)&&ia(r,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=oa(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=oa(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=Sa();return this.mutations.forEach((r=>{const s=e.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=t.has(r.key)?null:o;const a=sa(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(ei.min())})),n}keys(){return this.mutations.reduce(((e,t)=>e.add(t.key)),ka())}isEqual(e){return this.batchId===e.batchId&&Js(this.mutations,e.mutations,((e,t)=>aa(e,t)))&&Js(this.baseMutations,e.baseMutations,((e,t)=>aa(e,t)))}}
1040
+ */class dc{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&aa(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ca(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ca(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ca();return this.mutations.forEach((r=>{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=oa(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(ni.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Ra())}isEqual(t){return this.batchId===t.batchId&&ti(this.mutations,t.mutations,((t,e)=>ua(t,e)))&&ti(this.baseMutations,t.baseMutations,((t,e)=>ua(t,e)))}}
1040
1041
  /**
1041
1042
  * @license
1042
1043
  * Copyright 2022 Google LLC
@@ -1052,7 +1053,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1052
1053
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1053
1054
  * See the License for the specific language governing permissions and
1054
1055
  * limitations under the License.
1055
- */class lc{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
1056
+ */class fc{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
1056
1057
  /**
1057
1058
  * @license
1058
1059
  * Copyright 2017 Google LLC
@@ -1068,7 +1069,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1068
1069
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1069
1070
  * See the License for the specific language governing permissions and
1070
1071
  * limitations under the License.
1071
- */class dc{constructor(e,t,n,r,s=ei.min(),i=ei.min(),o=bi.EMPTY_BYTE_STRING){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(e){return new dc(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(e,t){return new dc(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e)}withLastLimboFreeSnapshotVersion(e){return new dc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken)}}
1072
+ */class pc{constructor(t,e,n,r,s=ni.min(),i=ni.min(),o=Ei.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(t){return new pc(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new pc(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new pc(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1072
1073
  /**
1073
1074
  * @license
1074
1075
  * Copyright 2017 Google LLC
@@ -1084,7 +1085,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1084
1085
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1085
1086
  * See the License for the specific language governing permissions and
1086
1087
  * limitations under the License.
1087
- */class fc{constructor(e){this.ie=e}}function pc(e){const t=tc({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?Po(t,t.limit,"L"):t}
1088
+ */class gc{constructor(t){this.ie=t}}function mc(t){const e=rc({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?xo(e,e.limit,"L"):e}
1088
1089
  /**
1089
1090
  * @license
1090
1091
  * Copyright 2019 Google LLC
@@ -1100,7 +1101,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1100
1101
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1101
1102
  * See the License for the specific language governing permissions and
1102
1103
  * limitations under the License.
1103
- */class gc{constructor(){this.Je=new mc}addToCollectionParentIndex(e,t){return this.Je.add(t),li.resolve()}getCollectionParents(e,t){return li.resolve(this.Je.getEntries(t))}addFieldIndex(e,t){return li.resolve()}deleteFieldIndex(e,t){return li.resolve()}getDocumentsMatchingTarget(e,t){return li.resolve(null)}getIndexType(e,t){return li.resolve(0)}getFieldIndexes(e,t){return li.resolve([])}getNextCollectionGroupToUpdate(e){return li.resolve(null)}getMinOffset(e,t){return li.resolve(ai.min())}getMinOffsetFromCollectionGroup(e,t){return li.resolve(ai.min())}updateCollectionGroup(e,t,n){return li.resolve()}updateIndexEntries(e,t){return li.resolve()}}class mc{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new go(ni.comparator),s=!r.has(n);return this.index[t]=r.add(n),s}has(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new go(ni.comparator)).toArray()}}
1104
+ */class yc{constructor(){this.Je=new vc}addToCollectionParentIndex(t,e){return this.Je.add(e),fi.resolve()}getCollectionParents(t,e){return fi.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return fi.resolve()}deleteFieldIndex(t,e){return fi.resolve()}getDocumentsMatchingTarget(t,e){return fi.resolve(null)}getIndexType(t,e){return fi.resolve(0)}getFieldIndexes(t,e){return fi.resolve([])}getNextCollectionGroupToUpdate(t){return fi.resolve(null)}getMinOffset(t,e){return fi.resolve(ui.min())}getMinOffsetFromCollectionGroup(t,e){return fi.resolve(ui.min())}updateCollectionGroup(t,e,n){return fi.resolve()}updateIndexEntries(t,e){return fi.resolve()}}class vc{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new yo(si.comparator),s=!r.has(n);return this.index[e]=r.add(n),s}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new yo(si.comparator)).toArray()}}
1104
1105
  /**
1105
1106
  * @license
1106
1107
  * Copyright 2017 Google LLC
@@ -1116,7 +1117,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1116
1117
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1117
1118
  * See the License for the specific language governing permissions and
1118
1119
  * limitations under the License.
1119
- */class yc{constructor(e){this.bn=e}next(){return this.bn+=2,this.bn}static Pn(){return new yc(0)}static vn(){return new yc(-1)}}
1120
+ */class wc{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new wc(0)}static vn(){return new wc(-1)}}
1120
1121
  /**
1121
1122
  * @license
1122
1123
  * Copyright 2017 Google LLC
@@ -1132,7 +1133,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1132
1133
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1133
1134
  * See the License for the specific language governing permissions and
1134
1135
  * limitations under the License.
1135
- */class vc{constructor(){this.changes=new va((e=>e.toString()),((e,t)=>e.isEqual(t))),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,wo.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?li.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}
1136
+ */class _c{constructor(){this.changes=new _a((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,To.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?fi.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
1136
1137
  /**
1137
1138
  * @license
1138
1139
  * Copyright 2017 Google LLC
@@ -1164,7 +1165,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1164
1165
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1165
1166
  * See the License for the specific language governing permissions and
1166
1167
  * limitations under the License.
1167
- */class wc{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}
1168
+ */class Tc{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
1168
1169
  /**
1169
1170
  * @license
1170
1171
  * Copyright 2017 Google LLC
@@ -1180,7 +1181,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1180
1181
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1181
1182
  * See the License for the specific language governing permissions and
1182
1183
  * limitations under the License.
1183
- */class Ic{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next((r=>(n=r,this.remoteDocumentCache.getEntry(e,t)))).next((e=>(null!==n&&oa(n.mutation,e,yo.empty(),Zs.now()),e)))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.getLocalViewOfDocuments(e,t,ka()).next((()=>t))))}getLocalViewOfDocuments(e,t,n=ka()){const r=_a();return this.populateOverlays(e,r,t).next((()=>this.computeViews(e,t,r,n).next((e=>{let t=Ta();return e.forEach(((e,n)=>{t=t.insert(e,n.overlayedDocument)})),t}))))}getOverlayedDocuments(e,t){const n=_a();return this.populateOverlays(e,n,t).next((()=>this.computeViews(e,t,n,ka())))}populateOverlays(e,t,n){const r=[];return n.forEach((e=>{t.has(e)||r.push(e)})),this.documentOverlayCache.getOverlays(e,r).next((e=>{e.forEach(((e,n)=>{t.set(e,n)}))}))}computeViews(e,t,n,r){let s=Ia();const i=Ca(),o=Ca();return t.forEach(((e,t)=>{const o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof ua)?s=s.insert(t.key,t):void 0!==o&&(i.set(t.key,o.mutation.getFieldMask()),oa(o.mutation,t,o.mutation.getFieldMask(),Zs.now()))})),this.recalculateAndSaveOverlays(e,s).next((e=>(e.forEach(((e,t)=>i.set(e,t))),t.forEach(((e,t)=>{var n;return o.set(e,new wc(t,null!==(n=i.get(e))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(e,t){const n=Ca();let r=new lo(((e,t)=>e-t)),s=ka();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next((e=>{for(const s of e)s.keys().forEach((e=>{const i=t.get(e);if(null===i)return;let o=n.get(e)||yo.empty();o=s.applyToLocalView(i,o),n.set(e,o);const a=(r.get(s.batchId)||ka()).add(e);r=r.insert(s.batchId,a)}))})).next((()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=Sa();c.forEach((e=>{if(!s.has(e)){const r=sa(t.get(e),n.get(e));null!==r&&u.set(e,r),s=s.add(e)}})),i.push(this.documentOverlayCache.saveOverlays(e,a,u))}return li.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next((t=>this.recalculateAndSaveOverlays(e,t)))}getDocumentsMatchingQuery(e,t,n){return function(e){return ii.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Do(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n):this.getDocumentsMatchingCollectionQuery(e,t,n)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next((s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-s.size):li.resolve(_a());let o=-1,a=s;return i.next((t=>li.forEach(t,((t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(t)?li.resolve():this.remoteDocumentCache.getEntry(e,t).next((e=>{a=a.insert(t,e)}))))).next((()=>this.populateOverlays(e,t,s))).next((()=>this.computeViews(e,a,t,ka()))).next((e=>({batchId:o,changes:Ea(e)})))))}))}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new ii(t)).next((e=>{let t=Ta();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t}))}getDocumentsMatchingCollectionGroupQuery(e,t,n){const r=t.collectionGroup;let s=Ta();return this.indexManager.getCollectionParents(e,r).next((i=>li.forEach(i,(i=>{const o=function(e,t){return new So(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,i.child(r));return this.getDocumentsMatchingCollectionQuery(e,o,n).next((e=>{e.forEach(((e,t)=>{s=s.insert(e,t)}))}))})).next((()=>s))))}getDocumentsMatchingCollectionQuery(e,t,n){let r;return this.remoteDocumentCache.getAllFromCollection(e,t.path,n).next((s=>(r=s,this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId)))).next((e=>{e.forEach(((e,t)=>{const n=t.getKey();null===r.get(n)&&(r=r.insert(n,wo.newInvalidDocument(n)))}));let n=Ta();return r.forEach(((r,s)=>{const i=e.get(r);void 0!==i&&oa(i.mutation,s,yo.empty(),Zs.now()),Fo(t,s)&&(n=n.insert(r,s))})),n}))}}
1184
+ */class Ic{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ca(n.mutation,t,wo.empty(),ei.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Ra()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Ra()){const r=Aa();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Sa();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Aa();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Ra())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let s=Ia();const i=ka(),o=ka();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof la)?s=s.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),ca(o.mutation,e,o.mutation.getFieldMask(),ei.now()))})),this.recalculateAndSaveOverlays(t,s).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Tc(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=ka();let r=new po(((t,e)=>t-e)),s=Ra();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const s of t)s.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||wo.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||Ra()).add(t);r=r.insert(s.batchId,a)}))})).next((()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=Ca();c.forEach((t=>{if(!s.has(t)){const r=oa(e.get(t),n.get(t));null!==r&&u.set(t,r),s=s.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,u))}return fi.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return ai.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):Oo(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-s.size):fi.resolve(Aa());let o=-1,a=s;return i.next((e=>fi.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(e)?fi.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,s))).next((()=>this.computeViews(t,a,e,Ra()))).next((t=>({batchId:o,changes:ba(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new ai(e)).next((t=>{let e=Sa();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let s=Sa();return this.indexManager.getCollectionParents(t,r).next((i=>fi.forEach(i,(i=>{const o=function(t,e){return new Co(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,i.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{s=s.insert(t,e)}))}))})).next((()=>s))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((s=>(r=s,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,To.newInvalidDocument(n)))}));let n=Sa();return r.forEach(((r,s)=>{const i=t.get(r);void 0!==i&&ca(i.mutation,s,wo.empty(),ei.now()),Bo(e,s)&&(n=n.insert(r,s))})),n}))}}
1184
1185
  /**
1185
1186
  * @license
1186
1187
  * Copyright 2020 Google LLC
@@ -1196,7 +1197,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1196
1197
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1197
1198
  * See the License for the specific language governing permissions and
1198
1199
  * limitations under the License.
1199
- */class bc{constructor(e){this.yt=e,this.Zn=new Map,this.ts=new Map}getBundleMetadata(e,t){return li.resolve(this.Zn.get(t))}saveBundleMetadata(e,t){var n;return this.Zn.set(t.id,{id:(n=t).id,version:n.version,createTime:Ha(n.createTime)}),li.resolve()}getNamedQuery(e,t){return li.resolve(this.ts.get(t))}saveNamedQuery(e,t){return this.ts.set(t.name,function(e){return{name:e.name,query:pc(e.bundledQuery),readTime:Ha(e.readTime)}}(t)),li.resolve()}}
1200
+ */class Ec{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return fi.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Ga(n.createTime)}),fi.resolve()}getNamedQuery(t,e){return fi.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:mc(t.bundledQuery),readTime:Ga(t.readTime)}}(e)),fi.resolve()}}
1200
1201
  /**
1201
1202
  * @license
1202
1203
  * Copyright 2022 Google LLC
@@ -1212,7 +1213,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1212
1213
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1213
1214
  * See the License for the specific language governing permissions and
1214
1215
  * limitations under the License.
1215
- */class Tc{constructor(){this.overlays=new lo(ii.comparator),this.es=new Map}getOverlay(e,t){return li.resolve(this.overlays.get(t))}getOverlays(e,t){const n=_a();return li.forEach(t,(t=>this.getOverlay(e,t).next((e=>{null!==e&&n.set(t,e)})))).next((()=>n))}saveOverlays(e,t,n){return n.forEach(((n,r)=>{this.oe(e,t,r)})),li.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((e=>this.overlays=this.overlays.remove(e))),this.es.delete(n)),li.resolve()}getOverlaysForCollection(e,t,n){const r=_a(),s=t.length+1,i=new ii(t.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const e=o.getNext().value,i=e.getKey();if(!t.isPrefixOf(i.path))break;i.path.length===s&&e.largestBatchId>n&&r.set(e.getKey(),e)}return li.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let s=new lo(((e,t)=>e-t));const i=this.overlays.getIterator();for(;i.hasNext();){const e=i.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=s.get(e.largestBatchId);null===t&&(t=_a(),s=s.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=_a(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((e,t)=>o.set(e,t))),!(o.size()>=r)););return li.resolve(o)}oe(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new lc(t,n));let s=this.es.get(t);void 0===s&&(s=ka(),this.es.set(t,s)),this.es.set(t,s.add(n.key))}}
1216
+ */class Sc{constructor(){this.overlays=new po(ai.comparator),this.es=new Map}getOverlay(t,e){return fi.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Aa();return fi.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),fi.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),fi.resolve()}getOverlaysForCollection(t,e,n){const r=Aa(),s=e.length+1,i=new ai(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===s&&t.largestBatchId>n&&r.set(t.getKey(),t)}return fi.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new po(((t,e)=>t-e));const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=s.get(t.largestBatchId);null===e&&(e=Aa(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Aa(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return fi.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new fc(e,n));let s=this.es.get(e);void 0===s&&(s=Ra(),this.es.set(e,s)),this.es.set(e,s.add(n.key))}}
1216
1217
  /**
1217
1218
  * @license
1218
1219
  * Copyright 2017 Google LLC
@@ -1228,7 +1229,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1228
1229
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1229
1230
  * See the License for the specific language governing permissions and
1230
1231
  * limitations under the License.
1231
- */class Ec{constructor(){this.ns=new go(_c.ss),this.rs=new go(_c.os)}isEmpty(){return this.ns.isEmpty()}addReference(e,t){const n=new _c(e,t);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(e,t){e.forEach((e=>this.addReference(e,t)))}removeReference(e,t){this.cs(new _c(e,t))}hs(e,t){e.forEach((e=>this.removeReference(e,t)))}ls(e){const t=new ii(new ni([])),n=new _c(t,e),r=new _c(t,e+1),s=[];return this.rs.forEachInRange([n,r],(e=>{this.cs(e),s.push(e.key)})),s}fs(){this.ns.forEach((e=>this.cs(e)))}cs(e){this.ns=this.ns.delete(e),this.rs=this.rs.delete(e)}ds(e){const t=new ii(new ni([])),n=new _c(t,e),r=new _c(t,e+1);let s=ka();return this.rs.forEachInRange([n,r],(e=>{s=s.add(e.key)})),s}containsKey(e){const t=new _c(e,0),n=this.ns.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class _c{constructor(e,t){this.key=e,this._s=t}static ss(e,t){return ii.comparator(e.key,t.key)||Xs(e._s,t._s)}static os(e,t){return Xs(e._s,t._s)||ii.comparator(e.key,t.key)}}
1232
+ */class bc{constructor(){this.ns=new yo(Ac.ss),this.rs=new yo(Ac.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Ac(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Ac(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new ai(new si([])),n=new Ac(e,t),r=new Ac(e,t+1),s=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),s.push(t.key)})),s}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new ai(new si([])),n=new Ac(e,t),r=new Ac(e,t+1);let s=Ra();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Ac(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Ac{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return ai.comparator(t.key,e.key)||Zs(t._s,e._s)}static os(t,e){return Zs(t._s,e._s)||ai.comparator(t.key,e.key)}}
1232
1233
  /**
1233
1234
  * @license
1234
1235
  * Copyright 2017 Google LLC
@@ -1244,7 +1245,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1244
1245
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1245
1246
  * See the License for the specific language governing permissions and
1246
1247
  * limitations under the License.
1247
- */class Sc{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.ws=1,this.gs=new go(_c.ss)}checkEmpty(e){return li.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new hc(s,t,n,r);this.mutationQueue.push(i);for(const t of r)this.gs=this.gs.add(new _c(t.key,s)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return li.resolve(i)}lookupMutationBatch(e,t){return li.resolve(this.ys(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.ps(n),s=r<0?0:r;return li.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return li.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(e){return li.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new _c(t,0),r=new _c(t,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(e=>{const t=this.ys(e._s);s.push(t)})),li.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new go(Xs);return t.forEach((e=>{const t=new _c(e,0),r=new _c(e,Number.POSITIVE_INFINITY);this.gs.forEachInRange([t,r],(e=>{n=n.add(e._s)}))})),li.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let s=n;ii.isDocumentKey(s)||(s=s.child(""));const i=new _c(new ii(s),0);let o=new go(Xs);return this.gs.forEachWhile((e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e._s)),!0)}),i),li.resolve(this.Is(o))}Is(e){const t=[];return e.forEach((e=>{const n=this.ys(e);null!==n&&t.push(n)})),t}removeMutationBatch(e,t){xs(0===this.Ts(t.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return li.forEach(t.mutations,(r=>{const s=new _c(r.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)})).next((()=>{this.gs=n}))}An(e){}containsKey(e,t){const n=new _c(t,0),r=this.gs.firstAfterOrEqual(n);return li.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,li.resolve()}Ts(e,t){return this.ps(e)}ps(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}ys(e){const t=this.ps(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}
1248
+ */class Cc{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new yo(Ac.ss)}checkEmpty(t){return fi.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new dc(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Ac(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return fi.resolve(i)}lookupMutationBatch(t,e){return fi.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return fi.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return fi.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return fi.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Ac(e,0),r=new Ac(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),fi.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new yo(Zs);return e.forEach((t=>{const e=new Ac(t,0),r=new Ac(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),fi.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;ai.isDocumentKey(s)||(s=s.child(""));const i=new Ac(new ai(s),0);let o=new yo(Zs);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),fi.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Fs(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return fi.forEach(e.mutations,(r=>{const s=new Ac(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Ac(e,0),r=this.gs.firstAfterOrEqual(n);return fi.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,fi.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
1248
1249
  /**
1249
1250
  * @license
1250
1251
  * Copyright 2017 Google LLC
@@ -1260,7 +1261,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1260
1261
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261
1262
  * See the License for the specific language governing permissions and
1262
1263
  * limitations under the License.
1263
- */class Cc{constructor(e){this.Es=e,this.docs=new lo(ii.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),s=r?r.size:0,i=this.Es(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return li.resolve(n?n.document.mutableCopy():wo.newInvalidDocument(t))}getEntries(e,t){let n=Ia();return t.forEach((e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():wo.newInvalidDocument(e))})),li.resolve(n)}getAllFromCollection(e,t,n){let r=Ia();const s=new ii(t.child("")),i=this.docs.getIteratorFrom(s);for(;i.hasNext();){const{key:e,value:{document:s}}=i.getNext();if(!t.isPrefixOf(e.path))break;e.path.length>t.length+1||ci(oi(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return li.resolve(r)}getAllFromCollectionGroup(e,t,n,r){Ms()}As(e,t){return li.forEach(this.docs,(e=>t(e)))}newChangeBuffer(e){return new Ac(this)}getSize(e){return li.resolve(this.size)}}class Ac extends vc{constructor(e){super(),this.Yn=e}applyChanges(e){const t=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?t.push(this.Yn.addEntry(e,r)):this.Yn.removeEntry(n)})),li.waitFor(t)}getFromCache(e,t){return this.Yn.getEntry(e,t)}getAllFromCache(e,t){return this.Yn.getEntries(e,t)}}
1264
+ */class kc{constructor(t){this.Es=t,this.docs=new po(ai.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),s=r?r.size:0,i=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return fi.resolve(n?n.document.mutableCopy():To.newInvalidDocument(e))}getEntries(t,e){let n=Ia();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():To.newInvalidDocument(t))})),fi.resolve(n)}getAllFromCollection(t,e,n){let r=Ia();const s=new ai(e.child("")),i=this.docs.getIteratorFrom(s);for(;i.hasNext();){const{key:t,value:{document:s}}=i.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||hi(ci(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return fi.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Us()}As(t,e){return fi.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Nc(this)}getSize(t){return fi.resolve(this.size)}}class Nc extends _c{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),fi.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1264
1265
  /**
1265
1266
  * @license
1266
1267
  * Copyright 2017 Google LLC
@@ -1276,7 +1277,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1276
1277
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1277
1278
  * See the License for the specific language governing permissions and
1278
1279
  * limitations under the License.
1279
- */class kc{constructor(e){this.persistence=e,this.Rs=new va((e=>To(e)),Eo),this.lastRemoteSnapshotVersion=ei.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Ec,this.targetCount=0,this.vs=yc.Pn()}forEachTarget(e,t){return this.Rs.forEach(((e,n)=>t(n))),li.resolve()}getLastRemoteSnapshotVersion(e){return li.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return li.resolve(this.bs)}allocateTargetId(e){return this.highestTargetId=this.vs.next(),li.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.bs&&(this.bs=t),li.resolve()}Dn(e){this.Rs.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.vs=new yc(t),this.highestTargetId=t),e.sequenceNumber>this.bs&&(this.bs=e.sequenceNumber)}addTargetData(e,t){return this.Dn(t),this.targetCount+=1,li.resolve()}updateTargetData(e,t){return this.Dn(t),li.resolve()}removeTargetData(e,t){return this.Rs.delete(t.target),this.Ps.ls(t.targetId),this.targetCount-=1,li.resolve()}removeTargets(e,t,n){let r=0;const s=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.Rs.delete(i),s.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)})),li.waitFor(s).next((()=>r))}getTargetCount(e){return li.resolve(this.targetCount)}getTargetData(e,t){const n=this.Rs.get(t)||null;return li.resolve(n)}addMatchingKeys(e,t,n){return this.Ps.us(t,n),li.resolve()}removeMatchingKeys(e,t,n){this.Ps.hs(t,n);const r=this.persistence.referenceDelegate,s=[];return r&&t.forEach((t=>{s.push(r.markPotentiallyOrphaned(e,t))})),li.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.Ps.ls(t),li.resolve()}getMatchingKeysForTargetId(e,t){const n=this.Ps.ds(t);return li.resolve(n)}containsKey(e,t){return li.resolve(this.Ps.containsKey(t))}}
1280
+ */class Rc{constructor(t){this.persistence=t,this.Rs=new _a((t=>So(t)),bo),this.lastRemoteSnapshotVersion=ni.min(),this.highestTargetId=0,this.bs=0,this.Ps=new bc,this.targetCount=0,this.vs=wc.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),fi.resolve()}getLastRemoteSnapshotVersion(t){return fi.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return fi.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),fi.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),fi.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new wc(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,fi.resolve()}updateTargetData(t,e){return this.Dn(e),fi.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,fi.resolve()}removeTargets(t,e,n){let r=0;const s=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(i),s.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),fi.waitFor(s).next((()=>r))}getTargetCount(t){return fi.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return fi.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),fi.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,s=[];return r&&e.forEach((e=>{s.push(r.markPotentiallyOrphaned(t,e))})),fi.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),fi.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return fi.resolve(n)}containsKey(t,e){return fi.resolve(this.Ps.containsKey(e))}}
1280
1281
  /**
1281
1282
  * @license
1282
1283
  * Copyright 2017 Google LLC
@@ -1292,7 +1293,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1292
1293
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1293
1294
  * See the License for the specific language governing permissions and
1294
1295
  * limitations under the License.
1295
- */class Nc{constructor(e,t){this.Vs={},this.overlays={},this.Ss=new fi(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=e(this),this.Cs=new kc(this),this.indexManager=new gc,this.remoteDocumentCache=function(e){return new Cc(e)}((e=>this.referenceDelegate.xs(e))),this.yt=new fc(t),this.Ns=new bc(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Tc,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.Vs[e.toKey()];return n||(n=new Sc(t,this.referenceDelegate),this.Vs[e.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(e,t,n){Rs("MemoryPersistence","Starting transaction:",e);const r=new Dc(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((e=>this.referenceDelegate.Os(r).next((()=>e)))).toPromise().then((e=>(r.raiseOnCommittedEvent(),e)))}Ms(e,t){return li.or(Object.values(this.Vs).map((n=>()=>n.containsKey(e,t))))}}class Dc extends ui{constructor(e){super(),this.currentSequenceNumber=e}}class Rc{constructor(e){this.persistence=e,this.Fs=new Ec,this.$s=null}static Bs(e){return new Rc(e)}get Ls(){if(this.$s)return this.$s;throw Ms()}addReference(e,t,n){return this.Fs.addReference(n,t),this.Ls.delete(n.toString()),li.resolve()}removeReference(e,t,n){return this.Fs.removeReference(n,t),this.Ls.add(n.toString()),li.resolve()}markPotentiallyOrphaned(e,t){return this.Ls.add(t.toString()),li.resolve()}removeTarget(e,t){this.Fs.ls(t.targetId).forEach((e=>this.Ls.add(e.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next((e=>{e.forEach((e=>this.Ls.add(e.toString())))})).next((()=>n.removeTargetData(e,t)))}ks(){this.$s=new Set}Os(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return li.forEach(this.Ls,(n=>{const r=ii.fromPath(n);return this.qs(e,r).next((e=>{e||t.removeEntry(r,ei.min())}))})).next((()=>(this.$s=null,t.apply(e))))}updateLimboDocument(e,t){return this.qs(e,t).next((e=>{e?this.Ls.delete(t.toString()):this.Ls.add(t.toString())}))}xs(e){return 0}qs(e,t){return li.or([()=>li.resolve(this.Fs.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ms(e,t)])}}
1296
+ */class Dc{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new gi(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new Rc(this),this.indexManager=new yc,this.remoteDocumentCache=function(t){return new kc(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new gc(e),this.Ns=new Ec(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Sc,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Cc(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Ls("MemoryPersistence","Starting transaction:",t);const r=new Oc(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return fi.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Oc extends li{constructor(t){super(),this.currentSequenceNumber=t}}class Lc{constructor(t){this.persistence=t,this.Fs=new bc,this.$s=null}static Bs(t){return new Lc(t)}get Ls(){if(this.$s)return this.$s;throw Us()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),fi.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),fi.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),fi.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return fi.forEach(this.Ls,(n=>{const r=ai.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,ni.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return fi.or([()=>fi.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1296
1297
  /**
1297
1298
  * @license
1298
1299
  * Copyright 2017 Google LLC
@@ -1308,7 +1309,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1308
1309
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1309
1310
  * See the License for the specific language governing permissions and
1310
1311
  * limitations under the License.
1311
- */class Oc{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.Si=n,this.Di=r}static Ci(e,t){let n=ka(),r=ka();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:r=r.add(e.doc.key)}return new Oc(e,t.fromCache,n,r)}}
1312
+ */class Pc{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Ra(),r=Ra();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Pc(t,e.fromCache,n,r)}}
1312
1313
  /**
1313
1314
  * @license
1314
1315
  * Copyright 2019 Google LLC
@@ -1324,7 +1325,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1324
1325
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1325
1326
  * See the License for the specific language governing permissions and
1326
1327
  * limitations under the License.
1327
- */class Lc{constructor(){this.xi=!1}initialize(e,t){this.Ni=e,this.indexManager=t,this.xi=!0}getDocumentsMatchingQuery(e,t,n,r){return this.ki(e,t).next((s=>s||this.Oi(e,t,r,n))).next((n=>n||this.Mi(e,t)))}ki(e,t){if(Ao(t))return li.resolve(null);let n=Oo(t);return this.indexManager.getIndexType(e,n).next((r=>0===r?null:(null!==t.limit&&1===r&&(t=Po(t,null,"F"),n=Oo(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next((r=>{const s=ka(...r);return this.Ni.getDocuments(e,s).next((r=>this.indexManager.getMinOffset(e,n).next((n=>{const i=this.Fi(t,r);return this.$i(t,i,s,n.readTime)?this.ki(e,Po(t,null,"F")):this.Bi(e,i,t,n)}))))})))))}Oi(e,t,n,r){return Ao(t)||r.isEqual(ei.min())?this.Mi(e,t):this.Ni.getDocuments(e,n).next((s=>{const i=this.Fi(t,s);return this.$i(t,i,n,r)?this.Mi(e,t):(Ds()<=S.DEBUG&&Rs("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Uo(t)),this.Bi(e,i,t,function(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,s=ei.fromTimestamp(1e9===r?new Zs(n+1,0):new Zs(n,r));return new ai(s,ii.empty(),t)}(r,-1)))}))}Fi(e,t){let n=new go(Vo(e));return t.forEach(((t,r)=>{Fo(e,r)&&(n=n.add(r))})),n}$i(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const s="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Mi(e,t){return Ds()<=S.DEBUG&&Rs("QueryEngine","Using full collection scan to execute query:",Uo(t)),this.Ni.getDocumentsMatchingQuery(e,t,ai.min())}Bi(e,t,n,r){return this.Ni.getDocumentsMatchingQuery(e,n,r).next((e=>(t.forEach((t=>{e=e.insert(t.key,t)})),e)))}}
1328
+ */class Mc{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((s=>s||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(No(e))return fi.resolve(null);let n=Po(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=xo(e,null,"F"),n=Po(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Ra(...r);return this.Ni.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,r);return this.$i(e,i,s,n.readTime)?this.ki(t,xo(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return No(e)||r.isEqual(ni.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((s=>{const i=this.Fi(e,s);return this.$i(e,i,n,r)?this.Mi(t,e):(Os()<=C.DEBUG&&Ls("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Vo(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=ni.fromTimestamp(1e9===r?new ei(n+1,0):new ei(n,r));return new ui(s,ai.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new yo(jo(t));return e.forEach(((e,r)=>{Bo(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const s="F"===t.limitType?e.last():e.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Mi(t,e){return Os()<=C.DEBUG&&Ls("QueryEngine","Using full collection scan to execute query:",Vo(e)),this.Ni.getDocumentsMatchingQuery(t,e,ui.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
1328
1329
  /**
1329
1330
  * @license
1330
1331
  * Copyright 2020 Google LLC
@@ -1340,7 +1341,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1340
1341
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1341
1342
  * See the License for the specific language governing permissions and
1342
1343
  * limitations under the License.
1343
- */class Pc{constructor(e,t,n,r){this.persistence=e,this.Li=t,this.yt=r,this.qi=new lo(Xs),this.Ui=new va((e=>To(e)),Eo),this.Ki=new Map,this.Gi=e.getRemoteDocumentCache(),this.Cs=e.getTargetCache(),this.Ns=e.getBundleCache(),this.Qi(n)}Qi(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(t=>e.collect(t,this.qi)))}}async function Mc(e,t){const n=Us(e);return await n.persistence.runTransaction("Handle user change","readonly",(e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next((s=>(r=s,n.Qi(t),n.mutationQueue.getAllMutationBatches(e)))).next((t=>{const s=[],i=[];let o=ka();for(const e of r){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){i.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next((e=>({ji:e,removedBatchIds:s,addedBatchIds:i})))}))}))}function xc(e){const t=Us(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",(e=>t.Cs.getLastRemoteSnapshotVersion(e)))}function Uc(e,t){const n=Us(e),r=t.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(e=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];t.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(e,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(e,i.addedDocuments,a))));let u=c.withSequenceNumber(e.currentSequenceNumber);t.targetMismatches.has(a)?u=u.withResumeToken(bi.EMPTY_BYTE_STRING,ei.min()).withLastLimboFreeSnapshotVersion(ei.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(e,t,n){return 0===e.resumeToken.approximateByteSize()||(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(e,u))}));let a=Ia(),c=ka();if(t.documentUpdates.forEach((r=>{t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))})),o.push(function(e,t,n){let r=ka(),s=ka();return n.forEach((e=>r=r.add(e))),t.getEntries(e,r).next((e=>{let r=Ia();return n.forEach(((n,i)=>{const o=e.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(ei.min())?(t.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(i),r=r.insert(n,i)):Rs("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(e,i,t.documentUpdates).next((e=>{a=e.Wi,c=e.zi}))),!r.isEqual(ei.min())){const t=n.Cs.getLastRemoteSnapshotVersion(e).next((t=>n.Cs.setTargetsMetadata(e,e.currentSequenceNumber,r)));o.push(t)}return li.waitFor(o).next((()=>i.apply(e))).next((()=>n.localDocuments.getLocalViewOfDocuments(e,a,c))).next((()=>a))})).then((e=>(n.qi=s,e)))}async function Fc(e,t,n){const r=Us(e),s=r.qi.get(t),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(e=>r.persistence.referenceDelegate.removeTarget(e,s)))}catch(e){if(!di(e))throw e;Rs("LocalStore",`Failed to update sequence numbers for target ${t}: ${e}`)}r.qi=r.qi.remove(t),r.Ui.delete(s.target)}function Vc(e,t,n){const r=Us(e);let s=ei.min(),i=ka();return r.persistence.runTransaction("Execute query","readonly",(e=>function(e,t,n){const r=Us(e),s=r.Ui.get(n);return void 0!==s?li.resolve(r.qi.get(s)):r.Cs.getTargetData(t,n)}(r,e,Oo(t)).next((t=>{if(t)return s=t.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(e,t.targetId).next((e=>{i=e}))})).next((()=>r.Li.getDocumentsMatchingQuery(e,t,n?s:ei.min(),n?i:ka()))).next((e=>(function(e,t,n){let r=e.Ki.get(t)||ei.min();n.forEach(((e,t)=>{t.readTime.compareTo(r)>0&&(r=t.readTime)})),e.Ki.set(t,r)}(r,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,Hi:i})))))}class qc{constructor(){this.activeTargetIds=Da()}er(e){this.activeTargetIds=this.activeTargetIds.add(e)}nr(e){this.activeTargetIds=this.activeTargetIds.delete(e)}tr(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class jc{constructor(){this.Lr=new qc,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e){return this.Lr.er(e),this.qr[e]||"not-current"}updateQueryState(e,t,n){this.qr[e]=t}removeLocalQueryTarget(e){this.Lr.nr(e)}isLocalQueryTarget(e){return this.Lr.activeTargetIds.has(e)}clearQueryState(e){delete this.qr[e]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(e){return this.Lr.activeTargetIds.has(e)}start(){return this.Lr=new qc,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}
1344
+ */class xc{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new po(Zs),this.Ui=new _a((t=>So(t)),bo),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new Ic(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Uc(t,e){const n=Vs(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Ra();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function Fc(t){const e=Vs(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Vc(t,e){const n=Vs(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(Ei.EMPTY_BYTE_STRING,ni.min()).withLastLimboFreeSnapshotVersion(ni.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ia(),c=Ra();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Ra(),s=Ra();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ia();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(ni.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ls("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(ni.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return fi.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}async function Bc(t,e,n){const r=Vs(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!pi(t))throw t;Ls("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function jc(t,e,n){const r=Vs(t);let s=ni.min(),i=Ra();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Vs(t),s=r.Ui.get(n);return void 0!==s?fi.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Po(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:ni.min(),n?i:Ra()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||ni.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class Hc{constructor(){this.activeTargetIds=Oa()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class qc{constructor(){this.Lr=new Hc,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Hc,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1344
1345
  /**
1345
1346
  * @license
1346
1347
  * Copyright 2019 Google LLC
@@ -1356,7 +1357,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1356
1357
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1357
1358
  * See the License for the specific language governing permissions and
1358
1359
  * limitations under the License.
1359
- */class Bc{Ur(e){}shutdown(){}}
1360
+ */class Kc{Ur(t){}shutdown(){}}
1360
1361
  /**
1361
1362
  * @license
1362
1363
  * Copyright 2019 Google LLC
@@ -1372,7 +1373,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1372
1373
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1373
1374
  * See the License for the specific language governing permissions and
1374
1375
  * limitations under the License.
1375
- */class zc{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(e){this.Wr.push(e)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Rs("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.Wr)e(0)}jr(){Rs("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.Wr)e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
1376
+ */class Wc{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Ls("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Ls("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
1376
1377
  /**
1377
1378
  * @license
1378
1379
  * Copyright 2020 Google LLC
@@ -1388,7 +1389,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1388
1389
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1389
1390
  * See the License for the specific language governing permissions and
1390
1391
  * limitations under the License.
1391
- */const $c={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1392
+ */const zc={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1392
1393
  /**
1393
1394
  * @license
1394
1395
  * Copyright 2017 Google LLC
@@ -1404,7 +1405,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1404
1405
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1405
1406
  * See the License for the specific language governing permissions and
1406
1407
  * limitations under the License.
1407
- */class Kc{constructor(e){this.Hr=e.Hr,this.Jr=e.Jr}Yr(e){this.Xr=e}Zr(e){this.eo=e}onMessage(e){this.no=e}close(){this.Jr()}send(e){this.Hr(e)}so(){this.Xr()}io(e){this.eo(e)}ro(e){this.no(e)}}
1408
+ */class $c{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
1408
1409
  /**
1409
1410
  * @license
1410
1411
  * Copyright 2017 Google LLC
@@ -1420,7 +1421,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1420
1421
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1421
1422
  * See the License for the specific language governing permissions and
1422
1423
  * limitations under the License.
1423
- */class Hc extends class{constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http";this.oo=t+"://"+e.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(e,t,n,r,s){const i=this.ho(e,t);Rs("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(e,i,o,n).then((e=>(Rs("RestConnection","Received: ",e),e)),(t=>{throw Ls("RestConnection",`${e} failed with error: `,t,"url: ",i,"request:",n),t}))}_o(e,t,n,r,s,i){return this.ao(e,t,n,r,s)}lo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+ks,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach(((t,n)=>e[n]=t)),n&&n.headers.forEach(((t,n)=>e[n]=t))}ho(e,t){const n=$c[e];return`${this.oo}/v1/${t}:${n}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams}fo(e,t,n,r){return new Promise(((s,i)=>{const o=new Ss;o.setWithCredentials(!0),o.listenOnce(ws.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case vs.NO_ERROR:const t=o.getResponseJson();Rs("Connection","XHR received:",JSON.stringify(t)),s(t);break;case vs.TIMEOUT:Rs("Connection",'RPC "'+e+'" timed out'),i(new Vs(Fs.DEADLINE_EXCEEDED,"Request time out"));break;case vs.HTTP_ERROR:const n=o.getStatus();if(Rs("Connection",'RPC "'+e+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let e=o.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(Fs).indexOf(t)>=0?t:Fs.UNKNOWN}(t.status);i(new Vs(e,t.message))}else i(new Vs(Fs.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Vs(Fs.UNAVAILABLE,"Connection failed."));break;default:Ms()}}finally{Rs("Connection",'RPC "'+e+'" completed.')}}));const a=JSON.stringify(r);o.send(t,"POST",a,n,15)}))}wo(e,t,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=new fs,i=ln(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new Es({})),this.lo(o.initMessageHeaders,t,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Rs("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new Kc({Hr:e=>{h?Rs("Connection","Not sending because WebChannel is closed:",e):(u||(Rs("Connection","Opening WebChannel transport."),c.open(),u=!0),Rs("Connection","WebChannel sending:",e),c.send(e))},Jr:()=>c.close()}),d=(e,t,n)=>{e.listen(t,(e=>{try{n(e)}catch(e){setTimeout((()=>{throw e}),0)}}))};return d(c,_s.EventType.OPEN,(()=>{h||Rs("Connection","WebChannel transport opened.")})),d(c,_s.EventType.CLOSE,(()=>{h||(h=!0,Rs("Connection","WebChannel transport closed"),l.io())})),d(c,_s.EventType.ERROR,(e=>{h||(h=!0,Ls("Connection","WebChannel transport errored:",e),l.io(new Vs(Fs.UNAVAILABLE,"The operation could not be completed")))})),d(c,_s.EventType.MESSAGE,(e=>{var t;if(!h){const n=e.data[0];xs(!!n);const r=n,s=r.error||(null===(t=r[0])||void 0===t?void 0:t.error);if(s){Rs("Connection","WebChannel received error:",s);const e=s.status;let t=function(e){const t=ga[e];if(void 0!==t)return ya(t)}(e),n=s.message;void 0===t&&(t=Fs.INTERNAL,n="Unknown error status: "+e+" with message "+s.message),h=!0,l.io(new Vs(t,n)),c.close()}else Rs("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Is.STAT_EVENT,(e=>{e.stat===bs?Rs("Connection","Detected buffering proxy"):e.stat===Ts&&Rs("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Gc(){return"undefined"!=typeof document?document:null}
1424
+ */class Gc extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,s){const i=this.ho(t,e);Ls("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Ls("RestConnection","Received: ",t),t)),(e=>{throw Ms("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,r,s,i){return this.ao(t,e,n,r,s)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Rs,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=zc[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((s,i)=>{const o=new Cs;o.setWithCredentials(!0),o.listenOnce(Ts.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case _s.NO_ERROR:const e=o.getResponseJson();Ls("Connection","XHR received:",JSON.stringify(e)),s(e);break;case _s.TIMEOUT:Ls("Connection",'RPC "'+t+'" timed out'),i(new js(Bs.DEADLINE_EXCEEDED,"Request time out"));break;case _s.HTTP_ERROR:const n=o.getStatus();if(Ls("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Bs).indexOf(e)>=0?e:Bs.UNKNOWN}(e.status);i(new js(t,e.message))}else i(new js(Bs.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new js(Bs.UNAVAILABLE,"Connection failed."));break;default:Us()}}finally{Ls("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],s=new gs,i=fn(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new bs({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Ls("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new $c({Hr:t=>{h?Ls("Connection","Not sending because WebChannel is closed:",t):(u||(Ls("Connection","Opening WebChannel transport."),c.open(),u=!0),Ls("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,As.EventType.OPEN,(()=>{h||Ls("Connection","WebChannel transport opened.")})),d(c,As.EventType.CLOSE,(()=>{h||(h=!0,Ls("Connection","WebChannel transport closed"),l.io())})),d(c,As.EventType.ERROR,(t=>{h||(h=!0,Ms("Connection","WebChannel transport errored:",t),l.io(new js(Bs.UNAVAILABLE,"The operation could not be completed")))})),d(c,As.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Fs(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Ls("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=ya[t];if(void 0!==e)return wa(e)}(t),n=s.message;void 0===e&&(e=Bs.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new js(e,n)),c.close()}else Ls("Connection","WebChannel received:",n),l.ro(n)}})),d(i,Is.STAT_EVENT,(t=>{t.stat===Es?Ls("Connection","Detected buffering proxy"):t.stat===Ss&&Ls("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function Qc(){return"undefined"!=typeof document?document:null}
1424
1425
  /**
1425
1426
  * @license
1426
1427
  * Copyright 2020 Google LLC
@@ -1436,7 +1437,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1436
1437
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1437
1438
  * See the License for the specific language governing permissions and
1438
1439
  * limitations under the License.
1439
- */function Wc(e){return new za(e,!0)}class Qc{constructor(e,t,n=1e3,r=1.5,s=6e4){this.Hs=e,this.timerId=t,this.mo=n,this.yo=r,this.po=s,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(e){this.cancel();const t=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,t-n);r>0&&Rs("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),e()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
1440
+ */function Jc(t){return new Wa(t,!0)}class Yc{constructor(t,e,n=1e3,r=1.5,s=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=s,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&Ls("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
1440
1441
  /**
1441
1442
  * @license
1442
1443
  * Copyright 2017 Google LLC
@@ -1452,7 +1453,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1452
1453
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1453
1454
  * See the License for the specific language governing permissions and
1454
1455
  * limitations under the License.
1455
- */class Yc{constructor(e,t,n,r,s,i,o,a){this.Hs=e,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Qc(e,t)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(e){this.Lo(),this.stream.send(e)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(e,t){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==e?this.xo.reset():t&&t.code===Fs.RESOURCE_EXHAUSTED?(Os(t.toString()),Os("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):t&&t.code===Fs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Zr(t)}Uo(){}auth(){this.state=1;const e=this.Ko(this.So),t=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([e,n])=>{this.So===t&&this.Go(e,n)}),(t=>{e((()=>{const e=new Vs(Fs.UNKNOWN,"Fetching auth token failed: "+t.message);return this.Qo(e)}))}))}Go(e,t){const n=this.Ko(this.So);this.stream=this.jo(e,t),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((e=>{n((()=>this.Qo(e)))})),this.stream.onMessage((e=>{n((()=>this.onMessage(e)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(e){return Rs("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}Ko(e){return t=>{this.Hs.enqueueAndForget((()=>this.So===e?t():(Rs("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Xc extends Yc{constructor(e,t,n,r,s,i){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,i),this.yt=s}jo(e,t){return this.connection.wo("Listen",e,t)}onMessage(e){this.xo.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:Ms()}(t.targetChange.targetChangeType||"NO_CHANGE"),s=t.targetChange.targetIds||[],i=function(e,t){return e.wt?(xs(void 0===t||"string"==typeof t),bi.fromBase64String(t||"")):(xs(void 0===t||t instanceof Uint8Array),bi.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Fs.UNKNOWN:ya(e.code);return new Vs(t,e.message||"")}(o);n=new Ma(r,s,i,a||null)}else if("documentChange"in t){t.documentChange;const r=t.documentChange;r.document,r.document.name,r.document.updateTime;const s=Qa(e,r.document.name),i=Ha(r.document.updateTime),o=r.document.createTime?Ha(r.document.createTime):ei.min(),a=new vo({mapValue:{fields:r.document.fields}}),c=wo.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new La(u,h,c.key,c)}else if("documentDelete"in t){t.documentDelete;const r=t.documentDelete;r.document;const s=Qa(e,r.document),i=r.readTime?Ha(r.readTime):ei.min(),o=wo.newNoDocument(s,i),a=r.removedTargetIds||[];n=new La([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const r=t.documentRemove;r.document;const s=Qa(e,r.document),i=r.removedTargetIds||[];n=new La([],i,s,null)}else{if(!("filter"in t))return Ms();{t.filter;const e=t.filter;e.targetId;const r=e.count||0,s=new pa(r),i=e.targetId;n=new Pa(i,s)}}return n}(this.yt,e),n=function(e){if(!("targetChange"in e))return ei.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?ei.min():t.readTime?Ha(t.readTime):ei.min()}(e);return this.listener.Wo(t,n)}zo(e){const t={};t.database=Xa(this.yt),t.addTarget=function(e,t){let n;const r=t.target;return n=_o(r)?{documents:Za(e,r)}:{query:ec(e,r)},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0?n.resumeToken=Ka(e,t.resumeToken):t.snapshotVersion.compareTo(ei.min())>0&&(n.readTime=$a(e,t.snapshotVersion.toTimestamp())),n}(this.yt,e);const n=function(e,t){const n=function(e,t){switch(t){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Ms()}}(0,t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,e);n&&(t.labels=n),this.Bo(t)}Ho(e){const t={};t.database=Xa(this.yt),t.removeTarget=e,this.Bo(t)}}
1456
+ */class Xc{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new Yc(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Bs.RESOURCE_EXHAUSTED?(Ps(e.toString()),Ps("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Bs.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new js(Bs.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Ls("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ls("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class Zc extends Xc{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Us()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Fs(void 0===e||"string"==typeof e),Ei.fromBase64String(e||"")):(Fs(void 0===e||e instanceof Uint8Array),Ei.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Bs.UNKNOWN:wa(t.code);return new js(e,t.message||"")}(o);n=new Ua(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=Ya(t,r.document.name),i=Ga(r.document.updateTime),o=r.document.createTime?Ga(r.document.createTime):ni.min(),a=new _o({mapValue:{fields:r.document.fields}}),c=To.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new Ma(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=Ya(t,r.document),i=r.readTime?Ga(r.readTime):ni.min(),o=To.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Ma([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=Ya(t,r.document),i=r.removedTargetIds||[];n=new Ma([],i,s,null)}else{if(!("filter"in e))return Us();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new ma(r),i=t.targetId;n=new xa(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return ni.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?ni.min():e.readTime?Ga(e.readTime):ni.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=Za(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ao(r)?{documents:ec(t,r)}:{query:nc(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=$a(t,e.resumeToken):e.snapshotVersion.compareTo(ni.min())>0&&(n.readTime=za(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Us()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=Za(this.yt),e.removeTarget=t,this.Bo(e)}}
1456
1457
  /**
1457
1458
  * @license
1458
1459
  * Copyright 2017 Google LLC
@@ -1468,7 +1469,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1468
1469
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1469
1470
  * See the License for the specific language governing permissions and
1470
1471
  * limitations under the License.
1471
- */class Jc extends class{}{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Vs(Fs.FAILED_PRECONDITION,"The client has already been terminated.")}ao(e,t,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection.ao(e,t,n,r,s))).catch((e=>{throw"FirebaseError"===e.name?(e.code===Fs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Vs(Fs.UNKNOWN,e.toString())}))}_o(e,t,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection._o(e,t,n,s,i,r))).catch((e=>{throw"FirebaseError"===e.name?(e.code===Fs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Vs(Fs.UNKNOWN,e.toString())}))}terminate(){this.nu=!0}}class Zc{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(e){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.cu("Offline")))}set(e){this.lu(),this.iu=0,"Online"===e&&(this.ou=!1),this.cu(e)}cu(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}au(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(Os(t),this.ou=!1):Rs("OnlineStateTracker",t)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1472
+ */class tu extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new js(Bs.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection.ao(t,e,n,r,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Bs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new js(Bs.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection._o(t,e,n,s,i,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Bs.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new js(Bs.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class eu{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(Ps(e),this.ou=!1):Ls("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1472
1473
  /**
1473
1474
  * @license
1474
1475
  * Copyright 2017 Google LLC
@@ -1484,7 +1485,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1484
1485
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1485
1486
  * See the License for the specific language governing permissions and
1486
1487
  * limitations under the License.
1487
- */class eu{constructor(e,t,n,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=s,this.mu.Ur((e=>{n.enqueueAndForget((async()=>{uu(this)&&(Rs("RemoteStore","Restarting streams for network reachability change."),await async function(e){const t=Us(e);t._u.add(4),await nu(t),t.gu.set("Unknown"),t._u.delete(4),await tu(t)}(this))}))})),this.gu=new Zc(n,r)}}async function tu(e){if(uu(e))for(const t of e.wu)await t(!0)}async function nu(e){for(const t of e.wu)await t(!1)}function ru(e,t){const n=Us(e);n.du.has(t.targetId)||(n.du.set(t.targetId,t),cu(n)?au(n):mu(n).ko()&&iu(n,t))}function su(e,t){const n=Us(e),r=mu(n);n.du.delete(t),r.ko()&&ou(n,t),0===n.du.size&&(r.ko()?r.Fo():uu(n)&&n.gu.set("Unknown"))}function iu(e,t){e.yu.Ot(t.targetId),mu(e).zo(t)}function ou(e,t){e.yu.Ot(t),mu(e).Ho(t)}function au(e){e.yu=new Ua({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),ne:t=>e.du.get(t)||null}),mu(e).start(),e.gu.uu()}function cu(e){return uu(e)&&!mu(e).No()&&e.du.size>0}function uu(e){return 0===Us(e)._u.size}function hu(e){e.yu=void 0}async function lu(e){e.du.forEach(((t,n)=>{iu(e,t)}))}async function du(e,t){hu(e),cu(e)?(e.gu.hu(t),au(e)):e.gu.set("Unknown")}async function fu(e,t,n){if(e.gu.set("Online"),t instanceof Ma&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const r of t.targetIds)e.du.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.du.delete(r),e.yu.removeTarget(r))}(e,t)}catch(n){Rs("RemoteStore","Failed to remove targets %s: %s ",t.targetIds.join(","),n),await pu(e,n)}else if(t instanceof La?e.yu.Kt(t):t instanceof Pa?e.yu.Jt(t):e.yu.jt(t),!n.isEqual(ei.min()))try{const t=await xc(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.yu.Zt(t);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=e.du.get(r);s&&e.du.set(r,s.withResumeToken(n.resumeToken,t))}})),n.targetMismatches.forEach((t=>{const n=e.du.get(t);if(!n)return;e.du.set(t,n.withResumeToken(bi.EMPTY_BYTE_STRING,n.snapshotVersion)),ou(e,t);const r=new dc(n.target,t,1,n.sequenceNumber);iu(e,r)})),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Rs("RemoteStore","Failed to raise snapshot:",t),await pu(e,t)}}async function pu(e,t,n){if(!di(t))throw t;e._u.add(1),await nu(e),e.gu.set("Offline"),n||(n=()=>xc(e.localStore)),e.asyncQueue.enqueueRetryable((async()=>{Rs("RemoteStore","Retrying IndexedDB access"),await n(),e._u.delete(1),await tu(e)}))}async function gu(e,t){const n=Us(e);n.asyncQueue.verifyOperationInProgress(),Rs("RemoteStore","RemoteStore received new credentials");const r=uu(n);n._u.add(3),await nu(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n._u.delete(3),await tu(n)}function mu(e){return e.pu||(e.pu=function(e,t,n){const r=Us(e);return r.su(),new Xc(t,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1488
+ */class nu{constructor(t,e,n,r,s){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=s,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{lu(this)&&(Ls("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Vs(t);e._u.add(4),await su(e),e.gu.set("Unknown"),e._u.delete(4),await ru(e)}(this))}))})),this.gu=new eu(n,r)}}async function ru(t){if(lu(t))for(const e of t.wu)await e(!0)}async function su(t){for(const e of t.wu)await e(!1)}function iu(t,e){const n=Vs(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),hu(n)?uu(n):vu(n).ko()&&au(n,e))}function ou(t,e){const n=Vs(t),r=vu(n);n.du.delete(e),r.ko()&&cu(n,e),0===n.du.size&&(r.ko()?r.Fo():lu(n)&&n.gu.set("Unknown"))}function au(t,e){t.yu.Ot(e.targetId),vu(t).zo(e)}function cu(t,e){t.yu.Ot(e),vu(t).Ho(e)}function uu(t){t.yu=new Va({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),vu(t).start(),t.gu.uu()}function hu(t){return lu(t)&&!vu(t).No()&&t.du.size>0}function lu(t){return 0===Vs(t)._u.size}function du(t){t.yu=void 0}async function fu(t){t.du.forEach(((e,n)=>{au(t,e)}))}async function pu(t,e){du(t),hu(t)?(t.gu.hu(e),uu(t)):t.gu.set("Unknown")}async function gu(t,e,n){if(t.gu.set("Online"),e instanceof Ua&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){Ls("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await mu(t,n)}else if(e instanceof Ma?t.yu.Kt(e):e instanceof xa?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(ni.min()))try{const e=await Fc(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=t.du.get(r);s&&t.du.set(r,s.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(Ei.EMPTY_BYTE_STRING,n.snapshotVersion)),cu(t,e);const r=new pc(n.target,e,1,n.sequenceNumber);au(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Ls("RemoteStore","Failed to raise snapshot:",e),await mu(t,e)}}async function mu(t,e,n){if(!pi(e))throw e;t._u.add(1),await su(t),t.gu.set("Offline"),n||(n=()=>Fc(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Ls("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await ru(t)}))}async function yu(t,e){const n=Vs(t);n.asyncQueue.verifyOperationInProgress(),Ls("RemoteStore","RemoteStore received new credentials");const r=lu(n);n._u.add(3),await su(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await ru(n)}function vu(t){return t.pu||(t.pu=function(t,e,n){const r=Vs(t);return r.su(),new Zc(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1488
1489
  /**
1489
1490
  * @license
1490
1491
  * Copyright 2018 Google LLC
@@ -1500,7 +1501,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1500
1501
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1501
1502
  * See the License for the specific language governing permissions and
1502
1503
  * limitations under the License.
1503
- */}(e.datastore,e.asyncQueue,{Yr:lu.bind(null,e),Zr:du.bind(null,e),Wo:fu.bind(null,e)}),e.wu.push((async t=>{t?(e.pu.Mo(),cu(e)?au(e):e.gu.set("Unknown")):(await e.pu.stop(),hu(e))}))),e.pu
1504
+ */}(t.datastore,t.asyncQueue,{Yr:fu.bind(null,t),Zr:pu.bind(null,t),Wo:gu.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),hu(t)?uu(t):t.gu.set("Unknown")):(await t.pu.stop(),du(t))}))),t.pu
1504
1505
  /**
1505
1506
  * @license
1506
1507
  * Copyright 2017 Google LLC
@@ -1516,7 +1517,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1516
1517
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1517
1518
  * See the License for the specific language governing permissions and
1518
1519
  * limitations under the License.
1519
- */}class yu{constructor(e,t,n,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new qs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((e=>{}))}static createAndSchedule(e,t,n,r,s){const i=Date.now()+n,o=new yu(e,t,i,r,s);return o.start(n),o}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Vs(Fs.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((e=>this.deferred.resolve(e)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function vu(e,t){if(Os("AsyncQueue",`${t}: ${e}`),di(e))return new Vs(Fs.UNAVAILABLE,`${t}: ${e}`);throw e}
1520
+ */}class wu{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Hs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,s){const i=Date.now()+n,o=new wu(t,e,i,r,s);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new js(Bs.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function _u(t,e){if(Ps("AsyncQueue",`${e}: ${t}`),pi(t))return new js(Bs.UNAVAILABLE,`${e}: ${t}`);throw t}
1520
1521
  /**
1521
1522
  * @license
1522
1523
  * Copyright 2017 Google LLC
@@ -1532,7 +1533,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1532
1533
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1533
1534
  * See the License for the specific language governing permissions and
1534
1535
  * limitations under the License.
1535
- */class wu{constructor(e){this.comparator=e?(t,n)=>e(t,n)||ii.comparator(t.key,n.key):(e,t)=>ii.comparator(e.key,t.key),this.keyedMap=Ta(),this.sortedSet=new lo(this.comparator)}static emptySet(e){return new wu(e.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal(((t,n)=>(e(t),!1)))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof wu))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){const e=[];return this.forEach((t=>{e.push(t.toString())})),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new wu;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}
1536
+ */class Tu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||ai.comparator(e.key,n.key):(t,e)=>ai.comparator(t.key,e.key),this.keyedMap=Sa(),this.sortedSet=new po(this.comparator)}static emptySet(t){return new Tu(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Tu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Tu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1536
1537
  /**
1537
1538
  * @license
1538
1539
  * Copyright 2017 Google LLC
@@ -1548,7 +1549,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1548
1549
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1549
1550
  * See the License for the specific language governing permissions and
1550
1551
  * limitations under the License.
1551
- */class Iu{constructor(){this.Tu=new lo(ii.comparator)}track(e){const t=e.doc.key,n=this.Tu.get(t);n?0!==e.type&&3===n.type?this.Tu=this.Tu.insert(t,e):3===e.type&&1!==n.type?this.Tu=this.Tu.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.Tu=this.Tu.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.Tu=this.Tu.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.Tu=this.Tu.remove(t):1===e.type&&2===n.type?this.Tu=this.Tu.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.Tu=this.Tu.insert(t,{type:2,doc:e.doc}):Ms():this.Tu=this.Tu.insert(t,e)}Eu(){const e=[];return this.Tu.inorderTraversal(((t,n)=>{e.push(n)})),e}}class bu{constructor(e,t,n,r,s,i,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,r,s){const i=[];return t.forEach((e=>{i.push({type:0,doc:e})})),new bu(e,t,wu.emptySet(t),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Mo(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}
1552
+ */class Iu{constructor(){this.Tu=new po(ai.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):Us():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Eu{constructor(t,e,n,r,s,i,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,s){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new Eu(t,e,Tu.emptySet(e),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&Uo(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
1552
1553
  /**
1553
1554
  * @license
1554
1555
  * Copyright 2017 Google LLC
@@ -1564,7 +1565,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1564
1565
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1565
1566
  * See the License for the specific language governing permissions and
1566
1567
  * limitations under the License.
1567
- */class Tu{constructor(){this.Au=void 0,this.listeners=[]}}class Eu{constructor(){this.queries=new va((e=>xo(e)),Mo),this.onlineState="Unknown",this.Ru=new Set}}async function _u(e,t){const n=Us(e),r=t.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new Tu),s)try{i.Au=await n.onListen(r)}catch(e){const n=vu(e,`Initialization of query '${Uo(t.query)}' failed`);return void t.onError(n)}n.queries.set(r,i),i.listeners.push(t),t.bu(n.onlineState),i.Au&&t.Pu(i.Au)&&ku(n)}async function Su(e,t){const n=Us(e),r=t.query;let s=!1;const i=n.queries.get(r);if(i){const e=i.listeners.indexOf(t);e>=0&&(i.listeners.splice(e,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function Cu(e,t){const n=Us(e);let r=!1;for(const e of t){const t=e.query,s=n.queries.get(t);if(s){for(const t of s.listeners)t.Pu(e)&&(r=!0);s.Au=e}}r&&ku(n)}function Au(e,t,n){const r=Us(e),s=r.queries.get(t);if(s)for(const e of s.listeners)e.onError(n);r.queries.delete(t)}function ku(e){e.Ru.forEach((e=>{e.next()}))}class Nu{constructor(e,t,n){this.query=e,this.vu=t,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new bu(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.Vu?this.Du(e)&&(this.vu.next(e),t=!0):this.Cu(e,this.onlineState)&&(this.xu(e),t=!0),this.Su=e,t}onError(e){this.vu.error(e)}bu(e){this.onlineState=e;let t=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,e)&&(this.xu(this.Su),t=!0),t}Cu(e,t){if(!e.fromCache)return!0;const n="Offline"!==t;return(!this.options.Nu||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Du(e){if(e.docChanges.length>0)return!0;const t=this.Su&&this.Su.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}xu(e){e=bu.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Vu=!0,this.vu.next(e)}}
1568
+ */class Su{constructor(){this.Au=void 0,this.listeners=[]}}class bu{constructor(){this.queries=new _a((t=>Fo(t)),Uo),this.onlineState="Unknown",this.Ru=new Set}}async function Au(t,e){const n=Vs(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new Su),s)try{i.Au=await n.onListen(r)}catch(t){const n=_u(t,`Initialization of query '${Vo(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Ru(n)}async function Cu(t,e){const n=Vs(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function ku(t,e){const n=Vs(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.listeners)e.Pu(t)&&(r=!0);s.Au=t}}r&&Ru(n)}function Nu(t,e,n){const r=Vs(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Ru(t){t.Ru.forEach((t=>{t.next()}))}class Du{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new Eu(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=Eu.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1568
1569
  /**
1569
1570
  * @license
1570
1571
  * Copyright 2017 Google LLC
@@ -1580,7 +1581,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1580
1581
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1581
1582
  * See the License for the specific language governing permissions and
1582
1583
  * limitations under the License.
1583
- */class Du{constructor(e){this.key=e}}class Ru{constructor(e){this.key=e}}class Ou{constructor(e,t){this.query=e,this.qu=t,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=ka(),this.mutatedKeys=ka(),this.Gu=Vo(e),this.Qu=new wu(this.Gu)}get ju(){return this.qu}Wu(e,t){const n=t?t.zu:new Iu,r=t?t.Qu:this.Qu;let s=t?t.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal(((e,t)=>{const u=r.get(e),h=Fo(this.query,t)?t:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(e):s.delete(e)):(i=i.delete(e),s=s.delete(e)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const e="F"===this.query.limitType?i.last():i.first();i=i.delete(e.key),s=s.delete(e.key),n.track({type:1,doc:e})}return{Qu:i,zu:n,$i:o,mutatedKeys:s}}Hu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n){const r=this.Qu;this.Qu=e.Qu,this.mutatedKeys=e.mutatedKeys;const s=e.zu.Eu();s.sort(((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ms()}};return n(e)-n(t)}
1584
+ */class Ou{constructor(t){this.key=t}}class Lu{constructor(t){this.key=t}}class Pu{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Ra(),this.mutatedKeys=Ra(),this.Gu=jo(t),this.Qu=new Tu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Iu,r=e?e.Qu:this.Qu;let s=e?e.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const u=r.get(t),h=Bo(this.query,e)?e:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(t):s.delete(t)):(i=i.delete(t),s=s.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:s}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const s=t.zu.Eu();s.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Us()}};return n(t)-n(e)}
1584
1585
  /**
1585
1586
  * @license
1586
1587
  * Copyright 2020 Google LLC
@@ -1596,7 +1597,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1596
1597
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1597
1598
  * See the License for the specific language governing permissions and
1598
1599
  * limitations under the License.
1599
- */(e.type,t.type)||this.Gu(e.doc,t.doc))),this.Ju(n);const i=t?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new bu(this.query,e.Qu,r,s,e.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(e){return!this.qu.has(e)&&!!this.Qu.has(e)&&!this.Qu.get(e).hasLocalMutations}Ju(e){e&&(e.addedDocuments.forEach((e=>this.qu=this.qu.add(e))),e.modifiedDocuments.forEach((e=>{})),e.removedDocuments.forEach((e=>this.qu=this.qu.delete(e))),this.current=e.current)}Yu(){if(!this.current)return[];const e=this.Ku;this.Ku=ka(),this.Qu.forEach((e=>{this.Zu(e.key)&&(this.Ku=this.Ku.add(e.key))}));const t=[];return e.forEach((e=>{this.Ku.has(e)||t.push(new Ru(e))})),this.Ku.forEach((n=>{e.has(n)||t.push(new Du(n))})),t}tc(e){this.qu=e.Hi,this.Ku=ka();const t=this.Wu(e.documents);return this.applyChanges(t,!0)}ec(){return bu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Lu{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class Pu{constructor(e){this.key=e,this.nc=!1}}class Mu{constructor(e,t,n,r,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new va((e=>xo(e)),Mo),this.rc=new Map,this.oc=new Set,this.uc=new lo(ii.comparator),this.cc=new Map,this.ac=new Ec,this.hc={},this.lc=new Map,this.fc=yc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function xu(e,t){const n=function(e){const t=Us(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=Fu.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Wu.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=qu.bind(null,t),t.sc.Wo=Cu.bind(null,t.eventManager),t.sc.wc=Au.bind(null,t.eventManager),t}(e);let r,s;const i=n.ic.get(t);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const e=await function(e,t){const n=Us(e);return n.persistence.runTransaction("Allocate target","readwrite",(e=>{let r;return n.Cs.getTargetData(e,t).next((s=>s?(r=s,li.resolve(r)):n.Cs.allocateTargetId(e).next((s=>(r=new dc(t,s,0,e.currentSequenceNumber),n.Cs.addTargetData(e,r).next((()=>r)))))))})).then((e=>{const r=n.qi.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(e.targetId,e),n.Ui.set(t,e.targetId)),e}))}(n.localStore,Oo(t));n.isPrimaryClient&&ru(n.remoteStore,e);const i=n.sharedClientState.addLocalQueryTarget(e.targetId);r=e.targetId,s=await async function(e,t,n,r,s){e._c=(t,n,r)=>async function(e,t,n,r){let s=t.view.Wu(n);s.$i&&(s=await Vc(e.localStore,t.query,!1).then((({documents:e})=>t.view.Wu(e,s))));const i=r&&r.targetChanges.get(t.targetId),o=t.view.applyChanges(s,e.isPrimaryClient,i);return zu(e,t.targetId,o.Xu),o.snapshot}(e,t,n,r);const i=await Vc(e.localStore,t,!0),o=new Ou(t,i.Hi),a=o.Wu(i.documents),c=Oa.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,s),u=o.applyChanges(a,e.isPrimaryClient,c);zu(e,n,u.Xu);const h=new Lu(t,n,o);return e.ic.set(t,h),e.rc.has(n)?e.rc.get(n).push(t):e.rc.set(n,[t]),u.snapshot}(n,t,r,"current"===i,e.resumeToken)}return s}async function Uu(e,t){const n=Us(e),r=n.ic.get(t),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((e=>!Mo(e,t)))),void n.ic.delete(t);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Fc(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),su(n.remoteStore,r.targetId),ju(n,r.targetId)})).catch(hi)):(ju(n,r.targetId),await Fc(n.localStore,r.targetId,!0))}async function Fu(e,t){const n=Us(e);try{const e=await Uc(n.localStore,t);t.targetChanges.forEach(((e,t)=>{const r=n.cc.get(t);r&&(xs(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1),e.addedDocuments.size>0?r.nc=!0:e.modifiedDocuments.size>0?xs(r.nc):e.removedDocuments.size>0&&(xs(r.nc),r.nc=!1))})),await Hu(n,e,t)}catch(e){await hi(e)}}function Vu(e,t,n){const r=Us(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(t);s.snapshot&&e.push(s.snapshot)})),function(e,t){const n=Us(e);n.onlineState=t;let r=!1;n.queries.forEach(((e,n)=>{for(const e of n.listeners)e.bu(t)&&(r=!0)})),r&&ku(n)}(r.eventManager,t),e.length&&r.sc.Wo(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function qu(e,t,n){const r=Us(e);r.sharedClientState.updateQueryState(t,"rejected",n);const s=r.cc.get(t),i=s&&s.key;if(i){let e=new lo(ii.comparator);e=e.insert(i,wo.newNoDocument(i,ei.min()));const n=ka().add(i),s=new Ra(ei.min(),new Map,new go(Xs),e,n);await Fu(r,s),r.uc=r.uc.remove(i),r.cc.delete(t),Ku(r)}else await Fc(r.localStore,t,!1).then((()=>ju(r,t,n))).catch(hi)}function ju(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.rc.get(t))e.ic.delete(r),n&&e.sc.wc(r,n);e.rc.delete(t),e.isPrimaryClient&&e.ac.ls(t).forEach((t=>{e.ac.containsKey(t)||Bu(e,t)}))}function Bu(e,t){e.oc.delete(t.path.canonicalString());const n=e.uc.get(t);null!==n&&(su(e.remoteStore,n),e.uc=e.uc.remove(t),e.cc.delete(n),Ku(e))}function zu(e,t,n){for(const r of n)r instanceof Du?(e.ac.addReference(r.key,t),$u(e,r)):r instanceof Ru?(Rs("SyncEngine","Document no longer in limbo: "+r.key),e.ac.removeReference(r.key,t),e.ac.containsKey(r.key)||Bu(e,r.key)):Ms()}function $u(e,t){const n=t.key,r=n.path.canonicalString();e.uc.get(n)||e.oc.has(r)||(Rs("SyncEngine","New document in limbo: "+n),e.oc.add(r),Ku(e))}function Ku(e){for(;e.oc.size>0&&e.uc.size<e.maxConcurrentLimboResolutions;){const t=e.oc.values().next().value;e.oc.delete(t);const n=new ii(ni.fromString(t)),r=e.fc.next();e.cc.set(r,new Pu(n)),e.uc=e.uc.insert(n,r),ru(e.remoteStore,new dc(Oo(Co(n.path)),r,2,fi.at))}}async function Hu(e,t,n){const r=Us(e),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((e,a)=>{o.push(r._c(a,t,n).then((e=>{if((e||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==e?void 0:e.fromCache)?"not-current":"current"),e){s.push(e);const t=Oc.Ci(a.targetId,e);i.push(t)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(e,t){const n=Us(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(e=>li.forEach(t,(t=>li.forEach(t.Si,(r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r))).next((()=>li.forEach(t.Di,(r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))))))}catch(e){if(!di(e))throw e;Rs("LocalStore","Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.qi.get(t),r=e.snapshotVersion,s=e.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(t,s)}}}(r.localStore,i))}async function Gu(e,t){const n=Us(e);if(!n.currentUser.isEqual(t)){Rs("SyncEngine","User change. New user:",t.toKey());const e=await Mc(n.localStore,t);n.currentUser=t,function(e,t){e.lc.forEach((e=>{e.forEach((e=>{e.reject(new Vs(Fs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),e.lc.clear()}(n),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Hu(n,e.ji)}}function Wu(e,t){const n=Us(e),r=n.cc.get(t);if(r&&r.nc)return ka().add(r.key);{let e=ka();const r=n.rc.get(t);if(!r)return e;for(const t of r){const r=n.ic.get(t);e=e.unionWith(r.view.ju)}return e}}class Qu{constructor(){this.synchronizeTabs=!1}async initialize(e){this.yt=Wc(e.databaseInfo.databaseId),this.sharedClientState=this.gc(e),this.persistence=this.yc(e),await this.persistence.start(),this.localStore=this.Ic(e),this.gcScheduler=this.Tc(e,this.localStore),this.indexBackfillerScheduler=this.Ec(e,this.localStore)}Tc(e,t){return null}Ec(e,t){return null}Ic(e){return function(e,t,n,r){return new Pc(e,t,n,r)}(this.persistence,new Lc,e.initialUser,this.yt)}yc(e){return new Nc(Rc.Bs,this.yt)}gc(e){return new jc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Yu{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>Vu(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Gu.bind(null,this.syncEngine),await async function(e,t){const n=Us(e);t?(n._u.delete(2),await tu(n)):t||(n._u.add(2),await nu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Eu}createDatastore(e){const t=Wc(e.databaseInfo.databaseId),n=(r=e.databaseInfo,new Hc(r));var r;return function(e,t,n,r){return new Jc(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return t=this.localStore,n=this.datastore,r=e.asyncQueue,s=e=>Vu(this.syncEngine,e,0),i=zc.C()?new zc:new Bc,new eu(t,n,r,s,i);var t,n,r,s,i}createSyncEngine(e,t){return function(e,t,n,r,s,i,o){const a=new Mu(e,t,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}terminate(){return async function(e){const t=Us(e);Rs("RemoteStore","RemoteStore shutting down."),t._u.add(5),await nu(t),t.mu.shutdown(),t.gu.set("Unknown")}(this.remoteStore)}}
1600
+ */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new Eu(this.query,t.Qu,r,s,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Iu,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Ra(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Ou(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Ra();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Eu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Mu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class xu{constructor(t){this.key=t,this.nc=!1}}class Uu{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _a((t=>Fo(t)),Uo),this.rc=new Map,this.oc=new Set,this.uc=new po(ai.comparator),this.cc=new Map,this.ac=new bc,this.hc={},this.lc=new Map,this.fc=wc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function Fu(t,e){const n=function(t){const e=Vs(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ju.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=Hu.bind(null,e),e.sc.Wo=ku.bind(null,e.eventManager),e.sc.wc=Nu.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Vs(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,fi.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new pc(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Po(e));n.isPrimaryClient&&iu(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await jc(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return Wu(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await jc(t.localStore,e,!0),o=new Pu(e,i.Hi),a=o.Wu(i.documents),c=Pa.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);Wu(t,n,u.Xu);const h=new Mu(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,r,"current"===i,t.resumeToken)}return s}async function Vu(t,e){const n=Vs(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!Uo(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Bc(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),ou(n.remoteStore,r.targetId),qu(n,r.targetId)})).catch(di)):(qu(n,r.targetId),await Bc(n.localStore,r.targetId,!0))}async function Bu(t,e){const n=Vs(t);try{const t=await Vc(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Fs(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Fs(r.nc):t.removedDocuments.size>0&&(Fs(r.nc),r.nc=!1))})),await Gu(n,t,e)}catch(t){await di(t)}}function ju(t,e,n){const r=Vs(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Vs(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Ru(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function Hu(t,e,n){const r=Vs(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new po(ai.comparator);t=t.insert(i,To.newNoDocument(i,ni.min()));const n=Ra().add(i),s=new La(ni.min(),new Map,new yo(Zs),t,n);await Bu(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),$u(r)}else await Bc(r.localStore,e,!1).then((()=>qu(r,e,n))).catch(di)}function qu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||Ku(t,e)}))}function Ku(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ou(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),$u(t))}function Wu(t,e,n){for(const r of n)r instanceof Ou?(t.ac.addReference(r.key,e),zu(t,r)):r instanceof Lu?(Ls("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||Ku(t,r.key)):Us()}function zu(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ls("SyncEngine","New document in limbo: "+n),t.oc.add(r),$u(t))}function $u(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new ai(si.fromString(e)),r=t.fc.next();t.cc.set(r,new xu(n)),t.uc=t.uc.insert(n,r),iu(t.remoteStore,new pc(Po(ko(n.path)),r,2,gi.at))}}async function Gu(t,e,n){const r=Vs(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Pc.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Vs(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>fi.forEach(e,(e=>fi.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>fi.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!pi(t))throw t;Ls("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function Qu(t,e){const n=Vs(t);if(!n.currentUser.isEqual(e)){Ls("SyncEngine","User change. New user:",e.toKey());const t=await Uc(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new js(Bs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Gu(n,t.ji)}}function Ju(t,e){const n=Vs(t),r=n.cc.get(e);if(r&&r.nc)return Ra().add(r.key);{let t=Ra();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Yu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=Jc(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new xc(t,e,n,r)}(this.persistence,new Mc,t.initialUser,this.yt)}yc(t){return new Dc(Lc.Bs,this.yt)}gc(t){return new qc}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Xu{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>ju(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Qu.bind(null,this.syncEngine),await async function(t,e){const n=Vs(t);e?(n._u.delete(2),await ru(n)):e||(n._u.add(2),await su(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new bu}createDatastore(t){const e=Jc(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Gc(r));var r;return function(t,e,n,r){return new tu(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>ju(this.syncEngine,t,0),i=Wc.C()?new Wc:new Kc,new nu(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new Uu(t,e,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Vs(t);Ls("RemoteStore","RemoteStore shutting down."),e._u.add(5),await su(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1600
1601
  /**
1601
1602
  * @license
1602
1603
  * Copyright 2017 Google LLC
@@ -1612,7 +1613,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1612
1613
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1613
1614
  * See the License for the specific language governing permissions and
1614
1615
  * limitations under the License.
1615
- */function Xu(e,t,n){if(!n)throw new Vs(Fs.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function Ju(e){if(!ii.isDocumentKey(e))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function Zu(e){if(ii.isDocumentKey(e))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function eh(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":Ms()}function th(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Vs(Fs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=eh(e);throw new Vs(Fs.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}
1616
+ */function Zu(t,e,n){if(!n)throw new js(Bs.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function th(t){if(!ai.isDocumentKey(t))throw new js(Bs.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function eh(t){if(ai.isDocumentKey(t))throw new js(Bs.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function nh(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Us()}function rh(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new js(Bs.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=nh(t);throw new js(Bs.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1616
1617
  /**
1617
1618
  * @license
1618
1619
  * Copyright 2020 Google LLC
@@ -1628,7 +1629,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1628
1629
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1629
1630
  * See the License for the specific language governing permissions and
1630
1631
  * limitations under the License.
1631
- */const nh=new Map;class rh{constructor(e){var t;if(void 0===e.host){if(void 0!==e.ssl)throw new Vs(Fs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=null===(t=e.ssl)||void 0===t||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,void 0===e.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Vs(Fs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.useFetchStreams=!!e.useFetchStreams,function(e,t,n,r){if(!0===t&&!0===r)throw new Vs(Fs.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)}("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling)}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}
1632
+ */const sh=new Map;class ih{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new js(Bs.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new js(Bs.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new js(Bs.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
1632
1633
  /**
1633
1634
  * @license
1634
1635
  * Copyright 2020 Google LLC
@@ -1644,7 +1645,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1644
1645
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1645
1646
  * See the License for the specific language governing permissions and
1646
1647
  * limitations under the License.
1647
- */class sh{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new rh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Vs(Fs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Vs(Fs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new rh(e),void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Bs;switch(e.type){case"gapi":const t=e.client;return new Hs(t,e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Vs(Fs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=nh.get(e);t&&(Rs("ComponentProvider","Removing Datastore"),nh.delete(e),t.terminate())}(this),Promise.resolve()}}function ih(e,t,r,s={}){var i;const o=(e=th(e,sh))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==t&&Ls("Host has been set in both settings() and useEmulator(), emulator host will be used"),e._setSettings(Object.assign(Object.assign({},o),{host:`${t}:${r}`,ssl:!1})),s.mockUserToken){let t,r;if("string"==typeof s.mockUserToken)t=s.mockUserToken,r=As.MOCK_USER;else{t=function(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.');const r=t||"demo-project",s=e.iat||0,i=e.sub||e.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[n(JSON.stringify({alg:"none",type:"JWT"})),n(JSON.stringify(o)),""].join(".")}
1648
+ */class oh{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new ih({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new js(Bs.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new js(Bs.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new ih(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Ks;switch(t.type){case"gapi":const e=t.client;return new Gs(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new js(Bs.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=sh.get(t);e&&(Ls("ComponentProvider","Removing Datastore"),sh.delete(t),e.terminate())}(this),Promise.resolve()}}function ah(t,e,n,r={}){var i;const o=(t=rh(t,oh))._getSettings();if("firestore.googleapis.com"!==o.host&&o.host!==e&&Ms("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},o),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Ns.MOCK_USER;else{e=function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=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:{}}},t);return[s(JSON.stringify({alg:"none",type:"JWT"})),s(JSON.stringify(o)),""].join(".")}
1648
1649
  /**
1649
1650
  * @license
1650
1651
  * Copyright 2017 Google LLC
@@ -1660,7 +1661,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1660
1661
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1661
1662
  * See the License for the specific language governing permissions and
1662
1663
  * limitations under the License.
1663
- */(s.mockUserToken,null===(i=e._app)||void 0===i?void 0:i.options.projectId);const o=s.mockUserToken.sub||s.mockUserToken.user_id;if(!o)throw new Vs(Fs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");r=new As(o)}e._authCredentials=new zs(new js(t,r))}}
1664
+ */(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new js(Bs.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Ns(o)}t._authCredentials=new Ws(new qs(e,n))}}
1664
1665
  /**
1665
1666
  * @license
1666
1667
  * Copyright 2020 Google LLC
@@ -1676,7 +1677,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1676
1677
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1677
1678
  * See the License for the specific language governing permissions and
1678
1679
  * limitations under the License.
1679
- */class oh{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new ch(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new oh(this.firestore,e,this._key)}}class ah{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new ah(this.firestore,e,this._query)}}class ch extends ah{constructor(e,t,n){super(e,t,Co(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new oh(this.firestore,null,new ii(e))}withConverter(e){return new ch(this.firestore,e,this._path)}}function uh(e,t,...n){if(e=I(e),Xu("collection","path",t),e instanceof sh){const r=ni.fromString(t,...n);return Zu(r),new ch(e,null,r)}{if(!(e instanceof oh||e instanceof ch))throw new Vs(Fs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(ni.fromString(t,...n));return Zu(r),new ch(e.firestore,null,r)}}
1680
+ */class ch{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new hh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new ch(this.firestore,t,this._key)}}class uh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new uh(this.firestore,t,this._query)}}class hh extends uh{constructor(t,e,n){super(t,e,ko(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new ch(this.firestore,null,new ai(t))}withConverter(t){return new hh(this.firestore,t,this._path)}}function lh(t,e,...n){if(t=I(t),Zu("collection","path",e),t instanceof oh){const r=si.fromString(e,...n);return eh(r),new hh(t,null,r)}{if(!(t instanceof ch||t instanceof hh))throw new js(Bs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(si.fromString(e,...n));return eh(r),new hh(t.firestore,null,r)}}function dh(t,e,...n){if(t=I(t),1===arguments.length&&(e=Xs.R()),Zu("doc","path",e),t instanceof oh){const r=si.fromString(e,...n);return th(r),new ch(t,null,new ai(r))}{if(!(t instanceof ch||t instanceof hh))throw new js(Bs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(si.fromString(e,...n));return th(r),new ch(t.firestore,t instanceof hh?t.converter:null,new ai(r))}}
1680
1681
  /**
1681
1682
  * @license
1682
1683
  * Copyright 2020 Google LLC
@@ -1708,8 +1709,7 @@ class va{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.inn
1708
1709
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1709
1710
  * See the License for the specific language governing permissions and
1710
1711
  * limitations under the License.
1711
- */
1712
- class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Rc(this.observer.next,e)}error(e){this.observer.error?this.Rc(this.observer.error,e):Os("Uncaught Error in snapshot listener:",e.toString())}bc(){this.muted=!0}Rc(e,t){this.muted||setTimeout((()=>{this.muted||e(t)}),0)}}
1712
+ */class fh{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):Ps("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1713
1713
  /**
1714
1714
  * @license
1715
1715
  * Copyright 2017 Google LLC
@@ -1725,7 +1725,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1725
1725
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1726
1726
  * See the License for the specific language governing permissions and
1727
1727
  * limitations under the License.
1728
- */class lh{constructor(e,t,n,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=As.UNAUTHENTICATED,this.clientId=Ys.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async e=>{Rs("FirestoreClient","Received user=",e.uid),await this.authCredentialListener(e),this.user=e})),this.appCheckCredentials.start(n,(e=>(Rs("FirestoreClient","Received new app check token=",e),this.appCheckCredentialListener(e,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Vs(Fs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new qs;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=vu(t,"Failed to shutdown persistence");e.reject(n)}})),e.promise}}async function dh(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){return e.offlineComponents||(Rs("FirestoreClient","Using default OfflineComponentProvider"),await async function(e,t){e.asyncQueue.verifyOperationInProgress(),Rs("FirestoreClient","Initializing OfflineComponentProvider");const n=await e.getConfiguration();await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener((async e=>{r.isEqual(e)||(await Mc(t.localStore,e),r=e)})),t.persistence.setDatabaseDeletedListener((()=>e.terminate())),e.offlineComponents=t}(e,new Qu)),e.offlineComponents}(e);Rs("FirestoreClient","Initializing OnlineComponentProvider");const r=await e.getConfiguration();await t.initialize(n,r),e.setCredentialChangeListener((e=>gu(t.remoteStore,e))),e.setAppCheckTokenChangeListener(((e,n)=>gu(t.remoteStore,n))),e.onlineComponents=t}async function fh(e){const t=await async function(e){return e.onlineComponents||(Rs("FirestoreClient","Using default OnlineComponentProvider"),await dh(e,new Yu)),e.onlineComponents}(e),n=t.eventManager;return n.onListen=xu.bind(null,t.syncEngine),n.onUnlisten=Uu.bind(null,t.syncEngine),n}class ph{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new Qc(this,"async_queue_retry"),this.Wc=()=>{const e=Gc();e&&Rs("AsyncQueue","Visibility state changed to "+e.visibilityState),this.xo.Po()};const e=Gc();e&&"function"==typeof e.addEventListener&&e.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.zc(),this.Hc(e)}enterRestrictedMode(e){if(!this.qc){this.qc=!0,this.Qc=e||!1;const t=Gc();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.Wc)}}enqueue(e){if(this.zc(),this.qc)return new Promise((()=>{}));const t=new qs;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise))).then((()=>t.promise))}enqueueRetryable(e){this.enqueueAndForget((()=>(this.Lc.push(e),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(e){if(!di(e))throw e;Rs("AsyncQueue","Operation failed with retryable error: "+e)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(e){const t=this.Bc.then((()=>(this.Gc=!0,e().catch((e=>{this.Kc=e,this.Gc=!1;const t=function(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}
1728
+ */class ph{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Ns.UNAUTHENTICATED,this.clientId=Xs.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ls("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ls("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new js(Bs.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new Hs;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=_u(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function gh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Ls("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Ls("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Uc(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Yu)),t.offlineComponents}(t);Ls("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>yu(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>yu(e.remoteStore,n))),t.onlineComponents=e}async function mh(t){const e=await async function(t){return t.onlineComponents||(Ls("FirestoreClient","Using default OnlineComponentProvider"),await gh(t,new Xu)),t.onlineComponents}(t),n=e.eventManager;return n.onListen=Fu.bind(null,e.syncEngine),n.onUnlisten=Vu.bind(null,e.syncEngine),n}class yh{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new Yc(this,"async_queue_retry"),this.Wc=()=>{const t=Qc();t&&Ls("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=Qc();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=Qc();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new Hs;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!pi(t))throw t;Ls("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
1729
1729
  /**
1730
1730
  * @license
1731
1731
  * Copyright 2017 Google LLC
@@ -1741,7 +1741,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1741
1741
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1742
1742
  * See the License for the specific language governing permissions and
1743
1743
  * limitations under the License.
1744
- */(e);throw Os("INTERNAL UNHANDLED ERROR: ",t),e})).then((e=>(this.Gc=!1,e))))));return this.Bc=t,t}enqueueAfterDelay(e,t,n){this.zc(),this.jc.indexOf(e)>-1&&(t=0);const r=yu.createAndSchedule(this,e,t,n,(e=>this.Yc(e)));return this.Uc.push(r),r}zc(){this.Kc&&Ms()}verifyOperationInProgress(){}async Xc(){let e;do{e=this.Bc,await e}while(e!==this.Bc)}Zc(e){for(const t of this.Uc)if(t.timerId===e)return!0;return!1}ta(e){return this.Xc().then((()=>{this.Uc.sort(((e,t)=>e.targetTimeMs-t.targetTimeMs));for(const t of this.Uc)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Xc()}))}ea(e){this.jc.push(e)}Yc(e){const t=this.Uc.indexOf(e);this.Uc.splice(t,1)}}function gh(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const e of["next","error","complete"])if(e in n&&"function"==typeof n[e])return!0;return!1}
1744
+ */(t);throw Ps("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=wu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Us()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function vh(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
1745
1745
  /**
1746
1746
  * @license
1747
1747
  * Copyright 2020 Google LLC
@@ -1757,7 +1757,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1757
1757
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1758
1758
  * See the License for the specific language governing permissions and
1759
1759
  * limitations under the License.
1760
- */(e)}class mh extends sh{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new ph,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||wh(this),this._firestoreClient.terminate()}}function yh(e,t){const n="string"==typeof e?e:t||"(default)",r=re("object"==typeof e?e:ce(),"firestore").getImmediate({identifier:n});if(!r._initialized){const e=(e=>{const t=a(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]})("firestore");e&&ih(r,...e)}return r}function vh(e){return e._firestoreClient||wh(e),e._firestoreClient.verifyNotTerminated(),e._firestoreClient}function wh(e){var t;const n=e._freezeSettings(),r=function(e,t,n,r){return new pi(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1760
+ */(t)}class wh extends oh{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new yh,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Ih(this),this._firestoreClient.terminate()}}function _h(t,e){const n="string"==typeof t?t:e||"(default)",r=it("object"==typeof t?t:ht(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=(t=>{const e=u(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]})("firestore");t&&ah(r,...t)}return r}function Th(t){return t._firestoreClient||Ih(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Ih(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new mi(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1761
1761
  /**
1762
1762
  * @license
1763
1763
  * Copyright 2020 Google LLC
@@ -1773,7 +1773,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1773
1773
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1774
1774
  * See the License for the specific language governing permissions and
1775
1775
  * limitations under the License.
1776
- */(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,n);e._firestoreClient=new lh(e._authCredentials,e._appCheckCredentials,e._queue,r)}
1776
+ */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new ph(t._authCredentials,t._appCheckCredentials,t._queue,r)}
1777
1777
  /**
1778
1778
  * @license
1779
1779
  * Copyright 2020 Google LLC
@@ -1805,7 +1805,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1805
1805
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1806
1806
  * See the License for the specific language governing permissions and
1807
1807
  * limitations under the License.
1808
- */class Ih{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Ih(bi.fromBase64String(e))}catch(e){throw new Vs(Fs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new Ih(bi.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}
1808
+ */class Eh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Eh(Ei.fromBase64String(t))}catch(t){throw new js(Bs.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Eh(Ei.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
1809
1809
  /**
1810
1810
  * @license
1811
1811
  * Copyright 2020 Google LLC
@@ -1821,7 +1821,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1821
1821
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1822
1822
  * See the License for the specific language governing permissions and
1823
1823
  * limitations under the License.
1824
- */class bh{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new Vs(Fs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new si(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function Th(){return new bh("__name__")}
1824
+ */class Sh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new js(Bs.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new oi(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1825
1825
  /**
1826
1826
  * @license
1827
1827
  * Copyright 2020 Google LLC
@@ -1837,7 +1837,8 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1837
1837
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1838
1838
  * See the License for the specific language governing permissions and
1839
1839
  * limitations under the License.
1840
- */class Eh{constructor(e){this._methodName=e}}
1840
+ */
1841
+ class bh{constructor(t){this._methodName=t}}
1841
1842
  /**
1842
1843
  * @license
1843
1844
  * Copyright 2017 Google LLC
@@ -1853,7 +1854,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1853
1854
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1854
1855
  * See the License for the specific language governing permissions and
1855
1856
  * limitations under the License.
1856
- */class _h{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new Vs(Fs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new Vs(Fs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return Xs(this._lat,e._lat)||Xs(this._long,e._long)}}
1857
+ */class Ah{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new js(Bs.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new js(Bs.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Zs(this._lat,t._lat)||Zs(this._long,t._long)}}
1857
1858
  /**
1858
1859
  * @license
1859
1860
  * Copyright 2017 Google LLC
@@ -1869,7 +1870,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1869
1870
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1870
1871
  * See the License for the specific language governing permissions and
1871
1872
  * limitations under the License.
1872
- */const Sh=/^__.*__$/;function Ch(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ms()}}class Ah{constructor(e,t,n,r,s,i){this.settings=e,this.databaseId=t,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(e){return new Ah(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.ia({path:n,oa:!1});return r.ua(e),r}ca(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.ia({path:n,oa:!1});return r.na(),r}aa(e){return this.ia({path:void 0,oa:!0})}ha(e){return Oh(e,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(e){return void 0!==this.fieldMask.find((t=>e.isPrefixOf(t)))||void 0!==this.fieldTransforms.find((t=>e.isPrefixOf(t.field)))}na(){if(this.path)for(let e=0;e<this.path.length;e++)this.ua(this.path.get(e))}ua(e){if(0===e.length)throw this.ha("Document fields must not be empty");if(Ch(this.sa)&&Sh.test(e))throw this.ha('Document fields cannot begin and end with "__"')}}class kh{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.yt=n||Wc(e)}da(e,t,n,r=!1){return new Ah({sa:e,methodName:t,fa:n,path:si.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Nh(e,t){if(Dh(e=I(e)))return function(e,t,n){if(!Dh(n)||!function(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}(n)){const r=eh(n);throw"an object"===r?t.ha(e+" a custom object"):t.ha(e+" "+r)}}("Unsupported field value:",t,e),function(e,t){const n={};return vi(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):yi(e,((e,r)=>{const s=Nh(r,t.ra(e));null!=s&&(n[e]=s)})),{mapValue:{fields:n}}}(e,t);if(e instanceof Eh)return function(e,t){if(!Ch(t.sa))throw t.ha(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.ha(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.oa&&4!==t.sa)throw t.ha("Nested arrays are not supported");return function(e,t){const n=[];let r=0;for(const s of e){let e=Nh(s,t.aa(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=I(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return zo(t.yt,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=Zs.fromDate(e);return{timestampValue:$a(t.yt,n)}}if(e instanceof Zs){const n=new Zs(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:$a(t.yt,n)}}if(e instanceof _h)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof Ih)return{bytesValue:Ka(t.yt,e._byteString)};if(e instanceof oh){const n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ga(e.firestore._databaseId||t.databaseId,e._key.path)}}throw t.ha(`Unsupported field value: ${eh(e)}`)}(e,t)}function Dh(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof Zs||e instanceof _h||e instanceof Ih||e instanceof oh||e instanceof Eh)}const Rh=new RegExp("[~\\*/\\[\\]]");function Oh(e,t,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Vs(Fs.INVALID_ARGUMENT,a+e+c)
1873
+ */const Ch=/^__.*__$/;function kh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Us()}}class Nh{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Nh(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return Ph(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(kh(this.sa)&&Ch.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Rh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||Jc(t)}da(t,e,n,r=!1){return new Nh({sa:t,methodName:e,fa:n,path:oi.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function Dh(t,e){if(Oh(t=I(t)))return function(t,e,n){if(!Oh(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=nh(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}("Unsupported field value:",e,t),function(t,e){const n={};return _i(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):wi(t,((t,r)=>{const s=Dh(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}(t,e);if(t instanceof bh)return function(t,e){if(!kh(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=Dh(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=I(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Wo(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=ei.fromDate(t);return{timestampValue:za(e.yt,n)}}if(t instanceof ei){const n=new ei(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:za(e.yt,n)}}if(t instanceof Ah)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Eh)return{bytesValue:$a(e.yt,t._byteString)};if(t instanceof ch){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Qa(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${nh(t)}`)}(t,e)}function Oh(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof ei||t instanceof Ah||t instanceof Eh||t instanceof ch||t instanceof bh)}const Lh=new RegExp("[~\\*/\\[\\]]");function Ph(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new js(Bs.INVALID_ARGUMENT,a+t+c)
1873
1874
  /**
1874
1875
  * @license
1875
1876
  * Copyright 2020 Google LLC
@@ -1885,7 +1886,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1885
1886
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1886
1887
  * See the License for the specific language governing permissions and
1887
1888
  * limitations under the License.
1888
- */}class Lh{constructor(e,t,n,r,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new oh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Ph(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const t=this._document.data.field(Mh("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Ph extends Lh{data(){return super.data()}}function Mh(e,t){return"string"==typeof t?function(e,t,n){if(t.search(Rh)>=0)throw Oh(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new bh(...t.split("."))._internalPath}catch(r){throw Oh(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}(e,t):t instanceof bh?t._internalPath:t._delegate._internalPath}
1889
+ */}class Mh{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new ch(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new xh(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(Uh("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class xh extends Mh{data(){return super.data()}}function Uh(t,e){return"string"==typeof e?function(t,e,n){if(e.search(Lh)>=0)throw Ph(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Sh(...e.split("."))._internalPath}catch(r){throw Ph(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}(t,e):e instanceof Sh?e._internalPath:e._delegate._internalPath}
1889
1890
  /**
1890
1891
  * @license
1891
1892
  * Copyright 2020 Google LLC
@@ -1901,7 +1902,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1901
1902
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1902
1903
  * See the License for the specific language governing permissions and
1903
1904
  * limitations under the License.
1904
- */function xh(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new Vs(Fs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Uh{}class Fh extends Uh{}function Vh(e,t,...n){let r=[];t instanceof Uh&&r.push(t),r=r.concat(n),function(e){const t=e.filter((e=>e instanceof Bh)).length,n=e.filter((e=>e instanceof qh)).length;if(t>1||t>0&&n>0)throw new Vs(Fs.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
1905
+ */function Fh(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new js(Bs.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Vh{}class Bh extends Vh{}function jh(t,e,...n){let r=[];e instanceof Vh&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Kh)).length,n=t.filter((t=>t instanceof Hh)).length;if(e>1||e>0&&n>0)throw new js(Bs.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
1905
1906
  /**
1906
1907
  * @license
1907
1908
  * Copyright 2020 Google LLC
@@ -1917,7 +1918,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1917
1918
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1918
1919
  * See the License for the specific language governing permissions and
1919
1920
  * limitations under the License.
1920
- */(r);for(const t of r)e=t._apply(e);return e}class qh extends Fh{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new qh(e,t,n)}_apply(e){const t=this._parse(e);return Kh(e._query,t),new ah(e.firestore,e.converter,Lo(e._query,t))}_parse(e){const t=function(e){const t=e._freezeSettings(),n=Wc(e._databaseId);return new kh(e._databaseId,!!t.ignoreUndefinedProperties,n)}(e.firestore),n=function(e,t,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){$h(o,i);const t=[];for(const n of o)t.push(zh(r,e,n));a={arrayValue:{values:t}}}else a=zh(r,e,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||$h(o,i),a=function(e,t,n,r=!1){return Nh(n,e.da(r?4:3,t))}(n,"where",o,"in"===i||"not-in"===i);return Wi.create(s,i,a)}(e._query,0,t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function jh(e,t,n){const r=t,s=Mh("where",e);return qh._create(s,r,n)}class Bh extends Uh{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Bh(e,t)}_parse(e){const t=this._queryConstraints.map((t=>t._parse(e))).filter((e=>e.getFilters().length>0));return 1===t.length?t[0]:Qi.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const r=t.getFlattenedFilters();for(const e of r)Kh(n,e),n=Lo(n,e)}(e._query,t),new ah(e.firestore,e.converter,Lo(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function zh(e,t,n){if("string"==typeof(n=I(n))){if(""===n)throw new Vs(Fs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Do(t)&&-1!==n.indexOf("/"))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=t.path.child(ni.fromString(n));if(!ii.isDocumentKey(r))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Ui(e,new ii(r))}if(n instanceof oh)return Ui(e,n._key);throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${eh(n)}.`)}function $h(e,t){if(!Array.isArray(e)||0===e.length)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`);if(e.length>10)throw new Vs(Fs.INVALID_ARGUMENT,`Invalid Query. '${t.toString()}' filters support a maximum of 10 elements in the value array.`)}function Kh(e,t){if(t.isInequality()){const n=No(e),r=t.field;if(null!==n&&!n.isEqual(r))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=ko(e);null!==s&&function(e,t,n){if(!n.isEqual(t))throw new Vs(Fs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${t.toString()}' and so you must also use '${t.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Vs(Fs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Vs(Fs.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class Hh{convertValue(e,t="none"){switch(Di(e)){case 0:return null;case 1:return e.booleanValue;case 2:return _i(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(Si(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 10:return this.convertObject(e.mapValue,t);default:throw Ms()}}convertObject(e,t){const n={};return yi(e.fields,((e,r)=>{n[e]=this.convertValue(r,t)})),n}convertGeoPoint(e){return new _h(_i(e.latitude),_i(e.longitude))}convertArray(e,t){return(e.values||[]).map((e=>this.convertValue(e,t)))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Ai(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(ki(e));default:return null}}convertTimestamp(e){const t=Ei(e);return new Zs(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=ni.fromString(e);xs(uc(n));const r=new gi(n.get(1),n.get(3)),s=new ii(n.popFirst(5));return r.isEqual(t)||Os(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}}
1921
+ */(r);for(const e of r)t=e._apply(t);return t}class Hh extends Bh{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Hh(t,e,n)}_apply(t){const e=this._parse(t);return $h(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e))}_parse(t){const e=function(t){const e=t._freezeSettings(),n=Jc(t._databaseId);return new Rh(t._databaseId,!!e.ignoreUndefinedProperties,n)}(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new js(Bs.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){zh(o,i);const e=[];for(const n of o)e.push(Wh(r,t,n));a={arrayValue:{values:e}}}else a=Wh(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||zh(o,i),a=function(t,e,n,r=!1){return Dh(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Ji.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function qh(t,e,n){const r=e,s=Uh("where",t);return Hh._create(s,r,n)}class Kh extends Vh{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Kh(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Yi.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)$h(n,t),n=Mo(n,t)}(t._query,e),new uh(t.firestore,t.converter,Mo(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Wh(t,e,n){if("string"==typeof(n=I(n))){if(""===n)throw new js(Bs.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Oo(e)&&-1!==n.indexOf("/"))throw new js(Bs.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(si.fromString(n));if(!ai.isDocumentKey(r))throw new js(Bs.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Vi(t,new ai(r))}if(n instanceof ch)return Vi(t,n._key);throw new js(Bs.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${nh(n)}.`)}function zh(t,e){if(!Array.isArray(t)||0===t.length)throw new js(Bs.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new js(Bs.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function $h(t,e){if(e.isInequality()){const n=Do(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new js(Bs.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Ro(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new js(Bs.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new js(Bs.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new js(Bs.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Gh{convertValue(t,e="none"){switch(Oi(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Ai(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(Ci(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Us()}}convertObject(t,e){const n={};return wi(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Ah(Ai(t.latitude),Ai(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Ni(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ri(t));default:return null}}convertTimestamp(t){const e=bi(t);return new ei(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=si.fromString(t);Fs(lc(n));const r=new yi(n.get(1),n.get(3)),s=new ai(n.popFirst(5));return r.isEqual(e)||Ps(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
1921
1922
  /**
1922
1923
  * @license
1923
1924
  * Copyright 2020 Google LLC
@@ -1933,7 +1934,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1933
1934
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1934
1935
  * See the License for the specific language governing permissions and
1935
1936
  * limitations under the License.
1936
- */class Gh{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Wh extends Lh{constructor(e,t,n,r,s,i){super(e,t,n,r,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Qh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(Mh("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}}class Qh extends Wh{data(e={}){return super.data(e)}}class Yh{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new Gh(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const e=[];return this.forEach((t=>e.push(t))),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach((n=>{e.call(t,new Qh(this._firestore,this._userDataWriter,n.key,n,new Gh(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Vs(Fs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map((n=>{const r=new Qh(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Gh(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}}))}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter((e=>t||3!==e.type)).map((t=>{const r=new Qh(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Gh(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let s=-1,i=-1;return 0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),i=n.indexOf(t.doc.key)),{type:Xh(t.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function Xh(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ms()}}
1937
+ */class Qh{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Jh extends Mh{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Yh(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(Uh("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Yh extends Jh{data(t={}){return super.data(t)}}class Xh{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Qh(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Yh(this._firestore,this._userDataWriter,n.key,n,new Qh(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new js(Bs.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Yh(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Qh(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Yh(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Qh(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Zh(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Zh(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Us()}}
1937
1938
  /**
1938
1939
  * @license
1939
1940
  * Copyright 2020 Google LLC
@@ -1949,7 +1950,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1949
1950
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1950
1951
  * See the License for the specific language governing permissions and
1951
1952
  * limitations under the License.
1952
- */function Jh(e){e=th(e,oh);const t=th(e.firestore,mh);return function(e,t,n={}){const r=new qs;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,s){const i=new hh({next:i=>{t.enqueueAndForget((()=>Su(e,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Vs(Fs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Vs(Fs.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(i)},error:e=>s.reject(e)}),o=new Nu(Co(n.path),i,{includeMetadataChanges:!0,Nu:!0});return _u(e,o)}(await fh(e),e.asyncQueue,t,n,r))),r.promise}(vh(t),e._key).then((n=>nl(t,e,n)))}class Zh extends Hh{constructor(e){super(),this.firestore=e}convertBytes(e){return new Ih(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new oh(this.firestore,null,t)}}function el(e){e=th(e,ah);const t=th(e.firestore,mh),n=vh(t),r=new Zh(t);return xh(e._query),function(e,t,n={}){const r=new qs;return e.asyncQueue.enqueueAndForget((async()=>function(e,t,n,r,s){const i=new hh({next:n=>{t.enqueueAndForget((()=>Su(e,o))),n.fromCache&&"server"===r.source?s.reject(new Vs(Fs.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:e=>s.reject(e)}),o=new Nu(n,i,{includeMetadataChanges:!0,Nu:!0});return _u(e,o)}(await fh(e),e.asyncQueue,t,n,r))),r.promise}(n,e._query).then((n=>new Yh(t,r,e,n)))}function tl(e,...t){var n,r,s;e=I(e);let i={includeMetadataChanges:!1},o=0;"object"!=typeof t[o]||gh(t[o])||(i=t[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(gh(t[o])){const e=t[o];t[o]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[o+1]=null===(r=e.error)||void 0===r?void 0:r.bind(e),t[o+2]=null===(s=e.complete)||void 0===s?void 0:s.bind(e)}let c,u,h;if(e instanceof oh)u=th(e.firestore,mh),h=Co(e._key.path),c={next:n=>{t[o]&&t[o](nl(u,e,n))},error:t[o+1],complete:t[o+2]};else{const n=th(e,ah);u=th(n.firestore,mh),h=n._query;const r=new Zh(u);c={next:e=>{t[o]&&t[o](new Yh(u,r,n,e))},error:t[o+1],complete:t[o+2]},xh(e._query)}return function(e,t,n,r){const s=new hh(r),i=new Nu(t,s,n);return e.asyncQueue.enqueueAndForget((async()=>_u(await fh(e),i))),()=>{s.bc(),e.asyncQueue.enqueueAndForget((async()=>Su(await fh(e),i)))}}(vh(u),h,a,c)}function nl(e,t,n){const r=n.docs.get(t._key),s=new Zh(e);return new Wh(e,s,t._key,r,new Gh(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){ks=oe,ne(new b("firestore",((e,{instanceIdentifier:n,options:r})=>{const s=e.getProvider("app").getImmediate(),i=new mh(new $s(e.getProvider("auth-internal")),new Ws(e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Vs(Fs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new gi(e.options.projectId,t)}(s,n),s);return r=Object.assign({useFetchStreams:t},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),ue(Cs,"3.8.0",e),ue(Cs,"3.8.0","esm2017")}();
1953
+ */function tl(t){t=rh(t,ch);const e=rh(t.firestore,wh);return function(t,e,n={}){const r=new Hs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new fh({next:i=>{e.enqueueAndForget((()=>Cu(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new js(Bs.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new js(Bs.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Du(ko(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,r))),r.promise}(Th(e),t._key).then((n=>sl(e,t,n)))}class el extends Gh{constructor(t){super(),this.firestore=t}convertBytes(t){return new Eh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new ch(this.firestore,null,e)}}function nl(t){t=rh(t,uh);const e=rh(t.firestore,wh),n=Th(e),r=new el(e);return Fh(t._query),function(t,e,n={}){const r=new Hs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new fh({next:n=>{e.enqueueAndForget((()=>Cu(t,o))),n.fromCache&&"server"===r.source?s.reject(new js(Bs.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Du(n,i,{includeMetadataChanges:!0,Nu:!0});return Au(t,o)}(await mh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Xh(e,r,t,n)))}function rl(t,...e){var n,r,s;t=I(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||vh(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if(vh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof ch)u=rh(t.firestore,wh),h=ko(t._key.path),c={next:n=>{e[o]&&e[o](sl(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=rh(t,uh);u=rh(n.firestore,wh),h=n._query;const r=new el(u);c={next:t=>{e[o]&&e[o](new Xh(u,r,n,t))},error:e[o+1],complete:e[o+2]},Fh(t._query)}return function(t,e,n,r){const s=new fh(r),i=new Du(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Au(await mh(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Cu(await mh(t),i)))}}(Th(u),h,a,c)}function sl(t,e,n){const r=n.docs.get(e._key),s=new el(t);return new Jh(t,s,e._key,r,new Qh(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Rs=ct,st(new E("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new wh(new zs(t.getProvider("auth-internal")),new Js(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new js(Bs.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new yi(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),lt(ks,"3.8.0",t),lt(ks,"3.8.0","esm2017")}();
1953
1954
  /**
1954
1955
  * @license
1955
1956
  * Copyright 2020 Google LLC
@@ -1966,7 +1967,7 @@ class hh{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next
1966
1967
  * See the License for the specific language governing permissions and
1967
1968
  * limitations under the License.
1968
1969
  */
1969
- ue("firebase","9.15.0","app");class rl{constructor(){}static getInstance(){return rl.instance||(rl.instance=new rl),rl.instance}setEnv(e){switch(e){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?il.firebase:sl.firebase}get api(){return"prod"===this.env?il.api:sl.api}get config(){return"prod"===this.env?il.config:sl.config}}const sl={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},il={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};function ol(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}function al(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const cl=al,ul=new l("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),hl="auth/user-disabled",ll=new D("@firebase/auth");function dl(e,...t){ll.logLevel<=S.ERROR&&ll.error(`Auth (${oe}): ${e}`,...t)}
1970
+ lt("firebase","9.15.0","app");class il{constructor(){}static getInstance(){return il.instance||(il.instance=new il),il.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?al.firebase:ol.firebase}get api(){return"prod"===this.env?al.api:ol.api}get config(){return"prod"===this.env?al.config:ol.config}}const ol={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},al={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};function cl(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n}function ul(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const hl=ul,ll=new f("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),dl="auth/user-disabled",fl=new O("@firebase/auth");function pl(t,...e){fl.logLevel<=C.ERROR&&fl.error(`Auth (${ct}): ${t}`,...e)}
1970
1971
  /**
1971
1972
  * @license
1972
1973
  * Copyright 2020 Google LLC
@@ -1982,7 +1983,7 @@ ue("firebase","9.15.0","app");class rl{constructor(){}static getInstance(){retur
1982
1983
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1983
1984
  * See the License for the specific language governing permissions and
1984
1985
  * limitations under the License.
1985
- */function fl(e,...t){throw gl(e,...t)}function pl(e,...t){return gl(e,...t)}function gl(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return ul.create(e,...t)}function ml(e,t,...n){if(!e)throw gl(t,...n)}function yl(e){const t="INTERNAL ASSERTION FAILED: "+e;throw dl(t),new Error(t)}function vl(e,t){e||yl(t)}
1986
+ */function gl(t,...e){throw yl(t,...e)}function ml(t,...e){return yl(t,...e)}function yl(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return ll.create(t,...e)}function vl(t,e,...n){if(!t)throw yl(e,...n)}function wl(t){const e="INTERNAL ASSERTION FAILED: "+t;throw pl(e),new Error(e)}function _l(t,e){t||wl(e)}
1986
1987
  /**
1987
1988
  * @license
1988
1989
  * Copyright 2020 Google LLC
@@ -1998,7 +1999,7 @@ ue("firebase","9.15.0","app");class rl{constructor(){}static getInstance(){retur
1998
1999
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1999
2000
  * See the License for the specific language governing permissions and
2000
2001
  * limitations under the License.
2001
- */const wl=new Map;function Il(e){vl(e instanceof Function,"Expected a class definition");let t=wl.get(e);return t?(vl(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,wl.set(e,t),t)}
2002
+ */const Tl=new Map;function Il(t){_l(t instanceof Function,"Expected a class definition");let e=Tl.get(t);return e?(_l(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Tl.set(t,e),e)}
2002
2003
  /**
2003
2004
  * @license
2004
2005
  * Copyright 2020 Google LLC
@@ -2031,7 +2032,7 @@ ue("firebase","9.15.0","app");class rl{constructor(){}static getInstance(){retur
2031
2032
  * See the License for the specific language governing permissions and
2032
2033
  * limitations under the License.
2033
2034
  */
2034
- function bl(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Tl(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}
2035
+ function El(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Sl(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2035
2036
  /**
2036
2037
  * @license
2037
2038
  * Copyright 2020 Google LLC
@@ -2047,7 +2048,7 @@ function bl(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||v
2047
2048
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2048
2049
  * See the License for the specific language governing permissions and
2049
2050
  * limitations under the License.
2050
- */function El(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Tl()&&"https:"!==Tl()&&!function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()&&!("connection"in navigator)||navigator.onLine}
2051
+ */function bl(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Sl()&&"https:"!==Sl()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2051
2052
  /**
2052
2053
  * @license
2053
2054
  * Copyright 2020 Google LLC
@@ -2064,7 +2065,7 @@ function bl(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||v
2064
2065
  * See the License for the specific language governing permissions and
2065
2066
  * limitations under the License.
2066
2067
  */
2067
- class _l{constructor(e,t){this.shortDelay=e,this.longDelay=t,vl(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(s())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return El()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2068
+ class Al{constructor(t,e){this.shortDelay=t,this.longDelay=e,_l(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(o())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return bl()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2068
2069
  /**
2069
2070
  * @license
2070
2071
  * Copyright 2020 Google LLC
@@ -2080,7 +2081,7 @@ class _l{constructor(e,t){this.shortDelay=e,this.longDelay=t,vl(t>e,"Short delay
2080
2081
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2081
2082
  * See the License for the specific language governing permissions and
2082
2083
  * limitations under the License.
2083
- */function Sl(e,t){vl(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}
2084
+ */function Cl(t,e){_l(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2084
2085
  /**
2085
2086
  * @license
2086
2087
  * Copyright 2020 Google LLC
@@ -2096,7 +2097,7 @@ class _l{constructor(e,t){this.shortDelay=e,this.longDelay=t,vl(t>e,"Short delay
2096
2097
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2097
2098
  * See the License for the specific language governing permissions and
2098
2099
  * limitations under the License.
2099
- */class Cl{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void yl("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void yl("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void yl("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2100
+ */class kl{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void wl("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void wl("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void wl("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2100
2101
  /**
2101
2102
  * @license
2102
2103
  * Copyright 2020 Google LLC
@@ -2112,7 +2113,7 @@ class _l{constructor(e,t){this.shortDelay=e,this.longDelay=t,vl(t>e,"Short delay
2112
2113
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2113
2114
  * See the License for the specific language governing permissions and
2114
2115
  * limitations under the License.
2115
- */const Al={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},kl=new _l(3e4,6e4);
2116
+ */const Nl={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},Rl=new Al(3e4,6e4);
2116
2117
  /**
2117
2118
  * @license
2118
2119
  * Copyright 2020 Google LLC
@@ -2128,7 +2129,7 @@ class _l{constructor(e,t){this.shortDelay=e,this.longDelay=t,vl(t>e,"Short delay
2128
2129
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2129
2130
  * See the License for the specific language governing permissions and
2130
2131
  * limitations under the License.
2131
- */function Nl(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Dl(e,t,n,r,s={}){return Rl(e,s,(async()=>{let s={},i={};r&&("GET"===t?i=r:s={body:JSON.stringify(r)});const o=g(Object.assign({key:e.config.apiKey},i)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),Cl.fetch()(Ll(e,e.config.apiHost,n,o),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},s))}))}async function Rl(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Al),t);try{const t=new Pl(e),s=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Ml(e,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const t=s.ok?i.errorMessage:i.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Ml(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Ml(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw Ml(e,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(e,t,n){const r=Object.assign(Object.assign({},cl()),{[t]:n});return new l("auth","Firebase",r).create(t,{appName:e.name})}(e,a,o);fl(e,a)}}catch(t){if(t instanceof h)throw t;fl(e,"network-request-failed")}}async function Ol(e,t,n,r,s={}){const i=await Dl(e,t,n,r,s);return"mfaPendingCredential"in i&&fl(e,"multi-factor-auth-required",{_serverResponse:i}),i}function Ll(e,t,n,r){const s=`${t}${n}?${r}`;return e.config.emulator?Sl(e.config,s):`${e.config.apiScheme}://${s}`}class Pl{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(pl(this.auth,"network-request-failed"))),kl.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ml(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=pl(e,t,r);return s.customData._tokenResponse=n,s}
2132
+ */function Dl(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Ol(t,e,n,r,s={}){return Ll(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=y(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),kl.fetch()(Ml(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function Ll(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Nl),e);try{const e=new xl(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Ul(t,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const e=s.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Ul(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Ul(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Ul(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const r=Object.assign(Object.assign({},hl()),{[e]:n});return new f("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);gl(t,a)}}catch(e){if(e instanceof d)throw e;gl(t,"network-request-failed")}}async function Pl(t,e,n,r,s={}){const i=await Ol(t,e,n,r,s);return"mfaPendingCredential"in i&&gl(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Ml(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Cl(t.config,s):`${t.config.apiScheme}://${s}`}class xl{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(ml(this.auth,"network-request-failed"))),Rl.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ul(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=ml(t,e,r);return s.customData._tokenResponse=n,s}
2132
2133
  /**
2133
2134
  * @license
2134
2135
  * Copyright 2020 Google LLC
@@ -2161,7 +2162,7 @@ class _l{constructor(e,t){this.shortDelay=e,this.longDelay=t,vl(t>e,"Short delay
2161
2162
  * See the License for the specific language governing permissions and
2162
2163
  * limitations under the License.
2163
2164
  */
2164
- function xl(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function Ul(e){return 1e3*Number(e)}function Fl(e){const[t,n,s]=e.split(".");if(void 0===t||void 0===n||void 0===s)return dl("JWT malformed, contained fewer than 3 sections"),null;try{const e=r(n);return e?JSON.parse(e):(dl("Failed to decode base64 JWT payload"),null)}catch(e){return dl("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}
2165
+ function Fl(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Vl(t){return 1e3*Number(t)}function Bl(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return pl("JWT malformed, contained fewer than 3 sections"),null;try{const t=i(n);return t?JSON.parse(t):(pl("Failed to decode base64 JWT payload"),null)}catch(t){return pl("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
2165
2166
  /**
2166
2167
  * @license
2167
2168
  * Copyright 2020 Google LLC
@@ -2178,7 +2179,7 @@ function xl(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))retur
2178
2179
  * See the License for the specific language governing permissions and
2179
2180
  * limitations under the License.
2180
2181
  */
2181
- async function Vl(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof h&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}
2182
+ async function jl(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof d&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2182
2183
  /**
2183
2184
  * @license
2184
2185
  * Copyright 2020 Google LLC
@@ -2194,7 +2195,7 @@ async function Vl(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t in
2194
2195
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2195
2196
  * See the License for the specific language governing permissions and
2196
2197
  * limitations under the License.
2197
- */(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class ql{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}
2198
+ */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Hl{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
2198
2199
  /**
2199
2200
  * @license
2200
2201
  * Copyright 2020 Google LLC
@@ -2210,7 +2211,7 @@ async function Vl(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t in
2210
2211
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2211
2212
  * See the License for the specific language governing permissions and
2212
2213
  * limitations under the License.
2213
- */class jl{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=xl(this.lastLoginAt),this.creationTime=xl(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2214
+ */class ql{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Fl(this.lastLoginAt),this.creationTime=Fl(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2214
2215
  /**
2215
2216
  * @license
2216
2217
  * Copyright 2019 Google LLC
@@ -2226,7 +2227,7 @@ async function Vl(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t in
2226
2227
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2227
2228
  * See the License for the specific language governing permissions and
2228
2229
  * limitations under the License.
2229
- */async function Bl(e){var t;const n=e.auth,r=await e.getIdToken(),s=await Vl(e,async function(e,t){return Dl(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:r}));ml(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];e._notifyReloadListener(i);const o=(null===(t=i.providerUserInfo)||void 0===t?void 0:t.length)?i.providerUserInfo.map((e=>{var{providerId:t}=e,n=ol(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(c=e.providerData,u=o,[...c.filter((e=>!u.some((t=>t.providerId===e.providerId)))),...u]);var c,u;const h=e.isAnonymous,l=!(e.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new jl(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(e,f)}
2230
+ */async function Kl(t){var e;const n=t.auth,r=await t.getIdToken(),s=await jl(t,async function(t,e){return Ol(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));vl(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?i.providerUserInfo.map((t=>{var{providerId:e}=t,n=cl(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new ql(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}
2230
2231
  /**
2231
2232
  * @license
2232
2233
  * Copyright 2020 Google LLC
@@ -2243,7 +2244,7 @@ async function Vl(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t in
2243
2244
  * See the License for the specific language governing permissions and
2244
2245
  * limitations under the License.
2245
2246
  */
2246
- class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){ml(e.idToken,"internal-error"),ml(void 0!==e.idToken,"internal-error"),ml(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){const t=Fl(e);return ml(t,"internal-error"),ml(void 0!==t.exp,"internal-error"),ml(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return ml(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:s}=await
2247
+ class Wl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){vl(t.idToken,"internal-error"),vl(void 0!==t.idToken,"internal-error"),vl(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=Bl(t);return vl(e,"internal-error"),vl(void 0!==e.exp,"internal-error"),vl(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return vl(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:s}=await
2247
2248
  /**
2248
2249
  * @license
2249
2250
  * Copyright 2020 Google LLC
@@ -2260,7 +2261,7 @@ class zl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2260
2261
  * See the License for the specific language governing permissions and
2261
2262
  * limitations under the License.
2262
2263
  */
2263
- async function(e,t){const n=await Rl(e,{},(async()=>{const n=g({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:s}=e.config,i=Ll(e,r,"/v1/token",`key=${s}`),o=await e._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Cl.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:s}=t,i=new zl;return n&&(ml("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(ml("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),s&&(ml("number"==typeof s,"internal-error",{appName:e}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new zl,this.toJSON())}_performRefresh(){return yl("not implemented")}}
2264
+ async function(t,e){const n=await Ll(t,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=Ml(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",kl.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new Wl;return n&&(vl("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(vl("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(vl("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Wl,this.toJSON())}_performRefresh(){return wl("not implemented")}}
2264
2265
  /**
2265
2266
  * @license
2266
2267
  * Copyright 2020 Google LLC
@@ -2276,7 +2277,7 @@ async function(e,t){const n=await Rl(e,{},(async()=>{const n=g({grant_type:"refr
2276
2277
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2277
2278
  * See the License for the specific language governing permissions and
2278
2279
  * limitations under the License.
2279
- */function $l(e,t){ml("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Kl{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,s=ol(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ql(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new jl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await Vl(this,this.stsTokenManager.getToken(this.auth,e));return ml(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=I(e),r=await n.getIdToken(t),s=Fl(r);ml(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:xl(Ul(s.auth_time)),issuedAtTime:xl(Ul(s.iat)),expirationTime:xl(Ul(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=I(e);await Bl(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(ml(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new Kl(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){ml(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await Bl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await Vl(this,async function(e,t){return Dl(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,r,s,i,o,a,c,u;const h=null!==(n=t.displayName)&&void 0!==n?n:void 0,l=null!==(r=t.email)&&void 0!==r?r:void 0,d=null!==(s=t.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=t.photoURL)&&void 0!==i?i:void 0,p=null!==(o=t.tenantId)&&void 0!==o?o:void 0,g=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(u=t.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:I,providerData:b,stsTokenManager:T}=t;ml(v&&T,e,"internal-error");const E=zl.fromJSON(this.name,T);ml("string"==typeof v,e,"internal-error"),$l(h,e.name),$l(l,e.name),ml("boolean"==typeof w,e,"internal-error"),ml("boolean"==typeof I,e,"internal-error"),$l(d,e.name),$l(f,e.name),$l(p,e.name),$l(g,e.name),$l(m,e.name),$l(y,e.name);const _=new Kl({uid:v,auth:e,email:l,emailVerified:w,displayName:h,isAnonymous:I,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return b&&Array.isArray(b)&&(_.providerData=b.map((e=>Object.assign({},e)))),g&&(_._redirectEventId=g),_}static async _fromIdTokenResponse(e,t,n=!1){const r=new zl;r.updateFromServerResponse(t);const s=new Kl({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await Bl(s),s}}
2280
+ */function zl(t,e){vl("string"==typeof t||void 0===t,"internal-error",{appName:e})}class $l{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=cl(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Hl(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new ql(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await jl(this,this.stsTokenManager.getToken(this.auth,t));return vl(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=I(t),r=await n.getIdToken(e),s=Bl(r);vl(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Fl(Vl(s.auth_time)),issuedAtTime:Fl(Vl(s.iat)),expirationTime:Fl(Vl(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=I(t);await Kl(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(vl(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){return new $l(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(t){vl(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await Kl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await jl(this,async function(t,e){return Ol(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:I}=e;vl(v&&I,t,"internal-error");const E=Wl.fromJSON(this.name,I);vl("string"==typeof v,t,"internal-error"),zl(h,t.name),zl(l,t.name),vl("boolean"==typeof w,t,"internal-error"),vl("boolean"==typeof _,t,"internal-error"),zl(d,t.name),zl(f,t.name),zl(p,t.name),zl(g,t.name),zl(m,t.name),zl(y,t.name);const S=new $l({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(S.providerData=T.map((t=>Object.assign({},t)))),g&&(S._redirectEventId=g),S}static async _fromIdTokenResponse(t,e,n=!1){const r=new Wl;r.updateFromServerResponse(e);const s=new $l({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await Kl(s),s}}
2280
2281
  /**
2281
2282
  * @license
2282
2283
  * Copyright 2019 Google LLC
@@ -2292,7 +2293,7 @@ async function(e,t){const n=await Rl(e,{},(async()=>{const n=g({grant_type:"refr
2292
2293
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2293
2294
  * See the License for the specific language governing permissions and
2294
2295
  * limitations under the License.
2295
- */class Hl{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Hl.type="NONE";const Gl=Hl;
2296
+ */class Gl{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}Gl.type="NONE";const Ql=Gl;
2296
2297
  /**
2297
2298
  * @license
2298
2299
  * Copyright 2019 Google LLC
@@ -2308,7 +2309,7 @@ async function(e,t){const n=await Rl(e,{},(async()=>{const n=g({grant_type:"refr
2308
2309
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2309
2310
  * See the License for the specific language governing permissions and
2310
2311
  * limitations under the License.
2311
- */function Wl(e,t,n){return`firebase:${e}:${t}:${n}`}class Ql{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=Wl(this.userKey,r.apiKey,s),this.fullPersistenceKey=Wl("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?Kl._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new Ql(Il(Gl),e,n);const r=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let s=r[0]||Il(Gl);const i=Wl(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(i);if(t){const r=Kl._fromJSON(e,t);n!==s&&(o=r),s=n;break}}catch(e){}const a=r.filter((e=>e._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(t.map((async e=>{if(e!==s)try{await e._remove(i)}catch(e){}}))),new Ql(s,e,n)):new Ql(s,e,n)}}
2312
+ */function Jl(t,e,n){return`firebase:${t}:${e}:${n}`}class Yl{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=Jl(this.userKey,r.apiKey,s),this.fullPersistenceKey=Jl("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?$l._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new Yl(Il(Ql),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||Il(Ql);const i=Jl(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=$l._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new Yl(s,t,n)):new Yl(s,t,n)}}
2312
2313
  /**
2313
2314
  * @license
2314
2315
  * Copyright 2020 Google LLC
@@ -2324,7 +2325,7 @@ async function(e,t){const n=await Rl(e,{},(async()=>{const n=g({grant_type:"refr
2324
2325
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2325
2326
  * See the License for the specific language governing permissions and
2326
2327
  * limitations under the License.
2327
- */function Yl(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ed(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Xl(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(nd(t))return"Blackberry";if(rd(t))return"Webos";if(Jl(t))return"Safari";if((t.includes("chrome/")||Zl(t))&&!t.includes("edge/"))return"Chrome";if(td(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function Xl(e=s()){return/firefox\//i.test(e)}function Jl(e=s()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Zl(e=s()){return/crios\//i.test(e)}function ed(e=s()){return/iemobile/i.test(e)}function td(e=s()){return/android/i.test(e)}function nd(e=s()){return/blackberry/i.test(e)}function rd(e=s()){return/webos/i.test(e)}function sd(e=s()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function id(){return function(){const e=s();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function od(e=s()){return sd(e)||td(e)||rd(e)||nd(e)||/windows phone/i.test(e)||ed(e)}
2328
+ */function Xl(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(nd(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Zl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(sd(e))return"Blackberry";if(id(e))return"Webos";if(td(e))return"Safari";if((e.includes("chrome/")||ed(e))&&!e.includes("edge/"))return"Chrome";if(rd(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function Zl(t=o()){return/firefox\//i.test(t)}function td(t=o()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ed(t=o()){return/crios\//i.test(t)}function nd(t=o()){return/iemobile/i.test(t)}function rd(t=o()){return/android/i.test(t)}function sd(t=o()){return/blackberry/i.test(t)}function id(t=o()){return/webos/i.test(t)}function od(t=o()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function ad(){return function(){const t=o();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function cd(t=o()){return od(t)||rd(t)||id(t)||sd(t)||/windows phone/i.test(t)||nd(t)}
2328
2329
  /**
2329
2330
  * @license
2330
2331
  * Copyright 2020 Google LLC
@@ -2341,7 +2342,7 @@ async function(e,t){const n=await Rl(e,{},(async()=>{const n=g({grant_type:"refr
2341
2342
  * See the License for the specific language governing permissions and
2342
2343
  * limitations under the License.
2343
2344
  */
2344
- function ad(e,t=[]){let n;switch(e){case"Browser":n=Yl(s());break;case"Worker":n=`${Yl(s())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${oe}/${r}`}
2345
+ function ud(t,e=[]){let n;switch(t){case"Browser":n=Xl(o());break;case"Worker":n=`${Xl(o())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${ct}/${r}`}
2345
2346
  /**
2346
2347
  * @license
2347
2348
  * Copyright 2022 Google LLC
@@ -2357,7 +2358,7 @@ function ad(e,t=[]){let n;switch(e){case"Browser":n=Yl(s());break;case"Worker":n
2357
2358
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2358
2359
  * See the License for the specific language governing permissions and
2359
2360
  * limitations under the License.
2360
- */class cd{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,r)=>{try{n(e(t))}catch(e){r(e)}}));n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}
2361
+ */class hd{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2361
2362
  /**
2362
2363
  * @license
2363
2364
  * Copyright 2020 Google LLC
@@ -2373,7 +2374,7 @@ function ad(e,t=[]){let n;switch(e){case"Browser":n=Yl(s());break;case"Worker":n
2373
2374
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2374
2375
  * See the License for the specific language governing permissions and
2375
2376
  * limitations under the License.
2376
- */class ud{constructor(e,t,n){this.app=e,this.heartbeatServiceProvider=t,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ld(this),this.idTokenSubscription=new ld(this),this.beforeStateQueue=new cd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ul,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Il(t)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Ql.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(e)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return ml(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Bl(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?I(e):null;return t&&ml(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&ml(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Il(e))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new l("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Il(e)||this._popupRedirectResolver;ml(t,this,"argument-error"),this.redirectPersistenceManager=await Ql.create(this,[Il(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const s="function"==typeof t?t:t.next.bind(t),i=this._isInitialized?Promise.resolve():this._initializationPromise;return ml(i,this,"internal-error"),i.then((()=>s(this.currentUser))),"function"==typeof t?e.addObserver(t,n,r):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return ml(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ad(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());return n&&(t["X-Firebase-Client"]=n),t}}function hd(e){return I(e)}class ld{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new v(e,t);return n.subscribe.bind(n)}((e=>this.observer=e))}get next(){return ml(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function dd(e,t,n){const r=hd(e);ml(r._canInitEmulator,r,"emulator-config-failed"),ml(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=fd(t),{host:o,port:a}=function(e){const t=fd(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const e=s[1];return{host:e,port:pd(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:pd(t)}}}(t),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}
2377
+ */class ld{constructor(t,e,n){this.app=t,this.heartbeatServiceProvider=e,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new fd(this),this.idTokenSubscription=new fd(this),this.beforeStateQueue=new hd(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ll,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=n.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Il(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await Yl.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return vl(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Kl(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?I(t):null;return e&&vl(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&vl(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Il(t))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new f("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Il(t)||this._popupRedirectResolver;vl(e,this,"argument-error"),this.redirectPersistenceManager=await Yl.create(this,[Il(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e),i=this._isInitialized?Promise.resolve():this._initializationPromise;return vl(i,this,"internal-error"),i.then((()=>s(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return vl(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=ud(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());return n&&(e["X-Firebase-Client"]=n),e}}function dd(t){return I(t)}class fd{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new _(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return vl(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function pd(t,e,n){const r=dd(t);vl(r._canInitEmulator,r,"emulator-config-failed"),vl(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=gd(e),{host:o,port:a}=function(t){const e=gd(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:md(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:md(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
2377
2378
  /**
2378
2379
  * @license
2379
2380
  * Copyright 2020 Google LLC
@@ -2389,7 +2390,7 @@ function ad(e,t=[]){let n;switch(e){case"Browser":n=Yl(s());break;case"Worker":n
2389
2390
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2390
2391
  * See the License for the specific language governing permissions and
2391
2392
  * limitations under the License.
2392
- */()}function fd(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function pd(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class gd{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return yl("not implemented")}_getIdTokenResponse(e){return yl("not implemented")}_linkToIdToken(e,t){return yl("not implemented")}_getReauthenticationResolver(e){return yl("not implemented")}}
2393
+ */()}function gd(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function md(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class yd{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return wl("not implemented")}_getIdTokenResponse(t){return wl("not implemented")}_linkToIdToken(t,e){return wl("not implemented")}_getReauthenticationResolver(t){return wl("not implemented")}}
2393
2394
  /**
2394
2395
  * @license
2395
2396
  * Copyright 2020 Google LLC
@@ -2405,7 +2406,7 @@ function ad(e,t=[]){let n;switch(e){case"Browser":n=Yl(s());break;case"Worker":n
2405
2406
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2406
2407
  * See the License for the specific language governing permissions and
2407
2408
  * limitations under the License.
2408
- */async function md(e,t){return async function(e,t){return Dl(e,"POST","/v1/accounts:sendOobCode",Nl(e,t))}(e,t)}
2409
+ */async function vd(t,e){return async function(t,e){return Ol(t,"POST","/v1/accounts:sendOobCode",Dl(t,e))}(t,e)}
2409
2410
  /**
2410
2411
  * @license
2411
2412
  * Copyright 2020 Google LLC
@@ -2438,7 +2439,7 @@ function ad(e,t=[]){let n;switch(e){case"Browser":n=Yl(s());break;case"Worker":n
2438
2439
  * See the License for the specific language governing permissions and
2439
2440
  * limitations under the License.
2440
2441
  */
2441
- class yd extends gd{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new yd(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new yd(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":
2442
+ class wd extends yd{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new wd(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new wd(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":
2442
2443
  /**
2443
2444
  * @license
2444
2445
  * Copyright 2020 Google LLC
@@ -2455,7 +2456,7 @@ class yd extends gd{constructor(e,t,n,r=null){super("password",n),this._email=e,
2455
2456
  * See the License for the specific language governing permissions and
2456
2457
  * limitations under the License.
2457
2458
  */
2458
- return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithPassword",Nl(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithEmailLink",Nl(e,t))}(e,{email:this._email,oobCode:this._password});default:fl(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return async function(e,t){return Dl(e,"POST","/v1/accounts:update",t)}(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithEmailLink",Nl(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:fl(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}
2459
+ return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithPassword",Dl(t,e))}(t,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithEmailLink",Dl(t,e))}(t,{email:this._email,oobCode:this._password});default:gl(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Ol(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Pl(t,"POST","/v1/accounts:signInWithEmailLink",Dl(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:gl(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2459
2460
  /**
2460
2461
  * @license
2461
2462
  * Copyright 2020 Google LLC
@@ -2471,7 +2472,7 @@ return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithPassword",
2471
2472
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2472
2473
  * See the License for the specific language governing permissions and
2473
2474
  * limitations under the License.
2474
- */async function vd(e,t){return Ol(e,"POST","/v1/accounts:signInWithIdp",Nl(e,t))}
2475
+ */async function _d(t,e){return Pl(t,"POST","/v1/accounts:signInWithIdp",Dl(t,e))}
2475
2476
  /**
2476
2477
  * @license
2477
2478
  * Copyright 2020 Google LLC
@@ -2487,7 +2488,7 @@ return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithPassword",
2487
2488
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2488
2489
  * See the License for the specific language governing permissions and
2489
2490
  * limitations under the License.
2490
- */class wd extends gd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new wd(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):fl("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r}=t,s=ol(t,["providerId","signInMethod"]);if(!n||!r)return null;const i=new wd(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(e){return vd(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,vd(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,vd(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=g(t)}return e}}
2491
+ */class Td extends yd{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Td(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):gl("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,s=cl(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Td(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(t){return _d(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,_d(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,_d(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=y(e)}return t}}
2491
2492
  /**
2492
2493
  * @license
2493
2494
  * Copyright 2020 Google LLC
@@ -2503,7 +2504,7 @@ return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithPassword",
2503
2504
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2504
2505
  * See the License for the specific language governing permissions and
2505
2506
  * limitations under the License.
2506
- */class Id{constructor(e){var t,n,r,s,i,o;const a=m(y(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);ml(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=m(y(e)).link,n=t?m(y(t)).deep_link_id:null,r=m(y(e)).deep_link_id;return(r?m(y(r)).link:null)||r||n||t||e}(e);try{return new Id(t)}catch(e){return null}}}
2507
+ */class Id{constructor(t){var e,n,r,s,i,o;const a=v(w(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);vl(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=v(w(t)).link,n=e?v(w(e)).deep_link_id:null,r=v(w(t)).deep_link_id;return(r?v(w(r)).link:null)||r||n||e||t}(t);try{return new Id(e)}catch(t){return null}}}
2507
2508
  /**
2508
2509
  * @license
2509
2510
  * Copyright 2020 Google LLC
@@ -2519,7 +2520,7 @@ return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithPassword",
2519
2520
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2520
2521
  * See the License for the specific language governing permissions and
2521
2522
  * limitations under the License.
2522
- */class bd{constructor(){this.providerId=bd.PROVIDER_ID}static credential(e,t){return yd._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=Id.parseLink(t);return ml(n,"argument-error"),yd._fromEmailAndCode(e,n.code,n.tenantId)}}bd.PROVIDER_ID="password",bd.EMAIL_PASSWORD_SIGN_IN_METHOD="password",bd.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2523
+ */class Ed{constructor(){this.providerId=Ed.PROVIDER_ID}static credential(t,e){return wd._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Id.parseLink(e);return vl(n,"argument-error"),wd._fromEmailAndCode(t,n.code,n.tenantId)}}Ed.PROVIDER_ID="password",Ed.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Ed.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2523
2524
  /**
2524
2525
  * @license
2525
2526
  * Copyright 2020 Google LLC
@@ -2536,7 +2537,7 @@ return async function(e,t){return Ol(e,"POST","/v1/accounts:signInWithPassword",
2536
2537
  * See the License for the specific language governing permissions and
2537
2538
  * limitations under the License.
2538
2539
  */
2539
- class Td{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}
2540
+ class Sd{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
2540
2541
  /**
2541
2542
  * @license
2542
2543
  * Copyright 2019 Google LLC
@@ -2552,7 +2553,7 @@ class Td{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.cus
2552
2553
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2553
2554
  * See the License for the specific language governing permissions and
2554
2555
  * limitations under the License.
2555
- */class Ed extends Td{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}
2556
+ */class bd extends Sd{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2556
2557
  /**
2557
2558
  * @license
2558
2559
  * Copyright 2020 Google LLC
@@ -2568,7 +2569,7 @@ class Td{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.cus
2568
2569
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2569
2570
  * See the License for the specific language governing permissions and
2570
2571
  * limitations under the License.
2571
- */class _d extends Ed{constructor(){super("facebook.com")}static credential(e){return wd._fromParams({providerId:_d.PROVIDER_ID,signInMethod:_d.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return _d.credentialFromTaggedObject(e)}static credentialFromError(e){return _d.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return _d.credential(e.oauthAccessToken)}catch(e){return null}}}_d.FACEBOOK_SIGN_IN_METHOD="facebook.com",_d.PROVIDER_ID="facebook.com";
2572
+ */class Ad extends bd{constructor(){super("facebook.com")}static credential(t){return Td._fromParams({providerId:Ad.PROVIDER_ID,signInMethod:Ad.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Ad.credentialFromTaggedObject(t)}static credentialFromError(t){return Ad.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Ad.credential(t.oauthAccessToken)}catch(t){return null}}}Ad.FACEBOOK_SIGN_IN_METHOD="facebook.com",Ad.PROVIDER_ID="facebook.com";
2572
2573
  /**
2573
2574
  * @license
2574
2575
  * Copyright 2020 Google LLC
@@ -2585,7 +2586,7 @@ class Td{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.cus
2585
2586
  * See the License for the specific language governing permissions and
2586
2587
  * limitations under the License.
2587
2588
  */
2588
- class Sd extends Ed{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return wd._fromParams({providerId:Sd.PROVIDER_ID,signInMethod:Sd.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Sd.credentialFromTaggedObject(e)}static credentialFromError(e){return Sd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return Sd.credential(t,n)}catch(e){return null}}}Sd.GOOGLE_SIGN_IN_METHOD="google.com",Sd.PROVIDER_ID="google.com";
2589
+ class Cd extends bd{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Td._fromParams({providerId:Cd.PROVIDER_ID,signInMethod:Cd.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Cd.credentialFromTaggedObject(t)}static credentialFromError(t){return Cd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Cd.credential(e,n)}catch(t){return null}}}Cd.GOOGLE_SIGN_IN_METHOD="google.com",Cd.PROVIDER_ID="google.com";
2589
2590
  /**
2590
2591
  * @license
2591
2592
  * Copyright 2020 Google LLC
@@ -2602,7 +2603,7 @@ class Sd extends Ed{constructor(){super("google.com"),this.addScope("profile")}s
2602
2603
  * See the License for the specific language governing permissions and
2603
2604
  * limitations under the License.
2604
2605
  */
2605
- class Cd extends Ed{constructor(){super("github.com")}static credential(e){return wd._fromParams({providerId:Cd.PROVIDER_ID,signInMethod:Cd.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Cd.credentialFromTaggedObject(e)}static credentialFromError(e){return Cd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Cd.credential(e.oauthAccessToken)}catch(e){return null}}}Cd.GITHUB_SIGN_IN_METHOD="github.com",Cd.PROVIDER_ID="github.com";
2606
+ class kd extends bd{constructor(){super("github.com")}static credential(t){return Td._fromParams({providerId:kd.PROVIDER_ID,signInMethod:kd.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return kd.credentialFromTaggedObject(t)}static credentialFromError(t){return kd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return kd.credential(t.oauthAccessToken)}catch(t){return null}}}kd.GITHUB_SIGN_IN_METHOD="github.com",kd.PROVIDER_ID="github.com";
2606
2607
  /**
2607
2608
  * @license
2608
2609
  * Copyright 2020 Google LLC
@@ -2619,7 +2620,7 @@ class Cd extends Ed{constructor(){super("github.com")}static credential(e){retur
2619
2620
  * See the License for the specific language governing permissions and
2620
2621
  * limitations under the License.
2621
2622
  */
2622
- class Ad extends Ed{constructor(){super("twitter.com")}static credential(e,t){return wd._fromParams({providerId:Ad.PROVIDER_ID,signInMethod:Ad.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Ad.credentialFromTaggedObject(e)}static credentialFromError(e){return Ad.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return Ad.credential(t,n)}catch(e){return null}}}Ad.TWITTER_SIGN_IN_METHOD="twitter.com",Ad.PROVIDER_ID="twitter.com";
2623
+ class Nd extends bd{constructor(){super("twitter.com")}static credential(t,e){return Td._fromParams({providerId:Nd.PROVIDER_ID,signInMethod:Nd.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Nd.credentialFromTaggedObject(t)}static credentialFromError(t){return Nd.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Nd.credential(e,n)}catch(t){return null}}}Nd.TWITTER_SIGN_IN_METHOD="twitter.com",Nd.PROVIDER_ID="twitter.com";
2623
2624
  /**
2624
2625
  * @license
2625
2626
  * Copyright 2020 Google LLC
@@ -2636,7 +2637,7 @@ class Ad extends Ed{constructor(){super("twitter.com")}static credential(e,t){re
2636
2637
  * See the License for the specific language governing permissions and
2637
2638
  * limitations under the License.
2638
2639
  */
2639
- class kd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){const s=await Kl._fromIdTokenResponse(e,n,r),i=Nd(n);return new kd({user:s,providerId:i,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=Nd(n);return new kd({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function Nd(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}
2640
+ class Rd{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await $l._fromIdTokenResponse(t,n,r),i=Dd(n);return new Rd({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=Dd(n);return new Rd({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function Dd(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2640
2641
  /**
2641
2642
  * @license
2642
2643
  * Copyright 2020 Google LLC
@@ -2652,7 +2653,7 @@ class kd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._toke
2652
2653
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2653
2654
  * See the License for the specific language governing permissions and
2654
2655
  * limitations under the License.
2655
- */class Dd extends h{constructor(e,t,n,r){var s;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,Dd.prototype),this.customData={appName:e.name,tenantId:null!==(s=e.tenantId)&&void 0!==s?s:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new Dd(e,t,n,r)}}function Rd(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw Dd._fromErrorAndOperation(e,n,t,r);throw n}))}
2656
+ */class Od extends d{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,Od.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new Od(t,e,n,r)}}function Ld(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw Od._fromErrorAndOperation(t,n,e,r);throw n}))}
2656
2657
  /**
2657
2658
  * @license
2658
2659
  * Copyright 2020 Google LLC
@@ -2669,7 +2670,7 @@ class kd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._toke
2669
2670
  * See the License for the specific language governing permissions and
2670
2671
  * limitations under the License.
2671
2672
  */
2672
- async function Od(e,t,n=!1){const r="signIn",s=await Rd(e,r,t),i=await kd._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(i.user),i}
2673
+ async function Pd(t,e,n=!1){const r="signIn",s=await Ld(t,r,e),i=await Rd._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2673
2674
  /**
2674
2675
  * @license
2675
2676
  * Copyright 2020 Google LLC
@@ -2686,7 +2687,7 @@ async function Od(e,t,n=!1){const r="signIn",s=await Rd(e,r,t),i=await kd._fromI
2686
2687
  * See the License for the specific language governing permissions and
2687
2688
  * limitations under the License.
2688
2689
  */
2689
- async function Ld(e,t,n){const r=I(e),s={requestType:"PASSWORD_RESET",email:t};n&&
2690
+ async function Md(t,e,n){const r=I(t),s={requestType:"PASSWORD_RESET",email:e};n&&
2690
2691
  /**
2691
2692
  * @license
2692
2693
  * Copyright 2020 Google LLC
@@ -2703,7 +2704,7 @@ async function Ld(e,t,n){const r=I(e),s={requestType:"PASSWORD_RESET",email:t};n
2703
2704
  * See the License for the specific language governing permissions and
2704
2705
  * limitations under the License.
2705
2706
  */
2706
- function(e,t,n){var r;ml((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"invalid-continue-uri"),ml(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=n.url,t.dynamicLinkDomain=n.dynamicLinkDomain,t.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(ml(n.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=n.iOS.bundleId),n.android&&(ml(n.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=n.android.installApp,t.androidMinimumVersionCode=n.android.minimumVersion,t.androidPackageName=n.android.packageName)}(r,s,n),await md(r,s)}async function Pd(e,t,n){await async function(e,t){return Dl(e,"POST","/v1/accounts:resetPassword",Nl(e,t))}(I(e),{oobCode:t,newPassword:n})}function Md(e,t,n){return async function(e,t){return Od(hd(e),t)}(I(e),bd.credential(t,n))}const xd="__sak";
2707
+ function(t,e,n){var r;vl((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),vl(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(vl(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(vl(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,s,n),await vd(r,s)}async function xd(t,e,n){await async function(t,e){return Ol(t,"POST","/v1/accounts:resetPassword",Dl(t,e))}(I(t),{oobCode:e,newPassword:n})}function Ud(t,e,n){return async function(t,e){return Pd(dd(t),e)}(I(t),Ed.credential(e,n))}const Fd="__sak";
2707
2708
  /**
2708
2709
  * @license
2709
2710
  * Copyright 2019 Google LLC
@@ -2719,7 +2720,7 @@ function(e,t,n){var r;ml((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"inv
2719
2720
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2720
2721
  * See the License for the specific language governing permissions and
2721
2722
  * limitations under the License.
2722
- */class Ud{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(xd,"1"),this.storage.removeItem(xd),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}
2723
+ */class Vd{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Fd,"1"),this.storage.removeItem(Fd),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
2723
2724
  /**
2724
2725
  * @license
2725
2726
  * Copyright 2020 Google LLC
@@ -2735,7 +2736,7 @@ function(e,t,n){var r;ml((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"inv
2735
2736
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2736
2737
  * See the License for the specific language governing permissions and
2737
2738
  * limitations under the License.
2738
- */class Fd extends Ud{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=s();return Jl(e)||sd(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=od(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(e.newValue!==r)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.storage.getItem(n);id()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Fd.type="LOCAL";const Vd=Fd;
2739
+ */class Bd extends Vd{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=o();return td(t)||od(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=cd(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);ad()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Bd.type="LOCAL";const jd=Bd;
2739
2740
  /**
2740
2741
  * @license
2741
2742
  * Copyright 2020 Google LLC
@@ -2751,7 +2752,7 @@ function(e,t,n){var r;ml((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"inv
2751
2752
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2752
2753
  * See the License for the specific language governing permissions and
2753
2754
  * limitations under the License.
2754
- */class qd extends Ud{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}qd.type="SESSION";const jd=qd;
2755
+ */class Hd extends Vd{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}Hd.type="SESSION";const qd=Hd;
2755
2756
  /**
2756
2757
  * @license
2757
2758
  * Copyright 2019 Google LLC
@@ -2784,7 +2785,7 @@ function(e,t,n){var r;ml((null===(r=n.url)||void 0===r?void 0:r.length)>0,e,"inv
2784
2785
  * See the License for the specific language governing permissions and
2785
2786
  * limitations under the License.
2786
2787
  */
2787
- class Bd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const n=new Bd(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:s}=t.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async e=>e(t.origin,s))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})))}(o);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2788
+ class Kd{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new Kd(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:s}=e.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2788
2789
  /**
2789
2790
  * @license
2790
2791
  * Copyright 2020 Google LLC
@@ -2801,7 +2802,7 @@ class Bd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHa
2801
2802
  * See the License for the specific language governing permissions and
2802
2803
  * limitations under the License.
2803
2804
  */
2804
- function zd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}
2805
+ function Wd(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2805
2806
  /**
2806
2807
  * @license
2807
2808
  * Copyright 2019 Google LLC
@@ -2817,7 +2818,7 @@ function zd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random
2817
2818
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2818
2819
  * See the License for the specific language governing permissions and
2819
2820
  * limitations under the License.
2820
- */Bd.receivers=[];class $d{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=zd("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(t.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2821
+ */Kd.receivers=[];class zd{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=Wd("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2821
2822
  /**
2822
2823
  * @license
2823
2824
  * Copyright 2020 Google LLC
@@ -2833,7 +2834,7 @@ function zd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random
2833
2834
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2834
2835
  * See the License for the specific language governing permissions and
2835
2836
  * limitations under the License.
2836
- */function Kd(){return window}
2837
+ */function $d(){return window}
2837
2838
  /**
2838
2839
  * @license
2839
2840
  * Copyright 2020 Google LLC.
@@ -2850,7 +2851,7 @@ function zd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random
2850
2851
  * See the License for the specific language governing permissions and
2851
2852
  * limitations under the License.
2852
2853
  */
2853
- function Hd(){return void 0!==Kd().WorkerGlobalScope&&"function"==typeof Kd().importScripts}
2854
+ function Gd(){return void 0!==$d().WorkerGlobalScope&&"function"==typeof $d().importScripts}
2854
2855
  /**
2855
2856
  * @license
2856
2857
  * Copyright 2019 Google LLC
@@ -2867,7 +2868,7 @@ function Hd(){return void 0!==Kd().WorkerGlobalScope&&"function"==typeof Kd().im
2867
2868
  * See the License for the specific language governing permissions and
2868
2869
  * limitations under the License.
2869
2870
  */
2870
- const Gd="firebaseLocalStorageDb",Wd="firebaseLocalStorage",Qd="fbase_key";class Yd{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Xd(e,t){return e.transaction([Wd],t?"readwrite":"readonly").objectStore(Wd)}function Jd(){const e=indexedDB.open(Gd,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(Wd,{keyPath:Qd})}catch(e){n(e)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(Wd)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Gd);return new Yd(e).toPromise()}(),t(await Jd()))}))}))}async function Zd(e,t,n){const r=Xd(e,!0).put({[Qd]:t,value:n});return new Yd(r).toPromise()}function ef(e,t){const n=Xd(e,!0).delete(t);return new Yd(n).toPromise()}class tf{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Jd()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Hd()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Bd._getInstance(Hd()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new $d(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&function(){var e;return(null===(e=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===e?void 0:e.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Jd();return await Zd(e,xd,"1"),await ef(e,xd),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((n=>Zd(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const n=Xd(e,!1).get(t),r=await new Yd(n).toPromise();return void 0===r?null:r.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>ef(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Xd(e,!1).getAll();return new Yd(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;for(const{fbase_key:r,value:s}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}tf.type="LOCAL";const nf=tf;
2871
+ const Qd="firebaseLocalStorageDb",Jd="firebaseLocalStorage",Yd="fbase_key";class Xd{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Zd(t,e){return t.transaction([Jd],e?"readwrite":"readonly").objectStore(Jd)}function tf(){const t=indexedDB.open(Qd,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Jd,{keyPath:Yd})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Jd)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Qd);return new Xd(t).toPromise()}(),e(await tf()))}))}))}async function ef(t,e,n){const r=Zd(t,!0).put({[Yd]:e,value:n});return new Xd(r).toPromise()}function nf(t,e){const n=Zd(t,!0).delete(e);return new Xd(n).toPromise()}class rf{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await tf()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Gd()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Kd._getInstance(Gd()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new zd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await tf();return await ef(t,Fd,"1"),await nf(t,Fd),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>ef(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Zd(t,!1).get(e),r=await new Xd(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>nf(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Zd(t,!1).getAll();return new Xd(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}rf.type="LOCAL";const sf=rf;
2871
2872
  /**
2872
2873
  * @license
2873
2874
  * Copyright 2020 Google LLC
@@ -2883,7 +2884,7 @@ const Gd="firebaseLocalStorageDb",Wd="firebaseLocalStorage",Qd="fbase_key";class
2883
2884
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2884
2885
  * See the License for the specific language governing permissions and
2885
2886
  * limitations under the License.
2886
- */function rf(e){return new Promise(((t,n)=>{const r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=pl("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",function(){var e,t;return null!==(t=null===(e=document.getElementsByTagName("head"))||void 0===e?void 0:e[0])&&void 0!==t?t:document}().appendChild(r)}))}new _l(3e4,6e4);
2887
+ */function of(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=ml("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)}))}new Al(3e4,6e4);
2887
2888
  /**
2888
2889
  * @license
2889
2890
  * Copyright 2019 Google LLC
@@ -2900,7 +2901,7 @@ const Gd="firebaseLocalStorageDb",Wd="firebaseLocalStorage",Qd="fbase_key";class
2900
2901
  * See the License for the specific language governing permissions and
2901
2902
  * limitations under the License.
2902
2903
  */
2903
- class sf extends gd{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return vd(e,this._buildIdpRequest())}_linkToIdToken(e,t){return vd(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return vd(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function of(e){return Od(e.auth,new sf(e),e.bypassAuthState)}function af(e){const{auth:t,user:n}=e;return ml(n,t,"internal-error"),
2904
+ class af extends yd{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return _d(t,this._buildIdpRequest())}_linkToIdToken(t,e){return _d(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return _d(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function cf(t){return Pd(t.auth,new af(t),t.bypassAuthState)}function uf(t){const{auth:e,user:n}=t;return vl(n,e,"internal-error"),
2904
2905
  /**
2905
2906
  * @license
2906
2907
  * Copyright 2019 Google LLC
@@ -2917,7 +2918,7 @@ class sf extends gd{constructor(e){super("custom","custom"),this.params=e}_getId
2917
2918
  * See the License for the specific language governing permissions and
2918
2919
  * limitations under the License.
2919
2920
  */
2920
- async function(e,t,n=!1){const{auth:r}=e,s="reauthenticate";try{const i=await Vl(e,Rd(r,s,t,e),n);ml(i.idToken,r,"internal-error");const o=Fl(i.idToken);ml(o,r,"internal-error");const{sub:a}=o;return ml(e.uid===a,r,"user-mismatch"),kd._forOperation(e,s,i)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&fl(r,"user-mismatch"),e}}(n,new sf(e),e.bypassAuthState)}async function cf(e){const{auth:t,user:n}=e;return ml(n,t,"internal-error"),async function(e,t,n=!1){const r=await Vl(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return kd._forOperation(e,"link",r)}(n,new sf(e),e.bypassAuthState)}
2921
+ async function(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await jl(t,Ld(r,s,e,t),n);vl(i.idToken,r,"internal-error");const o=Bl(i.idToken);vl(o,r,"internal-error");const{sub:a}=o;return vl(t.uid===a,r,"user-mismatch"),Rd._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&gl(r,"user-mismatch"),t}}(n,new af(t),t.bypassAuthState)}async function hf(t){const{auth:e,user:n}=t;return vl(n,e,"internal-error"),async function(t,e,n=!1){const r=await jl(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Rd._forOperation(t,"link",r)}(n,new af(t),t.bypassAuthState)}
2921
2922
  /**
2922
2923
  * @license
2923
2924
  * Copyright 2020 Google LLC
@@ -2933,7 +2934,7 @@ async function(e,t,n=!1){const{auth:r}=e,s="reauthenticate";try{const i=await Vl
2933
2934
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2934
2935
  * See the License for the specific language governing permissions and
2935
2936
  * limitations under the License.
2936
- */class uf{constructor(e,t,n,r,s=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=e;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return of;case"linkViaPopup":case"linkViaRedirect":return cf;case"reauthViaPopup":case"reauthViaRedirect":return af;default:fl(this.auth,"internal-error")}}resolve(e){vl(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){vl(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
2937
+ */class lf{constructor(t,e,n,r,s=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return cf;case"linkViaPopup":case"linkViaRedirect":return hf;case"reauthViaPopup":case"reauthViaRedirect":return uf;default:gl(this.auth,"internal-error")}}resolve(t){_l(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){_l(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
2937
2938
  /**
2938
2939
  * @license
2939
2940
  * Copyright 2020 Google LLC
@@ -2949,7 +2950,7 @@ async function(e,t,n=!1){const{auth:r}=e,s="reauthenticate";try{const i=await Vl
2949
2950
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2950
2951
  * See the License for the specific language governing permissions and
2951
2952
  * limitations under the License.
2952
- */const hf=new _l(2e3,1e4);class lf extends uf{constructor(e,t,n,r,s){super(e,t,r,s),this.provider=n,this.authWindow=null,this.pollId=null,lf.currentPopupAction&&lf.currentPopupAction.cancel(),lf.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return ml(e,this.auth,"internal-error"),e}async onExecution(){vl(1===this.filter.length,"Popup operations only handle one event");const e=zd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(pl(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(pl(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,lf.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(pl(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(e,hf.get())};e()}}lf.currentPopupAction=null;
2953
+ */const df=new Al(2e3,1e4);class ff extends lf{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,ff.currentPopupAction&&ff.currentPopupAction.cancel(),ff.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return vl(t,this.auth,"internal-error"),t}async onExecution(){_l(1===this.filter.length,"Popup operations only handle one event");const t=Wd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(ml(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(ml(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ff.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(ml(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(t,df.get())};t()}}ff.currentPopupAction=null;
2953
2954
  /**
2954
2955
  * @license
2955
2956
  * Copyright 2020 Google LLC
@@ -2966,7 +2967,7 @@ async function(e,t,n=!1){const{auth:r}=e,s="reauthenticate";try{const i=await Vl
2966
2967
  * See the License for the specific language governing permissions and
2967
2968
  * limitations under the License.
2968
2969
  */
2969
- const df="pendingRedirect",ff=new Map;class pf extends uf{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=ff.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return Wl(df,e.config.apiKey,e.name)}(t),r=function(e){return Il(e._redirectPersistence)}(e);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}ff.set(this.auth._key(),e)}return this.bypassAuthState||ff.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function gf(e,t){ff.set(e._key(),t)}async function mf(e,t,n=!1){const r=hd(e),s=
2970
+ const pf="pendingRedirect",gf=new Map;class mf extends lf{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=gf.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return Jl(pf,t.config.apiKey,t.name)}(e),r=function(t){return Il(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}gf.set(this.auth._key(),t)}return this.bypassAuthState||gf.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function yf(t,e){gf.set(t._key(),e)}async function vf(t,e,n=!1){const r=dd(t),s=
2970
2971
  /**
2971
2972
  * @license
2972
2973
  * Copyright 2021 Google LLC
@@ -2983,7 +2984,7 @@ const df="pendingRedirect",ff=new Map;class pf extends uf{constructor(e,t,n=!1){
2983
2984
  * See the License for the specific language governing permissions and
2984
2985
  * limitations under the License.
2985
2986
  */
2986
- function(e,t){return t?Il(t):(ml(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(r,t),i=new pf(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,t)),o}
2987
+ function(t,e){return e?Il(e):(vl(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new mf(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
2987
2988
  /**
2988
2989
  * @license
2989
2990
  * Copyright 2020 Google LLC
@@ -2999,7 +3000,7 @@ function(e,t){return t?Il(t):(ml(e._popupRedirectResolver,e,"argument-error"),e.
2999
3000
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3000
3001
  * See the License for the specific language governing permissions and
3001
3002
  * limitations under the License.
3002
- */class yf{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return wf(e);default:return!1}}
3003
+ */class wf{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Tf(t);default:return!1}}
3003
3004
  /**
3004
3005
  * @license
3005
3006
  * Copyright 2020 Google LLC
@@ -3015,7 +3016,7 @@ function(e,t){return t?Il(t):(ml(e._popupRedirectResolver,e,"argument-error"),e.
3015
3016
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3016
3017
  * See the License for the specific language governing permissions and
3017
3018
  * limitations under the License.
3018
- */(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!wf(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(pl(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(vf(e))}saveEventToCache(e){this.cachedEventUids.add(vf(e)),this.lastProcessedEventTime=Date.now()}}function vf(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function wf({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}
3019
+ */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Tf(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(ml(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(_f(t))}saveEventToCache(t){this.cachedEventUids.add(_f(t)),this.lastProcessedEventTime=Date.now()}}function _f(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Tf({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3019
3020
  /**
3020
3021
  * @license
3021
3022
  * Copyright 2020 Google LLC
@@ -3032,7 +3033,7 @@ function(e,t){return t?Il(t):(ml(e._popupRedirectResolver,e,"argument-error"),e.
3032
3033
  * See the License for the specific language governing permissions and
3033
3034
  * limitations under the License.
3034
3035
  */
3035
- const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,bf=/^https?/;async function Tf(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return Dl(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(Ef(e))return}catch(e){}fl(e,"unauthorized-domain")}function Ef(e){const t=bl(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const s=new URL(e);return""===s.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!bf.test(n))return!1;if(If.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3036
+ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ef=/^https?/;async function Sf(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Ol(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(bf(t))return}catch(t){}gl(t,"unauthorized-domain")}function bf(t){const e=El(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!Ef.test(n))return!1;if(If.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3036
3037
  /**
3037
3038
  * @license
3038
3039
  * Copyright 2020 Google LLC.
@@ -3048,7 +3049,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,bf=/^https?/;async function Tf(e
3048
3049
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3049
3050
  * See the License for the specific language governing permissions and
3050
3051
  * limitations under the License.
3051
- */const _f=new _l(3e4,6e4);function Sf(){const e=Kd().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}function Cf(e){return new Promise(((t,n)=>{var r,s,i;function o(){Sf(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{Sf(),n(pl(e,"network-request-failed"))},timeout:_f.get()})}if(null===(s=null===(r=Kd().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)t(gapi.iframes.getContext());else{if(!(null===(i=Kd().gapi)||void 0===i?void 0:i.load)){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Kd()[t]=()=>{gapi.load?o():n(pl(e,"network-request-failed"))},rf(`https://apis.google.com/js/api.js?onload=${t}`).catch((e=>n(e)))}o()}})).catch((e=>{throw Af=null,e}))}let Af=null;
3052
+ */const Af=new Al(3e4,6e4);function Cf(){const t=$d().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function kf(t){return new Promise(((e,n)=>{var r,s,i;function o(){Cf(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Cf(),n(ml(t,"network-request-failed"))},timeout:Af.get()})}if(null===(s=null===(r=$d().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=$d().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return $d()[e]=()=>{gapi.load?o():n(ml(t,"network-request-failed"))},of(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Nf=null,t}))}let Nf=null;
3052
3053
  /**
3053
3054
  * @license
3054
3055
  * Copyright 2020 Google LLC.
@@ -3065,7 +3066,7 @@ const If=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,bf=/^https?/;async function Tf(e
3065
3066
  * See the License for the specific language governing permissions and
3066
3067
  * limitations under the License.
3067
3068
  */
3068
- const kf=new _l(5e3,15e3),Nf={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Df=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Rf(e){const t=e.config;ml(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Sl(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:oe},s=Df.get(e.config.apiHost);s&&(r.eid=s);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${g(r).slice(1)}`}async function Of(e){const t=await function(e){return Af=Af||Cf(e),Af}(e),n=Kd().gapi;return ml(n,e,"internal-error"),t.open({where:document.body,url:Rf(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Nf,dontclear:!0},(t=>new Promise((async(n,r)=>{await t.restyle({setHideOnLeave:!1});const s=pl(e,"network-request-failed"),i=Kd().setTimeout((()=>{r(s)}),kf.get());function o(){Kd().clearTimeout(i),n(t)}t.ping(o).then(o,(()=>{r(s)}))}))))}
3069
+ const Rf=new Al(5e3,15e3),Df={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Of=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Lf(t){const e=t.config;vl(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Cl(e,"emulator/auth/iframe"):`https://${t.config.authDomain}/__/auth/iframe`,r={apiKey:e.apiKey,appName:t.name,v:ct},s=Of.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${y(r).slice(1)}`}async function Pf(t){const e=await function(t){return Nf=Nf||kf(t),Nf}(t),n=$d().gapi;return vl(n,t,"internal-error"),e.open({where:document.body,url:Lf(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Df,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=ml(t,"network-request-failed"),i=$d().setTimeout((()=>{r(s)}),Rf.get());function o(){$d().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3069
3070
  /**
3070
3071
  * @license
3071
3072
  * Copyright 2020 Google LLC.
@@ -3081,7 +3082,7 @@ const kf=new _l(5e3,15e3),Nf={style:{position:"absolute",top:"-100px",width:"1px
3081
3082
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3082
3083
  * See the License for the specific language governing permissions and
3083
3084
  * limitations under the License.
3084
- */const Lf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Pf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Mf(e,t,n,r=500,i=600){const o=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u=Object.assign(Object.assign({},Lf),{width:r.toString(),height:i.toString(),top:o,left:a}),h=s().toLowerCase();n&&(c=Zl(h)?"_blank":n),Xl(h)&&(t=t||"http://localhost",u.scrollbars="yes");const l=Object.entries(u).reduce(((e,[t,n])=>`${e}${t}=${n},`),"");if(function(e=s()){var t;return sd(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(h)&&"_self"!==c)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3085
+ */const Mf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class xf{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Uf(t,e,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const u=Object.assign(Object.assign({},Mf),{width:r.toString(),height:s.toString(),top:i,left:a}),h=o().toLowerCase();n&&(c=ed(h)?"_blank":n),Zl(h)&&(e=e||"http://localhost",u.scrollbars="yes");const l=Object.entries(u).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=o()){var e;return od(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(h)&&"_self"!==c)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3085
3086
  /**
3086
3087
  * @license
3087
3088
  * Copyright 2021 Google LLC
@@ -3097,7 +3098,7 @@ const kf=new _l(5e3,15e3),Nf={style:{position:"absolute",top:"-100px",width:"1px
3097
3098
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3098
3099
  * See the License for the specific language governing permissions and
3099
3100
  * limitations under the License.
3100
- */(t||"",c),new Pf(null);const d=window.open(t||"",c,l);ml(d,e,"popup-blocked");try{d.focus()}catch(e){}return new Pf(d)}const xf="__/auth/handler",Uf="emulator/auth/handler";function Ff(e,t,n,r,s,i){ml(e.config.authDomain,e,"auth-domain-config-required"),ml(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:oe,eventId:s};if(t instanceof Td){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(i||{}))o[e]=t}if(t instanceof Ed){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${xf}`;return Sl(e,Uf)}
3101
+ */(e||"",c),new xf(null);const d=window.open(e||"",c,l);vl(d,t,"popup-blocked");try{d.focus()}catch(t){}return new xf(d)}const Ff="__/auth/handler",Vf="emulator/auth/handler";function Bf(t,e,n,r,s,i){vl(t.config.authDomain,t,"auth-domain-config-required"),vl(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:ct,eventId:s};if(e instanceof Sd){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof bd){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Ff}`;return Cl(t,Vf)}
3101
3102
  /**
3102
3103
  * @license
3103
3104
  * Copyright 2020 Google LLC
@@ -3113,7 +3114,7 @@ const kf=new _l(5e3,15e3),Nf={style:{position:"absolute",top:"-100px",width:"1px
3113
3114
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3114
3115
  * See the License for the specific language governing permissions and
3115
3116
  * limitations under the License.
3116
- */(e)}?${g(a).slice(1)}`}const Vf="webStorageSupport";const qf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=jd,this._completeRedirectFn=mf,this._overrideRedirectResult=gf}async _openPopup(e,t,n,r){var s;vl(null===(s=this.eventManagers[e._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return Mf(e,Ff(e,t,n,bl(),r),zd())}async _openRedirect(e,t,n,r){var s;return await this._originValidation(e),s=Ff(e,t,n,bl(),r),Kd().location.href=s,new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(vl(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch((()=>{delete this.eventManagers[t]})),n}async initAndGetManager(e){const t=await Of(e),n=new yf(e);return t.register("authEvent",(t=>{ml(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Vf,{type:Vf},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[Vf];void 0!==s&&t(!!s),fl(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=Tf(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return od()||Jl()||sd()}};var jf="@firebase/auth",Bf="0.21.0";
3117
+ */(t)}?${y(a).slice(1)}`}const jf="webStorageSupport";const Hf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qd,this._completeRedirectFn=vf,this._overrideRedirectResult=yf}async _openPopup(t,e,n,r){var s;_l(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return Uf(t,Bf(t,e,n,El(),r),Wd())}async _openRedirect(t,e,n,r){var s;return await this._originValidation(t),s=Bf(t,e,n,El(),r),$d().location.href=s,new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(_l(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await Pf(t),n=new wf(t);return e.register("authEvent",(e=>{vl(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(jf,{type:jf},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[jf];void 0!==s&&e(!!s),gl(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Sf(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return cd()||td()||od()}};var qf="@firebase/auth",Kf="0.21.0";
3117
3118
  /**
3118
3119
  * @license
3119
3120
  * Copyright 2020 Google LLC
@@ -3130,7 +3131,7 @@ const kf=new _l(5e3,15e3),Nf={style:{position:"absolute",top:"-100px",width:"1px
3130
3131
  * See the License for the specific language governing permissions and
3131
3132
  * limitations under the License.
3132
3133
  */
3133
- class zf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){ml(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3134
+ class Wf{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){vl(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3134
3135
  /**
3135
3136
  * @license
3136
3137
  * Copyright 2020 Google LLC
@@ -3163,5 +3164,5 @@ class zf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var
3163
3164
  * See the License for the specific language governing permissions and
3164
3165
  * limitations under the License.
3165
3166
  */
3166
- const $f=c("authIdTokenMaxAge")||300;let Kf=null;function Hf(e=ce()){const t=re(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=re(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(f(n.getOptions(),null!=t?t:{}))return e;fl(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:qf,persistence:[nf,Vd,jd]}),r=c("authTokenSyncURL");if(r){const e=(s=r,async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>$f)return;const r=null==t?void 0:t.token;Kf!==r&&(Kf=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){I(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(e,t,n,r){I(e).onIdTokenChanged(t,n,r)}(n,(t=>e(t)))}var s;const i=a("auth");return i&&dd(n,`http://${i}`),n}var Gf;Gf="Browser",ne(new b("auth",((e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((e,n)=>{ml(s&&!s.includes(":"),"invalid-api-key",{appName:e.name}),ml(!(null==i?void 0:i.includes(":")),"argument-error",{appName:e.name});const r={apiKey:s,authDomain:i,clientPlatform:Gf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ad(Gf)},o=new ud(e,n,r);return function(e,t){const n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Il);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(o,t),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),ne(new b("auth-internal",(e=>(e=>new zf(e))(hd(e.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),ue(jf,Bf,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Gf)),ue(jf,Bf,"esm2017");class Wf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Qf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Yf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Xf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Jf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Zf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class ep extends Error{constructor(e,t){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=e,this.available_sizes=t}}class tp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const np="avatar not created";var rp=Object.freeze({__proto__:null,AvatarNotCreatedError:Wf,NoFramesFoundError:Qf,RequestTimeoutError:Yf,UserNotLoggedInError:Xf,NoColorwaySizeAssetsFoundError:Jf,NoStylesFoundError:Zf,RecommendedAvailableSizesError:ep,BrandUserIdNotSetError:tp,AvatarNotCreated:np});class sp{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Hf(t),this.auth.setPersistence(Vd)}get id(){var e;return null===(e=this.user)||void 0===e?void 0:e.uid}onInit(){return new Promise((e=>{const t=this.auth.onAuthStateChanged((n=>{this.setUser(n),e(Boolean(n)),t()}))}))}setUser(e){this.user=e}setBrandUserId(e){this.brandUserId=e}async getToken(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Xf;return await this.user.getIdToken()}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Xf;const t=await Jh(function(e,t,...n){if(e=I(e),1===arguments.length&&(t=Ys.R()),Xu("doc","path",t),e instanceof sh){const r=ni.fromString(t,...n);return Ju(r),new oh(e,null,new ii(r))}{if(!(e instanceof oh||e instanceof ch))throw new Vs(Fs.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(ni.fromString(t,...n));return Ju(r),new oh(e.firestore,e instanceof ch?e.converter:null,new ii(r))}}(this.firestore,"users",this.id));return t.data()}watchUserProfileForChanges(e,t){let n;const r=Vh(uh(this.firestore,"users"),jh(Th(),"==",this.id)),s=setTimeout((()=>n()),t);return new Promise((t=>{n=tl(r,(async r=>{await e(r)&&(clearTimeout(s),n(),t(r.docs[0].data()))}))}))}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await Md(this.auth,e,t);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(e){await Ld(this.auth,e)}async confirmPasswordReset(e,t){await Pd(this.auth,e,t)}}class ip{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise((r=>{n=tl(e,(e=>{r(e),t&&n()}))})),unsubscribe:()=>n()}};const e=ae(rl.getInstance().firebase);this.firestore=yh(e),this.user=new sp(this.firestore,e)}onInit(){return this.user.onInit()}query(e,t,n=!0){const r=Vh(uh(this.firestore,e),t);return this.promisefyOnSnapshot(r,n)}getDocs(e,t){return el(Vh(uh(this.firestore,e),...t))}}const op=e=>{if(e.code===hl)throw new Error("account has been disabled");throw new Error(e.message)};class ap{static get endpoint(){return rl.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:r,useToken:s=!0}){const i=this.getUrl(t,s),o={method:n,headers:await this.getHeaders(e,s),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(e,t){return t?`${this.endpoint}/v1${e}`:this.endpoint+e}static async getHeaders(e,t){if(!t)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await e.getToken()}`}}static Get(e,t,n){return this.Fetch({user:e,endpointPath:t,method:"GET",body:null,useToken:n})}static Post(e,t,n=null,r){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:r})}static Put(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:r})}static Patch(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:r})}static Delete(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:r})}}const cp=e=>{const t=new Image;return t.src=e,new Promise((e=>{t.onerror=()=>e(!1),t.onload=()=>e(!0)}))};class up{constructor(e,t){this.brandId=e,this.firebase=t;const n=rl.getInstance().config;up.avatarTimeout=n.avatarTimeout?Number(n.avatarTimeout):12e4,up.vtoTimeout=n.vtoTimeout?Number(n.vtoTimeout):12e4}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async tryOn(e){if(!this.isLoggedIn)throw new Xf;try{return await this.getColorwaySizeAssetFrames(e)}catch(t){if(!(t instanceof Qf))throw t;return this.requestThenGetColorwaySizeAssetFrames(e)}}async awaitAvatarCreated(){if(!this.isLoggedIn)throw new Xf;const{promise:e,unsubscribe:t}=this.firebase.query("users",jh(Th(),"==",this.user.id)),n=setTimeout((()=>{throw t(),new Yf}),up.avatarTimeout),r=await e;clearTimeout(n);return"CREATED"===r.docs[0].data().avatar_status}async getRecommendedSizes(e){if(!this.isLoggedIn)throw new Xf;try{const t=await ap.Get(this.user,`/styles/${e}/recommendation`);return await t.json()}catch(e){if((null==e?void 0:e.error)===np)throw new Wf;throw e}}async getRecommendedSizesLabels(e){const t=await this.getRecommendedSizes(e);return{recommendedSizeLabel:t.recommended_sizes.label||t.recommended_sizes.size_value.size,availableSizeLabels:t.available_sizes.map((e=>e.label||e.size_value.size))}}async getStyles(e,t){const n=[jh("brand_id","==",this.brandId)];(null==e?void 0:e.length)>0&&n.push(jh("id","in",e)),(null==t?void 0:t.length)>0&&n.push(jh("brand_style_id","in",t));try{const e=await this.firebase.getDocs("styles",n),t=new Map;return e.forEach((e=>{const n=e.data();t.set(n.id,n)})),t}catch(e){return op(e)}}async submitTelephoneNumber(e){const t=e.replace(/[^\+0-9]/g,""),n=await ap.Post(this.user,"/ios-app-link",{phone_number:t},!1);console.log(n)}async getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Jf;return Array.from(t.values())[0]}async _getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Jf;return Array.from(t.values())}async awaitColorwaySizeAssetFrames(e){var t,n,r,s;if(!this.isLoggedIn)throw new Xf;const i=await this.user.watchUserProfileForChanges((async t=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[e])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&cp(o[0])}),up.vtoTimeout);if(!(null===(s=null===(r=null===(n=null===(t=null==i?void 0:i.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Qf;return i.vto[this.brandId][e].frames}async requestThenGetColorwaySizeAssetFrames(e){var t,n;const[r,s]=await(i=this.getColorwaySizeAssetFromSku(e),i.then((e=>[null,e])).catch((e=>[e])));var i;if(r)throw r;try{return await this.requestColorwaySizeAssetFrames(s.id),this.awaitColorwaySizeAssetFrames(e)}catch(r){if((null==r?void 0:r.error)===np)throw new Wf;if(!r.recommended_size_id)throw new Error(r);const e=r,i=(await this.getStyles([s.style_id],null)).get(s.style_id);if(!(null==i?void 0:i.sizes))throw new Zf;const o=(null===(t=i.sizes[e.recommended_size_id])||void 0===t?void 0:t.label)||(null===(n=i.sizes[e.recommended_size_id])||void 0===n?void 0:n.size),a=e.available_size_ids.filter((e=>{var t;return(null===(t=i.sizes[e])||void 0===t?void 0:t.size)!==o})).map((e=>{var t,n;return(null===(t=i.sizes[e])||void 0===t?void 0:t.label)||(null===(n=i.sizes[e])||void 0===n?void 0:n.size)}));throw new ep(o,a)}}async getColorwaySizeAssets(e,t){const n=[jh("brand_id","==",this.brandId)];e&&n.push(jh("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(jh("sku","in",t));try{const e=await this.firebase.getDocs("colorway_size_assets",n),t=new Map;return e.forEach((e=>{const n=e.data();t.set(n.id,n)})),t}catch(e){return op(e)}}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Xf;if(!this.user.brandUserId)throw new tp;await ap.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(t=null==s?void 0:s.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Qf;if(!await cp(i[0]))throw new Qf;return i}}up.avatarTimeout=12e4,up.vtoTimeout=12e4;const hp=(e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),rl.getInstance().setEnv(t),new up(e,new ip));var lp,dp=Object.freeze({__proto__:null}),fp=Object.freeze({__proto__:null});!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(lp||(lp={}));var pp=Object.freeze({__proto__:null,get AvatarState(){return lp}});const gp=up.vtoTimeout;export{rp as Errors,gp as VTO_TIMEOUT_MS,hp as initShop,dp as requests,fp as responses,pp as types};
3167
+ const zf=h("authIdTokenMaxAge")||300;let $f=null;function Gf(t=ht()){const e=it(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=it(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(g(n.getOptions(),null!=e?e:{}))return t;gl(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:Hf,persistence:[sf,jd,qd]}),r=h("authTokenSyncURL");if(r){const t=(s=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>zf)return;const r=null==e?void 0:e.token;$f!==r&&($f=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){I(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var s;const i=u("auth");return i&&pd(n,`http://${i}`),n}var Qf;Qf="Browser",st(new E("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:s,authDomain:i}=n.options;return((t,n)=>{vl(s&&!s.includes(":"),"invalid-api-key",{appName:t.name}),vl(!(null==i?void 0:i.includes(":")),"argument-error",{appName:t.name});const r={apiKey:s,authDomain:i,clientPlatform:Qf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ud(Qf)},o=new ld(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Il);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),st(new E("auth-internal",(t=>(t=>new Wf(t))(dd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),lt(qf,Kf,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Qf)),lt(qf,Kf,"esm2017");class Jf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Yf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Xf extends Error{constructor(){super("request timeout"),this.name="RequestTimeoutError"}}class Zf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class tp extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class ep extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}class np extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class rp extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}const sp="avatar not created";var ip=Object.freeze({__proto__:null,AvatarNotCreatedError:Jf,NoFramesFoundError:Yf,RequestTimeoutError:Xf,UserNotLoggedInError:Zf,NoColorwaySizeAssetsFoundError:tp,NoStylesFoundError:ep,RecommendedAvailableSizesError:np,BrandUserIdNotSetError:rp,AvatarNotCreated:sp});class op{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Gf(e),this.auth.setPersistence(jd)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Zf;return(await tl(dh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t,e){let n;const r=jh(lh(this.firestore,"users"),qh(new Sh("__name__"),"==",this.id)),s=setTimeout((()=>n()),e);return new Promise((e=>{n=rl(r,(async r=>{await t(r)&&(clearTimeout(s),n(),e(r.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Ud(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await Md(this.auth,t)}async confirmPasswordReset(t,e){await xd(this.auth,t,e)}}class ap{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=rl(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=ut(il.getInstance().firebase);this.firestore=_h(t),this.user=new op(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=jh(lh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return nl(jh(lh(this.firestore,t),...e))}async getDoc(t,e){const n=dh(this.firestore,t,e),r=await tl(n);return r.exists()?r.data():null}}const cp=t=>{if(t.code===dl)throw new Error("account has been disabled");throw new Error(t.message)};var up;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(up||(up={}));const hp={[up.ACROSS_BACK]:"Across back",[up.ACROSS_FRONT]:"Across front",[up.ACROSS_SHOULDER]:"Across shoulder",[up.ANKLE]:"Ankle",[up.ARMEYE]:"Armeye",[up.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[up.BACK_CROTCH_LENGTH]:"Back crotch length",[up.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[up.BELOW_KNEE]:"Below knee",[up.BICEP]:"Bicep",[up.BUST]:"Chest/Bust",[up.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[up.CALF]:"Calf",[up.CB_NECK_TO_WAIST]:"Cb neck to waist",[up.CB_NECK_TO_WRIST]:"Cb neck to wrist",[up.CF_NECK_TO_WAIST]:"Cf neck to waist",[up.ELBOW]:"Elbow",[up.FOREARM]:"Forearm",[up.FRONT_CROTCH_LENGTH]:"Front crotch length",[up.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[up.HIGH_HIP]:"High hip",[up.HSP_TO_ACROSS_BACK]:"Hsp to across back",[up.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[up.HSP_TO_BUST_POINT]:"Hsp to bust point",[up.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[up.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[up.INSEAM]:"Inseam",[up.KNEE]:"Knee",[up.LOW_HIP]:"Low hip",[up.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[up.MID_NECK]:"Mid neck",[up.NECK_AT_BASE]:"Neck at base",[up.SHOULDER_DROP]:"Shoulder drop",[up.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[up.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[up.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[up.THIGH]:"Thigh",[up.TOTAL_RISE_LENGTH]:"Total rise length",[up.UNDER_BUST]:"Under bust",[up.VERTICAL_TRUNK]:"Vertical trunk",[up.WAIST]:"Waist",[up.WRIST]:"Wrist"};var lp;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(lp||(lp={}));const dp={[lp.BLOUSES]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.COATS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.DRESSES]:[up.LOW_HIP,up.BUST,up.ACROSS_SHOULDER,up.WAIST],[lp.JACKETS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.PANTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.PUFFERS_AND_PARKAS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.SHORTS]:[up.LOW_HIP,up.WAIST,up.THIGH,up.INSEAM],[lp.SKIRTS]:[up.LOW_HIP,up.WAIST],[lp.SWEATERS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP],[lp.T_SHIRTS_AND_TANKS]:[up.BUST,up.ACROSS_SHOULDER,up.WAIST,up.LOW_HIP,up.HIGH_HIP]},fp={activewear:{leggings:lp.PANTS,joggers:lp.PANTS,sweatshirts:lp.SWEATERS},dresses:{a_line:lp.DRESSES,bodycon:lp.DRESSES,fit_and_flare:lp.DRESSES,knit:lp.DRESSES,shirt:lp.DRESSES,slip:lp.DRESSES,straight:lp.DRESSES,wrap:lp.DRESSES},jackets_and_coats:{denim_jackets:lp.JACKETS,parkas:lp.PUFFERS_AND_PARKAS,peacoats:lp.COATS,puffer_jackets:lp.PUFFERS_AND_PARKAS,raincoats:lp.COATS,rompers:lp.COATS,shackets:lp.JACKETS,trench_coats:lp.COATS},jeans:{bootcut:lp.PANTS,flared:lp.PANTS,mom:lp.PANTS,relaxed:lp.PANTS,skinny:lp.PANTS,slim:lp.PANTS,straight:lp.PANTS,tapered:lp.PANTS,wide_leg:lp.PANTS},jumpsuits_and_rompers:{boiler_suits:lp.DRESSES,denim:lp.DRESSES,jumpsuits:lp.DRESSES,overalls:lp.DRESSES,rompers:lp.DRESSES,unitards:lp.DRESSES},pants_and_shorts:{cigarette:lp.PANTS,culottes:lp.SHORTS,denim_shorts:lp.SHORTS,flared:lp.PANTS,joggers:lp.PANTS,leggings:lp.PANTS,skinny:lp.PANTS,wide_leg:lp.PANTS},skirts:{a_line_flared:lp.SKIRTS,denim:lp.SKIRTS,knit:lp.SKIRTS,pencil:lp.SKIRTS,pleated:lp.SKIRTS,skater:lp.SKIRTS,slip:lp.SKIRTS,wrap:lp.SKIRTS},suits_and_tailoring:{blazers:lp.JACKETS,suit_jackets:lp.JACKETS,suit_skirts:lp.SKIRTS,suit_trousers:lp.PANTS,suit_vests:lp.SWEATERS,trousers:lp.PANTS},sweaters:{cardigans:lp.SWEATERS,crewnecks:lp.SWEATERS,hoodies_and_zipups:lp.SWEATERS,sweatshirts:lp.SWEATERS,turtlenecks:lp.SWEATERS,v_necks:lp.SWEATERS},tops:{bodysuits:lp.BLOUSES,corsets_and_bustiers:lp.BLOUSES,polos:lp.T_SHIRTS_AND_TANKS,shirts_and_blouses:lp.BLOUSES,t_shirts:lp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:lp.T_SHIRTS_AND_TANKS}};class pp{static get endpoint(){return il.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"include"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class gp{constructor(t,e){this.brandId=t,this.firebase=e,il.getInstance().config}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}onInit(){return this.firebase.onInit()}async getRecommendedSizes(t){if(!this.isLoggedIn)throw new Zf;try{const e=await pp.Get(this.user,`/styles/${t}/recommendation`);return await e.json()}catch(t){if((null==t?void 0:t.error)===sp)throw new Jf;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await pp.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new tp;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t){var e;const n=await this.getColorwaySizeAssetFromSku(t),r=await this.getStyleCategory(n.style_id),s=(null===(e=fp[r.category])||void 0===e?void 0:e[r.sub_category])||null;return s?dp[s].map((t=>hp[t])):null}async getColorwaySizeAssets(t,e){const n=[qh("brand_id","==",this.brandId)];t&&n.push(qh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(qh("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return cp(t)}}async getStyleCategory(t){try{return await this.firebase.getDoc("style_categories",String(t))}catch(t){return cp(t)}}}const mp=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),il.getInstance().setEnv(e),new gp(t,new ap));var yp;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(yp||(yp={}));var vp=Object.freeze({__proto__:null,get AvatarState(){return yp}});export{ip as Errors,mp as initShop,t as requests,e as responses,vp as types};
3167
3168
  //# sourceMappingURL=index.min.js.map