@entropic-bond/firebase 1.13.5 → 1.13.7

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,4 +1,4 @@
1
- (function(Ee,Gt){typeof exports=="object"&&typeof module<"u"?Gt(exports):typeof define=="function"&&define.amd?define(["exports"],Gt):(Ee=typeof globalThis<"u"?globalThis:Ee||self,Gt(Ee["entropic-bond-firebase"]={}))})(this,function(Ee){"use strict";/**
1
+ (function(Le,un){typeof exports=="object"&&typeof module<"u"?un(exports):typeof define=="function"&&define.amd?define(["exports"],un):(Le=typeof globalThis<"u"?globalThis:Le||self,un(Le["entropic-bond-firebase"]={}))})(this,function(Le){"use strict";/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  *
@@ -28,7 +28,7 @@
28
28
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
29
29
  * See the License for the specific language governing permissions and
30
30
  * limitations under the License.
31
- */const Gt=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++]=s&63|128):(s&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},If=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((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],a=t[n++],c=((s&7)<<18|(i&63)<<12|(o&63)<<6|a&63)-65536;e[r++]=String.fromCharCode(55296+(c>>10)),e[r++]=String.fromCharCode(56320+(c&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},Qa={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:typeof atob=="function",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 s=0;s<t.length;s+=3){const i=t[s],o=s+1<t.length,a=o?t[s+1]:0,c=s+2<t.length,u=c?t[s+2]:0,l=i>>2,h=(i&3)<<4|a>>4;let d=(a&15)<<2|u>>6,f=u&63;c||(f=64,o||(d=64)),r.push(n[l],n[h],n[d],n[f])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Gt(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):If(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<t.length;){const i=n[t.charAt(s++)],a=s<t.length?n[t.charAt(s)]:0;++s;const u=s<t.length?n[t.charAt(s)]:64;++s;const h=s<t.length?n[t.charAt(s)]:64;if(++s,i==null||a==null||u==null||h==null)throw new wf;const d=i<<2|a>>4;if(r.push(d),u!==64){const f=a<<4&240|u>>2;if(r.push(f),h!==64){const E=u<<6&192|h;r.push(E)}}}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)}}};class wf extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Af=function(t){const e=Gt(t);return Qa.encodeByteArray(e,!0)},xr=function(t){return Af(t).replace(/\./g,"")},Ya=function(t){try{return Qa.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
31
+ */const un=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let s=n.charCodeAt(r);s<128?e[t++]=s:s<2048?(e[t++]=s>>6|192,e[t++]=s&63|128):(s&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=s>>18|240,e[t++]=s>>12&63|128,e[t++]=s>>6&63|128,e[t++]=s&63|128):(e[t++]=s>>12|224,e[t++]=s>>6&63|128,e[t++]=s&63|128)}return e},yf=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const s=n[t++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=n[t++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=n[t++],a=n[t++],c=n[t++],l=((s&7)<<18|(i&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{const i=n[t++],a=n[t++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|a&63)}}return e.join("")},za={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:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let s=0;s<n.length;s+=3){const i=n[s],a=s+1<n.length,c=a?n[s+1]:0,l=s+2<n.length,d=l?n[s+2]:0,p=i>>2,g=(i&3)<<4|c>>4;let v=(c&15)<<2|d>>6,R=d&63;l||(R=64,a||(v=64)),r.push(t[p],t[g],t[v],t[R])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(un(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):yf(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<n.length;){const i=t[n.charAt(s++)],c=s<n.length?t[n.charAt(s)]:0;++s;const d=s<n.length?t[n.charAt(s)]:64;++s;const g=s<n.length?t[n.charAt(s)]:64;if(++s,i==null||c==null||d==null||g==null)throw new vf;const v=i<<2|c>>4;if(r.push(v),d!==64){const R=c<<4&240|d>>2;if(r.push(R),g!==64){const C=d<<6&192|g;r.push(C)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class vf extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Ef=function(n){const e=un(n);return za.encodeByteArray(e,!0)},Gr=function(n){return Ef(n).replace(/\./g,"")},Ha=function(n){try{return za.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
32
32
  * @license
33
33
  * Copyright 2022 Google LLC
34
34
  *
@@ -43,7 +43,7 @@
43
43
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
44
44
  * See the License for the specific language governing permissions and
45
45
  * limitations under the License.
46
- */function Rf(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
46
+ */function Tf(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
47
47
  * @license
48
48
  * Copyright 2022 Google LLC
49
49
  *
@@ -58,7 +58,7 @@
58
58
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59
59
  * See the License for the specific language governing permissions and
60
60
  * limitations under the License.
61
- */const Pf=()=>Rf().__FIREBASE_DEFAULTS__,Sf=()=>{if(typeof process>"u"||typeof process.env>"u")return;const t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Cf=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&Ya(t[1]);return e&&JSON.parse(e)},Fr=()=>{try{return Pf()||Sf()||Cf()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Xa=t=>{var e,n;return(n=(e=Fr())===null||e===void 0?void 0:e.emulatorHosts)===null||n===void 0?void 0:n[t]},yi=t=>{const e=Xa(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]},Ja=()=>{var t;return(t=Fr())===null||t===void 0?void 0:t.config},Za=t=>{var e;return(e=Fr())===null||e===void 0?void 0:e[`_${t}`]};/**
61
+ */const wf=()=>Tf().__FIREBASE_DEFAULTS__,If=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Af=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&Ha(n[1]);return e&&JSON.parse(e)},Kr=()=>{try{return wf()||If()||Af()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Wa=n=>{var e,t;return(t=(e=Kr())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},wi=n=>{const e=Wa(n);if(!e)return;const t=e.lastIndexOf(":");if(t<=0||t+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(t+1),10);return e[0]==="["?[e.substring(1,t-1),r]:[e.substring(0,t),r]},Ga=()=>{var n;return(n=Kr())===null||n===void 0?void 0:n.config},Ka=n=>{var e;return(e=Kr())===null||e===void 0?void 0:e[`_${n}`]};/**
62
62
  * @license
63
63
  * Copyright 2017 Google LLC
64
64
  *
@@ -73,7 +73,7 @@
73
73
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
74
74
  * See the License for the specific language governing permissions and
75
75
  * limitations under the License.
76
- */class bf{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}}/**
76
+ */class Rf{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
77
77
  * @license
78
78
  * Copyright 2021 Google LLC
79
79
  *
@@ -88,7 +88,7 @@
88
88
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
89
89
  * See the License for the specific language governing permissions and
90
90
  * limitations under the License.
91
- */function ec(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={alg:"none",type:"JWT"},r=e||"demo-project",s=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/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[xr(JSON.stringify(n)),xr(JSON.stringify(o)),""].join(".")}/**
91
+ */function Qa(n,e){if(n.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const t={alg:"none",type:"JWT"},r=e||"demo-project",s=n.iat||0,i=n.sub||n.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const a=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:{}}},n);return[Gr(JSON.stringify(t)),Gr(JSON.stringify(a)),""].join(".")}/**
92
92
  * @license
93
93
  * Copyright 2017 Google LLC
94
94
  *
@@ -103,7 +103,7 @@
103
103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
104
104
  * See the License for the specific language governing permissions and
105
105
  * limitations under the License.
106
- */function ie(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function kf(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ie())}function Nf(){var t;const e=(t=Fr())===null||t===void 0?void 0:t.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function Df(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Of(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Vf(){const t=ie();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Lf(){try{return typeof indexedDB=="object"}catch{return!1}}function Mf(){return 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 i;e(((i=s.error)===null||i===void 0?void 0:i.message)||"")}}catch(n){e(n)}})}/**
106
+ */function Ee(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function bf(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ee())}function Pf(){var n;const e=(n=Kr())===null||n===void 0?void 0:n.forceEnvironment;if(e==="node")return!0;if(e==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function Sf(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Cf(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function kf(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Nf(){const n=Ee();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Df(){return!Pf()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function Of(){try{return typeof indexedDB=="object"}catch{return!1}}function Vf(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},s.onupgradeneeded=()=>{t=!1},s.onerror=()=>{var i;e(((i=s.error)===null||i===void 0?void 0:i.message)||"")}}catch(t){e(t)}})}/**
107
107
  * @license
108
108
  * Copyright 2017 Google LLC
109
109
  *
@@ -118,7 +118,7 @@
118
118
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
119
  * See the License for the specific language governing permissions and
120
120
  * limitations under the License.
121
- */const Uf="FirebaseError";class be extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Uf,Object.setPrototypeOf(this,be.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,kn.prototype.create)}}class kn{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?xf(i,r):"Error",a=`${this.serviceName}: ${o} (${s}).`;return new be(s,a,r)}}function xf(t,e){return t.replace(Ff,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Ff=/\{\$([^}]+)}/g;function Bf(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Br(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 i=t[s],o=e[s];if(tc(i)&&tc(o)){if(!Br(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function tc(t){return t!==null&&typeof t=="object"}/**
121
+ */const Lf="FirebaseError";class $e extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=Lf,Object.setPrototypeOf(this,$e.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,zn.prototype.create)}}class zn{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},s=`${this.service}/${e}`,i=this.errors[e],a=i?Mf(i,r):"Error",c=`${this.serviceName}: ${a} (${s}).`;return new $e(s,c,r)}}function Mf(n,e){return n.replace(Uf,(t,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const Uf=/\{\$([^}]+)}/g;function xf(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Qr(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const s of t){if(!r.includes(s))return!1;const i=n[s],a=e[s];if(Ya(i)&&Ya(a)){if(!Qr(i,a))return!1}else if(i!==a)return!1}for(const s of r)if(!t.includes(s))return!1;return!0}function Ya(n){return n!==null&&typeof n=="object"}/**
122
122
  * @license
123
123
  * Copyright 2017 Google LLC
124
124
  *
@@ -133,7 +133,7 @@
133
133
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
134
134
  * See the License for the specific language governing permissions and
135
135
  * limitations under the License.
136
- */function Nn(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Dn(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function On(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function qf(t,e){const n=new $f(t,e);return n.subscribe.bind(n)}class $f{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");jf(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=Ei),s.error===void 0&&(s.error=Ei),s.complete===void 0&&(s.complete=Ei);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function jf(t,e){if(typeof t!="object"||t===null)return!1;for(const n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function Ei(){}/**
136
+ */function Hn(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Wn(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function Gn(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function Ff(n,e){const t=new Bf(n,e);return t.subscribe.bind(t)}class Bf{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(r=>{this.error(r)})}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,r){let s;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");jf(e,["next","error","complete"])?s=e:s={next:e,error:t,complete:r},s.next===void 0&&(s.next=Ii),s.error===void 0&&(s.error=Ii),s.complete===void 0&&(s.complete=Ii);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&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(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function jf(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Ii(){}/**
137
137
  * @license
138
138
  * Copyright 2021 Google LLC
139
139
  *
@@ -148,7 +148,7 @@
148
148
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
149
149
  * See the License for the specific language governing permissions and
150
150
  * limitations under the License.
151
- */function M(t){return t&&t._delegate?t._delegate:t}class Ke{constructor(e,n,r){this.name=e,this.instanceFactory=n,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
151
+ */function Y(n){return n&&n._delegate?n._delegate:n}class ct{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}/**
152
152
  * @license
153
153
  * Copyright 2019 Google LLC
154
154
  *
@@ -163,7 +163,7 @@
163
163
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164
164
  * See the License for the specific language governing permissions and
165
165
  * limitations under the License.
166
- */const Pt="[DEFAULT]";/**
166
+ */const jt="[DEFAULT]";/**
167
167
  * @license
168
168
  * Copyright 2019 Google LLC
169
169
  *
@@ -178,7 +178,7 @@
178
178
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
179
  * See the License for the specific language governing permissions and
180
180
  * limitations under the License.
181
- */class zf{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){const r=new bf;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){var n;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(n=e==null?void 0:e.optional)!==null&&n!==void 0?n:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(s)return null;throw i}else{if(s)return null;throw Error(`Service ${this.name} is not available`)}}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(Wf(e))try{this.getOrInitializeService({instanceIdentifier:Pt})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=Pt){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(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Pt){return this.instances.has(e)}getOptions(e=Pt){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(i);r===a&&o.resolve(s)}return s}onInit(e,n){var r;const s=this.normalizeInstanceIdentifier(n),i=(r=this.onInitCallbacks.get(s))!==null&&r!==void 0?r:new Set;i.add(e),this.onInitCallbacks.set(s,i);const o=this.instances.get(s);return o&&e(o,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Hf(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Pt){return this.component?this.component.multipleInstances?e:Pt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function Hf(t){return t===Pt?void 0:t}function Wf(t){return t.instantiationMode==="EAGER"}/**
181
+ */class qf{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 r=new Rf;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(i){if(s)return null;throw i}else{if(s)return null;throw Error(`Service ${this.name} is not available`)}}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(zf(e))try{this.getOrInitializeService({instanceIdentifier:jt})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(t);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}catch{}}}}clearInstance(e=jt){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(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=jt){return this.instances.has(e)}getOptions(e=jt){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const s=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[i,a]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(i);r===c&&a.resolve(s)}return s}onInit(e,t){var r;const s=this.normalizeInstanceIdentifier(t),i=(r=this.onInitCallbacks.get(s))!==null&&r!==void 0?r:new Set;i.add(e),this.onInitCallbacks.set(s,i);const a=this.instances.get(s);return a&&e(a,s),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const s of r)try{s(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:$f(e),options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=jt){return this.component?this.component.multipleInstances?e:jt:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function $f(n){return n===jt?void 0:n}function zf(n){return n.instantiationMode==="EAGER"}/**
182
182
  * @license
183
183
  * Copyright 2019 Google LLC
184
184
  *
@@ -193,7 +193,7 @@
193
193
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
194
194
  * See the License for the specific language governing permissions and
195
195
  * limitations under the License.
196
- */class Gf{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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 n=new zf(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
196
+ */class Hf{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 qf(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
197
197
  * @license
198
198
  * Copyright 2017 Google LLC
199
199
  *
@@ -208,7 +208,7 @@
208
208
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
209
209
  * See the License for the specific language governing permissions and
210
210
  * limitations under the License.
211
- */var D;(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"})(D||(D={}));const Kf={debug:D.DEBUG,verbose:D.VERBOSE,info:D.INFO,warn:D.WARN,error:D.ERROR,silent:D.SILENT},Qf=D.INFO,Yf={[D.DEBUG]:"log",[D.VERBOSE]:"log",[D.INFO]:"info",[D.WARN]:"warn",[D.ERROR]:"error"},Xf=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),s=Yf[e];if(s)console[s](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class vi{constructor(e){this.name=e,this._logLevel=Qf,this._logHandler=Xf,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in D))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Kf[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")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,D.DEBUG,...e),this._logHandler(this,D.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,D.VERBOSE,...e),this._logHandler(this,D.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,D.INFO,...e),this._logHandler(this,D.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,D.WARN,...e),this._logHandler(this,D.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,D.ERROR,...e),this._logHandler(this,D.ERROR,...e)}}const Jf=(t,e)=>e.some(n=>t instanceof n);let nc,rc;function Zf(){return nc||(nc=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ep(){return rc||(rc=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const sc=new WeakMap,Ti=new WeakMap,ic=new WeakMap,Ii=new WeakMap,wi=new WeakMap;function tp(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n(ct(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&sc.set(n,t)}).catch(()=>{}),wi.set(e,t),e}function np(t){if(Ti.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});Ti.set(t,e)}let Ai={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Ti.get(t);if(e==="objectStoreNames")return t.objectStoreNames||ic.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return ct(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};function rp(t){Ai=t(Ai)}function sp(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(Ri(this),e,...n);return ic.set(r,e.sort?e.sort():[e]),ct(r)}:ep().includes(t)?function(...e){return t.apply(Ri(this),e),ct(sc.get(this))}:function(...e){return ct(t.apply(Ri(this),e))}}function ip(t){return typeof t=="function"?sp(t):(t instanceof IDBTransaction&&np(t),Jf(t,Zf())?new Proxy(t,Ai):t)}function ct(t){if(t instanceof IDBRequest)return tp(t);if(Ii.has(t))return Ii.get(t);const e=ip(t);return e!==t&&(Ii.set(t,e),wi.set(e,t)),e}const Ri=t=>wi.get(t);function op(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=ct(o);return r&&o.addEventListener("upgradeneeded",c=>{r(ct(o.result),c.oldVersion,c.newVersion,ct(o.transaction),c)}),n&&o.addEventListener("blocked",c=>n(c.oldVersion,c.newVersion,c)),a.then(c=>{i&&c.addEventListener("close",()=>i()),s&&c.addEventListener("versionchange",u=>s(u.oldVersion,u.newVersion,u))}).catch(()=>{}),a}const ap=["get","getKey","getAll","getAllKeys","count"],cp=["put","add","delete","clear"],Pi=new Map;function oc(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Pi.get(e))return Pi.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=cp.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||ap.includes(n)))return;const i=async function(o,...a){const c=this.transaction(o,s?"readwrite":"readonly");let u=c.store;return r&&(u=u.index(a.shift())),(await Promise.all([u[n](...a),s&&c.done]))[0]};return Pi.set(e,i),i}rp(t=>({...t,get:(e,n,r)=>oc(e,n)||t.get(e,n,r),has:(e,n)=>!!oc(e,n)||t.has(e,n)}));/**
211
+ */var W;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(W||(W={}));const Wf={debug:W.DEBUG,verbose:W.VERBOSE,info:W.INFO,warn:W.WARN,error:W.ERROR,silent:W.SILENT},Gf=W.INFO,Kf={[W.DEBUG]:"log",[W.VERBOSE]:"log",[W.INFO]:"info",[W.WARN]:"warn",[W.ERROR]:"error"},Qf=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),s=Kf[e];if(s)console[s](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Ai{constructor(e){this.name=e,this._logLevel=Gf,this._logHandler=Qf,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in W))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Wf[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")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,W.DEBUG,...e),this._logHandler(this,W.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,W.VERBOSE,...e),this._logHandler(this,W.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,W.INFO,...e),this._logHandler(this,W.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,W.WARN,...e),this._logHandler(this,W.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,W.ERROR,...e),this._logHandler(this,W.ERROR,...e)}}const Yf=(n,e)=>e.some(t=>n instanceof t);let Xa,Ja;function Xf(){return Xa||(Xa=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Jf(){return Ja||(Ja=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Za=new WeakMap,Ri=new WeakMap,ec=new WeakMap,bi=new WeakMap,Pi=new WeakMap;function Zf(n){const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("success",i),n.removeEventListener("error",a)},i=()=>{t(wt(n.result)),s()},a=()=>{r(n.error),s()};n.addEventListener("success",i),n.addEventListener("error",a)});return e.then(t=>{t instanceof IDBCursor&&Za.set(t,n)}).catch(()=>{}),Pi.set(e,n),e}function ep(n){if(Ri.has(n))return;const e=new Promise((t,r)=>{const s=()=>{n.removeEventListener("complete",i),n.removeEventListener("error",a),n.removeEventListener("abort",a)},i=()=>{t(),s()},a=()=>{r(n.error||new DOMException("AbortError","AbortError")),s()};n.addEventListener("complete",i),n.addEventListener("error",a),n.addEventListener("abort",a)});Ri.set(n,e)}let Si={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Ri.get(n);if(e==="objectStoreNames")return n.objectStoreNames||ec.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return wt(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function tp(n){Si=n(Si)}function np(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Ci(this),e,...t);return ec.set(r,e.sort?e.sort():[e]),wt(r)}:Jf().includes(n)?function(...e){return n.apply(Ci(this),e),wt(Za.get(this))}:function(...e){return wt(n.apply(Ci(this),e))}}function rp(n){return typeof n=="function"?np(n):(n instanceof IDBTransaction&&ep(n),Yf(n,Xf())?new Proxy(n,Si):n)}function wt(n){if(n instanceof IDBRequest)return Zf(n);if(bi.has(n))return bi.get(n);const e=rp(n);return e!==n&&(bi.set(n,e),Pi.set(e,n)),e}const Ci=n=>Pi.get(n);function sp(n,e,{blocked:t,upgrade:r,blocking:s,terminated:i}={}){const a=indexedDB.open(n,e),c=wt(a);return r&&a.addEventListener("upgradeneeded",l=>{r(wt(a.result),l.oldVersion,l.newVersion,wt(a.transaction),l)}),t&&a.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{i&&l.addEventListener("close",()=>i()),s&&l.addEventListener("versionchange",d=>s(d.oldVersion,d.newVersion,d))}).catch(()=>{}),c}const ip=["get","getKey","getAll","getAllKeys","count"],op=["put","add","delete","clear"],ki=new Map;function tc(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(ki.get(e))return ki.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,s=op.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(s||ip.includes(t)))return;const i=async function(a,...c){const l=this.transaction(a,s?"readwrite":"readonly");let d=l.store;return r&&(d=d.index(c.shift())),(await Promise.all([d[t](...c),s&&l.done]))[0]};return ki.set(e,i),i}tp(n=>({...n,get:(e,t,r)=>tc(e,t)||n.get(e,t,r),has:(e,t)=>!!tc(e,t)||n.has(e,t)}));/**
212
212
  * @license
213
213
  * Copyright 2019 Google LLC
214
214
  *
@@ -223,7 +223,7 @@
223
223
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
224
224
  * See the License for the specific language governing permissions and
225
225
  * limitations under the License.
226
- */class up{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(lp(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function lp(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Si="@firebase/app",ac="0.9.23";/**
226
+ */class ap{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(cp(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function cp(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Ni="@firebase/app",nc="0.10.11";/**
227
227
  * @license
228
228
  * Copyright 2019 Google LLC
229
229
  *
@@ -238,7 +238,7 @@
238
238
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
239
239
  * See the License for the specific language governing permissions and
240
240
  * limitations under the License.
241
- */const St=new vi("@firebase/app"),hp="@firebase/app-compat",dp="@firebase/analytics-compat",fp="@firebase/analytics",pp="@firebase/app-check-compat",mp="@firebase/app-check",gp="@firebase/auth",_p="@firebase/auth-compat",yp="@firebase/database",Ep="@firebase/database-compat",vp="@firebase/functions",Tp="@firebase/functions-compat",Ip="@firebase/installations",wp="@firebase/installations-compat",Ap="@firebase/messaging",Rp="@firebase/messaging-compat",Pp="@firebase/performance",Sp="@firebase/performance-compat",Cp="@firebase/remote-config",bp="@firebase/remote-config-compat",kp="@firebase/storage",Np="@firebase/storage-compat",Dp="@firebase/firestore",Op="@firebase/firestore-compat",Vp="firebase",Lp="10.6.0";/**
241
+ */const ut=new Ai("@firebase/app"),up="@firebase/app-compat",lp="@firebase/analytics-compat",hp="@firebase/analytics",dp="@firebase/app-check-compat",fp="@firebase/app-check",pp="@firebase/auth",mp="@firebase/auth-compat",gp="@firebase/database",_p="@firebase/database-compat",yp="@firebase/functions",vp="@firebase/functions-compat",Ep="@firebase/installations",Tp="@firebase/installations-compat",wp="@firebase/messaging",Ip="@firebase/messaging-compat",Ap="@firebase/performance",Rp="@firebase/performance-compat",bp="@firebase/remote-config",Pp="@firebase/remote-config-compat",Sp="@firebase/storage",Cp="@firebase/storage-compat",kp="@firebase/firestore",Np="@firebase/vertexai-preview",Dp="@firebase/firestore-compat",Op="firebase",Vp="10.13.2";/**
242
242
  * @license
243
243
  * Copyright 2019 Google LLC
244
244
  *
@@ -253,7 +253,7 @@
253
253
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
254
254
  * See the License for the specific language governing permissions and
255
255
  * limitations under the License.
256
- */const Ci="[DEFAULT]",Mp={[Si]:"fire-core",[hp]:"fire-core-compat",[fp]:"fire-analytics",[dp]:"fire-analytics-compat",[mp]:"fire-app-check",[pp]:"fire-app-check-compat",[gp]:"fire-auth",[_p]:"fire-auth-compat",[yp]:"fire-rtdb",[Ep]:"fire-rtdb-compat",[vp]:"fire-fn",[Tp]:"fire-fn-compat",[Ip]:"fire-iid",[wp]:"fire-iid-compat",[Ap]:"fire-fcm",[Rp]:"fire-fcm-compat",[Pp]:"fire-perf",[Sp]:"fire-perf-compat",[Cp]:"fire-rc",[bp]:"fire-rc-compat",[kp]:"fire-gcs",[Np]:"fire-gcs-compat",[Dp]:"fire-fst",[Op]:"fire-fst-compat","fire-js":"fire-js",[Vp]:"fire-js-all"};/**
256
+ */const Di="[DEFAULT]",Lp={[Ni]:"fire-core",[up]:"fire-core-compat",[hp]:"fire-analytics",[lp]:"fire-analytics-compat",[fp]:"fire-app-check",[dp]:"fire-app-check-compat",[pp]:"fire-auth",[mp]:"fire-auth-compat",[gp]:"fire-rtdb",[_p]:"fire-rtdb-compat",[yp]:"fire-fn",[vp]:"fire-fn-compat",[Ep]:"fire-iid",[Tp]:"fire-iid-compat",[wp]:"fire-fcm",[Ip]:"fire-fcm-compat",[Ap]:"fire-perf",[Rp]:"fire-perf-compat",[bp]:"fire-rc",[Pp]:"fire-rc-compat",[Sp]:"fire-gcs",[Cp]:"fire-gcs-compat",[kp]:"fire-fst",[Dp]:"fire-fst-compat",[Np]:"fire-vertex","fire-js":"fire-js",[Op]:"fire-js-all"};/**
257
257
  * @license
258
258
  * Copyright 2019 Google LLC
259
259
  *
@@ -268,7 +268,7 @@
268
268
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
269
269
  * See the License for the specific language governing permissions and
270
270
  * limitations under the License.
271
- */const qr=new Map,bi=new Map;function Up(t,e){try{t.container.addComponent(e)}catch(n){St.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function ut(t){const e=t.name;if(bi.has(e))return St.debug(`There were multiple attempts to register component ${e}.`),!1;bi.set(e,t);for(const n of qr.values())Up(n,t);return!0}function Vn(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}/**
271
+ */const Yr=new Map,Mp=new Map,Oi=new Map;function rc(n,e){try{n.container.addComponent(e)}catch(t){ut.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function It(n){const e=n.name;if(Oi.has(e))return ut.debug(`There were multiple attempts to register component ${e}.`),!1;Oi.set(e,n);for(const t of Yr.values())rc(t,n);for(const t of Mp.values())rc(t,n);return!0}function Kn(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function Fe(n){return n.settings!==void 0}/**
272
272
  * @license
273
273
  * Copyright 2019 Google LLC
274
274
  *
@@ -283,7 +283,7 @@
283
283
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
284
284
  * See the License for the specific language governing permissions and
285
285
  * limitations under the License.
286
- */const xp={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."},lt=new kn("app","Firebase",xp);/**
286
+ */const Up={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},At=new zn("app","Firebase",Up);/**
287
287
  * @license
288
288
  * Copyright 2019 Google LLC
289
289
  *
@@ -298,7 +298,7 @@
298
298
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
299
299
  * See the License for the specific language governing permissions and
300
300
  * limitations under the License.
301
- */class Fp{constructor(e,n,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},n),this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Ke("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 lt.create("app-deleted",{appName:this._name})}}/**
301
+ */class xp{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new ct("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 At.create("app-deleted",{appName:this._name})}}/**
302
302
  * @license
303
303
  * Copyright 2019 Google LLC
304
304
  *
@@ -313,7 +313,7 @@
313
313
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
314
314
  * See the License for the specific language governing permissions and
315
315
  * limitations under the License.
316
- */const Ct=Lp;function cc(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Ci,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw lt.create("bad-app-name",{appName:String(s)});if(n||(n=Ja()),!n)throw lt.create("no-options");const i=qr.get(s);if(i){if(Br(n,i.options)&&Br(r,i.config))return i;throw lt.create("duplicate-app",{appName:s})}const o=new Gf(s);for(const c of bi.values())o.addComponent(c);const a=new Fp(n,r,o);return qr.set(s,a),a}function $r(t=Ci){const e=qr.get(t);if(!e&&t===Ci&&Ja())return cc();if(!e)throw lt.create("no-app",{appName:t});return e}function Ae(t,e,n){var r;let s=(r=Mp[t])!==null&&r!==void 0?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const a=[`Unable to register library "${s}" with version "${e}":`];i&&a.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&a.push("and"),o&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),St.warn(a.join(" "));return}ut(new Ke(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
316
+ */const qt=Vp;function sc(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:Di,automaticDataCollectionEnabled:!1},e),s=r.name;if(typeof s!="string"||!s)throw At.create("bad-app-name",{appName:String(s)});if(t||(t=Ga()),!t)throw At.create("no-options");const i=Yr.get(s);if(i){if(Qr(t,i.options)&&Qr(r,i.config))return i;throw At.create("duplicate-app",{appName:s})}const a=new Hf(s);for(const l of Oi.values())a.addComponent(l);const c=new xp(t,r,a);return Yr.set(s,c),c}function Xr(n=Di){const e=Yr.get(n);if(!e&&n===Di&&Ga())return sc();if(!e)throw At.create("no-app",{appName:n});return e}function Be(n,e,t){var r;let s=(r=Lp[n])!==null&&r!==void 0?r:n;t&&(s+=`-${t}`);const i=s.match(/\s|\//),a=e.match(/\s|\//);if(i||a){const c=[`Unable to register library "${s}" with version "${e}":`];i&&c.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&a&&c.push("and"),a&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ut.warn(c.join(" "));return}It(new ct(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
317
317
  * @license
318
318
  * Copyright 2021 Google LLC
319
319
  *
@@ -328,7 +328,7 @@
328
328
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
329
  * See the License for the specific language governing permissions and
330
330
  * limitations under the License.
331
- */const Bp="firebase-heartbeat-database",qp=1,Ln="firebase-heartbeat-store";let ki=null;function uc(){return ki||(ki=op(Bp,qp,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Ln)}}}).catch(t=>{throw lt.create("idb-open",{originalErrorMessage:t.message})})),ki}async function $p(t){try{return await(await uc()).transaction(Ln).objectStore(Ln).get(hc(t))}catch(e){if(e instanceof be)St.warn(e.message);else{const n=lt.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});St.warn(n.message)}}}async function lc(t,e){try{const r=(await uc()).transaction(Ln,"readwrite");await r.objectStore(Ln).put(e,hc(t)),await r.done}catch(n){if(n instanceof be)St.warn(n.message);else{const r=lt.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});St.warn(r.message)}}}function hc(t){return`${t.name}!${t.options.appId}`}/**
331
+ */const Fp="firebase-heartbeat-database",Bp=1,Qn="firebase-heartbeat-store";let Vi=null;function ic(){return Vi||(Vi=sp(Fp,Bp,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(Qn)}catch(t){console.warn(t)}}}}).catch(n=>{throw At.create("idb-open",{originalErrorMessage:n.message})})),Vi}async function jp(n){try{const t=(await ic()).transaction(Qn),r=await t.objectStore(Qn).get(ac(n));return await t.done,r}catch(e){if(e instanceof $e)ut.warn(e.message);else{const t=At.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});ut.warn(t.message)}}}async function oc(n,e){try{const r=(await ic()).transaction(Qn,"readwrite");await r.objectStore(Qn).put(e,ac(n)),await r.done}catch(t){if(t instanceof $e)ut.warn(t.message);else{const r=At.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});ut.warn(r.message)}}}function ac(n){return`${n.name}!${n.options.appId}`}/**
332
332
  * @license
333
333
  * Copyright 2021 Google LLC
334
334
  *
@@ -343,7 +343,7 @@
343
343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
344
344
  * See the License for the specific language governing permissions and
345
345
  * limitations under the License.
346
- */const jp=1024,zp=30*24*60*60*1e3;class Hp{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new Gp(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e;const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=dc();if(((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise),!(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some(i=>i.date===s)))return this._heartbeatsCache.heartbeats.push({date:s,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(i=>{const o=new Date(i.date).valueOf();return Date.now()-o<=zp}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){var e;if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=dc(),{heartbeatsToSend:r,unsentEntries:s}=Wp(this._heartbeatsCache.heartbeats),i=xr(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}}function dc(){return new Date().toISOString().substring(0,10)}function Wp(t,e=jp){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),fc(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),fc(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class Gp{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Lf()?Mf().then(()=>!0).catch(()=>!1):!1}async read(){return await this._canUseIndexedDBPromise?await $p(this.app)||{heartbeats:[]}:{heartbeats:[]}}async overwrite(e){var n;if(await this._canUseIndexedDBPromise){const s=await this.read();return lc(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var n;if(await this._canUseIndexedDBPromise){const s=await this.read();return lc(this.app,{lastSentHeartbeatDate:(n=e.lastSentHeartbeatDate)!==null&&n!==void 0?n:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function fc(t){return xr(JSON.stringify({version:2,heartbeats:t})).length}/**
346
+ */const qp=1024,$p=30*24*60*60*1e3;class zp{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Wp(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=cc();return((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((t=this._heartbeatsCache)===null||t===void 0?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(a=>a.date===i)?void 0:(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(a=>{const c=new Date(a.date).valueOf();return Date.now()-c<=$p}),this._storage.overwrite(this._heartbeatsCache))}catch(r){ut.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)===null||e===void 0?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const t=cc(),{heartbeatsToSend:r,unsentEntries:s}=Hp(this._heartbeatsCache.heartbeats),i=Gr(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=t,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(t){return ut.warn(t),""}}}function cc(){return new Date().toISOString().substring(0,10)}function Hp(n,e=qp){const t=[];let r=n.slice();for(const s of n){const i=t.find(a=>a.agent===s.agent);if(i){if(i.dates.push(s.date),uc(t)>e){i.dates.pop();break}}else if(t.push({agent:s.agent,dates:[s.date]}),uc(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class Wp{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Of()?Vf().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const t=await jp(this.app);return t!=null&&t.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return oc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return oc(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function uc(n){return Gr(JSON.stringify({version:2,heartbeats:n})).length}/**
347
347
  * @license
348
348
  * Copyright 2019 Google LLC
349
349
  *
@@ -358,15 +358,29 @@
358
358
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
359
359
  * See the License for the specific language governing permissions and
360
360
  * limitations under the License.
361
- */function Kp(t){ut(new Ke("platform-logger",e=>new up(e),"PRIVATE")),ut(new Ke("heartbeat",e=>new Hp(e),"PRIVATE")),Ae(Si,ac,t),Ae(Si,ac,"esm2017"),Ae("fire-js","")}Kp("");var Qp=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},y,Ni=Ni||{},R=Qp||self;function jr(t){var e=typeof t;return e=e!="object"?e:t?Array.isArray(t)?"array":e:"null",e=="array"||e=="object"&&typeof t.length=="number"}function Mn(t){var e=typeof t;return e=="object"&&t!=null||e=="function"}function Yp(t){return Object.prototype.hasOwnProperty.call(t,Di)&&t[Di]||(t[Di]=++Xp)}var Di="closure_uid_"+(1e9*Math.random()>>>0),Xp=0;function Jp(t,e,n){return t.call.apply(t.bind,arguments)}function Zp(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var s=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(s,r),t.apply(e,s)}}return function(){return t.apply(e,arguments)}}function oe(t,e,n){return Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?oe=Jp:oe=Zp,oe.apply(null,arguments)}function zr(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),t.apply(this,r)}}function Y(t,e){function n(){}n.prototype=e.prototype,t.$=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.ac=function(r,s,i){for(var o=Array(arguments.length-2),a=2;a<arguments.length;a++)o[a-2]=arguments[a];return e.prototype[s].apply(r,o)}}function ht(){this.s=this.s,this.o=this.o}var em=0;ht.prototype.s=!1,ht.prototype.sa=function(){!this.s&&(this.s=!0,this.N(),em!=0)&&Yp(this)},ht.prototype.N=function(){if(this.o)for(;this.o.length;)this.o.shift()()};const pc=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(typeof t=="string")return typeof e!="string"||e.length!=1?-1:t.indexOf(e,0);for(let n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Oi(t){const e=t.length;if(0<e){const n=Array(e);for(let r=0;r<e;r++)n[r]=t[r];return n}return[]}function mc(t,e){for(let n=1;n<arguments.length;n++){const r=arguments[n];if(jr(r)){const s=t.length||0,i=r.length||0;t.length=s+i;for(let o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function ae(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ae.prototype.h=function(){this.defaultPrevented=!0};var tm=function(){if(!R.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{R.addEventListener("test",()=>{},e),R.removeEventListener("test",()=>{},e)}catch{}return t}();function Un(t){return/^[\s\xa0]*$/.test(t)}function Hr(){var t=R.navigator;return t&&(t=t.userAgent)?t:""}function Le(t){return Hr().indexOf(t)!=-1}function Vi(t){return Vi[" "](t),t}Vi[" "]=function(){};function nm(t,e){var n=Km;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}var rm=Le("Opera"),Kt=Le("Trident")||Le("MSIE"),gc=Le("Edge"),Li=gc||Kt,_c=Le("Gecko")&&!(Hr().toLowerCase().indexOf("webkit")!=-1&&!Le("Edge"))&&!(Le("Trident")||Le("MSIE"))&&!Le("Edge"),sm=Hr().toLowerCase().indexOf("webkit")!=-1&&!Le("Edge");function yc(){var t=R.document;return t?t.documentMode:void 0}var Mi;e:{var Ui="",xi=function(){var t=Hr();if(_c)return/rv:([^\);]+)(\)|;)/.exec(t);if(gc)return/Edge\/([\d\.]+)/.exec(t);if(Kt)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t);if(sm)return/WebKit\/(\S+)/.exec(t);if(rm)return/(?:Version)[ \/]?(\S+)/.exec(t)}();if(xi&&(Ui=xi?xi[1]:""),Kt){var Fi=yc();if(Fi!=null&&Fi>parseFloat(Ui)){Mi=String(Fi);break e}}Mi=Ui}var Bi;if(R.document&&Kt){var Ec=yc();Bi=Ec||parseInt(Mi,10)||void 0}else Bi=void 0;var im=Bi;function xn(t,e){if(ae.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(_c){e:{try{Vi(e.nodeName);var s=!0;break e}catch{}s=!1}s||(e=null)}}else n=="mouseover"?e=t.fromElement:n=="mouseout"&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=r.clientX!==void 0?r.clientX:r.pageX,this.clientY=r.clientY!==void 0?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=t.clientX!==void 0?t.clientX:t.pageX,this.clientY=t.clientY!==void 0?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=typeof t.pointerType=="string"?t.pointerType:om[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&xn.$.h.call(this)}}Y(xn,ae);var om={2:"touch",3:"pen",4:"mouse"};xn.prototype.h=function(){xn.$.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var Fn="closure_listenable_"+(1e6*Math.random()|0),am=0;function cm(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.la=s,this.key=++am,this.fa=this.ia=!1}function Wr(t){t.fa=!0,t.listener=null,t.proxy=null,t.src=null,t.la=null}function qi(t,e,n){for(const r in t)e.call(n,t[r],r,t)}function um(t,e){for(const n in t)e.call(void 0,t[n],n,t)}function vc(t){const e={};for(const n in t)e[n]=t[n];return e}const Tc="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ic(t,e){let n,r;for(let s=1;s<arguments.length;s++){r=arguments[s];for(n in r)t[n]=r[n];for(let i=0;i<Tc.length;i++)n=Tc[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Gr(t){this.src=t,this.g={},this.h=0}Gr.prototype.add=function(t,e,n,r,s){var i=t.toString();t=this.g[i],t||(t=this.g[i]=[],this.h++);var o=ji(t,e,r,s);return-1<o?(e=t[o],n||(e.ia=!1)):(e=new cm(e,this.src,i,!!r,s),e.ia=n,t.push(e)),e};function $i(t,e){var n=e.type;if(n in t.g){var r=t.g[n],s=pc(r,e),i;(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(Wr(e),t.g[n].length==0&&(delete t.g[n],t.h--))}}function ji(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.fa&&i.listener==e&&i.capture==!!n&&i.la==r)return s}return-1}var zi="closure_lm_"+(1e6*Math.random()|0),Hi={};function wc(t,e,n,r,s){if(r&&r.once)return Rc(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)wc(t,e[i],n,r,s);return null}return n=Qi(n),t&&t[Fn]?t.O(e,n,Mn(r)?!!r.capture:!!r,s):Ac(t,e,n,!1,r,s)}function Ac(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=Mn(s)?!!s.capture:!!s,a=Gi(t);if(a||(t[zi]=a=new Gr(t)),n=a.add(e,n,r,o,i),n.proxy)return n;if(r=lm(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)tm||(s=o),s===void 0&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Sc(e.toString()),r);else if(t.addListener&&t.removeListener)t.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function lm(){function t(n){return e.call(t.src,t.listener,n)}const e=hm;return t}function Rc(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)Rc(t,e[i],n,r,s);return null}return n=Qi(n),t&&t[Fn]?t.P(e,n,Mn(r)?!!r.capture:!!r,s):Ac(t,e,n,!0,r,s)}function Pc(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Pc(t,e[i],n,r,s);else r=Mn(r)?!!r.capture:!!r,n=Qi(n),t&&t[Fn]?(t=t.i,e=String(e).toString(),e in t.g&&(i=t.g[e],n=ji(i,n,r,s),-1<n&&(Wr(i[n]),Array.prototype.splice.call(i,n,1),i.length==0&&(delete t.g[e],t.h--)))):t&&(t=Gi(t))&&(e=t.g[e.toString()],t=-1,e&&(t=ji(e,n,r,s)),(n=-1<t?e[t]:null)&&Wi(n))}function Wi(t){if(typeof t!="number"&&t&&!t.fa){var e=t.src;if(e&&e[Fn])$i(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Sc(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Gi(e))?($i(n,t),n.h==0&&(n.src=null,e[zi]=null)):Wr(t)}}}function Sc(t){return t in Hi?Hi[t]:Hi[t]="on"+t}function hm(t,e){if(t.fa)t=!0;else{e=new xn(e,this);var n=t.listener,r=t.la||t.src;t.ia&&Wi(t),t=n.call(r,e)}return t}function Gi(t){return t=t[zi],t instanceof Gr?t:null}var Ki="__closure_events_fn_"+(1e9*Math.random()>>>0);function Qi(t){return typeof t=="function"?t:(t[Ki]||(t[Ki]=function(e){return t.handleEvent(e)}),t[Ki])}function X(){ht.call(this),this.i=new Gr(this),this.S=this,this.J=null}Y(X,ht),X.prototype[Fn]=!0,X.prototype.removeEventListener=function(t,e,n,r){Pc(this,t,e,n,r)};function Z(t,e){var n,r=t.J;if(r)for(n=[];r;r=r.J)n.push(r);if(t=t.S,r=e.type||e,typeof e=="string")e=new ae(e,t);else if(e instanceof ae)e.target=e.target||t;else{var s=e;e=new ae(r,t),Ic(e,s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=Kr(o,r,!0,e)&&s}if(o=e.g=t,s=Kr(o,r,!0,e)&&s,s=Kr(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)o=e.g=n[i],s=Kr(o,r,!1,e)&&s}X.prototype.N=function(){if(X.$.N.call(this),this.i){var t=this.i,e;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)Wr(n[r]);delete t.g[e],t.h--}}this.J=null},X.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},X.prototype.P=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};function Kr(t,e,n,r){if(e=t.i.g[String(e)],!e)return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.fa&&o.capture==n){var a=o.listener,c=o.la||o.src;o.ia&&$i(t.i,o),s=a.call(c,r)!==!1&&s}}return s&&!r.defaultPrevented}var Yi=R.JSON.stringify;class dm{constructor(e,n){this.i=e,this.j=n,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function fm(){var t=Xi;let e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}class pm{constructor(){this.h=this.g=null}add(e,n){const r=Cc.get();r.set(e,n),this.h?this.h.next=r:this.g=r,this.h=r}}var Cc=new dm(()=>new mm,t=>t.reset());class mm{constructor(){this.next=this.g=this.h=null}set(e,n){this.h=e,this.g=n,this.next=null}reset(){this.next=this.g=this.h=null}}function gm(t){var e=1;t=t.split(":");const n=[];for(;0<e&&t.length;)n.push(t.shift()),e--;return t.length&&n.push(t.join(":")),n}function _m(t){R.setTimeout(()=>{throw t},0)}let Bn,qn=!1,Xi=new pm,bc=()=>{const t=R.Promise.resolve(void 0);Bn=()=>{t.then(ym)}};var ym=()=>{for(var t;t=fm();){try{t.h.call(t.g)}catch(n){_m(n)}var e=Cc;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}qn=!1};function Qr(t,e){X.call(this),this.h=t||1,this.g=e||R,this.j=oe(this.qb,this),this.l=Date.now()}Y(Qr,X),y=Qr.prototype,y.ga=!1,y.T=null,y.qb=function(){if(this.ga){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.T=this.g.setTimeout(this.j,this.h-t):(this.T&&(this.g.clearTimeout(this.T),this.T=null),Z(this,"tick"),this.ga&&(Ji(this),this.start()))}},y.start=function(){this.ga=!0,this.T||(this.T=this.g.setTimeout(this.j,this.h),this.l=Date.now())};function Ji(t){t.ga=!1,t.T&&(t.g.clearTimeout(t.T),t.T=null)}y.N=function(){Qr.$.N.call(this),Ji(this),delete this.g};function Zi(t,e,n){if(typeof t=="function")n&&(t=oe(t,n));else if(t&&typeof t.handleEvent=="function")t=oe(t.handleEvent,t);else throw Error("Invalid listener argument");return 2147483647<Number(e)?-1:R.setTimeout(t,e||0)}function kc(t){t.g=Zi(()=>{t.g=null,t.i&&(t.i=!1,kc(t))},t.j);const e=t.h;t.h=null,t.m.apply(null,e)}class Em extends ht{constructor(e,n){super(),this.m=e,this.j=n,this.h=null,this.i=!1,this.g=null}l(e){this.h=arguments,this.g?this.i=!0:kc(this)}N(){super.N(),this.g&&(R.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function $n(t){ht.call(this),this.h=t,this.g={}}Y($n,ht);var Nc=[];function Dc(t,e,n,r){Array.isArray(n)||(n&&(Nc[0]=n.toString()),n=Nc);for(var s=0;s<n.length;s++){var i=wc(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function Oc(t){qi(t.g,function(e,n){this.g.hasOwnProperty(n)&&Wi(e)},t),t.g={}}$n.prototype.N=function(){$n.$.N.call(this),Oc(this)},$n.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};function Yr(){this.g=!0}Yr.prototype.Ea=function(){this.g=!1};function vm(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 l=u[0];u=u[1];var h=l.split("_");o=2<=h.length&&h[1]=="type"?o+(l+"="+u+"&"):o+(l+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+`
362
- `+n+`
363
- `+o})}function Tm(t,e,n,r,s,i,o){t.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+`
364
- `+n+`
365
- `+i+" "+o})}function Qt(t,e,n,r){t.info(function(){return"XMLHTTP TEXT ("+e+"): "+wm(t,n)+(r?" "+r:"")})}function Im(t,e){t.info(function(){return"TIMEOUT: "+e})}Yr.prototype.info=function(){};function wm(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(i!="noop"&&i!="stop"&&i!="close")for(var o=1;o<s.length;o++)s[o]=""}}}}return Yi(n)}catch{return e}}var bt={},Vc=null;function Xr(){return Vc=Vc||new X}bt.Ta="serverreachability";function Lc(t){ae.call(this,bt.Ta,t)}Y(Lc,ae);function jn(t){const e=Xr();Z(e,new Lc(e))}bt.STAT_EVENT="statevent";function Mc(t,e){ae.call(this,bt.STAT_EVENT,t),this.stat=e}Y(Mc,ae);function fe(t){const e=Xr();Z(e,new Mc(e,t))}bt.Ua="timingevent";function Uc(t,e){ae.call(this,bt.Ua,t),this.size=e}Y(Uc,ae);function zn(t,e){if(typeof t!="function")throw Error("Fn must not be null and must be a function");return R.setTimeout(function(){t()},e)}var Jr={NO_ERROR:0,rb:1,Eb:2,Db:3,yb:4,Cb:5,Fb:6,Qa:7,TIMEOUT:8,Ib:9},xc={wb:"complete",Sb:"success",Ra:"error",Qa:"abort",Kb:"ready",Lb:"readystatechange",TIMEOUT:"timeout",Gb:"incrementaldata",Jb:"progress",zb:"downloadprogress",$b:"uploadprogress"};function eo(){}eo.prototype.h=null;function Fc(t){return t.h||(t.h=t.i())}function Bc(){}var Hn={OPEN:"a",vb:"b",Ra:"c",Hb:"d"};function to(){ae.call(this,"d")}Y(to,ae);function no(){ae.call(this,"c")}Y(no,ae);var ro;function Zr(){}Y(Zr,eo),Zr.prototype.g=function(){return new XMLHttpRequest},Zr.prototype.i=function(){return{}},ro=new Zr;function Wn(t,e,n,r){this.l=t,this.j=e,this.m=n,this.W=r||1,this.U=new $n(this),this.P=Am,t=Li?125:void 0,this.V=new Qr(t),this.I=null,this.i=!1,this.s=this.A=this.v=this.L=this.G=this.Y=this.B=null,this.F=[],this.g=null,this.C=0,this.o=this.u=null,this.ca=-1,this.J=!1,this.O=0,this.M=null,this.ba=this.K=this.aa=this.S=!1,this.h=new qc}function qc(){this.i=null,this.g="",this.h=!1}var Am=45e3,so={},es={};y=Wn.prototype,y.setTimeout=function(t){this.P=t};function io(t,e,n){t.L=1,t.v=ss(Qe(e)),t.s=n,t.S=!0,$c(t,null)}function $c(t,e){t.G=Date.now(),Gn(t),t.A=Qe(t.v);var n=t.A,r=t.W;Array.isArray(r)||(r=[String(r)]),Jc(n.i,"t",r),t.C=0,n=t.l.J,t.h=new qc,t.g=Iu(t.l,n?e:null,!t.s),0<t.O&&(t.M=new Em(oe(t.Pa,t,t.g),t.O)),Dc(t.U,t.g,"readystatechange",t.nb),e=t.I?vc(t.I):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.ha(t.A,t.u,t.s,e)):(t.u="GET",t.g.ha(t.A,t.u,null,e)),jn(),vm(t.j,t.u,t.A,t.m,t.W,t.s)}y.nb=function(t){t=t.target;const e=this.M;e&&Me(t)==3?e.l():this.Pa(t)},y.Pa=function(t){try{if(t==this.g)e:{const l=Me(this.g);var e=this.g.Ia();const h=this.g.da();if(!(3>l)&&(l!=3||Li||this.g&&(this.h.h||this.g.ja()||lu(this.g)))){this.J||l!=4||e==7||(e==8||0>=h?jn(3):jn(2)),ts(this);var n=this.g.da();this.ca=n;t:if(jc(this)){var r=lu(this.g);t="";var s=r.length,i=Me(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){kt(this),Kn(this);var o="";break t}this.h.i=new R.TextDecoder}for(e=0;e<s;e++)this.h.h=!0,t+=this.h.i.decode(r[e],{stream:i&&e==s-1});r.splice(0,s),this.h.g+=t,this.C=0,o=this.h.g}else o=this.g.ja();if(this.i=n==200,Tm(this.j,this.u,this.A,this.m,this.W,l,n),this.i){if(this.aa&&!this.K){t:{if(this.g){var a,c=this.g;if((a=c.g?c.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Un(a)){var u=a;break t}}u=null}if(n=u)Qt(this.j,this.m,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,oo(this,n);else{this.i=!1,this.o=3,fe(12),kt(this),Kn(this);break e}}this.S?(zc(this,l,o),Li&&this.i&&l==3&&(Dc(this.U,this.V,"tick",this.mb),this.V.start())):(Qt(this.j,this.m,o,null),oo(this,o)),l==4&&kt(this),this.i&&!this.J&&(l==4?yu(this.l,this):(this.i=!1,Gn(this)))}else Hm(this.g),n==400&&0<o.indexOf("Unknown SID")?(this.o=3,fe(12)):(this.o=0,fe(13)),kt(this),Kn(this)}}}catch{}finally{}};function jc(t){return t.g?t.u=="GET"&&t.L!=2&&t.l.Ha:!1}function zc(t,e,n){let r=!0,s;for(;!t.J&&t.C<n.length;)if(s=Rm(t,n),s==es){e==4&&(t.o=4,fe(14),r=!1),Qt(t.j,t.m,null,"[Incomplete Response]");break}else if(s==so){t.o=4,fe(15),Qt(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}else Qt(t.j,t.m,s,null),oo(t,s);jc(t)&&s!=es&&s!=so&&(t.h.g="",t.C=0),e!=4||n.length!=0||t.h.h||(t.o=1,fe(16),r=!1),t.i=t.i&&r,r?0<n.length&&!t.ba&&(t.ba=!0,e=t.l,e.g==t&&e.ca&&!e.M&&(e.l.info("Great, no buffering proxy detected. Bytes received: "+n.length),po(e),e.M=!0,fe(11))):(Qt(t.j,t.m,n,"[Invalid Chunked Response]"),kt(t),Kn(t))}y.mb=function(){if(this.g){var t=Me(this.g),e=this.g.ja();this.C<e.length&&(ts(this),zc(this,t,e),this.i&&t!=4&&Gn(this))}};function Rm(t,e){var n=t.C,r=e.indexOf(`
366
- `,n);return r==-1?es:(n=Number(e.substring(n,r)),isNaN(n)?so:(r+=1,r+n>e.length?es:(e=e.slice(r,r+n),t.C=r+n,e)))}y.cancel=function(){this.J=!0,kt(this)};function Gn(t){t.Y=Date.now()+t.P,Hc(t,t.P)}function Hc(t,e){if(t.B!=null)throw Error("WatchDog timer not null");t.B=zn(oe(t.lb,t),e)}function ts(t){t.B&&(R.clearTimeout(t.B),t.B=null)}y.lb=function(){this.B=null;const t=Date.now();0<=t-this.Y?(Im(this.j,this.A),this.L!=2&&(jn(),fe(17)),kt(this),this.o=2,Kn(this)):Hc(this,this.Y-t)};function Kn(t){t.l.H==0||t.J||yu(t.l,t)}function kt(t){ts(t);var e=t.M;e&&typeof e.sa=="function"&&e.sa(),t.M=null,Ji(t.V),Oc(t.U),t.g&&(e=t.g,t.g=null,e.abort(),e.sa())}function oo(t,e){try{var n=t.l;if(n.H!=0&&(n.g==t||ao(n.i,t))){if(!t.K&&ao(n.i,t)&&n.H==3){try{var r=n.Ja.g.parse(e)}catch{r=null}if(Array.isArray(r)&&r.length==3){var s=r;if(s[0]==0){e:if(!n.u){if(n.g)if(n.g.G+3e3<t.G)ls(n),cs(n);else break e;fo(n),fe(18)}}else n.Fa=s[1],0<n.Fa-n.V&&37500>s[2]&&n.G&&n.A==0&&!n.v&&(n.v=zn(oe(n.ib,n),6e3));if(1>=tu(n.i)&&n.oa){try{n.oa()}catch{}n.oa=void 0}}else Dt(n,11)}else if((t.K||n.g==t)&&ls(n),!Un(e))for(s=n.Ja.g.parse(e),e=0;e<s.length;e++){let u=s[e];if(n.V=u[0],u=u[1],n.H==2)if(u[0]=="c"){n.K=u[1],n.pa=u[2];const l=u[3];l!=null&&(n.ra=l,n.l.info("VER="+n.ra));const h=u[4];h!=null&&(n.Ga=h,n.l.info("SVER="+n.Ga));const d=u[5];d!=null&&typeof d=="number"&&0<d&&(r=1.5*d,n.L=r,n.l.info("backChannelRequestTimeoutMs_="+r)),r=n;const f=t.g;if(f){const E=f.g?f.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(E){var i=r.i;i.g||E.indexOf("spdy")==-1&&E.indexOf("quic")==-1&&E.indexOf("h2")==-1||(i.j=i.l,i.g=new Set,i.h&&(co(i,i.h),i.h=null))}if(r.F){const v=f.g?f.g.getResponseHeader("X-HTTP-Session-Id"):null;v&&(r.Da=v,q(r.I,r.F,v))}}n.H=3,n.h&&n.h.Ba(),n.ca&&(n.S=Date.now()-t.G,n.l.info("Handshake RTT: "+n.S+"ms")),r=n;var o=t;if(r.wa=Tu(r,r.J?r.pa:null,r.Y),o.K){nu(r.i,o);var a=o,c=r.L;c&&a.setTimeout(c),a.B&&(ts(a),Gn(a)),r.g=o}else gu(r);0<n.j.length&&us(n)}else u[0]!="stop"&&u[0]!="close"||Dt(n,7);else n.H==3&&(u[0]=="stop"||u[0]=="close"?u[0]=="stop"?Dt(n,7):ho(n):u[0]!="noop"&&n.h&&n.h.Aa(u),n.A=0)}}jn(4)}catch{}}function Pm(t){if(t.Z&&typeof t.Z=="function")return t.Z();if(typeof Map<"u"&&t instanceof Map||typeof Set<"u"&&t instanceof Set)return Array.from(t.values());if(typeof t=="string")return t.split("");if(jr(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}e=[],n=0;for(r in t)e[n++]=t[r];return e}function Sm(t){if(t.ta&&typeof t.ta=="function")return t.ta();if(!t.Z||typeof t.Z!="function"){if(typeof Map<"u"&&t instanceof Map)return Array.from(t.keys());if(!(typeof Set<"u"&&t instanceof Set)){if(jr(t)||typeof t=="string"){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}e=[],n=0;for(const r in t)e[n++]=r;return e}}}function Wc(t,e){if(t.forEach&&typeof t.forEach=="function")t.forEach(e,void 0);else if(jr(t)||typeof t=="string")Array.prototype.forEach.call(t,e,void 0);else for(var n=Sm(t),r=Pm(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}var Gc=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Cm(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," ")):"")}}}function Nt(t){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Nt){this.h=t.h,ns(this,t.j),this.s=t.s,this.g=t.g,rs(this,t.m),this.l=t.l;var e=t.i,n=new Xn;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Kc(this,n),this.o=t.o}else t&&(e=String(t).match(Gc))?(this.h=!1,ns(this,e[1]||"",!0),this.s=Qn(e[2]||""),this.g=Qn(e[3]||"",!0),rs(this,e[4]),this.l=Qn(e[5]||"",!0),Kc(this,e[6]||"",!0),this.o=Qn(e[7]||"")):(this.h=!1,this.i=new Xn(null,this.h))}Nt.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Yn(e,Qc,!0),":");var n=this.g;return(n||e=="file")&&(t.push("//"),(e=this.s)&&t.push(Yn(e,Qc,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),n=this.m,n!=null&&t.push(":",String(n))),(n=this.l)&&(this.g&&n.charAt(0)!="/"&&t.push("/"),t.push(Yn(n,n.charAt(0)=="/"?Nm:km,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Yn(n,Om)),t.join("")};function Qe(t){return new Nt(t)}function ns(t,e,n){t.j=n?Qn(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function rs(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 Kc(t,e,n){e instanceof Xn?(t.i=e,Vm(t.i,t.h)):(n||(e=Yn(e,Dm)),t.i=new Xn(e,t.h))}function q(t,e,n){t.i.set(e,n)}function ss(t){return q(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Qn(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Yn(t,e,n){return typeof t=="string"?(t=encodeURI(t).replace(e,bm),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function bm(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(t&15).toString(16)}var Qc=/[#\/\?@]/g,km=/[#\?:]/g,Nm=/[#\?]/g,Dm=/[#\?@]/g,Om=/#/g;function Xn(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function dt(t){t.g||(t.g=new Map,t.h=0,t.i&&Cm(t.i,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}y=Xn.prototype,y.add=function(t,e){dt(this),this.i=null,t=Yt(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this};function Yc(t,e){dt(t),e=Yt(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function Xc(t,e){return dt(t),e=Yt(t,e),t.g.has(e)}y.forEach=function(t,e){dt(this),this.g.forEach(function(n,r){n.forEach(function(s){t.call(e,s,r,this)},this)},this)},y.ta=function(){dt(this);const t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[];for(let r=0;r<e.length;r++){const s=t[r];for(let i=0;i<s.length;i++)n.push(e[r])}return n},y.Z=function(t){dt(this);let e=[];if(typeof t=="string")Xc(this,t)&&(e=e.concat(this.g.get(Yt(this,t))));else{t=Array.from(this.g.values());for(let n=0;n<t.length;n++)e=e.concat(t[n])}return e},y.set=function(t,e){return dt(this),this.i=null,t=Yt(this,t),Xc(this,t)&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},y.get=function(t,e){return t?(t=this.Z(t),0<t.length?String(t[0]):e):e};function Jc(t,e,n){Yc(t,e),0<n.length&&(t.i=null,t.g.set(Yt(t,e),Oi(n)),t.h+=n.length)}y.toString=function(){if(this.i)return this.i;if(!this.g)return"";const t=[],e=Array.from(this.g.keys());for(var n=0;n<e.length;n++){var r=e[n];const i=encodeURIComponent(String(r)),o=this.Z(r);for(r=0;r<o.length;r++){var s=i;o[r]!==""&&(s+="="+encodeURIComponent(String(o[r]))),t.push(s)}}return this.i=t.join("&")};function Yt(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}function Vm(t,e){e&&!t.j&&(dt(t),t.i=null,t.g.forEach(function(n,r){var s=r.toLowerCase();r!=s&&(Yc(this,r),Jc(this,s,n))},t)),t.j=e}var Lm=class{constructor(t,e){this.g=t,this.map=e}};function Zc(t){this.l=t||Mm,R.PerformanceNavigationTiming?(t=R.performance.getEntriesByType("navigation"),t=0<t.length&&(t[0].nextHopProtocol=="hq"||t[0].nextHopProtocol=="h2")):t=!!(R.g&&R.g.Ka&&R.g.Ka()&&R.g.Ka().dc),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var Mm=10;function eu(t){return t.h?!0:t.g?t.g.size>=t.j:!1}function tu(t){return t.h?1:t.g?t.g.size:0}function ao(t,e){return t.h?t.h==e:t.g?t.g.has(e):!1}function co(t,e){t.g?t.g.add(e):t.h=e}function nu(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}Zc.prototype.cancel=function(){if(this.i=ru(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const t of this.g.values())t.cancel();this.g.clear()}};function ru(t){if(t.h!=null)return t.i.concat(t.h.F);if(t.g!=null&&t.g.size!==0){let e=t.i;for(const n of t.g.values())e=e.concat(n.F);return e}return Oi(t.i)}var Um=class{stringify(t){return R.JSON.stringify(t,void 0)}parse(t){return R.JSON.parse(t,void 0)}};function xm(){this.g=new Um}function Fm(t,e,n){const r=n||"";try{Wc(t,function(s,i){let o=s;Mn(s)&&(o=Yi(s)),e.push(r+i+"="+encodeURIComponent(o))})}catch(s){throw e.push(r+"type="+encodeURIComponent("_badmap")),s}}function Bm(t,e){const n=new Yr;if(R.Image){const r=new Image;r.onload=zr(is,n,r,"TestLoadImage: loaded",!0,e),r.onerror=zr(is,n,r,"TestLoadImage: error",!1,e),r.onabort=zr(is,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=zr(is,n,r,"TestLoadImage: timeout",!1,e),R.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}else e(!1)}function is(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch{}}function Jn(t){this.l=t.ec||null,this.j=t.ob||!1}Y(Jn,eo),Jn.prototype.g=function(){return new os(this.l,this.j)},Jn.prototype.i=function(t){return function(){return t}}({});function os(t,e){X.call(this),this.F=t,this.u=e,this.m=void 0,this.readyState=uo,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}Y(os,X);var uo=0;y=os.prototype,y.open=function(t,e){if(this.readyState!=uo)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,er(this)},y.send=function(t){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.F||R).fetch(new Request(this.B,e)).then(this.$a.bind(this),this.ka.bind(this))},y.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,Zn(this)),this.readyState=uo},y.$a=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,er(this)),this.g&&(this.readyState=3,er(this),this.g)))if(this.responseType==="arraybuffer")t.arrayBuffer().then(this.Ya.bind(this),this.ka.bind(this));else if(typeof R.ReadableStream<"u"&&"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;su(this)}else t.text().then(this.Za.bind(this),this.ka.bind(this))};function su(t){t.j.read().then(t.Xa.bind(t)).catch(t.ka.bind(t))}y.Xa=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?Zn(this):er(this),this.readyState==3&&su(this)}},y.Za=function(t){this.g&&(this.response=this.responseText=t,Zn(this))},y.Ya=function(t){this.g&&(this.response=t,Zn(this))},y.ka=function(){this.g&&Zn(this)};function Zn(t){t.readyState=4,t.l=null,t.j=null,t.A=null,er(t)}y.setRequestHeader=function(t,e){this.v.append(t,e)},y.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},y.getAllResponseHeaders=function(){if(!this.h)return"";const t=[],e=this.h.entries();for(var n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join(`\r
367
- `)};function er(t){t.onreadystatechange&&t.onreadystatechange.call(t)}Object.defineProperty(os.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(t){this.m=t?"include":"same-origin"}});var qm=R.JSON.parse;function H(t){X.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.I="",this.m=0,this.j="",this.l=this.G=this.v=this.F=!1,this.B=0,this.A=null,this.K=iu,this.L=this.M=!1}Y(H,X);var iu="",$m=/^https?$/i,jm=["POST","PUT"];y=H.prototype,y.Oa=function(t){this.M=t},y.ha=function(t,e,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.I+"; newUri="+t);e=e?e.toUpperCase():"GET",this.I=t,this.j="",this.m=0,this.F=!1,this.h=!0,this.g=this.u?this.u.g():ro.g(),this.C=this.u?Fc(this.u):Fc(ro),this.g.onreadystatechange=oe(this.La,this);try{this.G=!0,this.g.open(e,String(t),!0),this.G=!1}catch(i){ou(this,i);return}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var s in r)n.set(s,r[s]);else if(typeof r.keys=="function"&&typeof r.get=="function")for(const i of r.keys())n.set(i,r.get(i));else throw Error("Unknown input type for opt_headers: "+String(r));r=Array.from(n.keys()).find(i=>i.toLowerCase()=="content-type"),s=R.FormData&&t instanceof R.FormData,!(0<=pc(jm,e))||r||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[i,o]of n)this.g.setRequestHeader(i,o);this.K&&(this.g.responseType=this.K),"withCredentials"in this.g&&this.g.withCredentials!==this.M&&(this.g.withCredentials=this.M);try{uu(this),0<this.B&&((this.L=zm(this.g))?(this.g.timeout=this.B,this.g.ontimeout=oe(this.ua,this)):this.A=Zi(this.ua,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(i){ou(this,i)}};function zm(t){return Kt&&typeof t.timeout=="number"&&t.ontimeout!==void 0}y.ua=function(){typeof Ni<"u"&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Z(this,"timeout"),this.abort(8))};function ou(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,au(t),as(t)}function au(t){t.F||(t.F=!0,Z(t,"complete"),Z(t,"error"))}y.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Z(this,"complete"),Z(this,"abort"),as(this))},y.N=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),as(this,!0)),H.$.N.call(this)},y.La=function(){this.s||(this.G||this.v||this.l?cu(this):this.kb())},y.kb=function(){cu(this)};function cu(t){if(t.h&&typeof Ni<"u"&&(!t.C[1]||Me(t)!=4||t.da()!=2)){if(t.v&&Me(t)==4)Zi(t.La,0,t);else if(Z(t,"readystatechange"),Me(t)==4){t.h=!1;try{const o=t.da();e:switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var e=!0;break e;default:e=!1}var n;if(!(n=e)){var r;if(r=o===0){var s=String(t.I).match(Gc)[1]||null;!s&&R.self&&R.self.location&&(s=R.self.location.protocol.slice(0,-1)),r=!$m.test(s?s.toLowerCase():"")}n=r}if(n)Z(t,"complete"),Z(t,"success");else{t.m=6;try{var i=2<Me(t)?t.g.statusText:""}catch{i=""}t.j=i+" ["+t.da()+"]",au(t)}}finally{as(t)}}}}function as(t,e){if(t.g){uu(t);const n=t.g,r=t.C[0]?()=>{}:null;t.g=null,t.C=null,e||Z(t,"ready");try{n.onreadystatechange=r}catch{}}}function uu(t){t.g&&t.L&&(t.g.ontimeout=null),t.A&&(R.clearTimeout(t.A),t.A=null)}y.isActive=function(){return!!this.g};function Me(t){return t.g?t.g.readyState:0}y.da=function(){try{return 2<Me(this)?this.g.status:-1}catch{return-1}},y.ja=function(){try{return this.g?this.g.responseText:""}catch{return""}},y.Wa=function(t){if(this.g){var e=this.g.responseText;return t&&e.indexOf(t)==0&&(e=e.substring(t.length)),qm(e)}};function lu(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.K){case iu:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch{return null}}function Hm(t){const e={};t=(t.g&&2<=Me(t)&&t.g.getAllResponseHeaders()||"").split(`\r
368
- `);for(let r=0;r<t.length;r++){if(Un(t[r]))continue;var n=gm(t[r]);const s=n[0];if(n=n[1],typeof n!="string")continue;n=n.trim();const i=e[s]||[];e[s]=i,i.push(n)}um(e,function(r){return r.join(", ")})}y.Ia=function(){return this.m},y.Sa=function(){return typeof this.j=="string"?this.j:String(this.j)};function hu(t){let e="";return qi(t,function(n,r){e+=r,e+=":",e+=n,e+=`\r
369
- `}),e}function lo(t,e,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=hu(n),typeof t=="string"?n!=null&&encodeURIComponent(String(n)):q(t,e,n))}function tr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function du(t){this.Ga=0,this.j=[],this.l=new Yr,this.pa=this.wa=this.I=this.Y=this.g=this.Da=this.F=this.na=this.o=this.U=this.s=null,this.fb=this.W=0,this.cb=tr("failFast",!1,t),this.G=this.v=this.u=this.m=this.h=null,this.aa=!0,this.Fa=this.V=-1,this.ba=this.A=this.C=0,this.ab=tr("baseRetryDelayMs",5e3,t),this.hb=tr("retryDelaySeedMs",1e4,t),this.eb=tr("forwardChannelMaxRetries",2,t),this.xa=tr("forwardChannelRequestTimeoutMs",2e4,t),this.va=t&&t.xmlHttpFactory||void 0,this.Ha=t&&t.useFetchStreams||!1,this.L=void 0,this.J=t&&t.supportsCrossDomainXhr||!1,this.K="",this.i=new Zc(t&&t.concurrentRequestLimit),this.Ja=new xm,this.P=t&&t.fastHandshake||!1,this.O=t&&t.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.bb=t&&t.bc||!1,t&&t.Ea&&this.l.Ea(),t&&t.forceLongPolling&&(this.aa=!1),this.ca=!this.P&&this.aa&&t&&t.detectBufferingProxy||!1,this.qa=void 0,t&&t.longPollingTimeout&&0<t.longPollingTimeout&&(this.qa=t.longPollingTimeout),this.oa=void 0,this.S=0,this.M=!1,this.ma=this.B=null}y=du.prototype,y.ra=8,y.H=1;function ho(t){if(fu(t),t.H==3){var e=t.W++,n=Qe(t.I);if(q(n,"SID",t.K),q(n,"RID",e),q(n,"TYPE","terminate"),nr(t,n),e=new Wn(t,t.l,e),e.L=2,e.v=ss(Qe(n)),n=!1,R.navigator&&R.navigator.sendBeacon)try{n=R.navigator.sendBeacon(e.v.toString(),"")}catch{}!n&&R.Image&&(new Image().src=e.v,n=!0),n||(e.g=Iu(e.l,null),e.g.ha(e.v)),e.G=Date.now(),Gn(e)}vu(t)}function cs(t){t.g&&(po(t),t.g.cancel(),t.g=null)}function fu(t){cs(t),t.u&&(R.clearTimeout(t.u),t.u=null),ls(t),t.i.cancel(),t.m&&(typeof t.m=="number"&&R.clearTimeout(t.m),t.m=null)}function us(t){if(!eu(t.i)&&!t.m){t.m=!0;var e=t.Na;Bn||bc(),qn||(Bn(),qn=!0),Xi.add(e,t),t.C=0}}function Wm(t,e){return tu(t.i)>=t.i.j-(t.m?1:0)?!1:t.m?(t.j=e.F.concat(t.j),!0):t.H==1||t.H==2||t.C>=(t.cb?0:t.eb)?!1:(t.m=zn(oe(t.Na,t,e),Eu(t,t.C)),t.C++,!0)}y.Na=function(t){if(this.m)if(this.m=null,this.H==1){if(!t){this.W=Math.floor(1e5*Math.random()),t=this.W++;const s=new Wn(this,this.l,t);let i=this.s;if(this.U&&(i?(i=vc(i),Ic(i,this.U)):i=this.U),this.o!==null||this.O||(s.I=i,i=null),this.P)e:{for(var e=0,n=0;n<this.j.length;n++){t:{var r=this.j[n];if("__data__"in r.map&&(r=r.map.__data__,typeof r=="string")){r=r.length;break t}r=void 0}if(r===void 0)break;if(e+=r,4096<e){e=n;break e}if(e===4096||n===this.j.length-1){e=n+1;break e}}e=1e3}else e=1e3;e=mu(this,s,e),n=Qe(this.I),q(n,"RID",t),q(n,"CVER",22),this.F&&q(n,"X-HTTP-Session-Id",this.F),nr(this,n),i&&(this.O?e="headers="+encodeURIComponent(String(hu(i)))+"&"+e:this.o&&lo(n,this.o,i)),co(this.i,s),this.bb&&q(n,"TYPE","init"),this.P?(q(n,"$req",e),q(n,"SID","null"),s.aa=!0,io(s,n,null)):io(s,n,e),this.H=2}}else this.H==3&&(t?pu(this,t):this.j.length==0||eu(this.i)||pu(this))};function pu(t,e){var n;e?n=e.m:n=t.W++;const r=Qe(t.I);q(r,"SID",t.K),q(r,"RID",n),q(r,"AID",t.V),nr(t,r),t.o&&t.s&&lo(r,t.o,t.s),n=new Wn(t,t.l,n,t.C+1),t.o===null&&(n.I=t.s),e&&(t.j=e.F.concat(t.j)),e=mu(t,n,1e3),n.setTimeout(Math.round(.5*t.xa)+Math.round(.5*t.xa*Math.random())),co(t.i,n),io(n,r,e)}function nr(t,e){t.na&&qi(t.na,function(n,r){q(e,r,n)}),t.h&&Wc({},function(n,r){q(e,r,n)})}function mu(t,e,n){n=Math.min(t.j.length,n);var r=t.h?oe(t.h.Va,t.h,t):null;e:{var s=t.j;let i=-1;for(;;){const o=["count="+n];i==-1?0<n?(i=s[0].g,o.push("ofs="+i)):i=0:o.push("ofs="+i);let a=!0;for(let c=0;c<n;c++){let u=s[c].g;const l=s[c].map;if(u-=i,0>u)i=Math.max(0,s[c].g-100),a=!1;else try{Fm(l,o,"req"+u+"_")}catch{r&&r(l)}}if(a){r=o.join("&");break e}}}return t=t.j.splice(0,n),e.F=t,r}function gu(t){if(!t.g&&!t.u){t.ba=1;var e=t.Ma;Bn||bc(),qn||(Bn(),qn=!0),Xi.add(e,t),t.A=0}}function fo(t){return t.g||t.u||3<=t.A?!1:(t.ba++,t.u=zn(oe(t.Ma,t),Eu(t,t.A)),t.A++,!0)}y.Ma=function(){if(this.u=null,_u(this),this.ca&&!(this.M||this.g==null||0>=this.S)){var t=2*this.S;this.l.info("BP detection timer enabled: "+t),this.B=zn(oe(this.jb,this),t)}},y.jb=function(){this.B&&(this.B=null,this.l.info("BP detection timeout reached."),this.l.info("Buffering proxy detected and switch to long-polling!"),this.G=!1,this.M=!0,fe(10),cs(this),_u(this))};function po(t){t.B!=null&&(R.clearTimeout(t.B),t.B=null)}function _u(t){t.g=new Wn(t,t.l,"rpc",t.ba),t.o===null&&(t.g.I=t.s),t.g.O=0;var e=Qe(t.wa);q(e,"RID","rpc"),q(e,"SID",t.K),q(e,"AID",t.V),q(e,"CI",t.G?"0":"1"),!t.G&&t.qa&&q(e,"TO",t.qa),q(e,"TYPE","xmlhttp"),nr(t,e),t.o&&t.s&&lo(e,t.o,t.s),t.L&&t.g.setTimeout(t.L);var n=t.g;t=t.pa,n.L=1,n.v=ss(Qe(e)),n.s=null,n.S=!0,$c(n,t)}y.ib=function(){this.v!=null&&(this.v=null,cs(this),fo(this),fe(19))};function ls(t){t.v!=null&&(R.clearTimeout(t.v),t.v=null)}function yu(t,e){var n=null;if(t.g==e){ls(t),po(t),t.g=null;var r=2}else if(ao(t.i,e))n=e.F,nu(t.i,e),r=1;else return;if(t.H!=0){if(e.i)if(r==1){n=e.s?e.s.length:0,e=Date.now()-e.G;var s=t.C;r=Xr(),Z(r,new Uc(r,n)),us(t)}else gu(t);else if(s=e.o,s==3||s==0&&0<e.ca||!(r==1&&Wm(t,e)||r==2&&fo(t)))switch(n&&0<n.length&&(e=t.i,e.i=e.i.concat(n)),s){case 1:Dt(t,5);break;case 4:Dt(t,10);break;case 3:Dt(t,6);break;default:Dt(t,2)}}}function Eu(t,e){let n=t.ab+Math.floor(Math.random()*t.hb);return t.isActive()||(n*=2),n*e}function Dt(t,e){if(t.l.info("Error code "+e),e==2){var n=null;t.h&&(n=null);var r=oe(t.pb,t);n||(n=new Nt("//www.google.com/images/cleardot.gif"),R.location&&R.location.protocol=="http"||ns(n,"https"),ss(n)),Bm(n.toString(),r)}else fe(2);t.H=0,t.h&&t.h.za(e),vu(t),fu(t)}y.pb=function(t){t?(this.l.info("Successfully pinged google.com"),fe(2)):(this.l.info("Failed to ping google.com"),fe(1))};function vu(t){if(t.H=0,t.ma=[],t.h){const e=ru(t.i);(e.length!=0||t.j.length!=0)&&(mc(t.ma,e),mc(t.ma,t.j),t.i.i.length=0,Oi(t.j),t.j.length=0),t.h.ya()}}function Tu(t,e,n){var r=n instanceof Nt?Qe(n):new Nt(n);if(r.g!="")e&&(r.g=e+"."+r.g),rs(r,r.m);else{var s=R.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new Nt(null);r&&ns(i,r),e&&(i.g=e),s&&rs(i,s),n&&(i.l=n),r=i}return n=t.F,e=t.Da,n&&e&&q(r,n,e),q(r,"VER",t.ra),nr(t,r),r}function Iu(t,e,n){if(e&&!t.J)throw Error("Can't create secondary domain capable XhrIo object.");return e=n&&t.Ha&&!t.va?new H(new Jn({ob:!0})):new H(t.va),e.Oa(t.J),e}y.isActive=function(){return!!this.h&&this.h.isActive(this)};function wu(){}y=wu.prototype,y.Ba=function(){},y.Aa=function(){},y.za=function(){},y.ya=function(){},y.isActive=function(){return!0},y.Va=function(){};function hs(){if(Kt&&!(10<=Number(im)))throw Error("Environmental error: no available transport.")}hs.prototype.g=function(t,e){return new ve(t,e)};function ve(t,e){X.call(this),this.g=new du(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.Ca&&(t?t["X-WebChannel-Client-Profile"]=e.Ca:t={"X-WebChannel-Client-Profile":e.Ca}),this.g.U=t,(t=e&&e.cc)&&!Un(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Un(e)&&(this.g.F=e,t=this.h,t!==null&&e in t&&(t=this.h,e in t&&delete t[e])),this.j=new Xt(this)}Y(ve,X),ve.prototype.m=function(){this.g.h=this.j,this.A&&(this.g.J=!0);var t=this.g,e=this.l,n=this.h||void 0;fe(0),t.Y=e,t.na=n||{},t.G=t.aa,t.I=Tu(t,null,t.Y),us(t)},ve.prototype.close=function(){ho(this.g)},ve.prototype.u=function(t){var e=this.g;if(typeof t=="string"){var n={};n.__data__=t,t=n}else this.v&&(n={},n.__data__=Yi(t),t=n);e.j.push(new Lm(e.fb++,t)),e.H==3&&us(e)},ve.prototype.N=function(){this.g.h=null,delete this.j,ho(this.g),delete this.g,ve.$.N.call(this)};function Au(t){to.call(this),t.__headers__&&(this.headers=t.__headers__,this.statusCode=t.__status__,delete t.__headers__,delete t.__status__);var e=t.__sm__;if(e){e:{for(const n in e){t=n;break e}t=void 0}(this.i=t)&&(t=this.i,e=e!==null&&t in e?e[t]:void 0),this.data=e}else this.data=t}Y(Au,to);function Ru(){no.call(this),this.status=1}Y(Ru,no);function Xt(t){this.g=t}Y(Xt,wu),Xt.prototype.Ba=function(){Z(this.g,"a")},Xt.prototype.Aa=function(t){Z(this.g,new Au(t))},Xt.prototype.za=function(t){Z(this.g,new Ru)},Xt.prototype.ya=function(){Z(this.g,"b")};function Gm(){this.blockSize=-1}function ke(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.m=Array(this.blockSize),this.i=this.h=0,this.reset()}Y(ke,Gm),ke.prototype.reset=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.i=this.h=0};function mo(t,e,n){n||(n=0);var r=Array(16);if(typeof e=="string")for(var s=0;16>s;++s)r[s]=e.charCodeAt(n++)|e.charCodeAt(n++)<<8|e.charCodeAt(n++)<<16|e.charCodeAt(n++)<<24;else for(s=0;16>s;++s)r[s]=e[n++]|e[n++]<<8|e[n++]<<16|e[n++]<<24;e=t.g[0],n=t.g[1],s=t.g[2];var i=t.g[3],o=e+(i^n&(s^i))+r[0]+3614090360&4294967295;e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[1]+3905402710&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[2]+606105819&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[3]+3250441966&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(i^n&(s^i))+r[4]+4118548399&4294967295,e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[5]+1200080426&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[6]+2821735955&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[7]+4249261313&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(i^n&(s^i))+r[8]+1770035416&4294967295,e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[9]+2336552879&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[10]+4294925233&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[11]+2304563134&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(i^n&(s^i))+r[12]+1804603682&4294967295,e=n+(o<<7&4294967295|o>>>25),o=i+(s^e&(n^s))+r[13]+4254626195&4294967295,i=e+(o<<12&4294967295|o>>>20),o=s+(n^i&(e^n))+r[14]+2792965006&4294967295,s=i+(o<<17&4294967295|o>>>15),o=n+(e^s&(i^e))+r[15]+1236535329&4294967295,n=s+(o<<22&4294967295|o>>>10),o=e+(s^i&(n^s))+r[1]+4129170786&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[6]+3225465664&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[11]+643717713&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[0]+3921069994&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(n^s))+r[5]+3593408605&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[10]+38016083&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[15]+3634488961&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[4]+3889429448&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(n^s))+r[9]+568446438&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[14]+3275163606&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[3]+4107603335&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[8]+1163531501&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(s^i&(n^s))+r[13]+2850285829&4294967295,e=n+(o<<5&4294967295|o>>>27),o=i+(n^s&(e^n))+r[2]+4243563512&4294967295,i=e+(o<<9&4294967295|o>>>23),o=s+(e^n&(i^e))+r[7]+1735328473&4294967295,s=i+(o<<14&4294967295|o>>>18),o=n+(i^e&(s^i))+r[12]+2368359562&4294967295,n=s+(o<<20&4294967295|o>>>12),o=e+(n^s^i)+r[5]+4294588738&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[8]+2272392833&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[11]+1839030562&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[14]+4259657740&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(n^s^i)+r[1]+2763975236&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[4]+1272893353&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[7]+4139469664&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[10]+3200236656&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(n^s^i)+r[13]+681279174&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[0]+3936430074&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[3]+3572445317&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[6]+76029189&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(n^s^i)+r[9]+3654602809&4294967295,e=n+(o<<4&4294967295|o>>>28),o=i+(e^n^s)+r[12]+3873151461&4294967295,i=e+(o<<11&4294967295|o>>>21),o=s+(i^e^n)+r[15]+530742520&4294967295,s=i+(o<<16&4294967295|o>>>16),o=n+(s^i^e)+r[2]+3299628645&4294967295,n=s+(o<<23&4294967295|o>>>9),o=e+(s^(n|~i))+r[0]+4096336452&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[7]+1126891415&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[14]+2878612391&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[5]+4237533241&4294967295,n=s+(o<<21&4294967295|o>>>11),o=e+(s^(n|~i))+r[12]+1700485571&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[3]+2399980690&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[10]+4293915773&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[1]+2240044497&4294967295,n=s+(o<<21&4294967295|o>>>11),o=e+(s^(n|~i))+r[8]+1873313359&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[15]+4264355552&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[6]+2734768916&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[13]+1309151649&4294967295,n=s+(o<<21&4294967295|o>>>11),o=e+(s^(n|~i))+r[4]+4149444226&4294967295,e=n+(o<<6&4294967295|o>>>26),o=i+(n^(e|~s))+r[11]+3174756917&4294967295,i=e+(o<<10&4294967295|o>>>22),o=s+(e^(i|~n))+r[2]+718787259&4294967295,s=i+(o<<15&4294967295|o>>>17),o=n+(i^(s|~e))+r[9]+3951481745&4294967295,t.g[0]=t.g[0]+e&4294967295,t.g[1]=t.g[1]+(s+(o<<21&4294967295|o>>>11))&4294967295,t.g[2]=t.g[2]+s&4294967295,t.g[3]=t.g[3]+i&4294967295}ke.prototype.j=function(t,e){e===void 0&&(e=t.length);for(var n=e-this.blockSize,r=this.m,s=this.h,i=0;i<e;){if(s==0)for(;i<=n;)mo(this,t,i),i+=this.blockSize;if(typeof t=="string"){for(;i<e;)if(r[s++]=t.charCodeAt(i++),s==this.blockSize){mo(this,r),s=0;break}}else for(;i<e;)if(r[s++]=t[i++],s==this.blockSize){mo(this,r),s=0;break}}this.h=s,this.i+=e},ke.prototype.l=function(){var t=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);t[0]=128;for(var e=1;e<t.length-8;++e)t[e]=0;var n=8*this.i;for(e=t.length-8;e<t.length;++e)t[e]=n&255,n/=256;for(this.j(t),t=Array(16),e=n=0;4>e;++e)for(var r=0;32>r;r+=8)t[n++]=this.g[e]>>>r&255;return t};function x(t,e){this.h=e;for(var n=[],r=!0,s=t.length-1;0<=s;s--){var i=t[s]|0;r&&i==e||(n[s]=i,r=!1)}this.g=n}var Km={};function go(t){return-128<=t&&128>t?nm(t,function(e){return new x([e|0],0>e?-1:0)}):new x([t|0],0>t?-1:0)}function Ue(t){if(isNaN(t)||!isFinite(t))return Jt;if(0>t)return ee(Ue(-t));for(var e=[],n=1,r=0;t>=n;r++)e[r]=t/n|0,n*=_o;return new x(e,0)}function Pu(t,e){if(t.length==0)throw Error("number format error: empty string");if(e=e||10,2>e||36<e)throw Error("radix out of range: "+e);if(t.charAt(0)=="-")return ee(Pu(t.substring(1),e));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var n=Ue(Math.pow(e,8)),r=Jt,s=0;s<t.length;s+=8){var i=Math.min(8,t.length-s),o=parseInt(t.substring(s,s+i),e);8>i?(i=Ue(Math.pow(e,i)),r=r.R(i).add(Ue(o))):(r=r.R(n),r=r.add(Ue(o)))}return r}var _o=4294967296,Jt=go(0),yo=go(1),Su=go(16777216);y=x.prototype,y.ea=function(){if(Re(this))return-ee(this).ea();for(var t=0,e=1,n=0;n<this.g.length;n++){var r=this.D(n);t+=(0<=r?r:_o+r)*e,e*=_o}return t},y.toString=function(t){if(t=t||10,2>t||36<t)throw Error("radix out of range: "+t);if(Ye(this))return"0";if(Re(this))return"-"+ee(this).toString(t);for(var e=Ue(Math.pow(t,6)),n=this,r="";;){var s=ps(n,e).g;n=ds(n,s.R(e));var i=((0<n.g.length?n.g[0]:n.h)>>>0).toString(t);if(n=s,Ye(n))return i+r;for(;6>i.length;)i="0"+i;r=i+r}},y.D=function(t){return 0>t?0:t<this.g.length?this.g[t]:this.h};function Ye(t){if(t.h!=0)return!1;for(var e=0;e<t.g.length;e++)if(t.g[e]!=0)return!1;return!0}function Re(t){return t.h==-1}y.X=function(t){return t=ds(this,t),Re(t)?-1:Ye(t)?0:1};function ee(t){for(var e=t.g.length,n=[],r=0;r<e;r++)n[r]=~t.g[r];return new x(n,~t.h).add(yo)}y.abs=function(){return Re(this)?ee(this):this},y.add=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0,s=0;s<=e;s++){var i=r+(this.D(s)&65535)+(t.D(s)&65535),o=(i>>>16)+(this.D(s)>>>16)+(t.D(s)>>>16);r=o>>>16,i&=65535,o&=65535,n[s]=o<<16|i}return new x(n,n[n.length-1]&-2147483648?-1:0)};function ds(t,e){return t.add(ee(e))}y.R=function(t){if(Ye(this)||Ye(t))return Jt;if(Re(this))return Re(t)?ee(this).R(ee(t)):ee(ee(this).R(t));if(Re(t))return ee(this.R(ee(t)));if(0>this.X(Su)&&0>t.X(Su))return Ue(this.ea()*t.ea());for(var e=this.g.length+t.g.length,n=[],r=0;r<2*e;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<t.g.length;s++){var i=this.D(r)>>>16,o=this.D(r)&65535,a=t.D(s)>>>16,c=t.D(s)&65535;n[2*r+2*s]+=o*c,fs(n,2*r+2*s),n[2*r+2*s+1]+=i*c,fs(n,2*r+2*s+1),n[2*r+2*s+1]+=o*a,fs(n,2*r+2*s+1),n[2*r+2*s+2]+=i*a,fs(n,2*r+2*s+2)}for(r=0;r<e;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=e;r<2*e;r++)n[r]=0;return new x(n,0)};function fs(t,e){for(;(t[e]&65535)!=t[e];)t[e+1]+=t[e]>>>16,t[e]&=65535,e++}function rr(t,e){this.g=t,this.h=e}function ps(t,e){if(Ye(e))throw Error("division by zero");if(Ye(t))return new rr(Jt,Jt);if(Re(t))return e=ps(ee(t),e),new rr(ee(e.g),ee(e.h));if(Re(e))return e=ps(t,ee(e)),new rr(ee(e.g),e.h);if(30<t.g.length){if(Re(t)||Re(e))throw Error("slowDivide_ only works with positive integers.");for(var n=yo,r=e;0>=r.X(t);)n=Cu(n),r=Cu(r);var s=Zt(n,1),i=Zt(r,1);for(r=Zt(r,2),n=Zt(n,2);!Ye(r);){var o=i.add(r);0>=o.X(t)&&(s=s.add(n),i=o),r=Zt(r,1),n=Zt(n,1)}return e=ds(t,s.R(e)),new rr(s,e)}for(s=Jt;0<=t.X(e);){for(n=Math.max(1,Math.floor(t.ea()/e.ea())),r=Math.ceil(Math.log(n)/Math.LN2),r=48>=r?1:Math.pow(2,r-48),i=Ue(n),o=i.R(e);Re(o)||0<o.X(t);)n-=r,i=Ue(n),o=i.R(e);Ye(i)&&(i=yo),s=s.add(i),t=ds(t,o)}return new rr(s,t)}y.gb=function(t){return ps(this,t).h},y.and=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)&t.D(r);return new x(n,this.h&t.h)},y.or=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)|t.D(r);return new x(n,this.h|t.h)},y.xor=function(t){for(var e=Math.max(this.g.length,t.g.length),n=[],r=0;r<e;r++)n[r]=this.D(r)^t.D(r);return new x(n,this.h^t.h)};function Cu(t){for(var e=t.g.length+1,n=[],r=0;r<e;r++)n[r]=t.D(r)<<1|t.D(r-1)>>>31;return new x(n,t.h)}function Zt(t,e){var n=e>>5;e%=32;for(var r=t.g.length-n,s=[],i=0;i<r;i++)s[i]=0<e?t.D(i+n)>>>e|t.D(i+n+1)<<32-e:t.D(i+n);return new x(s,t.h)}hs.prototype.createWebChannel=hs.prototype.g,ve.prototype.send=ve.prototype.u,ve.prototype.open=ve.prototype.m,ve.prototype.close=ve.prototype.close,Jr.NO_ERROR=0,Jr.TIMEOUT=8,Jr.HTTP_ERROR=6,xc.COMPLETE="complete",Bc.EventType=Hn,Hn.OPEN="a",Hn.CLOSE="b",Hn.ERROR="c",Hn.MESSAGE="d",X.prototype.listen=X.prototype.O,H.prototype.listenOnce=H.prototype.P,H.prototype.getLastError=H.prototype.Sa,H.prototype.getLastErrorCode=H.prototype.Ia,H.prototype.getStatus=H.prototype.da,H.prototype.getResponseJson=H.prototype.Wa,H.prototype.getResponseText=H.prototype.ja,H.prototype.send=H.prototype.ha,H.prototype.setWithCredentials=H.prototype.Oa,ke.prototype.digest=ke.prototype.l,ke.prototype.reset=ke.prototype.reset,ke.prototype.update=ke.prototype.j,x.prototype.add=x.prototype.add,x.prototype.multiply=x.prototype.R,x.prototype.modulo=x.prototype.gb,x.prototype.compare=x.prototype.X,x.prototype.toNumber=x.prototype.ea,x.prototype.toString=x.prototype.toString,x.prototype.getBits=x.prototype.D,x.fromNumber=Ue,x.fromString=Pu;var Qm=function(){return new hs},Ym=function(){return Xr()},Eo=Jr,Xm=xc,Jm=bt,bu={xb:0,Ab:1,Bb:2,Ub:3,Zb:4,Wb:5,Xb:6,Vb:7,Tb:8,Yb:9,PROXY:10,NOPROXY:11,Rb:12,Nb:13,Ob:14,Mb:15,Pb:16,Qb:17,tb:18,sb:19,ub:20},Zm=Jn,ms=Bc,eg=H,tg=ke,en=x;const ku="@firebase/firestore";/**
361
+ */function Gp(n){It(new ct("platform-logger",e=>new ap(e),"PRIVATE")),It(new ct("heartbeat",e=>new zp(e),"PRIVATE")),Be(Ni,nc,n),Be(Ni,nc,"esm2017"),Be("fire-js","")}Gp("");var lc=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
362
+ Copyright The Closure Library Authors.
363
+ SPDX-License-Identifier: Apache-2.0
364
+ */var $t,hc;(function(){var n;/** @license
365
+
366
+ Copyright The Closure Library Authors.
367
+ SPDX-License-Identifier: Apache-2.0
368
+ */function e(T,m){function _(){}_.prototype=m.prototype,T.D=m.prototype,T.prototype=new _,T.prototype.constructor=T,T.C=function(E,w,A){for(var y=Array(arguments.length-2),vt=2;vt<arguments.length;vt++)y[vt-2]=arguments[vt];return m.prototype[w].apply(E,y)}}function t(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}e(r,t),r.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(T,m,_){_||(_=0);var E=Array(16);if(typeof m=="string")for(var w=0;16>w;++w)E[w]=m.charCodeAt(_++)|m.charCodeAt(_++)<<8|m.charCodeAt(_++)<<16|m.charCodeAt(_++)<<24;else for(w=0;16>w;++w)E[w]=m[_++]|m[_++]<<8|m[_++]<<16|m[_++]<<24;m=T.g[0],_=T.g[1],w=T.g[2];var A=T.g[3],y=m+(A^_&(w^A))+E[0]+3614090360&4294967295;m=_+(y<<7&4294967295|y>>>25),y=A+(w^m&(_^w))+E[1]+3905402710&4294967295,A=m+(y<<12&4294967295|y>>>20),y=w+(_^A&(m^_))+E[2]+606105819&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(m^w&(A^m))+E[3]+3250441966&4294967295,_=w+(y<<22&4294967295|y>>>10),y=m+(A^_&(w^A))+E[4]+4118548399&4294967295,m=_+(y<<7&4294967295|y>>>25),y=A+(w^m&(_^w))+E[5]+1200080426&4294967295,A=m+(y<<12&4294967295|y>>>20),y=w+(_^A&(m^_))+E[6]+2821735955&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(m^w&(A^m))+E[7]+4249261313&4294967295,_=w+(y<<22&4294967295|y>>>10),y=m+(A^_&(w^A))+E[8]+1770035416&4294967295,m=_+(y<<7&4294967295|y>>>25),y=A+(w^m&(_^w))+E[9]+2336552879&4294967295,A=m+(y<<12&4294967295|y>>>20),y=w+(_^A&(m^_))+E[10]+4294925233&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(m^w&(A^m))+E[11]+2304563134&4294967295,_=w+(y<<22&4294967295|y>>>10),y=m+(A^_&(w^A))+E[12]+1804603682&4294967295,m=_+(y<<7&4294967295|y>>>25),y=A+(w^m&(_^w))+E[13]+4254626195&4294967295,A=m+(y<<12&4294967295|y>>>20),y=w+(_^A&(m^_))+E[14]+2792965006&4294967295,w=A+(y<<17&4294967295|y>>>15),y=_+(m^w&(A^m))+E[15]+1236535329&4294967295,_=w+(y<<22&4294967295|y>>>10),y=m+(w^A&(_^w))+E[1]+4129170786&4294967295,m=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(m^_))+E[6]+3225465664&4294967295,A=m+(y<<9&4294967295|y>>>23),y=w+(m^_&(A^m))+E[11]+643717713&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^m&(w^A))+E[0]+3921069994&4294967295,_=w+(y<<20&4294967295|y>>>12),y=m+(w^A&(_^w))+E[5]+3593408605&4294967295,m=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(m^_))+E[10]+38016083&4294967295,A=m+(y<<9&4294967295|y>>>23),y=w+(m^_&(A^m))+E[15]+3634488961&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^m&(w^A))+E[4]+3889429448&4294967295,_=w+(y<<20&4294967295|y>>>12),y=m+(w^A&(_^w))+E[9]+568446438&4294967295,m=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(m^_))+E[14]+3275163606&4294967295,A=m+(y<<9&4294967295|y>>>23),y=w+(m^_&(A^m))+E[3]+4107603335&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^m&(w^A))+E[8]+1163531501&4294967295,_=w+(y<<20&4294967295|y>>>12),y=m+(w^A&(_^w))+E[13]+2850285829&4294967295,m=_+(y<<5&4294967295|y>>>27),y=A+(_^w&(m^_))+E[2]+4243563512&4294967295,A=m+(y<<9&4294967295|y>>>23),y=w+(m^_&(A^m))+E[7]+1735328473&4294967295,w=A+(y<<14&4294967295|y>>>18),y=_+(A^m&(w^A))+E[12]+2368359562&4294967295,_=w+(y<<20&4294967295|y>>>12),y=m+(_^w^A)+E[5]+4294588738&4294967295,m=_+(y<<4&4294967295|y>>>28),y=A+(m^_^w)+E[8]+2272392833&4294967295,A=m+(y<<11&4294967295|y>>>21),y=w+(A^m^_)+E[11]+1839030562&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^m)+E[14]+4259657740&4294967295,_=w+(y<<23&4294967295|y>>>9),y=m+(_^w^A)+E[1]+2763975236&4294967295,m=_+(y<<4&4294967295|y>>>28),y=A+(m^_^w)+E[4]+1272893353&4294967295,A=m+(y<<11&4294967295|y>>>21),y=w+(A^m^_)+E[7]+4139469664&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^m)+E[10]+3200236656&4294967295,_=w+(y<<23&4294967295|y>>>9),y=m+(_^w^A)+E[13]+681279174&4294967295,m=_+(y<<4&4294967295|y>>>28),y=A+(m^_^w)+E[0]+3936430074&4294967295,A=m+(y<<11&4294967295|y>>>21),y=w+(A^m^_)+E[3]+3572445317&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^m)+E[6]+76029189&4294967295,_=w+(y<<23&4294967295|y>>>9),y=m+(_^w^A)+E[9]+3654602809&4294967295,m=_+(y<<4&4294967295|y>>>28),y=A+(m^_^w)+E[12]+3873151461&4294967295,A=m+(y<<11&4294967295|y>>>21),y=w+(A^m^_)+E[15]+530742520&4294967295,w=A+(y<<16&4294967295|y>>>16),y=_+(w^A^m)+E[2]+3299628645&4294967295,_=w+(y<<23&4294967295|y>>>9),y=m+(w^(_|~A))+E[0]+4096336452&4294967295,m=_+(y<<6&4294967295|y>>>26),y=A+(_^(m|~w))+E[7]+1126891415&4294967295,A=m+(y<<10&4294967295|y>>>22),y=w+(m^(A|~_))+E[14]+2878612391&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~m))+E[5]+4237533241&4294967295,_=w+(y<<21&4294967295|y>>>11),y=m+(w^(_|~A))+E[12]+1700485571&4294967295,m=_+(y<<6&4294967295|y>>>26),y=A+(_^(m|~w))+E[3]+2399980690&4294967295,A=m+(y<<10&4294967295|y>>>22),y=w+(m^(A|~_))+E[10]+4293915773&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~m))+E[1]+2240044497&4294967295,_=w+(y<<21&4294967295|y>>>11),y=m+(w^(_|~A))+E[8]+1873313359&4294967295,m=_+(y<<6&4294967295|y>>>26),y=A+(_^(m|~w))+E[15]+4264355552&4294967295,A=m+(y<<10&4294967295|y>>>22),y=w+(m^(A|~_))+E[6]+2734768916&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~m))+E[13]+1309151649&4294967295,_=w+(y<<21&4294967295|y>>>11),y=m+(w^(_|~A))+E[4]+4149444226&4294967295,m=_+(y<<6&4294967295|y>>>26),y=A+(_^(m|~w))+E[11]+3174756917&4294967295,A=m+(y<<10&4294967295|y>>>22),y=w+(m^(A|~_))+E[2]+718787259&4294967295,w=A+(y<<15&4294967295|y>>>17),y=_+(A^(w|~m))+E[9]+3951481745&4294967295,T.g[0]=T.g[0]+m&4294967295,T.g[1]=T.g[1]+(w+(y<<21&4294967295|y>>>11))&4294967295,T.g[2]=T.g[2]+w&4294967295,T.g[3]=T.g[3]+A&4294967295}r.prototype.u=function(T,m){m===void 0&&(m=T.length);for(var _=m-this.blockSize,E=this.B,w=this.h,A=0;A<m;){if(w==0)for(;A<=_;)s(this,T,A),A+=this.blockSize;if(typeof T=="string"){for(;A<m;)if(E[w++]=T.charCodeAt(A++),w==this.blockSize){s(this,E),w=0;break}}else for(;A<m;)if(E[w++]=T[A++],w==this.blockSize){s(this,E),w=0;break}}this.h=w,this.o+=m},r.prototype.v=function(){var T=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);T[0]=128;for(var m=1;m<T.length-8;++m)T[m]=0;var _=8*this.o;for(m=T.length-8;m<T.length;++m)T[m]=_&255,_/=256;for(this.u(T),T=Array(16),m=_=0;4>m;++m)for(var E=0;32>E;E+=8)T[_++]=this.g[m]>>>E&255;return T};function i(T,m){var _=c;return Object.prototype.hasOwnProperty.call(_,T)?_[T]:_[T]=m(T)}function a(T,m){this.h=m;for(var _=[],E=!0,w=T.length-1;0<=w;w--){var A=T[w]|0;E&&A==m||(_[w]=A,E=!1)}this.g=_}var c={};function l(T){return-128<=T&&128>T?i(T,function(m){return new a([m|0],0>m?-1:0)}):new a([T|0],0>T?-1:0)}function d(T){if(isNaN(T)||!isFinite(T))return g;if(0>T)return S(d(-T));for(var m=[],_=1,E=0;T>=_;E++)m[E]=T/_|0,_*=4294967296;return new a(m,0)}function p(T,m){if(T.length==0)throw Error("number format error: empty string");if(m=m||10,2>m||36<m)throw Error("radix out of range: "+m);if(T.charAt(0)=="-")return S(p(T.substring(1),m));if(0<=T.indexOf("-"))throw Error('number format error: interior "-" character');for(var _=d(Math.pow(m,8)),E=g,w=0;w<T.length;w+=8){var A=Math.min(8,T.length-w),y=parseInt(T.substring(w,w+A),m);8>A?(A=d(Math.pow(m,A)),E=E.j(A).add(d(y))):(E=E.j(_),E=E.add(d(y)))}return E}var g=l(0),v=l(1),R=l(16777216);n=a.prototype,n.m=function(){if(N(this))return-S(this).m();for(var T=0,m=1,_=0;_<this.g.length;_++){var E=this.i(_);T+=(0<=E?E:4294967296+E)*m,m*=4294967296}return T},n.toString=function(T){if(T=T||10,2>T||36<T)throw Error("radix out of range: "+T);if(C(this))return"0";if(N(this))return"-"+S(this).toString(T);for(var m=d(Math.pow(T,6)),_=this,E="";;){var w=z(_,m).g;_=U(_,w.j(m));var A=((0<_.g.length?_.g[0]:_.h)>>>0).toString(T);if(_=w,C(_))return A+E;for(;6>A.length;)A="0"+A;E=A+E}},n.i=function(T){return 0>T?0:T<this.g.length?this.g[T]:this.h};function C(T){if(T.h!=0)return!1;for(var m=0;m<T.g.length;m++)if(T.g[m]!=0)return!1;return!0}function N(T){return T.h==-1}n.l=function(T){return T=U(this,T),N(T)?-1:C(T)?0:1};function S(T){for(var m=T.g.length,_=[],E=0;E<m;E++)_[E]=~T.g[E];return new a(_,~T.h).add(v)}n.abs=function(){return N(this)?S(this):this},n.add=function(T){for(var m=Math.max(this.g.length,T.g.length),_=[],E=0,w=0;w<=m;w++){var A=E+(this.i(w)&65535)+(T.i(w)&65535),y=(A>>>16)+(this.i(w)>>>16)+(T.i(w)>>>16);E=y>>>16,A&=65535,y&=65535,_[w]=y<<16|A}return new a(_,_[_.length-1]&-2147483648?-1:0)};function U(T,m){return T.add(S(m))}n.j=function(T){if(C(this)||C(T))return g;if(N(this))return N(T)?S(this).j(S(T)):S(S(this).j(T));if(N(T))return S(this.j(S(T)));if(0>this.l(R)&&0>T.l(R))return d(this.m()*T.m());for(var m=this.g.length+T.g.length,_=[],E=0;E<2*m;E++)_[E]=0;for(E=0;E<this.g.length;E++)for(var w=0;w<T.g.length;w++){var A=this.i(E)>>>16,y=this.i(E)&65535,vt=T.i(w)>>>16,Cr=T.i(w)&65535;_[2*E+2*w]+=y*Cr,$(_,2*E+2*w),_[2*E+2*w+1]+=A*Cr,$(_,2*E+2*w+1),_[2*E+2*w+1]+=y*vt,$(_,2*E+2*w+1),_[2*E+2*w+2]+=A*vt,$(_,2*E+2*w+2)}for(E=0;E<m;E++)_[E]=_[2*E+1]<<16|_[2*E];for(E=m;E<2*m;E++)_[E]=0;return new a(_,0)};function $(T,m){for(;(T[m]&65535)!=T[m];)T[m+1]+=T[m]>>>16,T[m]&=65535,m++}function x(T,m){this.g=T,this.h=m}function z(T,m){if(C(m))throw Error("division by zero");if(C(T))return new x(g,g);if(N(T))return m=z(S(T),m),new x(S(m.g),S(m.h));if(N(m))return m=z(T,S(m)),new x(S(m.g),m.h);if(30<T.g.length){if(N(T)||N(m))throw Error("slowDivide_ only works with positive integers.");for(var _=v,E=m;0>=E.l(T);)_=le(_),E=le(E);var w=J(_,1),A=J(E,1);for(E=J(E,2),_=J(_,2);!C(E);){var y=A.add(E);0>=y.l(T)&&(w=w.add(_),A=y),E=J(E,1),_=J(_,1)}return m=U(T,w.j(m)),new x(w,m)}for(w=g;0<=T.l(m);){for(_=Math.max(1,Math.floor(T.m()/m.m())),E=Math.ceil(Math.log(_)/Math.LN2),E=48>=E?1:Math.pow(2,E-48),A=d(_),y=A.j(m);N(y)||0<y.l(T);)_-=E,A=d(_),y=A.j(m);C(A)&&(A=v),w=w.add(A),T=U(T,y)}return new x(w,T)}n.A=function(T){return z(this,T).h},n.and=function(T){for(var m=Math.max(this.g.length,T.g.length),_=[],E=0;E<m;E++)_[E]=this.i(E)&T.i(E);return new a(_,this.h&T.h)},n.or=function(T){for(var m=Math.max(this.g.length,T.g.length),_=[],E=0;E<m;E++)_[E]=this.i(E)|T.i(E);return new a(_,this.h|T.h)},n.xor=function(T){for(var m=Math.max(this.g.length,T.g.length),_=[],E=0;E<m;E++)_[E]=this.i(E)^T.i(E);return new a(_,this.h^T.h)};function le(T){for(var m=T.g.length+1,_=[],E=0;E<m;E++)_[E]=T.i(E)<<1|T.i(E-1)>>>31;return new a(_,T.h)}function J(T,m){var _=m>>5;m%=32;for(var E=T.g.length-_,w=[],A=0;A<E;A++)w[A]=0<m?T.i(A+_)>>>m|T.i(A+_+1)<<32-m:T.i(A+_);return new a(w,T.h)}r.prototype.digest=r.prototype.v,r.prototype.reset=r.prototype.s,r.prototype.update=r.prototype.u,hc=r,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.A,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=d,a.fromString=p,$t=a}).apply(typeof lc<"u"?lc:typeof self<"u"?self:typeof window<"u"?window:{});var Jr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
369
+ Copyright The Closure Library Authors.
370
+ SPDX-License-Identifier: Apache-2.0
371
+ */var dc,fc,Yn,pc,Zr,Li,mc,gc,_c;(function(){var n,e=typeof Object.defineProperties=="function"?Object.defineProperty:function(o,u,h){return o==Array.prototype||o==Object.prototype||(o[u]=h.value),o};function t(o){o=[typeof globalThis=="object"&&globalThis,o,typeof window=="object"&&window,typeof self=="object"&&self,typeof Jr=="object"&&Jr];for(var u=0;u<o.length;++u){var h=o[u];if(h&&h.Math==Math)return h}throw Error("Cannot find global object")}var r=t(this);function s(o,u){if(u)e:{var h=r;o=o.split(".");for(var f=0;f<o.length-1;f++){var I=o[f];if(!(I in h))break e;h=h[I]}o=o[o.length-1],f=h[o],u=u(f),u!=f&&u!=null&&e(h,o,{configurable:!0,writable:!0,value:u})}}function i(o,u){o instanceof String&&(o+="");var h=0,f=!1,I={next:function(){if(!f&&h<o.length){var b=h++;return{value:u(b,o[b]),done:!1}}return f=!0,{done:!0,value:void 0}}};return I[Symbol.iterator]=function(){return I},I}s("Array.prototype.values",function(o){return o||function(){return i(this,function(u,h){return h})}});/** @license
372
+
373
+ Copyright The Closure Library Authors.
374
+ SPDX-License-Identifier: Apache-2.0
375
+ */var a=a||{},c=this||self;function l(o){var u=typeof o;return u=u!="object"?u:o?Array.isArray(o)?"array":u:"null",u=="array"||u=="object"&&typeof o.length=="number"}function d(o){var u=typeof o;return u=="object"&&o!=null||u=="function"}function p(o,u,h){return o.call.apply(o.bind,arguments)}function g(o,u,h){if(!o)throw Error();if(2<arguments.length){var f=Array.prototype.slice.call(arguments,2);return function(){var I=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(I,f),o.apply(u,I)}}return function(){return o.apply(u,arguments)}}function v(o,u,h){return v=Function.prototype.bind&&Function.prototype.bind.toString().indexOf("native code")!=-1?p:g,v.apply(null,arguments)}function R(o,u){var h=Array.prototype.slice.call(arguments,1);return function(){var f=h.slice();return f.push.apply(f,arguments),o.apply(this,f)}}function C(o,u){function h(){}h.prototype=u.prototype,o.aa=u.prototype,o.prototype=new h,o.prototype.constructor=o,o.Qb=function(f,I,b){for(var D=Array(arguments.length-2),Z=2;Z<arguments.length;Z++)D[Z-2]=arguments[Z];return u.prototype[I].apply(f,D)}}function N(o){const u=o.length;if(0<u){const h=Array(u);for(let f=0;f<u;f++)h[f]=o[f];return h}return[]}function S(o,u){for(let h=1;h<arguments.length;h++){const f=arguments[h];if(l(f)){const I=o.length||0,b=f.length||0;o.length=I+b;for(let D=0;D<b;D++)o[I+D]=f[D]}else o.push(f)}}class U{constructor(u,h){this.i=u,this.j=h,this.h=0,this.g=null}get(){let u;return 0<this.h?(this.h--,u=this.g,this.g=u.next,u.next=null):u=this.i(),u}}function $(o){return/^[\s\xa0]*$/.test(o)}function x(){var o=c.navigator;return o&&(o=o.userAgent)?o:""}function z(o){return z[" "](o),o}z[" "]=function(){};var le=x().indexOf("Gecko")!=-1&&!(x().toLowerCase().indexOf("webkit")!=-1&&x().indexOf("Edge")==-1)&&!(x().indexOf("Trident")!=-1||x().indexOf("MSIE")!=-1)&&x().indexOf("Edge")==-1;function J(o,u,h){for(const f in o)u.call(h,o[f],f,o)}function T(o,u){for(const h in o)u.call(void 0,o[h],h,o)}function m(o){const u={};for(const h in o)u[h]=o[h];return u}const _="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function E(o,u){let h,f;for(let I=1;I<arguments.length;I++){f=arguments[I];for(h in f)o[h]=f[h];for(let b=0;b<_.length;b++)h=_[b],Object.prototype.hasOwnProperty.call(f,h)&&(o[h]=f[h])}}function w(o){var u=1;o=o.split(":");const h=[];for(;0<u&&o.length;)h.push(o.shift()),u--;return o.length&&h.push(o.join(":")),h}function A(o){c.setTimeout(()=>{throw o},0)}function y(){var o=Ea;let u=null;return o.g&&(u=o.g,o.g=o.g.next,o.g||(o.h=null),u.next=null),u}class vt{constructor(){this.h=this.g=null}add(u,h){const f=Cr.get();f.set(u,h),this.h?this.h.next=f:this.g=f,this.h=f}}var Cr=new U(()=>new kw,o=>o.reset());class kw{constructor(){this.next=this.g=this.h=null}set(u,h){this.h=u,this.g=h,this.next=null}reset(){this.next=this.g=this.h=null}}let kr,Nr=!1,Ea=new vt,gd=()=>{const o=c.Promise.resolve(void 0);kr=()=>{o.then(Nw)}};var Nw=()=>{for(var o;o=y();){try{o.h.call(o.g)}catch(h){A(h)}var u=Cr;u.j(o),100>u.h&&(u.h++,o.next=u.g,u.g=o)}Nr=!1};function Ut(){this.s=this.s,this.C=this.C}Ut.prototype.s=!1,Ut.prototype.ma=function(){this.s||(this.s=!0,this.N())},Ut.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function Ae(o,u){this.type=o,this.g=this.target=u,this.defaultPrevented=!1}Ae.prototype.h=function(){this.defaultPrevented=!0};var Dw=function(){if(!c.addEventListener||!Object.defineProperty)return!1;var o=!1,u=Object.defineProperty({},"passive",{get:function(){o=!0}});try{const h=()=>{};c.addEventListener("test",h,u),c.removeEventListener("test",h,u)}catch{}return o}();function Dr(o,u){if(Ae.call(this,o?o.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,o){var h=this.type=o.type,f=o.changedTouches&&o.changedTouches.length?o.changedTouches[0]:null;if(this.target=o.target||o.srcElement,this.g=u,u=o.relatedTarget){if(le){e:{try{z(u.nodeName);var I=!0;break e}catch{}I=!1}I||(u=null)}}else h=="mouseover"?u=o.fromElement:h=="mouseout"&&(u=o.toElement);this.relatedTarget=u,f?(this.clientX=f.clientX!==void 0?f.clientX:f.pageX,this.clientY=f.clientY!==void 0?f.clientY:f.pageY,this.screenX=f.screenX||0,this.screenY=f.screenY||0):(this.clientX=o.clientX!==void 0?o.clientX:o.pageX,this.clientY=o.clientY!==void 0?o.clientY:o.pageY,this.screenX=o.screenX||0,this.screenY=o.screenY||0),this.button=o.button,this.key=o.key||"",this.ctrlKey=o.ctrlKey,this.altKey=o.altKey,this.shiftKey=o.shiftKey,this.metaKey=o.metaKey,this.pointerId=o.pointerId||0,this.pointerType=typeof o.pointerType=="string"?o.pointerType:Ow[o.pointerType]||"",this.state=o.state,this.i=o,o.defaultPrevented&&Dr.aa.h.call(this)}}C(Dr,Ae);var Ow={2:"touch",3:"pen",4:"mouse"};Dr.prototype.h=function(){Dr.aa.h.call(this);var o=this.i;o.preventDefault?o.preventDefault():o.returnValue=!1};var si="closure_listenable_"+(1e6*Math.random()|0),Vw=0;function Lw(o,u,h,f,I){this.listener=o,this.proxy=null,this.src=u,this.type=h,this.capture=!!f,this.ha=I,this.key=++Vw,this.da=this.fa=!1}function ii(o){o.da=!0,o.listener=null,o.proxy=null,o.src=null,o.ha=null}function oi(o){this.src=o,this.g={},this.h=0}oi.prototype.add=function(o,u,h,f,I){var b=o.toString();o=this.g[b],o||(o=this.g[b]=[],this.h++);var D=wa(o,u,f,I);return-1<D?(u=o[D],h||(u.fa=!1)):(u=new Lw(u,this.src,b,!!f,I),u.fa=h,o.push(u)),u};function Ta(o,u){var h=u.type;if(h in o.g){var f=o.g[h],I=Array.prototype.indexOf.call(f,u,void 0),b;(b=0<=I)&&Array.prototype.splice.call(f,I,1),b&&(ii(u),o.g[h].length==0&&(delete o.g[h],o.h--))}}function wa(o,u,h,f){for(var I=0;I<o.length;++I){var b=o[I];if(!b.da&&b.listener==u&&b.capture==!!h&&b.ha==f)return I}return-1}var Ia="closure_lm_"+(1e6*Math.random()|0),Aa={};function _d(o,u,h,f,I){if(Array.isArray(u)){for(var b=0;b<u.length;b++)_d(o,u[b],h,f,I);return null}return h=Ed(h),o&&o[si]?o.K(u,h,d(f)?!!f.capture:!!f,I):Mw(o,u,h,!1,f,I)}function Mw(o,u,h,f,I,b){if(!u)throw Error("Invalid event type");var D=d(I)?!!I.capture:!!I,Z=ba(o);if(Z||(o[Ia]=Z=new oi(o)),h=Z.add(u,h,f,D,b),h.proxy)return h;if(f=Uw(),h.proxy=f,f.src=o,f.listener=h,o.addEventListener)Dw||(I=D),I===void 0&&(I=!1),o.addEventListener(u.toString(),f,I);else if(o.attachEvent)o.attachEvent(vd(u.toString()),f);else if(o.addListener&&o.removeListener)o.addListener(f);else throw Error("addEventListener and attachEvent are unavailable.");return h}function Uw(){function o(h){return u.call(o.src,o.listener,h)}const u=xw;return o}function yd(o,u,h,f,I){if(Array.isArray(u))for(var b=0;b<u.length;b++)yd(o,u[b],h,f,I);else f=d(f)?!!f.capture:!!f,h=Ed(h),o&&o[si]?(o=o.i,u=String(u).toString(),u in o.g&&(b=o.g[u],h=wa(b,h,f,I),-1<h&&(ii(b[h]),Array.prototype.splice.call(b,h,1),b.length==0&&(delete o.g[u],o.h--)))):o&&(o=ba(o))&&(u=o.g[u.toString()],o=-1,u&&(o=wa(u,h,f,I)),(h=-1<o?u[o]:null)&&Ra(h))}function Ra(o){if(typeof o!="number"&&o&&!o.da){var u=o.src;if(u&&u[si])Ta(u.i,o);else{var h=o.type,f=o.proxy;u.removeEventListener?u.removeEventListener(h,f,o.capture):u.detachEvent?u.detachEvent(vd(h),f):u.addListener&&u.removeListener&&u.removeListener(f),(h=ba(u))?(Ta(h,o),h.h==0&&(h.src=null,u[Ia]=null)):ii(o)}}}function vd(o){return o in Aa?Aa[o]:Aa[o]="on"+o}function xw(o,u){if(o.da)o=!0;else{u=new Dr(u,this);var h=o.listener,f=o.ha||o.src;o.fa&&Ra(o),o=h.call(f,u)}return o}function ba(o){return o=o[Ia],o instanceof oi?o:null}var Pa="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ed(o){return typeof o=="function"?o:(o[Pa]||(o[Pa]=function(u){return o.handleEvent(u)}),o[Pa])}function Re(){Ut.call(this),this.i=new oi(this),this.M=this,this.F=null}C(Re,Ut),Re.prototype[si]=!0,Re.prototype.removeEventListener=function(o,u,h,f){yd(this,o,u,h,f)};function Ce(o,u){var h,f=o.F;if(f)for(h=[];f;f=f.F)h.push(f);if(o=o.M,f=u.type||u,typeof u=="string")u=new Ae(u,o);else if(u instanceof Ae)u.target=u.target||o;else{var I=u;u=new Ae(f,o),E(u,I)}if(I=!0,h)for(var b=h.length-1;0<=b;b--){var D=u.g=h[b];I=ai(D,f,!0,u)&&I}if(D=u.g=o,I=ai(D,f,!0,u)&&I,I=ai(D,f,!1,u)&&I,h)for(b=0;b<h.length;b++)D=u.g=h[b],I=ai(D,f,!1,u)&&I}Re.prototype.N=function(){if(Re.aa.N.call(this),this.i){var o=this.i,u;for(u in o.g){for(var h=o.g[u],f=0;f<h.length;f++)ii(h[f]);delete o.g[u],o.h--}}this.F=null},Re.prototype.K=function(o,u,h,f){return this.i.add(String(o),u,!1,h,f)},Re.prototype.L=function(o,u,h,f){return this.i.add(String(o),u,!0,h,f)};function ai(o,u,h,f){if(u=o.i.g[String(u)],!u)return!0;u=u.concat();for(var I=!0,b=0;b<u.length;++b){var D=u[b];if(D&&!D.da&&D.capture==h){var Z=D.listener,ve=D.ha||D.src;D.fa&&Ta(o.i,D),I=Z.call(ve,f)!==!1&&I}}return I&&!f.defaultPrevented}function Td(o,u,h){if(typeof o=="function")h&&(o=v(o,h));else if(o&&typeof o.handleEvent=="function")o=v(o.handleEvent,o);else throw Error("Invalid listener argument");return 2147483647<Number(u)?-1:c.setTimeout(o,u||0)}function wd(o){o.g=Td(()=>{o.g=null,o.i&&(o.i=!1,wd(o))},o.l);const u=o.h;o.h=null,o.m.apply(null,u)}class Fw extends Ut{constructor(u,h){super(),this.m=u,this.l=h,this.h=null,this.i=!1,this.g=null}j(u){this.h=arguments,this.g?this.i=!0:wd(this)}N(){super.N(),this.g&&(c.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function Or(o){Ut.call(this),this.h=o,this.g={}}C(Or,Ut);var Id=[];function Ad(o){J(o.g,function(u,h){this.g.hasOwnProperty(h)&&Ra(u)},o),o.g={}}Or.prototype.N=function(){Or.aa.N.call(this),Ad(this)},Or.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var Sa=c.JSON.stringify,Bw=c.JSON.parse,jw=class{stringify(o){return c.JSON.stringify(o,void 0)}parse(o){return c.JSON.parse(o,void 0)}};function Ca(){}Ca.prototype.h=null;function Rd(o){return o.h||(o.h=o.i())}function bd(){}var Vr={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function ka(){Ae.call(this,"d")}C(ka,Ae);function Na(){Ae.call(this,"c")}C(Na,Ae);var sn={},Pd=null;function ci(){return Pd=Pd||new Re}sn.La="serverreachability";function Sd(o){Ae.call(this,sn.La,o)}C(Sd,Ae);function Lr(o){const u=ci();Ce(u,new Sd(u))}sn.STAT_EVENT="statevent";function Cd(o,u){Ae.call(this,sn.STAT_EVENT,o),this.stat=u}C(Cd,Ae);function ke(o){const u=ci();Ce(u,new Cd(u,o))}sn.Ma="timingevent";function kd(o,u){Ae.call(this,sn.Ma,o),this.size=u}C(kd,Ae);function Mr(o,u){if(typeof o!="function")throw Error("Fn must not be null and must be a function");return c.setTimeout(function(){o()},u)}function Ur(){this.g=!0}Ur.prototype.xa=function(){this.g=!1};function qw(o,u,h,f,I,b){o.info(function(){if(o.g)if(b)for(var D="",Z=b.split("&"),ve=0;ve<Z.length;ve++){var Q=Z[ve].split("=");if(1<Q.length){var be=Q[0];Q=Q[1];var Pe=be.split("_");D=2<=Pe.length&&Pe[1]=="type"?D+(be+"="+Q+"&"):D+(be+"=redacted&")}}else D=null;else D=b;return"XMLHTTP REQ ("+f+") [attempt "+I+"]: "+u+`
376
+ `+h+`
377
+ `+D})}function $w(o,u,h,f,I,b,D){o.info(function(){return"XMLHTTP RESP ("+f+") [ attempt "+I+"]: "+u+`
378
+ `+h+`
379
+ `+b+" "+D})}function xn(o,u,h,f){o.info(function(){return"XMLHTTP TEXT ("+u+"): "+Hw(o,h)+(f?" "+f:"")})}function zw(o,u){o.info(function(){return"TIMEOUT: "+u})}Ur.prototype.info=function(){};function Hw(o,u){if(!o.g)return u;if(!u)return null;try{var h=JSON.parse(u);if(h){for(o=0;o<h.length;o++)if(Array.isArray(h[o])){var f=h[o];if(!(2>f.length)){var I=f[1];if(Array.isArray(I)&&!(1>I.length)){var b=I[0];if(b!="noop"&&b!="stop"&&b!="close")for(var D=1;D<I.length;D++)I[D]=""}}}}return Sa(h)}catch{return u}}var ui={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Nd={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"},Da;function li(){}C(li,Ca),li.prototype.g=function(){return new XMLHttpRequest},li.prototype.i=function(){return{}},Da=new li;function xt(o,u,h,f){this.j=o,this.i=u,this.l=h,this.R=f||1,this.U=new Or(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Dd}function Dd(){this.i=null,this.g="",this.h=!1}var Od={},Oa={};function Va(o,u,h){o.L=1,o.v=pi(Et(u)),o.m=h,o.P=!0,Vd(o,null)}function Vd(o,u){o.F=Date.now(),hi(o),o.A=Et(o.v);var h=o.A,f=o.R;Array.isArray(f)||(f=[String(f)]),Kd(h.i,"t",f),o.C=0,h=o.j.J,o.h=new Dd,o.g=ff(o.j,h?u:null,!o.m),0<o.O&&(o.M=new Fw(v(o.Y,o,o.g),o.O)),u=o.U,h=o.g,f=o.ca;var I="readystatechange";Array.isArray(I)||(I&&(Id[0]=I.toString()),I=Id);for(var b=0;b<I.length;b++){var D=_d(h,I[b],f||u.handleEvent,!1,u.h||u);if(!D)break;u.g[D.key]=D}u=o.H?m(o.H):{},o.m?(o.u||(o.u="POST"),u["Content-Type"]="application/x-www-form-urlencoded",o.g.ea(o.A,o.u,o.m,u)):(o.u="GET",o.g.ea(o.A,o.u,null,u)),Lr(),qw(o.i,o.u,o.A,o.l,o.R,o.m)}xt.prototype.ca=function(o){o=o.target;const u=this.M;u&&Tt(o)==3?u.j():this.Y(o)},xt.prototype.Y=function(o){try{if(o==this.g)e:{const Pe=Tt(this.g);var u=this.g.Ba();const jn=this.g.Z();if(!(3>Pe)&&(Pe!=3||this.g&&(this.h.h||this.g.oa()||tf(this.g)))){this.J||Pe!=4||u==7||(u==8||0>=jn?Lr(3):Lr(2)),La(this);var h=this.g.Z();this.X=h;t:if(Ld(this)){var f=tf(this.g);o="";var I=f.length,b=Tt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){on(this),xr(this);var D="";break t}this.h.i=new c.TextDecoder}for(u=0;u<I;u++)this.h.h=!0,o+=this.h.i.decode(f[u],{stream:!(b&&u==I-1)});f.length=0,this.h.g+=o,this.C=0,D=this.h.g}else D=this.g.oa();if(this.o=h==200,$w(this.i,this.u,this.A,this.l,this.R,Pe,h),this.o){if(this.T&&!this.K){t:{if(this.g){var Z,ve=this.g;if((Z=ve.g?ve.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!$(Z)){var Q=Z;break t}}Q=null}if(h=Q)xn(this.i,this.l,h,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ma(this,h);else{this.o=!1,this.s=3,ke(12),on(this),xr(this);break e}}if(this.P){h=!0;let Ye;for(;!this.J&&this.C<D.length;)if(Ye=Ww(this,D),Ye==Oa){Pe==4&&(this.s=4,ke(14),h=!1),xn(this.i,this.l,null,"[Incomplete Response]");break}else if(Ye==Od){this.s=4,ke(15),xn(this.i,this.l,D,"[Invalid Chunk]"),h=!1;break}else xn(this.i,this.l,Ye,null),Ma(this,Ye);if(Ld(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),Pe!=4||D.length!=0||this.h.h||(this.s=1,ke(16),h=!1),this.o=this.o&&h,!h)xn(this.i,this.l,D,"[Invalid Chunked Response]"),on(this),xr(this);else if(0<D.length&&!this.W){this.W=!0;var be=this.j;be.g==this&&be.ba&&!be.M&&(be.j.info("Great, no buffering proxy detected. Bytes received: "+D.length),qa(be),be.M=!0,ke(11))}}else xn(this.i,this.l,D,null),Ma(this,D);Pe==4&&on(this),this.o&&!this.J&&(Pe==4?uf(this.j,this):(this.o=!1,hi(this)))}else uI(this.g),h==400&&0<D.indexOf("Unknown SID")?(this.s=3,ke(12)):(this.s=0,ke(13)),on(this),xr(this)}}}catch{}finally{}};function Ld(o){return o.g?o.u=="GET"&&o.L!=2&&o.j.Ca:!1}function Ww(o,u){var h=o.C,f=u.indexOf(`
380
+ `,h);return f==-1?Oa:(h=Number(u.substring(h,f)),isNaN(h)?Od:(f+=1,f+h>u.length?Oa:(u=u.slice(f,f+h),o.C=f+h,u)))}xt.prototype.cancel=function(){this.J=!0,on(this)};function hi(o){o.S=Date.now()+o.I,Md(o,o.I)}function Md(o,u){if(o.B!=null)throw Error("WatchDog timer not null");o.B=Mr(v(o.ba,o),u)}function La(o){o.B&&(c.clearTimeout(o.B),o.B=null)}xt.prototype.ba=function(){this.B=null;const o=Date.now();0<=o-this.S?(zw(this.i,this.A),this.L!=2&&(Lr(),ke(17)),on(this),this.s=2,xr(this)):Md(this,this.S-o)};function xr(o){o.j.G==0||o.J||uf(o.j,o)}function on(o){La(o);var u=o.M;u&&typeof u.ma=="function"&&u.ma(),o.M=null,Ad(o.U),o.g&&(u=o.g,o.g=null,u.abort(),u.ma())}function Ma(o,u){try{var h=o.j;if(h.G!=0&&(h.g==o||Ua(h.h,o))){if(!o.K&&Ua(h.h,o)&&h.G==3){try{var f=h.Da.g.parse(u)}catch{f=null}if(Array.isArray(f)&&f.length==3){var I=f;if(I[0]==0){e:if(!h.u){if(h.g)if(h.g.F+3e3<o.F)vi(h),_i(h);else break e;ja(h),ke(18)}}else h.za=I[1],0<h.za-h.T&&37500>I[2]&&h.F&&h.v==0&&!h.C&&(h.C=Mr(v(h.Za,h),6e3));if(1>=Fd(h.h)&&h.ca){try{h.ca()}catch{}h.ca=void 0}}else cn(h,11)}else if((o.K||h.g==o)&&vi(h),!$(u))for(I=h.Da.g.parse(u),u=0;u<I.length;u++){let Q=I[u];if(h.T=Q[0],Q=Q[1],h.G==2)if(Q[0]=="c"){h.K=Q[1],h.ia=Q[2];const be=Q[3];be!=null&&(h.la=be,h.j.info("VER="+h.la));const Pe=Q[4];Pe!=null&&(h.Aa=Pe,h.j.info("SVER="+h.Aa));const jn=Q[5];jn!=null&&typeof jn=="number"&&0<jn&&(f=1.5*jn,h.L=f,h.j.info("backChannelRequestTimeoutMs_="+f)),f=h;const Ye=o.g;if(Ye){const Ti=Ye.g?Ye.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(Ti){var b=f.h;b.g||Ti.indexOf("spdy")==-1&&Ti.indexOf("quic")==-1&&Ti.indexOf("h2")==-1||(b.j=b.l,b.g=new Set,b.h&&(xa(b,b.h),b.h=null))}if(f.D){const $a=Ye.g?Ye.g.getResponseHeader("X-HTTP-Session-Id"):null;$a&&(f.ya=$a,ne(f.I,f.D,$a))}}h.G=3,h.l&&h.l.ua(),h.ba&&(h.R=Date.now()-o.F,h.j.info("Handshake RTT: "+h.R+"ms")),f=h;var D=o;if(f.qa=df(f,f.J?f.ia:null,f.W),D.K){Bd(f.h,D);var Z=D,ve=f.L;ve&&(Z.I=ve),Z.B&&(La(Z),hi(Z)),f.g=D}else af(f);0<h.i.length&&yi(h)}else Q[0]!="stop"&&Q[0]!="close"||cn(h,7);else h.G==3&&(Q[0]=="stop"||Q[0]=="close"?Q[0]=="stop"?cn(h,7):Ba(h):Q[0]!="noop"&&h.l&&h.l.ta(Q),h.v=0)}}Lr(4)}catch{}}var Gw=class{constructor(o,u){this.g=o,this.map=u}};function Ud(o){this.l=o||10,c.PerformanceNavigationTiming?(o=c.performance.getEntriesByType("navigation"),o=0<o.length&&(o[0].nextHopProtocol=="hq"||o[0].nextHopProtocol=="h2")):o=!!(c.chrome&&c.chrome.loadTimes&&c.chrome.loadTimes()&&c.chrome.loadTimes().wasFetchedViaSpdy),this.j=o?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function xd(o){return o.h?!0:o.g?o.g.size>=o.j:!1}function Fd(o){return o.h?1:o.g?o.g.size:0}function Ua(o,u){return o.h?o.h==u:o.g?o.g.has(u):!1}function xa(o,u){o.g?o.g.add(u):o.h=u}function Bd(o,u){o.h&&o.h==u?o.h=null:o.g&&o.g.has(u)&&o.g.delete(u)}Ud.prototype.cancel=function(){if(this.i=jd(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const o of this.g.values())o.cancel();this.g.clear()}};function jd(o){if(o.h!=null)return o.i.concat(o.h.D);if(o.g!=null&&o.g.size!==0){let u=o.i;for(const h of o.g.values())u=u.concat(h.D);return u}return N(o.i)}function Kw(o){if(o.V&&typeof o.V=="function")return o.V();if(typeof Map<"u"&&o instanceof Map||typeof Set<"u"&&o instanceof Set)return Array.from(o.values());if(typeof o=="string")return o.split("");if(l(o)){for(var u=[],h=o.length,f=0;f<h;f++)u.push(o[f]);return u}u=[],h=0;for(f in o)u[h++]=o[f];return u}function Qw(o){if(o.na&&typeof o.na=="function")return o.na();if(!o.V||typeof o.V!="function"){if(typeof Map<"u"&&o instanceof Map)return Array.from(o.keys());if(!(typeof Set<"u"&&o instanceof Set)){if(l(o)||typeof o=="string"){var u=[];o=o.length;for(var h=0;h<o;h++)u.push(h);return u}u=[],h=0;for(const f in o)u[h++]=f;return u}}}function qd(o,u){if(o.forEach&&typeof o.forEach=="function")o.forEach(u,void 0);else if(l(o)||typeof o=="string")Array.prototype.forEach.call(o,u,void 0);else for(var h=Qw(o),f=Kw(o),I=f.length,b=0;b<I;b++)u.call(void 0,f[b],h&&h[b],o)}var $d=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Yw(o,u){if(o){o=o.split("&");for(var h=0;h<o.length;h++){var f=o[h].indexOf("="),I=null;if(0<=f){var b=o[h].substring(0,f);I=o[h].substring(f+1)}else b=o[h];u(b,I?decodeURIComponent(I.replace(/\+/g," ")):"")}}}function an(o){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,o instanceof an){this.h=o.h,di(this,o.j),this.o=o.o,this.g=o.g,fi(this,o.s),this.l=o.l;var u=o.i,h=new jr;h.i=u.i,u.g&&(h.g=new Map(u.g),h.h=u.h),zd(this,h),this.m=o.m}else o&&(u=String(o).match($d))?(this.h=!1,di(this,u[1]||"",!0),this.o=Fr(u[2]||""),this.g=Fr(u[3]||"",!0),fi(this,u[4]),this.l=Fr(u[5]||"",!0),zd(this,u[6]||"",!0),this.m=Fr(u[7]||"")):(this.h=!1,this.i=new jr(null,this.h))}an.prototype.toString=function(){var o=[],u=this.j;u&&o.push(Br(u,Hd,!0),":");var h=this.g;return(h||u=="file")&&(o.push("//"),(u=this.o)&&o.push(Br(u,Hd,!0),"@"),o.push(encodeURIComponent(String(h)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),h=this.s,h!=null&&o.push(":",String(h))),(h=this.l)&&(this.g&&h.charAt(0)!="/"&&o.push("/"),o.push(Br(h,h.charAt(0)=="/"?Zw:Jw,!0))),(h=this.i.toString())&&o.push("?",h),(h=this.m)&&o.push("#",Br(h,tI)),o.join("")};function Et(o){return new an(o)}function di(o,u,h){o.j=h?Fr(u,!0):u,o.j&&(o.j=o.j.replace(/:$/,""))}function fi(o,u){if(u){if(u=Number(u),isNaN(u)||0>u)throw Error("Bad port number "+u);o.s=u}else o.s=null}function zd(o,u,h){u instanceof jr?(o.i=u,nI(o.i,o.h)):(h||(u=Br(u,eI)),o.i=new jr(u,o.h))}function ne(o,u,h){o.i.set(u,h)}function pi(o){return ne(o,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),o}function Fr(o,u){return o?u?decodeURI(o.replace(/%25/g,"%2525")):decodeURIComponent(o):""}function Br(o,u,h){return typeof o=="string"?(o=encodeURI(o).replace(u,Xw),h&&(o=o.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),o):null}function Xw(o){return o=o.charCodeAt(0),"%"+(o>>4&15).toString(16)+(o&15).toString(16)}var Hd=/[#\/\?@]/g,Jw=/[#\?:]/g,Zw=/[#\?]/g,eI=/[#\?@]/g,tI=/#/g;function jr(o,u){this.h=this.g=null,this.i=o||null,this.j=!!u}function Ft(o){o.g||(o.g=new Map,o.h=0,o.i&&Yw(o.i,function(u,h){o.add(decodeURIComponent(u.replace(/\+/g," ")),h)}))}n=jr.prototype,n.add=function(o,u){Ft(this),this.i=null,o=Fn(this,o);var h=this.g.get(o);return h||this.g.set(o,h=[]),h.push(u),this.h+=1,this};function Wd(o,u){Ft(o),u=Fn(o,u),o.g.has(u)&&(o.i=null,o.h-=o.g.get(u).length,o.g.delete(u))}function Gd(o,u){return Ft(o),u=Fn(o,u),o.g.has(u)}n.forEach=function(o,u){Ft(this),this.g.forEach(function(h,f){h.forEach(function(I){o.call(u,I,f,this)},this)},this)},n.na=function(){Ft(this);const o=Array.from(this.g.values()),u=Array.from(this.g.keys()),h=[];for(let f=0;f<u.length;f++){const I=o[f];for(let b=0;b<I.length;b++)h.push(u[f])}return h},n.V=function(o){Ft(this);let u=[];if(typeof o=="string")Gd(this,o)&&(u=u.concat(this.g.get(Fn(this,o))));else{o=Array.from(this.g.values());for(let h=0;h<o.length;h++)u=u.concat(o[h])}return u},n.set=function(o,u){return Ft(this),this.i=null,o=Fn(this,o),Gd(this,o)&&(this.h-=this.g.get(o).length),this.g.set(o,[u]),this.h+=1,this},n.get=function(o,u){return o?(o=this.V(o),0<o.length?String(o[0]):u):u};function Kd(o,u,h){Wd(o,u),0<h.length&&(o.i=null,o.g.set(Fn(o,u),N(h)),o.h+=h.length)}n.toString=function(){if(this.i)return this.i;if(!this.g)return"";const o=[],u=Array.from(this.g.keys());for(var h=0;h<u.length;h++){var f=u[h];const b=encodeURIComponent(String(f)),D=this.V(f);for(f=0;f<D.length;f++){var I=b;D[f]!==""&&(I+="="+encodeURIComponent(String(D[f]))),o.push(I)}}return this.i=o.join("&")};function Fn(o,u){return u=String(u),o.j&&(u=u.toLowerCase()),u}function nI(o,u){u&&!o.j&&(Ft(o),o.i=null,o.g.forEach(function(h,f){var I=f.toLowerCase();f!=I&&(Wd(this,f),Kd(this,I,h))},o)),o.j=u}function rI(o,u){const h=new Ur;if(c.Image){const f=new Image;f.onload=R(Bt,h,"TestLoadImage: loaded",!0,u,f),f.onerror=R(Bt,h,"TestLoadImage: error",!1,u,f),f.onabort=R(Bt,h,"TestLoadImage: abort",!1,u,f),f.ontimeout=R(Bt,h,"TestLoadImage: timeout",!1,u,f),c.setTimeout(function(){f.ontimeout&&f.ontimeout()},1e4),f.src=o}else u(!1)}function sI(o,u){const h=new Ur,f=new AbortController,I=setTimeout(()=>{f.abort(),Bt(h,"TestPingServer: timeout",!1,u)},1e4);fetch(o,{signal:f.signal}).then(b=>{clearTimeout(I),b.ok?Bt(h,"TestPingServer: ok",!0,u):Bt(h,"TestPingServer: server error",!1,u)}).catch(()=>{clearTimeout(I),Bt(h,"TestPingServer: error",!1,u)})}function Bt(o,u,h,f,I){try{I&&(I.onload=null,I.onerror=null,I.onabort=null,I.ontimeout=null),f(h)}catch{}}function iI(){this.g=new jw}function oI(o,u,h){const f=h||"";try{qd(o,function(I,b){let D=I;d(I)&&(D=Sa(I)),u.push(f+b+"="+encodeURIComponent(D))})}catch(I){throw u.push(f+"type="+encodeURIComponent("_badmap")),I}}function qr(o){this.l=o.Ub||null,this.j=o.eb||!1}C(qr,Ca),qr.prototype.g=function(){return new mi(this.l,this.j)},qr.prototype.i=function(o){return function(){return o}}({});function mi(o,u){Re.call(this),this.D=o,this.o=u,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}C(mi,Re),n=mi.prototype,n.open=function(o,u){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=o,this.A=u,this.readyState=1,zr(this)},n.send=function(o){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const u={headers:this.u,method:this.B,credentials:this.m,cache:void 0};o&&(u.body=o),(this.D||c).fetch(new Request(this.A,u)).then(this.Sa.bind(this),this.ga.bind(this))},n.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,$r(this)),this.readyState=0},n.Sa=function(o){if(this.g&&(this.l=o,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=o.headers,this.readyState=2,zr(this)),this.g&&(this.readyState=3,zr(this),this.g)))if(this.responseType==="arraybuffer")o.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof c.ReadableStream<"u"&&"body"in o){if(this.j=o.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Qd(this)}else o.text().then(this.Ra.bind(this),this.ga.bind(this))};function Qd(o){o.j.read().then(o.Pa.bind(o)).catch(o.ga.bind(o))}n.Pa=function(o){if(this.g){if(this.o&&o.value)this.response.push(o.value);else if(!this.o){var u=o.value?o.value:new Uint8Array(0);(u=this.v.decode(u,{stream:!o.done}))&&(this.response=this.responseText+=u)}o.done?$r(this):zr(this),this.readyState==3&&Qd(this)}},n.Ra=function(o){this.g&&(this.response=this.responseText=o,$r(this))},n.Qa=function(o){this.g&&(this.response=o,$r(this))},n.ga=function(){this.g&&$r(this)};function $r(o){o.readyState=4,o.l=null,o.j=null,o.v=null,zr(o)}n.setRequestHeader=function(o,u){this.u.append(o,u)},n.getResponseHeader=function(o){return this.h&&this.h.get(o.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";const o=[],u=this.h.entries();for(var h=u.next();!h.done;)h=h.value,o.push(h[0]+": "+h[1]),h=u.next();return o.join(`\r
381
+ `)};function zr(o){o.onreadystatechange&&o.onreadystatechange.call(o)}Object.defineProperty(mi.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(o){this.m=o?"include":"same-origin"}});function Yd(o){let u="";return J(o,function(h,f){u+=f,u+=":",u+=h,u+=`\r
382
+ `}),u}function Fa(o,u,h){e:{for(f in h){var f=!1;break e}f=!0}f||(h=Yd(h),typeof o=="string"?h!=null&&encodeURIComponent(String(h)):ne(o,u,h))}function ie(o){Re.call(this),this.headers=new Map,this.o=o||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}C(ie,Re);var aI=/^https?$/i,cI=["POST","PUT"];n=ie.prototype,n.Ha=function(o){this.J=o},n.ea=function(o,u,h,f){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+o);u=u?u.toUpperCase():"GET",this.D=o,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Da.g(),this.v=this.o?Rd(this.o):Rd(Da),this.g.onreadystatechange=v(this.Ea,this);try{this.B=!0,this.g.open(u,String(o),!0),this.B=!1}catch(b){Xd(this,b);return}if(o=h||"",h=new Map(this.headers),f)if(Object.getPrototypeOf(f)===Object.prototype)for(var I in f)h.set(I,f[I]);else if(typeof f.keys=="function"&&typeof f.get=="function")for(const b of f.keys())h.set(b,f.get(b));else throw Error("Unknown input type for opt_headers: "+String(f));f=Array.from(h.keys()).find(b=>b.toLowerCase()=="content-type"),I=c.FormData&&o instanceof c.FormData,!(0<=Array.prototype.indexOf.call(cI,u,void 0))||f||I||h.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[b,D]of h)this.g.setRequestHeader(b,D);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{ef(this),this.u=!0,this.g.send(o),this.u=!1}catch(b){Xd(this,b)}};function Xd(o,u){o.h=!1,o.g&&(o.j=!0,o.g.abort(),o.j=!1),o.l=u,o.m=5,Jd(o),gi(o)}function Jd(o){o.A||(o.A=!0,Ce(o,"complete"),Ce(o,"error"))}n.abort=function(o){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=o||7,Ce(this,"complete"),Ce(this,"abort"),gi(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),gi(this,!0)),ie.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?Zd(this):this.bb())},n.bb=function(){Zd(this)};function Zd(o){if(o.h&&typeof a<"u"&&(!o.v[1]||Tt(o)!=4||o.Z()!=2)){if(o.u&&Tt(o)==4)Td(o.Ea,0,o);else if(Ce(o,"readystatechange"),Tt(o)==4){o.h=!1;try{const D=o.Z();e:switch(D){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var u=!0;break e;default:u=!1}var h;if(!(h=u)){var f;if(f=D===0){var I=String(o.D).match($d)[1]||null;!I&&c.self&&c.self.location&&(I=c.self.location.protocol.slice(0,-1)),f=!aI.test(I?I.toLowerCase():"")}h=f}if(h)Ce(o,"complete"),Ce(o,"success");else{o.m=6;try{var b=2<Tt(o)?o.g.statusText:""}catch{b=""}o.l=b+" ["+o.Z()+"]",Jd(o)}}finally{gi(o)}}}}function gi(o,u){if(o.g){ef(o);const h=o.g,f=o.v[0]?()=>{}:null;o.g=null,o.v=null,u||Ce(o,"ready");try{h.onreadystatechange=f}catch{}}}function ef(o){o.I&&(c.clearTimeout(o.I),o.I=null)}n.isActive=function(){return!!this.g};function Tt(o){return o.g?o.g.readyState:0}n.Z=function(){try{return 2<Tt(this)?this.g.status:-1}catch{return-1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},n.Oa=function(o){if(this.g){var u=this.g.responseText;return o&&u.indexOf(o)==0&&(u=u.substring(o.length)),Bw(u)}};function tf(o){try{if(!o.g)return null;if("response"in o.g)return o.g.response;switch(o.H){case"":case"text":return o.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in o.g)return o.g.mozResponseArrayBuffer}return null}catch{return null}}function uI(o){const u={};o=(o.g&&2<=Tt(o)&&o.g.getAllResponseHeaders()||"").split(`\r
383
+ `);for(let f=0;f<o.length;f++){if($(o[f]))continue;var h=w(o[f]);const I=h[0];if(h=h[1],typeof h!="string")continue;h=h.trim();const b=u[I]||[];u[I]=b,b.push(h)}T(u,function(f){return f.join(", ")})}n.Ba=function(){return this.m},n.Ka=function(){return typeof this.l=="string"?this.l:String(this.l)};function Hr(o,u,h){return h&&h.internalChannelParams&&h.internalChannelParams[o]||u}function nf(o){this.Aa=0,this.i=[],this.j=new Ur,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=Hr("failFast",!1,o),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=Hr("baseRetryDelayMs",5e3,o),this.cb=Hr("retryDelaySeedMs",1e4,o),this.Wa=Hr("forwardChannelMaxRetries",2,o),this.wa=Hr("forwardChannelRequestTimeoutMs",2e4,o),this.pa=o&&o.xmlHttpFactory||void 0,this.Xa=o&&o.Tb||void 0,this.Ca=o&&o.useFetchStreams||!1,this.L=void 0,this.J=o&&o.supportsCrossDomainXhr||!1,this.K="",this.h=new Ud(o&&o.concurrentRequestLimit),this.Da=new iI,this.P=o&&o.fastHandshake||!1,this.O=o&&o.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=o&&o.Rb||!1,o&&o.xa&&this.j.xa(),o&&o.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&o&&o.detectBufferingProxy||!1,this.ja=void 0,o&&o.longPollingTimeout&&0<o.longPollingTimeout&&(this.ja=o.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}n=nf.prototype,n.la=8,n.G=1,n.connect=function(o,u,h,f){ke(0),this.W=o,this.H=u||{},h&&f!==void 0&&(this.H.OSID=h,this.H.OAID=f),this.F=this.X,this.I=df(this,null,this.W),yi(this)};function Ba(o){if(rf(o),o.G==3){var u=o.U++,h=Et(o.I);if(ne(h,"SID",o.K),ne(h,"RID",u),ne(h,"TYPE","terminate"),Wr(o,h),u=new xt(o,o.j,u),u.L=2,u.v=pi(Et(h)),h=!1,c.navigator&&c.navigator.sendBeacon)try{h=c.navigator.sendBeacon(u.v.toString(),"")}catch{}!h&&c.Image&&(new Image().src=u.v,h=!0),h||(u.g=ff(u.j,null),u.g.ea(u.v)),u.F=Date.now(),hi(u)}hf(o)}function _i(o){o.g&&(qa(o),o.g.cancel(),o.g=null)}function rf(o){_i(o),o.u&&(c.clearTimeout(o.u),o.u=null),vi(o),o.h.cancel(),o.s&&(typeof o.s=="number"&&c.clearTimeout(o.s),o.s=null)}function yi(o){if(!xd(o.h)&&!o.s){o.s=!0;var u=o.Ga;kr||gd(),Nr||(kr(),Nr=!0),Ea.add(u,o),o.B=0}}function lI(o,u){return Fd(o.h)>=o.h.j-(o.s?1:0)?!1:o.s?(o.i=u.D.concat(o.i),!0):o.G==1||o.G==2||o.B>=(o.Va?0:o.Wa)?!1:(o.s=Mr(v(o.Ga,o,u),lf(o,o.B)),o.B++,!0)}n.Ga=function(o){if(this.s)if(this.s=null,this.G==1){if(!o){this.U=Math.floor(1e5*Math.random()),o=this.U++;const I=new xt(this,this.j,o);let b=this.o;if(this.S&&(b?(b=m(b),E(b,this.S)):b=this.S),this.m!==null||this.O||(I.H=b,b=null),this.P)e:{for(var u=0,h=0;h<this.i.length;h++){t:{var f=this.i[h];if("__data__"in f.map&&(f=f.map.__data__,typeof f=="string")){f=f.length;break t}f=void 0}if(f===void 0)break;if(u+=f,4096<u){u=h;break e}if(u===4096||h===this.i.length-1){u=h+1;break e}}u=1e3}else u=1e3;u=of(this,I,u),h=Et(this.I),ne(h,"RID",o),ne(h,"CVER",22),this.D&&ne(h,"X-HTTP-Session-Id",this.D),Wr(this,h),b&&(this.O?u="headers="+encodeURIComponent(String(Yd(b)))+"&"+u:this.m&&Fa(h,this.m,b)),xa(this.h,I),this.Ua&&ne(h,"TYPE","init"),this.P?(ne(h,"$req",u),ne(h,"SID","null"),I.T=!0,Va(I,h,null)):Va(I,h,u),this.G=2}}else this.G==3&&(o?sf(this,o):this.i.length==0||xd(this.h)||sf(this))};function sf(o,u){var h;u?h=u.l:h=o.U++;const f=Et(o.I);ne(f,"SID",o.K),ne(f,"RID",h),ne(f,"AID",o.T),Wr(o,f),o.m&&o.o&&Fa(f,o.m,o.o),h=new xt(o,o.j,h,o.B+1),o.m===null&&(h.H=o.o),u&&(o.i=u.D.concat(o.i)),u=of(o,h,1e3),h.I=Math.round(.5*o.wa)+Math.round(.5*o.wa*Math.random()),xa(o.h,h),Va(h,f,u)}function Wr(o,u){o.H&&J(o.H,function(h,f){ne(u,f,h)}),o.l&&qd({},function(h,f){ne(u,f,h)})}function of(o,u,h){h=Math.min(o.i.length,h);var f=o.l?v(o.l.Na,o.l,o):null;e:{var I=o.i;let b=-1;for(;;){const D=["count="+h];b==-1?0<h?(b=I[0].g,D.push("ofs="+b)):b=0:D.push("ofs="+b);let Z=!0;for(let ve=0;ve<h;ve++){let Q=I[ve].g;const be=I[ve].map;if(Q-=b,0>Q)b=Math.max(0,I[ve].g-100),Z=!1;else try{oI(be,D,"req"+Q+"_")}catch{f&&f(be)}}if(Z){f=D.join("&");break e}}}return o=o.i.splice(0,h),u.D=o,f}function af(o){if(!o.g&&!o.u){o.Y=1;var u=o.Fa;kr||gd(),Nr||(kr(),Nr=!0),Ea.add(u,o),o.v=0}}function ja(o){return o.g||o.u||3<=o.v?!1:(o.Y++,o.u=Mr(v(o.Fa,o),lf(o,o.v)),o.v++,!0)}n.Fa=function(){if(this.u=null,cf(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var o=2*this.R;this.j.info("BP detection timer enabled: "+o),this.A=Mr(v(this.ab,this),o)}},n.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,ke(10),_i(this),cf(this))};function qa(o){o.A!=null&&(c.clearTimeout(o.A),o.A=null)}function cf(o){o.g=new xt(o,o.j,"rpc",o.Y),o.m===null&&(o.g.H=o.o),o.g.O=0;var u=Et(o.qa);ne(u,"RID","rpc"),ne(u,"SID",o.K),ne(u,"AID",o.T),ne(u,"CI",o.F?"0":"1"),!o.F&&o.ja&&ne(u,"TO",o.ja),ne(u,"TYPE","xmlhttp"),Wr(o,u),o.m&&o.o&&Fa(u,o.m,o.o),o.L&&(o.g.I=o.L);var h=o.g;o=o.ia,h.L=1,h.v=pi(Et(u)),h.m=null,h.P=!0,Vd(h,o)}n.Za=function(){this.C!=null&&(this.C=null,_i(this),ja(this),ke(19))};function vi(o){o.C!=null&&(c.clearTimeout(o.C),o.C=null)}function uf(o,u){var h=null;if(o.g==u){vi(o),qa(o),o.g=null;var f=2}else if(Ua(o.h,u))h=u.D,Bd(o.h,u),f=1;else return;if(o.G!=0){if(u.o)if(f==1){h=u.m?u.m.length:0,u=Date.now()-u.F;var I=o.B;f=ci(),Ce(f,new kd(f,h)),yi(o)}else af(o);else if(I=u.s,I==3||I==0&&0<u.X||!(f==1&&lI(o,u)||f==2&&ja(o)))switch(h&&0<h.length&&(u=o.h,u.i=u.i.concat(h)),I){case 1:cn(o,5);break;case 4:cn(o,10);break;case 3:cn(o,6);break;default:cn(o,2)}}}function lf(o,u){let h=o.Ta+Math.floor(Math.random()*o.cb);return o.isActive()||(h*=2),h*u}function cn(o,u){if(o.j.info("Error code "+u),u==2){var h=v(o.fb,o),f=o.Xa;const I=!f;f=new an(f||"//www.google.com/images/cleardot.gif"),c.location&&c.location.protocol=="http"||di(f,"https"),pi(f),I?rI(f.toString(),h):sI(f.toString(),h)}else ke(2);o.G=0,o.l&&o.l.sa(u),hf(o),rf(o)}n.fb=function(o){o?(this.j.info("Successfully pinged google.com"),ke(2)):(this.j.info("Failed to ping google.com"),ke(1))};function hf(o){if(o.G=0,o.ka=[],o.l){const u=jd(o.h);(u.length!=0||o.i.length!=0)&&(S(o.ka,u),S(o.ka,o.i),o.h.i.length=0,N(o.i),o.i.length=0),o.l.ra()}}function df(o,u,h){var f=h instanceof an?Et(h):new an(h);if(f.g!="")u&&(f.g=u+"."+f.g),fi(f,f.s);else{var I=c.location;f=I.protocol,u=u?u+"."+I.hostname:I.hostname,I=+I.port;var b=new an(null);f&&di(b,f),u&&(b.g=u),I&&fi(b,I),h&&(b.l=h),f=b}return h=o.D,u=o.ya,h&&u&&ne(f,h,u),ne(f,"VER",o.la),Wr(o,f),f}function ff(o,u,h){if(u&&!o.J)throw Error("Can't create secondary domain capable XhrIo object.");return u=o.Ca&&!o.pa?new ie(new qr({eb:h})):new ie(o.pa),u.Ha(o.J),u}n.isActive=function(){return!!this.l&&this.l.isActive(this)};function pf(){}n=pf.prototype,n.ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){};function Ei(){}Ei.prototype.g=function(o,u){return new xe(o,u)};function xe(o,u){Re.call(this),this.g=new nf(u),this.l=o,this.h=u&&u.messageUrlParams||null,o=u&&u.messageHeaders||null,u&&u.clientProtocolHeaderRequired&&(o?o["X-Client-Protocol"]="webchannel":o={"X-Client-Protocol":"webchannel"}),this.g.o=o,o=u&&u.initMessageHeaders||null,u&&u.messageContentType&&(o?o["X-WebChannel-Content-Type"]=u.messageContentType:o={"X-WebChannel-Content-Type":u.messageContentType}),u&&u.va&&(o?o["X-WebChannel-Client-Profile"]=u.va:o={"X-WebChannel-Client-Profile":u.va}),this.g.S=o,(o=u&&u.Sb)&&!$(o)&&(this.g.m=o),this.v=u&&u.supportsCrossDomainXhr||!1,this.u=u&&u.sendRawJson||!1,(u=u&&u.httpSessionIdParam)&&!$(u)&&(this.g.D=u,o=this.h,o!==null&&u in o&&(o=this.h,u in o&&delete o[u])),this.j=new Bn(this)}C(xe,Re),xe.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},xe.prototype.close=function(){Ba(this.g)},xe.prototype.o=function(o){var u=this.g;if(typeof o=="string"){var h={};h.__data__=o,o=h}else this.u&&(h={},h.__data__=Sa(o),o=h);u.i.push(new Gw(u.Ya++,o)),u.G==3&&yi(u)},xe.prototype.N=function(){this.g.l=null,delete this.j,Ba(this.g),delete this.g,xe.aa.N.call(this)};function mf(o){ka.call(this),o.__headers__&&(this.headers=o.__headers__,this.statusCode=o.__status__,delete o.__headers__,delete o.__status__);var u=o.__sm__;if(u){e:{for(const h in u){o=h;break e}o=void 0}(this.i=o)&&(o=this.i,u=u!==null&&o in u?u[o]:void 0),this.data=u}else this.data=o}C(mf,ka);function gf(){Na.call(this),this.status=1}C(gf,Na);function Bn(o){this.g=o}C(Bn,pf),Bn.prototype.ua=function(){Ce(this.g,"a")},Bn.prototype.ta=function(o){Ce(this.g,new mf(o))},Bn.prototype.sa=function(o){Ce(this.g,new gf)},Bn.prototype.ra=function(){Ce(this.g,"b")},Ei.prototype.createWebChannel=Ei.prototype.g,xe.prototype.send=xe.prototype.o,xe.prototype.open=xe.prototype.m,xe.prototype.close=xe.prototype.close,_c=function(){return new Ei},gc=function(){return ci()},mc=sn,Li={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},ui.NO_ERROR=0,ui.TIMEOUT=8,ui.HTTP_ERROR=6,Zr=ui,Nd.COMPLETE="complete",pc=Nd,bd.EventType=Vr,Vr.OPEN="a",Vr.CLOSE="b",Vr.ERROR="c",Vr.MESSAGE="d",Re.prototype.listen=Re.prototype.K,Yn=bd,fc=qr,ie.prototype.listenOnce=ie.prototype.L,ie.prototype.getLastError=ie.prototype.Ka,ie.prototype.getLastErrorCode=ie.prototype.Ba,ie.prototype.getStatus=ie.prototype.Z,ie.prototype.getResponseJson=ie.prototype.Oa,ie.prototype.getResponseText=ie.prototype.oa,ie.prototype.send=ie.prototype.ea,ie.prototype.setWithCredentials=ie.prototype.Ha,dc=ie}).apply(typeof Jr<"u"?Jr:typeof self<"u"?self:typeof window<"u"?window:{});const yc="@firebase/firestore";/**
370
384
  * @license
371
385
  * Copyright 2017 Google LLC
372
386
  *
@@ -381,7 +395,7 @@
381
395
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
382
396
  * See the License for the specific language governing permissions and
383
397
  * limitations under the License.
384
- */class ce{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}ce.UNAUTHENTICATED=new ce(null),ce.GOOGLE_CREDENTIALS=new ce("google-credentials-uid"),ce.FIRST_PARTY=new ce("first-party-uid"),ce.MOCK_USER=new ce("mock-user");/**
398
+ */class Te{constructor(e){this.uid=e}isAuthenticated(){return this.uid!=null}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}Te.UNAUTHENTICATED=new Te(null),Te.GOOGLE_CREDENTIALS=new Te("google-credentials-uid"),Te.FIRST_PARTY=new Te("first-party-uid"),Te.MOCK_USER=new Te("mock-user");/**
385
399
  * @license
386
400
  * Copyright 2017 Google LLC
387
401
  *
@@ -396,7 +410,7 @@
396
410
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
397
411
  * See the License for the specific language governing permissions and
398
412
  * limitations under the License.
399
- */let tn="10.5.2";/**
413
+ */let ln="10.13.2";/**
400
414
  * @license
401
415
  * Copyright 2017 Google LLC
402
416
  *
@@ -411,7 +425,7 @@
411
425
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
412
426
  * See the License for the specific language governing permissions and
413
427
  * limitations under the License.
414
- */const Ot=new vi("@firebase/firestore");function sr(){return Ot.logLevel}function T(t,...e){if(Ot.logLevel<=D.DEBUG){const n=e.map(vo);Ot.debug(`Firestore (${tn}): ${t}`,...n)}}function Xe(t,...e){if(Ot.logLevel<=D.ERROR){const n=e.map(vo);Ot.error(`Firestore (${tn}): ${t}`,...n)}}function nn(t,...e){if(Ot.logLevel<=D.WARN){const n=e.map(vo);Ot.warn(`Firestore (${tn}): ${t}`,...n)}}function vo(t){if(typeof t=="string")return t;try{/**
428
+ */const zt=new Ai("@firebase/firestore");function Xn(){return zt.logLevel}function V(n,...e){if(zt.logLevel<=W.DEBUG){const t=e.map(Mi);zt.debug(`Firestore (${ln}): ${n}`,...t)}}function lt(n,...e){if(zt.logLevel<=W.ERROR){const t=e.map(Mi);zt.error(`Firestore (${ln}): ${n}`,...t)}}function hn(n,...e){if(zt.logLevel<=W.WARN){const t=e.map(Mi);zt.warn(`Firestore (${ln}): ${n}`,...t)}}function Mi(n){if(typeof n=="string")return n;try{/**
415
429
  * @license
416
430
  * Copyright 2020 Google LLC
417
431
  *
@@ -426,7 +440,7 @@
426
440
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
427
441
  * See the License for the specific language governing permissions and
428
442
  * limitations under the License.
429
- */return function(n){return JSON.stringify(n)}(t)}catch{return t}}/**
443
+ */return function(t){return JSON.stringify(t)}(n)}catch{return n}}/**
430
444
  * @license
431
445
  * Copyright 2017 Google LLC
432
446
  *
@@ -441,7 +455,7 @@
441
455
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
442
456
  * See the License for the specific language governing permissions and
443
457
  * limitations under the License.
444
- */function A(t="Unexpected state"){const e=`FIRESTORE (${tn}) INTERNAL ASSERTION FAILED: `+t;throw Xe(e),new Error(e)}function F(t,e){t||A()}function P(t,e){return t}/**
458
+ */function F(n="Unexpected state"){const e=`FIRESTORE (${ln}) INTERNAL ASSERTION FAILED: `+n;throw lt(e),new Error(e)}function X(n,e){n||F()}function B(n,e){return n}/**
445
459
  * @license
446
460
  * Copyright 2017 Google LLC
447
461
  *
@@ -456,7 +470,7 @@
456
470
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
457
471
  * See the License for the specific language governing permissions and
458
472
  * limitations under the License.
459
- */const p={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 _ extends be{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
473
+ */const P={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 O extends $e{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
460
474
  * @license
461
475
  * Copyright 2017 Google LLC
462
476
  *
@@ -471,7 +485,7 @@
471
485
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
472
486
  * See the License for the specific language governing permissions and
473
487
  * limitations under the License.
474
- */class xe{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
488
+ */class Xe{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}/**
475
489
  * @license
476
490
  * Copyright 2017 Google LLC
477
491
  *
@@ -486,7 +500,7 @@
486
500
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
487
501
  * See the License for the specific language governing permissions and
488
502
  * limitations under the License.
489
- */class Nu{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class ng{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(ce.UNAUTHENTICATED))}shutdown(){}}class rg{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,n){this.changeListener=n,e.enqueueRetryable(()=>n(this.token.user))}shutdown(){this.changeListener=null}}class sg{constructor(e){this.t=e,this.currentUser=ce.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){let r=this.i;const s=c=>this.i!==r?(r=this.i,n(c)):Promise.resolve();let i=new xe;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new xe,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const c=i;e.enqueueRetryable(async()=>{await c.promise,await s(this.currentUser)})},a=c=>{T("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=c,this.auth.addAuthTokenListener(this.o),o()};this.t.onInit(c=>a(c)),setTimeout(()=>{if(!this.auth){const c=this.t.getImmediate({optional:!0});c?a(c):(T("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new xe)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(T("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(F(typeof r.accessToken=="string"),new Nu(r.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 F(e===null||typeof e=="string"),new ce(e)}}class ig{constructor(e,n,r){this.l=e,this.h=n,this.P=r,this.type="FirstParty",this.user=ce.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class og{constructor(e,n,r){this.l=e,this.h=n,this.P=r}getToken(){return Promise.resolve(new ig(this.l,this.h,this.P))}start(e,n){e.enqueueRetryable(()=>n(ce.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class ag{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 cg{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,n){const r=i=>{i.error!=null&&T("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.R;return this.R=i.token,T("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{T("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.appCheck.addTokenListener(this.o)};this.A.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.A.getImmediate({optional:!0});i?s(i):T("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(F(typeof n.token=="string"),this.R=n.token,new ag(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/**
503
+ */class vc{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Kp{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(Te.UNAUTHENTICATED))}shutdown(){}}class Qp{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 Yp{constructor(e){this.t=e,this.currentUser=Te.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){let r=this.i;const s=l=>this.i!==r?(r=this.i,t(l)):Promise.resolve();let i=new Xe;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Xe,e.enqueueRetryable(()=>s(this.currentUser))};const a=()=>{const l=i;e.enqueueRetryable(async()=>{await l.promise,await s(this.currentUser)})},c=l=>{V("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=l,this.auth.addAuthTokenListener(this.o),a()};this.t.onInit(l=>c(l)),setTimeout(()=>{if(!this.auth){const l=this.t.getImmediate({optional:!0});l?c(l):(V("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Xe)}},0),a()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(r=>this.i!==e?(V("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(X(typeof r.accessToken=="string"),new vc(r.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 X(e===null||typeof e=="string"),new Te(e)}}class Xp{constructor(e,t,r){this.l=e,this.h=t,this.P=r,this.type="FirstParty",this.user=Te.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class Jp{constructor(e,t,r){this.l=e,this.h=t,this.P=r}getToken(){return Promise.resolve(new Xp(this.l,this.h,this.P))}start(e,t){e.enqueueRetryable(()=>t(Te.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Zp{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 em{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,t){const r=i=>{i.error!=null&&V("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const a=i.token!==this.R;return this.R=i.token,V("FirebaseAppCheckTokenProvider",`Received ${a?"new":"existing"} token.`),a?t(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{V("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.appCheck.addTokenListener(this.o)};this.A.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.A.getImmediate({optional:!0});i?s(i):V("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(t=>t?(X(typeof t.token=="string"),this.R=t.token,new Zp(t.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}/**
490
504
  * @license
491
505
  * Copyright 2020 Google LLC
492
506
  *
@@ -501,7 +515,7 @@
501
515
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
502
516
  * See the License for the specific language governing permissions and
503
517
  * limitations under the License.
504
- */function ug(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;r<t;r++)n[r]=Math.floor(256*Math.random());return n}/**
518
+ */function tm(n){const e=typeof self<"u"&&(self.crypto||self.msCrypto),t=new Uint8Array(n);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<n;r++)t[r]=Math.floor(256*Math.random());return t}/**
505
519
  * @license
506
520
  * Copyright 2017 Google LLC
507
521
  *
@@ -516,7 +530,7 @@
516
530
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
517
531
  * See the License for the specific language governing permissions and
518
532
  * limitations under the License.
519
- */class Du{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const s=ug(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<n&&(r+=e.charAt(s[i]%e.length))}return r}}function L(t,e){return t<e?-1:t>e?1:0}function rn(t,e,n){return t.length===e.length&&t.every((r,s)=>n(r,e[s]))}/**
533
+ */class Ec{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const s=tm(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<t&&(r+=e.charAt(s[i]%e.length))}return r}}function K(n,e){return n<e?-1:n>e?1:0}function dn(n,e,t){return n.length===e.length&&n.every((r,s)=>t(r,e[s]))}/**
520
534
  * @license
521
535
  * Copyright 2017 Google LLC
522
536
  *
@@ -531,7 +545,7 @@
531
545
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
532
546
  * See the License for the specific language governing permissions and
533
547
  * limitations under the License.
534
- */class Q{constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new _(p.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new _(p.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<-62135596800)throw new _(p.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new _(p.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return Q.fromMillis(Date.now())}static fromDate(e){return Q.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*n));return new Q(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?L(this.nanoseconds,e.nanoseconds):L(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")}}/**
548
+ */class ue{constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new O(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new O(P.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-62135596800)throw new O(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new O(P.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ue.fromMillis(Date.now())}static fromDate(e){return ue.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*t));return new ue(t,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?K(this.nanoseconds,e.nanoseconds):K(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")}}/**
535
549
  * @license
536
550
  * Copyright 2017 Google LLC
537
551
  *
@@ -546,7 +560,7 @@
546
560
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
547
561
  * See the License for the specific language governing permissions and
548
562
  * limitations under the License.
549
- */class S{constructor(e){this.timestamp=e}static fromTimestamp(e){return new S(e)}static min(){return new S(new Q(0,0))}static max(){return new S(new Q(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}}/**
563
+ */class q{constructor(e){this.timestamp=e}static fromTimestamp(e){return new q(e)}static min(){return new q(new ue(0,0))}static max(){return new q(new ue(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}}/**
550
564
  * @license
551
565
  * Copyright 2017 Google LLC
552
566
  *
@@ -561,7 +575,7 @@
561
575
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
562
576
  * See the License for the specific language governing permissions and
563
577
  * limitations under the License.
564
- */class ir{constructor(e,n,r){n===void 0?n=0:n>e.length&&A(),r===void 0?r=e.length-n:r>e.length-n&&A(),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return ir.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof ir?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?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 this.length===0}isPrefixOf(e){if(e.length<this.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let n=0;n<this.length;n++)if(this.get(n)!==e.get(n))return!1;return!0}forEach(e){for(let n=this.offset,r=this.limit();n<r;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){const r=Math.min(e.length,n.length);for(let s=0;s<r;s++){const i=e.get(s),o=n.get(s);if(i<o)return-1;if(i>o)return 1}return e.length<n.length?-1:e.length>n.length?1:0}}class B extends ir{construct(e,n,r){return new B(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new _(p.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(s=>s.length>0))}return new B(n)}static emptyPath(){return new B([])}}const lg=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class te extends ir{construct(e,n,r){return new te(e,n,r)}static isValidIdentifier(e){return lg.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),te.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new te(["__name__"])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new _(p.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;s<e.length;){const a=e[s];if(a==="\\"){if(s+1===e.length)throw new _(p.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const c=e[s+1];if(c!=="\\"&&c!=="."&&c!=="`")throw new _(p.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=c,s+=2}else a==="`"?(o=!o,s++):a!=="."||o?(r+=a,s++):(i(),s++)}if(i(),o)throw new _(p.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new te(n)}static emptyPath(){return new te([])}}/**
578
+ */class Jn{constructor(e,t,r){t===void 0?t=0:t>e.length&&F(),r===void 0?r=e.length-t:r>e.length-t&&F(),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return Jn.comparator(this,e)===0}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Jn?e.forEach(r=>{t.push(r)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?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 this.length===0}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,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const r=Math.min(e.length,t.length);for(let s=0;s<r;s++){const i=e.get(s),a=t.get(s);if(i<a)return-1;if(i>a)return 1}return e.length<t.length?-1:e.length>t.length?1:0}}class ee extends Jn{construct(e,t,r){return new ee(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const r of e){if(r.indexOf("//")>=0)throw new O(P.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(s=>s.length>0))}return new ee(t)}static emptyPath(){return new ee([])}}const nm=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class pe extends Jn{construct(e,t,r){return new pe(e,t,r)}static isValidIdentifier(e){return nm.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),pe.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new pe(["__name__"])}static fromServerFormat(e){const t=[];let r="",s=0;const i=()=>{if(r.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""};let a=!1;for(;s<e.length;){const c=e[s];if(c==="\\"){if(s+1===e.length)throw new O(P.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const l=e[s+1];if(l!=="\\"&&l!=="."&&l!=="`")throw new O(P.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=l,s+=2}else c==="`"?(a=!a,s++):c!=="."||a?(r+=c,s++):(i(),s++)}if(i(),a)throw new O(P.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new pe(t)}static emptyPath(){return new pe([])}}/**
565
579
  * @license
566
580
  * Copyright 2017 Google LLC
567
581
  *
@@ -576,7 +590,7 @@
576
590
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
577
591
  * See the License for the specific language governing permissions and
578
592
  * limitations under the License.
579
- */class I{constructor(e){this.path=e}static fromPath(e){return new I(B.fromString(e))}static fromName(e){return new I(B.fromString(e).popFirst(5))}static empty(){return new I(B.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 e!==null&&B.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return B.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new I(new B(e.slice()))}}function hg(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=S.fromTimestamp(r===1e9?new Q(n+1,0):new Q(n,r));return new ft(s,I.empty(),e)}function dg(t){return new ft(t.readTime,t.key,-1)}class ft{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new ft(S.min(),I.empty(),-1)}static max(){return new ft(S.max(),I.empty(),-1)}}function fg(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=I.comparator(t.documentKey,e.documentKey),n!==0?n:L(t.largestBatchId,e.largestBatchId))}/**
593
+ */class L{constructor(e){this.path=e}static fromPath(e){return new L(ee.fromString(e))}static fromName(e){return new L(ee.fromString(e).popFirst(5))}static empty(){return new L(ee.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 e!==null&&ee.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,t){return ee.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new L(new ee(e.slice()))}}function rm(n,e){const t=n.toTimestamp().seconds,r=n.toTimestamp().nanoseconds+1,s=q.fromTimestamp(r===1e9?new ue(t+1,0):new ue(t,r));return new Rt(s,L.empty(),e)}function sm(n){return new Rt(n.readTime,n.key,-1)}class Rt{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new Rt(q.min(),L.empty(),-1)}static max(){return new Rt(q.max(),L.empty(),-1)}}function im(n,e){let t=n.readTime.compareTo(e.readTime);return t!==0?t:(t=L.comparator(n.documentKey,e.documentKey),t!==0?t:K(n.largestBatchId,e.largestBatchId))}/**
580
594
  * @license
581
595
  * Copyright 2020 Google LLC
582
596
  *
@@ -591,7 +605,7 @@
591
605
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
592
606
  * See the License for the specific language governing permissions and
593
607
  * limitations under the License.
594
- */const pg="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class mg{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
608
+ */const om="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class am{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
595
609
  * @license
596
610
  * Copyright 2017 Google LLC
597
611
  *
@@ -606,7 +620,7 @@
606
620
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
607
621
  * See the License for the specific language governing permissions and
608
622
  * limitations under the License.
609
- */async function or(t){if(t.code!==p.FAILED_PRECONDITION||t.message!==pg)throw t;T("LocalStore","Unexpectedly lost primary lease")}/**
623
+ */async function Zn(n){if(n.code!==P.FAILED_PRECONDITION||n.message!==om)throw n;V("LocalStore","Unexpectedly lost primary lease")}/**
610
624
  * @license
611
625
  * Copyright 2017 Google LLC
612
626
  *
@@ -621,7 +635,7 @@
621
635
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
622
636
  * See the License for the specific language governing permissions and
623
637
  * limitations under the License.
624
- */class m{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(n=>{this.isDone=!0,this.result=n,this.nextCallback&&this.nextCallback(n)},n=>{this.isDone=!0,this.error=n,this.catchCallback&&this.catchCallback(n)})}catch(e){return this.next(void 0,e)}next(e,n){return this.callbackAttached&&A(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new m((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof m?n:m.resolve(n)}catch(n){return m.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):m.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):m.reject(n)}static resolve(e){return new m((n,r)=>{n(e)})}static reject(e){return new m((n,r)=>{r(e)})}static waitFor(e){return new m((n,r)=>{let s=0,i=0,o=!1;e.forEach(a=>{++s,a.next(()=>{++i,o&&i===s&&n()},c=>r(c))}),o=!0,i===s&&n()})}static or(e){let n=m.resolve(!1);for(const r of e)n=n.next(s=>s?m.resolve(s):r());return n}static forEach(e,n){const r=[];return e.forEach((s,i)=>{r.push(n.call(this,s,i))}),this.waitFor(r)}static mapArray(e,n){return new m((r,s)=>{const i=e.length,o=new Array(i);let a=0;for(let c=0;c<i;c++){const u=c;n(e[u]).next(l=>{o[u]=l,++a,a===i&&r(o)},l=>s(l))}})}static doWhile(e,n){return new m((r,s)=>{const i=()=>{e()===!0?n().next(()=>{i()},s):r()};i()})}}function ar(t){return t.name==="IndexedDbTransactionError"}/**
638
+ */class k{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(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(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&F(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new k((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(t,i).next(r,s)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof k?t:k.resolve(t)}catch(t){return k.reject(t)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):k.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):k.reject(t)}static resolve(e){return new k((t,r)=>{t(e)})}static reject(e){return new k((t,r)=>{r(e)})}static waitFor(e){return new k((t,r)=>{let s=0,i=0,a=!1;e.forEach(c=>{++s,c.next(()=>{++i,a&&i===s&&t()},l=>r(l))}),a=!0,i===s&&t()})}static or(e){let t=k.resolve(!1);for(const r of e)t=t.next(s=>s?k.resolve(s):r());return t}static forEach(e,t){const r=[];return e.forEach((s,i)=>{r.push(t.call(this,s,i))}),this.waitFor(r)}static mapArray(e,t){return new k((r,s)=>{const i=e.length,a=new Array(i);let c=0;for(let l=0;l<i;l++){const d=l;t(e[d]).next(p=>{a[d]=p,++c,c===i&&r(a)},p=>s(p))}})}static doWhile(e,t){return new k((r,s)=>{const i=()=>{e()===!0?t().next(()=>{i()},s):r()};i()})}}function cm(n){const e=n.match(/Android ([\d.]+)/i),t=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(t)}function er(n){return n.name==="IndexedDbTransactionError"}/**
625
639
  * @license
626
640
  * Copyright 2018 Google LLC
627
641
  *
@@ -636,7 +650,7 @@
636
650
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
637
651
  * See the License for the specific language governing permissions and
638
652
  * limitations under the License.
639
- */class To{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.se(r),this.oe=r=>n.writeSequenceNumber(r))}se(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.oe&&this.oe(e),e}}To._e=-1;function gs(t){return t==null}function _s(t){return t===0&&1/t==-1/0}function gg(t){return typeof t=="number"&&Number.isInteger(t)&&!_s(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
653
+ */class Ui{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=r=>this.ie(r),this.se=r=>t.writeSequenceNumber(r))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}Ui.oe=-1;function es(n){return n==null}function ts(n){return n===0&&1/n==-1/0}function um(n){return typeof n=="number"&&Number.isInteger(n)&&!ts(n)&&n<=Number.MAX_SAFE_INTEGER&&n>=Number.MIN_SAFE_INTEGER}/**
640
654
  * @license
641
655
  * Copyright 2017 Google LLC
642
656
  *
@@ -651,7 +665,7 @@
651
665
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
652
666
  * See the License for the specific language governing permissions and
653
667
  * limitations under the License.
654
- */function Ou(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Vt(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Vu(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
668
+ */function Tc(n){let e=0;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e++;return e}function Ht(n,e){for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e(t,n[t])}function lm(n,e){const t=[];for(const r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.push(e(n[r],r,n));return t}function wc(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}/**
655
669
  * @license
656
670
  * Copyright 2017 Google LLC
657
671
  *
@@ -666,7 +680,7 @@
666
680
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
667
681
  * See the License for the specific language governing permissions and
668
682
  * limitations under the License.
669
- */class j{constructor(e,n){this.comparator=e,this.root=n||ne.EMPTY}insert(e,n){return new j(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,ne.BLACK,null,null))}remove(e){return new j(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ne.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<0?r=r.left:(n+=r.left.size+1,r=r.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((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new ys(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new ys(this.root,e,this.comparator,!1)}getReverseIterator(){return new ys(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new ys(this.root,e,this.comparator,!0)}}class ys{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={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 n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class ne{constructor(e,n,r,s,i){this.key=e,this.value=n,this.color=r??ne.RED,this.left=s??ne.EMPTY,this.right=i??ne.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new ne(e??this.key,n??this.value,r??this.color,s??this.left,i??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,n,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return ne.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,n){let r,s=this;if(n(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return ne.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.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,ne.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,ne.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),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw A();const e=this.left.check();if(e!==this.right.check())throw A();return e+(this.isRed()?0:1)}}ne.EMPTY=null,ne.RED=!0,ne.BLACK=!1,ne.EMPTY=new class{constructor(){this.size=0}get key(){throw A()}get value(){throw A()}get color(){throw A()}get left(){throw A()}get right(){throw A()}copy(e,n,r,s,i){return this}insert(e,n,r){return new ne(e,n)}remove(e,n){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}};/**
683
+ */class re{constructor(e,t){this.comparator=e,this.root=t||me.EMPTY}insert(e,t){return new re(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,me.BLACK,null,null))}remove(e){return new re(this.comparator,this.root.remove(e,this.comparator).copy(null,null,me.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const r=this.comparator(e,t.key);if(r===0)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){const s=this.comparator(e,r.key);if(s===0)return t+r.left.size;s<0?r=r.left:(t+=r.left.size+1,r=r.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,r)=>(e(t,r),!1))}toString(){const e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new ns(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new ns(this.root,e,this.comparator,!1)}getReverseIterator(){return new ns(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new ns(this.root,e,this.comparator,!0)}}class ns{constructor(e,t,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===0){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(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class me{constructor(e,t,r,s,i){this.key=e,this.value=t,this.color=r??me.RED,this.left=s??me.EMPTY,this.right=i??me.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,s,i){return new me(e??this.key,t??this.value,r??this.color,s??this.left,i??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,r){let s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,t,r),null):i===0?s.copy(null,t,null,null,null):s.copy(null,null,null,null,s.right.insert(e,t,r)),s.fixUp()}removeMin(){if(this.left.isEmpty())return me.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 r,s=this;if(t(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,t),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),t(e,s.key)===0){if(s.right.isEmpty())return me.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,t))}return s.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,me.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,me.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()||this.right.isRed())throw F();const e=this.left.check();if(e!==this.right.check())throw F();return e+(this.isRed()?0:1)}}me.EMPTY=null,me.RED=!0,me.BLACK=!1,me.EMPTY=new class{constructor(){this.size=0}get key(){throw F()}get value(){throw F()}get color(){throw F()}get left(){throw F()}get right(){throw F()}copy(e,t,r,s,i){return this}insert(e,t,r){return new me(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}};/**
670
684
  * @license
671
685
  * Copyright 2017 Google LLC
672
686
  *
@@ -681,7 +695,7 @@
681
695
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
682
696
  * See the License for the specific language governing permissions and
683
697
  * limitations under the License.
684
- */class re{constructor(e){this.comparator=e,this.data=new j(this.comparator)}has(e){return this.data.get(e)!==null}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((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new Lu(this.data.getIterator())}getIteratorFrom(e){return new Lu(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 n=this;return n.size<e.size&&(n=e,e=this),e.forEach(r=>{n=n.add(r)}),n}isEqual(e){if(!(e instanceof re)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new re(this.comparator);return n.data=e,n}}class Lu{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
698
+ */class ge{constructor(e){this.comparator=e,this.data=new re(this.comparator)}has(e){return this.data.get(e)!==null}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,r)=>(e(t),!1))}forEachInRange(e,t){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;t(s.key)}}forEachWhile(e,t){let r;for(r=t!==void 0?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Ic(this.data.getIterator())}getIteratorFrom(e){return new Ic(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(r=>{t=t.add(r)}),t}isEqual(e){if(!(e instanceof ge)||this.size!==e.size)return!1;const t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==0)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 ge(this.comparator);return t.data=e,t}}class Ic{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
685
699
  * @license
686
700
  * Copyright 2020 Google LLC
687
701
  *
@@ -696,7 +710,7 @@
696
710
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
697
711
  * See the License for the specific language governing permissions and
698
712
  * limitations under the License.
699
- */class Te{constructor(e){this.fields=e,e.sort(te.comparator)}static empty(){return new Te([])}unionWith(e){let n=new re(te.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new Te(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return rn(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
713
+ */class Me{constructor(e){this.fields=e,e.sort(pe.comparator)}static empty(){return new Me([])}unionWith(e){let t=new ge(pe.comparator);for(const r of this.fields)t=t.add(r);for(const r of e)t=t.add(r);return new Me(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return dn(this.fields,e.fields,(t,r)=>t.isEqual(r))}}/**
700
714
  * @license
701
715
  * Copyright 2023 Google LLC
702
716
  *
@@ -711,7 +725,7 @@
711
725
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
712
726
  * See the License for the specific language governing permissions and
713
727
  * limitations under the License.
714
- */class Mu extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
728
+ */class Ac extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
715
729
  * @license
716
730
  * Copyright 2020 Google LLC
717
731
  *
@@ -726,7 +740,7 @@
726
740
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
727
741
  * See the License for the specific language governing permissions and
728
742
  * limitations under the License.
729
- */class ue{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new Mu("Invalid base64 string: "+i):i}}(e);return new ue(n)}static fromUint8Array(e){const n=function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i}(e);return new ue(n)}[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 function(n){return btoa(n)}(this.binaryString)}toUint8Array(){return function(n){const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return L(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}ue.EMPTY_BYTE_STRING=new ue("");const _g=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function pt(t){if(F(!!t),typeof t=="string"){let e=0;const n=_g.exec(t);if(F(!!n),n[1]){let s=n[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:W(t.seconds),nanos:W(t.nanos)}}function W(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function Lt(t){return typeof t=="string"?ue.fromBase64String(t):ue.fromUint8Array(t)}/**
743
+ */class _e{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new Ac("Invalid base64 string: "+i):i}}(e);return new _e(t)}static fromUint8Array(e){const t=function(s){let i="";for(let a=0;a<s.length;++a)i+=String.fromCharCode(s[a]);return i}(e);return new _e(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 function(t){return btoa(t)}(this.binaryString)}toUint8Array(){return function(t){const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return K(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}_e.EMPTY_BYTE_STRING=new _e("");const hm=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function bt(n){if(X(!!n),typeof n=="string"){let e=0;const t=hm.exec(n);if(X(!!t),t[1]){let s=t[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(n);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:oe(n.seconds),nanos:oe(n.nanos)}}function oe(n){return typeof n=="number"?n:typeof n=="string"?Number(n):0}function Wt(n){return typeof n=="string"?_e.fromBase64String(n):_e.fromUint8Array(n)}/**
730
744
  * @license
731
745
  * Copyright 2020 Google LLC
732
746
  *
@@ -741,7 +755,7 @@
741
755
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
742
756
  * See the License for the specific language governing permissions and
743
757
  * limitations under the License.
744
- */function Es(t){var e,n;return((n=(((e=t==null?void 0:t.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||n===void 0?void 0:n.stringValue)==="server_timestamp"}function Io(t){const e=t.mapValue.fields.__previous_value__;return Es(e)?Io(e):e}function cr(t){const e=pt(t.mapValue.fields.__local_write_time__.timestampValue);return new Q(e.seconds,e.nanos)}/**
758
+ */function rs(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="server_timestamp"}function xi(n){const e=n.mapValue.fields.__previous_value__;return rs(e)?xi(e):e}function tr(n){const e=bt(n.mapValue.fields.__local_write_time__.timestampValue);return new ue(e.seconds,e.nanos)}/**
745
759
  * @license
746
760
  * Copyright 2017 Google LLC
747
761
  *
@@ -756,7 +770,7 @@
756
770
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
757
771
  * See the License for the specific language governing permissions and
758
772
  * limitations under the License.
759
- */class yg{constructor(e,n,r,s,i,o,a,c,u){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=a,this.longPollingOptions=c,this.useFetchStreams=u}}class ur{constructor(e,n){this.projectId=e,this.database=n||"(default)"}static empty(){return new ur("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof ur&&e.projectId===this.projectId&&e.database===this.database}}/**
773
+ */class dm{constructor(e,t,r,s,i,a,c,l,d){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=a,this.autoDetectLongPolling=c,this.longPollingOptions=l,this.useFetchStreams=d}}class nr{constructor(e,t){this.projectId=e,this.database=t||"(default)"}static empty(){return new nr("","")}get isDefaultDatabase(){return this.database==="(default)"}isEqual(e){return e instanceof nr&&e.projectId===this.projectId&&e.database===this.database}}/**
760
774
  * @license
761
775
  * Copyright 2020 Google LLC
762
776
  *
@@ -771,7 +785,7 @@
771
785
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
772
786
  * See the License for the specific language governing permissions and
773
787
  * limitations under the License.
774
- */const vs={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Mt(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?Es(t)?4:Eg(t)?9007199254740991:10:A()}function Fe(t,e){if(t===e)return!0;const n=Mt(t);if(n!==Mt(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return cr(t).isEqual(cr(e));case 3:return function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const o=pt(s.timestampValue),a=pt(i.timestampValue);return o.seconds===a.seconds&&o.nanos===a.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(s,i){return Lt(s.bytesValue).isEqual(Lt(i.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(s,i){return W(s.geoPointValue.latitude)===W(i.geoPointValue.latitude)&&W(s.geoPointValue.longitude)===W(i.geoPointValue.longitude)}(t,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return W(s.integerValue)===W(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const o=W(s.doubleValue),a=W(i.doubleValue);return o===a?_s(o)===_s(a):isNaN(o)&&isNaN(a)}return!1}(t,e);case 9:return rn(t.arrayValue.values||[],e.arrayValue.values||[],Fe);case 10:return function(s,i){const o=s.mapValue.fields||{},a=i.mapValue.fields||{};if(Ou(o)!==Ou(a))return!1;for(const c in o)if(o.hasOwnProperty(c)&&(a[c]===void 0||!Fe(o[c],a[c])))return!1;return!0}(t,e);default:return A()}}function lr(t,e){return(t.values||[]).find(n=>Fe(n,e))!==void 0}function sn(t,e){if(t===e)return 0;const n=Mt(t),r=Mt(e);if(n!==r)return L(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return L(t.booleanValue,e.booleanValue);case 2:return function(i,o){const a=W(i.integerValue||i.doubleValue),c=W(o.integerValue||o.doubleValue);return a<c?-1:a>c?1:a===c?0:isNaN(a)?isNaN(c)?0:-1:1}(t,e);case 3:return Uu(t.timestampValue,e.timestampValue);case 4:return Uu(cr(t),cr(e));case 5:return L(t.stringValue,e.stringValue);case 6:return function(i,o){const a=Lt(i),c=Lt(o);return a.compareTo(c)}(t.bytesValue,e.bytesValue);case 7:return function(i,o){const a=i.split("/"),c=o.split("/");for(let u=0;u<a.length&&u<c.length;u++){const l=L(a[u],c[u]);if(l!==0)return l}return L(a.length,c.length)}(t.referenceValue,e.referenceValue);case 8:return function(i,o){const a=L(W(i.latitude),W(o.latitude));return a!==0?a:L(W(i.longitude),W(o.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(i,o){const a=i.values||[],c=o.values||[];for(let u=0;u<a.length&&u<c.length;++u){const l=sn(a[u],c[u]);if(l)return l}return L(a.length,c.length)}(t.arrayValue,e.arrayValue);case 10:return function(i,o){if(i===vs.mapValue&&o===vs.mapValue)return 0;if(i===vs.mapValue)return 1;if(o===vs.mapValue)return-1;const a=i.fields||{},c=Object.keys(a),u=o.fields||{},l=Object.keys(u);c.sort(),l.sort();for(let h=0;h<c.length&&h<l.length;++h){const d=L(c[h],l[h]);if(d!==0)return d;const f=sn(a[c[h]],u[l[h]]);if(f!==0)return f}return L(c.length,l.length)}(t.mapValue,e.mapValue);default:throw A()}}function Uu(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return L(t,e);const n=pt(t),r=pt(e),s=L(n.seconds,r.seconds);return s!==0?s:L(n.nanos,r.nanos)}function on(t){return wo(t)}function wo(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(n){const r=pt(n);return`time(${r.seconds},${r.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(n){return Lt(n).toBase64()}(t.bytesValue):"referenceValue"in t?function(n){return I.fromName(n).toString()}(t.referenceValue):"geoPointValue"in t?function(n){return`geo(${n.latitude},${n.longitude})`}(t.geoPointValue):"arrayValue"in t?function(n){let r="[",s=!0;for(const i of n.values||[])s?s=!1:r+=",",r+=wo(i);return r+"]"}(t.arrayValue):"mapValue"in t?function(n){const r=Object.keys(n.fields||{}).sort();let s="{",i=!0;for(const o of r)i?i=!1:s+=",",s+=`${o}:${wo(n.fields[o])}`;return s+"}"}(t.mapValue):A()}function Ts(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Ao(t){return!!t&&"integerValue"in t}function Ro(t){return!!t&&"arrayValue"in t}function xu(t){return!!t&&"nullValue"in t}function Fu(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Is(t){return!!t&&"mapValue"in t}function hr(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return Vt(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=hr(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=hr(t.arrayValue.values[n]);return e}return Object.assign({},t)}function Eg(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
788
+ */const ss={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function Gt(n){return"nullValue"in n?0:"booleanValue"in n?1:"integerValue"in n||"doubleValue"in n?2:"timestampValue"in n?3:"stringValue"in n?5:"bytesValue"in n?6:"referenceValue"in n?7:"geoPointValue"in n?8:"arrayValue"in n?9:"mapValue"in n?rs(n)?4:pm(n)?9007199254740991:fm(n)?10:11:F()}function Je(n,e){if(n===e)return!0;const t=Gt(n);if(t!==Gt(e))return!1;switch(t){case 0:case 9007199254740991:return!0;case 1:return n.booleanValue===e.booleanValue;case 4:return tr(n).isEqual(tr(e));case 3:return function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const a=bt(s.timestampValue),c=bt(i.timestampValue);return a.seconds===c.seconds&&a.nanos===c.nanos}(n,e);case 5:return n.stringValue===e.stringValue;case 6:return function(s,i){return Wt(s.bytesValue).isEqual(Wt(i.bytesValue))}(n,e);case 7:return n.referenceValue===e.referenceValue;case 8:return function(s,i){return oe(s.geoPointValue.latitude)===oe(i.geoPointValue.latitude)&&oe(s.geoPointValue.longitude)===oe(i.geoPointValue.longitude)}(n,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return oe(s.integerValue)===oe(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const a=oe(s.doubleValue),c=oe(i.doubleValue);return a===c?ts(a)===ts(c):isNaN(a)&&isNaN(c)}return!1}(n,e);case 9:return dn(n.arrayValue.values||[],e.arrayValue.values||[],Je);case 10:case 11:return function(s,i){const a=s.mapValue.fields||{},c=i.mapValue.fields||{};if(Tc(a)!==Tc(c))return!1;for(const l in a)if(a.hasOwnProperty(l)&&(c[l]===void 0||!Je(a[l],c[l])))return!1;return!0}(n,e);default:return F()}}function rr(n,e){return(n.values||[]).find(t=>Je(t,e))!==void 0}function fn(n,e){if(n===e)return 0;const t=Gt(n),r=Gt(e);if(t!==r)return K(t,r);switch(t){case 0:case 9007199254740991:return 0;case 1:return K(n.booleanValue,e.booleanValue);case 2:return function(i,a){const c=oe(i.integerValue||i.doubleValue),l=oe(a.integerValue||a.doubleValue);return c<l?-1:c>l?1:c===l?0:isNaN(c)?isNaN(l)?0:-1:1}(n,e);case 3:return Rc(n.timestampValue,e.timestampValue);case 4:return Rc(tr(n),tr(e));case 5:return K(n.stringValue,e.stringValue);case 6:return function(i,a){const c=Wt(i),l=Wt(a);return c.compareTo(l)}(n.bytesValue,e.bytesValue);case 7:return function(i,a){const c=i.split("/"),l=a.split("/");for(let d=0;d<c.length&&d<l.length;d++){const p=K(c[d],l[d]);if(p!==0)return p}return K(c.length,l.length)}(n.referenceValue,e.referenceValue);case 8:return function(i,a){const c=K(oe(i.latitude),oe(a.latitude));return c!==0?c:K(oe(i.longitude),oe(a.longitude))}(n.geoPointValue,e.geoPointValue);case 9:return bc(n.arrayValue,e.arrayValue);case 10:return function(i,a){var c,l,d,p;const g=i.fields||{},v=a.fields||{},R=(c=g.value)===null||c===void 0?void 0:c.arrayValue,C=(l=v.value)===null||l===void 0?void 0:l.arrayValue,N=K(((d=R==null?void 0:R.values)===null||d===void 0?void 0:d.length)||0,((p=C==null?void 0:C.values)===null||p===void 0?void 0:p.length)||0);return N!==0?N:bc(R,C)}(n.mapValue,e.mapValue);case 11:return function(i,a){if(i===ss.mapValue&&a===ss.mapValue)return 0;if(i===ss.mapValue)return 1;if(a===ss.mapValue)return-1;const c=i.fields||{},l=Object.keys(c),d=a.fields||{},p=Object.keys(d);l.sort(),p.sort();for(let g=0;g<l.length&&g<p.length;++g){const v=K(l[g],p[g]);if(v!==0)return v;const R=fn(c[l[g]],d[p[g]]);if(R!==0)return R}return K(l.length,p.length)}(n.mapValue,e.mapValue);default:throw F()}}function Rc(n,e){if(typeof n=="string"&&typeof e=="string"&&n.length===e.length)return K(n,e);const t=bt(n),r=bt(e),s=K(t.seconds,r.seconds);return s!==0?s:K(t.nanos,r.nanos)}function bc(n,e){const t=n.values||[],r=e.values||[];for(let s=0;s<t.length&&s<r.length;++s){const i=fn(t[s],r[s]);if(i)return i}return K(t.length,r.length)}function pn(n){return Fi(n)}function Fi(n){return"nullValue"in n?"null":"booleanValue"in n?""+n.booleanValue:"integerValue"in n?""+n.integerValue:"doubleValue"in n?""+n.doubleValue:"timestampValue"in n?function(t){const r=bt(t);return`time(${r.seconds},${r.nanos})`}(n.timestampValue):"stringValue"in n?n.stringValue:"bytesValue"in n?function(t){return Wt(t).toBase64()}(n.bytesValue):"referenceValue"in n?function(t){return L.fromName(t).toString()}(n.referenceValue):"geoPointValue"in n?function(t){return`geo(${t.latitude},${t.longitude})`}(n.geoPointValue):"arrayValue"in n?function(t){let r="[",s=!0;for(const i of t.values||[])s?s=!1:r+=",",r+=Fi(i);return r+"]"}(n.arrayValue):"mapValue"in n?function(t){const r=Object.keys(t.fields||{}).sort();let s="{",i=!0;for(const a of r)i?i=!1:s+=",",s+=`${a}:${Fi(t.fields[a])}`;return s+"}"}(n.mapValue):F()}function is(n,e){return{referenceValue:`projects/${n.projectId}/databases/${n.database}/documents/${e.path.canonicalString()}`}}function Bi(n){return!!n&&"integerValue"in n}function ji(n){return!!n&&"arrayValue"in n}function Pc(n){return!!n&&"nullValue"in n}function Sc(n){return!!n&&"doubleValue"in n&&isNaN(Number(n.doubleValue))}function os(n){return!!n&&"mapValue"in n}function fm(n){var e,t;return((t=(((e=n==null?void 0:n.mapValue)===null||e===void 0?void 0:e.fields)||{}).__type__)===null||t===void 0?void 0:t.stringValue)==="__vector__"}function sr(n){if(n.geoPointValue)return{geoPointValue:Object.assign({},n.geoPointValue)};if(n.timestampValue&&typeof n.timestampValue=="object")return{timestampValue:Object.assign({},n.timestampValue)};if(n.mapValue){const e={mapValue:{fields:{}}};return Ht(n.mapValue.fields,(t,r)=>e.mapValue.fields[t]=sr(r)),e}if(n.arrayValue){const e={arrayValue:{values:[]}};for(let t=0;t<(n.arrayValue.values||[]).length;++t)e.arrayValue.values[t]=sr(n.arrayValue.values[t]);return e}return Object.assign({},n)}function pm(n){return(((n.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
775
789
  * @license
776
790
  * Copyright 2017 Google LLC
777
791
  *
@@ -786,7 +800,7 @@
786
800
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
787
801
  * See the License for the specific language governing permissions and
788
802
  * limitations under the License.
789
- */class ge{constructor(e){this.value=e}static empty(){return new ge({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r<e.length-1;++r)if(n=(n.mapValue.fields||{})[e.get(r)],!Is(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=hr(n)}setAll(e){let n=te.emptyPath(),r={},s=[];e.forEach((o,a)=>{if(!n.isImmediateParentOf(a)){const c=this.getFieldsMap(n);this.applyChanges(c,r,s),r={},s=[],n=a.popLast()}o?r[a.lastSegment()]=hr(o):s.push(a.lastSegment())});const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());Is(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Fe(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=n.mapValue.fields[e.get(r)];Is(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=s),n=s}return n.mapValue.fields}applyChanges(e,n,r){Vt(n,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new ge(hr(this.value))}}function Bu(t){const e=[];return Vt(t.fields,(n,r)=>{const s=new te([n]);if(Is(r)){const i=Bu(r.mapValue).fields;if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new Te(e)}/**
803
+ */class Ne{constructor(e){this.value=e}static empty(){return new Ne({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(t=(t.mapValue.fields||{})[e.get(r)],!os(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=sr(t)}setAll(e){let t=pe.emptyPath(),r={},s=[];e.forEach((a,c)=>{if(!t.isImmediateParentOf(c)){const l=this.getFieldsMap(t);this.applyChanges(l,r,s),r={},s=[],t=c.popLast()}a?r[c.lastSegment()]=sr(a):s.push(c.lastSegment())});const i=this.getFieldsMap(t);this.applyChanges(i,r,s)}delete(e){const t=this.field(e.popLast());os(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return Je(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let s=t.mapValue.fields[e.get(r)];os(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=s),t=s}return t.mapValue.fields}applyChanges(e,t,r){Ht(t,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new Ne(sr(this.value))}}function Cc(n){const e=[];return Ht(n.fields,(t,r)=>{const s=new pe([t]);if(os(r)){const i=Cc(r.mapValue).fields;if(i.length===0)e.push(s);else for(const a of i)e.push(s.child(a))}else e.push(s)}),new Me(e)}/**
790
804
  * @license
791
805
  * Copyright 2017 Google LLC
792
806
  *
@@ -801,7 +815,7 @@
801
815
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
802
816
  * See the License for the specific language governing permissions and
803
817
  * limitations under the License.
804
- */class le{constructor(e,n,r,s,i,o,a){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=a}static newInvalidDocument(e){return new le(e,0,S.min(),S.min(),S.min(),ge.empty(),0)}static newFoundDocument(e,n,r,s){return new le(e,1,n,S.min(),r,s,0)}static newNoDocument(e,n){return new le(e,2,n,S.min(),S.min(),ge.empty(),0)}static newUnknownDocument(e,n){return new le(e,3,n,S.min(),S.min(),ge.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(S.min())||this.documentType!==2&&this.documentType!==0||(this.createTime=e),this.version=e,this.documentType=1,this.data=n,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=ge.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=ge.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=S.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof le&&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 le(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}})`}}/**
818
+ */class we{constructor(e,t,r,s,i,a,c){this.key=e,this.documentType=t,this.version=r,this.readTime=s,this.createTime=i,this.data=a,this.documentState=c}static newInvalidDocument(e){return new we(e,0,q.min(),q.min(),q.min(),Ne.empty(),0)}static newFoundDocument(e,t,r,s){return new we(e,1,t,q.min(),r,s,0)}static newNoDocument(e,t){return new we(e,2,t,q.min(),q.min(),Ne.empty(),0)}static newUnknownDocument(e,t){return new we(e,3,t,q.min(),q.min(),Ne.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(q.min())||this.documentType!==2&&this.documentType!==0||(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=Ne.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=Ne.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=q.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return this.documentState===1}get hasCommittedMutations(){return this.documentState===2}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return this.documentType!==0}isFoundDocument(){return this.documentType===1}isNoDocument(){return this.documentType===2}isUnknownDocument(){return this.documentType===3}isEqual(e){return e instanceof we&&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 we(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}})`}}/**
805
819
  * @license
806
820
  * Copyright 2022 Google LLC
807
821
  *
@@ -816,7 +830,7 @@
816
830
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
817
831
  * See the License for the specific language governing permissions and
818
832
  * limitations under the License.
819
- */class an{constructor(e,n){this.position=e,this.inclusive=n}}function qu(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(i.field.isKeyField()?r=I.comparator(I.fromName(o.referenceValue),n.key):r=sn(o,n.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function $u(t,e){if(t===null)return e===null;if(e===null||t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Fe(t.position[n],e.position[n]))return!1;return!0}/**
833
+ */class mn{constructor(e,t){this.position=e,this.inclusive=t}}function kc(n,e,t){let r=0;for(let s=0;s<n.position.length;s++){const i=e[s],a=n.position[s];if(i.field.isKeyField()?r=L.comparator(L.fromName(a.referenceValue),t.key):r=fn(a,t.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function Nc(n,e){if(n===null)return e===null;if(e===null||n.inclusive!==e.inclusive||n.position.length!==e.position.length)return!1;for(let t=0;t<n.position.length;t++)if(!Je(n.position[t],e.position[t]))return!1;return!0}/**
820
834
  * @license
821
835
  * Copyright 2022 Google LLC
822
836
  *
@@ -831,7 +845,7 @@
831
845
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
832
846
  * See the License for the specific language governing permissions and
833
847
  * limitations under the License.
834
- */class dr{constructor(e,n="asc"){this.field=e,this.dir=n}}function vg(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
848
+ */class ir{constructor(e,t="asc"){this.field=e,this.dir=t}}function mm(n,e){return n.dir===e.dir&&n.field.isEqual(e.field)}/**
835
849
  * @license
836
850
  * Copyright 2022 Google LLC
837
851
  *
@@ -846,7 +860,7 @@
846
860
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
847
861
  * See the License for the specific language governing permissions and
848
862
  * limitations under the License.
849
- */class ju{}class G extends ju{constructor(e,n,r){super(),this.field=e,this.op=n,this.value=r}static create(e,n,r){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,r):new Ig(e,n,r):n==="array-contains"?new Rg(e,r):n==="in"?new Pg(e,r):n==="not-in"?new Sg(e,r):n==="array-contains-any"?new Cg(e,r):new G(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new wg(e,r):new Ag(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(sn(n,this.value)):n!==null&&Mt(this.value)===Mt(n)&&this.matchesComparison(sn(n,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return A()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ne extends ju{constructor(e,n){super(),this.filters=e,this.op=n,this.ue=null}static create(e,n){return new Ne(e,n)}matches(e){return zu(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.ue!==null||(this.ue=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.ue}getFilters(){return Object.assign([],this.filters)}}function zu(t){return t.op==="and"}function Hu(t){return Tg(t)&&zu(t)}function Tg(t){for(const e of t.filters)if(e instanceof Ne)return!1;return!0}function Po(t){if(t instanceof G)return t.field.canonicalString()+t.op.toString()+on(t.value);if(Hu(t))return t.filters.map(e=>Po(e)).join(",");{const e=t.filters.map(n=>Po(n)).join(",");return`${t.op}(${e})`}}function Wu(t,e){return t instanceof G?function(r,s){return s instanceof G&&r.op===s.op&&r.field.isEqual(s.field)&&Fe(r.value,s.value)}(t,e):t instanceof Ne?function(r,s){return s instanceof Ne&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,a)=>i&&Wu(o,s.filters[a]),!0):!1}(t,e):void A()}function Gu(t){return t instanceof G?function(n){return`${n.field.canonicalString()} ${n.op} ${on(n.value)}`}(t):t instanceof Ne?function(n){return n.op.toString()+" {"+n.getFilters().map(Gu).join(" ,")+"}"}(t):"Filter"}class Ig extends G{constructor(e,n,r){super(e,n,r),this.key=I.fromName(r.referenceValue)}matches(e){const n=I.comparator(e.key,this.key);return this.matchesComparison(n)}}class wg extends G{constructor(e,n){super(e,"in",n),this.keys=Ku("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class Ag extends G{constructor(e,n){super(e,"not-in",n),this.keys=Ku("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Ku(t,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>I.fromName(r.referenceValue))}class Rg extends G{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Ro(n)&&lr(n.arrayValue,this.value)}}class Pg extends G{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&lr(this.value.arrayValue,n)}}class Sg extends G{constructor(e,n){super(e,"not-in",n)}matches(e){if(lr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&!lr(this.value.arrayValue,n)}}class Cg extends G{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Ro(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>lr(this.value.arrayValue,r))}}/**
863
+ */class Dc{}class ae extends Dc{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?t==="in"||t==="not-in"?this.createKeyFieldInFilter(e,t,r):new _m(e,t,r):t==="array-contains"?new Em(e,r):t==="in"?new Tm(e,r):t==="not-in"?new wm(e,r):t==="array-contains-any"?new Im(e,r):new ae(e,t,r)}static createKeyFieldInFilter(e,t,r){return t==="in"?new ym(e,r):new vm(e,r)}matches(e){const t=e.data.field(this.field);return this.op==="!="?t!==null&&this.matchesComparison(fn(t,this.value)):t!==null&&Gt(this.value)===Gt(t)&&this.matchesComparison(fn(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return e===0;case"!=":return e!==0;case">":return e>0;case">=":return e>=0;default:return F()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class ze extends Dc{constructor(e,t){super(),this.filters=e,this.op=t,this.ae=null}static create(e,t){return new ze(e,t)}matches(e){return Oc(this)?this.filters.find(t=>!t.matches(e))===void 0:this.filters.find(t=>t.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function Oc(n){return n.op==="and"}function Vc(n){return gm(n)&&Oc(n)}function gm(n){for(const e of n.filters)if(e instanceof ze)return!1;return!0}function qi(n){if(n instanceof ae)return n.field.canonicalString()+n.op.toString()+pn(n.value);if(Vc(n))return n.filters.map(e=>qi(e)).join(",");{const e=n.filters.map(t=>qi(t)).join(",");return`${n.op}(${e})`}}function Lc(n,e){return n instanceof ae?function(r,s){return s instanceof ae&&r.op===s.op&&r.field.isEqual(s.field)&&Je(r.value,s.value)}(n,e):n instanceof ze?function(r,s){return s instanceof ze&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,a,c)=>i&&Lc(a,s.filters[c]),!0):!1}(n,e):void F()}function Mc(n){return n instanceof ae?function(t){return`${t.field.canonicalString()} ${t.op} ${pn(t.value)}`}(n):n instanceof ze?function(t){return t.op.toString()+" {"+t.getFilters().map(Mc).join(" ,")+"}"}(n):"Filter"}class _m extends ae{constructor(e,t,r){super(e,t,r),this.key=L.fromName(r.referenceValue)}matches(e){const t=L.comparator(e.key,this.key);return this.matchesComparison(t)}}class ym extends ae{constructor(e,t){super(e,"in",t),this.keys=Uc("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class vm extends ae{constructor(e,t){super(e,"not-in",t),this.keys=Uc("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Uc(n,e){var t;return(((t=e.arrayValue)===null||t===void 0?void 0:t.values)||[]).map(r=>L.fromName(r.referenceValue))}class Em extends ae{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return ji(t)&&rr(t.arrayValue,this.value)}}class Tm extends ae{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return t!==null&&rr(this.value.arrayValue,t)}}class wm extends ae{constructor(e,t){super(e,"not-in",t)}matches(e){if(rr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return t!==null&&!rr(this.value.arrayValue,t)}}class Im extends ae{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!ji(t)||!t.arrayValue.values)&&t.arrayValue.values.some(r=>rr(this.value.arrayValue,r))}}/**
850
864
  * @license
851
865
  * Copyright 2019 Google LLC
852
866
  *
@@ -861,7 +875,7 @@
861
875
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862
876
  * See the License for the specific language governing permissions and
863
877
  * limitations under the License.
864
- */class bg{constructor(e,n=null,r=[],s=[],i=null,o=null,a=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=a,this.ce=null}}function Qu(t,e=null,n=[],r=[],s=null,i=null,o=null){return new bg(t,e,n,r,s,i,o)}function So(t){const e=P(t);if(e.ce===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>Po(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),gs(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>on(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>on(r)).join(",")),e.ce=n}return e.ce}function Co(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!vg(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(!Wu(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!$u(t.startAt,e.startAt)&&$u(t.endAt,e.endAt)}function bo(t){return I.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
878
+ */class Am{constructor(e,t=null,r=[],s=[],i=null,a=null,c=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=a,this.endAt=c,this.ue=null}}function xc(n,e=null,t=[],r=[],s=null,i=null,a=null){return new Am(n,e,t,r,s,i,a)}function $i(n){const e=B(n);if(e.ue===null){let t=e.path.canonicalString();e.collectionGroup!==null&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(r=>qi(r)).join(","),t+="|ob:",t+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),es(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(r=>pn(r)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(r=>pn(r)).join(",")),e.ue=t}return e.ue}function zi(n,e){if(n.limit!==e.limit||n.orderBy.length!==e.orderBy.length)return!1;for(let t=0;t<n.orderBy.length;t++)if(!mm(n.orderBy[t],e.orderBy[t]))return!1;if(n.filters.length!==e.filters.length)return!1;for(let t=0;t<n.filters.length;t++)if(!Lc(n.filters[t],e.filters[t]))return!1;return n.collectionGroup===e.collectionGroup&&!!n.path.isEqual(e.path)&&!!Nc(n.startAt,e.startAt)&&Nc(n.endAt,e.endAt)}function Hi(n){return L.isDocumentKey(n.path)&&n.collectionGroup===null&&n.filters.length===0}/**
865
879
  * @license
866
880
  * Copyright 2017 Google LLC
867
881
  *
@@ -876,7 +890,7 @@
876
890
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
877
891
  * See the License for the specific language governing permissions and
878
892
  * limitations under the License.
879
- */class Ut{constructor(e,n=null,r=[],s=[],i=null,o="F",a=null,c=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=o,this.startAt=a,this.endAt=c,this.le=null,this.he=null,this.Pe=null,this.startAt,this.endAt}}function kg(t,e,n,r,s,i,o,a){return new Ut(t,e,n,r,s,i,o,a)}function ko(t){return new Ut(t)}function Yu(t){return t.filters.length===0&&t.limit===null&&t.startAt==null&&t.endAt==null&&(t.explicitOrderBy.length===0||t.explicitOrderBy.length===1&&t.explicitOrderBy[0].field.isKeyField())}function No(t){return t.collectionGroup!==null}function cn(t){const e=P(t);if(e.le===null){e.le=[];const n=new Set;for(const i of e.explicitOrderBy)e.le.push(i),n.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let a=new re(te.comparator);return o.filters.forEach(c=>{c.getFlattenedFilters().forEach(u=>{u.isInequality()&&(a=a.add(u.field))})}),a})(e).forEach(i=>{n.has(i.canonicalString())||i.isKeyField()||e.le.push(new dr(i,r))}),n.has(te.keyField().canonicalString())||e.le.push(new dr(te.keyField(),r))}return e.le}function Be(t){const e=P(t);return e.he||(e.he=Xu(e,cn(t))),e.he}function Xu(t,e){if(t.limitType==="F")return Qu(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new dr(s.field,i)});const n=t.endAt?new an(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new an(t.startAt.position,t.startAt.inclusive):null;return Qu(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function Do(t,e){const n=t.filters.concat([e]);return new Ut(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function ws(t,e,n){return new Ut(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function As(t,e){return Co(Be(t),Be(e))&&t.limitType===e.limitType}function Ju(t){return`${So(Be(t))}|lt:${t.limitType}`}function un(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(s=>Gu(s)).join(", ")}]`),gs(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(s=>on(s)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(s=>on(s)).join(",")),`Target(${r})`}(Be(t))}; limitType=${t.limitType})`}function Rs(t,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):I.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(t,e)&&function(r,s){for(const i of cn(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(t,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(t,e)&&function(r,s){return!(r.startAt&&!function(o,a,c){const u=qu(o,a,c);return o.inclusive?u<=0:u<0}(r.startAt,cn(r),s)||r.endAt&&!function(o,a,c){const u=qu(o,a,c);return o.inclusive?u>=0:u>0}(r.endAt,cn(r),s))}(t,e)}function Ng(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function Zu(t){return(e,n)=>{let r=!1;for(const s of cn(t)){const i=Dg(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function Dg(t,e,n){const r=t.field.isKeyField()?I.comparator(e.key,n.key):function(i,o,a){const c=o.data.field(i),u=a.data.field(i);return c!==null&&u!==null?sn(c,u):A()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return A()}}/**
893
+ */class Kt{constructor(e,t=null,r=[],s=[],i=null,a="F",c=null,l=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=a,this.startAt=c,this.endAt=l,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function Rm(n,e,t,r,s,i,a,c){return new Kt(n,e,t,r,s,i,a,c)}function as(n){return new Kt(n)}function Fc(n){return n.filters.length===0&&n.limit===null&&n.startAt==null&&n.endAt==null&&(n.explicitOrderBy.length===0||n.explicitOrderBy.length===1&&n.explicitOrderBy[0].field.isKeyField())}function Wi(n){return n.collectionGroup!==null}function gn(n){const e=B(n);if(e.ce===null){e.ce=[];const t=new Set;for(const i of e.explicitOrderBy)e.ce.push(i),t.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(a){let c=new ge(pe.comparator);return a.filters.forEach(l=>{l.getFlattenedFilters().forEach(d=>{d.isInequality()&&(c=c.add(d.field))})}),c})(e).forEach(i=>{t.has(i.canonicalString())||i.isKeyField()||e.ce.push(new ir(i,r))}),t.has(pe.keyField().canonicalString())||e.ce.push(new ir(pe.keyField(),r))}return e.ce}function Ze(n){const e=B(n);return e.le||(e.le=Bc(e,gn(n))),e.le}function bm(n){const e=B(n);return e.he||(e.he=Bc(e,n.explicitOrderBy)),e.he}function Bc(n,e){if(n.limitType==="F")return xc(n.path,n.collectionGroup,e,n.filters,n.limit,n.startAt,n.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new ir(s.field,i)});const t=n.endAt?new mn(n.endAt.position,n.endAt.inclusive):null,r=n.startAt?new mn(n.startAt.position,n.startAt.inclusive):null;return xc(n.path,n.collectionGroup,e,n.filters,n.limit,t,r)}}function Gi(n,e){const t=n.filters.concat([e]);return new Kt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),t,n.limit,n.limitType,n.startAt,n.endAt)}function cs(n,e,t){return new Kt(n.path,n.collectionGroup,n.explicitOrderBy.slice(),n.filters.slice(),e,t,n.startAt,n.endAt)}function us(n,e){return zi(Ze(n),Ze(e))&&n.limitType===e.limitType}function jc(n){return`${$i(Ze(n))}|lt:${n.limitType}`}function _n(n){return`Query(target=${function(t){let r=t.path.canonicalString();return t.collectionGroup!==null&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(s=>Mc(s)).join(", ")}]`),es(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(s=>function(a){return`${a.field.canonicalString()} (${a.dir})`}(s)).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(s=>pn(s)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(s=>pn(s)).join(",")),`Target(${r})`}(Ze(n))}; limitType=${n.limitType})`}function ls(n,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):L.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(n,e)&&function(r,s){for(const i of gn(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(n,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(n,e)&&function(r,s){return!(r.startAt&&!function(a,c,l){const d=kc(a,c,l);return a.inclusive?d<=0:d<0}(r.startAt,gn(r),s)||r.endAt&&!function(a,c,l){const d=kc(a,c,l);return a.inclusive?d>=0:d>0}(r.endAt,gn(r),s))}(n,e)}function Pm(n){return n.collectionGroup||(n.path.length%2==1?n.path.lastSegment():n.path.get(n.path.length-2))}function qc(n){return(e,t)=>{let r=!1;for(const s of gn(n)){const i=Sm(s,e,t);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function Sm(n,e,t){const r=n.field.isKeyField()?L.comparator(e.key,t.key):function(i,a,c){const l=a.data.field(i),d=c.data.field(i);return l!==null&&d!==null?fn(l,d):F()}(n.field,e,t);switch(n.dir){case"asc":return r;case"desc":return-1*r;default:return F()}}/**
880
894
  * @license
881
895
  * Copyright 2017 Google LLC
882
896
  *
@@ -891,7 +905,7 @@
891
905
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
892
906
  * See the License for the specific language governing permissions and
893
907
  * limitations under the License.
894
- */class ln{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,n]);s.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[n]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Vt(this.inner,(n,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return Vu(this.inner)}size(){return this.innerSize}}/**
908
+ */class yn{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r!==void 0){for(const[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,t){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,t]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,t]);s.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),r=this.inner[t];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[t]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){Ht(this.inner,(t,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return wc(this.inner)}size(){return this.innerSize}}/**
895
909
  * @license
896
910
  * Copyright 2017 Google LLC
897
911
  *
@@ -906,7 +920,7 @@
906
920
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
907
921
  * See the License for the specific language governing permissions and
908
922
  * limitations under the License.
909
- */const Og=new j(I.comparator);function Je(){return Og}const el=new j(I.comparator);function fr(...t){let e=el;for(const n of t)e=e.insert(n.key,n);return e}function tl(t){let e=el;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function xt(){return pr()}function nl(){return pr()}function pr(){return new ln(t=>t.toString(),(t,e)=>t.isEqual(e))}const Vg=new j(I.comparator),Lg=new re(I.comparator);function N(...t){let e=Lg;for(const n of t)e=e.add(n);return e}const Mg=new re(L);function Ug(){return Mg}/**
923
+ */const Cm=new re(L.comparator);function ht(){return Cm}const $c=new re(L.comparator);function or(...n){let e=$c;for(const t of n)e=e.insert(t.key,t);return e}function zc(n){let e=$c;return n.forEach((t,r)=>e=e.insert(t,r.overlayedDocument)),e}function Qt(){return ar()}function Hc(){return ar()}function ar(){return new yn(n=>n.toString(),(n,e)=>n.isEqual(e))}const km=new re(L.comparator),Nm=new ge(L.comparator);function H(...n){let e=Nm;for(const t of n)e=e.add(t);return e}const Dm=new ge(K);function Om(){return Dm}/**
910
924
  * @license
911
925
  * Copyright 2020 Google LLC
912
926
  *
@@ -921,7 +935,7 @@
921
935
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
922
936
  * See the License for the specific language governing permissions and
923
937
  * limitations under the License.
924
- */function rl(t,e){if(t.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:_s(e)?"-0":e}}function sl(t){return{integerValue:""+t}}function xg(t,e){return gg(e)?sl(e):rl(t,e)}/**
938
+ */function Ki(n,e){if(n.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ts(e)?"-0":e}}function Wc(n){return{integerValue:""+n}}function Vm(n,e){return um(e)?Wc(e):Ki(n,e)}/**
925
939
  * @license
926
940
  * Copyright 2018 Google LLC
927
941
  *
@@ -936,7 +950,7 @@
936
950
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
937
951
  * See the License for the specific language governing permissions and
938
952
  * limitations under the License.
939
- */class Ps{constructor(){this._=void 0}}function Fg(t,e,n){return t instanceof Ss?function(s,i){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&Es(i)&&(i=Io(i)),i&&(o.fields.__previous_value__=i),{mapValue:o}}(n,e):t instanceof mr?ol(t,e):t instanceof gr?al(t,e):function(s,i){const o=il(s,i),a=cl(o)+cl(s.Ie);return Ao(o)&&Ao(s.Ie)?sl(a):rl(s.serializer,a)}(t,e)}function Bg(t,e,n){return t instanceof mr?ol(t,e):t instanceof gr?al(t,e):n}function il(t,e){return t instanceof Cs?function(r){return Ao(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Ss extends Ps{}class mr extends Ps{constructor(e){super(),this.elements=e}}function ol(t,e){const n=ul(e);for(const r of t.elements)n.some(s=>Fe(s,r))||n.push(r);return{arrayValue:{values:n}}}class gr extends Ps{constructor(e){super(),this.elements=e}}function al(t,e){let n=ul(e);for(const r of t.elements)n=n.filter(s=>!Fe(s,r));return{arrayValue:{values:n}}}class Cs extends Ps{constructor(e,n){super(),this.serializer=e,this.Ie=n}}function cl(t){return W(t.integerValue||t.doubleValue)}function ul(t){return Ro(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function qg(t,e){return t.field.isEqual(e.field)&&function(r,s){return r instanceof mr&&s instanceof mr||r instanceof gr&&s instanceof gr?rn(r.elements,s.elements,Fe):r instanceof Cs&&s instanceof Cs?Fe(r.Ie,s.Ie):r instanceof Ss&&s instanceof Ss}(t.transform,e.transform)}class $g{constructor(e,n){this.version=e,this.transformResults=n}}class Pe{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new Pe}static exists(e){return new Pe(void 0,e)}static updateTime(e){return new Pe(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function bs(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class ks{}function ll(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Ns(t.key,Pe.none()):new yr(t.key,t.data,Pe.none());{const n=t.data,r=ge.empty();let s=new re(te.comparator);for(let i of e.fields)if(!s.has(i)){let o=n.field(i);o===null&&i.length>1&&(i=i.popLast(),o=n.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new mt(t.key,r,new Te(s.toArray()),Pe.none())}}function jg(t,e,n){t instanceof yr?function(s,i,o){const a=s.value.clone(),c=fl(s.fieldTransforms,i,o.transformResults);a.setAll(c),i.convertToFoundDocument(o.version,a).setHasCommittedMutations()}(t,e,n):t instanceof mt?function(s,i,o){if(!bs(s.precondition,i))return void i.convertToUnknownDocument(o.version);const a=fl(s.fieldTransforms,i,o.transformResults),c=i.data;c.setAll(dl(s)),c.setAll(a),i.convertToFoundDocument(o.version,c).setHasCommittedMutations()}(t,e,n):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function _r(t,e,n,r){return t instanceof yr?function(i,o,a,c){if(!bs(i.precondition,o))return a;const u=i.value.clone(),l=pl(i.fieldTransforms,c,o);return u.setAll(l),o.convertToFoundDocument(o.version,u).setHasLocalMutations(),null}(t,e,n,r):t instanceof mt?function(i,o,a,c){if(!bs(i.precondition,o))return a;const u=pl(i.fieldTransforms,c,o),l=o.data;return l.setAll(dl(i)),l.setAll(u),o.convertToFoundDocument(o.version,l).setHasLocalMutations(),a===null?null:a.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(h=>h.field))}(t,e,n,r):function(i,o,a){return bs(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):a}(t,e,n)}function zg(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=il(r.transform,s||null);i!=null&&(n===null&&(n=ge.empty()),n.set(r.field,i))}return n||null}function hl(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&rn(r,s,(i,o)=>qg(i,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class yr extends ks{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class mt extends ks{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function dl(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 fl(t,e,n){const r=new Map;F(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,Bg(o,a,n[s]))}return r}function pl(t,e,n){const r=new Map;for(const s of t){const i=s.transform,o=n.data.field(s.field);r.set(s.field,Fg(i,o,e))}return r}class Ns extends ks{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Hg extends ks{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
953
+ */class hs{constructor(){this._=void 0}}function Lm(n,e,t){return n instanceof ds?function(s,i){const a={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&rs(i)&&(i=xi(i)),i&&(a.fields.__previous_value__=i),{mapValue:a}}(t,e):n instanceof cr?Kc(n,e):n instanceof ur?Qc(n,e):function(s,i){const a=Gc(s,i),c=Yc(a)+Yc(s.Pe);return Bi(a)&&Bi(s.Pe)?Wc(c):Ki(s.serializer,c)}(n,e)}function Mm(n,e,t){return n instanceof cr?Kc(n,e):n instanceof ur?Qc(n,e):t}function Gc(n,e){return n instanceof fs?function(r){return Bi(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class ds extends hs{}class cr extends hs{constructor(e){super(),this.elements=e}}function Kc(n,e){const t=Xc(e);for(const r of n.elements)t.some(s=>Je(s,r))||t.push(r);return{arrayValue:{values:t}}}class ur extends hs{constructor(e){super(),this.elements=e}}function Qc(n,e){let t=Xc(e);for(const r of n.elements)t=t.filter(s=>!Je(s,r));return{arrayValue:{values:t}}}class fs extends hs{constructor(e,t){super(),this.serializer=e,this.Pe=t}}function Yc(n){return oe(n.integerValue||n.doubleValue)}function Xc(n){return ji(n)&&n.arrayValue.values?n.arrayValue.values.slice():[]}function Um(n,e){return n.field.isEqual(e.field)&&function(r,s){return r instanceof cr&&s instanceof cr||r instanceof ur&&s instanceof ur?dn(r.elements,s.elements,Je):r instanceof fs&&s instanceof fs?Je(r.Pe,s.Pe):r instanceof ds&&s instanceof ds}(n.transform,e.transform)}class xm{constructor(e,t){this.version=e,this.transformResults=t}}class je{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new je}static exists(e){return new je(void 0,e)}static updateTime(e){return new je(e)}get isNone(){return this.updateTime===void 0&&this.exists===void 0}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function ps(n,e){return n.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(n.updateTime):n.exists===void 0||n.exists===e.isFoundDocument()}class ms{}function Jc(n,e){if(!n.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return n.isNoDocument()?new gs(n.key,je.none()):new hr(n.key,n.data,je.none());{const t=n.data,r=Ne.empty();let s=new ge(pe.comparator);for(let i of e.fields)if(!s.has(i)){let a=t.field(i);a===null&&i.length>1&&(i=i.popLast(),a=t.field(i)),a===null?r.delete(i):r.set(i,a),s=s.add(i)}return new Pt(n.key,r,new Me(s.toArray()),je.none())}}function Fm(n,e,t){n instanceof hr?function(s,i,a){const c=s.value.clone(),l=tu(s.fieldTransforms,i,a.transformResults);c.setAll(l),i.convertToFoundDocument(a.version,c).setHasCommittedMutations()}(n,e,t):n instanceof Pt?function(s,i,a){if(!ps(s.precondition,i))return void i.convertToUnknownDocument(a.version);const c=tu(s.fieldTransforms,i,a.transformResults),l=i.data;l.setAll(eu(s)),l.setAll(c),i.convertToFoundDocument(a.version,l).setHasCommittedMutations()}(n,e,t):function(s,i,a){i.convertToNoDocument(a.version).setHasCommittedMutations()}(0,e,t)}function lr(n,e,t,r){return n instanceof hr?function(i,a,c,l){if(!ps(i.precondition,a))return c;const d=i.value.clone(),p=nu(i.fieldTransforms,l,a);return d.setAll(p),a.convertToFoundDocument(a.version,d).setHasLocalMutations(),null}(n,e,t,r):n instanceof Pt?function(i,a,c,l){if(!ps(i.precondition,a))return c;const d=nu(i.fieldTransforms,l,a),p=a.data;return p.setAll(eu(i)),p.setAll(d),a.convertToFoundDocument(a.version,p).setHasLocalMutations(),c===null?null:c.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(g=>g.field))}(n,e,t,r):function(i,a,c){return ps(i.precondition,a)?(a.convertToNoDocument(a.version).setHasLocalMutations(),null):c}(n,e,t)}function Bm(n,e){let t=null;for(const r of n.fieldTransforms){const s=e.data.field(r.field),i=Gc(r.transform,s||null);i!=null&&(t===null&&(t=Ne.empty()),t.set(r.field,i))}return t||null}function Zc(n,e){return n.type===e.type&&!!n.key.isEqual(e.key)&&!!n.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&dn(r,s,(i,a)=>Um(i,a))}(n.fieldTransforms,e.fieldTransforms)&&(n.type===0?n.value.isEqual(e.value):n.type!==1||n.data.isEqual(e.data)&&n.fieldMask.isEqual(e.fieldMask))}class hr extends ms{constructor(e,t,r,s=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class Pt extends ms{constructor(e,t,r,s,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function eu(n){const e=new Map;return n.fieldMask.fields.forEach(t=>{if(!t.isEmpty()){const r=n.data.field(t);e.set(t,r)}}),e}function tu(n,e,t){const r=new Map;X(n.length===t.length);for(let s=0;s<t.length;s++){const i=n[s],a=i.transform,c=e.data.field(i.field);r.set(i.field,Mm(a,c,t[s]))}return r}function nu(n,e,t){const r=new Map;for(const s of n){const i=s.transform,a=t.data.field(s.field);r.set(s.field,Lm(i,a,e))}return r}class gs extends ms{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class jm extends ms{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
940
954
  * @license
941
955
  * Copyright 2017 Google LLC
942
956
  *
@@ -951,7 +965,7 @@
951
965
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
952
966
  * See the License for the specific language governing permissions and
953
967
  * limitations under the License.
954
- */class Wg{constructor(e,n,r,s){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&jg(i,e,r[s])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=_r(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=_r(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=nl();return this.mutations.forEach(s=>{const i=e.get(s.key),o=i.overlayedDocument;let a=this.applyToLocalView(o,i.mutatedFields);a=n.has(s.key)?null:a;const c=ll(o,a);c!==null&&r.set(s.key,c),o.isValidDocument()||o.convertToNoDocument(S.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),N())}isEqual(e){return this.batchId===e.batchId&&rn(this.mutations,e.mutations,(n,r)=>hl(n,r))&&rn(this.baseMutations,e.baseMutations,(n,r)=>hl(n,r))}}class Oo{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){F(e.mutations.length===r.length);let s=function(){return Vg}();const i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,r[o].version);return new Oo(e,n,r,s)}}/**
968
+ */class qm{constructor(e,t,r,s){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,t){const r=t.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&Fm(i,e,r[s])}}applyToLocalView(e,t){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(t=lr(r,e,t,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(t=lr(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const r=Hc();return this.mutations.forEach(s=>{const i=e.get(s.key),a=i.overlayedDocument;let c=this.applyToLocalView(a,i.mutatedFields);c=t.has(s.key)?null:c;const l=Jc(a,c);l!==null&&r.set(s.key,l),a.isValidDocument()||a.convertToNoDocument(q.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),H())}isEqual(e){return this.batchId===e.batchId&&dn(this.mutations,e.mutations,(t,r)=>Zc(t,r))&&dn(this.baseMutations,e.baseMutations,(t,r)=>Zc(t,r))}}class Qi{constructor(e,t,r,s){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=s}static from(e,t,r){X(e.mutations.length===r.length);let s=function(){return km}();const i=e.mutations;for(let a=0;a<i.length;a++)s=s.insert(i[a].key,r[a].version);return new Qi(e,t,r,s)}}/**
955
969
  * @license
956
970
  * Copyright 2022 Google LLC
957
971
  *
@@ -966,7 +980,7 @@
966
980
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
967
981
  * See the License for the specific language governing permissions and
968
982
  * limitations under the License.
969
- */class Gg{constructor(e,n){this.largestBatchId=e,this.mutation=n}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
983
+ */class $m{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return e!==null&&this.mutation===e.mutation}toString(){return`Overlay{
970
984
  largestBatchId: ${this.largestBatchId},
971
985
  mutation: ${this.mutation.toString()}
972
986
  }`}}/**
@@ -984,7 +998,7 @@
984
998
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
985
999
  * See the License for the specific language governing permissions and
986
1000
  * limitations under the License.
987
- */class Kg{constructor(e,n,r){this.alias=e,this.aggregateType=n,this.fieldPath=r}}/**
1001
+ */class zm{constructor(e,t,r){this.alias=e,this.aggregateType=t,this.fieldPath=r}}/**
988
1002
  * @license
989
1003
  * Copyright 2017 Google LLC
990
1004
  *
@@ -999,7 +1013,7 @@
999
1013
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1000
1014
  * See the License for the specific language governing permissions and
1001
1015
  * limitations under the License.
1002
- */class Qg{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
1016
+ */class Hm{constructor(e,t){this.count=e,this.unchangedNames=t}}/**
1003
1017
  * @license
1004
1018
  * Copyright 2017 Google LLC
1005
1019
  *
@@ -1014,7 +1028,7 @@
1014
1028
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1015
1029
  * See the License for the specific language governing permissions and
1016
1030
  * limitations under the License.
1017
- */var K,V;function Yg(t){switch(t){default:return A();case p.CANCELLED:case p.UNKNOWN:case p.DEADLINE_EXCEEDED:case p.RESOURCE_EXHAUSTED:case p.INTERNAL:case p.UNAVAILABLE:case p.UNAUTHENTICATED:return!1;case p.INVALID_ARGUMENT:case p.NOT_FOUND:case p.ALREADY_EXISTS:case p.PERMISSION_DENIED:case p.FAILED_PRECONDITION:case p.ABORTED:case p.OUT_OF_RANGE:case p.UNIMPLEMENTED:case p.DATA_LOSS:return!0}}function ml(t){if(t===void 0)return Xe("GRPC error has no .code"),p.UNKNOWN;switch(t){case K.OK:return p.OK;case K.CANCELLED:return p.CANCELLED;case K.UNKNOWN:return p.UNKNOWN;case K.DEADLINE_EXCEEDED:return p.DEADLINE_EXCEEDED;case K.RESOURCE_EXHAUSTED:return p.RESOURCE_EXHAUSTED;case K.INTERNAL:return p.INTERNAL;case K.UNAVAILABLE:return p.UNAVAILABLE;case K.UNAUTHENTICATED:return p.UNAUTHENTICATED;case K.INVALID_ARGUMENT:return p.INVALID_ARGUMENT;case K.NOT_FOUND:return p.NOT_FOUND;case K.ALREADY_EXISTS:return p.ALREADY_EXISTS;case K.PERMISSION_DENIED:return p.PERMISSION_DENIED;case K.FAILED_PRECONDITION:return p.FAILED_PRECONDITION;case K.ABORTED:return p.ABORTED;case K.OUT_OF_RANGE:return p.OUT_OF_RANGE;case K.UNIMPLEMENTED:return p.UNIMPLEMENTED;case K.DATA_LOSS:return p.DATA_LOSS;default:return A()}}(V=K||(K={}))[V.OK=0]="OK",V[V.CANCELLED=1]="CANCELLED",V[V.UNKNOWN=2]="UNKNOWN",V[V.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",V[V.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",V[V.NOT_FOUND=5]="NOT_FOUND",V[V.ALREADY_EXISTS=6]="ALREADY_EXISTS",V[V.PERMISSION_DENIED=7]="PERMISSION_DENIED",V[V.UNAUTHENTICATED=16]="UNAUTHENTICATED",V[V.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",V[V.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",V[V.ABORTED=10]="ABORTED",V[V.OUT_OF_RANGE=11]="OUT_OF_RANGE",V[V.UNIMPLEMENTED=12]="UNIMPLEMENTED",V[V.INTERNAL=13]="INTERNAL",V[V.UNAVAILABLE=14]="UNAVAILABLE",V[V.DATA_LOSS=15]="DATA_LOSS";/**
1031
+ */var ce,G;function Wm(n){switch(n){default:return F();case P.CANCELLED:case P.UNKNOWN:case P.DEADLINE_EXCEEDED:case P.RESOURCE_EXHAUSTED:case P.INTERNAL:case P.UNAVAILABLE:case P.UNAUTHENTICATED:return!1;case P.INVALID_ARGUMENT:case P.NOT_FOUND:case P.ALREADY_EXISTS:case P.PERMISSION_DENIED:case P.FAILED_PRECONDITION:case P.ABORTED:case P.OUT_OF_RANGE:case P.UNIMPLEMENTED:case P.DATA_LOSS:return!0}}function ru(n){if(n===void 0)return lt("GRPC error has no .code"),P.UNKNOWN;switch(n){case ce.OK:return P.OK;case ce.CANCELLED:return P.CANCELLED;case ce.UNKNOWN:return P.UNKNOWN;case ce.DEADLINE_EXCEEDED:return P.DEADLINE_EXCEEDED;case ce.RESOURCE_EXHAUSTED:return P.RESOURCE_EXHAUSTED;case ce.INTERNAL:return P.INTERNAL;case ce.UNAVAILABLE:return P.UNAVAILABLE;case ce.UNAUTHENTICATED:return P.UNAUTHENTICATED;case ce.INVALID_ARGUMENT:return P.INVALID_ARGUMENT;case ce.NOT_FOUND:return P.NOT_FOUND;case ce.ALREADY_EXISTS:return P.ALREADY_EXISTS;case ce.PERMISSION_DENIED:return P.PERMISSION_DENIED;case ce.FAILED_PRECONDITION:return P.FAILED_PRECONDITION;case ce.ABORTED:return P.ABORTED;case ce.OUT_OF_RANGE:return P.OUT_OF_RANGE;case ce.UNIMPLEMENTED:return P.UNIMPLEMENTED;case ce.DATA_LOSS:return P.DATA_LOSS;default:return F()}}(G=ce||(ce={}))[G.OK=0]="OK",G[G.CANCELLED=1]="CANCELLED",G[G.UNKNOWN=2]="UNKNOWN",G[G.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",G[G.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",G[G.NOT_FOUND=5]="NOT_FOUND",G[G.ALREADY_EXISTS=6]="ALREADY_EXISTS",G[G.PERMISSION_DENIED=7]="PERMISSION_DENIED",G[G.UNAUTHENTICATED=16]="UNAUTHENTICATED",G[G.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",G[G.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",G[G.ABORTED=10]="ABORTED",G[G.OUT_OF_RANGE=11]="OUT_OF_RANGE",G[G.UNIMPLEMENTED=12]="UNIMPLEMENTED",G[G.INTERNAL=13]="INTERNAL",G[G.UNAVAILABLE=14]="UNAVAILABLE",G[G.DATA_LOSS=15]="DATA_LOSS";/**
1018
1032
  * @license
1019
1033
  * Copyright 2023 Google LLC
1020
1034
  *
@@ -1029,7 +1043,7 @@
1029
1043
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1030
1044
  * See the License for the specific language governing permissions and
1031
1045
  * limitations under the License.
1032
- */function Xg(){return new TextEncoder}/**
1046
+ */function Gm(){return new TextEncoder}/**
1033
1047
  * @license
1034
1048
  * Copyright 2022 Google LLC
1035
1049
  *
@@ -1044,7 +1058,7 @@
1044
1058
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1045
1059
  * See the License for the specific language governing permissions and
1046
1060
  * limitations under the License.
1047
- */const Jg=new en([4294967295,4294967295],0);function gl(t){const e=Xg().encode(t),n=new tg;return n.update(e),new Uint8Array(n.digest())}function _l(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new en([n,r],0),new en([s,i],0)]}class Vo{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new Er(`Invalid padding: ${n}`);if(r<0)throw new Er(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new Er(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new Er(`Invalid padding when bitmap length is 0: ${n}`);this.Te=8*e.length-n,this.Ee=en.fromNumber(this.Te)}de(e,n,r){let s=e.add(n.multiply(en.fromNumber(r)));return s.compare(Jg)===1&&(s=new en([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Ee).toNumber()}Ae(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Te===0)return!1;const n=gl(e),[r,s]=_l(n);for(let i=0;i<this.hashCount;i++){const o=this.de(r,s,i);if(!this.Ae(o))return!1}return!0}static create(e,n,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new Vo(i,s,n);return r.forEach(a=>o.insert(a)),o}insert(e){if(this.Te===0)return;const n=gl(e),[r,s]=_l(n);for(let i=0;i<this.hashCount;i++){const o=this.de(r,s,i);this.Re(o)}}Re(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class Er extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
1061
+ */const Km=new $t([4294967295,4294967295],0);function su(n){const e=Gm().encode(n),t=new hc;return t.update(e),new Uint8Array(t.digest())}function iu(n){const e=new DataView(n.buffer),t=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);return[new $t([t,r],0),new $t([s,i],0)]}class Yi{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new dr(`Invalid padding: ${t}`);if(r<0)throw new dr(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new dr(`Invalid hash count: ${r}`);if(e.length===0&&t!==0)throw new dr(`Invalid padding when bitmap length is 0: ${t}`);this.Ie=8*e.length-t,this.Te=$t.fromNumber(this.Ie)}Ee(e,t,r){let s=e.add(t.multiply($t.fromNumber(r)));return s.compare(Km)===1&&(s=new $t([s.getBits(0),s.getBits(1)],0)),s.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<<e%8)!=0}mightContain(e){if(this.Ie===0)return!1;const t=su(e),[r,s]=iu(t);for(let i=0;i<this.hashCount;i++){const a=this.Ee(r,s,i);if(!this.de(a))return!1}return!0}static create(e,t,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),a=new Yi(i,s,t);return r.forEach(c=>a.insert(c)),a}insert(e){if(this.Ie===0)return;const t=su(e),[r,s]=iu(t);for(let i=0;i<this.hashCount;i++){const a=this.Ee(r,s,i);this.Ae(a)}}Ae(e){const t=Math.floor(e/8),r=e%8;this.bitmap[t]|=1<<r}}class dr extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
1048
1062
  * @license
1049
1063
  * Copyright 2017 Google LLC
1050
1064
  *
@@ -1059,7 +1073,7 @@
1059
1073
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1060
1074
  * See the License for the specific language governing permissions and
1061
1075
  * limitations under the License.
1062
- */class Ds{constructor(e,n,r,s,i){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const s=new Map;return s.set(e,vr.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new Ds(S.min(),s,new j(L),Je(),N())}}class vr{constructor(e,n,r,s,i){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new vr(r,n,N(),N(),N())}}/**
1076
+ */class _s{constructor(e,t,r,s,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,r){const s=new Map;return s.set(e,fr.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new _s(q.min(),s,new re(K),ht(),H())}}class fr{constructor(e,t,r,s,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new fr(r,t,H(),H(),H())}}/**
1063
1077
  * @license
1064
1078
  * Copyright 2017 Google LLC
1065
1079
  *
@@ -1074,7 +1088,7 @@
1074
1088
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1075
1089
  * See the License for the specific language governing permissions and
1076
1090
  * limitations under the License.
1077
- */class Os{constructor(e,n,r,s){this.Ve=e,this.removedTargetIds=n,this.key=r,this.me=s}}class yl{constructor(e,n){this.targetId=e,this.fe=n}}class El{constructor(e,n,r=ue.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=s}}class vl{constructor(){this.ge=0,this.pe=Il(),this.ye=ue.EMPTY_BYTE_STRING,this.we=!1,this.Se=!0}get current(){return this.we}get resumeToken(){return this.ye}get be(){return this.ge!==0}get De(){return this.Se}Ce(e){e.approximateByteSize()>0&&(this.Se=!0,this.ye=e)}ve(){let e=N(),n=N(),r=N();return this.pe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:A()}}),new vr(this.ye,this.we,e,n,r)}Fe(){this.Se=!1,this.pe=Il()}Me(e,n){this.Se=!0,this.pe=this.pe.insert(e,n)}xe(e){this.Se=!0,this.pe=this.pe.remove(e)}Oe(){this.ge+=1}Ne(){this.ge-=1}Be(){this.Se=!0,this.we=!0}}class Zg{constructor(e){this.Le=e,this.ke=new Map,this.qe=Je(),this.Qe=Tl(),this.Ke=new j(L)}$e(e){for(const n of e.Ve)e.me&&e.me.isFoundDocument()?this.Ue(n,e.me):this.We(n,e.key,e.me);for(const n of e.removedTargetIds)this.We(n,e.key,e.me)}Ge(e){this.forEachTarget(e,n=>{const r=this.ze(n);switch(e.state){case 0:this.je(n)&&r.Ce(e.resumeToken);break;case 1:r.Ne(),r.be||r.Fe(),r.Ce(e.resumeToken);break;case 2:r.Ne(),r.be||this.removeTarget(n);break;case 3:this.je(n)&&(r.Be(),r.Ce(e.resumeToken));break;case 4:this.je(n)&&(this.He(n),r.Ce(e.resumeToken));break;default:A()}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ke.forEach((r,s)=>{this.je(s)&&n(s)})}Je(e){const n=e.targetId,r=e.fe.count,s=this.Ye(n);if(s){const i=s.target;if(bo(i))if(r===0){const o=new I(i.path);this.We(n,o,le.newNoDocument(o,S.min()))}else F(r===1);else{const o=this.Ze(n);if(o!==r){const a=this.Xe(e),c=a?this.et(a,e,o):1;if(c!==0){this.He(n);const u=c===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ke=this.Ke.insert(n,u)}}}}}Xe(e){const n=e.fe.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let o,a;try{o=Lt(r).toUint8Array()}catch(c){if(c instanceof Mu)return nn("Decoding the base64 bloom filter in existence filter failed ("+c.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw c}try{a=new Vo(o,s,i)}catch(c){return nn(c instanceof Er?"BloomFilter error: ":"Applying bloom filter failed: ",c),null}return a.Te===0?null:a}et(e,n,r){return n.fe.count===r-this.rt(e,n.targetId)?0:2}rt(e,n){const r=this.Le.getRemoteKeysForTarget(n);let s=0;return r.forEach(i=>{const o=this.Le.nt(),a=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(a)||(this.We(n,i,null),s++)}),s}it(e){const n=new Map;this.ke.forEach((i,o)=>{const a=this.Ye(o);if(a){if(i.current&&bo(a.target)){const c=new I(a.target.path);this.qe.get(c)!==null||this.st(o,c)||this.We(o,c,le.newNoDocument(c,e))}i.De&&(n.set(o,i.ve()),i.Fe())}});let r=N();this.Qe.forEach((i,o)=>{let a=!0;o.forEachWhile(c=>{const u=this.Ye(c);return!u||u.purpose==="TargetPurposeLimboResolution"||(a=!1,!1)}),a&&(r=r.add(i))}),this.qe.forEach((i,o)=>o.setReadTime(e));const s=new Ds(e,n,this.Ke,this.qe,r);return this.qe=Je(),this.Qe=Tl(),this.Ke=new j(L),s}Ue(e,n){if(!this.je(e))return;const r=this.st(e,n.key)?2:0;this.ze(e).Me(n.key,r),this.qe=this.qe.insert(n.key,n),this.Qe=this.Qe.insert(n.key,this.ot(n.key).add(e))}We(e,n,r){if(!this.je(e))return;const s=this.ze(e);this.st(e,n)?s.Me(n,1):s.xe(n),this.Qe=this.Qe.insert(n,this.ot(n).delete(e)),r&&(this.qe=this.qe.insert(n,r))}removeTarget(e){this.ke.delete(e)}Ze(e){const n=this.ze(e).ve();return this.Le.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}Oe(e){this.ze(e).Oe()}ze(e){let n=this.ke.get(e);return n||(n=new vl,this.ke.set(e,n)),n}ot(e){let n=this.Qe.get(e);return n||(n=new re(L),this.Qe=this.Qe.insert(e,n)),n}je(e){const n=this.Ye(e)!==null;return n||T("WatchChangeAggregator","Detected inactive target",e),n}Ye(e){const n=this.ke.get(e);return n&&n.be?null:this.Le._t(e)}He(e){this.ke.set(e,new vl),this.Le.getRemoteKeysForTarget(e).forEach(n=>{this.We(e,n,null)})}st(e,n){return this.Le.getRemoteKeysForTarget(e).has(n)}}function Tl(){return new j(I.comparator)}function Il(){return new j(I.comparator)}const e_={asc:"ASCENDING",desc:"DESCENDING"},t_={"<":"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"},n_={and:"AND",or:"OR"};class r_{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function Lo(t,e){return t.useProto3Json||gs(e)?e:{value:e}}function Vs(t,e){return t.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function wl(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function s_(t,e){return Vs(t,e.toTimestamp())}function qe(t){return F(!!t),S.fromTimestamp(function(n){const r=pt(n);return new Q(r.seconds,r.nanos)}(t))}function Mo(t,e){return function(r){return new B(["projects",r.projectId,"databases",r.database])}(t).child("documents").child(e).canonicalString()}function Al(t){const e=B.fromString(t);return F(kl(e)),e}function Uo(t,e){return Mo(t.databaseId,e.path)}function xo(t,e){const n=Al(e);if(n.get(1)!==t.databaseId.projectId)throw new _(p.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 _(p.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new I(Rl(n))}function Fo(t,e){return Mo(t.databaseId,e)}function i_(t){const e=Al(t);return e.length===4?B.emptyPath():Rl(e)}function Bo(t){return new B(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function Rl(t){return F(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function Pl(t,e,n){return{name:Uo(t,e),fields:n.value.mapValue.fields}}function o_(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(u){return u==="NO_CHANGE"?0:u==="ADD"?1:u==="REMOVE"?2:u==="CURRENT"?3:u==="RESET"?4:A()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(u,l){return u.useProto3Json?(F(l===void 0||typeof l=="string"),ue.fromBase64String(l||"")):(F(l===void 0||l instanceof Uint8Array),ue.fromUint8Array(l||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(u){const l=u.code===void 0?p.UNKNOWN:ml(u.code);return new _(l,u.message||"")}(o);n=new El(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=xo(t,r.document.name),i=qe(r.document.updateTime),o=r.document.createTime?qe(r.document.createTime):S.min(),a=new ge({mapValue:{fields:r.document.fields}}),c=le.newFoundDocument(s,i,o,a),u=r.targetIds||[],l=r.removedTargetIds||[];n=new Os(u,l,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=xo(t,r.document),i=r.readTime?qe(r.readTime):S.min(),o=le.newNoDocument(s,i),a=r.removedTargetIds||[];n=new Os([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=xo(t,r.document),i=r.removedTargetIds||[];n=new Os([],i,s,null)}else{if(!("filter"in e))return A();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new Qg(s,i),a=r.targetId;n=new yl(a,o)}}return n}function a_(t,e){let n;if(e instanceof yr)n={update:Pl(t,e.key,e.value)};else if(e instanceof Ns)n={delete:Uo(t,e.key)};else if(e instanceof mt)n={update:Pl(t,e.key,e.data),updateMask:m_(e.fieldMask)};else{if(!(e instanceof Hg))return A();n={verify:Uo(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const a=o.transform;if(a instanceof Ss)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(a instanceof mr)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:a.elements}};if(a instanceof gr)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:a.elements}};if(a instanceof Cs)return{fieldPath:o.field.canonicalString(),increment:a.Ie};throw A()}(0,r))),e.precondition.isNone||(n.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:s_(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:A()}(t,e.precondition)),n}function c_(t,e){return t&&t.length>0?(F(e!==void 0),t.map(n=>function(s,i){let o=s.updateTime?qe(s.updateTime):qe(i);return o.isEqual(S.min())&&(o=qe(i)),new $g(o,s.transformResults||[])}(n,e))):[]}function u_(t,e){return{documents:[Fo(t,e.path)]}}function Sl(t,e){const n={structuredQuery:{}},r=e.path;e.collectionGroup!==null?(n.parent=Fo(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Fo(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(c){if(c.length!==0)return bl(Ne.create(c,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(c){if(c.length!==0)return c.map(u=>function(h){return{field:gt(h.field),direction:d_(h.dir)}}(u))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=Lo(t,e.limit);return o!==null&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt=function(c){return{before:c.inclusive,values:c.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(c){return{before:!c.inclusive,values:c.position}}(e.endAt)),n}function l_(t){let e=i_(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){F(r===1);const l=n.from[0];l.allDescendants?s=l.collectionId:e=e.child(l.collectionId)}let i=[];n.where&&(i=function(h){const d=Cl(h);return d instanceof Ne&&Hu(d)?d.getFilters():[d]}(n.where));let o=[];n.orderBy&&(o=function(h){return h.map(d=>function(E){return new dr(hn(E.field),function(g){switch(g){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(E.direction))}(d))}(n.orderBy));let a=null;n.limit&&(a=function(h){let d;return d=typeof h=="object"?h.value:h,gs(d)?null:d}(n.limit));let c=null;n.startAt&&(c=function(h){const d=!!h.before,f=h.values||[];return new an(f,d)}(n.startAt));let u=null;return n.endAt&&(u=function(h){const d=!h.before,f=h.values||[];return new an(f,d)}(n.endAt)),kg(e,s,o,i,a,"F",c,u)}function h_(t,e){const n=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return A()}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function Cl(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=hn(n.unaryFilter.field);return G.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=hn(n.unaryFilter.field);return G.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=hn(n.unaryFilter.field);return G.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=hn(n.unaryFilter.field);return G.create(o,"!=",{nullValue:"NULL_VALUE"});default:return A()}}(t):t.fieldFilter!==void 0?function(n){return G.create(hn(n.fieldFilter.field),function(s){switch(s){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 A()}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Ne.create(n.compositeFilter.filters.map(r=>Cl(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return A()}}(n.compositeFilter.op))}(t):A()}function d_(t){return e_[t]}function f_(t){return t_[t]}function p_(t){return n_[t]}function gt(t){return{fieldPath:t.canonicalString()}}function hn(t){return te.fromServerFormat(t.fieldPath)}function bl(t){return t instanceof G?function(n){if(n.op==="=="){if(Fu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NAN"}};if(xu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Fu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NOT_NAN"}};if(xu(n.value))return{unaryFilter:{field:gt(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:gt(n.field),op:f_(n.op),value:n.value}}}(t):t instanceof Ne?function(n){const r=n.getFilters().map(s=>bl(s));return r.length===1?r[0]:{compositeFilter:{op:p_(n.op),filters:r}}}(t):A()}function m_(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function kl(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/**
1091
+ */class ys{constructor(e,t,r,s){this.Re=e,this.removedTargetIds=t,this.key=r,this.Ve=s}}class ou{constructor(e,t){this.targetId=e,this.me=t}}class au{constructor(e,t,r=_e.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=s}}class cu{constructor(){this.fe=0,this.ge=lu(),this.pe=_e.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=H(),t=H(),r=H();return this.ge.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:t=t.add(s);break;case 1:r=r.add(s);break;default:F()}}),new fr(this.pe,this.ye,e,t,r)}Ce(){this.we=!1,this.ge=lu()}Fe(e,t){this.we=!0,this.ge=this.ge.insert(e,t)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,X(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class Qm{constructor(e){this.Le=e,this.Be=new Map,this.ke=ht(),this.qe=uu(),this.Qe=new re(K)}Ke(e){for(const t of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(t,e.Ve):this.Ue(t,e.key,e.Ve);for(const t of e.removedTargetIds)this.Ue(t,e.key,e.Ve)}We(e){this.forEachTarget(e,t=>{const r=this.Ge(t);switch(e.state){case 0:this.ze(t)&&r.De(e.resumeToken);break;case 1:r.Oe(),r.Se||r.Ce(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||this.removeTarget(t);break;case 3:this.ze(t)&&(r.Ne(),r.De(e.resumeToken));break;case 4:this.ze(t)&&(this.je(t),r.De(e.resumeToken));break;default:F()}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Be.forEach((r,s)=>{this.ze(s)&&t(s)})}He(e){const t=e.targetId,r=e.me.count,s=this.Je(t);if(s){const i=s.target;if(Hi(i))if(r===0){const a=new L(i.path);this.Ue(t,a,we.newNoDocument(a,q.min()))}else X(r===1);else{const a=this.Ye(t);if(a!==r){const c=this.Ze(e),l=c?this.Xe(c,e,a):1;if(l!==0){this.je(t);const d=l===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(t,d)}}}}}Ze(e){const t=e.me.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=t;let a,c;try{a=Wt(r).toUint8Array()}catch(l){if(l instanceof Ac)return hn("Decoding the base64 bloom filter in existence filter failed ("+l.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw l}try{c=new Yi(a,s,i)}catch(l){return hn(l instanceof dr?"BloomFilter error: ":"Applying bloom filter failed: ",l),null}return c.Ie===0?null:c}Xe(e,t,r){return t.me.count===r-this.nt(e,t.targetId)?0:2}nt(e,t){const r=this.Le.getRemoteKeysForTarget(t);let s=0;return r.forEach(i=>{const a=this.Le.tt(),c=`projects/${a.projectId}/databases/${a.database}/documents/${i.path.canonicalString()}`;e.mightContain(c)||(this.Ue(t,i,null),s++)}),s}rt(e){const t=new Map;this.Be.forEach((i,a)=>{const c=this.Je(a);if(c){if(i.current&&Hi(c.target)){const l=new L(c.target.path);this.ke.get(l)!==null||this.it(a,l)||this.Ue(a,l,we.newNoDocument(l,e))}i.be&&(t.set(a,i.ve()),i.Ce())}});let r=H();this.qe.forEach((i,a)=>{let c=!0;a.forEachWhile(l=>{const d=this.Je(l);return!d||d.purpose==="TargetPurposeLimboResolution"||(c=!1,!1)}),c&&(r=r.add(i))}),this.ke.forEach((i,a)=>a.setReadTime(e));const s=new _s(e,t,this.Qe,this.ke,r);return this.ke=ht(),this.qe=uu(),this.Qe=new re(K),s}$e(e,t){if(!this.ze(e))return;const r=this.it(e,t.key)?2:0;this.Ge(e).Fe(t.key,r),this.ke=this.ke.insert(t.key,t),this.qe=this.qe.insert(t.key,this.st(t.key).add(e))}Ue(e,t,r){if(!this.ze(e))return;const s=this.Ge(e);this.it(e,t)?s.Fe(t,1):s.Me(t),this.qe=this.qe.insert(t,this.st(t).delete(e)),r&&(this.ke=this.ke.insert(t,r))}removeTarget(e){this.Be.delete(e)}Ye(e){const t=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let t=this.Be.get(e);return t||(t=new cu,this.Be.set(e,t)),t}st(e){let t=this.qe.get(e);return t||(t=new ge(K),this.qe=this.qe.insert(e,t)),t}ze(e){const t=this.Je(e)!==null;return t||V("WatchChangeAggregator","Detected inactive target",e),t}Je(e){const t=this.Be.get(e);return t&&t.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new cu),this.Le.getRemoteKeysForTarget(e).forEach(t=>{this.Ue(e,t,null)})}it(e,t){return this.Le.getRemoteKeysForTarget(e).has(t)}}function uu(){return new re(L.comparator)}function lu(){return new re(L.comparator)}const Ym={asc:"ASCENDING",desc:"DESCENDING"},Xm={"<":"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"},Jm={and:"AND",or:"OR"};class Zm{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Xi(n,e){return n.useProto3Json||es(e)?e:{value:e}}function vs(n,e){return n.useProto3Json?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function hu(n,e){return n.useProto3Json?e.toBase64():e.toUint8Array()}function eg(n,e){return vs(n,e.toTimestamp())}function et(n){return X(!!n),q.fromTimestamp(function(t){const r=bt(t);return new ue(r.seconds,r.nanos)}(n))}function Ji(n,e){return Zi(n,e).canonicalString()}function Zi(n,e){const t=function(s){return new ee(["projects",s.projectId,"databases",s.database])}(n).child("documents");return e===void 0?t:t.child(e)}function du(n){const e=ee.fromString(n);return X(vu(e)),e}function eo(n,e){return Ji(n.databaseId,e.path)}function to(n,e){const t=du(e);if(t.get(1)!==n.databaseId.projectId)throw new O(P.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+t.get(1)+" vs "+n.databaseId.projectId);if(t.get(3)!==n.databaseId.database)throw new O(P.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+t.get(3)+" vs "+n.databaseId.database);return new L(pu(t))}function fu(n,e){return Ji(n.databaseId,e)}function tg(n){const e=du(n);return e.length===4?ee.emptyPath():pu(e)}function no(n){return new ee(["projects",n.databaseId.projectId,"databases",n.databaseId.database]).canonicalString()}function pu(n){return X(n.length>4&&n.get(4)==="documents"),n.popFirst(5)}function mu(n,e,t){return{name:eo(n,e),fields:t.value.mapValue.fields}}function ng(n,e){let t;if("targetChange"in e){e.targetChange;const r=function(d){return d==="NO_CHANGE"?0:d==="ADD"?1:d==="REMOVE"?2:d==="CURRENT"?3:d==="RESET"?4:F()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(d,p){return d.useProto3Json?(X(p===void 0||typeof p=="string"),_e.fromBase64String(p||"")):(X(p===void 0||p instanceof Buffer||p instanceof Uint8Array),_e.fromUint8Array(p||new Uint8Array))}(n,e.targetChange.resumeToken),a=e.targetChange.cause,c=a&&function(d){const p=d.code===void 0?P.UNKNOWN:ru(d.code);return new O(p,d.message||"")}(a);t=new au(r,s,i,c||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=to(n,r.document.name),i=et(r.document.updateTime),a=r.document.createTime?et(r.document.createTime):q.min(),c=new Ne({mapValue:{fields:r.document.fields}}),l=we.newFoundDocument(s,i,a,c),d=r.targetIds||[],p=r.removedTargetIds||[];t=new ys(d,p,l.key,l)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=to(n,r.document),i=r.readTime?et(r.readTime):q.min(),a=we.newNoDocument(s,i),c=r.removedTargetIds||[];t=new ys([],c,a.key,a)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=to(n,r.document),i=r.removedTargetIds||[];t=new ys([],i,s,null)}else{if(!("filter"in e))return F();{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,a=new Hm(s,i),c=r.targetId;t=new ou(c,a)}}return t}function rg(n,e){let t;if(e instanceof hr)t={update:mu(n,e.key,e.value)};else if(e instanceof gs)t={delete:eo(n,e.key)};else if(e instanceof Pt)t={update:mu(n,e.key,e.data),updateMask:dg(e.fieldMask)};else{if(!(e instanceof jm))return F();t={verify:eo(n,e.key)}}return e.fieldTransforms.length>0&&(t.updateTransforms=e.fieldTransforms.map(r=>function(i,a){const c=a.transform;if(c instanceof ds)return{fieldPath:a.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(c instanceof cr)return{fieldPath:a.field.canonicalString(),appendMissingElements:{values:c.elements}};if(c instanceof ur)return{fieldPath:a.field.canonicalString(),removeAllFromArray:{values:c.elements}};if(c instanceof fs)return{fieldPath:a.field.canonicalString(),increment:c.Pe};throw F()}(0,r))),e.precondition.isNone||(t.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:eg(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:F()}(n,e.precondition)),t}function sg(n,e){return n&&n.length>0?(X(e!==void 0),n.map(t=>function(s,i){let a=s.updateTime?et(s.updateTime):et(i);return a.isEqual(q.min())&&(a=et(i)),new xm(a,s.transformResults||[])}(t,e))):[]}function ig(n,e){return{documents:[fu(n,e.path)]}}function gu(n,e){const t={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,t.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),t.structuredQuery.from=[{collectionId:r.lastSegment()}]),t.parent=fu(n,s);const i=function(d){if(d.length!==0)return yu(ze.create(d,"and"))}(e.filters);i&&(t.structuredQuery.where=i);const a=function(d){if(d.length!==0)return d.map(p=>function(v){return{field:St(v.field),direction:ug(v.dir)}}(p))}(e.orderBy);a&&(t.structuredQuery.orderBy=a);const c=Xi(n,e.limit);return c!==null&&(t.structuredQuery.limit=c),e.startAt&&(t.structuredQuery.startAt=function(d){return{before:d.inclusive,values:d.position}}(e.startAt)),e.endAt&&(t.structuredQuery.endAt=function(d){return{before:!d.inclusive,values:d.position}}(e.endAt)),{_t:t,parent:s}}function og(n,e,t,r){const{_t:s,parent:i}=gu(n,e),a={},c=[];let l=0;return t.forEach(d=>{const p="aggregate_"+l++;a[p]=d.alias,d.aggregateType==="count"?c.push({alias:p,count:{}}):d.aggregateType==="avg"?c.push({alias:p,avg:{field:St(d.fieldPath)}}):d.aggregateType==="sum"&&c.push({alias:p,sum:{field:St(d.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:c,structuredQuery:s.structuredQuery},parent:s.parent},ut:a,parent:i}}function ag(n){let e=tg(n.parent);const t=n.structuredQuery,r=t.from?t.from.length:0;let s=null;if(r>0){X(r===1);const p=t.from[0];p.allDescendants?s=p.collectionId:e=e.child(p.collectionId)}let i=[];t.where&&(i=function(g){const v=_u(g);return v instanceof ze&&Vc(v)?v.getFilters():[v]}(t.where));let a=[];t.orderBy&&(a=function(g){return g.map(v=>function(C){return new ir(vn(C.field),function(S){switch(S){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(C.direction))}(v))}(t.orderBy));let c=null;t.limit&&(c=function(g){let v;return v=typeof g=="object"?g.value:g,es(v)?null:v}(t.limit));let l=null;t.startAt&&(l=function(g){const v=!!g.before,R=g.values||[];return new mn(R,v)}(t.startAt));let d=null;return t.endAt&&(d=function(g){const v=!g.before,R=g.values||[];return new mn(R,v)}(t.endAt)),Rm(e,s,a,i,c,"F",l,d)}function cg(n,e){const t=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return F()}}(e.purpose);return t==null?null:{"goog-listen-tags":t}}function _u(n){return n.unaryFilter!==void 0?function(t){switch(t.unaryFilter.op){case"IS_NAN":const r=vn(t.unaryFilter.field);return ae.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=vn(t.unaryFilter.field);return ae.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=vn(t.unaryFilter.field);return ae.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const a=vn(t.unaryFilter.field);return ae.create(a,"!=",{nullValue:"NULL_VALUE"});default:return F()}}(n):n.fieldFilter!==void 0?function(t){return ae.create(vn(t.fieldFilter.field),function(s){switch(s){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 F()}}(t.fieldFilter.op),t.fieldFilter.value)}(n):n.compositeFilter!==void 0?function(t){return ze.create(t.compositeFilter.filters.map(r=>_u(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return F()}}(t.compositeFilter.op))}(n):F()}function ug(n){return Ym[n]}function lg(n){return Xm[n]}function hg(n){return Jm[n]}function St(n){return{fieldPath:n.canonicalString()}}function vn(n){return pe.fromServerFormat(n.fieldPath)}function yu(n){return n instanceof ae?function(t){if(t.op==="=="){if(Sc(t.value))return{unaryFilter:{field:St(t.field),op:"IS_NAN"}};if(Pc(t.value))return{unaryFilter:{field:St(t.field),op:"IS_NULL"}}}else if(t.op==="!="){if(Sc(t.value))return{unaryFilter:{field:St(t.field),op:"IS_NOT_NAN"}};if(Pc(t.value))return{unaryFilter:{field:St(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:St(t.field),op:lg(t.op),value:t.value}}}(n):n instanceof ze?function(t){const r=t.getFilters().map(s=>yu(s));return r.length===1?r[0]:{compositeFilter:{op:hg(t.op),filters:r}}}(n):F()}function dg(n){const e=[];return n.fields.forEach(t=>e.push(t.canonicalString())),{fieldPaths:e}}function vu(n){return n.length>=4&&n.get(0)==="projects"&&n.get(2)==="databases"}/**
1078
1092
  * @license
1079
1093
  * Copyright 2017 Google LLC
1080
1094
  *
@@ -1089,7 +1103,7 @@
1089
1103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1090
1104
  * See the License for the specific language governing permissions and
1091
1105
  * limitations under the License.
1092
- */class _t{constructor(e,n,r,s,i=S.min(),o=S.min(),a=ue.EMPTY_BYTE_STRING,c=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=a,this.expectedCount=c}withSequenceNumber(e){return new _t(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new _t(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new _t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new _t(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
1106
+ */class Ct{constructor(e,t,r,s,i=q.min(),a=q.min(),c=_e.EMPTY_BYTE_STRING,l=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=a,this.resumeToken=c,this.expectedCount=l}withSequenceNumber(e){return new Ct(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Ct(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Ct(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Ct(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
1093
1107
  * @license
1094
1108
  * Copyright 2017 Google LLC
1095
1109
  *
@@ -1104,7 +1118,7 @@
1104
1118
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1105
1119
  * See the License for the specific language governing permissions and
1106
1120
  * limitations under the License.
1107
- */class g_{constructor(e){this.ut=e}}function __(t){const e=l_({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?ws(e,e.limit,"L"):e}/**
1121
+ */class fg{constructor(e){this.ct=e}}function pg(n){const e=ag({parent:n.parent,structuredQuery:n.structuredQuery});return n.limitType==="LAST"?cs(e,e.limit,"L"):e}/**
1108
1122
  * @license
1109
1123
  * Copyright 2019 Google LLC
1110
1124
  *
@@ -1119,7 +1133,7 @@
1119
1133
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1120
1134
  * See the License for the specific language governing permissions and
1121
1135
  * limitations under the License.
1122
- */class y_{constructor(){this.on=new E_}addToCollectionParentIndex(e,n){return this.on.add(n),m.resolve()}getCollectionParents(e,n){return m.resolve(this.on.getEntries(n))}addFieldIndex(e,n){return m.resolve()}deleteFieldIndex(e,n){return m.resolve()}deleteAllFieldIndexes(e){return m.resolve()}createTargetIndexes(e,n){return m.resolve()}getDocumentsMatchingTarget(e,n){return m.resolve(null)}getIndexType(e,n){return m.resolve(0)}getFieldIndexes(e,n){return m.resolve([])}getNextCollectionGroupToUpdate(e){return m.resolve(null)}getMinOffset(e,n){return m.resolve(ft.min())}getMinOffsetFromCollectionGroup(e,n){return m.resolve(ft.min())}updateCollectionGroup(e,n,r){return m.resolve()}updateIndexEntries(e,n){return m.resolve()}}class E_{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new re(B.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new re(B.comparator)).toArray()}}/**
1136
+ */class mg{constructor(){this.un=new gg}addToCollectionParentIndex(e,t){return this.un.add(t),k.resolve()}getCollectionParents(e,t){return k.resolve(this.un.getEntries(t))}addFieldIndex(e,t){return k.resolve()}deleteFieldIndex(e,t){return k.resolve()}deleteAllFieldIndexes(e){return k.resolve()}createTargetIndexes(e,t){return k.resolve()}getDocumentsMatchingTarget(e,t){return k.resolve(null)}getIndexType(e,t){return k.resolve(0)}getFieldIndexes(e,t){return k.resolve([])}getNextCollectionGroupToUpdate(e){return k.resolve(null)}getMinOffset(e,t){return k.resolve(Rt.min())}getMinOffsetFromCollectionGroup(e,t){return k.resolve(Rt.min())}updateCollectionGroup(e,t,r){return k.resolve()}updateIndexEntries(e,t){return k.resolve()}}class gg{constructor(){this.index={}}add(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t]||new ge(ee.comparator),i=!s.has(r);return this.index[t]=s.add(r),i}has(e){const t=e.lastSegment(),r=e.popLast(),s=this.index[t];return s&&s.has(r)}getEntries(e){return(this.index[e]||new ge(ee.comparator)).toArray()}}/**
1123
1137
  * @license
1124
1138
  * Copyright 2017 Google LLC
1125
1139
  *
@@ -1134,7 +1148,7 @@
1134
1148
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1135
1149
  * See the License for the specific language governing permissions and
1136
1150
  * limitations under the License.
1137
- */class dn{constructor(e){this.xn=e}next(){return this.xn+=2,this.xn}static On(){return new dn(0)}static Nn(){return new dn(-1)}}/**
1151
+ */class En{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new En(0)}static kn(){return new En(-1)}}/**
1138
1152
  * @license
1139
1153
  * Copyright 2017 Google LLC
1140
1154
  *
@@ -1149,7 +1163,7 @@
1149
1163
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1150
1164
  * See the License for the specific language governing permissions and
1151
1165
  * limitations under the License.
1152
- */class v_{constructor(){this.changes=new ln(e=>e.toString(),(e,n)=>e.isEqual(n)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,n){this.assertNotApplied(),this.changes.set(e,le.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?m.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
1166
+ */class _g{constructor(){this.changes=new yn(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,we.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const r=this.changes.get(t);return r!==void 0?k.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
1153
1167
  * @license
1154
1168
  * Copyright 2017 Google LLC
1155
1169
  *
@@ -1179,7 +1193,7 @@
1179
1193
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1180
1194
  * See the License for the specific language governing permissions and
1181
1195
  * limitations under the License.
1182
- */class T_{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
1196
+ */class yg{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}/**
1183
1197
  * @license
1184
1198
  * Copyright 2017 Google LLC
1185
1199
  *
@@ -1194,7 +1208,7 @@
1194
1208
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1195
1209
  * See the License for the specific language governing permissions and
1196
1210
  * limitations under the License.
1197
- */class I_{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,n))).next(s=>(r!==null&&_r(r.mutation,s,Te.empty(),Q.now()),s))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,N()).next(()=>r))}getLocalViewOfDocuments(e,n,r=N()){const s=xt();return this.populateOverlays(e,s,n).next(()=>this.computeViews(e,n,s,r).next(i=>{let o=fr();return i.forEach((a,c)=>{o=o.insert(a,c.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=xt();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,N()))}populateOverlays(e,n,r){const s=[];return r.forEach(i=>{n.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,a)=>{n.set(o,a)})})}computeViews(e,n,r,s){let i=Je();const o=pr(),a=function(){return pr()}();return n.forEach((c,u)=>{const l=r.get(u.key);s.has(u.key)&&(l===void 0||l.mutation instanceof mt)?i=i.insert(u.key,u):l!==void 0?(o.set(u.key,l.mutation.getFieldMask()),_r(l.mutation,u,l.mutation.getFieldMask(),Q.now())):o.set(u.key,Te.empty())}),this.recalculateAndSaveOverlays(e,i).next(c=>(c.forEach((u,l)=>o.set(u,l)),n.forEach((u,l)=>{var h;return a.set(u,new T_(l,(h=o.get(u))!==null&&h!==void 0?h:null))}),a))}recalculateAndSaveOverlays(e,n){const r=pr();let s=new j((o,a)=>o-a),i=N();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const a of o)a.keys().forEach(c=>{const u=n.get(c);if(u===null)return;let l=r.get(c)||Te.empty();l=a.applyToLocalView(u,l),r.set(c,l);const h=(s.get(a.batchId)||N()).add(c);s=s.insert(a.batchId,h)})}).next(()=>{const o=[],a=s.getReverseIterator();for(;a.hasNext();){const c=a.getNext(),u=c.key,l=c.value,h=nl();l.forEach(d=>{if(!i.has(d)){const f=ll(n.get(d),r.get(d));f!==null&&h.set(d,f),i=i.add(d)}}),o.push(this.documentOverlayCache.saveOverlays(e,u,h))}return m.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,s){return function(o){return I.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):No(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):m.resolve(xt());let a=-1,c=i;return o.next(u=>m.forEach(u,(l,h)=>(a<h.largestBatchId&&(a=h.largestBatchId),i.get(l)?m.resolve():this.remoteDocumentCache.getEntry(e,l).next(d=>{c=c.insert(l,d)}))).next(()=>this.populateOverlays(e,u,i)).next(()=>this.computeViews(e,c,u,N())).next(l=>({batchId:a,changes:tl(l)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new I(n)).next(r=>{let s=fr();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let o=fr();return this.indexManager.getCollectionParents(e,i).next(a=>m.forEach(a,c=>{const u=function(h,d){return new Ut(d,null,h.explicitOrderBy.slice(),h.filters.slice(),h.limit,h.limitType,h.startAt,h.endAt)}(n,c.child(i));return this.getDocumentsMatchingCollectionQuery(e,u,r,s).next(l=>{l.forEach((h,d)=>{o=o.insert(h,d)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s))).next(o=>{i.forEach((c,u)=>{const l=u.getKey();o.get(l)===null&&(o=o.insert(l,le.newInvalidDocument(l)))});let a=fr();return o.forEach((c,u)=>{const l=i.get(c);l!==void 0&&_r(l.mutation,u,Te.empty(),Q.now()),Rs(n,u)&&(a=a.insert(c,u))}),a})}}/**
1211
+ */class vg{constructor(e,t,r,s){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,t))).next(s=>(r!==null&&lr(r.mutation,s,Me.empty(),ue.now()),s))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.getLocalViewOfDocuments(e,r,H()).next(()=>r))}getLocalViewOfDocuments(e,t,r=H()){const s=Qt();return this.populateOverlays(e,s,t).next(()=>this.computeViews(e,t,s,r).next(i=>{let a=or();return i.forEach((c,l)=>{a=a.insert(c,l.overlayedDocument)}),a}))}getOverlayedDocuments(e,t){const r=Qt();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,H()))}populateOverlays(e,t,r){const s=[];return r.forEach(i=>{t.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((a,c)=>{t.set(a,c)})})}computeViews(e,t,r,s){let i=ht();const a=ar(),c=function(){return ar()}();return t.forEach((l,d)=>{const p=r.get(d.key);s.has(d.key)&&(p===void 0||p.mutation instanceof Pt)?i=i.insert(d.key,d):p!==void 0?(a.set(d.key,p.mutation.getFieldMask()),lr(p.mutation,d,p.mutation.getFieldMask(),ue.now())):a.set(d.key,Me.empty())}),this.recalculateAndSaveOverlays(e,i).next(l=>(l.forEach((d,p)=>a.set(d,p)),t.forEach((d,p)=>{var g;return c.set(d,new yg(p,(g=a.get(d))!==null&&g!==void 0?g:null))}),c))}recalculateAndSaveOverlays(e,t){const r=ar();let s=new re((a,c)=>a-c),i=H();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(a=>{for(const c of a)c.keys().forEach(l=>{const d=t.get(l);if(d===null)return;let p=r.get(l)||Me.empty();p=c.applyToLocalView(d,p),r.set(l,p);const g=(s.get(c.batchId)||H()).add(l);s=s.insert(c.batchId,g)})}).next(()=>{const a=[],c=s.getReverseIterator();for(;c.hasNext();){const l=c.getNext(),d=l.key,p=l.value,g=Hc();p.forEach(v=>{if(!i.has(v)){const R=Jc(t.get(v),r.get(v));R!==null&&g.set(v,R),i=i.add(v)}}),a.push(this.documentOverlayCache.saveOverlays(e,d,g))}return k.waitFor(a)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,t,r,s){return function(a){return L.isDocumentKey(a.path)&&a.collectionGroup===null&&a.filters.length===0}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Wi(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,s):this.getDocumentsMatchingCollectionQuery(e,t,r,s)}getNextDocuments(e,t,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,s).next(i=>{const a=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,s-i.size):k.resolve(Qt());let c=-1,l=i;return a.next(d=>k.forEach(d,(p,g)=>(c<g.largestBatchId&&(c=g.largestBatchId),i.get(p)?k.resolve():this.remoteDocumentCache.getEntry(e,p).next(v=>{l=l.insert(p,v)}))).next(()=>this.populateOverlays(e,d,i)).next(()=>this.computeViews(e,l,d,H())).next(p=>({batchId:c,changes:zc(p)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new L(t)).next(r=>{let s=or();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,t,r,s){const i=t.collectionGroup;let a=or();return this.indexManager.getCollectionParents(e,i).next(c=>k.forEach(c,l=>{const d=function(g,v){return new Kt(v,null,g.explicitOrderBy.slice(),g.filters.slice(),g.limit,g.limitType,g.startAt,g.endAt)}(t,l.child(i));return this.getDocumentsMatchingCollectionQuery(e,d,r,s).next(p=>{p.forEach((g,v)=>{a=a.insert(g,v)})})}).next(()=>a))}getDocumentsMatchingCollectionQuery(e,t,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(a=>(i=a,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,s))).next(a=>{i.forEach((l,d)=>{const p=d.getKey();a.get(p)===null&&(a=a.insert(p,we.newInvalidDocument(p)))});let c=or();return a.forEach((l,d)=>{const p=i.get(l);p!==void 0&&lr(p.mutation,d,Me.empty(),ue.now()),ls(t,d)&&(c=c.insert(l,d))}),c})}}/**
1198
1212
  * @license
1199
1213
  * Copyright 2020 Google LLC
1200
1214
  *
@@ -1209,7 +1223,7 @@
1209
1223
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1210
1224
  * See the License for the specific language governing permissions and
1211
1225
  * limitations under the License.
1212
- */class w_{constructor(e){this.serializer=e,this.ur=new Map,this.cr=new Map}getBundleMetadata(e,n){return m.resolve(this.ur.get(n))}saveBundleMetadata(e,n){return this.ur.set(n.id,function(s){return{id:s.id,version:s.version,createTime:qe(s.createTime)}}(n)),m.resolve()}getNamedQuery(e,n){return m.resolve(this.cr.get(n))}saveNamedQuery(e,n){return this.cr.set(n.name,function(s){return{name:s.name,query:__(s.bundledQuery),readTime:qe(s.readTime)}}(n)),m.resolve()}}/**
1226
+ */class Eg{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,t){return k.resolve(this.hr.get(t))}saveBundleMetadata(e,t){return this.hr.set(t.id,function(s){return{id:s.id,version:s.version,createTime:et(s.createTime)}}(t)),k.resolve()}getNamedQuery(e,t){return k.resolve(this.Pr.get(t))}saveNamedQuery(e,t){return this.Pr.set(t.name,function(s){return{name:s.name,query:pg(s.bundledQuery),readTime:et(s.readTime)}}(t)),k.resolve()}}/**
1213
1227
  * @license
1214
1228
  * Copyright 2022 Google LLC
1215
1229
  *
@@ -1224,7 +1238,22 @@
1224
1238
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1225
1239
  * See the License for the specific language governing permissions and
1226
1240
  * limitations under the License.
1227
- */class A_{constructor(){this.overlays=new j(I.comparator),this.lr=new Map}getOverlay(e,n){return m.resolve(this.overlays.get(n))}getOverlays(e,n){const r=xt();return m.forEach(n,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((s,i)=>{this.lt(e,n,i)}),m.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.lr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.lr.delete(r)),m.resolve()}getOverlaysForCollection(e,n,r){const s=xt(),i=n.length+1,o=new I(n.child("")),a=this.overlays.getIteratorFrom(o);for(;a.hasNext();){const c=a.getNext().value,u=c.getKey();if(!n.isPrefixOf(u.path))break;u.path.length===i&&c.largestBatchId>r&&s.set(c.getKey(),c)}return m.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new j((u,l)=>u-l);const o=this.overlays.getIterator();for(;o.hasNext();){const u=o.getNext().value;if(u.getKey().getCollectionGroup()===n&&u.largestBatchId>r){let l=i.get(u.largestBatchId);l===null&&(l=xt(),i=i.insert(u.largestBatchId,l)),l.set(u.getKey(),u)}}const a=xt(),c=i.getIterator();for(;c.hasNext()&&(c.getNext().value.forEach((u,l)=>a.set(u,l)),!(a.size()>=s)););return m.resolve(a)}lt(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.lr.get(s.largestBatchId).delete(r.key);this.lr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new Gg(n,r));let i=this.lr.get(n);i===void 0&&(i=N(),this.lr.set(n,i)),this.lr.set(n,i.add(r.key))}}/**
1241
+ */class Tg{constructor(){this.overlays=new re(L.comparator),this.Ir=new Map}getOverlay(e,t){return k.resolve(this.overlays.get(t))}getOverlays(e,t){const r=Qt();return k.forEach(t,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((s,i)=>{this.ht(e,t,i)}),k.resolve()}removeOverlaysForBatchId(e,t,r){const s=this.Ir.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Ir.delete(r)),k.resolve()}getOverlaysForCollection(e,t,r){const s=Qt(),i=t.length+1,a=new L(t.child("")),c=this.overlays.getIteratorFrom(a);for(;c.hasNext();){const l=c.getNext().value,d=l.getKey();if(!t.isPrefixOf(d.path))break;d.path.length===i&&l.largestBatchId>r&&s.set(l.getKey(),l)}return k.resolve(s)}getOverlaysForCollectionGroup(e,t,r,s){let i=new re((d,p)=>d-p);const a=this.overlays.getIterator();for(;a.hasNext();){const d=a.getNext().value;if(d.getKey().getCollectionGroup()===t&&d.largestBatchId>r){let p=i.get(d.largestBatchId);p===null&&(p=Qt(),i=i.insert(d.largestBatchId,p)),p.set(d.getKey(),d)}}const c=Qt(),l=i.getIterator();for(;l.hasNext()&&(l.getNext().value.forEach((d,p)=>c.set(d,p)),!(c.size()>=s)););return k.resolve(c)}ht(e,t,r){const s=this.overlays.get(r.key);if(s!==null){const a=this.Ir.get(s.largestBatchId).delete(r.key);this.Ir.set(s.largestBatchId,a)}this.overlays=this.overlays.insert(r.key,new $m(t,r));let i=this.Ir.get(t);i===void 0&&(i=H(),this.Ir.set(t,i)),this.Ir.set(t,i.add(r.key))}}/**
1242
+ * @license
1243
+ * Copyright 2024 Google LLC
1244
+ *
1245
+ * Licensed under the Apache License, Version 2.0 (the "License");
1246
+ * you may not use this file except in compliance with the License.
1247
+ * You may obtain a copy of the License at
1248
+ *
1249
+ * http://www.apache.org/licenses/LICENSE-2.0
1250
+ *
1251
+ * Unless required by applicable law or agreed to in writing, software
1252
+ * distributed under the License is distributed on an "AS IS" BASIS,
1253
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1254
+ * See the License for the specific language governing permissions and
1255
+ * limitations under the License.
1256
+ */class wg{constructor(){this.sessionToken=_e.EMPTY_BYTE_STRING}getSessionToken(e){return k.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,k.resolve()}}/**
1228
1257
  * @license
1229
1258
  * Copyright 2017 Google LLC
1230
1259
  *
@@ -1239,7 +1268,7 @@
1239
1268
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1240
1269
  * See the License for the specific language governing permissions and
1241
1270
  * limitations under the License.
1242
- */class qo{constructor(){this.hr=new re(J.Pr),this.Ir=new re(J.Tr)}isEmpty(){return this.hr.isEmpty()}addReference(e,n){const r=new J(e,n);this.hr=this.hr.add(r),this.Ir=this.Ir.add(r)}Er(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.dr(new J(e,n))}Ar(e,n){e.forEach(r=>this.removeReference(r,n))}Rr(e){const n=new I(new B([])),r=new J(n,e),s=new J(n,e+1),i=[];return this.Ir.forEachInRange([r,s],o=>{this.dr(o),i.push(o.key)}),i}Vr(){this.hr.forEach(e=>this.dr(e))}dr(e){this.hr=this.hr.delete(e),this.Ir=this.Ir.delete(e)}mr(e){const n=new I(new B([])),r=new J(n,e),s=new J(n,e+1);let i=N();return this.Ir.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const n=new J(e,0),r=this.hr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class J{constructor(e,n){this.key=e,this.gr=n}static Pr(e,n){return I.comparator(e.key,n.key)||L(e.gr,n.gr)}static Tr(e,n){return L(e.gr,n.gr)||I.comparator(e.key,n.key)}}/**
1271
+ */class ro{constructor(){this.Tr=new ge(he.Er),this.dr=new ge(he.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,t){const r=new he(e,t);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,t){e.forEach(r=>this.addReference(r,t))}removeReference(e,t){this.Vr(new he(e,t))}mr(e,t){e.forEach(r=>this.removeReference(r,t))}gr(e){const t=new L(new ee([])),r=new he(t,e),s=new he(t,e+1),i=[];return this.dr.forEachInRange([r,s],a=>{this.Vr(a),i.push(a.key)}),i}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const t=new L(new ee([])),r=new he(t,e),s=new he(t,e+1);let i=H();return this.dr.forEachInRange([r,s],a=>{i=i.add(a.key)}),i}containsKey(e){const t=new he(e,0),r=this.Tr.firstAfterOrEqual(t);return r!==null&&e.isEqual(r.key)}}class he{constructor(e,t){this.key=e,this.wr=t}static Er(e,t){return L.comparator(e.key,t.key)||K(e.wr,t.wr)}static Ar(e,t){return K(e.wr,t.wr)||L.comparator(e.key,t.key)}}/**
1243
1272
  * @license
1244
1273
  * Copyright 2017 Google LLC
1245
1274
  *
@@ -1254,7 +1283,7 @@
1254
1283
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1255
1284
  * See the License for the specific language governing permissions and
1256
1285
  * limitations under the License.
1257
- */class R_{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.pr=1,this.yr=new re(J.Pr)}checkEmpty(e){return m.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.pr;this.pr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new Wg(i,n,r,s);this.mutationQueue.push(o);for(const a of s)this.yr=this.yr.add(new J(a.key,i)),this.indexManager.addToCollectionParentIndex(e,a.key.path.popLast());return m.resolve(o)}lookupMutationBatch(e,n){return m.resolve(this.wr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.Sr(r),i=s<0?0:s;return m.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return m.resolve(this.mutationQueue.length===0?-1:this.pr-1)}getAllMutationBatches(e){return m.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new J(n,0),s=new J(n,Number.POSITIVE_INFINITY),i=[];return this.yr.forEachInRange([r,s],o=>{const a=this.wr(o.gr);i.push(a)}),m.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new re(L);return n.forEach(s=>{const i=new J(s,0),o=new J(s,Number.POSITIVE_INFINITY);this.yr.forEachInRange([i,o],a=>{r=r.add(a.gr)})}),m.resolve(this.br(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;I.isDocumentKey(i)||(i=i.child(""));const o=new J(new I(i),0);let a=new re(L);return this.yr.forEachWhile(c=>{const u=c.key.path;return!!r.isPrefixOf(u)&&(u.length===s&&(a=a.add(c.gr)),!0)},o),m.resolve(this.br(a))}br(e){const n=[];return e.forEach(r=>{const s=this.wr(r);s!==null&&n.push(s)}),n}removeMutationBatch(e,n){F(this.Dr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.yr;return m.forEach(n.mutations,s=>{const i=new J(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.yr=r})}Fn(e){}containsKey(e,n){const r=new J(n,0),s=this.yr.firstAfterOrEqual(r);return m.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,m.resolve()}Dr(e,n){return this.Sr(e)}Sr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}wr(e){const n=this.Sr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
1286
+ */class Ig{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Sr=1,this.br=new ge(he.Er)}checkEmpty(e){return k.resolve(this.mutationQueue.length===0)}addMutationBatch(e,t,r,s){const i=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const a=new qm(i,t,r,s);this.mutationQueue.push(a);for(const c of s)this.br=this.br.add(new he(c.key,i)),this.indexManager.addToCollectionParentIndex(e,c.key.path.popLast());return k.resolve(a)}lookupMutationBatch(e,t){return k.resolve(this.Dr(t))}getNextMutationBatchAfterBatchId(e,t){const r=t+1,s=this.vr(r),i=s<0?0:s;return k.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return k.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return k.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const r=new he(t,0),s=new he(t,Number.POSITIVE_INFINITY),i=[];return this.br.forEachInRange([r,s],a=>{const c=this.Dr(a.wr);i.push(c)}),k.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new ge(K);return t.forEach(s=>{const i=new he(s,0),a=new he(s,Number.POSITIVE_INFINITY);this.br.forEachInRange([i,a],c=>{r=r.add(c.wr)})}),k.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,t){const r=t.path,s=r.length+1;let i=r;L.isDocumentKey(i)||(i=i.child(""));const a=new he(new L(i),0);let c=new ge(K);return this.br.forEachWhile(l=>{const d=l.key.path;return!!r.isPrefixOf(d)&&(d.length===s&&(c=c.add(l.wr)),!0)},a),k.resolve(this.Cr(c))}Cr(e){const t=[];return e.forEach(r=>{const s=this.Dr(r);s!==null&&t.push(s)}),t}removeMutationBatch(e,t){X(this.Fr(t.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return k.forEach(t.mutations,s=>{const i=new he(s.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,t){const r=new he(t,0),s=this.br.firstAfterOrEqual(r);return k.resolve(t.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,k.resolve()}Fr(e,t){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const t=this.vr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}/**
1258
1287
  * @license
1259
1288
  * Copyright 2017 Google LLC
1260
1289
  *
@@ -1269,7 +1298,7 @@
1269
1298
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1270
1299
  * See the License for the specific language governing permissions and
1271
1300
  * limitations under the License.
1272
- */class P_{constructor(e){this.Cr=e,this.docs=function(){return new j(I.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,o=this.Cr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-i,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return m.resolve(r?r.document.mutableCopy():le.newInvalidDocument(n))}getEntries(e,n){let r=Je();return n.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():le.newInvalidDocument(s))}),m.resolve(r)}getDocumentsMatchingQuery(e,n,r,s){let i=Je();const o=n.path,a=new I(o.child("")),c=this.docs.getIteratorFrom(a);for(;c.hasNext();){const{key:u,value:{document:l}}=c.getNext();if(!o.isPrefixOf(u.path))break;u.path.length>o.length+1||fg(dg(l),r)<=0||(s.has(l.key)||Rs(n,l))&&(i=i.insert(l.key,l.mutableCopy()))}return m.resolve(i)}getAllFromCollectionGroup(e,n,r,s){A()}vr(e,n){return m.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new S_(this)}getSize(e){return m.resolve(this.size)}}class S_ extends v_{constructor(e){super(),this._r=e}applyChanges(e){const n=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?n.push(this._r.addEntry(e,s)):this._r.removeEntry(r)}),m.waitFor(n)}getFromCache(e,n){return this._r.getEntry(e,n)}getAllFromCache(e,n){return this._r.getEntries(e,n)}}/**
1301
+ */class Ag{constructor(e){this.Mr=e,this.docs=function(){return new re(L.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const r=t.key,s=this.docs.get(r),i=s?s.size:0,a=this.Mr(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:a}),this.size+=a-i,this.indexManager.addToCollectionParentIndex(e,r.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 r=this.docs.get(t);return k.resolve(r?r.document.mutableCopy():we.newInvalidDocument(t))}getEntries(e,t){let r=ht();return t.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():we.newInvalidDocument(s))}),k.resolve(r)}getDocumentsMatchingQuery(e,t,r,s){let i=ht();const a=t.path,c=new L(a.child("")),l=this.docs.getIteratorFrom(c);for(;l.hasNext();){const{key:d,value:{document:p}}=l.getNext();if(!a.isPrefixOf(d.path))break;d.path.length>a.length+1||im(sm(p),r)<=0||(s.has(p.key)||ls(t,p))&&(i=i.insert(p.key,p.mutableCopy()))}return k.resolve(i)}getAllFromCollectionGroup(e,t,r,s){F()}Or(e,t){return k.forEach(this.docs,r=>t(r))}newChangeBuffer(e){return new Rg(this)}getSize(e){return k.resolve(this.size)}}class Rg extends _g{constructor(e){super(),this.cr=e}applyChanges(e){const t=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?t.push(this.cr.addEntry(e,s)):this.cr.removeEntry(r)}),k.waitFor(t)}getFromCache(e,t){return this.cr.getEntry(e,t)}getAllFromCache(e,t){return this.cr.getEntries(e,t)}}/**
1273
1302
  * @license
1274
1303
  * Copyright 2017 Google LLC
1275
1304
  *
@@ -1284,7 +1313,7 @@
1284
1313
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1285
1314
  * See the License for the specific language governing permissions and
1286
1315
  * limitations under the License.
1287
- */class C_{constructor(e){this.persistence=e,this.Fr=new ln(n=>So(n),Co),this.lastRemoteSnapshotVersion=S.min(),this.highestTargetId=0,this.Mr=0,this.Or=new qo,this.targetCount=0,this.Nr=dn.On()}forEachTarget(e,n){return this.Fr.forEach((r,s)=>n(s)),m.resolve()}getLastRemoteSnapshotVersion(e){return m.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return m.resolve(this.Mr)}allocateTargetId(e){return this.highestTargetId=this.Nr.next(),m.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Mr&&(this.Mr=n),m.resolve()}kn(e){this.Fr.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.Nr=new dn(n),this.highestTargetId=n),e.sequenceNumber>this.Mr&&(this.Mr=e.sequenceNumber)}addTargetData(e,n){return this.kn(n),this.targetCount+=1,m.resolve()}updateTargetData(e,n){return this.kn(n),m.resolve()}removeTargetData(e,n){return this.Fr.delete(n.target),this.Or.Rr(n.targetId),this.targetCount-=1,m.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.Fr.forEach((o,a)=>{a.sequenceNumber<=n&&r.get(a.targetId)===null&&(this.Fr.delete(o),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),s++)}),m.waitFor(i).next(()=>s)}getTargetCount(e){return m.resolve(this.targetCount)}getTargetData(e,n){const r=this.Fr.get(n)||null;return m.resolve(r)}addMatchingKeys(e,n,r){return this.Or.Er(n,r),m.resolve()}removeMatchingKeys(e,n,r){this.Or.Ar(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),m.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.Or.Rr(n),m.resolve()}getMatchingKeysForTargetId(e,n){const r=this.Or.mr(n);return m.resolve(r)}containsKey(e,n){return m.resolve(this.Or.containsKey(n))}}/**
1316
+ */class bg{constructor(e){this.persistence=e,this.Nr=new yn(t=>$i(t),zi),this.lastRemoteSnapshotVersion=q.min(),this.highestTargetId=0,this.Lr=0,this.Br=new ro,this.targetCount=0,this.kr=En.Bn()}forEachTarget(e,t){return this.Nr.forEach((r,s)=>t(s)),k.resolve()}getLastRemoteSnapshotVersion(e){return k.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return k.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),k.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.Lr&&(this.Lr=t),k.resolve()}Kn(e){this.Nr.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this.kr=new En(t),this.highestTargetId=t),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,t){return this.Kn(t),this.targetCount+=1,k.resolve()}updateTargetData(e,t){return this.Kn(t),k.resolve()}removeTargetData(e,t){return this.Nr.delete(t.target),this.Br.gr(t.targetId),this.targetCount-=1,k.resolve()}removeTargets(e,t,r){let s=0;const i=[];return this.Nr.forEach((a,c)=>{c.sequenceNumber<=t&&r.get(c.targetId)===null&&(this.Nr.delete(a),i.push(this.removeMatchingKeysForTargetId(e,c.targetId)),s++)}),k.waitFor(i).next(()=>s)}getTargetCount(e){return k.resolve(this.targetCount)}getTargetData(e,t){const r=this.Nr.get(t)||null;return k.resolve(r)}addMatchingKeys(e,t,r){return this.Br.Rr(t,r),k.resolve()}removeMatchingKeys(e,t,r){this.Br.mr(t,r);const s=this.persistence.referenceDelegate,i=[];return s&&t.forEach(a=>{i.push(s.markPotentiallyOrphaned(e,a))}),k.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.Br.gr(t),k.resolve()}getMatchingKeysForTargetId(e,t){const r=this.Br.yr(t);return k.resolve(r)}containsKey(e,t){return k.resolve(this.Br.containsKey(t))}}/**
1288
1317
  * @license
1289
1318
  * Copyright 2017 Google LLC
1290
1319
  *
@@ -1299,7 +1328,7 @@
1299
1328
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1300
1329
  * See the License for the specific language governing permissions and
1301
1330
  * limitations under the License.
1302
- */class b_{constructor(e,n){this.Br={},this.overlays={},this.Lr=new To(0),this.kr=!1,this.kr=!0,this.referenceDelegate=e(this),this.qr=new C_(this),this.indexManager=new y_,this.remoteDocumentCache=function(s){return new P_(s)}(r=>this.referenceDelegate.Qr(r)),this.serializer=new g_(n),this.Kr=new w_(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.kr=!1,Promise.resolve()}get started(){return this.kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new A_,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.Br[e.toKey()];return r||(r=new R_(n,this.referenceDelegate),this.Br[e.toKey()]=r),r}getTargetCache(){return this.qr}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Kr}runTransaction(e,n,r){T("MemoryPersistence","Starting transaction:",e);const s=new k_(this.Lr.next());return this.referenceDelegate.$r(),r(s).next(i=>this.referenceDelegate.Ur(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Wr(e,n){return m.or(Object.values(this.Br).map(r=>()=>r.containsKey(e,n)))}}class k_ extends mg{constructor(e){super(),this.currentSequenceNumber=e}}class $o{constructor(e){this.persistence=e,this.Gr=new qo,this.zr=null}static jr(e){return new $o(e)}get Hr(){if(this.zr)return this.zr;throw A()}addReference(e,n,r){return this.Gr.addReference(r,n),this.Hr.delete(r.toString()),m.resolve()}removeReference(e,n,r){return this.Gr.removeReference(r,n),this.Hr.add(r.toString()),m.resolve()}markPotentiallyOrphaned(e,n){return this.Hr.add(n.toString()),m.resolve()}removeTarget(e,n){this.Gr.Rr(n.targetId).forEach(s=>this.Hr.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(s=>{s.forEach(i=>this.Hr.add(i.toString()))}).next(()=>r.removeTargetData(e,n))}$r(){this.zr=new Set}Ur(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return m.forEach(this.Hr,r=>{const s=I.fromPath(r);return this.Jr(e,s).next(i=>{i||n.removeEntry(s,S.min())})}).next(()=>(this.zr=null,n.apply(e)))}updateLimboDocument(e,n){return this.Jr(e,n).next(r=>{r?this.Hr.delete(n.toString()):this.Hr.add(n.toString())})}Qr(e){return 0}Jr(e,n){return m.or([()=>m.resolve(this.Gr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Wr(e,n)])}}/**
1331
+ */class Pg{constructor(e,t){this.qr={},this.overlays={},this.Qr=new Ui(0),this.Kr=!1,this.Kr=!0,this.$r=new wg,this.referenceDelegate=e(this),this.Ur=new bg(this),this.indexManager=new mg,this.remoteDocumentCache=function(s){return new Ag(s)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new fg(t),this.Gr=new Eg(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new Tg,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.qr[e.toKey()];return r||(r=new Ig(t,this.referenceDelegate),this.qr[e.toKey()]=r),r}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,t,r){V("MemoryPersistence","Starting transaction:",e);const s=new Sg(this.Qr.next());return this.referenceDelegate.zr(),r(s).next(i=>this.referenceDelegate.jr(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Hr(e,t){return k.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,t)))}}class Sg extends am{constructor(e){super(),this.currentSequenceNumber=e}}class so{constructor(e){this.persistence=e,this.Jr=new ro,this.Yr=null}static Zr(e){return new so(e)}get Xr(){if(this.Yr)return this.Yr;throw F()}addReference(e,t,r){return this.Jr.addReference(r,t),this.Xr.delete(r.toString()),k.resolve()}removeReference(e,t,r){return this.Jr.removeReference(r,t),this.Xr.add(r.toString()),k.resolve()}markPotentiallyOrphaned(e,t){return this.Xr.add(t.toString()),k.resolve()}removeTarget(e,t){this.Jr.gr(t.targetId).forEach(s=>this.Xr.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(s=>{s.forEach(i=>this.Xr.add(i.toString()))}).next(()=>r.removeTargetData(e,t))}zr(){this.Yr=new Set}jr(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return k.forEach(this.Xr,r=>{const s=L.fromPath(r);return this.ei(e,s).next(i=>{i||t.removeEntry(s,q.min())})}).next(()=>(this.Yr=null,t.apply(e)))}updateLimboDocument(e,t){return this.ei(e,t).next(r=>{r?this.Xr.delete(t.toString()):this.Xr.add(t.toString())})}Wr(e){return 0}ei(e,t){return k.or([()=>k.resolve(this.Jr.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Hr(e,t)])}}/**
1303
1332
  * @license
1304
1333
  * Copyright 2017 Google LLC
1305
1334
  *
@@ -1314,7 +1343,7 @@
1314
1343
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1315
1344
  * See the License for the specific language governing permissions and
1316
1345
  * limitations under the License.
1317
- */class jo{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.ki=r,this.qi=s}static Qi(e,n){let r=N(),s=N();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new jo(e,n.fromCache,r,s)}}/**
1346
+ */class io{constructor(e,t,r,s){this.targetId=e,this.fromCache=t,this.$i=r,this.Ui=s}static Wi(e,t){let r=H(),s=H();for(const i of t.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new io(e,t.fromCache,r,s)}}/**
1318
1347
  * @license
1319
1348
  * Copyright 2023 Google LLC
1320
1349
  *
@@ -1329,7 +1358,7 @@
1329
1358
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1330
1359
  * See the License for the specific language governing permissions and
1331
1360
  * limitations under the License.
1332
- */class N_{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
1361
+ */class Cg{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
1333
1362
  * @license
1334
1363
  * Copyright 2019 Google LLC
1335
1364
  *
@@ -1344,7 +1373,7 @@
1344
1373
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1345
1374
  * See the License for the specific language governing permissions and
1346
1375
  * limitations under the License.
1347
- */class D_{constructor(){this.Ki=!1,this.$i=!1,this.Ui=100,this.Wi=8}initialize(e,n){this.Gi=e,this.indexManager=n,this.Ki=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.zi(e,n).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.ji(e,n,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new N_;return this.Hi(e,n,o).next(a=>{if(i.result=a,this.$i)return this.Ji(e,n,o,a.size)})}).next(()=>i.result)}Ji(e,n,r,s){return r.documentReadCount<this.Ui?(sr()<=D.DEBUG&&T("QueryEngine","SDK will not create cache indexes for query:",un(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Ui,"documents"),m.resolve()):(sr()<=D.DEBUG&&T("QueryEngine","Query:",un(n),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.Wi*s?(sr()<=D.DEBUG&&T("QueryEngine","The SDK decides to create cache indexes for query:",un(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Be(n))):m.resolve())}zi(e,n){if(Yu(n))return m.resolve(null);let r=Be(n);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(n.limit!==null&&s===1&&(n=ws(n,null,"F"),r=Be(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=N(...i);return this.Gi.getDocuments(e,o).next(a=>this.indexManager.getMinOffset(e,r).next(c=>{const u=this.Yi(n,a);return this.Zi(n,u,o,c.readTime)?this.zi(e,ws(n,null,"F")):this.Xi(e,u,n,c)}))})))}ji(e,n,r,s){return Yu(n)||s.isEqual(S.min())?m.resolve(null):this.Gi.getDocuments(e,r).next(i=>{const o=this.Yi(n,i);return this.Zi(n,o,r,s)?m.resolve(null):(sr()<=D.DEBUG&&T("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),un(n)),this.Xi(e,o,n,hg(s,-1)).next(a=>a))})}Yi(e,n){let r=new re(Zu(e));return n.forEach((s,i)=>{Rs(e,i)&&(r=r.add(i))}),r}Zi(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}Hi(e,n,r){return sr()<=D.DEBUG&&T("QueryEngine","Using full collection scan to execute query:",un(n)),this.Gi.getDocumentsMatchingQuery(e,n,ft.min(),r)}Xi(e,n,r,s){return this.Gi.getDocumentsMatchingQuery(e,r,s).next(i=>(n.forEach(o=>{i=i.insert(o.key,o)}),i))}}/**
1376
+ */class kg{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return Df()?8:cm(Ee())>0?6:4}()}initialize(e,t){this.Ji=e,this.indexManager=t,this.Gi=!0}getDocumentsMatchingQuery(e,t,r,s){const i={result:null};return this.Yi(e,t).next(a=>{i.result=a}).next(()=>{if(!i.result)return this.Zi(e,t,s,r).next(a=>{i.result=a})}).next(()=>{if(i.result)return;const a=new Cg;return this.Xi(e,t,a).next(c=>{if(i.result=c,this.zi)return this.es(e,t,a,c.size)})}).next(()=>i.result)}es(e,t,r,s){return r.documentReadCount<this.ji?(Xn()<=W.DEBUG&&V("QueryEngine","SDK will not create cache indexes for query:",_n(t),"since it only creates cache indexes for collection contains","more than or equal to",this.ji,"documents"),k.resolve()):(Xn()<=W.DEBUG&&V("QueryEngine","Query:",_n(t),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.Hi*s?(Xn()<=W.DEBUG&&V("QueryEngine","The SDK decides to create cache indexes for query:",_n(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Ze(t))):k.resolve())}Yi(e,t){if(Fc(t))return k.resolve(null);let r=Ze(t);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(t.limit!==null&&s===1&&(t=cs(t,null,"F"),r=Ze(t)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const a=H(...i);return this.Ji.getDocuments(e,a).next(c=>this.indexManager.getMinOffset(e,r).next(l=>{const d=this.ts(t,c);return this.ns(t,d,a,l.readTime)?this.Yi(e,cs(t,null,"F")):this.rs(e,d,t,l)}))})))}Zi(e,t,r,s){return Fc(t)||s.isEqual(q.min())?k.resolve(null):this.Ji.getDocuments(e,r).next(i=>{const a=this.ts(t,i);return this.ns(t,a,r,s)?k.resolve(null):(Xn()<=W.DEBUG&&V("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),_n(t)),this.rs(e,a,t,rm(s,-1)).next(c=>c))})}ts(e,t){let r=new ge(qc(e));return t.forEach((s,i)=>{ls(e,i)&&(r=r.add(i))}),r}ns(e,t,r,s){if(e.limit===null)return!1;if(r.size!==t.size)return!0;const i=e.limitType==="F"?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}Xi(e,t,r){return Xn()<=W.DEBUG&&V("QueryEngine","Using full collection scan to execute query:",_n(t)),this.Ji.getDocumentsMatchingQuery(e,t,Rt.min(),r)}rs(e,t,r,s){return this.Ji.getDocumentsMatchingQuery(e,r,s).next(i=>(t.forEach(a=>{i=i.insert(a.key,a)}),i))}}/**
1348
1377
  * @license
1349
1378
  * Copyright 2020 Google LLC
1350
1379
  *
@@ -1359,7 +1388,7 @@
1359
1388
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1360
1389
  * See the License for the specific language governing permissions and
1361
1390
  * limitations under the License.
1362
- */class O_{constructor(e,n,r,s){this.persistence=e,this.es=n,this.serializer=s,this.ts=new j(L),this.ns=new ln(i=>So(i),Co),this.rs=new Map,this.ss=e.getRemoteDocumentCache(),this.qr=e.getTargetCache(),this.Kr=e.getBundleCache(),this.os(r)}os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new I_(this.ss,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.ss.setIndexManager(this.indexManager),this.es.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.ts))}}function V_(t,e,n,r){return new O_(t,e,n,r)}async function Nl(t,e){const n=P(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let s;return n.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,n.os(e),n.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],a=[];let c=N();for(const u of s){o.push(u.batchId);for(const l of u.mutations)c=c.add(l.key)}for(const u of i){a.push(u.batchId);for(const l of u.mutations)c=c.add(l.key)}return n.localDocuments.getDocuments(r,c).next(u=>({_s:u,removedBatchIds:o,addedBatchIds:a}))})})}function L_(t,e){const n=P(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=n.ss.newChangeBuffer({trackRemovals:!0});return function(a,c,u,l){const h=u.batch,d=h.keys();let f=m.resolve();return d.forEach(E=>{f=f.next(()=>l.getEntry(c,E)).next(v=>{const g=u.docVersions.get(E);F(g!==null),v.version.compareTo(g)<0&&(h.applyToRemoteDocument(v,u),v.isValidDocument()&&(v.setReadTime(u.commitVersion),l.addEntry(v)))})}),f.next(()=>a.mutationQueue.removeMutationBatch(c,h))}(n,r,e,i).next(()=>i.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(a){let c=N();for(let u=0;u<a.mutationResults.length;++u)a.mutationResults[u].transformResults.length>0&&(c=c.add(a.batch.mutations[u].key));return c}(e))).next(()=>n.localDocuments.getDocuments(r,s))})}function Dl(t){const e=P(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.qr.getLastRemoteSnapshotVersion(n))}function M_(t,e){const n=P(t),r=e.snapshotVersion;let s=n.ts;return n.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=n.ss.newChangeBuffer({trackRemovals:!0});s=n.ts;const a=[];e.targetChanges.forEach((l,h)=>{const d=s.get(h);if(!d)return;a.push(n.qr.removeMatchingKeys(i,l.removedDocuments,h).next(()=>n.qr.addMatchingKeys(i,l.addedDocuments,h)));let f=d.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(h)!==null?f=f.withResumeToken(ue.EMPTY_BYTE_STRING,S.min()).withLastLimboFreeSnapshotVersion(S.min()):l.resumeToken.approximateByteSize()>0&&(f=f.withResumeToken(l.resumeToken,r)),s=s.insert(h,f),function(v,g,k){return v.resumeToken.approximateByteSize()===0||g.snapshotVersion.toMicroseconds()-v.snapshotVersion.toMicroseconds()>=3e8?!0:k.addedDocuments.size+k.modifiedDocuments.size+k.removedDocuments.size>0}(d,f,l)&&a.push(n.qr.updateTargetData(i,f))});let c=Je(),u=N();if(e.documentUpdates.forEach(l=>{e.resolvedLimboDocuments.has(l)&&a.push(n.persistence.referenceDelegate.updateLimboDocument(i,l))}),a.push(U_(i,o,e.documentUpdates).next(l=>{c=l.us,u=l.cs})),!r.isEqual(S.min())){const l=n.qr.getLastRemoteSnapshotVersion(i).next(h=>n.qr.setTargetsMetadata(i,i.currentSequenceNumber,r));a.push(l)}return m.waitFor(a).next(()=>o.apply(i)).next(()=>n.localDocuments.getLocalViewOfDocuments(i,c,u)).next(()=>c)}).then(i=>(n.ts=s,i))}function U_(t,e,n){let r=N(),s=N();return n.forEach(i=>r=r.add(i)),e.getEntries(t,r).next(i=>{let o=Je();return n.forEach((a,c)=>{const u=i.get(a);c.isFoundDocument()!==u.isFoundDocument()&&(s=s.add(a)),c.isNoDocument()&&c.version.isEqual(S.min())?(e.removeEntry(a,c.readTime),o=o.insert(a,c)):!u.isValidDocument()||c.version.compareTo(u.version)>0||c.version.compareTo(u.version)===0&&u.hasPendingWrites?(e.addEntry(c),o=o.insert(a,c)):T("LocalStore","Ignoring outdated watch update for ",a,". Current version:",u.version," Watch version:",c.version)}),{us:o,cs:s}})}function x_(t,e){const n=P(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function F_(t,e){const n=P(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return n.qr.getTargetData(r,e).next(i=>i?(s=i,m.resolve(s)):n.qr.allocateTargetId(r).next(o=>(s=new _t(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.qr.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=n.ts.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.ts=n.ts.insert(r.targetId,r),n.ns.set(e,r.targetId)),r})}async function zo(t,e,n){const r=P(t),s=r.ts.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!ar(o))throw o;T("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.ts=r.ts.remove(e),r.ns.delete(s.target)}function Ol(t,e,n){const r=P(t);let s=S.min(),i=N();return r.persistence.runTransaction("Execute query","readwrite",o=>function(c,u,l){const h=P(c),d=h.ns.get(l);return d!==void 0?m.resolve(h.ts.get(d)):h.qr.getTargetData(u,l)}(r,o,Be(e)).next(a=>{if(a)return s=a.lastLimboFreeSnapshotVersion,r.qr.getMatchingKeysForTargetId(o,a.targetId).next(c=>{i=c})}).next(()=>r.es.getDocumentsMatchingQuery(o,e,n?s:S.min(),n?i:N())).next(a=>(B_(r,Ng(e),a),{documents:a,ls:i})))}function B_(t,e,n){let r=t.rs.get(e)||S.min();n.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),t.rs.set(e,r)}class Vl{constructor(){this.activeTargetIds=Ug()}ds(e){this.activeTargetIds=this.activeTargetIds.add(e)}As(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Es(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class q_{constructor(){this.eo=new Vl,this.no={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e){return this.eo.ds(e),this.no[e]||"not-current"}updateQueryState(e,n,r){this.no[e]=n}removeLocalQueryTarget(e){this.eo.As(e)}isLocalQueryTarget(e){return this.eo.activeTargetIds.has(e)}clearQueryState(e){delete this.no[e]}getAllActiveQueryTargets(){return this.eo.activeTargetIds}isActiveQueryTarget(e){return this.eo.activeTargetIds.has(e)}start(){return this.eo=new Vl,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
1391
+ */class Ng{constructor(e,t,r,s){this.persistence=e,this.ss=t,this.serializer=s,this.os=new re(K),this._s=new yn(i=>$i(i),zi),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(r)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new vg(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.os))}}function Dg(n,e,t,r){return new Ng(n,e,t,r)}async function Eu(n,e){const t=B(n);return await t.persistence.runTransaction("Handle user change","readonly",r=>{let s;return t.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,t.ls(e),t.mutationQueue.getAllMutationBatches(r))).next(i=>{const a=[],c=[];let l=H();for(const d of s){a.push(d.batchId);for(const p of d.mutations)l=l.add(p.key)}for(const d of i){c.push(d.batchId);for(const p of d.mutations)l=l.add(p.key)}return t.localDocuments.getDocuments(r,l).next(d=>({hs:d,removedBatchIds:a,addedBatchIds:c}))})})}function Og(n,e){const t=B(n);return t.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=t.cs.newChangeBuffer({trackRemovals:!0});return function(c,l,d,p){const g=d.batch,v=g.keys();let R=k.resolve();return v.forEach(C=>{R=R.next(()=>p.getEntry(l,C)).next(N=>{const S=d.docVersions.get(C);X(S!==null),N.version.compareTo(S)<0&&(g.applyToRemoteDocument(N,d),N.isValidDocument()&&(N.setReadTime(d.commitVersion),p.addEntry(N)))})}),R.next(()=>c.mutationQueue.removeMutationBatch(l,g))}(t,r,e,i).next(()=>i.apply(r)).next(()=>t.mutationQueue.performConsistencyCheck(r)).next(()=>t.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>t.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(c){let l=H();for(let d=0;d<c.mutationResults.length;++d)c.mutationResults[d].transformResults.length>0&&(l=l.add(c.batch.mutations[d].key));return l}(e))).next(()=>t.localDocuments.getDocuments(r,s))})}function Tu(n){const e=B(n);return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.Ur.getLastRemoteSnapshotVersion(t))}function Vg(n,e){const t=B(n),r=e.snapshotVersion;let s=t.os;return t.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const a=t.cs.newChangeBuffer({trackRemovals:!0});s=t.os;const c=[];e.targetChanges.forEach((p,g)=>{const v=s.get(g);if(!v)return;c.push(t.Ur.removeMatchingKeys(i,p.removedDocuments,g).next(()=>t.Ur.addMatchingKeys(i,p.addedDocuments,g)));let R=v.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(g)!==null?R=R.withResumeToken(_e.EMPTY_BYTE_STRING,q.min()).withLastLimboFreeSnapshotVersion(q.min()):p.resumeToken.approximateByteSize()>0&&(R=R.withResumeToken(p.resumeToken,r)),s=s.insert(g,R),function(N,S,U){return N.resumeToken.approximateByteSize()===0||S.snapshotVersion.toMicroseconds()-N.snapshotVersion.toMicroseconds()>=3e8?!0:U.addedDocuments.size+U.modifiedDocuments.size+U.removedDocuments.size>0}(v,R,p)&&c.push(t.Ur.updateTargetData(i,R))});let l=ht(),d=H();if(e.documentUpdates.forEach(p=>{e.resolvedLimboDocuments.has(p)&&c.push(t.persistence.referenceDelegate.updateLimboDocument(i,p))}),c.push(Lg(i,a,e.documentUpdates).next(p=>{l=p.Ps,d=p.Is})),!r.isEqual(q.min())){const p=t.Ur.getLastRemoteSnapshotVersion(i).next(g=>t.Ur.setTargetsMetadata(i,i.currentSequenceNumber,r));c.push(p)}return k.waitFor(c).next(()=>a.apply(i)).next(()=>t.localDocuments.getLocalViewOfDocuments(i,l,d)).next(()=>l)}).then(i=>(t.os=s,i))}function Lg(n,e,t){let r=H(),s=H();return t.forEach(i=>r=r.add(i)),e.getEntries(n,r).next(i=>{let a=ht();return t.forEach((c,l)=>{const d=i.get(c);l.isFoundDocument()!==d.isFoundDocument()&&(s=s.add(c)),l.isNoDocument()&&l.version.isEqual(q.min())?(e.removeEntry(c,l.readTime),a=a.insert(c,l)):!d.isValidDocument()||l.version.compareTo(d.version)>0||l.version.compareTo(d.version)===0&&d.hasPendingWrites?(e.addEntry(l),a=a.insert(c,l)):V("LocalStore","Ignoring outdated watch update for ",c,". Current version:",d.version," Watch version:",l.version)}),{Ps:a,Is:s}})}function Mg(n,e){const t=B(n);return t.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),t.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function Ug(n,e){const t=B(n);return t.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return t.Ur.getTargetData(r,e).next(i=>i?(s=i,k.resolve(s)):t.Ur.allocateTargetId(r).next(a=>(s=new Ct(e,a,"TargetPurposeListen",r.currentSequenceNumber),t.Ur.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=t.os.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(t.os=t.os.insert(r.targetId,r),t._s.set(e,r.targetId)),r})}async function oo(n,e,t){const r=B(n),s=r.os.get(e),i=t?"readwrite":"readwrite-primary";try{t||await r.persistence.runTransaction("Release target",i,a=>r.persistence.referenceDelegate.removeTarget(a,s))}catch(a){if(!er(a))throw a;V("LocalStore",`Failed to update sequence numbers for target ${e}: ${a}`)}r.os=r.os.remove(e),r._s.delete(s.target)}function wu(n,e,t){const r=B(n);let s=q.min(),i=H();return r.persistence.runTransaction("Execute query","readwrite",a=>function(l,d,p){const g=B(l),v=g._s.get(p);return v!==void 0?k.resolve(g.os.get(v)):g.Ur.getTargetData(d,p)}(r,a,Ze(e)).next(c=>{if(c)return s=c.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(a,c.targetId).next(l=>{i=l})}).next(()=>r.ss.getDocumentsMatchingQuery(a,e,t?s:q.min(),t?i:H())).next(c=>(xg(r,Pm(e),c),{documents:c,Ts:i})))}function xg(n,e,t){let r=n.us.get(e)||q.min();t.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),n.us.set(e,r)}class Iu{constructor(){this.activeTargetIds=Om()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Fg{constructor(){this.so=new Iu,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,t,r){this.oo[e]=t}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new Iu,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
1363
1392
  * @license
1364
1393
  * Copyright 2019 Google LLC
1365
1394
  *
@@ -1374,7 +1403,7 @@
1374
1403
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1375
1404
  * See the License for the specific language governing permissions and
1376
1405
  * limitations under the License.
1377
- */class $_{ro(e){}shutdown(){}}/**
1406
+ */class Bg{_o(e){}shutdown(){}}/**
1378
1407
  * @license
1379
1408
  * Copyright 2019 Google LLC
1380
1409
  *
@@ -1389,7 +1418,7 @@
1389
1418
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1390
1419
  * See the License for the specific language governing permissions and
1391
1420
  * limitations under the License.
1392
- */class Ll{constructor(){this.io=()=>this.so(),this.oo=()=>this._o(),this.ao=[],this.uo()}ro(e){this.ao.push(e)}shutdown(){window.removeEventListener("online",this.io),window.removeEventListener("offline",this.oo)}uo(){window.addEventListener("online",this.io),window.addEventListener("offline",this.oo)}so(){T("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ao)e(0)}_o(){T("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ao)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
1421
+ */class Au{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){V("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){V("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
1393
1422
  * @license
1394
1423
  * Copyright 2023 Google LLC
1395
1424
  *
@@ -1404,7 +1433,7 @@
1404
1433
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1405
1434
  * See the License for the specific language governing permissions and
1406
1435
  * limitations under the License.
1407
- */let Ls=null;function Ho(){return Ls===null?Ls=function(){return 268435456+Math.round(2147483648*Math.random())}():Ls++,"0x"+Ls.toString(16)}/**
1436
+ */let Es=null;function ao(){return Es===null?Es=function(){return 268435456+Math.round(2147483648*Math.random())}():Es++,"0x"+Es.toString(16)}/**
1408
1437
  * @license
1409
1438
  * Copyright 2020 Google LLC
1410
1439
  *
@@ -1419,7 +1448,7 @@
1419
1448
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1420
1449
  * See the License for the specific language governing permissions and
1421
1450
  * limitations under the License.
1422
- */const j_={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
1451
+ */const jg={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
1423
1452
  * @license
1424
1453
  * Copyright 2017 Google LLC
1425
1454
  *
@@ -1434,7 +1463,7 @@
1434
1463
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1435
1464
  * See the License for the specific language governing permissions and
1436
1465
  * limitations under the License.
1437
- */class z_{constructor(e){this.co=e.co,this.lo=e.lo}ho(e){this.Po=e}Io(e){this.To=e}onMessage(e){this.Eo=e}close(){this.lo()}send(e){this.co(e)}Ao(){this.Po()}Ro(e){this.To(e)}Vo(e){this.Eo(e)}}/**
1466
+ */class qg{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/**
1438
1467
  * @license
1439
1468
  * Copyright 2017 Google LLC
1440
1469
  *
@@ -1449,7 +1478,7 @@
1449
1478
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1450
1479
  * See the License for the specific language governing permissions and
1451
1480
  * limitations under the License.
1452
- */const he="WebChannelConnection";class H_ extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",s=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.mo=r+"://"+n.host,this.fo=`projects/${s}/databases/${i}`,this.po=this.databaseId.database==="(default)"?`project_id=${s}`:`project_id=${s}&database_id=${i}`}get yo(){return!1}wo(n,r,s,i,o){const a=Ho(),c=this.So(n,r);T("RestConnection",`Sending RPC '${n}' ${a}:`,c,s);const u={"google-cloud-resource-prefix":this.fo,"x-goog-request-params":this.po};return this.bo(u,i,o),this.Do(n,c,u,s).then(l=>(T("RestConnection",`Received RPC '${n}' ${a}: `,l),l),l=>{throw nn("RestConnection",`RPC '${n}' ${a} failed with error: `,l,"url: ",c,"request:",s),l})}Co(n,r,s,i,o,a){return this.wo(n,r,s,i,o)}bo(n,r,s){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+tn}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((i,o)=>n[o]=i),s&&s.headers.forEach((i,o)=>n[o]=i)}So(n,r){const s=j_[n];return`${this.mo}/v1/${r}:${s}`}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}Do(e,n,r,s){const i=Ho();return new Promise((o,a)=>{const c=new eg;c.setWithCredentials(!0),c.listenOnce(Xm.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case Eo.NO_ERROR:const l=c.getResponseJson();T(he,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(l)),o(l);break;case Eo.TIMEOUT:T(he,`RPC '${e}' ${i} timed out`),a(new _(p.DEADLINE_EXCEEDED,"Request time out"));break;case Eo.HTTP_ERROR:const h=c.getStatus();if(T(he,`RPC '${e}' ${i} failed with status:`,h,"response text:",c.getResponseText()),h>0){let d=c.getResponseJson();Array.isArray(d)&&(d=d[0]);const f=d==null?void 0:d.error;if(f&&f.status&&f.message){const E=function(g){const k=g.toLowerCase().replace(/_/g,"-");return Object.values(p).indexOf(k)>=0?k:p.UNKNOWN}(f.status);a(new _(E,f.message))}else a(new _(p.UNKNOWN,"Server responded with status "+c.getStatus()))}else a(new _(p.UNAVAILABLE,"Connection failed."));break;default:A()}}finally{T(he,`RPC '${e}' ${i} completed.`)}});const u=JSON.stringify(s);T(he,`RPC '${e}' ${i} sending request:`,s),c.send(n,"POST",u,r,15)})}vo(e,n,r){const s=Ho(),i=[this.mo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=Qm(),a=Ym(),c={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},u=this.longPollingOptions.timeoutSeconds;u!==void 0&&(c.longPollingTimeout=Math.round(1e3*u)),this.useFetchStreams&&(c.xmlHttpFactory=new Zm({})),this.bo(c.initMessageHeaders,n,r),c.encodeInitMessageHeaders=!0;const l=i.join("");T(he,`Creating RPC '${e}' stream ${s}: ${l}`,c);const h=o.createWebChannel(l,c);let d=!1,f=!1;const E=new z_({co:g=>{f?T(he,`Not sending because RPC '${e}' stream ${s} is closed:`,g):(d||(T(he,`Opening RPC '${e}' stream ${s} transport.`),h.open(),d=!0),T(he,`RPC '${e}' stream ${s} sending:`,g),h.send(g))},lo:()=>h.close()}),v=(g,k,O)=>{g.listen(k,b=>{try{O(b)}catch(U){setTimeout(()=>{throw U},0)}})};return v(h,ms.EventType.OPEN,()=>{f||T(he,`RPC '${e}' stream ${s} transport opened.`)}),v(h,ms.EventType.CLOSE,()=>{f||(f=!0,T(he,`RPC '${e}' stream ${s} transport closed`),E.Ro())}),v(h,ms.EventType.ERROR,g=>{f||(f=!0,nn(he,`RPC '${e}' stream ${s} transport errored:`,g),E.Ro(new _(p.UNAVAILABLE,"The operation could not be completed")))}),v(h,ms.EventType.MESSAGE,g=>{var k;if(!f){const O=g.data[0];F(!!O);const b=O,U=b.error||((k=b[0])===null||k===void 0?void 0:k.error);if(U){T(he,`RPC '${e}' stream ${s} received error:`,U);const me=U.status;let de=function(at){const _i=K[at];if(_i!==void 0)return ml(_i)}(me),ot=U.message;de===void 0&&(de=p.INTERNAL,ot="Unknown error status: "+me+" with message "+U.message),f=!0,E.Ro(new _(de,ot)),h.close()}else T(he,`RPC '${e}' stream ${s} received:`,O),E.Vo(O)}}),v(a,Jm.STAT_EVENT,g=>{g.stat===bu.PROXY?T(he,`RPC '${e}' stream ${s} detected buffering proxy`):g.stat===bu.NOPROXY&&T(he,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{E.Ao()},0),E}}function Wo(){return typeof document<"u"?document:null}/**
1481
+ */const Ie="WebChannelConnection";class $g extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const r=t.ssl?"https":"http",s=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+t.host,this.vo=`projects/${s}/databases/${i}`,this.Co=this.databaseId.database==="(default)"?`project_id=${s}`:`project_id=${s}&database_id=${i}`}get Fo(){return!1}Mo(t,r,s,i,a){const c=ao(),l=this.xo(t,r.toUriEncodedString());V("RestConnection",`Sending RPC '${t}' ${c}:`,l,s);const d={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(d,i,a),this.No(t,l,d,s).then(p=>(V("RestConnection",`Received RPC '${t}' ${c}: `,p),p),p=>{throw hn("RestConnection",`RPC '${t}' ${c} failed with error: `,p,"url: ",l,"request:",s),p})}Lo(t,r,s,i,a,c){return this.Mo(t,r,s,i,a)}Oo(t,r,s){t["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+ln}(),t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((i,a)=>t[a]=i),s&&s.headers.forEach((i,a)=>t[a]=i)}xo(t,r){const s=jg[t];return`${this.Do}/v1/${r}:${s}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,t,r,s){const i=ao();return new Promise((a,c)=>{const l=new dc;l.setWithCredentials(!0),l.listenOnce(pc.COMPLETE,()=>{try{switch(l.getLastErrorCode()){case Zr.NO_ERROR:const p=l.getResponseJson();V(Ie,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(p)),a(p);break;case Zr.TIMEOUT:V(Ie,`RPC '${e}' ${i} timed out`),c(new O(P.DEADLINE_EXCEEDED,"Request time out"));break;case Zr.HTTP_ERROR:const g=l.getStatus();if(V(Ie,`RPC '${e}' ${i} failed with status:`,g,"response text:",l.getResponseText()),g>0){let v=l.getResponseJson();Array.isArray(v)&&(v=v[0]);const R=v==null?void 0:v.error;if(R&&R.status&&R.message){const C=function(S){const U=S.toLowerCase().replace(/_/g,"-");return Object.values(P).indexOf(U)>=0?U:P.UNKNOWN}(R.status);c(new O(C,R.message))}else c(new O(P.UNKNOWN,"Server responded with status "+l.getStatus()))}else c(new O(P.UNAVAILABLE,"Connection failed."));break;default:F()}}finally{V(Ie,`RPC '${e}' ${i} completed.`)}});const d=JSON.stringify(s);V(Ie,`RPC '${e}' ${i} sending request:`,s),l.send(t,"POST",d,r,15)})}Bo(e,t,r){const s=ao(),i=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],a=_c(),c=gc(),l={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},d=this.longPollingOptions.timeoutSeconds;d!==void 0&&(l.longPollingTimeout=Math.round(1e3*d)),this.useFetchStreams&&(l.xmlHttpFactory=new fc({})),this.Oo(l.initMessageHeaders,t,r),l.encodeInitMessageHeaders=!0;const p=i.join("");V(Ie,`Creating RPC '${e}' stream ${s}: ${p}`,l);const g=a.createWebChannel(p,l);let v=!1,R=!1;const C=new qg({Io:S=>{R?V(Ie,`Not sending because RPC '${e}' stream ${s} is closed:`,S):(v||(V(Ie,`Opening RPC '${e}' stream ${s} transport.`),g.open(),v=!0),V(Ie,`RPC '${e}' stream ${s} sending:`,S),g.send(S))},To:()=>g.close()}),N=(S,U,$)=>{S.listen(U,x=>{try{$(x)}catch(z){setTimeout(()=>{throw z},0)}})};return N(g,Yn.EventType.OPEN,()=>{R||(V(Ie,`RPC '${e}' stream ${s} transport opened.`),C.yo())}),N(g,Yn.EventType.CLOSE,()=>{R||(R=!0,V(Ie,`RPC '${e}' stream ${s} transport closed`),C.So())}),N(g,Yn.EventType.ERROR,S=>{R||(R=!0,hn(Ie,`RPC '${e}' stream ${s} transport errored:`,S),C.So(new O(P.UNAVAILABLE,"The operation could not be completed")))}),N(g,Yn.EventType.MESSAGE,S=>{var U;if(!R){const $=S.data[0];X(!!$);const x=$,z=x.error||((U=x[0])===null||U===void 0?void 0:U.error);if(z){V(Ie,`RPC '${e}' stream ${s} received error:`,z);const le=z.status;let J=function(_){const E=ce[_];if(E!==void 0)return ru(E)}(le),T=z.message;J===void 0&&(J=P.INTERNAL,T="Unknown error status: "+le+" with message "+z.message),R=!0,C.So(new O(J,T)),g.close()}else V(Ie,`RPC '${e}' stream ${s} received:`,$),C.bo($)}}),N(c,mc.STAT_EVENT,S=>{S.stat===Li.PROXY?V(Ie,`RPC '${e}' stream ${s} detected buffering proxy`):S.stat===Li.NOPROXY&&V(Ie,`RPC '${e}' stream ${s} detected no buffering proxy`)}),setTimeout(()=>{C.wo()},0),C}}function co(){return typeof document<"u"?document:null}/**
1453
1482
  * @license
1454
1483
  * Copyright 2020 Google LLC
1455
1484
  *
@@ -1464,7 +1493,7 @@
1464
1493
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1465
1494
  * See the License for the specific language governing permissions and
1466
1495
  * limitations under the License.
1467
- */function Ms(t){return new r_(t,!0)}/**
1496
+ */function Ts(n){return new Zm(n,!0)}/**
1468
1497
  * @license
1469
1498
  * Copyright 2017 Google LLC
1470
1499
  *
@@ -1479,7 +1508,7 @@
1479
1508
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1480
1509
  * See the License for the specific language governing permissions and
1481
1510
  * limitations under the License.
1482
- */class Ml{constructor(e,n,r=1e3,s=1.5,i=6e4){this.si=e,this.timerId=n,this.Fo=r,this.Mo=s,this.xo=i,this.Oo=0,this.No=null,this.Bo=Date.now(),this.reset()}reset(){this.Oo=0}Lo(){this.Oo=this.xo}ko(e){this.cancel();const n=Math.floor(this.Oo+this.qo()),r=Math.max(0,Date.now()-this.Bo),s=Math.max(0,n-r);s>0&&T("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Oo} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.No=this.si.enqueueAfterDelay(this.timerId,s,()=>(this.Bo=Date.now(),e())),this.Oo*=this.Mo,this.Oo<this.Fo&&(this.Oo=this.Fo),this.Oo>this.xo&&(this.Oo=this.xo)}Qo(){this.No!==null&&(this.No.skipDelay(),this.No=null)}cancel(){this.No!==null&&(this.No.cancel(),this.No=null)}qo(){return(Math.random()-.5)*this.Oo}}/**
1511
+ */class Ru{constructor(e,t,r=1e3,s=1.5,i=6e4){this.ui=e,this.timerId=t,this.ko=r,this.qo=s,this.Qo=i,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const t=Math.floor(this.Ko+this.zo()),r=Math.max(0,Date.now()-this.Uo),s=Math.max(0,t-r);s>0&&V("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.Ko} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,s,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Ko<this.ko&&(this.Ko=this.ko),this.Ko>this.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/**
1483
1512
  * @license
1484
1513
  * Copyright 2017 Google LLC
1485
1514
  *
@@ -1494,7 +1523,7 @@
1494
1523
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1495
1524
  * See the License for the specific language governing permissions and
1496
1525
  * limitations under the License.
1497
- */class Ul{constructor(e,n,r,s,i,o,a,c){this.si=e,this.Ko=r,this.$o=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=a,this.listener=c,this.state=0,this.Uo=0,this.Wo=null,this.Go=null,this.stream=null,this.zo=new Ml(e,n)}jo(){return this.state===1||this.state===5||this.Ho()}Ho(){return this.state===2||this.state===3}start(){this.state!==4?this.auth():this.Jo()}async stop(){this.jo()&&await this.close(0)}Yo(){this.state=0,this.zo.reset()}Zo(){this.Ho()&&this.Wo===null&&(this.Wo=this.si.enqueueAfterDelay(this.Ko,6e4,()=>this.Xo()))}e_(e){this.t_(),this.stream.send(e)}async Xo(){if(this.Ho())return this.close(0)}t_(){this.Wo&&(this.Wo.cancel(),this.Wo=null)}n_(){this.Go&&(this.Go.cancel(),this.Go=null)}async close(e,n){this.t_(),this.n_(),this.zo.cancel(),this.Uo++,e!==4?this.zo.reset():n&&n.code===p.RESOURCE_EXHAUSTED?(Xe(n.toString()),Xe("Using maximum backoff delay to prevent overloading the backend."),this.zo.Lo()):n&&n.code===p.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.r_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.Io(n)}r_(){}auth(){this.state=1;const e=this.i_(this.Uo),n=this.Uo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.Uo===n&&this.s_(r,s)},r=>{e(()=>{const s=new _(p.UNKNOWN,"Fetching auth token failed: "+r.message);return this.o_(s)})})}s_(e,n){const r=this.i_(this.Uo);this.stream=this.__(e,n),this.stream.ho(()=>{r(()=>(this.state=2,this.Go=this.si.enqueueAfterDelay(this.$o,1e4,()=>(this.Ho()&&(this.state=3),Promise.resolve())),this.listener.ho()))}),this.stream.Io(s=>{r(()=>this.o_(s))}),this.stream.onMessage(s=>{r(()=>this.onMessage(s))})}Jo(){this.state=5,this.zo.ko(async()=>{this.state=0,this.start()})}o_(e){return T("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}i_(e){return n=>{this.si.enqueueAndForget(()=>this.Uo===e?n():(T("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class W_ extends Ul{constructor(e,n,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}__(e,n){return this.connection.vo("Listen",e,n)}onMessage(e){this.zo.reset();const n=o_(this.serializer,e),r=function(i){if(!("targetChange"in i))return S.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?S.min():o.readTime?qe(o.readTime):S.min()}(e);return this.listener.a_(n,r)}u_(e){const n={};n.database=Bo(this.serializer),n.addTarget=function(i,o){let a;const c=o.target;if(a=bo(c)?{documents:u_(i,c)}:{query:Sl(i,c)},a.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){a.resumeToken=wl(i,o.resumeToken);const u=Lo(i,o.expectedCount);u!==null&&(a.expectedCount=u)}else if(o.snapshotVersion.compareTo(S.min())>0){a.readTime=Vs(i,o.snapshotVersion.toTimestamp());const u=Lo(i,o.expectedCount);u!==null&&(a.expectedCount=u)}return a}(this.serializer,e);const r=h_(this.serializer,e);r&&(n.labels=r),this.e_(n)}c_(e){const n={};n.database=Bo(this.serializer),n.removeTarget=e,this.e_(n)}}class G_ extends Ul{constructor(e,n,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i,this.l_=!1}get h_(){return this.l_}start(){this.l_=!1,this.lastStreamToken=void 0,super.start()}r_(){this.l_&&this.P_([])}__(e,n){return this.connection.vo("Write",e,n)}onMessage(e){if(F(!!e.streamToken),this.lastStreamToken=e.streamToken,this.l_){this.zo.reset();const n=c_(e.writeResults,e.commitTime),r=qe(e.commitTime);return this.listener.I_(r,n)}return F(!e.writeResults||e.writeResults.length===0),this.l_=!0,this.listener.T_()}E_(){const e={};e.database=Bo(this.serializer),this.e_(e)}P_(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>a_(this.serializer,r))};this.e_(n)}}/**
1526
+ */class bu{constructor(e,t,r,s,i,a,c,l){this.ui=e,this.Ho=r,this.Jo=s,this.connection=i,this.authCredentialsProvider=a,this.appCheckCredentialsProvider=c,this.listener=l,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new Ru(e,t)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,t){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():t&&t.code===P.RESOURCE_EXHAUSTED?(lt(t.toString()),lt("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):t&&t.code===P.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(t)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),t=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.Yo===t&&this.P_(r,s)},r=>{e(()=>{const s=new O(P.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(s)})})}P_(e,t){const r=this.h_(this.Yo);this.stream=this.T_(e,t),this.stream.Eo(()=>{r(()=>this.listener.Eo())}),this.stream.Ro(()=>{r(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(s=>{r(()=>this.I_(s))}),this.stream.onMessage(s=>{r(()=>++this.e_==1?this.E_(s):this.onNext(s))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return V("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return t=>{this.ui.enqueueAndForget(()=>this.Yo===e?t():(V("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class zg extends bu{constructor(e,t,r,s,i,a){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}T_(e,t){return this.connection.Bo("Listen",e,t)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const t=ng(this.serializer,e),r=function(i){if(!("targetChange"in i))return q.min();const a=i.targetChange;return a.targetIds&&a.targetIds.length?q.min():a.readTime?et(a.readTime):q.min()}(e);return this.listener.d_(t,r)}A_(e){const t={};t.database=no(this.serializer),t.addTarget=function(i,a){let c;const l=a.target;if(c=Hi(l)?{documents:ig(i,l)}:{query:gu(i,l)._t},c.targetId=a.targetId,a.resumeToken.approximateByteSize()>0){c.resumeToken=hu(i,a.resumeToken);const d=Xi(i,a.expectedCount);d!==null&&(c.expectedCount=d)}else if(a.snapshotVersion.compareTo(q.min())>0){c.readTime=vs(i,a.snapshotVersion.toTimestamp());const d=Xi(i,a.expectedCount);d!==null&&(c.expectedCount=d)}return c}(this.serializer,e);const r=cg(this.serializer,e);r&&(t.labels=r),this.a_(t)}R_(e){const t={};t.database=no(this.serializer),t.removeTarget=e,this.a_(t)}}class Hg extends bu{constructor(e,t,r,s,i,a){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,s,a),this.serializer=i}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,t){return this.connection.Bo("Write",e,t)}E_(e){return X(!!e.streamToken),this.lastStreamToken=e.streamToken,X(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){X(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const t=sg(e.writeResults,e.commitTime),r=et(e.commitTime);return this.listener.g_(r,t)}p_(){const e={};e.database=no(this.serializer),this.a_(e)}m_(e){const t={streamToken:this.lastStreamToken,writes:e.map(r=>rg(this.serializer,r))};this.a_(t)}}/**
1498
1527
  * @license
1499
1528
  * Copyright 2017 Google LLC
1500
1529
  *
@@ -1509,8 +1538,8 @@
1509
1538
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1510
1539
  * See the License for the specific language governing permissions and
1511
1540
  * limitations under the License.
1512
- */class K_ extends class{}{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.d_=!1}A_(){if(this.d_)throw new _(p.FAILED_PRECONDITION,"The client has already been terminated.")}wo(e,n,r){return this.A_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,i])=>this.connection.wo(e,n,r,s,i)).catch(s=>{throw s.name==="FirebaseError"?(s.code===p.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new _(p.UNKNOWN,s.toString())})}Co(e,n,r,s){return this.A_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Co(e,n,r,i,o,s)).catch(i=>{throw i.name==="FirebaseError"?(i.code===p.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new _(p.UNKNOWN,i.toString())})}terminate(){this.d_=!0}}async function Q_(t,e,n){var r;const s=P(t),{request:i,R_:o}=function(h,d,f){const E=Sl(h,d),v={},g=[];let k=0;return f.forEach(O=>{const b="aggregate_"+k++;v[b]=O.alias,O.aggregateType==="count"?g.push({alias:b,count:{}}):O.aggregateType==="avg"?g.push({alias:b,avg:{field:gt(O.fieldPath)}}):O.aggregateType==="sum"&&g.push({alias:b,sum:{field:gt(O.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:g,structuredQuery:E.structuredQuery},parent:E.parent},R_:v}}(s.serializer,function(h){const d=P(h);return d.Pe||(d.Pe=Xu(d,h.explicitOrderBy)),d.Pe}(e),n),a=i.parent;s.connection.yo||delete i.parent;const c=(await s.Co("RunAggregationQuery",a,i,1)).filter(l=>!!l.result);F(c.length===1);const u=(r=c[0].result)===null||r===void 0?void 0:r.aggregateFields;return Object.keys(u).reduce((l,h)=>(l[o[h]]=u[h],l),{})}class Y_{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.V_=0,this.m_=null,this.f_=!0}g_(){this.V_===0&&(this.p_("Unknown"),this.m_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.m_=null,this.y_("Backend didn't respond within 10 seconds."),this.p_("Offline"),Promise.resolve())))}w_(e){this.state==="Online"?this.p_("Unknown"):(this.V_++,this.V_>=1&&(this.S_(),this.y_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.p_("Offline")))}set(e){this.S_(),this.V_=0,e==="Online"&&(this.f_=!1),this.p_(e)}p_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}y_(e){const n=`Could not reach Cloud Firestore backend. ${e}
1513
- This 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.f_?(Xe(n),this.f_=!1):T("OnlineStateTracker",n)}S_(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}}/**
1541
+ */class Wg extends class{}{constructor(e,t,r,s){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=s,this.y_=!1}w_(){if(this.y_)throw new O(P.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,t,r,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,a])=>this.connection.Mo(e,Zi(t,r),s,i,a)).catch(i=>{throw i.name==="FirebaseError"?(i.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new O(P.UNKNOWN,i.toString())})}Lo(e,t,r,s,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([a,c])=>this.connection.Lo(e,Zi(t,r),s,a,c,i)).catch(a=>{throw a.name==="FirebaseError"?(a.code===P.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),a):new O(P.UNKNOWN,a.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class Gg{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const t=`Could not reach Cloud Firestore backend. ${e}
1542
+ This 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.D_?(lt(t),this.D_=!1):V("OnlineStateTracker",t)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
1514
1543
  * @license
1515
1544
  * Copyright 2017 Google LLC
1516
1545
  *
@@ -1525,7 +1554,7 @@ This typically indicates that your device does not have a healthy Internet conne
1525
1554
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1526
1555
  * See the License for the specific language governing permissions and
1527
1556
  * limitations under the License.
1528
- */class X_{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.b_=[],this.D_=new Map,this.C_=new Set,this.v_=[],this.F_=i,this.F_.ro(o=>{r.enqueueAndForget(async()=>{Ft(this)&&(T("RemoteStore","Restarting streams for network reachability change."),await async function(c){const u=P(c);u.C_.add(4),await Tr(u),u.M_.set("Unknown"),u.C_.delete(4),await Us(u)}(this))})}),this.M_=new Y_(r,s)}}async function Us(t){if(Ft(t))for(const e of t.v_)await e(!0)}async function Tr(t){for(const e of t.v_)await e(!1)}function xl(t,e){const n=P(t);n.D_.has(e.targetId)||(n.D_.set(e.targetId,e),Qo(n)?Ko(n):fn(n).Ho()&&Go(n,e))}function Fl(t,e){const n=P(t),r=fn(n);n.D_.delete(e),r.Ho()&&Bl(n,e),n.D_.size===0&&(r.Ho()?r.Zo():Ft(n)&&n.M_.set("Unknown"))}function Go(t,e){if(t.x_.Oe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(S.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}fn(t).u_(e)}function Bl(t,e){t.x_.Oe(e),fn(t).c_(e)}function Ko(t){t.x_=new Zg({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),_t:e=>t.D_.get(e)||null,nt:()=>t.datastore.serializer.databaseId}),fn(t).start(),t.M_.g_()}function Qo(t){return Ft(t)&&!fn(t).jo()&&t.D_.size>0}function Ft(t){return P(t).C_.size===0}function ql(t){t.x_=void 0}async function J_(t){t.D_.forEach((e,n)=>{Go(t,e)})}async function Z_(t,e){ql(t),Qo(t)?(t.M_.w_(e),Ko(t)):t.M_.set("Unknown")}async function ey(t,e,n){if(t.M_.set("Online"),e instanceof El&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const a of i.targetIds)s.D_.has(a)&&(await s.remoteSyncer.rejectListen(a,o),s.D_.delete(a),s.x_.removeTarget(a))}(t,e)}catch(r){T("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await xs(t,r)}else if(e instanceof Os?t.x_.$e(e):e instanceof yl?t.x_.Je(e):t.x_.Ge(e),!n.isEqual(S.min()))try{const r=await Dl(t.localStore);n.compareTo(r)>=0&&await function(i,o){const a=i.x_.it(o);return a.targetChanges.forEach((c,u)=>{if(c.resumeToken.approximateByteSize()>0){const l=i.D_.get(u);l&&i.D_.set(u,l.withResumeToken(c.resumeToken,o))}}),a.targetMismatches.forEach((c,u)=>{const l=i.D_.get(c);if(!l)return;i.D_.set(c,l.withResumeToken(ue.EMPTY_BYTE_STRING,l.snapshotVersion)),Bl(i,c);const h=new _t(l.target,c,u,l.sequenceNumber);Go(i,h)}),i.remoteSyncer.applyRemoteEvent(a)}(t,n)}catch(r){T("RemoteStore","Failed to raise snapshot:",r),await xs(t,r)}}async function xs(t,e,n){if(!ar(e))throw e;t.C_.add(1),await Tr(t),t.M_.set("Offline"),n||(n=()=>Dl(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{T("RemoteStore","Retrying IndexedDB access"),await n(),t.C_.delete(1),await Us(t)})}function $l(t,e){return e().catch(n=>xs(t,n,e))}async function Fs(t){const e=P(t),n=yt(e);let r=e.b_.length>0?e.b_[e.b_.length-1].batchId:-1;for(;ty(e);)try{const s=await x_(e.localStore,r);if(s===null){e.b_.length===0&&n.Zo();break}r=s.batchId,ny(e,s)}catch(s){await xs(e,s)}jl(e)&&zl(e)}function ty(t){return Ft(t)&&t.b_.length<10}function ny(t,e){t.b_.push(e);const n=yt(t);n.Ho()&&n.h_&&n.P_(e.mutations)}function jl(t){return Ft(t)&&!yt(t).jo()&&t.b_.length>0}function zl(t){yt(t).start()}async function ry(t){yt(t).E_()}async function sy(t){const e=yt(t);for(const n of t.b_)e.P_(n.mutations)}async function iy(t,e,n){const r=t.b_.shift(),s=Oo.from(r,e,n);await $l(t,()=>t.remoteSyncer.applySuccessfulWrite(s)),await Fs(t)}async function oy(t,e){e&&yt(t).h_&&await async function(r,s){if(function(o){return Yg(o)&&o!==p.ABORTED}(s.code)){const i=r.b_.shift();yt(r).Yo(),await $l(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await Fs(r)}}(t,e),jl(t)&&zl(t)}async function Hl(t,e){const n=P(t);n.asyncQueue.verifyOperationInProgress(),T("RemoteStore","RemoteStore received new credentials");const r=Ft(n);n.C_.add(3),await Tr(n),r&&n.M_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.C_.delete(3),await Us(n)}async function ay(t,e){const n=P(t);e?(n.C_.delete(2),await Us(n)):e||(n.C_.add(2),await Tr(n),n.M_.set("Unknown"))}function fn(t){return t.O_||(t.O_=function(n,r,s){const i=P(n);return i.A_(),new W_(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{ho:J_.bind(null,t),Io:Z_.bind(null,t),a_:ey.bind(null,t)}),t.v_.push(async e=>{e?(t.O_.Yo(),Qo(t)?Ko(t):t.M_.set("Unknown")):(await t.O_.stop(),ql(t))})),t.O_}function yt(t){return t.N_||(t.N_=function(n,r,s){const i=P(n);return i.A_(),new G_(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{ho:ry.bind(null,t),Io:oy.bind(null,t),T_:sy.bind(null,t),I_:iy.bind(null,t)}),t.v_.push(async e=>{e?(t.N_.Yo(),await Fs(t)):(await t.N_.stop(),t.b_.length>0&&(T("RemoteStore",`Stopping write stream with ${t.b_.length} pending writes`),t.b_=[]))})),t.N_}/**
1557
+ */class Kg{constructor(e,t,r,s,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=i,this.k_._o(a=>{r.enqueueAndForget(async()=>{Yt(this)&&(V("RemoteStore","Restarting streams for network reachability change."),await async function(l){const d=B(l);d.L_.add(4),await pr(d),d.q_.set("Unknown"),d.L_.delete(4),await ws(d)}(this))})}),this.q_=new Gg(r,s)}}async function ws(n){if(Yt(n))for(const e of n.B_)await e(!0)}async function pr(n){for(const e of n.B_)await e(!1)}function Pu(n,e){const t=B(n);t.N_.has(e.targetId)||(t.N_.set(e.targetId,e),fo(t)?ho(t):Tn(t).r_()&&lo(t,e))}function uo(n,e){const t=B(n),r=Tn(t);t.N_.delete(e),r.r_()&&Su(t,e),t.N_.size===0&&(r.r_()?r.o_():Yt(t)&&t.q_.set("Unknown"))}function lo(n,e){if(n.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(q.min())>0){const t=n.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(t)}Tn(n).A_(e)}function Su(n,e){n.Q_.xe(e),Tn(n).R_(e)}function ho(n){n.Q_=new Qm({getRemoteKeysForTarget:e=>n.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>n.N_.get(e)||null,tt:()=>n.datastore.serializer.databaseId}),Tn(n).start(),n.q_.v_()}function fo(n){return Yt(n)&&!Tn(n).n_()&&n.N_.size>0}function Yt(n){return B(n).L_.size===0}function Cu(n){n.Q_=void 0}async function Qg(n){n.q_.set("Online")}async function Yg(n){n.N_.forEach((e,t)=>{lo(n,e)})}async function Xg(n,e){Cu(n),fo(n)?(n.q_.M_(e),ho(n)):n.q_.set("Unknown")}async function Jg(n,e,t){if(n.q_.set("Online"),e instanceof au&&e.state===2&&e.cause)try{await async function(s,i){const a=i.cause;for(const c of i.targetIds)s.N_.has(c)&&(await s.remoteSyncer.rejectListen(c,a),s.N_.delete(c),s.Q_.removeTarget(c))}(n,e)}catch(r){V("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await Is(n,r)}else if(e instanceof ys?n.Q_.Ke(e):e instanceof ou?n.Q_.He(e):n.Q_.We(e),!t.isEqual(q.min()))try{const r=await Tu(n.localStore);t.compareTo(r)>=0&&await function(i,a){const c=i.Q_.rt(a);return c.targetChanges.forEach((l,d)=>{if(l.resumeToken.approximateByteSize()>0){const p=i.N_.get(d);p&&i.N_.set(d,p.withResumeToken(l.resumeToken,a))}}),c.targetMismatches.forEach((l,d)=>{const p=i.N_.get(l);if(!p)return;i.N_.set(l,p.withResumeToken(_e.EMPTY_BYTE_STRING,p.snapshotVersion)),Su(i,l);const g=new Ct(p.target,l,d,p.sequenceNumber);lo(i,g)}),i.remoteSyncer.applyRemoteEvent(c)}(n,t)}catch(r){V("RemoteStore","Failed to raise snapshot:",r),await Is(n,r)}}async function Is(n,e,t){if(!er(e))throw e;n.L_.add(1),await pr(n),n.q_.set("Offline"),t||(t=()=>Tu(n.localStore)),n.asyncQueue.enqueueRetryable(async()=>{V("RemoteStore","Retrying IndexedDB access"),await t(),n.L_.delete(1),await ws(n)})}function ku(n,e){return e().catch(t=>Is(n,t,e))}async function As(n){const e=B(n),t=kt(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;Zg(e);)try{const s=await Mg(e.localStore,r);if(s===null){e.O_.length===0&&t.o_();break}r=s.batchId,e_(e,s)}catch(s){await Is(e,s)}Nu(e)&&Du(e)}function Zg(n){return Yt(n)&&n.O_.length<10}function e_(n,e){n.O_.push(e);const t=kt(n);t.r_()&&t.V_&&t.m_(e.mutations)}function Nu(n){return Yt(n)&&!kt(n).n_()&&n.O_.length>0}function Du(n){kt(n).start()}async function t_(n){kt(n).p_()}async function n_(n){const e=kt(n);for(const t of n.O_)e.m_(t.mutations)}async function r_(n,e,t){const r=n.O_.shift(),s=Qi.from(r,e,t);await ku(n,()=>n.remoteSyncer.applySuccessfulWrite(s)),await As(n)}async function s_(n,e){e&&kt(n).V_&&await async function(r,s){if(function(a){return Wm(a)&&a!==P.ABORTED}(s.code)){const i=r.O_.shift();kt(r).s_(),await ku(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await As(r)}}(n,e),Nu(n)&&Du(n)}async function Ou(n,e){const t=B(n);t.asyncQueue.verifyOperationInProgress(),V("RemoteStore","RemoteStore received new credentials");const r=Yt(t);t.L_.add(3),await pr(t),r&&t.q_.set("Unknown"),await t.remoteSyncer.handleCredentialChange(e),t.L_.delete(3),await ws(t)}async function i_(n,e){const t=B(n);e?(t.L_.delete(2),await ws(t)):e||(t.L_.add(2),await pr(t),t.q_.set("Unknown"))}function Tn(n){return n.K_||(n.K_=function(t,r,s){const i=B(t);return i.w_(),new zg(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{Eo:Qg.bind(null,n),Ro:Yg.bind(null,n),mo:Xg.bind(null,n),d_:Jg.bind(null,n)}),n.B_.push(async e=>{e?(n.K_.s_(),fo(n)?ho(n):n.q_.set("Unknown")):(await n.K_.stop(),Cu(n))})),n.K_}function kt(n){return n.U_||(n.U_=function(t,r,s){const i=B(t);return i.w_(),new Hg(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(n.datastore,n.asyncQueue,{Eo:()=>Promise.resolve(),Ro:t_.bind(null,n),mo:s_.bind(null,n),f_:n_.bind(null,n),g_:r_.bind(null,n)}),n.B_.push(async e=>{e?(n.U_.s_(),await As(n)):(await n.U_.stop(),n.O_.length>0&&(V("RemoteStore",`Stopping write stream with ${n.O_.length} pending writes`),n.O_=[]))})),n.U_}/**
1529
1558
  * @license
1530
1559
  * Copyright 2017 Google LLC
1531
1560
  *
@@ -1540,7 +1569,7 @@ This typically indicates that your device does not have a healthy Internet conne
1540
1569
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1541
1570
  * See the License for the specific language governing permissions and
1542
1571
  * limitations under the License.
1543
- */class Yo{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new xe,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,s,i){const o=Date.now()+r,a=new Yo(e,n,o,s,i);return a.start(r),a}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new _(p.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Xo(t,e){if(Xe("AsyncQueue",`${e}: ${t}`),ar(t))return new _(p.UNAVAILABLE,`${e}: ${t}`);throw t}/**
1572
+ */class po{constructor(e,t,r,s,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Xe,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(a=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,r,s,i){const a=Date.now()+r,c=new po(e,t,a,s,i);return c.start(r),c}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new O(P.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>this.timerHandle!==null?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){this.timerHandle!==null&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function mo(n,e){if(lt("AsyncQueue",`${e}: ${n}`),er(n))return new O(P.UNAVAILABLE,`${e}: ${n}`);throw n}/**
1544
1573
  * @license
1545
1574
  * Copyright 2017 Google LLC
1546
1575
  *
@@ -1555,10 +1584,10 @@ This typically indicates that your device does not have a healthy Internet conne
1555
1584
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1556
1585
  * See the License for the specific language governing permissions and
1557
1586
  * limitations under the License.
1558
- */class pn{constructor(e){this.comparator=e?(n,r)=>e(n,r)||I.comparator(n.key,r.key):(n,r)=>I.comparator(n.key,r.key),this.keyedMap=fr(),this.sortedSet=new j(this.comparator)}static emptySet(e){return new pn(e.comparator)}has(e){return this.keyedMap.get(e)!=null}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 n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof pn)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
1587
+ */class wn{constructor(e){this.comparator=e?(t,r)=>e(t,r)||L.comparator(t.key,r.key):(t,r)=>L.comparator(t.key,r.key),this.keyedMap=or(),this.sortedSet=new re(this.comparator)}static emptySet(e){return new wn(e.comparator)}has(e){return this.keyedMap.get(e)!=null}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,r)=>(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 wn)||this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){const s=t.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
1559
1588
  `+e.join(`
1560
1589
  `)+`
1561
- )`}copy(e,n){const r=new pn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
1590
+ )`}copy(e,t){const r=new wn;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}/**
1562
1591
  * @license
1563
1592
  * Copyright 2017 Google LLC
1564
1593
  *
@@ -1573,7 +1602,7 @@ This typically indicates that your device does not have a healthy Internet conne
1573
1602
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1574
1603
  * See the License for the specific language governing permissions and
1575
1604
  * limitations under the License.
1576
- */class Wl{constructor(){this.B_=new j(I.comparator)}track(e){const n=e.doc.key,r=this.B_.get(n);r?e.type!==0&&r.type===3?this.B_=this.B_.insert(n,e):e.type===3&&r.type!==1?this.B_=this.B_.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.B_=this.B_.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.B_=this.B_.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.B_=this.B_.remove(n):e.type===1&&r.type===2?this.B_=this.B_.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.B_=this.B_.insert(n,{type:2,doc:e.doc}):A():this.B_=this.B_.insert(n,e)}L_(){const e=[];return this.B_.inorderTraversal((n,r)=>{e.push(r)}),e}}class mn{constructor(e,n,r,s,i,o,a,c,u){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=a,this.excludesMetadataChanges=c,this.hasCachedResults=u}static fromInitialDocuments(e,n,r,s,i){const o=[];return n.forEach(a=>{o.push({type:0,doc:a})}),new mn(e,n,pn.emptySet(n),o,r,s,!0,!1,i)}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)&&As(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let s=0;s<n.length;s++)if(n[s].type!==r[s].type||!n[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
1605
+ */class Vu{constructor(){this.W_=new re(L.comparator)}track(e){const t=e.doc.key,r=this.W_.get(t);r?e.type!==0&&r.type===3?this.W_=this.W_.insert(t,e):e.type===3&&r.type!==1?this.W_=this.W_.insert(t,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.W_=this.W_.insert(t,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.W_=this.W_.remove(t):e.type===1&&r.type===2?this.W_=this.W_.insert(t,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.W_=this.W_.insert(t,{type:2,doc:e.doc}):F():this.W_=this.W_.insert(t,e)}G_(){const e=[];return this.W_.inorderTraversal((t,r)=>{e.push(r)}),e}}class In{constructor(e,t,r,s,i,a,c,l,d){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=a,this.syncStateChanged=c,this.excludesMetadataChanges=l,this.hasCachedResults=d}static fromInitialDocuments(e,t,r,s,i){const a=[];return t.forEach(c=>{a.push({type:0,doc:c})}),new In(e,t,wn.emptySet(t),a,r,s,!0,!1,i)}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)&&us(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++)if(t[s].type!==r[s].type||!t[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
1577
1606
  * @license
1578
1607
  * Copyright 2017 Google LLC
1579
1608
  *
@@ -1588,7 +1617,7 @@ This typically indicates that your device does not have a healthy Internet conne
1588
1617
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1589
1618
  * See the License for the specific language governing permissions and
1590
1619
  * limitations under the License.
1591
- */class cy{constructor(){this.k_=void 0,this.listeners=[]}}class uy{constructor(){this.queries=new ln(e=>Ju(e),As),this.onlineState="Unknown",this.q_=new Set}}async function Gl(t,e){const n=P(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new cy),s)try{i.k_=await n.onListen(r)}catch(o){const a=Xo(o,`Initialization of query '${un(e.query)}' failed`);return void e.onError(a)}n.queries.set(r,i),i.listeners.push(e),e.Q_(n.onlineState),i.k_&&e.K_(i.k_)&&Jo(n)}async function Kl(t,e){const n=P(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const o=i.listeners.indexOf(e);o>=0&&(i.listeners.splice(o,1),s=i.listeners.length===0)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function ly(t,e){const n=P(t);let r=!1;for(const s of e){const i=s.query,o=n.queries.get(i);if(o){for(const a of o.listeners)a.K_(s)&&(r=!0);o.k_=s}}r&&Jo(n)}function hy(t,e,n){const r=P(t),s=r.queries.get(e);if(s)for(const i of s.listeners)i.onError(n);r.queries.delete(e)}function Jo(t){t.q_.forEach(e=>{e.next()})}class Ql{constructor(e,n,r){this.query=e,this.U_=n,this.W_=!1,this.G_=null,this.onlineState="Unknown",this.options=r||{}}K_(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new mn(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.W_?this.z_(e)&&(this.U_.next(e),n=!0):this.j_(e,this.onlineState)&&(this.H_(e),n=!0),this.G_=e,n}onError(e){this.U_.error(e)}Q_(e){this.onlineState=e;let n=!1;return this.G_&&!this.W_&&this.j_(this.G_,e)&&(this.H_(this.G_),n=!0),n}j_(e,n){if(!e.fromCache)return!0;const r=n!=="Offline";return(!this.options.J_||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}z_(e){if(e.docChanges.length>0)return!0;const n=this.G_&&this.G_.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}H_(e){e=mn.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.W_=!0,this.U_.next(e)}}/**
1620
+ */class o_{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class a_{constructor(){this.queries=Lu(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(t,r){const s=B(t),i=s.queries;s.queries=Lu(),i.forEach((a,c)=>{for(const l of c.j_)l.onError(r)})})(this,new O(P.ABORTED,"Firestore shutting down"))}}function Lu(){return new yn(n=>jc(n),us)}async function go(n,e){const t=B(n);let r=3;const s=e.query;let i=t.queries.get(s);i?!i.H_()&&e.J_()&&(r=2):(i=new o_,r=e.J_()?0:1);try{switch(r){case 0:i.z_=await t.onListen(s,!0);break;case 1:i.z_=await t.onListen(s,!1);break;case 2:await t.onFirstRemoteStoreListen(s)}}catch(a){const c=mo(a,`Initialization of query '${_n(e.query)}' failed`);return void e.onError(c)}t.queries.set(s,i),i.j_.push(e),e.Z_(t.onlineState),i.z_&&e.X_(i.z_)&&yo(t)}async function _o(n,e){const t=B(n),r=e.query;let s=3;const i=t.queries.get(r);if(i){const a=i.j_.indexOf(e);a>=0&&(i.j_.splice(a,1),i.j_.length===0?s=e.J_()?0:1:!i.H_()&&e.J_()&&(s=2))}switch(s){case 0:return t.queries.delete(r),t.onUnlisten(r,!0);case 1:return t.queries.delete(r),t.onUnlisten(r,!1);case 2:return t.onLastRemoteStoreUnlisten(r);default:return}}function c_(n,e){const t=B(n);let r=!1;for(const s of e){const i=s.query,a=t.queries.get(i);if(a){for(const c of a.j_)c.X_(s)&&(r=!0);a.z_=s}}r&&yo(t)}function u_(n,e,t){const r=B(n),s=r.queries.get(e);if(s)for(const i of s.j_)i.onError(t);r.queries.delete(e)}function yo(n){n.Y_.forEach(e=>{e.next()})}var vo,Mu;(Mu=vo||(vo={})).ea="default",Mu.Cache="cache";class Eo{constructor(e,t,r){this.query=e,this.ta=t,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=r||{}}X_(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new In(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.na?this.ia(e)&&(this.ta.next(e),t=!0):this.sa(e,this.onlineState)&&(this.oa(e),t=!0),this.ra=e,t}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let t=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),t=!0),t}sa(e,t){if(!e.fromCache||!this.J_())return!0;const r=t!=="Offline";return(!this.options._a||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||t==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const t=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&this.options.includeMetadataChanges===!0}oa(e){e=In.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==vo.Cache}}/**
1592
1621
  * @license
1593
1622
  * Copyright 2017 Google LLC
1594
1623
  *
@@ -1603,7 +1632,7 @@ This typically indicates that your device does not have a healthy Internet conne
1603
1632
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1604
1633
  * See the License for the specific language governing permissions and
1605
1634
  * limitations under the License.
1606
- */class Yl{constructor(e){this.key=e}}class Xl{constructor(e){this.key=e}}class dy{constructor(e,n){this.query=e,this.ia=n,this.sa=null,this.hasCachedResults=!1,this.current=!1,this.oa=N(),this.mutatedKeys=N(),this._a=Zu(e),this.aa=new pn(this._a)}get ua(){return this.ia}ca(e,n){const r=n?n.la:new Wl,s=n?n.aa:this.aa;let i=n?n.mutatedKeys:this.mutatedKeys,o=s,a=!1;const c=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,u=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((l,h)=>{const d=s.get(l),f=Rs(this.query,h)?h:null,E=!!d&&this.mutatedKeys.has(d.key),v=!!f&&(f.hasLocalMutations||this.mutatedKeys.has(f.key)&&f.hasCommittedMutations);let g=!1;d&&f?d.data.isEqual(f.data)?E!==v&&(r.track({type:3,doc:f}),g=!0):this.ha(d,f)||(r.track({type:2,doc:f}),g=!0,(c&&this._a(f,c)>0||u&&this._a(f,u)<0)&&(a=!0)):!d&&f?(r.track({type:0,doc:f}),g=!0):d&&!f&&(r.track({type:1,doc:d}),g=!0,(c||u)&&(a=!0)),g&&(f?(o=o.add(f),i=v?i.add(l):i.delete(l)):(o=o.delete(l),i=i.delete(l)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const l=this.query.limitType==="F"?o.last():o.first();o=o.delete(l.key),i=i.delete(l.key),r.track({type:1,doc:l})}return{aa:o,la:r,Zi:a,mutatedKeys:i}}ha(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r){const s=this.aa;this.aa=e.aa,this.mutatedKeys=e.mutatedKeys;const i=e.la.L_();i.sort((u,l)=>function(d,f){const E=v=>{switch(v){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return A()}};return E(d)-E(f)}(u.type,l.type)||this._a(u.doc,l.doc)),this.Pa(r);const o=n?this.Ia():[],a=this.oa.size===0&&this.current?1:0,c=a!==this.sa;return this.sa=a,i.length!==0||c?{snapshot:new mn(this.query,e.aa,s,i,e.mutatedKeys,a===0,c,!1,!!r&&r.resumeToken.approximateByteSize()>0),Ta:o}:{Ta:o}}Q_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({aa:this.aa,la:new Wl,mutatedKeys:this.mutatedKeys,Zi:!1},!1)):{Ta:[]}}Ea(e){return!this.ia.has(e)&&!!this.aa.has(e)&&!this.aa.get(e).hasLocalMutations}Pa(e){e&&(e.addedDocuments.forEach(n=>this.ia=this.ia.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.ia=this.ia.delete(n)),this.current=e.current)}Ia(){if(!this.current)return[];const e=this.oa;this.oa=N(),this.aa.forEach(r=>{this.Ea(r.key)&&(this.oa=this.oa.add(r.key))});const n=[];return e.forEach(r=>{this.oa.has(r)||n.push(new Xl(r))}),this.oa.forEach(r=>{e.has(r)||n.push(new Yl(r))}),n}da(e){this.ia=e.ls,this.oa=N();const n=this.ca(e.documents);return this.applyChanges(n,!0)}Aa(){return mn.fromInitialDocuments(this.query,this.aa,this.mutatedKeys,this.sa===0,this.hasCachedResults)}}class fy{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class py{constructor(e){this.key=e,this.Ra=!1}}class my{constructor(e,n,r,s,i,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Va={},this.ma=new ln(a=>Ju(a),As),this.fa=new Map,this.ga=new Set,this.pa=new j(I.comparator),this.ya=new Map,this.wa=new qo,this.Sa={},this.ba=new Map,this.Da=dn.Nn(),this.onlineState="Unknown",this.Ca=void 0}get isPrimaryClient(){return this.Ca===!0}}async function gy(t,e){const n=Py(t);let r,s;const i=n.ma.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.Aa();else{const o=await F_(n.localStore,Be(e)),a=n.sharedClientState.addLocalQueryTarget(o.targetId);r=o.targetId,s=await _y(n,e,r,a==="current",o.resumeToken),n.isPrimaryClient&&xl(n.remoteStore,o)}return s}async function _y(t,e,n,r,s){t.va=(h,d,f)=>async function(v,g,k,O){let b=g.view.ca(k);b.Zi&&(b=await Ol(v.localStore,g.query,!1).then(({documents:de})=>g.view.ca(de,b)));const U=O&&O.targetChanges.get(g.targetId),me=g.view.applyChanges(b,v.isPrimaryClient,U);return rh(v,g.targetId,me.Ta),me.snapshot}(t,h,d,f);const i=await Ol(t.localStore,e,!0),o=new dy(e,i.ls),a=o.ca(i.documents),c=vr.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),u=o.applyChanges(a,t.isPrimaryClient,c);rh(t,n,u.Ta);const l=new fy(e,n,o);return t.ma.set(e,l),t.fa.has(n)?t.fa.get(n).push(e):t.fa.set(n,[e]),u.snapshot}async function yy(t,e){const n=P(t),r=n.ma.get(e),s=n.fa.get(r.targetId);if(s.length>1)return n.fa.set(r.targetId,s.filter(i=>!As(i,e))),void n.ma.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await zo(n.localStore,r.targetId,!1).then(()=>{n.sharedClientState.clearQueryState(r.targetId),Fl(n.remoteStore,r.targetId),Zo(n,r.targetId)}).catch(or)):(Zo(n,r.targetId),await zo(n.localStore,r.targetId,!0))}async function Ey(t,e,n){const r=Sy(t);try{const s=await function(o,a){const c=P(o),u=Q.now(),l=a.reduce((f,E)=>f.add(E.key),N());let h,d;return c.persistence.runTransaction("Locally write mutations","readwrite",f=>{let E=Je(),v=N();return c.ss.getEntries(f,l).next(g=>{E=g,E.forEach((k,O)=>{O.isValidDocument()||(v=v.add(k))})}).next(()=>c.localDocuments.getOverlayedDocuments(f,E)).next(g=>{h=g;const k=[];for(const O of a){const b=zg(O,h.get(O.key).overlayedDocument);b!=null&&k.push(new mt(O.key,b,Bu(b.value.mapValue),Pe.exists(!0)))}return c.mutationQueue.addMutationBatch(f,u,k,a)}).next(g=>{d=g;const k=g.applyToLocalDocumentSet(h,v);return c.documentOverlayCache.saveOverlays(f,g.batchId,k)})}).then(()=>({batchId:d.batchId,changes:tl(h)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,a,c){let u=o.Sa[o.currentUser.toKey()];u||(u=new j(L)),u=u.insert(a,c),o.Sa[o.currentUser.toKey()]=u}(r,s.batchId,n),await Ir(r,s.changes),await Fs(r.remoteStore)}catch(s){const i=Xo(s,"Failed to persist write");n.reject(i)}}async function Jl(t,e){const n=P(t);try{const r=await M_(n.localStore,e);e.targetChanges.forEach((s,i)=>{const o=n.ya.get(i);o&&(F(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?o.Ra=!0:s.modifiedDocuments.size>0?F(o.Ra):s.removedDocuments.size>0&&(F(o.Ra),o.Ra=!1))}),await Ir(n,r,e)}catch(r){await or(r)}}function Zl(t,e,n){const r=P(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.ma.forEach((i,o)=>{const a=o.view.Q_(e);a.snapshot&&s.push(a.snapshot)}),function(o,a){const c=P(o);c.onlineState=a;let u=!1;c.queries.forEach((l,h)=>{for(const d of h.listeners)d.Q_(a)&&(u=!0)}),u&&Jo(c)}(r.eventManager,e),s.length&&r.Va.a_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function vy(t,e,n){const r=P(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.ya.get(e),i=s&&s.key;if(i){let o=new j(I.comparator);o=o.insert(i,le.newNoDocument(i,S.min()));const a=N().add(i),c=new Ds(S.min(),new Map,new j(L),o,a);await Jl(r,c),r.pa=r.pa.remove(i),r.ya.delete(e),ea(r)}else await zo(r.localStore,e,!1).then(()=>Zo(r,e,n)).catch(or)}async function Ty(t,e){const n=P(t),r=e.batch.batchId;try{const s=await L_(n.localStore,e);th(n,r,null),eh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ir(n,s)}catch(s){await or(s)}}async function Iy(t,e,n){const r=P(t);try{const s=await function(o,a){const c=P(o);return c.persistence.runTransaction("Reject batch","readwrite-primary",u=>{let l;return c.mutationQueue.lookupMutationBatch(u,a).next(h=>(F(h!==null),l=h.keys(),c.mutationQueue.removeMutationBatch(u,h))).next(()=>c.mutationQueue.performConsistencyCheck(u)).next(()=>c.documentOverlayCache.removeOverlaysForBatchId(u,l,a)).next(()=>c.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(u,l)).next(()=>c.localDocuments.getDocuments(u,l))})}(r.localStore,e);th(r,e,n),eh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await Ir(r,s)}catch(s){await or(s)}}function eh(t,e){(t.ba.get(e)||[]).forEach(n=>{n.resolve()}),t.ba.delete(e)}function th(t,e,n){const r=P(t);let s=r.Sa[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.Sa[r.currentUser.toKey()]=s}}function Zo(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.fa.get(e))t.ma.delete(r),n&&t.Va.Fa(r,n);t.fa.delete(e),t.isPrimaryClient&&t.wa.Rr(e).forEach(r=>{t.wa.containsKey(r)||nh(t,r)})}function nh(t,e){t.ga.delete(e.path.canonicalString());const n=t.pa.get(e);n!==null&&(Fl(t.remoteStore,n),t.pa=t.pa.remove(e),t.ya.delete(n),ea(t))}function rh(t,e,n){for(const r of n)r instanceof Yl?(t.wa.addReference(r.key,e),wy(t,r)):r instanceof Xl?(T("SyncEngine","Document no longer in limbo: "+r.key),t.wa.removeReference(r.key,e),t.wa.containsKey(r.key)||nh(t,r.key)):A()}function wy(t,e){const n=e.key,r=n.path.canonicalString();t.pa.get(n)||t.ga.has(r)||(T("SyncEngine","New document in limbo: "+n),t.ga.add(r),ea(t))}function ea(t){for(;t.ga.size>0&&t.pa.size<t.maxConcurrentLimboResolutions;){const e=t.ga.values().next().value;t.ga.delete(e);const n=new I(B.fromString(e)),r=t.Da.next();t.ya.set(r,new py(n)),t.pa=t.pa.insert(n,r),xl(t.remoteStore,new _t(Be(ko(n.path)),r,"TargetPurposeLimboResolution",To._e))}}async function Ir(t,e,n){const r=P(t),s=[],i=[],o=[];r.ma.isEmpty()||(r.ma.forEach((a,c)=>{o.push(r.va(c,e,n).then(u=>{if((u||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(c.targetId,u!=null&&u.fromCache?"not-current":"current"),u){s.push(u);const l=jo.Qi(c.targetId,u);i.push(l)}}))}),await Promise.all(o),r.Va.a_(s),await async function(c,u){const l=P(c);try{await l.persistence.runTransaction("notifyLocalViewChanges","readwrite",h=>m.forEach(u,d=>m.forEach(d.ki,f=>l.persistence.referenceDelegate.addReference(h,d.targetId,f)).next(()=>m.forEach(d.qi,f=>l.persistence.referenceDelegate.removeReference(h,d.targetId,f)))))}catch(h){if(!ar(h))throw h;T("LocalStore","Failed to update sequence numbers: "+h)}for(const h of u){const d=h.targetId;if(!h.fromCache){const f=l.ts.get(d),E=f.snapshotVersion,v=f.withLastLimboFreeSnapshotVersion(E);l.ts=l.ts.insert(d,v)}}}(r.localStore,i))}async function Ay(t,e){const n=P(t);if(!n.currentUser.isEqual(e)){T("SyncEngine","User change. New user:",e.toKey());const r=await Nl(n.localStore,e);n.currentUser=e,function(i,o){i.ba.forEach(a=>{a.forEach(c=>{c.reject(new _(p.CANCELLED,o))})}),i.ba.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await Ir(n,r._s)}}function Ry(t,e){const n=P(t),r=n.ya.get(e);if(r&&r.Ra)return N().add(r.key);{let s=N();const i=n.fa.get(e);if(!i)return s;for(const o of i){const a=n.ma.get(o);s=s.unionWith(a.view.ua)}return s}}function Py(t){const e=P(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=Jl.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ry.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=vy.bind(null,e),e.Va.a_=ly.bind(null,e.eventManager),e.Va.Fa=hy.bind(null,e.eventManager),e}function Sy(t){const e=P(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=Ty.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=Iy.bind(null,e),e}class sh{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Ms(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,n){return null}createIndexBackfillerScheduler(e,n){return null}createLocalStore(e){return V_(this.persistence,new D_,e.initialUser,this.serializer)}createPersistence(e){return new b_($o.jr,this.serializer)}createSharedClientState(e){return new q_}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Cy{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>Zl(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=Ay.bind(null,this.syncEngine),await ay(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new uy}()}createDatastore(e){const n=Ms(e.databaseInfo.databaseId),r=function(i){return new H_(i)}(e.databaseInfo);return function(i,o,a,c){return new K_(i,o,a,c)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,s,i,o,a){return new X_(r,s,i,o,a)}(this.localStore,this.datastore,e.asyncQueue,n=>Zl(this.syncEngine,n,0),function(){return Ll.D()?new Ll:new $_}())}createSyncEngine(e,n){return function(s,i,o,a,c,u,l){const h=new my(s,i,o,a,c,u);return l&&(h.Ca=!0),h}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}terminate(){return async function(n){const r=P(n);T("RemoteStore","RemoteStore shutting down."),r.C_.add(5),await Tr(r),r.F_.shutdown(),r.M_.set("Unknown")}(this.remoteStore)}}/**
1635
+ */class Uu{constructor(e){this.key=e}}class xu{constructor(e){this.key=e}}class l_{constructor(e,t){this.query=e,this.Ta=t,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=H(),this.mutatedKeys=H(),this.Aa=qc(e),this.Ra=new wn(this.Aa)}get Va(){return this.Ta}ma(e,t){const r=t?t.fa:new Vu,s=t?t.Ra:this.Ra;let i=t?t.mutatedKeys:this.mutatedKeys,a=s,c=!1;const l=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,d=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((p,g)=>{const v=s.get(p),R=ls(this.query,g)?g:null,C=!!v&&this.mutatedKeys.has(v.key),N=!!R&&(R.hasLocalMutations||this.mutatedKeys.has(R.key)&&R.hasCommittedMutations);let S=!1;v&&R?v.data.isEqual(R.data)?C!==N&&(r.track({type:3,doc:R}),S=!0):this.ga(v,R)||(r.track({type:2,doc:R}),S=!0,(l&&this.Aa(R,l)>0||d&&this.Aa(R,d)<0)&&(c=!0)):!v&&R?(r.track({type:0,doc:R}),S=!0):v&&!R&&(r.track({type:1,doc:v}),S=!0,(l||d)&&(c=!0)),S&&(R?(a=a.add(R),i=N?i.add(p):i.delete(p)):(a=a.delete(p),i=i.delete(p)))}),this.query.limit!==null)for(;a.size>this.query.limit;){const p=this.query.limitType==="F"?a.last():a.first();a=a.delete(p.key),i=i.delete(p.key),r.track({type:1,doc:p})}return{Ra:a,fa:r,ns:c,mutatedKeys:i}}ga(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,s){const i=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const a=e.fa.G_();a.sort((p,g)=>function(R,C){const N=S=>{switch(S){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return F()}};return N(R)-N(C)}(p.type,g.type)||this.Aa(p.doc,g.doc)),this.pa(r),s=s!=null&&s;const c=t&&!s?this.ya():[],l=this.da.size===0&&this.current&&!s?1:0,d=l!==this.Ea;return this.Ea=l,a.length!==0||d?{snapshot:new In(this.query,e.Ra,i,a,e.mutatedKeys,l===0,d,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:c}:{wa:c}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new Vu,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(t=>this.Ta=this.Ta.add(t)),e.modifiedDocuments.forEach(t=>{}),e.removedDocuments.forEach(t=>this.Ta=this.Ta.delete(t)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=H(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const t=[];return e.forEach(r=>{this.da.has(r)||t.push(new xu(r))}),this.da.forEach(r=>{e.has(r)||t.push(new Uu(r))}),t}ba(e){this.Ta=e.Ts,this.da=H();const t=this.ma(e.documents);return this.applyChanges(t,!0)}Da(){return In.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class h_{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class d_{constructor(e){this.key=e,this.va=!1}}class f_{constructor(e,t,r,s,i,a){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=a,this.Ca={},this.Fa=new yn(c=>jc(c),us),this.Ma=new Map,this.xa=new Set,this.Oa=new re(L.comparator),this.Na=new Map,this.La=new ro,this.Ba={},this.ka=new Map,this.qa=En.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function p_(n,e,t=!0){const r=Wu(n);let s;const i=r.Fa.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.Da()):s=await Fu(r,e,t,!0),s}async function m_(n,e){const t=Wu(n);await Fu(t,e,!0,!1)}async function Fu(n,e,t,r){const s=await Ug(n.localStore,Ze(e)),i=s.targetId,a=n.sharedClientState.addLocalQueryTarget(i,t);let c;return r&&(c=await g_(n,e,i,a==="current",s.resumeToken)),n.isPrimaryClient&&t&&Pu(n.remoteStore,s),c}async function g_(n,e,t,r,s){n.Ka=(g,v,R)=>async function(N,S,U,$){let x=S.view.ma(U);x.ns&&(x=await wu(N.localStore,S.query,!1).then(({documents:T})=>S.view.ma(T,x)));const z=$&&$.targetChanges.get(S.targetId),le=$&&$.targetMismatches.get(S.targetId)!=null,J=S.view.applyChanges(x,N.isPrimaryClient,z,le);return Hu(N,S.targetId,J.wa),J.snapshot}(n,g,v,R);const i=await wu(n.localStore,e,!0),a=new l_(e,i.Ts),c=a.ma(i.documents),l=fr.createSynthesizedTargetChangeForCurrentChange(t,r&&n.onlineState!=="Offline",s),d=a.applyChanges(c,n.isPrimaryClient,l);Hu(n,t,d.wa);const p=new h_(e,t,a);return n.Fa.set(e,p),n.Ma.has(t)?n.Ma.get(t).push(e):n.Ma.set(t,[e]),d.snapshot}async function __(n,e,t){const r=B(n),s=r.Fa.get(e),i=r.Ma.get(s.targetId);if(i.length>1)return r.Ma.set(s.targetId,i.filter(a=>!us(a,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await oo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),t&&uo(r.remoteStore,s.targetId),To(r,s.targetId)}).catch(Zn)):(To(r,s.targetId),await oo(r.localStore,s.targetId,!0))}async function y_(n,e){const t=B(n),r=t.Fa.get(e),s=t.Ma.get(r.targetId);t.isPrimaryClient&&s.length===1&&(t.sharedClientState.removeLocalQueryTarget(r.targetId),uo(t.remoteStore,r.targetId))}async function v_(n,e,t){const r=b_(n);try{const s=await function(a,c){const l=B(a),d=ue.now(),p=c.reduce((R,C)=>R.add(C.key),H());let g,v;return l.persistence.runTransaction("Locally write mutations","readwrite",R=>{let C=ht(),N=H();return l.cs.getEntries(R,p).next(S=>{C=S,C.forEach((U,$)=>{$.isValidDocument()||(N=N.add(U))})}).next(()=>l.localDocuments.getOverlayedDocuments(R,C)).next(S=>{g=S;const U=[];for(const $ of c){const x=Bm($,g.get($.key).overlayedDocument);x!=null&&U.push(new Pt($.key,x,Cc(x.value.mapValue),je.exists(!0)))}return l.mutationQueue.addMutationBatch(R,d,U,c)}).next(S=>{v=S;const U=S.applyToLocalDocumentSet(g,N);return l.documentOverlayCache.saveOverlays(R,S.batchId,U)})}).then(()=>({batchId:v.batchId,changes:zc(g)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(a,c,l){let d=a.Ba[a.currentUser.toKey()];d||(d=new re(K)),d=d.insert(c,l),a.Ba[a.currentUser.toKey()]=d}(r,s.batchId,t),await mr(r,s.changes),await As(r.remoteStore)}catch(s){const i=mo(s,"Failed to persist write");t.reject(i)}}async function Bu(n,e){const t=B(n);try{const r=await Vg(t.localStore,e);e.targetChanges.forEach((s,i)=>{const a=t.Na.get(i);a&&(X(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1),s.addedDocuments.size>0?a.va=!0:s.modifiedDocuments.size>0?X(a.va):s.removedDocuments.size>0&&(X(a.va),a.va=!1))}),await mr(t,r,e)}catch(r){await Zn(r)}}function ju(n,e,t){const r=B(n);if(r.isPrimaryClient&&t===0||!r.isPrimaryClient&&t===1){const s=[];r.Fa.forEach((i,a)=>{const c=a.view.Z_(e);c.snapshot&&s.push(c.snapshot)}),function(a,c){const l=B(a);l.onlineState=c;let d=!1;l.queries.forEach((p,g)=>{for(const v of g.j_)v.Z_(c)&&(d=!0)}),d&&yo(l)}(r.eventManager,e),s.length&&r.Ca.d_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function E_(n,e,t){const r=B(n);r.sharedClientState.updateQueryState(e,"rejected",t);const s=r.Na.get(e),i=s&&s.key;if(i){let a=new re(L.comparator);a=a.insert(i,we.newNoDocument(i,q.min()));const c=H().add(i),l=new _s(q.min(),new Map,new re(K),a,c);await Bu(r,l),r.Oa=r.Oa.remove(i),r.Na.delete(e),wo(r)}else await oo(r.localStore,e,!1).then(()=>To(r,e,t)).catch(Zn)}async function T_(n,e){const t=B(n),r=e.batch.batchId;try{const s=await Og(t.localStore,e);$u(t,r,null),qu(t,r),t.sharedClientState.updateMutationState(r,"acknowledged"),await mr(t,s)}catch(s){await Zn(s)}}async function w_(n,e,t){const r=B(n);try{const s=await function(a,c){const l=B(a);return l.persistence.runTransaction("Reject batch","readwrite-primary",d=>{let p;return l.mutationQueue.lookupMutationBatch(d,c).next(g=>(X(g!==null),p=g.keys(),l.mutationQueue.removeMutationBatch(d,g))).next(()=>l.mutationQueue.performConsistencyCheck(d)).next(()=>l.documentOverlayCache.removeOverlaysForBatchId(d,p,c)).next(()=>l.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(d,p)).next(()=>l.localDocuments.getDocuments(d,p))})}(r.localStore,e);$u(r,e,t),qu(r,e),r.sharedClientState.updateMutationState(e,"rejected",t),await mr(r,s)}catch(s){await Zn(s)}}function qu(n,e){(n.ka.get(e)||[]).forEach(t=>{t.resolve()}),n.ka.delete(e)}function $u(n,e,t){const r=B(n);let s=r.Ba[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(t?i.reject(t):i.resolve(),s=s.remove(e)),r.Ba[r.currentUser.toKey()]=s}}function To(n,e,t=null){n.sharedClientState.removeLocalQueryTarget(e);for(const r of n.Ma.get(e))n.Fa.delete(r),t&&n.Ca.$a(r,t);n.Ma.delete(e),n.isPrimaryClient&&n.La.gr(e).forEach(r=>{n.La.containsKey(r)||zu(n,r)})}function zu(n,e){n.xa.delete(e.path.canonicalString());const t=n.Oa.get(e);t!==null&&(uo(n.remoteStore,t),n.Oa=n.Oa.remove(e),n.Na.delete(t),wo(n))}function Hu(n,e,t){for(const r of t)r instanceof Uu?(n.La.addReference(r.key,e),I_(n,r)):r instanceof xu?(V("SyncEngine","Document no longer in limbo: "+r.key),n.La.removeReference(r.key,e),n.La.containsKey(r.key)||zu(n,r.key)):F()}function I_(n,e){const t=e.key,r=t.path.canonicalString();n.Oa.get(t)||n.xa.has(r)||(V("SyncEngine","New document in limbo: "+t),n.xa.add(r),wo(n))}function wo(n){for(;n.xa.size>0&&n.Oa.size<n.maxConcurrentLimboResolutions;){const e=n.xa.values().next().value;n.xa.delete(e);const t=new L(ee.fromString(e)),r=n.qa.next();n.Na.set(r,new d_(t)),n.Oa=n.Oa.insert(t,r),Pu(n.remoteStore,new Ct(Ze(as(t.path)),r,"TargetPurposeLimboResolution",Ui.oe))}}async function mr(n,e,t){const r=B(n),s=[],i=[],a=[];r.Fa.isEmpty()||(r.Fa.forEach((c,l)=>{a.push(r.Ka(l,e,t).then(d=>{var p;if((d||t)&&r.isPrimaryClient){const g=d?!d.fromCache:(p=t==null?void 0:t.targetChanges.get(l.targetId))===null||p===void 0?void 0:p.current;r.sharedClientState.updateQueryState(l.targetId,g?"current":"not-current")}if(d){s.push(d);const g=io.Wi(l.targetId,d);i.push(g)}}))}),await Promise.all(a),r.Ca.d_(s),await async function(l,d){const p=B(l);try{await p.persistence.runTransaction("notifyLocalViewChanges","readwrite",g=>k.forEach(d,v=>k.forEach(v.$i,R=>p.persistence.referenceDelegate.addReference(g,v.targetId,R)).next(()=>k.forEach(v.Ui,R=>p.persistence.referenceDelegate.removeReference(g,v.targetId,R)))))}catch(g){if(!er(g))throw g;V("LocalStore","Failed to update sequence numbers: "+g)}for(const g of d){const v=g.targetId;if(!g.fromCache){const R=p.os.get(v),C=R.snapshotVersion,N=R.withLastLimboFreeSnapshotVersion(C);p.os=p.os.insert(v,N)}}}(r.localStore,i))}async function A_(n,e){const t=B(n);if(!t.currentUser.isEqual(e)){V("SyncEngine","User change. New user:",e.toKey());const r=await Eu(t.localStore,e);t.currentUser=e,function(i,a){i.ka.forEach(c=>{c.forEach(l=>{l.reject(new O(P.CANCELLED,a))})}),i.ka.clear()}(t,"'waitForPendingWrites' promise is rejected due to a user change."),t.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await mr(t,r.hs)}}function R_(n,e){const t=B(n),r=t.Na.get(e);if(r&&r.va)return H().add(r.key);{let s=H();const i=t.Ma.get(e);if(!i)return s;for(const a of i){const c=t.Fa.get(a);s=s.unionWith(c.view.Va)}return s}}function Wu(n){const e=B(n);return e.remoteStore.remoteSyncer.applyRemoteEvent=Bu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=R_.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=E_.bind(null,e),e.Ca.d_=c_.bind(null,e.eventManager),e.Ca.$a=u_.bind(null,e.eventManager),e}function b_(n){const e=B(n);return e.remoteStore.remoteSyncer.applySuccessfulWrite=T_.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=w_.bind(null,e),e}class Gu{constructor(){this.synchronizeTabs=!1}async initialize(e){this.serializer=Ts(e.databaseInfo.databaseId),this.sharedClientState=this.createSharedClientState(e),this.persistence=this.createPersistence(e),await this.persistence.start(),this.localStore=this.createLocalStore(e),this.gcScheduler=this.createGarbageCollectionScheduler(e,this.localStore),this.indexBackfillerScheduler=this.createIndexBackfillerScheduler(e,this.localStore)}createGarbageCollectionScheduler(e,t){return null}createIndexBackfillerScheduler(e,t){return null}createLocalStore(e){return Dg(this.persistence,new kg,e.initialUser,this.serializer)}createPersistence(e){return new Pg(so.Zr,this.serializer)}createSharedClientState(e){return new Fg}async terminate(){var e,t;(e=this.gcScheduler)===null||e===void 0||e.stop(),(t=this.indexBackfillerScheduler)===null||t===void 0||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class P_{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=r=>ju(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=A_.bind(null,this.syncEngine),await i_(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new a_}()}createDatastore(e){const t=Ts(e.databaseInfo.databaseId),r=function(i){return new $g(i)}(e.databaseInfo);return function(i,a,c,l){return new Wg(i,a,c,l)}(e.authCredentials,e.appCheckCredentials,r,t)}createRemoteStore(e){return function(r,s,i,a,c){return new Kg(r,s,i,a,c)}(this.localStore,this.datastore,e.asyncQueue,t=>ju(this.syncEngine,t,0),function(){return Au.D()?new Au:new Bg}())}createSyncEngine(e,t){return function(s,i,a,c,l,d,p){const g=new f_(s,i,a,c,l,d);return p&&(g.Qa=!0),g}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(s){const i=B(s);V("RemoteStore","RemoteStore shutting down."),i.L_.add(5),await pr(i),i.k_.shutdown(),i.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(t=this.eventManager)===null||t===void 0||t.terminate()}}/**
1607
1636
  * @license
1608
1637
  * Copyright 2020 Google LLC
1609
1638
  *
@@ -1633,7 +1662,7 @@ This typically indicates that your device does not have a healthy Internet conne
1633
1662
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1634
1663
  * See the License for the specific language governing permissions and
1635
1664
  * limitations under the License.
1636
- */class ih{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Oa(this.observer.next,e)}error(e){this.observer.error?this.Oa(this.observer.error,e):Xe("Uncaught Error in snapshot listener:",e.toString())}Na(){this.muted=!0}Oa(e,n){this.muted||setTimeout(()=>{this.muted||e(n)},0)}}/**
1665
+ */class Io{constructor(e){this.observer=e,this.muted=!1}next(e){this.observer.next&&this.Ga(this.observer.next,e)}error(e){this.observer.error?this.Ga(this.observer.error,e):lt("Uncaught Error in snapshot listener:",e.toString())}za(){this.muted=!0}Ga(e,t){this.muted||setTimeout(()=>{this.muted||e(t)},0)}}/**
1637
1666
  * @license
1638
1667
  * Copyright 2017 Google LLC
1639
1668
  *
@@ -1648,7 +1677,7 @@ This typically indicates that your device does not have a healthy Internet conne
1648
1677
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1649
1678
  * See the License for the specific language governing permissions and
1650
1679
  * limitations under the License.
1651
- */class by{constructor(e,n,r,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=s,this.user=ce.UNAUTHENTICATED,this.clientId=Du.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async i=>{T("FirestoreClient","Received user=",i.uid),await this.authCredentialListener(i),this.user=i}),this.appCheckCredentials.start(r,i=>(T("FirestoreClient","Received new app check token=",i),this.appCheckCredentialListener(i,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 _(p.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new xe;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(n){const r=Xo(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function ta(t,e){t.asyncQueue.verifyOperationInProgress(),T("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Nl(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function oh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await Ny(t);T("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener(s=>Hl(e.remoteStore,s)),t.setAppCheckTokenChangeListener((s,i)=>Hl(e.remoteStore,i)),t._onlineComponents=e}function ky(t){return t.name==="FirebaseError"?t.code===p.FAILED_PRECONDITION||t.code===p.UNIMPLEMENTED:!(typeof DOMException<"u"&&t instanceof DOMException)||t.code===22||t.code===20||t.code===11}async function Ny(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){T("FirestoreClient","Using user provided OfflineComponentProvider");try{await ta(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!ky(n))throw n;nn("Error using user provided cache. Falling back to memory cache: "+n),await ta(t,new sh)}}else T("FirestoreClient","Using default OfflineComponentProvider"),await ta(t,new sh);return t._offlineComponents}async function na(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(T("FirestoreClient","Using user provided OnlineComponentProvider"),await oh(t,t._uninitializedComponentsProvider._online)):(T("FirestoreClient","Using default OnlineComponentProvider"),await oh(t,new Cy))),t._onlineComponents}function Dy(t){return na(t).then(e=>e.syncEngine)}function Oy(t){return na(t).then(e=>e.datastore)}async function ah(t){const e=await na(t),n=e.eventManager;return n.onListen=gy.bind(null,e.syncEngine),n.onUnlisten=yy.bind(null,e.syncEngine),n}function Vy(t,e,n={}){const r=new xe;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,a,c,u){const l=new ih({next:d=>{o.enqueueAndForget(()=>Kl(i,h));const f=d.docs.has(a);!f&&d.fromCache?u.reject(new _(p.UNAVAILABLE,"Failed to get document because the client is offline.")):f&&d.fromCache&&c&&c.source==="server"?u.reject(new _(p.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new Ql(ko(a.path),l,{includeMetadataChanges:!0,J_:!0});return Gl(i,h)}(await ah(t),t.asyncQueue,e,n,r)),r.promise}function Ly(t,e,n={}){const r=new xe;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,a,c,u){const l=new ih({next:d=>{o.enqueueAndForget(()=>Kl(i,h)),d.fromCache&&c.source==="server"?u.reject(new _(p.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.)')):u.resolve(d)},error:d=>u.reject(d)}),h=new Ql(a,l,{includeMetadataChanges:!0,J_:!0});return Gl(i,h)}(await ah(t),t.asyncQueue,e,n,r)),r.promise}/**
1680
+ */class S_{constructor(e,t,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this.databaseInfo=s,this.user=Te.UNAUTHENTICATED,this.clientId=Ec.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(r,async i=>{V("FirestoreClient","Received user=",i.uid),await this.authCredentialListener(i),this.user=i}),this.appCheckCredentials.start(r,i=>(V("FirestoreClient","Received new app check token=",i),this.appCheckCredentialListener(i,this.user)))}get configuration(){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 O(P.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Xe;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 r=mo(t,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function Ao(n,e){n.asyncQueue.verifyOperationInProgress(),V("FirestoreClient","Initializing OfflineComponentProvider");const t=n.configuration;await e.initialize(t);let r=t.initialUser;n.setCredentialChangeListener(async s=>{r.isEqual(s)||(await Eu(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>n.terminate()),n._offlineComponents=e}async function Ku(n,e){n.asyncQueue.verifyOperationInProgress();const t=await k_(n);V("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(t,n.configuration),n.setCredentialChangeListener(r=>Ou(e.remoteStore,r)),n.setAppCheckTokenChangeListener((r,s)=>Ou(e.remoteStore,s)),n._onlineComponents=e}function C_(n){return n.name==="FirebaseError"?n.code===P.FAILED_PRECONDITION||n.code===P.UNIMPLEMENTED:!(typeof DOMException<"u"&&n instanceof DOMException)||n.code===22||n.code===20||n.code===11}async function k_(n){if(!n._offlineComponents)if(n._uninitializedComponentsProvider){V("FirestoreClient","Using user provided OfflineComponentProvider");try{await Ao(n,n._uninitializedComponentsProvider._offline)}catch(e){const t=e;if(!C_(t))throw t;hn("Error using user provided cache. Falling back to memory cache: "+t),await Ao(n,new Gu)}}else V("FirestoreClient","Using default OfflineComponentProvider"),await Ao(n,new Gu);return n._offlineComponents}async function Ro(n){return n._onlineComponents||(n._uninitializedComponentsProvider?(V("FirestoreClient","Using user provided OnlineComponentProvider"),await Ku(n,n._uninitializedComponentsProvider._online)):(V("FirestoreClient","Using default OnlineComponentProvider"),await Ku(n,new P_))),n._onlineComponents}function N_(n){return Ro(n).then(e=>e.syncEngine)}function D_(n){return Ro(n).then(e=>e.datastore)}async function Rs(n){const e=await Ro(n),t=e.eventManager;return t.onListen=p_.bind(null,e.syncEngine),t.onUnlisten=__.bind(null,e.syncEngine),t.onFirstRemoteStoreListen=m_.bind(null,e.syncEngine),t.onLastRemoteStoreUnlisten=y_.bind(null,e.syncEngine),t}function O_(n,e,t={}){const r=new Xe;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const p=new Io({next:v=>{a.enqueueAndForget(()=>_o(i,g));const R=v.docs.has(c);!R&&v.fromCache?d.reject(new O(P.UNAVAILABLE,"Failed to get document because the client is offline.")):R&&v.fromCache&&l&&l.source==="server"?d.reject(new O(P.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.)')):d.resolve(v)},error:v=>d.reject(v)}),g=new Eo(as(c.path),p,{includeMetadataChanges:!0,_a:!0});return go(i,g)}(await Rs(n),n.asyncQueue,e,t,r)),r.promise}function V_(n,e,t={}){const r=new Xe;return n.asyncQueue.enqueueAndForget(async()=>function(i,a,c,l,d){const p=new Io({next:v=>{a.enqueueAndForget(()=>_o(i,g)),v.fromCache&&l.source==="server"?d.reject(new O(P.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.)')):d.resolve(v)},error:v=>d.reject(v)}),g=new Eo(c,p,{includeMetadataChanges:!0,_a:!0});return go(i,g)}(await Rs(n),n.asyncQueue,e,t,r)),r.promise}function L_(n,e,t){const r=new Xe;return n.asyncQueue.enqueueAndForget(async()=>{try{const s=await D_(n);r.resolve(async function(a,c,l){var d;const p=B(a),{request:g,ut:v,parent:R}=og(p.serializer,bm(c),l);p.connection.Fo||delete g.parent;const C=(await p.Lo("RunAggregationQuery",p.serializer.databaseId,R,g,1)).filter(S=>!!S.result);X(C.length===1);const N=(d=C[0].result)===null||d===void 0?void 0:d.aggregateFields;return Object.keys(N).reduce((S,U)=>(S[v[U]]=N[U],S),{})}(s,e,t))}catch(s){r.reject(s)}}),r.promise}/**
1652
1681
  * @license
1653
1682
  * Copyright 2023 Google LLC
1654
1683
  *
@@ -1663,7 +1692,7 @@ This typically indicates that your device does not have a healthy Internet conne
1663
1692
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1664
1693
  * See the License for the specific language governing permissions and
1665
1694
  * limitations under the License.
1666
- */function ch(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
1695
+ */function Qu(n){const e={};return n.timeoutSeconds!==void 0&&(e.timeoutSeconds=n.timeoutSeconds),e}/**
1667
1696
  * @license
1668
1697
  * Copyright 2020 Google LLC
1669
1698
  *
@@ -1678,7 +1707,7 @@ This typically indicates that your device does not have a healthy Internet conne
1678
1707
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1679
1708
  * See the License for the specific language governing permissions and
1680
1709
  * limitations under the License.
1681
- */const uh=new Map;/**
1710
+ */const Yu=new Map;/**
1682
1711
  * @license
1683
1712
  * Copyright 2017 Google LLC
1684
1713
  *
@@ -1693,7 +1722,7 @@ This typically indicates that your device does not have a healthy Internet conne
1693
1722
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1694
1723
  * See the License for the specific language governing permissions and
1695
1724
  * limitations under the License.
1696
- */function lh(t,e,n){if(!n)throw new _(p.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function My(t,e,n,r){if(e===!0&&r===!0)throw new _(p.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function hh(t){if(!I.isDocumentKey(t))throw new _(p.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function dh(t){if(I.isDocumentKey(t))throw new _(p.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Bs(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":A()}function Et(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new _(p.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Bs(t);throw new _(p.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function Uy(t,e){if(e<=0)throw new _(p.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}/**
1725
+ */function Xu(n,e,t){if(!t)throw new O(P.INVALID_ARGUMENT,`Function ${n}() cannot be called with an empty ${e}.`)}function M_(n,e,t,r){if(e===!0&&r===!0)throw new O(P.INVALID_ARGUMENT,`${n} and ${t} cannot be used together.`)}function Ju(n){if(!L.isDocumentKey(n))throw new O(P.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${n} has ${n.length}.`)}function Zu(n){if(L.isDocumentKey(n))throw new O(P.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${n} has ${n.length}.`)}function bs(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return n.length>20&&(n=`${n.substring(0,20)}...`),JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return""+n;if(typeof n=="object"){if(n instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(n);return e?`a custom ${e} object`:"an object"}}return typeof n=="function"?"a function":F()}function He(n,e){if("_delegate"in n&&(n=n._delegate),!(n instanceof e)){if(e.name===n.constructor.name)throw new O(P.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const t=bs(n);throw new O(P.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${t}`)}}return n}function U_(n,e){if(e<=0)throw new O(P.INVALID_ARGUMENT,`Function ${n}() requires a positive number, but it was: ${e}.`)}/**
1697
1726
  * @license
1698
1727
  * Copyright 2020 Google LLC
1699
1728
  *
@@ -1708,7 +1737,7 @@ This typically indicates that your device does not have a healthy Internet conne
1708
1737
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1709
1738
  * See the License for the specific language governing permissions and
1710
1739
  * limitations under the License.
1711
- */class fh{constructor(e){var n,r;if(e.host===void 0){if(e.ssl!==void 0)throw new _(p.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=(n=e.ssl)===null||n===void 0||n;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new _(p.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}My("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=ch((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new _(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new _(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new _(p.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}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&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class qs{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new fh({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new _(p.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 this._terminateTask!==void 0}_setSettings(e){if(this._settingsFrozen)throw new _(p.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 fh(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new ng;switch(r.type){case"firstParty":return new og(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new _(p.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(n){const r=uh.get(n);r&&(T("ComponentProvider","Removing Datastore"),uh.delete(n),r.terminate())}(this),Promise.resolve()}}function ph(t,e,n,r={}){var s;const i=(t=Et(t,qs))._getSettings(),o=`${e}:${n}`;if(i.host!=="firestore.googleapis.com"&&i.host!==o&&nn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},i),{host:o,ssl:!1})),r.mockUserToken){let a,c;if(typeof r.mockUserToken=="string")a=r.mockUserToken,c=ce.MOCK_USER;else{a=ec(r.mockUserToken,(s=t._app)===null||s===void 0?void 0:s.options.projectId);const u=r.mockUserToken.sub||r.mockUserToken.user_id;if(!u)throw new _(p.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");c=new ce(u)}t._authCredentials=new rg(new Nu(a,c))}}/**
1740
+ */class el{constructor(e){var t,r;if(e.host===void 0){if(e.ssl!==void 0)throw new O(P.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=(t=e.ssl)===null||t===void 0||t;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new O(P.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}M_("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:e.experimentalAutoDetectLongPolling===void 0?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=Qu((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(i){if(i.timeoutSeconds!==void 0){if(isNaN(i.timeoutSeconds))throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (must not be NaN)`);if(i.timeoutSeconds<5)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (minimum allowed value is 5)`);if(i.timeoutSeconds>30)throw new O(P.INVALID_ARGUMENT,`invalid long polling timeout: ${i.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}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&&function(r,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Ps{constructor(e,t,r,s){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new el({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new O(P.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 this._terminateTask!==void 0}_setSettings(e){if(this._settingsFrozen)throw new O(P.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 el(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new Kp;switch(r.type){case"firstParty":return new Jp(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new O(P.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(t){const r=Yu.get(t);r&&(V("ComponentProvider","Removing Datastore"),Yu.delete(t),r.terminate())}(this),Promise.resolve()}}function tl(n,e,t,r={}){var s;const i=(n=He(n,Ps))._getSettings(),a=`${e}:${t}`;if(i.host!=="firestore.googleapis.com"&&i.host!==a&&hn("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),n._setSettings(Object.assign(Object.assign({},i),{host:a,ssl:!1})),r.mockUserToken){let c,l;if(typeof r.mockUserToken=="string")c=r.mockUserToken,l=Te.MOCK_USER;else{c=Qa(r.mockUserToken,(s=n._app)===null||s===void 0?void 0:s.options.projectId);const d=r.mockUserToken.sub||r.mockUserToken.user_id;if(!d)throw new O(P.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");l=new Te(d)}n._authCredentials=new Qp(new vc(c,l))}}/**
1712
1741
  * @license
1713
1742
  * Copyright 2020 Google LLC
1714
1743
  *
@@ -1723,7 +1752,7 @@ This typically indicates that your device does not have a healthy Internet conne
1723
1752
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1724
1753
  * See the License for the specific language governing permissions and
1725
1754
  * limitations under the License.
1726
- */class Ze{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Ze(this.firestore,e,this._query)}}class Ie{constructor(e,n,r){this.converter=n,this._key=r,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 vt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Ie(this.firestore,e,this._key)}}class vt extends Ze{constructor(e,n,r){super(e,n,ko(r)),this._path=r,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 Ie(this.firestore,null,new I(e))}withConverter(e){return new vt(this.firestore,e,this._path)}}function mh(t,e,...n){if(t=M(t),lh("collection","path",e),t instanceof qs){const r=B.fromString(e,...n);return dh(r),new vt(t,null,r)}{if(!(t instanceof Ie||t instanceof vt))throw new _(p.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(B.fromString(e,...n));return dh(r),new vt(t.firestore,null,r)}}function ra(t,e,...n){if(t=M(t),arguments.length===1&&(e=Du.newId()),lh("doc","path",e),t instanceof qs){const r=B.fromString(e,...n);return hh(r),new Ie(t,null,new I(r))}{if(!(t instanceof Ie||t instanceof vt))throw new _(p.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(B.fromString(e,...n));return hh(r),new Ie(t.firestore,t instanceof vt?t.converter:null,new I(r))}}/**
1755
+ */class tt{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new tt(this.firestore,e,this._query)}}class De{constructor(e,t,r){this.converter=t,this._key=r,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 Nt(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new De(this.firestore,e,this._key)}}class Nt extends tt{constructor(e,t,r){super(e,t,as(r)),this._path=r,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 De(this.firestore,null,new L(e))}withConverter(e){return new Nt(this.firestore,e,this._path)}}function nl(n,e,...t){if(n=Y(n),Xu("collection","path",e),n instanceof Ps){const r=ee.fromString(e,...t);return Zu(r),new Nt(n,null,r)}{if(!(n instanceof De||n instanceof Nt))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(ee.fromString(e,...t));return Zu(r),new Nt(n.firestore,null,r)}}function Ss(n,e,...t){if(n=Y(n),arguments.length===1&&(e=Ec.newId()),Xu("doc","path",e),n instanceof Ps){const r=ee.fromString(e,...t);return Ju(r),new De(n,null,new L(r))}{if(!(n instanceof De||n instanceof Nt))throw new O(P.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=n._path.child(ee.fromString(e,...t));return Ju(r),new De(n.firestore,n instanceof Nt?n.converter:null,new L(r))}}/**
1727
1756
  * @license
1728
1757
  * Copyright 2020 Google LLC
1729
1758
  *
@@ -1738,8 +1767,8 @@ This typically indicates that your device does not have a healthy Internet conne
1738
1767
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1739
1768
  * See the License for the specific language governing permissions and
1740
1769
  * limitations under the License.
1741
- */class xy{constructor(){this.Ja=Promise.resolve(),this.Ya=[],this.Za=!1,this.Xa=[],this.eu=null,this.tu=!1,this.nu=!1,this.ru=[],this.zo=new Ml(this,"async_queue_retry"),this.iu=()=>{const n=Wo();n&&T("AsyncQueue","Visibility state changed to "+n.visibilityState),this.zo.Qo()};const e=Wo();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.iu)}get isShuttingDown(){return this.Za}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.su(),this.ou(e)}enterRestrictedMode(e){if(!this.Za){this.Za=!0,this.nu=e||!1;const n=Wo();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.iu)}}enqueue(e){if(this.su(),this.Za)return new Promise(()=>{});const n=new xe;return this.ou(()=>this.Za&&this.nu?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Ya.push(e),this._u()))}async _u(){if(this.Ya.length!==0){try{await this.Ya[0](),this.Ya.shift(),this.zo.reset()}catch(e){if(!ar(e))throw e;T("AsyncQueue","Operation failed with retryable error: "+e)}this.Ya.length>0&&this.zo.ko(()=>this._u())}}ou(e){const n=this.Ja.then(()=>(this.tu=!0,e().catch(r=>{this.eu=r,this.tu=!1;const s=function(o){let a=o.message||"";return o.stack&&(a=o.stack.includes(o.message)?o.stack:o.message+`
1742
- `+o.stack),a}(r);throw Xe("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this.tu=!1,r))));return this.Ja=n,n}enqueueAfterDelay(e,n,r){this.su(),this.ru.indexOf(e)>-1&&(n=0);const s=Yo.createAndSchedule(this,e,n,r,i=>this.au(i));return this.Xa.push(s),s}su(){this.eu&&A()}verifyOperationInProgress(){}async uu(){let e;do e=this.Ja,await e;while(e!==this.Ja)}cu(e){for(const n of this.Xa)if(n.timerId===e)return!0;return!1}lu(e){return this.uu().then(()=>{this.Xa.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.Xa)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.uu()})}hu(e){this.ru.push(e)}au(e){const n=this.Xa.indexOf(e);this.Xa.splice(n,1)}}class gn extends qs{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=function(){return new xy}(),this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||gh(this),this._firestoreClient.terminate()}}function Fy(t,e){const n=typeof t=="object"?t:$r(),r=typeof t=="string"?t:e||"(default)",s=Vn(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=yi("firestore");i&&ph(s,...i)}return s}function wr(t){return t._firestoreClient||gh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function gh(t){var e,n,r;const s=t._freezeSettings(),i=function(a,c,u,l){return new yg(a,c,u,l.host,l.ssl,l.experimentalForceLongPolling,l.experimentalAutoDetectLongPolling,ch(l.experimentalLongPollingOptions),l.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,s);t._firestoreClient=new by(t._authCredentials,t._appCheckCredentials,t._queue,i),!((n=s.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(t._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.localCache.kind,_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider})}/**
1770
+ */class x_{constructor(){this.au=Promise.resolve(),this.uu=[],this.cu=!1,this.lu=[],this.hu=null,this.Pu=!1,this.Iu=!1,this.Tu=[],this.t_=new Ru(this,"async_queue_retry"),this.Eu=()=>{const t=co();t&&V("AsyncQueue","Visibility state changed to "+t.visibilityState),this.t_.jo()};const e=co();e&&typeof e.addEventListener=="function"&&e.addEventListener("visibilitychange",this.Eu)}get isShuttingDown(){return this.cu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.du(),this.Au(e)}enterRestrictedMode(e){if(!this.cu){this.cu=!0,this.Iu=e||!1;const t=co();t&&typeof t.removeEventListener=="function"&&t.removeEventListener("visibilitychange",this.Eu)}}enqueue(e){if(this.du(),this.cu)return new Promise(()=>{});const t=new Xe;return this.Au(()=>this.cu&&this.Iu?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.uu.push(e),this.Ru()))}async Ru(){if(this.uu.length!==0){try{await this.uu[0](),this.uu.shift(),this.t_.reset()}catch(e){if(!er(e))throw e;V("AsyncQueue","Operation failed with retryable error: "+e)}this.uu.length>0&&this.t_.Go(()=>this.Ru())}}Au(e){const t=this.au.then(()=>(this.Pu=!0,e().catch(r=>{this.hu=r,this.Pu=!1;const s=function(a){let c=a.message||"";return a.stack&&(c=a.stack.includes(a.message)?a.stack:a.message+`
1771
+ `+a.stack),c}(r);throw lt("INTERNAL UNHANDLED ERROR: ",s),r}).then(r=>(this.Pu=!1,r))));return this.au=t,t}enqueueAfterDelay(e,t,r){this.du(),this.Tu.indexOf(e)>-1&&(t=0);const s=po.createAndSchedule(this,e,t,r,i=>this.Vu(i));return this.lu.push(s),s}du(){this.hu&&F()}verifyOperationInProgress(){}async mu(){let e;do e=this.au,await e;while(e!==this.au)}fu(e){for(const t of this.lu)if(t.timerId===e)return!0;return!1}gu(e){return this.mu().then(()=>{this.lu.sort((t,r)=>t.targetTimeMs-r.targetTimeMs);for(const t of this.lu)if(t.skipDelay(),e!=="all"&&t.timerId===e)break;return this.mu()})}pu(e){this.Tu.push(e)}Vu(e){const t=this.lu.indexOf(e);this.lu.splice(t,1)}}function rl(n){return function(t,r){if(typeof t!="object"||t===null)return!1;const s=t;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(n,["next","error","complete"])}class Dt extends Ps{constructor(e,t,r,s){super(e,t,r,s),this.type="firestore",this._queue=function(){return new x_}(),this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||sl(this),this._firestoreClient.terminate()}}function F_(n,e){const t=typeof n=="object"?n:Xr(),r=typeof n=="string"?n:"(default)",s=Kn(t,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=wi("firestore");i&&tl(s,...i)}return s}function An(n){return n._firestoreClient||sl(n),n._firestoreClient.verifyNotTerminated(),n._firestoreClient}function sl(n){var e,t,r;const s=n._freezeSettings(),i=function(c,l,d,p){return new dm(c,l,d,p.host,p.ssl,p.experimentalForceLongPolling,p.experimentalAutoDetectLongPolling,Qu(p.experimentalLongPollingOptions),p.useFetchStreams)}(n._databaseId,((e=n._app)===null||e===void 0?void 0:e.options.appId)||"",n._persistenceKey,s);n._firestoreClient=new S_(n._authCredentials,n._appCheckCredentials,n._queue,i),!((t=s.localCache)===null||t===void 0)&&t._offlineComponentProvider&&(!((r=s.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(n._firestoreClient._uninitializedComponentsProvider={_offlineKind:s.localCache.kind,_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider})}/**
1743
1772
  * @license
1744
1773
  * Copyright 2020 Google LLC
1745
1774
  *
@@ -1769,7 +1798,7 @@ This typically indicates that your device does not have a healthy Internet conne
1769
1798
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1770
1799
  * See the License for the specific language governing permissions and
1771
1800
  * limitations under the License.
1772
- */class By{constructor(e="count",n){this._internalFieldPath=n,this.type="AggregateField",this.aggregateType=e}}class qy{constructor(e,n,r){this._userDataWriter=n,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}}/**
1801
+ */class B_{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class j_{constructor(e,t,r){this._userDataWriter=t,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}}/**
1773
1802
  * @license
1774
1803
  * Copyright 2020 Google LLC
1775
1804
  *
@@ -1784,7 +1813,7 @@ This typically indicates that your device does not have a healthy Internet conne
1784
1813
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1785
1814
  * See the License for the specific language governing permissions and
1786
1815
  * limitations under the License.
1787
- */class _n{constructor(e){this._byteString=e}static fromBase64String(e){try{return new _n(ue.fromBase64String(e))}catch(n){throw new _(p.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new _n(ue.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)}}/**
1816
+ */class Rn{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Rn(_e.fromBase64String(e))}catch(t){throw new O(P.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(e){return new Rn(_e.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)}}/**
1788
1817
  * @license
1789
1818
  * Copyright 2020 Google LLC
1790
1819
  *
@@ -1799,7 +1828,7 @@ This typically indicates that your device does not have a healthy Internet conne
1799
1828
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1800
1829
  * See the License for the specific language governing permissions and
1801
1830
  * limitations under the License.
1802
- */class $s{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new _(p.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new te(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
1831
+ */class Cs{constructor(...e){for(let t=0;t<e.length;++t)if(e[t].length===0)throw new O(P.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new pe(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
1803
1832
  * @license
1804
1833
  * Copyright 2020 Google LLC
1805
1834
  *
@@ -1814,7 +1843,7 @@ This typically indicates that your device does not have a healthy Internet conne
1814
1843
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1815
1844
  * See the License for the specific language governing permissions and
1816
1845
  * limitations under the License.
1817
- */class sa{constructor(e){this._methodName=e}}/**
1846
+ */class bo{constructor(e){this._methodName=e}}/**
1818
1847
  * @license
1819
1848
  * Copyright 2017 Google LLC
1820
1849
  *
@@ -1829,7 +1858,22 @@ This typically indicates that your device does not have a healthy Internet conne
1829
1858
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1830
1859
  * See the License for the specific language governing permissions and
1831
1860
  * limitations under the License.
1832
- */class ia{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new _(p.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new _(p.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}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 L(this._lat,e._lat)||L(this._long,e._long)}}/**
1861
+ */class Po{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new O(P.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new O(P.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 K(this._lat,e._lat)||K(this._long,e._long)}}/**
1862
+ * @license
1863
+ * Copyright 2024 Google LLC
1864
+ *
1865
+ * Licensed under the Apache License, Version 2.0 (the "License");
1866
+ * you may not use this file except in compliance with the License.
1867
+ * You may obtain a copy of the License at
1868
+ *
1869
+ * http://www.apache.org/licenses/LICENSE-2.0
1870
+ *
1871
+ * Unless required by applicable law or agreed to in writing, software
1872
+ * distributed under the License is distributed on an "AS IS" BASIS,
1873
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1874
+ * See the License for the specific language governing permissions and
1875
+ * limitations under the License.
1876
+ */class So{constructor(e){this._values=(e||[]).map(t=>t)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0}(this._values,e._values)}}/**
1833
1877
  * @license
1834
1878
  * Copyright 2017 Google LLC
1835
1879
  *
@@ -1844,7 +1888,7 @@ This typically indicates that your device does not have a healthy Internet conne
1844
1888
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1845
1889
  * See the License for the specific language governing permissions and
1846
1890
  * limitations under the License.
1847
- */const $y=/^__.*__$/;class jy{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new mt(e,this.data,this.fieldMask,n,this.fieldTransforms):new yr(e,this.data,n,this.fieldTransforms)}}class _h{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new mt(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function yh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw A()}}class oa{constructor(e,n,r,s,i,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.Pu(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Iu(){return this.settings.Iu}Tu(e){return new oa(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Eu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),s=this.Tu({path:r,du:!1});return s.Au(e),s}Ru(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),s=this.Tu({path:r,du:!1});return s.Pu(),s}Vu(e){return this.Tu({path:void 0,du:!0})}mu(e){return zs(e,this.settings.methodName,this.settings.fu||!1,this.path,this.settings.gu)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}Pu(){if(this.path)for(let e=0;e<this.path.length;e++)this.Au(this.path.get(e))}Au(e){if(e.length===0)throw this.mu("Document fields must not be empty");if(yh(this.Iu)&&$y.test(e))throw this.mu('Document fields cannot begin and end with "__"')}}class zy{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||Ms(e)}pu(e,n,r,s=!1){return new oa({Iu:e,methodName:n,gu:r,path:te.emptyPath(),du:!1,fu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function aa(t){const e=t._freezeSettings(),n=Ms(t._databaseId);return new zy(t._databaseId,!!e.ignoreUndefinedProperties,n)}function Hy(t,e,n,r,s,i={}){const o=t.pu(i.merge||i.mergeFields?2:0,e,n,s);ca("Data must be an object, but it was:",o,r);const a=vh(r,o);let c,u;if(i.merge)c=new Te(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const l=[];for(const h of i.mergeFields){const d=ua(e,h,n);if(!o.contains(d))throw new _(p.INVALID_ARGUMENT,`Field '${d}' is specified in your field mask but missing from your input data.`);Ih(l,d)||l.push(d)}c=new Te(l),u=o.fieldTransforms.filter(h=>c.covers(h.field))}else c=null,u=o.fieldTransforms;return new jy(new ge(a),c,u)}class js extends sa{_toFieldTransform(e){if(e.Iu!==2)throw e.Iu===1?e.mu(`${this._methodName}() can only appear at the top level of your update data`):e.mu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof js}}function Wy(t,e,n,r){const s=t.pu(1,e,n);ca("Data must be an object, but it was:",s,r);const i=[],o=ge.empty();Vt(r,(c,u)=>{const l=la(e,c,n);u=M(u);const h=s.Ru(l);if(u instanceof js)i.push(l);else{const d=Ar(u,h);d!=null&&(i.push(l),o.set(l,d))}});const a=new Te(i);return new _h(o,a,s.fieldTransforms)}function Gy(t,e,n,r,s,i){const o=t.pu(1,e,n),a=[ua(e,r,n)],c=[s];if(i.length%2!=0)throw new _(p.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let d=0;d<i.length;d+=2)a.push(ua(e,i[d])),c.push(i[d+1]);const u=[],l=ge.empty();for(let d=a.length-1;d>=0;--d)if(!Ih(u,a[d])){const f=a[d];let E=c[d];E=M(E);const v=o.Ru(f);if(E instanceof js)u.push(f);else{const g=Ar(E,v);g!=null&&(u.push(f),l.set(f,g))}}const h=new Te(u);return new _h(l,h,o.fieldTransforms)}function Eh(t,e,n,r=!1){return Ar(n,t.pu(r?4:3,e))}function Ar(t,e){if(Th(t=M(t)))return ca("Unsupported field value:",e,t),vh(t,e);if(t instanceof sa)return function(r,s){if(!yh(s.Iu))throw s.mu(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.mu(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.du&&e.Iu!==4)throw e.mu("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const a of r){let c=Ar(a,s.Vu(o));c==null&&(c={nullValue:"NULL_VALUE"}),i.push(c),o++}return{arrayValue:{values:i}}}(t,e)}return function(r,s){if((r=M(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return xg(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Q.fromDate(r);return{timestampValue:Vs(s.serializer,i)}}if(r instanceof Q){const i=new Q(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:Vs(s.serializer,i)}}if(r instanceof ia)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof _n)return{bytesValue:wl(s.serializer,r._byteString)};if(r instanceof Ie){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.mu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Mo(r.firestore._databaseId||s.databaseId,r._key.path)}}throw s.mu(`Unsupported field value: ${Bs(r)}`)}(t,e)}function vh(t,e){const n={};return Vu(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Vt(t,(r,s)=>{const i=Ar(s,e.Eu(r));i!=null&&(n[r]=i)}),{mapValue:{fields:n}}}function Th(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Q||t instanceof ia||t instanceof _n||t instanceof Ie||t instanceof sa)}function ca(t,e,n){if(!Th(n)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(n)){const r=Bs(n);throw r==="an object"?e.mu(t+" a custom object"):e.mu(t+" "+r)}}function ua(t,e,n){if((e=M(e))instanceof $s)return e._internalPath;if(typeof e=="string")return la(t,e);throw zs("Field path arguments must be of type string or ",t,!1,void 0,n)}const Ky=new RegExp("[~\\*/\\[\\]]");function la(t,e,n){if(e.search(Ky)>=0)throw zs(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new $s(...e.split("."))._internalPath}catch{throw zs(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function zs(t,e,n,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;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 _(p.INVALID_ARGUMENT,a+t+c)}function Ih(t,e){return t.some(n=>n.isEqual(e))}/**
1891
+ */const q_=/^__.*__$/;class $_{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return this.fieldMask!==null?new Pt(e,this.data,this.fieldMask,t,this.fieldTransforms):new hr(e,this.data,t,this.fieldTransforms)}}class il{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new Pt(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function ol(n){switch(n){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw F()}}class Co{constructor(e,t,r,s,i,a){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.yu(),this.fieldTransforms=i||[],this.fieldMask=a||[]}get path(){return this.settings.path}get wu(){return this.settings.wu}Su(e){return new Co(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}bu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.Su({path:r,Du:!1});return s.vu(e),s}Cu(e){var t;const r=(t=this.path)===null||t===void 0?void 0:t.child(e),s=this.Su({path:r,Du:!1});return s.yu(),s}Fu(e){return this.Su({path:void 0,Du:!0})}Mu(e){return Ns(e,this.settings.methodName,this.settings.xu||!1,this.path,this.settings.Ou)}contains(e){return this.fieldMask.find(t=>e.isPrefixOf(t))!==void 0||this.fieldTransforms.find(t=>e.isPrefixOf(t.field))!==void 0}yu(){if(this.path)for(let e=0;e<this.path.length;e++)this.vu(this.path.get(e))}vu(e){if(e.length===0)throw this.Mu("Document fields must not be empty");if(ol(this.wu)&&q_.test(e))throw this.Mu('Document fields cannot begin and end with "__"')}}class z_{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||Ts(e)}Nu(e,t,r,s=!1){return new Co({wu:e,methodName:t,Ou:r,path:pe.emptyPath(),Du:!1,xu:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function ko(n){const e=n._freezeSettings(),t=Ts(n._databaseId);return new z_(n._databaseId,!!e.ignoreUndefinedProperties,t)}function H_(n,e,t,r,s,i={}){const a=n.Nu(i.merge||i.mergeFields?2:0,e,t,s);No("Data must be an object, but it was:",a,r);const c=cl(r,a);let l,d;if(i.merge)l=new Me(a.fieldMask),d=a.fieldTransforms;else if(i.mergeFields){const p=[];for(const g of i.mergeFields){const v=Do(e,g,t);if(!a.contains(v))throw new O(P.INVALID_ARGUMENT,`Field '${v}' is specified in your field mask but missing from your input data.`);ll(p,v)||p.push(v)}l=new Me(p),d=a.fieldTransforms.filter(g=>l.covers(g.field))}else l=null,d=a.fieldTransforms;return new $_(new Ne(c),l,d)}class ks extends bo{_toFieldTransform(e){if(e.wu!==2)throw e.wu===1?e.Mu(`${this._methodName}() can only appear at the top level of your update data`):e.Mu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof ks}}function W_(n,e,t,r){const s=n.Nu(1,e,t);No("Data must be an object, but it was:",s,r);const i=[],a=Ne.empty();Ht(r,(l,d)=>{const p=Oo(e,l,t);d=Y(d);const g=s.Cu(p);if(d instanceof ks)i.push(p);else{const v=gr(d,g);v!=null&&(i.push(p),a.set(p,v))}});const c=new Me(i);return new il(a,c,s.fieldTransforms)}function G_(n,e,t,r,s,i){const a=n.Nu(1,e,t),c=[Do(e,r,t)],l=[s];if(i.length%2!=0)throw new O(P.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let v=0;v<i.length;v+=2)c.push(Do(e,i[v])),l.push(i[v+1]);const d=[],p=Ne.empty();for(let v=c.length-1;v>=0;--v)if(!ll(d,c[v])){const R=c[v];let C=l[v];C=Y(C);const N=a.Cu(R);if(C instanceof ks)d.push(R);else{const S=gr(C,N);S!=null&&(d.push(R),p.set(R,S))}}const g=new Me(d);return new il(p,g,a.fieldTransforms)}function al(n,e,t,r=!1){return gr(t,n.Nu(r?4:3,e))}function gr(n,e){if(ul(n=Y(n)))return No("Unsupported field value:",e,n),cl(n,e);if(n instanceof bo)return function(r,s){if(!ol(s.wu))throw s.Mu(`${r._methodName}() can only be used with update() and set()`);if(!s.path)throw s.Mu(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(n,e),null;if(n===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),n instanceof Array){if(e.settings.Du&&e.wu!==4)throw e.Mu("Nested arrays are not supported");return function(r,s){const i=[];let a=0;for(const c of r){let l=gr(c,s.Fu(a));l==null&&(l={nullValue:"NULL_VALUE"}),i.push(l),a++}return{arrayValue:{values:i}}}(n,e)}return function(r,s){if((r=Y(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return Vm(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=ue.fromDate(r);return{timestampValue:vs(s.serializer,i)}}if(r instanceof ue){const i=new ue(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:vs(s.serializer,i)}}if(r instanceof Po)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Rn)return{bytesValue:hu(s.serializer,r._byteString)};if(r instanceof De){const i=s.databaseId,a=r.firestore._databaseId;if(!a.isEqual(i))throw s.Mu(`Document reference is for database ${a.projectId}/${a.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:Ji(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof So)return function(a,c){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:a.toArray().map(l=>{if(typeof l!="number")throw c.Mu("VectorValues must only contain numeric values.");return Ki(c.serializer,l)})}}}}}}(r,s);throw s.Mu(`Unsupported field value: ${bs(r)}`)}(n,e)}function cl(n,e){const t={};return wc(n)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ht(n,(r,s)=>{const i=gr(s,e.bu(r));i!=null&&(t[r]=i)}),{mapValue:{fields:t}}}function ul(n){return!(typeof n!="object"||n===null||n instanceof Array||n instanceof Date||n instanceof ue||n instanceof Po||n instanceof Rn||n instanceof De||n instanceof bo||n instanceof So)}function No(n,e,t){if(!ul(t)||!function(s){return typeof s=="object"&&s!==null&&(Object.getPrototypeOf(s)===Object.prototype||Object.getPrototypeOf(s)===null)}(t)){const r=bs(t);throw r==="an object"?e.Mu(n+" a custom object"):e.Mu(n+" "+r)}}function Do(n,e,t){if((e=Y(e))instanceof Cs)return e._internalPath;if(typeof e=="string")return Oo(n,e);throw Ns("Field path arguments must be of type string or ",n,!1,void 0,t)}const K_=new RegExp("[~\\*/\\[\\]]");function Oo(n,e,t){if(e.search(K_)>=0)throw Ns(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,n,!1,void 0,t);try{return new Cs(...e.split("."))._internalPath}catch{throw Ns(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,n,!1,void 0,t)}}function Ns(n,e,t,r,s){const i=r&&!r.isEmpty(),a=s!==void 0;let c=`Function ${e}() called with invalid data`;t&&(c+=" (via `toFirestore()`)"),c+=". ";let l="";return(i||a)&&(l+=" (found",i&&(l+=` in field ${r}`),a&&(l+=` in document ${s}`),l+=")"),new O(P.INVALID_ARGUMENT,c+n+l)}function ll(n,e){return n.some(t=>t.isEqual(e))}/**
1848
1892
  * @license
1849
1893
  * Copyright 2020 Google LLC
1850
1894
  *
@@ -1859,7 +1903,7 @@ This typically indicates that your device does not have a healthy Internet conne
1859
1903
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1860
1904
  * See the License for the specific language governing permissions and
1861
1905
  * limitations under the License.
1862
- */class ha{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Ie(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Qy(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 n=this._document.data.field(Hs("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class Qy extends ha{data(){return super.data()}}function Hs(t,e){return typeof e=="string"?la(t,e):e instanceof $s?e._internalPath:e._delegate._internalPath}/**
1906
+ */class Vo{constructor(e,t,r,s,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new De(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Q_(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(Ds("DocumentSnapshot.get",e));if(t!==null)return this._userDataWriter.convertValue(t)}}}class Q_ extends Vo{data(){return super.data()}}function Ds(n,e){return typeof e=="string"?Oo(n,e):e instanceof Cs?e._internalPath:e._delegate._internalPath}/**
1863
1907
  * @license
1864
1908
  * Copyright 2020 Google LLC
1865
1909
  *
@@ -1874,7 +1918,7 @@ This typically indicates that your device does not have a healthy Internet conne
1874
1918
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1875
1919
  * See the License for the specific language governing permissions and
1876
1920
  * limitations under the License.
1877
- */function Yy(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new _(p.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class da{}class Ws extends da{}function wh(t,e,...n){let r=[];e instanceof da&&r.push(e),r=r.concat(n),function(i){const o=i.filter(c=>c instanceof yn).length,a=i.filter(c=>c instanceof Rr).length;if(o>1||o>0&&a>0)throw new _(p.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(...)))`.")}(r);for(const s of r)t=s._apply(t);return t}class Rr extends Ws{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Rr(e,n,r)}_apply(e){const n=this._parse(e);return Ch(e._query,n),new Ze(e.firestore,e.converter,Do(e._query,n))}_parse(e){const n=aa(e.firestore);return function(i,o,a,c,u,l,h){let d;if(u.isKeyField()){if(l==="array-contains"||l==="array-contains-any")throw new _(p.INVALID_ARGUMENT,`Invalid Query. You can't perform '${l}' queries on documentId().`);if(l==="in"||l==="not-in"){Sh(h,l);const f=[];for(const E of h)f.push(Ph(c,i,E));d={arrayValue:{values:f}}}else d=Ph(c,i,h)}else l!=="in"&&l!=="not-in"&&l!=="array-contains-any"||Sh(h,l),d=Eh(a,o,h,l==="in"||l==="not-in");return G.create(u,l,d)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function Ah(t,e,n){const r=e,s=Hs("where",t);return Rr._create(s,r,n)}class yn extends da{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new yn(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Ne.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(s,i){let o=s;const a=i.getFlattenedFilters();for(const c of a)Ch(o,c),o=Do(o,c)}(e._query,n),new Ze(e.firestore,e.converter,Do(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function Xy(...t){return t.forEach(e=>bh("or",e)),yn._create("or",t)}function Jy(...t){return t.forEach(e=>bh("and",e)),yn._create("and",t)}class fa extends Ws{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new fa(e,n)}_apply(e){const n=function(s,i,o){if(s.startAt!==null)throw new _(p.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new _(p.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new dr(i,o)}(e._query,this._field,this._direction);return new Ze(e.firestore,e.converter,function(s,i){const o=s.explicitOrderBy.concat([i]);return new Ut(s.path,s.collectionGroup,o,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,n))}}function Zy(t,e="asc"){const n=e,r=Hs("orderBy",t);return fa._create(r,n)}class pa extends Ws{constructor(e,n,r){super(),this.type=e,this._limit=n,this._limitType=r}static _create(e,n,r){return new pa(e,n,r)}_apply(e){return new Ze(e.firestore,e.converter,ws(e._query,this._limit,this._limitType))}}function Rh(t){return Uy("limit",t),pa._create("limit",t,"F")}class ma extends Ws{constructor(e,n,r){super(),this.type=e,this._docOrFields=n,this._inclusive=r}static _create(e,n,r){return new ma(e,n,r)}_apply(e){const n=tE(e,this.type,this._docOrFields,this._inclusive);return new Ze(e.firestore,e.converter,function(s,i){return new Ut(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,n))}}function eE(...t){return ma._create("startAfter",t,!1)}function tE(t,e,n,r){if(n[0]=M(n[0]),n[0]instanceof ha)return function(i,o,a,c,u){if(!c)throw new _(p.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${a}().`);const l=[];for(const h of cn(i))if(h.field.isKeyField())l.push(Ts(o,c.key));else{const d=c.data.field(h.field);if(Es(d))throw new _(p.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+h.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(d===null){const f=h.field.canonicalString();throw new _(p.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${f}' (used as the orderBy) does not exist.`)}l.push(d)}return new an(l,u)}(t._query,t.firestore._databaseId,e,n[0]._document,r);{const s=aa(t.firestore);return function(o,a,c,u,l,h){const d=o.explicitOrderBy;if(l.length>d.length)throw new _(p.INVALID_ARGUMENT,`Too many arguments provided to ${u}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const f=[];for(let E=0;E<l.length;E++){const v=l[E];if(d[E].field.isKeyField()){if(typeof v!="string")throw new _(p.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${u}(), but got a ${typeof v}`);if(!No(o)&&v.indexOf("/")!==-1)throw new _(p.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${u}() must be a plain document ID, but '${v}' contains a slash.`);const g=o.path.child(B.fromString(v));if(!I.isDocumentKey(g))throw new _(p.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${u}() must result in a valid document path, but '${g}' is not because it contains an odd number of segments.`);const k=new I(g);f.push(Ts(a,k))}else{const g=Eh(c,u,v);f.push(g)}}return new an(f,h)}(t._query,t.firestore._databaseId,s,e,n,r)}}function Ph(t,e,n){if(typeof(n=M(n))=="string"){if(n==="")throw new _(p.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!No(e)&&n.indexOf("/")!==-1)throw new _(p.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(B.fromString(n));if(!I.isDocumentKey(r))throw new _(p.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 Ts(t,new I(r))}if(n instanceof Ie)return Ts(t,n._key);throw new _(p.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Bs(n)}.`)}function Sh(t,e){if(!Array.isArray(t)||t.length===0)throw new _(p.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function Ch(t,e){const n=function(s,i){for(const o of s)for(const a of o.getFlattenedFilters())if(i.indexOf(a.op)>=0)return a.op;return null}(t.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new _(p.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new _(p.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function bh(t,e){if(!(e instanceof Rr||e instanceof yn))throw new _(p.INVALID_ARGUMENT,`Function ${t}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class nE{convertValue(e,n="none"){switch(Mt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return W(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,n);case 5:return e.stringValue;case 6:return this.convertBytes(Lt(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,n);case 10:return this.convertObject(e.mapValue,n);default:throw A()}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Vt(e,(s,i)=>{r[s]=this.convertValue(i,n)}),r}convertGeoPoint(e){return new ia(W(e.latitude),W(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Io(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(cr(e));default:return null}}convertTimestamp(e){const n=pt(e);return new Q(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=B.fromString(e);F(kl(r));const s=new ur(r.get(1),r.get(3)),i=new I(r.popFirst(5));return s.isEqual(n)||Xe(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),i}}/**
1921
+ */function hl(n){if(n.limitType==="L"&&n.explicitOrderBy.length===0)throw new O(P.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Lo{}class Os extends Lo{}function dl(n,e,...t){let r=[];e instanceof Lo&&r.push(e),r=r.concat(t),function(i){const a=i.filter(l=>l instanceof bn).length,c=i.filter(l=>l instanceof _r).length;if(a>1||a>0&&c>0)throw new O(P.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(...)))`.")}(r);for(const s of r)n=s._apply(n);return n}class _r extends Os{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new _r(e,t,r)}_apply(e){const t=this._parse(e);return _l(e._query,t),new tt(e.firestore,e.converter,Gi(e._query,t))}_parse(e){const t=ko(e.firestore);return function(i,a,c,l,d,p,g){let v;if(d.isKeyField()){if(p==="array-contains"||p==="array-contains-any")throw new O(P.INVALID_ARGUMENT,`Invalid Query. You can't perform '${p}' queries on documentId().`);if(p==="in"||p==="not-in"){gl(g,p);const R=[];for(const C of g)R.push(ml(l,i,C));v={arrayValue:{values:R}}}else v=ml(l,i,g)}else p!=="in"&&p!=="not-in"&&p!=="array-contains-any"||gl(g,p),v=al(c,a,g,p==="in"||p==="not-in");return ae.create(d,p,v)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function fl(n,e,t){const r=e,s=Ds("where",n);return _r._create(s,r,t)}class bn extends Lo{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new bn(e,t)}_parse(e){const t=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return t.length===1?t[0]:ze.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return t.getFilters().length===0?e:(function(s,i){let a=s;const c=i.getFlattenedFilters();for(const l of c)_l(a,l),a=Gi(a,l)}(e._query,t),new tt(e.firestore,e.converter,Gi(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function Y_(...n){return n.forEach(e=>yl("or",e)),bn._create("or",n)}function X_(...n){return n.forEach(e=>yl("and",e)),bn._create("and",n)}class Mo extends Os{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new Mo(e,t)}_apply(e){const t=function(s,i,a){if(s.startAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new O(P.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new ir(i,a)}(e._query,this._field,this._direction);return new tt(e.firestore,e.converter,function(s,i){const a=s.explicitOrderBy.concat([i]);return new Kt(s.path,s.collectionGroup,a,s.filters.slice(),s.limit,s.limitType,s.startAt,s.endAt)}(e._query,t))}}function J_(n,e="asc"){const t=e,r=Ds("orderBy",n);return Mo._create(r,t)}class Uo extends Os{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new Uo(e,t,r)}_apply(e){return new tt(e.firestore,e.converter,cs(e._query,this._limit,this._limitType))}}function pl(n){return U_("limit",n),Uo._create("limit",n,"F")}class xo extends Os{constructor(e,t,r){super(),this.type=e,this._docOrFields=t,this._inclusive=r}static _create(e,t,r){return new xo(e,t,r)}_apply(e){const t=ey(e,this.type,this._docOrFields,this._inclusive);return new tt(e.firestore,e.converter,function(s,i){return new Kt(s.path,s.collectionGroup,s.explicitOrderBy.slice(),s.filters.slice(),s.limit,s.limitType,i,s.endAt)}(e._query,t))}}function Z_(...n){return xo._create("startAfter",n,!1)}function ey(n,e,t,r){if(t[0]=Y(t[0]),t[0]instanceof Vo)return function(i,a,c,l,d){if(!l)throw new O(P.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${c}().`);const p=[];for(const g of gn(i))if(g.field.isKeyField())p.push(is(a,l.key));else{const v=l.data.field(g.field);if(rs(v))throw new O(P.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+g.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(v===null){const R=g.field.canonicalString();throw new O(P.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${R}' (used as the orderBy) does not exist.`)}p.push(v)}return new mn(p,d)}(n._query,n.firestore._databaseId,e,t[0]._document,r);{const s=ko(n.firestore);return function(a,c,l,d,p,g){const v=a.explicitOrderBy;if(p.length>v.length)throw new O(P.INVALID_ARGUMENT,`Too many arguments provided to ${d}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const R=[];for(let C=0;C<p.length;C++){const N=p[C];if(v[C].field.isKeyField()){if(typeof N!="string")throw new O(P.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${d}(), but got a ${typeof N}`);if(!Wi(a)&&N.indexOf("/")!==-1)throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${d}() must be a plain document ID, but '${N}' contains a slash.`);const S=a.path.child(ee.fromString(N));if(!L.isDocumentKey(S))throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${d}() must result in a valid document path, but '${S}' is not because it contains an odd number of segments.`);const U=new L(S);R.push(is(c,U))}else{const S=al(l,d,N);R.push(S)}}return new mn(R,g)}(n._query,n.firestore._databaseId,s,e,t,r)}}function ml(n,e,t){if(typeof(t=Y(t))=="string"){if(t==="")throw new O(P.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Wi(e)&&t.indexOf("/")!==-1)throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${t}' contains a '/' character.`);const r=e.path.child(ee.fromString(t));if(!L.isDocumentKey(r))throw new O(P.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 is(n,new L(r))}if(t instanceof De)return is(n,t._key);throw new O(P.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${bs(t)}.`)}function gl(n,e){if(!Array.isArray(n)||n.length===0)throw new O(P.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function _l(n,e){const t=function(s,i){for(const a of s)for(const c of a.getFlattenedFilters())if(i.indexOf(c.op)>=0)return c.op;return null}(n.filters,function(s){switch(s){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(t!==null)throw t===e.op?new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new O(P.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${t.toString()}' filters.`)}function yl(n,e){if(!(e instanceof _r||e instanceof bn))throw new O(P.INVALID_ARGUMENT,`Function ${n}() requires AppliableConstraints created with a call to 'where(...)', 'or(...)', or 'and(...)'.`)}class ty{convertValue(e,t="none"){switch(Gt(e)){case 0:return null;case 1:return e.booleanValue;case 2:return oe(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(Wt(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 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw F()}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const r={};return Ht(e,(s,i)=>{r[s]=this.convertValue(i,t)}),r}convertVectorValue(e){var t,r,s;const i=(s=(r=(t=e.fields)===null||t===void 0?void 0:t.value.arrayValue)===null||r===void 0?void 0:r.values)===null||s===void 0?void 0:s.map(a=>oe(a.doubleValue));return new So(i)}convertGeoPoint(e){return new Po(oe(e.latitude),oe(e.longitude))}convertArray(e,t){return(e.values||[]).map(r=>this.convertValue(r,t))}convertServerTimestamp(e,t){switch(t){case"previous":const r=xi(e);return r==null?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(tr(e));default:return null}}convertTimestamp(e){const t=bt(e);return new ue(t.seconds,t.nanos)}convertDocumentKey(e,t){const r=ee.fromString(e);X(vu(r));const s=new nr(r.get(1),r.get(3)),i=new L(r.popFirst(5));return s.isEqual(t)||lt(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}/**
1878
1922
  * @license
1879
1923
  * Copyright 2020 Google LLC
1880
1924
  *
@@ -1889,7 +1933,7 @@ This typically indicates that your device does not have a healthy Internet conne
1889
1933
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1890
1934
  * See the License for the specific language governing permissions and
1891
1935
  * limitations under the License.
1892
- */function rE(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}function sE(){return new By("count")}/**
1936
+ */function ny(n,e,t){let r;return r=n?t&&(t.merge||t.mergeFields)?n.toFirestore(e,t):n.toFirestore(e):e,r}function ry(){return new B_("count")}/**
1893
1937
  * @license
1894
1938
  * Copyright 2020 Google LLC
1895
1939
  *
@@ -1904,7 +1948,7 @@ This typically indicates that your device does not have a healthy Internet conne
1904
1948
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1905
1949
  * See the License for the specific language governing permissions and
1906
1950
  * limitations under the License.
1907
- */class Pr{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class kh extends ha{constructor(e,n,r,s,i,o){super(e,n,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Gs(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(Hs("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}}class Gs extends kh{data(e={}){return super.data(e)}}class iE{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new Pr(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Gs(this._firestore,this._userDataWriter,r.key,r,new Pr(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new _(p.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(a=>{const c=new Gs(s._firestore,s._userDataWriter,a.doc.key,a.doc,new Pr(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);return a.doc,{type:"added",doc:c,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(a=>i||a.type!==3).map(a=>{const c=new Gs(s._firestore,s._userDataWriter,a.doc.key,a.doc,new Pr(s._snapshot.mutatedKeys.has(a.doc.key),s._snapshot.fromCache),s.query.converter);let u=-1,l=-1;return a.type!==0&&(u=o.indexOf(a.doc.key),o=o.delete(a.doc.key)),a.type!==1&&(o=o.add(a.doc),l=o.indexOf(a.doc.key)),{type:oE(a.type),doc:c,oldIndex:u,newIndex:l}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}}function oE(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return A()}}/**
1951
+ */class yr{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class vl extends Vo{constructor(e,t,r,s,i,a){super(e,t,r,s,a),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vs(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 r=this._document.data.field(Ds("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}}class Vs extends vl{data(e={}){return super.data(e)}}class El{constructor(e,t,r,s){this._firestore=e,this._userDataWriter=t,this._snapshot=s,this.metadata=new yr(s.hasPendingWrites,s.fromCache),this.query=r}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,t){this._snapshot.docs.forEach(r=>{e.call(t,new Vs(this._firestore,this._userDataWriter,r.key,r,new yr(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new O(P.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(s,i){if(s._snapshot.oldDocs.isEmpty()){let a=0;return s._snapshot.docChanges.map(c=>{const l=new Vs(s._firestore,s._userDataWriter,c.doc.key,c.doc,new yr(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);return c.doc,{type:"added",doc:l,oldIndex:-1,newIndex:a++}})}{let a=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(c=>i||c.type!==3).map(c=>{const l=new Vs(s._firestore,s._userDataWriter,c.doc.key,c.doc,new yr(s._snapshot.mutatedKeys.has(c.doc.key),s._snapshot.fromCache),s.query.converter);let d=-1,p=-1;return c.type!==0&&(d=a.indexOf(c.doc.key),a=a.delete(c.doc.key)),c.type!==1&&(a=a.add(c.doc),p=a.indexOf(c.doc.key)),{type:sy(c.type),doc:l,oldIndex:d,newIndex:p}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}}function sy(n){switch(n){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return F()}}/**
1908
1952
  * @license
1909
1953
  * Copyright 2020 Google LLC
1910
1954
  *
@@ -1919,7 +1963,7 @@ This typically indicates that your device does not have a healthy Internet conne
1919
1963
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1920
1964
  * See the License for the specific language governing permissions and
1921
1965
  * limitations under the License.
1922
- */function aE(t){t=Et(t,Ie);const e=Et(t.firestore,gn);return Vy(wr(e),t._key).then(n=>lE(e,t,n))}class ga extends nE{constructor(e){super(),this.firestore=e}convertBytes(e){return new _n(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Ie(this.firestore,null,n)}}function cE(t){t=Et(t,Ze);const e=Et(t.firestore,gn),n=wr(e),r=new ga(e);return Yy(t._query),Ly(n,t._query).then(s=>new iE(e,r,t,s))}function uE(t){return Nh(Et(t.firestore,gn),[new Ns(t._key,Pe.none())])}function Nh(t,e){return function(r,s){const i=new xe;return r.asyncQueue.enqueueAndForget(async()=>Ey(await Dy(r),s,i)),i.promise}(wr(t),e)}function lE(t,e,n){const r=n.docs.get(e._key),s=new ga(t);return new kh(t,s,e._key,r,new Pr(n.hasPendingWrites,n.fromCache),e.converter)}/**
1966
+ */function iy(n){n=He(n,De);const e=He(n.firestore,Dt);return O_(An(e),n._key).then(t=>Il(e,n,t))}class Ls extends ty{constructor(e){super(),this.firestore=e}convertBytes(e){return new Rn(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new De(this.firestore,null,t)}}function oy(n){n=He(n,tt);const e=He(n.firestore,Dt),t=An(e),r=new Ls(e);return hl(n._query),V_(t,n._query).then(s=>new El(e,r,n,s))}function ay(n){return wl(He(n.firestore,Dt),[new gs(n._key,je.none())])}function Tl(n,...e){var t,r,s;n=Y(n);let i={includeMetadataChanges:!1,source:"default"},a=0;typeof e[a]!="object"||rl(e[a])||(i=e[a],a++);const c={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(rl(e[a])){const g=e[a];e[a]=(t=g.next)===null||t===void 0?void 0:t.bind(g),e[a+1]=(r=g.error)===null||r===void 0?void 0:r.bind(g),e[a+2]=(s=g.complete)===null||s===void 0?void 0:s.bind(g)}let l,d,p;if(n instanceof De)d=He(n.firestore,Dt),p=as(n._key.path),l={next:g=>{e[a]&&e[a](Il(d,n,g))},error:e[a+1],complete:e[a+2]};else{const g=He(n,tt);d=He(g.firestore,Dt),p=g._query;const v=new Ls(d);l={next:R=>{e[a]&&e[a](new El(d,v,g,R))},error:e[a+1],complete:e[a+2]},hl(n._query)}return function(v,R,C,N){const S=new Io(N),U=new Eo(R,S,C);return v.asyncQueue.enqueueAndForget(async()=>go(await Rs(v),U)),()=>{S.za(),v.asyncQueue.enqueueAndForget(async()=>_o(await Rs(v),U))}}(An(d),p,c,l)}function wl(n,e){return function(r,s){const i=new Xe;return r.asyncQueue.enqueueAndForget(async()=>v_(await N_(r),s,i)),i.promise}(An(n),e)}function Il(n,e,t){const r=t.docs.get(e._key),s=new Ls(n);return new vl(n,s,e._key,r,new yr(t.hasPendingWrites,t.fromCache),e.converter)}/**
1923
1967
  * @license
1924
1968
  * Copyright 2022 Google LLC
1925
1969
  *
@@ -1934,7 +1978,7 @@ This typically indicates that your device does not have a healthy Internet conne
1934
1978
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1935
1979
  * See the License for the specific language governing permissions and
1936
1980
  * limitations under the License.
1937
- */function hE(t){return dE(t,{count:sE()})}function dE(t,e){const n=Et(t.firestore,gn),r=wr(n),s=function(o,a){const c=[];for(const u in o)Object.prototype.hasOwnProperty.call(o,u)&&c.push(a(o[u],u,o));return c}(e,(i,o)=>new Kg(o,i.aggregateType,i._internalFieldPath));return function(o,a,c){const u=new xe;return o.asyncQueue.enqueueAndForget(async()=>{try{const l=await Oy(o);u.resolve(Q_(l,a,c))}catch(l){u.reject(l)}}),u.promise}(r,t._query,s).then(i=>function(a,c,u){const l=new ga(a);return new qy(c,l,u)}(n,t,i))}/**
1981
+ */function cy(n){return uy(n,{count:ry()})}function uy(n,e){const t=He(n.firestore,Dt),r=An(t),s=lm(e,(i,a)=>new zm(a,i.aggregateType,i._internalFieldPath));return L_(r,n._query,s).then(i=>function(c,l,d){const p=new Ls(c);return new j_(l,p,d)}(t,n,i))}/**
1938
1982
  * @license
1939
1983
  * Copyright 2020 Google LLC
1940
1984
  *
@@ -1949,7 +1993,7 @@ This typically indicates that your device does not have a healthy Internet conne
1949
1993
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1950
1994
  * See the License for the specific language governing permissions and
1951
1995
  * limitations under the License.
1952
- */class fE{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=aa(e)}set(e,n,r){this._verifyNotCommitted();const s=_a(e,this._firestore),i=rE(s.converter,n,r),o=Hy(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(o.toMutation(s._key,Pe.none())),this}update(e,n,r,...s){this._verifyNotCommitted();const i=_a(e,this._firestore);let o;return o=typeof(n=M(n))=="string"||n instanceof $s?Gy(this._dataReader,"WriteBatch.update",i._key,n,r,s):Wy(this._dataReader,"WriteBatch.update",i._key,n),this._mutations.push(o.toMutation(i._key,Pe.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=_a(e,this._firestore);return this._mutations=this._mutations.concat(new Ns(n._key,Pe.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new _(p.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function _a(t,e){if((t=M(t)).firestore!==e)throw new _(p.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/**
1996
+ */class ly{constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=ko(e)}set(e,t,r){this._verifyNotCommitted();const s=Fo(e,this._firestore),i=ny(s.converter,t,r),a=H_(this._dataReader,"WriteBatch.set",s._key,i,s.converter!==null,r);return this._mutations.push(a.toMutation(s._key,je.none())),this}update(e,t,r,...s){this._verifyNotCommitted();const i=Fo(e,this._firestore);let a;return a=typeof(t=Y(t))=="string"||t instanceof Cs?G_(this._dataReader,"WriteBatch.update",i._key,t,r,s):W_(this._dataReader,"WriteBatch.update",i._key,t),this._mutations.push(a.toMutation(i._key,je.exists(!0))),this}delete(e){this._verifyNotCommitted();const t=Fo(e,this._firestore);return this._mutations=this._mutations.concat(new gs(t._key,je.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new O(P.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function Fo(n,e){if((n=Y(n)).firestore!==e)throw new O(P.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return n}/**
1953
1997
  * @license
1954
1998
  * Copyright 2020 Google LLC
1955
1999
  *
@@ -1964,13 +2008,13 @@ This typically indicates that your device does not have a healthy Internet conne
1964
2008
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1965
2009
  * See the License for the specific language governing permissions and
1966
2010
  * limitations under the License.
1967
- */function pE(t){return wr(t=Et(t,gn)),new fE(t,e=>Nh(t,e))}(function(e,n=!0){(function(s){tn=s})(Ct),ut(new Ke("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),a=new gn(new sg(r.getProvider("auth-internal")),new cg(r.getProvider("app-check-internal")),function(u,l){if(!Object.prototype.hasOwnProperty.apply(u.options,["projectId"]))throw new _(p.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new ur(u.options.projectId,l)}(o,s),o);return i=Object.assign({useFetchStreams:n},i),a._setSettings(i),a},"PUBLIC").setMultipleInstances(!0)),Ae(ku,"4.3.2",e),Ae(ku,"4.3.2","esm2017")})();class Dh{constructor(){this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}notify(e){this.subscribers.forEach(n=>n(e))}get subscribersCount(){return this.subscribers.size}}let Ks;const mE=new Uint8Array(16);function gE(){if(!Ks&&(Ks=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ks))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ks(mE)}const se=[];for(let t=0;t<256;++t)se.push((t+256).toString(16).slice(1));function _E(t,e=0){return se[t[e+0]]+se[t[e+1]]+se[t[e+2]]+se[t[e+3]]+"-"+se[t[e+4]]+se[t[e+5]]+"-"+se[t[e+6]]+se[t[e+7]]+"-"+se[t[e+8]]+se[t[e+9]]+"-"+se[t[e+10]]+se[t[e+11]]+se[t[e+12]]+se[t[e+13]]+se[t[e+14]]+se[t[e+15]]}const yE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Oh={randomUUID:yE};function EE(t,e,n){if(Oh.randomUUID&&!e&&!t)return Oh.randomUUID();t=t||{};const r=t.random||(t.rng||gE)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){n=n||0;for(let s=0;s<16;++s)e[n+s]=r[s];return e}return _E(r)}var vE=Object.defineProperty,TE=Object.getOwnPropertyDescriptor,IE=(t,e,n,r)=>{for(var s=r>1?void 0:r?TE(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&vE(e,n,s),s},Se;const Vh=(Se=class{static registerFactory(t,e,n){this._factoryMap[t]={factory:e,annotation:n}}static classFactory(t){if(!t)throw new Error("You should provide a class name.");if(!this._factoryMap[t])throw new Error(`You should register class ${t} prior to use.`);return this._factoryMap[t].factory}static registeredClasses(){return Object.keys(this._factoryMap)}static classesExtending(t){return Object.entries(this._factoryMap).filter(([,e])=>new e.factory instanceof t).map(([e])=>e)}static annotations(t){if(t instanceof Se?t=t.className:typeof t=="string"||(t=new t().className),!this._factoryMap[t])throw new Error(`You should register class ${t} prior to use.`);return this._factoryMap[t].annotation}constructor(t=EE()){this._id=t}get className(){return this.__className}setId(t){this._id=t}get id(){return this._id}afterDeserialize(){}beforeSerialize(){}getPersistentProperties(){return this._persistentProperties?this._persistentProperties.map(t=>({...t,name:t.name.slice(1)})):[]}getPropInfo(t){const e=this.getPersistentProperties().find(n=>n.name===t);if(!e)throw new Error(`Property "${t}" has not been registered.`);return e}isRequired(t){return this.getPropInfo(t).validator!=null}isPropValueValid(t){const e=this.getPropInfo(t);return e.validator?e.validator(this[e.name],e,this):!0}clone(t){const e=t.toObject();return delete e.id,this.fromObject(e)}fromObject(t){return this.fromObj(t),this.afterDeserialize(),this}fromObj(t){return this._persistentProperties?(this._persistentProperties.forEach(e=>{const n=this.removeUnderscore(e),r=t[n];r!=null&&(this[e.name]=this.fromDeepObject(r))}),this):this}toObject(){const t={},e=this.toObj(t);return this.pushDocument(t,this.className,e),{...e,__rootCollections:t}}toObj(t){if(!this._persistentProperties)return{};this.beforeSerialize();const e={};if(!this.className)throw new Error("You should register this class prior to streaming it.");return this._persistentProperties.forEach(n=>{const r=this[n.name],s=this.removeUnderscore(n);r!=null&&(n.isReference?e[s]=this.toReferenceObj(n,t):e[s]=this.toDeepObj(r,t),n.searchableArray&&(e[Se.searchableArrayNameFor(s)]=r.map(i=>i.id)))}),e.__className=this.className,e}static searchableArrayNameFor(t){return`__${t}_searchable`}fromDeepObject(t){if(t==null)return t;if(Array.isArray(t))return t.map(e=>this.fromDeepObject(e));if(t.__documentReference){const e=t,n=Se.createInstance(e);return n.__documentReference=t.__documentReference,n}if(t.__className)return Se.createInstance(t);if(typeof t=="object"){const e={};return Object.entries(t).forEach(([n,r])=>e[n]=this.fromDeepObject(r)),e}return t}toDeepObj(t,e){if(t!=null){if(Array.isArray(t))return t.map(n=>this.toDeepObj(n,e));if(t.__documentReference)return t;if(t instanceof Se)return t.toObj(e);if(typeof t=="object"){const n={};return Object.entries(t).forEach(([r,s])=>n[r]=this.toDeepObj(s,e)),n}return t}}toReferenceObj(t,e){const n=this[t.name],r=s=>{let i;return typeof t.storeInCollection=="function"?i=t.storeInCollection(s,t):i=t.storeInCollection||s.className,i};return Array.isArray(n)?n.map(s=>(t.isPureReference||this.pushDocument(e,r(s),s),this.buildRefObject(s,r(s),t.forcedPersistentProps))):(t.isPureReference||this.pushDocument(e,r(n),n),this.buildRefObject(n,r(n),t.forcedPersistentProps))}buildRefObject(t,e,n){const r=n==null?void 0:n.reduce((s,i)=>(t[i]!==void 0&&(s[i]=t[i]),s),{});return{id:t.id,__className:t.className||t.__className,__documentReference:{storedInCollection:e},...r}}pushDocument(t,e,n){if("__documentReference"in n&&n.__documentReference)return;t[e]||(t[e]=[]);const r=this.toDeepObj(n,t);t[e].push(r)}removeUnderscore(t){return t.name.slice(1)}static createReference(t){const e=Se.createInstance(t);return e.__documentReference=t.__documentReference||{storedInCollection:e.className},e}static createInstance(t){if(typeof t=="string")return new(Se.classFactory(t));try{return new(Se.classFactory(t.__className))().fromObject(t)}catch(e){const n=Object.entries(t).filter(([r,s])=>s!=null&&typeof s!="function").map(([r,s])=>`${r}: ${s}`).join(`,
2011
+ */function hy(n){return An(n=He(n,Dt)),new ly(n,e=>wl(n,e))}(function(e,t=!0){(function(s){ln=s})(qt),It(new ct("firestore",(r,{instanceIdentifier:s,options:i})=>{const a=r.getProvider("app").getImmediate(),c=new Dt(new Yp(r.getProvider("auth-internal")),new em(r.getProvider("app-check-internal")),function(d,p){if(!Object.prototype.hasOwnProperty.apply(d.options,["projectId"]))throw new O(P.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new nr(d.options.projectId,p)}(a,s),a);return i=Object.assign({useFetchStreams:t},i),c._setSettings(i),c},"PUBLIC").setMultipleInstances(!0)),Be(yc,"4.7.2",e),Be(yc,"4.7.2","esm2017")})();class Al{constructor(){this.subscribers=new Set}subscribe(e){return this.subscribers.add(e),()=>this.unsubscribe(e)}unsubscribe(e){this.subscribers.delete(e)}notify(e){this.subscribers.forEach(t=>t(e))}get subscribersCount(){return this.subscribers.size}}for(var ye=[],Bo=0;Bo<256;++Bo)ye.push((Bo+256).toString(16).slice(1));function dy(n,e=0){return(ye[n[e+0]]+ye[n[e+1]]+ye[n[e+2]]+ye[n[e+3]]+"-"+ye[n[e+4]]+ye[n[e+5]]+"-"+ye[n[e+6]]+ye[n[e+7]]+"-"+ye[n[e+8]]+ye[n[e+9]]+"-"+ye[n[e+10]]+ye[n[e+11]]+ye[n[e+12]]+ye[n[e+13]]+ye[n[e+14]]+ye[n[e+15]]).toLowerCase()}var Ms,fy=new Uint8Array(16);function py(){if(!Ms&&(Ms=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ms))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ms(fy)}var my=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Rl={randomUUID:my};function gy(n,e,t){if(Rl.randomUUID&&!e&&!n)return Rl.randomUUID();n=n||{};var r=n.random||(n.rng||py)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,dy(r)}var _y=Object.defineProperty,yy=(n,e,t,r)=>{for(var s=void 0,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=a(e,t,s)||s);return s&&_y(e,t,s),s},de;const bl=(de=class{static registerFactory(n,e,t){this._factoryMap[n]={factory:e,annotation:t}}static classFactory(n){if(!n)throw new Error("You should provide a class name.");if(!this._factoryMap[n])throw new Error(`You should register class ${n} prior to use.`);return this._factoryMap[n].factory}static registeredClasses(){return Object.keys(this._factoryMap)}static classesExtending(n){return Object.entries(this._factoryMap).filter(([,e])=>new e.factory instanceof n).map(([e])=>e)}static annotations(n){if(n instanceof de?n=n.className:typeof n=="string"||(n=new n().className),!this._factoryMap[n])throw new Error(`You should register class ${n} prior to use.`);return this._factoryMap[n].annotation}constructor(n=gy()){this._id=n}get className(){return this.__className}setId(n){this._id=n}get id(){return this._id}afterDeserialize(){}beforeSerialize(){}getPersistentProperties(){return this._persistentProperties?this._persistentProperties.map(n=>({...n,name:n.name.slice(1)})):[]}getPropInfo(n){const e=this.getPersistentProperties().find(t=>t.name===n);if(!e)throw new Error(`Property "${n}" has not been registered.`);return e}isRequired(n){return this.getPropInfo(n).validator!=null}isPropValueValid(n){const e=this.getPropInfo(n);return e.validator?e.validator(this[e.name],e,this):!0}clone(n){const e=n.toObject();return delete e.id,this.fromObject(e)}fromObject(n){return this.fromObj(n),this.afterDeserialize(),this}fromObj(n){return this._persistentProperties?(this._persistentProperties.forEach(e=>{const t=this.removeUnderscore(e),r=n[t];r!=null&&(this[e.name]=this.fromDeepObject(r))}),this):this}toObject(){const n={},e=this.toObj(n);return this.pushDocument(n,this.className,e),{...e,__rootCollections:n}}toObj(n){if(!this._persistentProperties)return{};this.beforeSerialize();const e={};if(!this.className)throw new Error("You should register this class prior to streaming it.");return this._persistentProperties.forEach(t=>{const r=this[t.name],s=this.removeUnderscore(t);r!=null&&(t.isReference?e[s]=this.toReferenceObj(t,n):e[s]=this.toDeepObj(r,n),t.searchableArray&&(e[de.searchableArrayNameFor(s)]=r.map(i=>i.id)))}),e.__className=this.className,e}static searchableArrayNameFor(n){return`__${n}_searchable`}fromDeepObject(n){if(n==null)return n;if(Array.isArray(n))return n.map(e=>this.fromDeepObject(e));if(n.__documentReference){const e=n,t=de.createInstance(e);return t.__documentReference=n.__documentReference,t}if(n.__className)return de.createInstance(n);if(typeof n=="object"){const e={};return Object.entries(n).forEach(([t,r])=>e[t]=this.fromDeepObject(r)),e}return n}toDeepObj(n,e){if(n!=null){if(Array.isArray(n))return n.map(t=>this.toDeepObj(t,e));if(n.__documentReference)return n;if(n instanceof de)return n.toObj(e);if(typeof n=="object"){const t={};return Object.entries(n).forEach(([r,s])=>t[r]=this.toDeepObj(s,e)),t}return n}}static collectionPath(n,e){let t;return typeof e.storeInCollection=="function"?t=e.storeInCollection(n,e):t=e.storeInCollection??n.className,t}toReferenceObj(n,e){var t;const r=this[n.name];return Array.isArray(r)?r.map(s=>{var i;return n.isPureReference||this.pushDocument(e,de.collectionPath(s,n),s),this.buildRefObject(s,de.collectionPath(s,n),(i=n.cachedPropsConfig)==null?void 0:i.cachedProps)}):(n.isPureReference||this.pushDocument(e,de.collectionPath(r,n),r),this.buildRefObject(r,de.collectionPath(r,n),(t=n.cachedPropsConfig)==null?void 0:t.cachedProps))}buildRefObject(n,e,t){const r=t==null?void 0:t.reduce((s,i)=>(n[i]!==void 0&&(s[i]=n[i]),s),{});return{id:n.id,__className:n.className||n.__className,__documentReference:{storedInCollection:e},...r}}pushDocument(n,e,t){if("__documentReference"in t&&t.__documentReference)return;n[e]||(n[e]=[]);const r=this.toDeepObj(t,n);n[e].push(r)}removeUnderscore(n){return n.name.slice(1)}static createReference(n){const e=de.createInstance(n);return e.__documentReference=n.__documentReference||{storedInCollection:e.className},e}static createInstance(n){if(typeof n=="string")return new(de.classFactory(n));try{return new(de.classFactory(n.__className))().fromObject(n)}catch(e){const t=Object.entries(n).filter(([r,s])=>s!=null&&typeof s!="function").map(([r,s])=>`${r}: ${s}`).join(`,
1968
2012
  `);throw new Error(`${e}
1969
2013
  -----> Class name not found in object:
1970
2014
  {
1971
- ${n}
2015
+ ${t}
1972
2016
  }
1973
- `)}}static propInfo(t,e){return Se.createInstance(t).getPropInfo(e)}},Se._factoryMap={},Se);IE([En],Vh.prototype,"_id",2);let Qs=Vh;function En(t,e){return wE()(t,e)}function wE(t){return function(e,n){Object.getOwnPropertyDescriptor(e,"_persistentProperties")||(e._persistentProperties?e._persistentProperties=[...e._persistentProperties]:e._persistentProperties=[]);const r=e._persistentProperties.find(s=>s.name===n);r?Object.assign(r,t):e._persistentProperties.push({name:n,...t})}}function AE(t,e){return n=>{Qs.registerFactory(t,n,e),n.prototype.__className=t}}class Ys{static toPropertyPathOperations(e){return e?e.map(n=>{if(Ys.isArrayOperator(n.operator)&&n.value[0]instanceof Qs)return{property:Qs.searchableArrayNameFor(n.property),operator:n.operator,value:n.value.map(i=>i.id),aggregate:n.aggregate};const[r,s]=this.toPropertyPathValue(n.value);return{property:`${String(n.property)}${r?"."+r:""}`,operator:n.operator,value:s,aggregate:n.aggregate}}):[]}static isArrayOperator(e){return e==="containsAny"||e==="contains"}static toPropertyPathValue(e){if(typeof e=="object"&&!Array.isArray(e)){const n=Object.keys(e)[0],[r,s]=this.toPropertyPathValue(e[n]);return[`${n}${r?"."+r:""}`,s]}else return[void 0,e]}}const Lh=class bn{static registerCloudStorage(e,n){bn._cloudStorageFactoryMap[e]=n}static createInstance(e){const n=bn._cloudStorageFactoryMap[e];if(!n)throw new Error(`You should register the ${e} cloud storage provider prior to use it`);return n()}get className(){return this.__className}static useCloudStorage(e){bn._defaultCloudStorage=e}static get defaultCloudStorage(){if(!bn._defaultCloudStorage)throw new Error("You should define a default cloud storage provider prior to use it");return bn._defaultCloudStorage}};Lh._cloudStorageFactoryMap={};let vn=Lh;function Mh(t,e){return vn.registerCloudStorage(t,e),n=>{n.prototype.__className=t}}var RE=Object.defineProperty,PE=Object.getOwnPropertyDescriptor,SE=(t,e,n,r)=>{for(var s=r>1?void 0:r?PE(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&RE(e,n,s),s};let ya=class extends vn{constructor(t=""){super(),this._simulateDelay=0,this._pendingPromises=[],this.mockFileSystem={},this._pathToMockFiles=t}simulateDelay(t){return this._simulateDelay=t,this}resolveWithDelay(t){if(this._simulateDelay<=0)return Promise.resolve(t);const e=new Promise(n=>{setTimeout(()=>n(t),this._simulateDelay)});return this._pendingPromises.push(e),e.finally(()=>this._pendingPromises=this._pendingPromises.filter(n=>n===e)),e}save(t,e){const n=t;this._onProgress&&this._onProgress(0,100),this.mockFileSystem[t]=JSON.stringify(e),this._onProgress&&this._onProgress(100,100);const r=e instanceof File?e.name:n;return this.resolveWithDelay(r)}uploadControl(){return{resume:()=>{},pause:()=>{},cancel:()=>{},onProgress:t=>this._onProgress=t}}getUrl(t){return Promise.resolve(this._pathToMockFiles+t)}delete(t){return delete this.mockFileSystem[t],this.resolveWithDelay()}};ya=SE([Mh("MockCloudStorage",()=>new ya)],ya);var CE=Object.defineProperty,bE=Object.getOwnPropertyDescriptor,Tn=(t,e,n,r)=>{for(var s=r>1?void 0:r?bE(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&CE(e,n,s),s};let Bt=class extends Qs{constructor(){super(...arguments),this._onChange=new Dh}async save({data:t,fileName:e,progress:n,cloudStorageProvider:r}={}){const s=t||this._pendingData;s&&(this._reference&&await this.delete(),this.provider=r||vn.defaultCloudStorage,this._originalFileName=e||(s instanceof File?s.name:void 0),this._reference=await this.provider.save(this.id,s,n),this._url=await this.provider.getUrl(this._reference),this._pendingData=void 0,this._onChange.notify({event:0,storedFile:this}))}uploadControl(){return this.provider.uploadControl()}async delete(){if(!this._reference)throw new Error("Cannot delete a not stored file");await this.provider.delete(this._reference),this._reference=void 0,this._url=void 0,this._onChange.notify({event:2,storedFile:this})}set provider(t){this._provider=t,this._cloudStorageProviderName=t.className}get provider(){if(!this._provider)try{this._provider=vn.createInstance(this._cloudStorageProviderName)}catch{this._provider=vn.defaultCloudStorage}return this._provider}get url(){return this._url}get mimeType(){return this._mimeType}setDataToStore(t){return this._pendingData=t,this._originalFileName=t instanceof File?t.name:void 0,this._mimeType=t instanceof Blob?t.type:void 0,this._onChange.notify({event:1,pendingData:t,storedFile:this}),this}get originalFileName(){return this._originalFileName}onChange(t){return this._onChange.subscribe(t)}};Tn([En],Bt.prototype,"_reference",2),Tn([En],Bt.prototype,"_url",2),Tn([En],Bt.prototype,"_cloudStorageProviderName",2),Tn([En],Bt.prototype,"_originalFileName",2),Tn([En],Bt.prototype,"_mimeType",2),Bt=Tn([AE("StoredFile")],Bt);class Uh{}const xh=class ye extends Uh{constructor(){if(super(),this._onAuthStateChange=new Dh,!ye._authService)throw new Error(ye.error.shouldBeRegistered);ye._authService.onAuthStateChange(e=>this.authStateChanged(e))}static useAuthService(e){ye._authService!=e&&(ye._authService=e,this._instance=void 0)}static get instance(){return this._instance||(this._instance=new this)}signUp(e){return ye._authService.signUp(e)}login(e){return ye._authService.login(e)}logout(){return ye._authService.logout()}resetEmailPassword(e){return ye._authService.resetEmailPassword(e)}resendVerificationEmail(e,n,r){return ye._authService.resendVerificationEmail(e,n,r)}refreshToken(){return ye._authService.refreshToken()}onAuthStateChange(e){return this._onAuthStateChange.subscribe(e)}removeAuthStateChange(e){this._onAuthStateChange.unsubscribe(e)}linkAdditionalProvider(e){return ye._authService.linkAdditionalProvider(e)}unlinkProvider(e){return ye._authService.unlinkProvider(e)}authStateChanged(e){this._onAuthStateChange.notify(e)}};xh.error={shouldBeRegistered:"You should register an auth service before using Auth."},xh._instance=void 0;function Xs(t){return t?t.replace(/([-_ ][\w])/g,e=>e.toUpperCase().replace("-","").replace("_","").replace(" ","")):""}var kE="firebase",NE="10.6.0";/**
2017
+ `)}}static propInfo(n,e){return de.createInstance(n).getPropInfo(e)}static getSystemRegisteredReferencesWithCachedProps(){return de.registeredClasses().reduce((n,e)=>{const t=de.createInstance(e).getPersistentProperties().filter(r=>{var s;return(s=r.cachedPropsConfig)==null?void 0:s.cachedProps});return t.length>0&&(n[e]=t),n},{})}},de._factoryMap={},de);yy([Pn],bl.prototype,"_id");let fe=bl;function Pn(n,e){return vy()(n,e)}function vy(n){return function(e,t){Object.getOwnPropertyDescriptor(e,"_persistentProperties")||(e._persistentProperties?e._persistentProperties=[...e._persistentProperties]:e._persistentProperties=[]);const r=e._persistentProperties.find(s=>s.name===t);r?Object.assign(r,n):e._persistentProperties.push({name:t,...n})}}function Ey(n,e){return t=>{fe.registerFactory(n,t,e),t.prototype.__className=n}}const Pl=class _f{constructor(e,t,r){if(r){if(!(t instanceof fe))throw new Error(_f.error.persistentNeedForSubCollection);this.collectionName=`${t.className}/${t.id}/${r}`}else this.collectionName=t instanceof fe?t.className:t;this._stream=e}findById(e,t){return new Promise((r,s)=>{this._stream.findById(e,this.collectionName).then(i=>{i?(t?t.fromObject(i):t=fe.createInstance(i),r(t)):r(void 0)}).catch(i=>s(i))})}save(e){const t=e.toObject();return this.collectionName!==t.__className&&(t.__rootCollections[this.collectionName]=t.__rootCollections[t.__className],delete t.__rootCollections[t.__className]),new Promise((r,s)=>{this._stream.save(t.__rootCollections).then(()=>r()).catch(i=>s(i))})}delete(e){return new Promise((t,r)=>{this._stream.delete(e,this.collectionName).then(()=>t()).catch(s=>r(s))})}find(){return new Ty(this)}query(e={},t){if(t){const r=t instanceof fe?t.className:t;e.operations||(e.operations=[]),e.operations.push({property:"__className",operator:"==",value:r})}return this.mapToInstance(()=>this._stream.find(this.preprocessQueryObject(e),this.collectionName))}count(e){return this._stream.count(e,this.collectionName)}next(e){return this.mapToInstance(()=>this._stream.next(e))}onDocumentChange(e,t){return this._stream.onDocumentChange(this.collectionName,e,r=>t(this.toPersistentChangeObject(r)))}onCollectionChange(e,t){return this._stream.onCollectionChange(e.getQueryObject(),this.collectionName,r=>t(this.toPersistentChangeObject(r)))}toPersistentChangeObject(e){return{...e,before:e.before&&fe.createInstance(e.before),after:e.after&&fe.createInstance(e.after)}}mapToInstance(e){return new Promise((t,r)=>{e().then(s=>t(s.map(i=>fe.createInstance(i)))).catch(s=>r(s))})}preprocessQueryObject(e){var t;if(Object.values(e).length===0)return e;const r=((t=e.operations)==null?void 0:t.map(s=>{const i=s.value[0]??s.value;return Xt.isArrayOperator(s.operator)&&i instanceof fe?{property:fe.searchableArrayNameFor(s.property),operator:s.operator,value:Array.isArray(s.value)?s.value.map(a=>a.id):i.id,aggregate:s.aggregate}:{property:s.property,operator:s.operator,value:s.value instanceof fe?{id:s.value.id}:s.value,aggregate:s.aggregate}}))??[];return{...e,operations:r}}};Pl.error={persistentNeedForSubCollection:"The document parameter for a sub-collection should be a Persistent instace",invalidQueryOrder:"Cannot add where calls after or calls"};let Us=Pl;class Ty{constructor(e){this.queryObject={operations:[]},this.model=e}where(e,t,r,s){var i,a,c;if((a=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&a.aggregate&&!s)throw new Error(Us.error.invalidQueryOrder);return(c=this.queryObject.operations)==null||c.push({property:e,operator:t,value:r,aggregate:s}),this}whereDeepProp(e,t,r,s){var i,a,c;if((a=(i=this.queryObject.operations)==null?void 0:i.at(-1))!=null&&a.aggregate&&!s)throw new Error(Us.error.invalidQueryOrder);const l=e.split(".");let d={},p=l.length>1?d:r;return l.slice(1).forEach((g,v)=>{d[g]=v<l.length-2?{}:r,d=d[g]}),(c=this.queryObject.operations)==null||c.push({property:l[0],operator:t,value:p,aggregate:s}),this}and(e,t,r){return this.where(e,t,r)}andDeepProp(e,t,r){return this.whereDeepProp(e,t,r)}or(e,t,r){return this.where(e,t,r,!0)}orDeepProp(e,t,r){return this.whereDeepProp(e,t,r,!0)}instanceOf(e){var t;const r=e instanceof fe?e.className:e;return(t=this.queryObject.operations)==null||t.push({property:"__className",operator:"==",value:r}),this}get(e){return e&&(this.queryObject.limit=e),this.model.query(this.queryObject)}limit(e){return this.queryObject.limit=e,this}orderBy(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}orderByDeepProp(e,t="asc"){return this.queryObject.sort={propertyName:e,order:t},this}count(){return this.model.count(this.queryObject)}getQueryObject(){return this.queryObject}}const Sl=class qn{constructor(){}static useDataSource(e){this._dataSource=e}static get dataSource(){return qn._dataSource}static getModel(e){if(!qn._dataSource)throw new Error(this.error.shouldBeRegistered);return new Us(qn._dataSource,e)}static getModelForSubCollection(e,t){if(!qn._dataSource)throw new Error(this.error.shouldBeRegistered);return new Us(qn._dataSource,e,t)}static async populate(e){if(!e)return;const t=async r=>{const s=r;if(!s.__documentReference)return r;const i=await this.getModel(s.__documentReference.storedInCollection).findById(s.id,r);return i&&(i.__documentReference=void 0),i};return Array.isArray(e)?(await Promise.all(e.map(r=>t(r)))).filter(r=>r):t(e)}static isPopulated(e){return Array.isArray(e)?e.reduce((t,r)=>t&&r.__documentReference===void 0,!0):e.__documentReference===void 0}};Sl.error={shouldBeRegistered:"You should register a data source before using the data Store."};let wy=Sl;class Xt{installCachedPropsUpdaters(e={}){Xt.onUpdate=e.onUpdate;const t=fe.getSystemRegisteredReferencesWithCachedProps(),r={};Object.entries(t).forEach(([i,a])=>{a.forEach(c=>{const l=fe.collectionPath(fe.createInstance(i),c);r[l]||(r[l]=[]),r[l].push({prop:c,collectionPropOwner:i})})});const s=[];return Object.entries(r).forEach(([i,a])=>{const c=this.subscribeToDocumentChangeListerner(i,l=>Xt.onDocumentChange(l,a));if(c)s.push(c);else if(e.noThrowOnNonImplementedListener)throw new Error("The method documentChangeListerner has not been implemented in the concrete data source")}),s}subscribeToDocumentChangeListerner(e,t){}static toPropertyPathOperations(e){return e?e.map(t=>{if(Xt.isArrayOperator(t.operator)&&t.value[0]instanceof fe)return{property:fe.searchableArrayNameFor(t.property),operator:t.operator,value:t.value.map(i=>i.id),aggregate:t.aggregate};const[r,s]=this.toPropertyPathValue(t.value);return{property:`${String(t.property)}${r?"."+r:""}`,operator:t.operator,value:s,aggregate:t.aggregate}}):[]}static isArrayOperator(e){return e==="containsAny"||e==="contains"}static toPropertyPathValue(e){if(typeof e=="object"&&!Array.isArray(e)){const t=Object.keys(e)[0],[r,s]=this.toPropertyPathValue(e[t]);return[`${t}${r?"."+r:""}`,s]}else return[void 0,e]}static async onDocumentChange(e,t){if(e.before)return t.map(async r=>{var s,i;const a=wy.getModel(r.collectionPropOwner);let c=a.find();(i=(s=r.prop.cachedPropsConfig)==null?void 0:s.cachedProps)==null||i.forEach(d=>{var p,g;const v=(p=e.before)==null?void 0:p[d],R=(g=e.after)==null?void 0:g[d];v!==R&&(c=c.orDeepProp(`${r.prop.name}.${d}`,"==",v))});const l=await c.get();return Promise.all([l.map(async d=>{var p,g;(g=(p=r.prop.cachedPropsConfig)==null?void 0:p.cachedProps)==null||g.forEach(async v=>{var R,C,N;const S=(R=e.before)==null?void 0:R[v],U=(C=e.after)==null?void 0:C[v];S!==U&&(d[`_${r.prop.name}`][`_${v}`]=U,await a.save(d),(N=this.onUpdate)==null||N.call(this,d,r.prop))})})])})}}const Cl=class $n{static registerCloudStorage(e,t){$n._cloudStorageFactoryMap[e]=t}static createInstance(e){const t=$n._cloudStorageFactoryMap[e];if(!t)throw new Error(`You should register the ${e} cloud storage provider prior to use it`);return t()}get className(){return this.__className}static useCloudStorage(e){$n._defaultCloudStorage=e}static get defaultCloudStorage(){if(!$n._defaultCloudStorage)throw new Error("You should define a default cloud storage provider prior to use it");return $n._defaultCloudStorage}};Cl._cloudStorageFactoryMap={};let Sn=Cl;function kl(n,e){return Sn.registerCloudStorage(n,e),t=>{t.prototype.__className=n}}var Iy=(n,e,t,r)=>{for(var s=e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=a(s)||s);return s};let jo=class extends Sn{constructor(n=""){super(),this._simulateDelay=0,this._pendingPromises=[],this.mockFileSystem={},this._pathToMockFiles=n}simulateDelay(n){return this._simulateDelay=n,this}resolveWithDelay(n){if(this._simulateDelay<=0)return Promise.resolve(n);const e=new Promise(t=>{setTimeout(()=>t(n),this._simulateDelay)});return this._pendingPromises.push(e),e.finally(()=>this._pendingPromises=this._pendingPromises.filter(t=>t===e)),e}save(n,e){const t=n;this._onProgress&&this._onProgress(0,100),this.mockFileSystem[n]=JSON.stringify(e),this._onProgress&&this._onProgress(100,100);const r=e instanceof File?e.name:t;return this.resolveWithDelay(r)}uploadControl(){return{resume:()=>{},pause:()=>{},cancel:()=>{},onProgress:n=>this._onProgress=n}}getUrl(n){return Promise.resolve(this._pathToMockFiles+n)}delete(n){return delete this.mockFileSystem[n],this.resolveWithDelay()}};jo=Iy([kl("MockCloudStorage",()=>new jo)],jo);var Ay=Object.defineProperty,Ry=Object.getOwnPropertyDescriptor,Cn=(n,e,t,r)=>{for(var s=r>1?void 0:r?Ry(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=(r?a(e,t,s):a(s))||s);return r&&s&&Ay(e,t,s),s};let Jt=class extends fe{constructor(){super(...arguments),this._onChange=new Al}async save({data:n,fileName:e,progress:t,cloudStorageProvider:r}={}){const s=n||this._pendingData;s&&(this._reference&&await this.delete(),this.provider=r||Sn.defaultCloudStorage,this._originalFileName=e||(s instanceof File?s.name:void 0),this._reference=await this.provider.save(this.id,s,t),this._url=await this.provider.getUrl(this._reference),this._pendingData=void 0,this._onChange.notify({event:0,storedFile:this}))}uploadControl(){return this.provider.uploadControl()}async delete(){if(!this._reference)throw new Error("Cannot delete a not stored file");await this.provider.delete(this._reference),this._reference=void 0,this._url=void 0,this._onChange.notify({event:2,storedFile:this})}set provider(n){this._provider=n,this._cloudStorageProviderName=n.className}get provider(){if(!this._provider)try{this._provider=Sn.createInstance(this._cloudStorageProviderName)}catch{this._provider=Sn.defaultCloudStorage}return this._provider}get url(){return this._url}get mimeType(){return this._mimeType}setDataToStore(n){return this._pendingData=n,this._originalFileName=n instanceof File?n.name:void 0,this._mimeType=n instanceof Blob?n.type:void 0,this._onChange.notify({event:1,pendingData:n,storedFile:this}),this}get originalFileName(){return this._originalFileName}onChange(n){return this._onChange.subscribe(n)}};Cn([Pn],Jt.prototype,"_reference",2),Cn([Pn],Jt.prototype,"_url",2),Cn([Pn],Jt.prototype,"_cloudStorageProviderName",2),Cn([Pn],Jt.prototype,"_originalFileName",2),Cn([Pn],Jt.prototype,"_mimeType",2),Jt=Cn([Ey("StoredFile")],Jt);class Nl{}const Dl=class Ve extends Nl{constructor(){if(super(),this._onAuthStateChange=new Al,!Ve._authService)throw new Error(Ve.error.shouldBeRegistered);Ve._authService.onAuthStateChange(e=>this.authStateChanged(e))}static useAuthService(e){Ve._authService!=e&&(Ve._authService=e,this._instance=void 0)}static get instance(){return this._instance||(this._instance=new this)}signUp(e){return Ve._authService.signUp(e)}login(e){return Ve._authService.login(e)}logout(){return Ve._authService.logout()}resetEmailPassword(e){return Ve._authService.resetEmailPassword(e)}resendVerificationEmail(e,t,r){return Ve._authService.resendVerificationEmail(e,t,r)}refreshToken(){return Ve._authService.refreshToken()}onAuthStateChange(e){return this._onAuthStateChange.subscribe(e)}removeAuthStateChange(e){this._onAuthStateChange.unsubscribe(e)}linkAdditionalProvider(e){return Ve._authService.linkAdditionalProvider(e)}unlinkProvider(e){return Ve._authService.unlinkProvider(e)}authStateChanged(e){this._onAuthStateChange.notify(e)}};Dl.error={shouldBeRegistered:"You should register an auth service before using Auth."},Dl._instance=void 0;function xs(n){return n?n.replace(/([-_ ][\w])/g,e=>e.toUpperCase().replace("-","").replace("_","").replace(" ","")):""}var by="firebase",Py="10.13.2";/**
1974
2018
  * @license
1975
2019
  * Copyright 2020 Google LLC
1976
2020
  *
@@ -1985,7 +2029,7 @@ This typically indicates that your device does not have a healthy Internet conne
1985
2029
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1986
2030
  * See the License for the specific language governing permissions and
1987
2031
  * limitations under the License.
1988
- */Ae(kE,NE,"app");function Ea(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,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}typeof SuppressedError=="function"&&SuppressedError;function Fh(){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 DE=Fh,Bh=new kn("auth","Firebase",Fh());/**
2032
+ */Be(by,Py,"app");function qo(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(t[r[s]]=n[r[s]]);return t}typeof SuppressedError=="function"&&SuppressedError;function Ol(){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 Sy=Ol,Vl=new zn("auth","Firebase",Ol());/**
1989
2033
  * @license
1990
2034
  * Copyright 2020 Google LLC
1991
2035
  *
@@ -2000,7 +2044,7 @@ This typically indicates that your device does not have a healthy Internet conne
2000
2044
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2001
2045
  * See the License for the specific language governing permissions and
2002
2046
  * limitations under the License.
2003
- */const Js=new vi("@firebase/auth");function OE(t,...e){Js.logLevel<=D.WARN&&Js.warn(`Auth (${Ct}): ${t}`,...e)}function Zs(t,...e){Js.logLevel<=D.ERROR&&Js.error(`Auth (${Ct}): ${t}`,...e)}/**
2047
+ */const Fs=new Ai("@firebase/auth");function Cy(n,...e){Fs.logLevel<=W.WARN&&Fs.warn(`Auth (${qt}): ${n}`,...e)}function Bs(n,...e){Fs.logLevel<=W.ERROR&&Fs.error(`Auth (${qt}): ${n}`,...e)}/**
2004
2048
  * @license
2005
2049
  * Copyright 2020 Google LLC
2006
2050
  *
@@ -2015,7 +2059,7 @@ This typically indicates that your device does not have a healthy Internet conne
2015
2059
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2016
2060
  * See the License for the specific language governing permissions and
2017
2061
  * limitations under the License.
2018
- */function Ce(t,...e){throw va(t,...e)}function $e(t,...e){return va(t,...e)}function qh(t,e,n){const r=Object.assign(Object.assign({},DE()),{[e]:n});return new kn("auth","Firebase",r).create(e,{appName:t.name})}function $h(t,e,n){const r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&Ce(t,"argument-error"),qh(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function va(t,...e){if(typeof t!="string"){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return Bh.create(t,...e)}function w(t,e,...n){if(!t)throw va(e,...n)}function et(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Zs(e),new Error(e)}function tt(t,e){t||et(e)}/**
2062
+ */function qe(n,...e){throw zo(n,...e)}function We(n,...e){return zo(n,...e)}function $o(n,e,t){const r=Object.assign(Object.assign({},Sy()),{[e]:t});return new zn("auth","Firebase",r).create(e,{appName:n.name})}function nt(n){return $o(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Ll(n,e,t){const r=t;if(!(e instanceof r))throw r.name!==e.constructor.name&&qe(n,"argument-error"),$o(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function zo(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return Vl.create(n,...e)}function M(n,e,...t){if(!n)throw zo(e,...t)}function dt(n){const e="INTERNAL ASSERTION FAILED: "+n;throw Bs(e),new Error(e)}function ft(n,e){n||dt(e)}/**
2019
2063
  * @license
2020
2064
  * Copyright 2020 Google LLC
2021
2065
  *
@@ -2030,7 +2074,7 @@ This typically indicates that your device does not have a healthy Internet conne
2030
2074
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2031
2075
  * See the License for the specific language governing permissions and
2032
2076
  * limitations under the License.
2033
- */function Ta(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.href)||""}function VE(){return jh()==="http:"||jh()==="https:"}function jh(){var t;return typeof self<"u"&&((t=self.location)===null||t===void 0?void 0:t.protocol)||null}/**
2077
+ */function Ho(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function ky(){return Ml()==="http:"||Ml()==="https:"}function Ml(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
2034
2078
  * @license
2035
2079
  * Copyright 2020 Google LLC
2036
2080
  *
@@ -2045,7 +2089,7 @@ This typically indicates that your device does not have a healthy Internet conne
2045
2089
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2046
2090
  * See the License for the specific language governing permissions and
2047
2091
  * limitations under the License.
2048
- */function LE(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(VE()||Df()||"connection"in navigator)?navigator.onLine:!0}function ME(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
2092
+ */function Ny(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ky()||Cf()||"connection"in navigator)?navigator.onLine:!0}function Dy(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
2049
2093
  * @license
2050
2094
  * Copyright 2020 Google LLC
2051
2095
  *
@@ -2060,7 +2104,7 @@ This typically indicates that your device does not have a healthy Internet conne
2060
2104
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2061
2105
  * See the License for the specific language governing permissions and
2062
2106
  * limitations under the License.
2063
- */class Sr{constructor(e,n){this.shortDelay=e,this.longDelay=n,tt(n>e,"Short delay should be less than long delay!"),this.isMobile=kf()||Of()}get(){return LE()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
2107
+ */class vr{constructor(e,t){this.shortDelay=e,this.longDelay=t,ft(t>e,"Short delay should be less than long delay!"),this.isMobile=bf()||kf()}get(){return Ny()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
2064
2108
  * @license
2065
2109
  * Copyright 2020 Google LLC
2066
2110
  *
@@ -2075,7 +2119,7 @@ This typically indicates that your device does not have a healthy Internet conne
2075
2119
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2076
2120
  * See the License for the specific language governing permissions and
2077
2121
  * limitations under the License.
2078
- */function Ia(t,e){tt(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
2122
+ */function Wo(n,e){ft(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
2079
2123
  * @license
2080
2124
  * Copyright 2020 Google LLC
2081
2125
  *
@@ -2090,7 +2134,7 @@ This typically indicates that your device does not have a healthy Internet conne
2090
2134
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2091
2135
  * See the License for the specific language governing permissions and
2092
2136
  * limitations under the License.
2093
- */class zh{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;et("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;et("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;et("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
2137
+ */class Ul{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;dt("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;dt("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;dt("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
2094
2138
  * @license
2095
2139
  * Copyright 2020 Google LLC
2096
2140
  *
@@ -2105,7 +2149,7 @@ This typically indicates that your device does not have a healthy Internet conne
2105
2149
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2106
2150
  * See the License for the specific language governing permissions and
2107
2151
  * limitations under the License.
2108
- */const UE={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:"missing-password",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",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
2152
+ */const Oy={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:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",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",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
2109
2153
  * @license
2110
2154
  * Copyright 2020 Google LLC
2111
2155
  *
@@ -2120,7 +2164,7 @@ This typically indicates that your device does not have a healthy Internet conne
2120
2164
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2121
2165
  * See the License for the specific language governing permissions and
2122
2166
  * limitations under the License.
2123
- */const xE=new Sr(3e4,6e4);function nt(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function De(t,e,n,r,s={}){return Hh(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const a=Nn(Object.assign({key:t.config.apiKey},o)).slice(1),c=await t._getAdditionalHeaders();return c["Content-Type"]="application/json",t.languageCode&&(c["X-Firebase-Locale"]=t.languageCode),zh.fetch()(Wh(t,t.config.apiHost,n,a),Object.assign({method:e,headers:c,referrerPolicy:"no-referrer"},i))})}async function Hh(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},UE),e);try{const s=new BE(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw ei(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const a=i.ok?o.errorMessage:o.error.message,[c,u]=a.split(" : ");if(c==="FEDERATED_USER_ID_ALREADY_LINKED")throw ei(t,"credential-already-in-use",o);if(c==="EMAIL_EXISTS")throw ei(t,"email-already-in-use",o);if(c==="USER_DISABLED")throw ei(t,"user-disabled",o);const l=r[c]||c.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw qh(t,l,u);Ce(t,l)}}catch(s){if(s instanceof be)throw s;Ce(t,"network-request-failed",{message:String(s)})}}async function Cr(t,e,n,r,s={}){const i=await De(t,e,n,r,s);return"mfaPendingCredential"in i&&Ce(t,"multi-factor-auth-required",{_serverResponse:i}),i}function Wh(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Ia(t.config,s):`${t.config.apiScheme}://${s}`}function FE(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class BE{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r($e(this.auth,"network-request-failed")),xE.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function ei(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=$e(t,e,r);return s.customData._tokenResponse=n,s}function Gh(t){return t!==void 0&&t.enterprise!==void 0}class qE{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return FE(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function $E(t,e){return De(t,"GET","/v2/recaptchaConfig",nt(t,e))}/**
2167
+ */const Vy=new vr(3e4,6e4);function pt(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function Ge(n,e,t,r,s={}){return xl(n,s,async()=>{let i={},a={};r&&(e==="GET"?a=r:i={body:JSON.stringify(r)});const c=Hn(Object.assign({key:n.config.apiKey},a)).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);const d=Object.assign({method:e,headers:l},i);return Sf()||(d.referrerPolicy="no-referrer"),Ul.fetch()(Fl(n,n.config.apiHost,t,c),d)})}async function xl(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},Oy),e);try{const s=new My(n),i=await Promise.race([t(),s.promise]);s.clearNetworkTimeout();const a=await i.json();if("needConfirmation"in a)throw js(n,"account-exists-with-different-credential",a);if(i.ok&&!("errorMessage"in a))return a;{const c=i.ok?a.errorMessage:a.error.message,[l,d]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw js(n,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw js(n,"email-already-in-use",a);if(l==="USER_DISABLED")throw js(n,"user-disabled",a);const p=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(d)throw $o(n,p,d);qe(n,p)}}catch(s){if(s instanceof $e)throw s;qe(n,"network-request-failed",{message:String(s)})}}async function Er(n,e,t,r,s={}){const i=await Ge(n,e,t,r,s);return"mfaPendingCredential"in i&&qe(n,"multi-factor-auth-required",{_serverResponse:i}),i}function Fl(n,e,t,r){const s=`${e}${t}?${r}`;return n.config.emulator?Wo(n.config,s):`${n.config.apiScheme}://${s}`}function Ly(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class My{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(We(this.auth,"network-request-failed")),Vy.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function js(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const s=We(n,e,r);return s.customData._tokenResponse=t,s}function Bl(n){return n!==void 0&&n.enterprise!==void 0}class Uy{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return Ly(t.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}}async function xy(n,e){return Ge(n,"GET","/v2/recaptchaConfig",pt(n,e))}/**
2124
2168
  * @license
2125
2169
  * Copyright 2020 Google LLC
2126
2170
  *
@@ -2135,7 +2179,7 @@ This typically indicates that your device does not have a healthy Internet conne
2135
2179
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2136
2180
  * See the License for the specific language governing permissions and
2137
2181
  * limitations under the License.
2138
- */async function jE(t,e){return De(t,"POST","/v1/accounts:delete",e)}async function zE(t,e){return De(t,"POST","/v1/accounts:update",e)}async function HE(t,e){return De(t,"POST","/v1/accounts:lookup",e)}/**
2182
+ */async function Fy(n,e){return Ge(n,"POST","/v1/accounts:delete",e)}async function By(n,e){return Ge(n,"POST","/v1/accounts:update",e)}async function jl(n,e){return Ge(n,"POST","/v1/accounts:lookup",e)}/**
2139
2183
  * @license
2140
2184
  * Copyright 2020 Google LLC
2141
2185
  *
@@ -2150,7 +2194,7 @@ This typically indicates that your device does not have a healthy Internet conne
2150
2194
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2151
2195
  * See the License for the specific language governing permissions and
2152
2196
  * limitations under the License.
2153
- */function br(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function WE(t,e=!1){const n=M(t),r=await n.getIdToken(e),s=Aa(r);w(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:br(wa(s.auth_time)),issuedAtTime:br(wa(s.iat)),expirationTime:br(wa(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function wa(t){return Number(t)*1e3}function Aa(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Zs("JWT malformed, contained fewer than 3 sections"),null;try{const s=Ya(n);return s?JSON.parse(s):(Zs("Failed to decode base64 JWT payload"),null)}catch(s){return Zs("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function GE(t){const e=Aa(t);return w(e,"internal-error"),w(typeof e.exp<"u","internal-error"),w(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
2197
+ */function Tr(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function jy(n,e=!1){const t=Y(n),r=await t.getIdToken(e),s=Ko(r);M(s&&s.exp&&s.auth_time&&s.iat,t.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,a=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Tr(Go(s.auth_time)),issuedAtTime:Tr(Go(s.iat)),expirationTime:Tr(Go(s.exp)),signInProvider:a||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function Go(n){return Number(n)*1e3}function Ko(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return Bs("JWT malformed, contained fewer than 3 sections"),null;try{const s=Ha(t);return s?JSON.parse(s):(Bs("Failed to decode base64 JWT payload"),null)}catch(s){return Bs("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function ql(n){const e=Ko(n);return M(e,"internal-error"),M(typeof e.exp<"u","internal-error"),M(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
2154
2198
  * @license
2155
2199
  * Copyright 2020 Google LLC
2156
2200
  *
@@ -2165,7 +2209,7 @@ This typically indicates that your device does not have a healthy Internet conne
2165
2209
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2166
2210
  * See the License for the specific language governing permissions and
2167
2211
  * limitations under the License.
2168
- */async function In(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof be&&KE(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function KE({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
2212
+ */async function kn(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof $e&&qy(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function qy({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
2169
2213
  * @license
2170
2214
  * Copyright 2020 Google LLC
2171
2215
  *
@@ -2180,7 +2224,7 @@ This typically indicates that your device does not have a healthy Internet conne
2180
2224
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2181
2225
  * See the License for the specific language governing permissions and
2182
2226
  * limitations under the License.
2183
- */class QE{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var n;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const s=((n=this.user.stsTokenManager.expirationTime)!==null&&n!==void 0?n:0)-Date.now()-3e5;return Math.max(0,s)}}schedule(e=!1){if(!this.isRunning)return;const n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
2227
+ */class $y{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const s=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,s)}}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){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
2184
2228
  * @license
2185
2229
  * Copyright 2020 Google LLC
2186
2230
  *
@@ -2195,7 +2239,7 @@ This typically indicates that your device does not have a healthy Internet conne
2195
2239
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2196
2240
  * See the License for the specific language governing permissions and
2197
2241
  * limitations under the License.
2198
- */class Kh{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=br(this.lastLoginAt),this.creationTime=br(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
2242
+ */class Qo{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Tr(this.lastLoginAt),this.creationTime=Tr(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
2199
2243
  * @license
2200
2244
  * Copyright 2019 Google LLC
2201
2245
  *
@@ -2210,7 +2254,7 @@ This typically indicates that your device does not have a healthy Internet conne
2210
2254
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2211
2255
  * See the License for the specific language governing permissions and
2212
2256
  * limitations under the License.
2213
- */async function kr(t){var e;const n=t.auth,r=await t.getIdToken(),s=await In(t,HE(n,{idToken:r}));w(s==null?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?JE(i.providerUserInfo):[],a=XE(t.providerData,o),c=t.isAnonymous,u=!(t.email&&i.passwordHash)&&!(a!=null&&a.length),l=c?u:!1,h={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 Kh(i.createdAt,i.lastLoginAt),isAnonymous:l};Object.assign(t,h)}async function YE(t){const e=M(t);await kr(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function XE(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function JE(t){return t.map(e=>{var{providerId:n}=e,r=Ea(e,["providerId"]);return{providerId:n,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
2257
+ */async function wr(n){var e;const t=n.auth,r=await n.getIdToken(),s=await kn(n,jl(t,{idToken:r}));M(s==null?void 0:s.users.length,t,"internal-error");const i=s.users[0];n._notifyReloadListener(i);const a=!((e=i.providerUserInfo)===null||e===void 0)&&e.length?$l(i.providerUserInfo):[],c=Hy(n.providerData,a),l=n.isAnonymous,d=!(n.email&&i.passwordHash)&&!(c!=null&&c.length),p=l?d:!1,g={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:c,metadata:new Qo(i.createdAt,i.lastLoginAt),isAnonymous:p};Object.assign(n,g)}async function zy(n){const e=Y(n);await wr(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Hy(n,e){return[...n.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function $l(n){return n.map(e=>{var{providerId:t}=e,r=qo(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
2214
2258
  * @license
2215
2259
  * Copyright 2020 Google LLC
2216
2260
  *
@@ -2225,7 +2269,7 @@ This typically indicates that your device does not have a healthy Internet conne
2225
2269
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2226
2270
  * See the License for the specific language governing permissions and
2227
2271
  * limitations under the License.
2228
- */async function ZE(t,e){const n=await Hh(t,{},async()=>{const r=Nn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=Wh(t,s,"/v1/token",`key=${i}`),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/x-www-form-urlencoded",zh.fetch()(o,{method:"POST",headers:a,body:r})});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function ev(t,e){return De(t,"POST","/v2/accounts:revokeToken",nt(t,e))}/**
2272
+ */async function Wy(n,e){const t=await xl(n,{},async()=>{const r=Hn({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=n.config,a=Fl(n,s,"/v1/token",`key=${i}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",Ul.fetch()(a,{method:"POST",headers:c,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Gy(n,e){return Ge(n,"POST","/v2/accounts:revokeToken",pt(n,e))}/**
2229
2273
  * @license
2230
2274
  * Copyright 2020 Google LLC
2231
2275
  *
@@ -2240,7 +2284,7 @@ This typically indicates that your device does not have a healthy Internet conne
2240
2284
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2241
2285
  * See the License for the specific language governing permissions and
2242
2286
  * limitations under the License.
2243
- */class Nr{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){w(e.idToken,"internal-error"),w(typeof e.idToken<"u","internal-error"),w(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):GE(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}async getToken(e,n=!1){return w(!this.accessToken||this.refreshToken,e,"user-token-expired"),!n&&this.accessToken&&!this.isExpired?this.accessToken:this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){const{accessToken:r,refreshToken:s,expiresIn:i}=await ZE(e,n);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){const{refreshToken:r,accessToken:s,expirationTime:i}=n,o=new Nr;return r&&(w(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(w(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(w(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),o}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 Nr,this.toJSON())}_performRefresh(){return et("not implemented")}}/**
2287
+ */class Nn{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){M(e.idToken,"internal-error"),M(typeof e.idToken<"u","internal-error"),M(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):ql(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){M(e.length!==0,"internal-error");const t=ql(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&this.accessToken&&!this.isExpired?this.accessToken:(M(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:s,expiresIn:i}=await Wy(e,t);this.updateTokensAndExpiration(r,s,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:s,expirationTime:i}=t,a=new Nn;return r&&(M(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),s&&(M(typeof s=="string","internal-error",{appName:e}),a.accessToken=s),i&&(M(typeof i=="number","internal-error",{appName:e}),a.expirationTime=i),a}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 Nn,this.toJSON())}_performRefresh(){return dt("not implemented")}}/**
2244
2288
  * @license
2245
2289
  * Copyright 2020 Google LLC
2246
2290
  *
@@ -2255,7 +2299,7 @@ This typically indicates that your device does not have a healthy Internet conne
2255
2299
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2256
2300
  * See the License for the specific language governing permissions and
2257
2301
  * limitations under the License.
2258
- */function Tt(t,e){w(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class qt{constructor(e){var{uid:n,auth:r,stsTokenManager:s}=e,i=Ea(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new QE(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=n,this.auth=r,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Kh(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const n=await In(this,this.stsTokenManager.getToken(this.auth,e));return w(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return WE(this,e)}reload(){return YE(this)}_assign(e){this!==e&&(w(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(n=>Object.assign({},n)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new qt(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return n.metadata._copy(this.metadata),n}_onReload(e){w(!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,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await kr(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await In(this,jE(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,n){var r,s,i,o,a,c,u,l;const h=(r=n.displayName)!==null&&r!==void 0?r:void 0,d=(s=n.email)!==null&&s!==void 0?s:void 0,f=(i=n.phoneNumber)!==null&&i!==void 0?i:void 0,E=(o=n.photoURL)!==null&&o!==void 0?o:void 0,v=(a=n.tenantId)!==null&&a!==void 0?a:void 0,g=(c=n._redirectEventId)!==null&&c!==void 0?c:void 0,k=(u=n.createdAt)!==null&&u!==void 0?u:void 0,O=(l=n.lastLoginAt)!==null&&l!==void 0?l:void 0,{uid:b,emailVerified:U,isAnonymous:me,providerData:de,stsTokenManager:ot}=n;w(b&&ot,e,"internal-error");const Rt=Nr.fromJSON(this.name,ot);w(typeof b=="string",e,"internal-error"),Tt(h,e.name),Tt(d,e.name),w(typeof U=="boolean",e,"internal-error"),w(typeof me=="boolean",e,"internal-error"),Tt(f,e.name),Tt(E,e.name),Tt(v,e.name),Tt(g,e.name),Tt(k,e.name),Tt(O,e.name);const at=new qt({uid:b,auth:e,email:d,emailVerified:U,displayName:h,isAnonymous:me,photoURL:E,phoneNumber:f,tenantId:v,stsTokenManager:Rt,createdAt:k,lastLoginAt:O});return de&&Array.isArray(de)&&(at.providerData=de.map(_i=>Object.assign({},_i))),g&&(at._redirectEventId=g),at}static async _fromIdTokenResponse(e,n,r=!1){const s=new Nr;s.updateFromServerResponse(n);const i=new qt({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await kr(i),i}}/**
2302
+ */function Ot(n,e){M(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class mt{constructor(e){var{uid:t,auth:r,stsTokenManager:s}=e,i=qo(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new $y(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Qo(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await kn(this,this.stsTokenManager.getToken(this.auth,e));return M(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return jy(this,e)}reload(){return zy(this)}_assign(e){this!==e&&(M(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(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new mt(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){M(!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 r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await wr(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Fe(this.auth.app))return Promise.reject(nt(this.auth));const e=await this.getIdToken();return await kn(this,Fy(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 r,s,i,a,c,l,d,p;const g=(r=t.displayName)!==null&&r!==void 0?r:void 0,v=(s=t.email)!==null&&s!==void 0?s:void 0,R=(i=t.phoneNumber)!==null&&i!==void 0?i:void 0,C=(a=t.photoURL)!==null&&a!==void 0?a:void 0,N=(c=t.tenantId)!==null&&c!==void 0?c:void 0,S=(l=t._redirectEventId)!==null&&l!==void 0?l:void 0,U=(d=t.createdAt)!==null&&d!==void 0?d:void 0,$=(p=t.lastLoginAt)!==null&&p!==void 0?p:void 0,{uid:x,emailVerified:z,isAnonymous:le,providerData:J,stsTokenManager:T}=t;M(x&&T,e,"internal-error");const m=Nn.fromJSON(this.name,T);M(typeof x=="string",e,"internal-error"),Ot(g,e.name),Ot(v,e.name),M(typeof z=="boolean",e,"internal-error"),M(typeof le=="boolean",e,"internal-error"),Ot(R,e.name),Ot(C,e.name),Ot(N,e.name),Ot(S,e.name),Ot(U,e.name),Ot($,e.name);const _=new mt({uid:x,auth:e,email:v,emailVerified:z,displayName:g,isAnonymous:le,photoURL:C,phoneNumber:R,tenantId:N,stsTokenManager:m,createdAt:U,lastLoginAt:$});return J&&Array.isArray(J)&&(_.providerData=J.map(E=>Object.assign({},E))),S&&(_._redirectEventId=S),_}static async _fromIdTokenResponse(e,t,r=!1){const s=new Nn;s.updateFromServerResponse(t);const i=new mt({uid:t.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await wr(i),i}static async _fromGetAccountInfoResponse(e,t,r){const s=t.users[0];M(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?$l(s.providerUserInfo):[],a=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),c=new Nn;c.updateFromIdToken(r);const l=new mt({uid:s.localId,auth:e,stsTokenManager:c,isAnonymous:a}),d={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:i,metadata:new Qo(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(l,d),l}}/**
2259
2303
  * @license
2260
2304
  * Copyright 2020 Google LLC
2261
2305
  *
@@ -2270,7 +2314,7 @@ This typically indicates that your device does not have a healthy Internet conne
2270
2314
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2271
2315
  * See the License for the specific language governing permissions and
2272
2316
  * limitations under the License.
2273
- */const Qh=new Map;function rt(t){tt(t instanceof Function,"Expected a class definition");let e=Qh.get(t);return e?(tt(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Qh.set(t,e),e)}/**
2317
+ */const zl=new Map;function gt(n){ft(n instanceof Function,"Expected a class definition");let e=zl.get(n);return e?(ft(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,zl.set(n,e),e)}/**
2274
2318
  * @license
2275
2319
  * Copyright 2019 Google LLC
2276
2320
  *
@@ -2285,7 +2329,7 @@ This typically indicates that your device does not have a healthy Internet conne
2285
2329
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2286
2330
  * See the License for the specific language governing permissions and
2287
2331
  * limitations under the License.
2288
- */class Yh{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){const n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}}Yh.type="NONE";const Xh=Yh;/**
2332
+ */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 t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Hl.type="NONE";const Wl=Hl;/**
2289
2333
  * @license
2290
2334
  * Copyright 2019 Google LLC
2291
2335
  *
@@ -2300,7 +2344,7 @@ This typically indicates that your device does not have a healthy Internet conne
2300
2344
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2301
2345
  * See the License for the specific language governing permissions and
2302
2346
  * limitations under the License.
2303
- */function ti(t,e,n){return`firebase:${t}:${e}:${n}`}class wn{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=ti(this.userKey,s.apiKey,i),this.fullPersistenceKey=ti("persistence",s.apiKey,i),this.boundEventHandler=n._onStorageEvent.bind(n),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?qt._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 n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new wn(rt(Xh),e,r);const s=(await Promise.all(n.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let i=s[0]||rt(Xh);const o=ti(r,e.config.apiKey,e.name);let a=null;for(const u of n)try{const l=await u._get(o);if(l){const h=qt._fromJSON(e,l);u!==i&&(a=h),i=u;break}}catch{}const c=s.filter(u=>u._shouldAllowMigration);return!i._shouldAllowMigration||!c.length?new wn(i,e,r):(i=c[0],a&&await i._set(o,a.toJSON()),await Promise.all(n.map(async u=>{if(u!==i)try{await u._remove(o)}catch{}})),new wn(i,e,r))}}/**
2347
+ */function qs(n,e,t){return`firebase:${n}:${e}:${t}`}class Dn{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=qs(this.userKey,s.apiKey,i),this.fullPersistenceKey=qs("persistence",s.apiKey,i),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?mt._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();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new Dn(gt(Wl),e,r);const s=(await Promise.all(t.map(async d=>{if(await d._isAvailable())return d}))).filter(d=>d);let i=s[0]||gt(Wl);const a=qs(r,e.config.apiKey,e.name);let c=null;for(const d of t)try{const p=await d._get(a);if(p){const g=mt._fromJSON(e,p);d!==i&&(c=g),i=d;break}}catch{}const l=s.filter(d=>d._shouldAllowMigration);return!i._shouldAllowMigration||!l.length?new Dn(i,e,r):(i=l[0],c&&await i._set(a,c.toJSON()),await Promise.all(t.map(async d=>{if(d!==i)try{await d._remove(a)}catch{}})),new Dn(i,e,r))}}/**
2304
2348
  * @license
2305
2349
  * Copyright 2020 Google LLC
2306
2350
  *
@@ -2315,7 +2359,7 @@ This typically indicates that your device does not have a healthy Internet conne
2315
2359
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2316
2360
  * See the License for the specific language governing permissions and
2317
2361
  * limitations under the License.
2318
- */function Jh(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(td(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Zh(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(rd(e))return"Blackberry";if(sd(e))return"Webos";if(Ra(e))return"Safari";if((e.includes("chrome/")||ed(e))&&!e.includes("edge/"))return"Chrome";if(nd(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function Zh(t=ie()){return/firefox\//i.test(t)}function Ra(t=ie()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ed(t=ie()){return/crios\//i.test(t)}function td(t=ie()){return/iemobile/i.test(t)}function nd(t=ie()){return/android/i.test(t)}function rd(t=ie()){return/blackberry/i.test(t)}function sd(t=ie()){return/webos/i.test(t)}function ni(t=ie()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function tv(t=ie()){var e;return ni(t)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function nv(){return Vf()&&document.documentMode===10}function id(t=ie()){return ni(t)||nd(t)||sd(t)||rd(t)||/windows phone/i.test(t)||td(t)}function rv(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
2362
+ */function Gl(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Xl(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Kl(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Zl(e))return"Blackberry";if(eh(e))return"Webos";if(Ql(e))return"Safari";if((e.includes("chrome/")||Yl(e))&&!e.includes("edge/"))return"Chrome";if(Jl(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function Kl(n=Ee()){return/firefox\//i.test(n)}function Ql(n=Ee()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Yl(n=Ee()){return/crios\//i.test(n)}function Xl(n=Ee()){return/iemobile/i.test(n)}function Jl(n=Ee()){return/android/i.test(n)}function Zl(n=Ee()){return/blackberry/i.test(n)}function eh(n=Ee()){return/webos/i.test(n)}function Yo(n=Ee()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Ky(n=Ee()){var e;return Yo(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Qy(){return Nf()&&document.documentMode===10}function th(n=Ee()){return Yo(n)||Jl(n)||eh(n)||Zl(n)||/windows phone/i.test(n)||Xl(n)}/**
2319
2363
  * @license
2320
2364
  * Copyright 2020 Google LLC
2321
2365
  *
@@ -2330,7 +2374,7 @@ This typically indicates that your device does not have a healthy Internet conne
2330
2374
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2331
2375
  * See the License for the specific language governing permissions and
2332
2376
  * limitations under the License.
2333
- */function od(t,e=[]){let n;switch(t){case"Browser":n=Jh(ie());break;case"Worker":n=`${Jh(ie())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ct}/${r}`}/**
2377
+ */function nh(n,e=[]){let t;switch(n){case"Browser":t=Gl(Ee());break;case"Worker":t=`${Gl(Ee())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${qt}/${r}`}/**
2334
2378
  * @license
2335
2379
  * Copyright 2022 Google LLC
2336
2380
  *
@@ -2345,7 +2389,7 @@ This typically indicates that your device does not have a healthy Internet conne
2345
2389
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2346
2390
  * See the License for the specific language governing permissions and
2347
2391
  * limitations under the License.
2348
- */class sv{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,a)=>{try{const c=e(i);o(c)}catch(c){a(c)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(const s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
2392
+ */class Yy{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=i=>new Promise((a,c)=>{try{const l=e(i);a(l)}catch(l){c(l)}});r.onAbort=t,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const s of t)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
2349
2393
  * @license
2350
2394
  * Copyright 2023 Google LLC
2351
2395
  *
@@ -2360,7 +2404,7 @@ This typically indicates that your device does not have a healthy Internet conne
2360
2404
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2361
2405
  * See the License for the specific language governing permissions and
2362
2406
  * limitations under the License.
2363
- */async function iv(t,e={}){return De(t,"GET","/v2/passwordPolicy",nt(t,e))}/**
2407
+ */async function Xy(n,e={}){return Ge(n,"GET","/v2/passwordPolicy",pt(n,e))}/**
2364
2408
  * @license
2365
2409
  * Copyright 2023 Google LLC
2366
2410
  *
@@ -2375,7 +2419,7 @@ This typically indicates that your device does not have a healthy Internet conne
2375
2419
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2376
2420
  * See the License for the specific language governing permissions and
2377
2421
  * limitations under the License.
2378
- */const ov=6;class av{constructor(e){var n,r,s,i;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(n=o.minPasswordLength)!==null&&n!==void 0?n:ov,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(i=e.forceUpgradeOnSignin)!==null&&i!==void 0?i:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var n,r,s,i,o,a;const c={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,c),this.validatePasswordCharacterOptions(e,c),c.isValid&&(c.isValid=(n=c.meetsMinPasswordLength)!==null&&n!==void 0?n:!0),c.isValid&&(c.isValid=(r=c.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),c.isValid&&(c.isValid=(s=c.containsLowercaseLetter)!==null&&s!==void 0?s:!0),c.isValid&&(c.isValid=(i=c.containsUppercaseLetter)!==null&&i!==void 0?i:!0),c.isValid&&(c.isValid=(o=c.containsNumericCharacter)!==null&&o!==void 0?o:!0),c.isValid&&(c.isValid=(a=c.containsNonAlphanumericCharacter)!==null&&a!==void 0?a:!0),c}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
2422
+ */const Jy=6;class Zy{constructor(e){var t,r,s,i;const a=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=a.minPasswordLength)!==null&&t!==void 0?t:Jy,a.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=a.maxPasswordLength),a.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=a.containsLowercaseCharacter),a.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=a.containsUppercaseCharacter),a.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=a.containsNumericCharacter),a.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=a.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(s=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&s!==void 0?s:"",this.forceUpgradeOnSignin=(i=e.forceUpgradeOnSignin)!==null&&i!==void 0?i:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,s,i,a,c;const l={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,l),this.validatePasswordCharacterOptions(e,l),l.isValid&&(l.isValid=(t=l.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),l.isValid&&(l.isValid=(r=l.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),l.isValid&&(l.isValid=(s=l.containsLowercaseLetter)!==null&&s!==void 0?s:!0),l.isValid&&(l.isValid=(i=l.containsUppercaseLetter)!==null&&i!==void 0?i:!0),l.isValid&&(l.isValid=(a=l.containsNumericCharacter)!==null&&a!==void 0?a:!0),l.isValid&&(l.isValid=(c=l.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),l}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),s&&(t.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
2379
2423
  * @license
2380
2424
  * Copyright 2020 Google LLC
2381
2425
  *
@@ -2390,7 +2434,7 @@ This typically indicates that your device does not have a healthy Internet conne
2390
2434
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2391
2435
  * See the License for the specific language governing permissions and
2392
2436
  * limitations under the License.
2393
- */class cv{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new ad(this),this.idTokenSubscription=new ad(this),this.beforeStateQueue=new sv(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Bh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=rt(n)),this._initializationPromise=this.queue(async()=>{var r,s;if(!this._deleted&&(this.persistenceManager=await wn.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var n;const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(n=this.redirectUser)===null||n===void 0?void 0:n._redirectEventId,a=s==null?void 0:s._redirectEventId,c=await this.tryRedirectSignIn(e);(!o||o===a)&&(c!=null&&c.user)&&(s=c.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(o){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return w(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}async tryRedirectSignIn(e){let n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await kr(e)}catch(n){if((n==null?void 0:n.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=ME()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const n=e?M(e):null;return n&&w(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&w(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||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(rt(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await iv(this),n=new av(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new kn("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await ev(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,n){const r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&rt(e)||this._popupRedirectResolver;w(n,this,"argument-error"),this.redirectPersistenceManager=await wn.create(this,[rt(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,r;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)===null||n===void 0?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._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,n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=(n=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&n!==void 0?n:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const a=this._isInitialized?Promise.resolve():this._initializationPromise;if(w(a,this,"internal-error"),a.then(()=>{o||i(this.currentUser)}),typeof n=="function"){const c=e.addObserver(n,r,s);return()=>{o=!0,c()}}else{const c=e.addObserver(n);return()=>{o=!0,c()}}}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 w(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=od(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const n={"X-Client-Version":this.clientVersion};this.app.options.appId&&(n["X-Firebase-gmpid"]=this.app.options.appId);const r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(n["X-Firebase-Client"]=r);const s=await this._getAppCheckToken();return s&&(n["X-Firebase-AppCheck"]=s),n}async _getAppCheckToken(){var e;const n=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return n!=null&&n.error&&OE(`Error while retrieving App Check token: ${n.error}`),n==null?void 0:n.token}}function je(t){return M(t)}class ad{constructor(e){this.auth=e,this.observer=null,this.addObserver=qf(n=>this.observer=n)}get next(){return w(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
2437
+ */class ev{constructor(e,t,r,s){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new rh(this),this.idTokenSubscription=new rh(this),this.beforeStateQueue=new Yy(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Vl,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=gt(t)),this._initializationPromise=this.queue(async()=>{var r,s;if(!this._deleted&&(this.persistenceManager=await Dn.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((s=this.currentUser)===null||s===void 0?void 0:s.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{const t=await jl(this,{idToken:e}),r=await mt._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(Fe(this.app)){const a=this.app.settings.authIdToken;return a?new Promise(c=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(a).then(c,c))}):this.directlySetCurrentUser(null)}const r=await this.assertedPersistence.getCurrentUser();let s=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const a=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=s==null?void 0:s._redirectEventId,l=await this.tryRedirectSignIn(e);(!a||a===c)&&(l!=null&&l.user)&&(s=l.user,i=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(s)}catch(a){s=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(a))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return M(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await wr(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Dy()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Fe(this.app))return Promise.reject(nt(this));const t=e?Y(e):null;return t&&M(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&&M(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 Fe(this.app)?Promise.reject(nt(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Fe(this.app)?Promise.reject(nt(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(gt(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Xy(this),t=new Zy(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new zn("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(r.tenantId=this.tenantId),await Gy(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&gt(e)||this._popupRedirectResolver;M(t,this,"argument-error"),this.redirectPersistenceManager=await Dn.create(this,[gt(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue(async()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?void 0:r._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 r=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,s){if(this._deleted)return()=>{};const i=typeof t=="function"?t:t.next.bind(t);let a=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(M(c,this,"internal-error"),c.then(()=>{a||i(this.currentUser)}),typeof t=="function"){const l=e.addObserver(t,r,s);return()=>{a=!0,l()}}else{const l=e.addObserver(t);return()=>{a=!0,l()}}}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 M(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=nh(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 r=await((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const s=await this._getAppCheckToken();return s&&(t["X-Firebase-AppCheck"]=s),t}async _getAppCheckToken(){var e;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&Cy(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function rt(n){return Y(n)}class rh{constructor(e){this.auth=e,this.observer=null,this.addObserver=Ff(t=>this.observer=t)}get next(){return M(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
2394
2438
  * @license
2395
2439
  * Copyright 2020 Google LLC
2396
2440
  *
@@ -2405,7 +2449,7 @@ This typically indicates that your device does not have a healthy Internet conne
2405
2449
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2406
2450
  * See the License for the specific language governing permissions and
2407
2451
  * limitations under the License.
2408
- */function uv(){var t,e;return(e=(t=document.getElementsByTagName("head"))===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:document}function cd(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=$e("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",uv().appendChild(r)})}function lv(t){return`__${t}${Math.floor(Math.random()*1e6)}`}const hv="https://www.google.com/recaptcha/enterprise.js?render=",dv="recaptcha-enterprise",fv="NO_RECAPTCHA";class pv{constructor(e){this.type=dv,this.auth=je(e)}async verify(e="verify",n=!1){async function r(i){if(!n){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,a)=>{$E(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(c=>{if(c.recaptchaKey===void 0)a(new Error("recaptcha Enterprise site key undefined"));else{const u=new qE(c);return i.tenantId==null?i._agentRecaptchaConfig=u:i._tenantRecaptchaConfigs[i.tenantId]=u,o(u.siteKey)}}).catch(c=>{a(c)})})}function s(i,o,a){const c=window.grecaptcha;Gh(c)?c.enterprise.ready(()=>{c.enterprise.execute(i,{action:e}).then(u=>{o(u)}).catch(()=>{o(fv)})}):a(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((i,o)=>{r(this.auth).then(a=>{if(!n&&Gh(window.grecaptcha))s(a,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}cd(hv+a).then(()=>{s(a,i,o)}).catch(c=>{o(c)})}}).catch(a=>{o(a)})})}}async function ud(t,e,n,r=!1){const s=new pv(t);let i;try{i=await s.verify(n)}catch{i=await s.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:i}):Object.assign(o,{captchaResponse:i}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function ri(t,e,n,r){var s;if(!((s=t._getRecaptchaConfig())===null||s===void 0)&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await ud(t,e,n,n==="getOobCode");return r(t,i)}else return r(t,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const o=await ud(t,e,n,n==="getOobCode");return r(t,o)}else return Promise.reject(i)})}/**
2452
+ */let $s={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function tv(n){$s=n}function sh(n){return $s.loadJS(n)}function nv(){return $s.recaptchaEnterpriseScript}function rv(){return $s.gapiScript}function sv(n){return`__${n}${Math.floor(Math.random()*1e6)}`}const iv="recaptcha-enterprise",ov="NO_RECAPTCHA";class av{constructor(e){this.type=iv,this.auth=rt(e)}async verify(e="verify",t=!1){async function r(i){if(!t){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(a,c)=>{xy(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const d=new Uy(l);return i.tenantId==null?i._agentRecaptchaConfig=d:i._tenantRecaptchaConfigs[i.tenantId]=d,a(d.siteKey)}}).catch(l=>{c(l)})})}function s(i,a,c){const l=window.grecaptcha;Bl(l)?l.enterprise.ready(()=>{l.enterprise.execute(i,{action:e}).then(d=>{a(d)}).catch(()=>{a(ov)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((i,a)=>{r(this.auth).then(c=>{if(!t&&Bl(window.grecaptcha))s(c,i,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=nv();l.length!==0&&(l+=c),sh(l).then(()=>{s(c,i,a)}).catch(d=>{a(d)})}}).catch(c=>{a(c)})})}}async function ih(n,e,t,r=!1){const s=new av(n);let i;try{i=await s.verify(t)}catch{i=await s.verify(t,!0)}const a=Object.assign({},e);return r?Object.assign(a,{captchaResp:i}):Object.assign(a,{captchaResponse:i}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function zs(n,e,t,r){var s;if(!((s=n._getRecaptchaConfig())===null||s===void 0)&&s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const i=await ih(n,e,t,t==="getOobCode");return r(n,i)}else return r(n,e).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const a=await ih(n,e,t,t==="getOobCode");return r(n,a)}else return Promise.reject(i)})}/**
2409
2453
  * @license
2410
2454
  * Copyright 2020 Google LLC
2411
2455
  *
@@ -2420,7 +2464,7 @@ This typically indicates that your device does not have a healthy Internet conne
2420
2464
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2421
2465
  * See the License for the specific language governing permissions and
2422
2466
  * limitations under the License.
2423
- */function mv(t,e){const n=Vn(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(Br(i,e??{}))return s;Ce(s,"already-initialized")}return n.initialize({options:e})}function gv(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(rt);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function ld(t,e,n){const r=je(t);w(r._canInitEmulator,r,"emulator-config-failed"),w(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(n!=null&&n.disableWarnings),i=hd(e),{host:o,port:a}=_v(e),c=a===null?"":`:${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||yv()}function hd(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function _v(t){const e=hd(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 i=s[1];return{host:i,port:dd(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:dd(o)}}}function dd(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function yv(){function t(){const e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",t):t())}/**
2467
+ */function cv(n,e){const t=Kn(n,"auth");if(t.isInitialized()){const s=t.getImmediate(),i=t.getOptions();if(Qr(i,e??{}))return s;qe(s,"already-initialized")}return t.initialize({options:e})}function uv(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(gt);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function oh(n,e,t){const r=rt(n);M(r._canInitEmulator,r,"emulator-config-failed"),M(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=ah(e),{host:a,port:c}=lv(e),l=c===null?"":`:${c}`;r.config.emulator={url:`${i}//${a}${l}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:a,port:c,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),hv()}function ah(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function lv(n){const e=ah(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:ch(r.substr(i.length+1))}}else{const[i,a]=r.split(":");return{host:i,port:ch(a)}}}function ch(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function hv(){function n(){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)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
2424
2468
  * @license
2425
2469
  * Copyright 2020 Google LLC
2426
2470
  *
@@ -2435,7 +2479,7 @@ This typically indicates that your device does not have a healthy Internet conne
2435
2479
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2436
2480
  * See the License for the specific language governing permissions and
2437
2481
  * limitations under the License.
2438
- */class Pa{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return et("not implemented")}_getIdTokenResponse(e){return et("not implemented")}_linkToIdToken(e,n){return et("not implemented")}_getReauthenticationResolver(e){return et("not implemented")}}async function Ev(t,e){return De(t,"POST","/v1/accounts:signUp",e)}/**
2482
+ */class Xo{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return dt("not implemented")}_getIdTokenResponse(e){return dt("not implemented")}_linkToIdToken(e,t){return dt("not implemented")}_getReauthenticationResolver(e){return dt("not implemented")}}async function dv(n,e){return Ge(n,"POST","/v1/accounts:signUp",e)}/**
2439
2483
  * @license
2440
2484
  * Copyright 2020 Google LLC
2441
2485
  *
@@ -2450,7 +2494,7 @@ This typically indicates that your device does not have a healthy Internet conne
2450
2494
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2451
2495
  * See the License for the specific language governing permissions and
2452
2496
  * limitations under the License.
2453
- */async function vv(t,e){return Cr(t,"POST","/v1/accounts:signInWithPassword",nt(t,e))}async function fd(t,e){return De(t,"POST","/v1/accounts:sendOobCode",nt(t,e))}async function Tv(t,e){return fd(t,e)}async function Iv(t,e){return fd(t,e)}/**
2497
+ */async function fv(n,e){return Er(n,"POST","/v1/accounts:signInWithPassword",pt(n,e))}async function uh(n,e){return Ge(n,"POST","/v1/accounts:sendOobCode",pt(n,e))}async function pv(n,e){return uh(n,e)}async function mv(n,e){return uh(n,e)}/**
2454
2498
  * @license
2455
2499
  * Copyright 2020 Google LLC
2456
2500
  *
@@ -2465,7 +2509,7 @@ This typically indicates that your device does not have a healthy Internet conne
2465
2509
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2466
2510
  * See the License for the specific language governing permissions and
2467
2511
  * limitations under the License.
2468
- */async function wv(t,e){return Cr(t,"POST","/v1/accounts:signInWithEmailLink",nt(t,e))}async function Av(t,e){return Cr(t,"POST","/v1/accounts:signInWithEmailLink",nt(t,e))}/**
2512
+ */async function gv(n,e){return Er(n,"POST","/v1/accounts:signInWithEmailLink",pt(n,e))}async function _v(n,e){return Er(n,"POST","/v1/accounts:signInWithEmailLink",pt(n,e))}/**
2469
2513
  * @license
2470
2514
  * Copyright 2020 Google LLC
2471
2515
  *
@@ -2480,7 +2524,7 @@ This typically indicates that your device does not have a healthy Internet conne
2480
2524
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2481
2525
  * See the License for the specific language governing permissions and
2482
2526
  * limitations under the License.
2483
- */class Dr extends Pa{constructor(e,n,r,s=null){super("password",r),this._email=e,this._password=n,this._tenantId=s}static _fromEmailAndPassword(e,n){return new Dr(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new Dr(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e;if(n!=null&&n.email&&(n!=null&&n.password)){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ri(e,n,"signInWithPassword",vv);case"emailLink":return wv(e,{email:this._email,oobCode:this._password});default:Ce(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ri(e,r,"signUpPassword",Ev);case"emailLink":return Av(e,{idToken:n,email:this._email,oobCode:this._password});default:Ce(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
2527
+ */class Ir extends Xo{constructor(e,t,r,s=null){super("password",r),this._email=e,this._password=t,this._tenantId=s}static _fromEmailAndPassword(e,t){return new Ir(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Ir(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":const t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return zs(e,t,"signInWithPassword",fv);case"emailLink":return gv(e,{email:this._email,oobCode:this._password});default:qe(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":const r={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return zs(e,r,"signUpPassword",dv);case"emailLink":return _v(e,{idToken:t,email:this._email,oobCode:this._password});default:qe(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
2484
2528
  * @license
2485
2529
  * Copyright 2020 Google LLC
2486
2530
  *
@@ -2495,7 +2539,7 @@ This typically indicates that your device does not have a healthy Internet conne
2495
2539
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2496
2540
  * See the License for the specific language governing permissions and
2497
2541
  * limitations under the License.
2498
- */async function An(t,e){return Cr(t,"POST","/v1/accounts:signInWithIdp",nt(t,e))}/**
2542
+ */async function On(n,e){return Er(n,"POST","/v1/accounts:signInWithIdp",pt(n,e))}/**
2499
2543
  * @license
2500
2544
  * Copyright 2020 Google LLC
2501
2545
  *
@@ -2510,7 +2554,7 @@ This typically indicates that your device does not have a healthy Internet conne
2510
2554
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2511
2555
  * See the License for the specific language governing permissions and
2512
2556
  * limitations under the License.
2513
- */const Rv="http://localhost";class $t extends Pa{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new $t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):Ce("argument-error"),n}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 n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s}=n,i=Ea(n,["providerId","signInMethod"]);if(!r||!s)return null;const o=new $t(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return An(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,An(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,An(e,n)}buildRequest(){const e={requestUri:Rv,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=Nn(n)}return e}}/**
2557
+ */const yv="http://localhost";class Zt extends Xo{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Zt(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):qe("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=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:s}=t,i=qo(t,["providerId","signInMethod"]);if(!r||!s)return null;const a=new Zt(r,s);return a.idToken=i.idToken||void 0,a.accessToken=i.accessToken||void 0,a.secret=i.secret,a.nonce=i.nonce,a.pendingToken=i.pendingToken||null,a}_getIdTokenResponse(e){const t=this.buildRequest();return On(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,On(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,On(e,t)}buildRequest(){const e={requestUri:yv,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=Hn(t)}return e}}/**
2514
2558
  * @license
2515
2559
  * Copyright 2020 Google LLC
2516
2560
  *
@@ -2525,7 +2569,7 @@ This typically indicates that your device does not have a healthy Internet conne
2525
2569
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2526
2570
  * See the License for the specific language governing permissions and
2527
2571
  * limitations under the License.
2528
- */function Pv(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}}function Sv(t){const e=Dn(On(t)).link,n=e?Dn(On(e)).deep_link_id:null,r=Dn(On(t)).deep_link_id;return(r?Dn(On(r)).link:null)||r||n||e||t}class Sa{constructor(e){var n,r,s,i,o,a;const c=Dn(On(e)),u=(n=c.apiKey)!==null&&n!==void 0?n:null,l=(r=c.oobCode)!==null&&r!==void 0?r:null,h=Pv((s=c.mode)!==null&&s!==void 0?s:null);w(u&&l&&h,"argument-error"),this.apiKey=u,this.operation=h,this.code=l,this.continueUrl=(i=c.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(o=c.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(a=c.tenantId)!==null&&a!==void 0?a:null}static parseLink(e){const n=Sv(e);try{return new Sa(n)}catch{return null}}}/**
2572
+ */function vv(n){switch(n){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}}function Ev(n){const e=Wn(Gn(n)).link,t=e?Wn(Gn(e)).deep_link_id:null,r=Wn(Gn(n)).deep_link_id;return(r?Wn(Gn(r)).link:null)||r||t||e||n}class Jo{constructor(e){var t,r,s,i,a,c;const l=Wn(Gn(e)),d=(t=l.apiKey)!==null&&t!==void 0?t:null,p=(r=l.oobCode)!==null&&r!==void 0?r:null,g=vv((s=l.mode)!==null&&s!==void 0?s:null);M(d&&p&&g,"argument-error"),this.apiKey=d,this.operation=g,this.code=p,this.continueUrl=(i=l.continueUrl)!==null&&i!==void 0?i:null,this.languageCode=(a=l.languageCode)!==null&&a!==void 0?a:null,this.tenantId=(c=l.tenantId)!==null&&c!==void 0?c:null}static parseLink(e){const t=Ev(e);try{return new Jo(t)}catch{return null}}}/**
2529
2573
  * @license
2530
2574
  * Copyright 2020 Google LLC
2531
2575
  *
@@ -2540,7 +2584,7 @@ This typically indicates that your device does not have a healthy Internet conne
2540
2584
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2541
2585
  * See the License for the specific language governing permissions and
2542
2586
  * limitations under the License.
2543
- */class Rn{constructor(){this.providerId=Rn.PROVIDER_ID}static credential(e,n){return Dr._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Sa.parseLink(n);return w(r,"argument-error"),Dr._fromEmailAndCode(e,r.code,r.tenantId)}}Rn.PROVIDER_ID="password",Rn.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Rn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
2587
+ */class Vn{constructor(){this.providerId=Vn.PROVIDER_ID}static credential(e,t){return Ir._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Jo.parseLink(t);return M(r,"argument-error"),Ir._fromEmailAndCode(e,r.code,r.tenantId)}}Vn.PROVIDER_ID="password",Vn.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Vn.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
2544
2588
  * @license
2545
2589
  * Copyright 2020 Google LLC
2546
2590
  *
@@ -2555,7 +2599,7 @@ This typically indicates that your device does not have a healthy Internet conne
2555
2599
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2556
2600
  * See the License for the specific language governing permissions and
2557
2601
  * limitations under the License.
2558
- */class si{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}}/**
2602
+ */class Hs{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}}/**
2559
2603
  * @license
2560
2604
  * Copyright 2019 Google LLC
2561
2605
  *
@@ -2570,7 +2614,7 @@ This typically indicates that your device does not have a healthy Internet conne
2570
2614
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2571
2615
  * See the License for the specific language governing permissions and
2572
2616
  * limitations under the License.
2573
- */class Or extends si{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
2617
+ */class Ar extends Hs{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
2574
2618
  * @license
2575
2619
  * Copyright 2020 Google LLC
2576
2620
  *
@@ -2585,7 +2629,7 @@ This typically indicates that your device does not have a healthy Internet conne
2585
2629
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2586
2630
  * See the License for the specific language governing permissions and
2587
2631
  * limitations under the License.
2588
- */class ze extends Or{constructor(){super("facebook.com")}static credential(e){return $t._fromParams({providerId:ze.PROVIDER_ID,signInMethod:ze.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ze.credentialFromTaggedObject(e)}static credentialFromError(e){return ze.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return ze.credential(e.oauthAccessToken)}catch{return null}}}ze.FACEBOOK_SIGN_IN_METHOD="facebook.com",ze.PROVIDER_ID="facebook.com";/**
2632
+ */class st extends Ar{constructor(){super("facebook.com")}static credential(e){return Zt._fromParams({providerId:st.PROVIDER_ID,signInMethod:st.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return st.credentialFromTaggedObject(e)}static credentialFromError(e){return st.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return st.credential(e.oauthAccessToken)}catch{return null}}}st.FACEBOOK_SIGN_IN_METHOD="facebook.com",st.PROVIDER_ID="facebook.com";/**
2589
2633
  * @license
2590
2634
  * Copyright 2020 Google LLC
2591
2635
  *
@@ -2600,7 +2644,7 @@ This typically indicates that your device does not have a healthy Internet conne
2600
2644
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2601
2645
  * See the License for the specific language governing permissions and
2602
2646
  * limitations under the License.
2603
- */class He extends Or{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return $t._fromParams({providerId:He.PROVIDER_ID,signInMethod:He.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return He.credentialFromTaggedObject(e)}static credentialFromError(e){return He.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return He.credential(n,r)}catch{return null}}}He.GOOGLE_SIGN_IN_METHOD="google.com",He.PROVIDER_ID="google.com";/**
2647
+ */class it extends Ar{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Zt._fromParams({providerId:it.PROVIDER_ID,signInMethod:it.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return it.credentialFromTaggedObject(e)}static credentialFromError(e){return it.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return it.credential(t,r)}catch{return null}}}it.GOOGLE_SIGN_IN_METHOD="google.com",it.PROVIDER_ID="google.com";/**
2604
2648
  * @license
2605
2649
  * Copyright 2020 Google LLC
2606
2650
  *
@@ -2615,7 +2659,7 @@ This typically indicates that your device does not have a healthy Internet conne
2615
2659
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2616
2660
  * See the License for the specific language governing permissions and
2617
2661
  * limitations under the License.
2618
- */class It extends Or{constructor(){super("github.com")}static credential(e){return $t._fromParams({providerId:It.PROVIDER_ID,signInMethod:It.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return It.credentialFromTaggedObject(e)}static credentialFromError(e){return It.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return It.credential(e.oauthAccessToken)}catch{return null}}}It.GITHUB_SIGN_IN_METHOD="github.com",It.PROVIDER_ID="github.com";/**
2662
+ */class Vt extends Ar{constructor(){super("github.com")}static credential(e){return Zt._fromParams({providerId:Vt.PROVIDER_ID,signInMethod:Vt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Vt.credentialFromTaggedObject(e)}static credentialFromError(e){return Vt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Vt.credential(e.oauthAccessToken)}catch{return null}}}Vt.GITHUB_SIGN_IN_METHOD="github.com",Vt.PROVIDER_ID="github.com";/**
2619
2663
  * @license
2620
2664
  * Copyright 2020 Google LLC
2621
2665
  *
@@ -2630,7 +2674,7 @@ This typically indicates that your device does not have a healthy Internet conne
2630
2674
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631
2675
  * See the License for the specific language governing permissions and
2632
2676
  * limitations under the License.
2633
- */class Oe extends Or{constructor(){super("twitter.com")}static credential(e,n){return $t._fromParams({providerId:Oe.PROVIDER_ID,signInMethod:Oe.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return Oe.credentialFromTaggedObject(e)}static credentialFromError(e){return Oe.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return Oe.credential(n,r)}catch{return null}}}Oe.TWITTER_SIGN_IN_METHOD="twitter.com",Oe.PROVIDER_ID="twitter.com";/**
2677
+ */class Ke extends Ar{constructor(){super("twitter.com")}static credential(e,t){return Zt._fromParams({providerId:Ke.PROVIDER_ID,signInMethod:Ke.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Ke.credentialFromTaggedObject(e)}static credentialFromError(e){return Ke.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return Ke.credential(t,r)}catch{return null}}}Ke.TWITTER_SIGN_IN_METHOD="twitter.com",Ke.PROVIDER_ID="twitter.com";/**
2634
2678
  * @license
2635
2679
  * Copyright 2020 Google LLC
2636
2680
  *
@@ -2645,7 +2689,7 @@ This typically indicates that your device does not have a healthy Internet conne
2645
2689
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2646
2690
  * See the License for the specific language governing permissions and
2647
2691
  * limitations under the License.
2648
- */async function pd(t,e){return Cr(t,"POST","/v1/accounts:signUp",nt(t,e))}/**
2692
+ */async function lh(n,e){return Er(n,"POST","/v1/accounts:signUp",pt(n,e))}/**
2649
2693
  * @license
2650
2694
  * Copyright 2020 Google LLC
2651
2695
  *
@@ -2660,7 +2704,7 @@ This typically indicates that your device does not have a healthy Internet conne
2660
2704
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2661
2705
  * See the License for the specific language governing permissions and
2662
2706
  * limitations under the License.
2663
- */class st{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await qt._fromIdTokenResponse(e,r,s),o=md(r);return new st({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=md(r);return new st({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function md(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
2707
+ */class _t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,s=!1){const i=await mt._fromIdTokenResponse(e,r,s),a=hh(r);return new _t({user:i,providerId:a,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const s=hh(r);return new _t({user:e,providerId:s,_tokenResponse:r,operationType:t})}}function hh(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
2664
2708
  * @license
2665
2709
  * Copyright 2020 Google LLC
2666
2710
  *
@@ -2675,7 +2719,7 @@ This typically indicates that your device does not have a healthy Internet conne
2675
2719
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2676
2720
  * See the License for the specific language governing permissions and
2677
2721
  * limitations under the License.
2678
- */async function Cv(t){var e;const n=je(t);if(await n._initializationPromise,!((e=n.currentUser)===null||e===void 0)&&e.isAnonymous)return new st({user:n.currentUser,providerId:null,operationType:"signIn"});const r=await pd(n,{returnSecureToken:!0}),s=await st._fromIdTokenResponse(n,"signIn",r,!0);return await n._updateCurrentUser(s.user),s}/**
2722
+ */async function Tv(n){var e;if(Fe(n.app))return Promise.reject(nt(n));const t=rt(n);if(await t._initializationPromise,!((e=t.currentUser)===null||e===void 0)&&e.isAnonymous)return new _t({user:t.currentUser,providerId:null,operationType:"signIn"});const r=await lh(t,{returnSecureToken:!0}),s=await _t._fromIdTokenResponse(t,"signIn",r,!0);return await t._updateCurrentUser(s.user),s}/**
2679
2723
  * @license
2680
2724
  * Copyright 2020 Google LLC
2681
2725
  *
@@ -2690,7 +2734,7 @@ This typically indicates that your device does not have a healthy Internet conne
2690
2734
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2691
2735
  * See the License for the specific language governing permissions and
2692
2736
  * limitations under the License.
2693
- */class ii extends be{constructor(e,n,r,s){var i;super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,ii.prototype),this.customData={appName:e.name,tenantId:(i=e.tenantId)!==null&&i!==void 0?i:void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new ii(e,n,r,s)}}function gd(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?ii._fromErrorAndOperation(t,i,e,r):i})}/**
2737
+ */class Ws extends $e{constructor(e,t,r,s){var i;super(t.code,t.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Ws.prototype),this.customData={appName:e.name,tenantId:(i=e.tenantId)!==null&&i!==void 0?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,s){return new Ws(e,t,r,s)}}function dh(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Ws._fromErrorAndOperation(n,i,e,r):i})}/**
2694
2738
  * @license
2695
2739
  * Copyright 2020 Google LLC
2696
2740
  *
@@ -2705,7 +2749,7 @@ This typically indicates that your device does not have a healthy Internet conne
2705
2749
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2706
2750
  * See the License for the specific language governing permissions and
2707
2751
  * limitations under the License.
2708
- */function _d(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}/**
2752
+ */function fh(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}/**
2709
2753
  * @license
2710
2754
  * Copyright 2019 Google LLC
2711
2755
  *
@@ -2720,7 +2764,7 @@ This typically indicates that your device does not have a healthy Internet conne
2720
2764
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2721
2765
  * See the License for the specific language governing permissions and
2722
2766
  * limitations under the License.
2723
- */async function bv(t,e){const n=M(t);await Nv(!0,n,e);const{providerUserInfo:r}=await zE(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),s=_d(r||[]);return n.providerData=n.providerData.filter(i=>s.has(i.providerId)),s.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function kv(t,e,n=!1){const r=await In(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return st._forOperation(t,"link",r)}async function Nv(t,e,n){await kr(e);const r=_d(e.providerData),s=t===!1?"provider-already-linked":"no-such-provider";w(r.has(n)===t,e.auth,s)}/**
2767
+ */async function wv(n,e){const t=Y(n);await Av(!0,t,e);const{providerUserInfo:r}=await By(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),s=fh(r||[]);return t.providerData=t.providerData.filter(i=>s.has(i.providerId)),s.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function Iv(n,e,t=!1){const r=await kn(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return _t._forOperation(n,"link",r)}async function Av(n,e,t){await wr(e);const r=fh(e.providerData);M(r.has(t)===n,e.auth,"no-such-provider")}/**
2724
2768
  * @license
2725
2769
  * Copyright 2019 Google LLC
2726
2770
  *
@@ -2735,7 +2779,7 @@ This typically indicates that your device does not have a healthy Internet conne
2735
2779
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2736
2780
  * See the License for the specific language governing permissions and
2737
2781
  * limitations under the License.
2738
- */async function Dv(t,e,n=!1){const{auth:r}=t,s="reauthenticate";try{const i=await In(t,gd(r,s,e,t),n);w(i.idToken,r,"internal-error");const o=Aa(i.idToken);w(o,r,"internal-error");const{sub:a}=o;return w(t.uid===a,r,"user-mismatch"),st._forOperation(t,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&Ce(r,"user-mismatch"),i}}/**
2782
+ */async function Rv(n,e,t=!1){const{auth:r}=n;if(Fe(r.app))return Promise.reject(nt(r));const s="reauthenticate";try{const i=await kn(n,dh(r,s,e,n),t);M(i.idToken,r,"internal-error");const a=Ko(i.idToken);M(a,r,"internal-error");const{sub:c}=a;return M(n.uid===c,r,"user-mismatch"),_t._forOperation(n,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&qe(r,"user-mismatch"),i}}/**
2739
2783
  * @license
2740
2784
  * Copyright 2020 Google LLC
2741
2785
  *
@@ -2750,7 +2794,7 @@ This typically indicates that your device does not have a healthy Internet conne
2750
2794
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2751
2795
  * See the License for the specific language governing permissions and
2752
2796
  * limitations under the License.
2753
- */async function yd(t,e,n=!1){const r="signIn",s=await gd(t,r,e),i=await st._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}async function Ov(t,e){return yd(je(t),e)}/**
2797
+ */async function ph(n,e,t=!1){if(Fe(n.app))return Promise.reject(nt(n));const r="signIn",s=await dh(n,r,e),i=await _t._fromIdTokenResponse(n,r,s);return t||await n._updateCurrentUser(i.user),i}async function bv(n,e){return ph(rt(n),e)}/**
2754
2798
  * @license
2755
2799
  * Copyright 2020 Google LLC
2756
2800
  *
@@ -2765,7 +2809,7 @@ This typically indicates that your device does not have a healthy Internet conne
2765
2809
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2766
2810
  * See the License for the specific language governing permissions and
2767
2811
  * limitations under the License.
2768
- */function Ed(t,e,n){var r;w(((r=n.url)===null||r===void 0?void 0:r.length)>0,t,"invalid-continue-uri"),w(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(w(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(w(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)}/**
2812
+ */function Pv(n,e,t){var r;M(((r=t.url)===null||r===void 0?void 0:r.length)>0,n,"invalid-continue-uri"),M(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(M(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(M(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}/**
2769
2813
  * @license
2770
2814
  * Copyright 2020 Google LLC
2771
2815
  *
@@ -2780,7 +2824,7 @@ This typically indicates that your device does not have a healthy Internet conne
2780
2824
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2781
2825
  * See the License for the specific language governing permissions and
2782
2826
  * limitations under the License.
2783
- */async function vd(t){const e=je(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Vv(t,e,n){const r=je(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&Ed(r,s,n),await ri(r,s,"getOobCode",Iv)}async function Lv(t,e,n){const r=je(t),o=await ri(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",pd).catch(c=>{throw c.code==="auth/password-does-not-meet-requirements"&&vd(t),c}),a=await st._fromIdTokenResponse(r,"signIn",o);return await r._updateCurrentUser(a.user),a}function Td(t,e,n){return Ov(M(t),Rn.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&vd(t),r})}async function Id(t,e){const n=M(t),s={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&Ed(n.auth,s,e);const{email:i}=await Tv(n.auth,s);i!==t.email&&await t.reload()}/**
2827
+ */async function mh(n){const e=rt(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Sv(n,e,t){const r=rt(n);await zs(r,{requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"},"getOobCode",mv)}async function Cv(n,e,t){if(Fe(n.app))return Promise.reject(nt(n));const r=rt(n),a=await zs(r,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",lh).catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&mh(n),l}),c=await _t._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(c.user),c}function gh(n,e,t){return Fe(n.app)?Promise.reject(nt(n)):bv(Y(n),Vn.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&mh(n),r})}async function _h(n,e){const t=Y(n),s={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&Pv(t.auth,s,e);const{email:i}=await pv(t.auth,s);i!==n.email&&await n.reload()}/**
2784
2828
  * @license
2785
2829
  * Copyright 2020 Google LLC
2786
2830
  *
@@ -2795,7 +2839,7 @@ This typically indicates that your device does not have a healthy Internet conne
2795
2839
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2796
2840
  * See the License for the specific language governing permissions and
2797
2841
  * limitations under the License.
2798
- */async function Mv(t,e){return De(t,"POST","/v1/accounts:update",e)}/**
2842
+ */async function kv(n,e){return Ge(n,"POST","/v1/accounts:update",e)}/**
2799
2843
  * @license
2800
2844
  * Copyright 2020 Google LLC
2801
2845
  *
@@ -2810,7 +2854,7 @@ This typically indicates that your device does not have a healthy Internet conne
2810
2854
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2811
2855
  * See the License for the specific language governing permissions and
2812
2856
  * limitations under the License.
2813
- */async function Uv(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;const r=M(t),i={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},o=await In(r,Mv(r.auth,i));r.displayName=o.displayName||null,r.photoURL=o.photoUrl||null;const a=r.providerData.find(({providerId:c})=>c==="password");a&&(a.displayName=r.displayName,a.photoURL=r.photoURL),await r._updateTokensIfNecessary(o)}function xv(t,e,n,r){return M(t).onIdTokenChanged(e,n,r)}function Fv(t,e,n){return M(t).beforeAuthStateChanged(e,n)}const oi="__sak";/**
2857
+ */async function Nv(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;const r=Y(n),i={idToken:await r.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},a=await kn(r,kv(r.auth,i));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;const c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function Dv(n,e,t,r){return Y(n).onIdTokenChanged(e,t,r)}function Ov(n,e,t){return Y(n).beforeAuthStateChanged(e,t)}const Gs="__sak";/**
2814
2858
  * @license
2815
2859
  * Copyright 2019 Google LLC
2816
2860
  *
@@ -2825,7 +2869,7 @@ This typically indicates that your device does not have a healthy Internet conne
2825
2869
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2826
2870
  * See the License for the specific language governing permissions and
2827
2871
  * limitations under the License.
2828
- */class wd{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(oi,"1"),this.storage.removeItem(oi),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){const n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}/**
2872
+ */class yh{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Gs,"1"),this.storage.removeItem(Gs),Promise.resolve(!0)):Promise.resolve(!1)}catch{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()}}/**
2829
2873
  * @license
2830
2874
  * Copyright 2020 Google LLC
2831
2875
  *
@@ -2840,7 +2884,7 @@ This typically indicates that your device does not have a healthy Internet conne
2840
2884
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2841
2885
  * See the License for the specific language governing permissions and
2842
2886
  * limitations under the License.
2843
- */function Bv(){const t=ie();return Ra(t)||ni(t)}const qv=1e3,$v=10;class Ad extends wd{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=Bv()&&rv(),this.fallbackToPolling=id(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,a,c)=>{this.notifyListeners(o,c)});return}const r=e.key;if(n?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(r);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!n)return}const s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);nv()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,$v):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},qv)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){Object.keys(this.listeners).length===0&&(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(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){const n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}}Ad.type="LOCAL";const jv=Ad;/**
2887
+ */const Vv=1e3,Lv=10;class vh extends yh{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=th(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),s=this.localCache[t];r!==s&&e(t,s,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}const r=e.key;t?this.detachListener():this.stopPolling();const s=()=>{const a=this.storage.getItem(r);!t&&this.localCache[r]===a||this.notifyListeners(r,a)},i=this.storage.getItem(r);Qy()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,Lv):s()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},Vv)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(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]}}vh.type="LOCAL";const Mv=vh;/**
2844
2888
  * @license
2845
2889
  * Copyright 2020 Google LLC
2846
2890
  *
@@ -2855,7 +2899,7 @@ This typically indicates that your device does not have a healthy Internet conne
2855
2899
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2856
2900
  * See the License for the specific language governing permissions and
2857
2901
  * limitations under the License.
2858
- */class Rd extends wd{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}Rd.type="SESSION";const Pd=Rd;/**
2902
+ */class Eh extends yh{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Eh.type="SESSION";const Th=Eh;/**
2859
2903
  * @license
2860
2904
  * Copyright 2019 Google LLC
2861
2905
  *
@@ -2870,7 +2914,7 @@ This typically indicates that your device does not have a healthy Internet conne
2870
2914
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2871
2915
  * See the License for the specific language governing permissions and
2872
2916
  * limitations under the License.
2873
- */function zv(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
2917
+ */function Uv(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
2874
2918
  * @license
2875
2919
  * Copyright 2019 Google LLC
2876
2920
  *
@@ -2885,7 +2929,7 @@ This typically indicates that your device does not have a healthy Internet conne
2885
2929
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2886
2930
  * See the License for the specific language governing permissions and
2887
2931
  * limitations under the License.
2888
- */class ai{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new ai(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const a=Array.from(o).map(async u=>u(n.origin,i)),c=await zv(a);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:c})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}ai.receivers=[];/**
2932
+ */class Ks{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(s=>s.isListeningto(e));if(t)return t;const r=new Ks(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:s,data:i}=t.data,a=this.handlersMap[s];if(!(a!=null&&a.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const c=Array.from(a).map(async d=>d(t.origin,i)),l=await Uv(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&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||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Ks.receivers=[];/**
2889
2933
  * @license
2890
2934
  * Copyright 2020 Google LLC
2891
2935
  *
@@ -2900,7 +2944,7 @@ This typically indicates that your device does not have a healthy Internet conne
2900
2944
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2901
2945
  * See the License for the specific language governing permissions and
2902
2946
  * limitations under the License.
2903
- */function Ca(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/**
2947
+ */function Zo(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
2904
2948
  * @license
2905
2949
  * Copyright 2019 Google LLC
2906
2950
  *
@@ -2915,7 +2959,7 @@ This typically indicates that your device does not have a healthy Internet conne
2915
2959
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2916
2960
  * See the License for the specific language governing permissions and
2917
2961
  * limitations under the License.
2918
- */class Hv{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,n,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((a,c)=>{const u=Ca("",20);s.port1.start();const l=setTimeout(()=>{c(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(h){const d=h;if(d.data.eventId===u)switch(d.data.status){case"ack":clearTimeout(l),i=setTimeout(()=>{c(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),a(d.data.response);break;default:clearTimeout(l),clearTimeout(i),c(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
2962
+ */class xv{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,r=50){const s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,a;return new Promise((c,l)=>{const d=Zo("",20);s.port1.start();const p=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:s,onMessage(g){const v=g;if(v.data.eventId===d)switch(v.data.status){case"ack":clearTimeout(p),i=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),c(v.data.response);break;default:clearTimeout(p),clearTimeout(i),l(new Error("invalid_response"));break}}},this.handlers.add(a),s.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:d,data:t},[s.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}}/**
2919
2963
  * @license
2920
2964
  * Copyright 2020 Google LLC
2921
2965
  *
@@ -2930,7 +2974,7 @@ This typically indicates that your device does not have a healthy Internet conne
2930
2974
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2931
2975
  * See the License for the specific language governing permissions and
2932
2976
  * limitations under the License.
2933
- */function We(){return window}function Wv(t){We().location.href=t}/**
2977
+ */function ot(){return window}function Fv(n){ot().location.href=n}/**
2934
2978
  * @license
2935
2979
  * Copyright 2020 Google LLC.
2936
2980
  *
@@ -2945,7 +2989,7 @@ This typically indicates that your device does not have a healthy Internet conne
2945
2989
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2946
2990
  * See the License for the specific language governing permissions and
2947
2991
  * limitations under the License.
2948
- */function Sd(){return typeof We().WorkerGlobalScope<"u"&&typeof We().importScripts=="function"}async function Gv(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Kv(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)===null||t===void 0?void 0:t.controller)||null}function Qv(){return Sd()?self:null}/**
2992
+ */function wh(){return typeof ot().WorkerGlobalScope<"u"&&typeof ot().importScripts=="function"}async function Bv(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function jv(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function qv(){return wh()?self:null}/**
2949
2993
  * @license
2950
2994
  * Copyright 2019 Google LLC
2951
2995
  *
@@ -2960,7 +3004,7 @@ This typically indicates that your device does not have a healthy Internet conne
2960
3004
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2961
3005
  * See the License for the specific language governing permissions and
2962
3006
  * limitations under the License.
2963
- */const Cd="firebaseLocalStorageDb",Yv=1,ci="firebaseLocalStorage",bd="fbase_key";class Vr{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}}function ui(t,e){return t.transaction([ci],e?"readwrite":"readonly").objectStore(ci)}function Xv(){const t=indexedDB.deleteDatabase(Cd);return new Vr(t).toPromise()}function ba(){const t=indexedDB.open(Cd,Yv);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(ci,{keyPath:bd})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(ci)?e(r):(r.close(),await Xv(),e(await ba()))})})}async function kd(t,e,n){const r=ui(t,!0).put({[bd]:e,value:n});return new Vr(r).toPromise()}async function Jv(t,e){const n=ui(t,!1).get(e),r=await new Vr(n).toPromise();return r===void 0?null:r.value}function Nd(t,e){const n=ui(t,!0).delete(e);return new Vr(n).toPromise()}const Zv=800,eT=3;class Dd{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:(this.db=await ba(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>eT)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Sd()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=ai._getInstance(Qv()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var e,n;if(this.activeServiceWorker=await Gv(),!this.activeServiceWorker)return;this.sender=new Hv(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((n=r[0])===null||n===void 0)&&n.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Kv()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await ba();return await kd(e,oi,"1"),await Nd(e,oi),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>kd(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>Jv(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Nd(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=ui(s,!1).getAll();return new Vr(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Zv)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}Dd.type="LOCAL";const tT=Dd;new Sr(3e4,6e4);/**
3007
+ */const Ih="firebaseLocalStorageDb",$v=1,Qs="firebaseLocalStorage",Ah="fbase_key";class Rr{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 Ys(n,e){return n.transaction([Qs],e?"readwrite":"readonly").objectStore(Qs)}function zv(){const n=indexedDB.deleteDatabase(Ih);return new Rr(n).toPromise()}function ea(){const n=indexedDB.open(Ih,$v);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Qs,{keyPath:Ah})}catch(s){t(s)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Qs)?e(r):(r.close(),await zv(),e(await ea()))})})}async function Rh(n,e,t){const r=Ys(n,!0).put({[Ah]:e,value:t});return new Rr(r).toPromise()}async function Hv(n,e){const t=Ys(n,!1).get(e),r=await new Rr(t).toPromise();return r===void 0?null:r.value}function bh(n,e){const t=Ys(n,!0).delete(e);return new Rr(t).toPromise()}const Wv=800,Gv=3;class Ph{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:(this.db=await ea(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>Gv)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return wh()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ks._getInstance(qv()),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 Bv(),!this.activeServiceWorker)return;this.sender=new xv(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((t=r[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||jv()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await ea();return await Rh(e,Gs,"1"),await bh(e,Gs),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>Rh(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Hv(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>bh(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=Ys(s,!1).getAll();return new Rr(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),t.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),t.push(s));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Wv)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}Ph.type="LOCAL";const Kv=Ph;new vr(3e4,6e4);/**
2964
3008
  * @license
2965
3009
  * Copyright 2021 Google LLC
2966
3010
  *
@@ -2975,7 +3019,7 @@ This typically indicates that your device does not have a healthy Internet conne
2975
3019
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2976
3020
  * See the License for the specific language governing permissions and
2977
3021
  * limitations under the License.
2978
- */function ka(t,e){return e?rt(e):(w(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
3022
+ */function ta(n,e){return e?gt(e):(M(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
2979
3023
  * @license
2980
3024
  * Copyright 2019 Google LLC
2981
3025
  *
@@ -2990,7 +3034,7 @@ This typically indicates that your device does not have a healthy Internet conne
2990
3034
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2991
3035
  * See the License for the specific language governing permissions and
2992
3036
  * limitations under the License.
2993
- */class Na extends Pa{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return An(e,this._buildIdpRequest())}_linkToIdToken(e,n){return An(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return An(e,this._buildIdpRequest())}_buildIdpRequest(e){const n={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&&(n.idToken=e),n}}function nT(t){return yd(t.auth,new Na(t),t.bypassAuthState)}function rT(t){const{auth:e,user:n}=t;return w(n,e,"internal-error"),Dv(n,new Na(t),t.bypassAuthState)}async function sT(t){const{auth:e,user:n}=t;return w(n,e,"internal-error"),kv(n,new Na(t),t.bypassAuthState)}/**
3037
+ */class na extends Xo{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return On(e,this._buildIdpRequest())}_linkToIdToken(e,t){return On(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return On(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 Qv(n){return ph(n.auth,new na(n),n.bypassAuthState)}function Yv(n){const{auth:e,user:t}=n;return M(t,e,"internal-error"),Rv(t,new na(n),n.bypassAuthState)}async function Xv(n){const{auth:e,user:t}=n;return M(t,e,"internal-error"),Iv(t,new na(n),n.bypassAuthState)}/**
2994
3038
  * @license
2995
3039
  * Copyright 2020 Google LLC
2996
3040
  *
@@ -3005,7 +3049,7 @@ This typically indicates that your device does not have a healthy Internet conne
3005
3049
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3006
3050
  * See the License for the specific language governing permissions and
3007
3051
  * limitations under the License.
3008
- */class Od{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:r,postBody:s,tenantId:i,error:o,type:a}=e;if(o){this.reject(o);return}const c={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(c))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return nT;case"linkViaPopup":case"linkViaRedirect":return sT;case"reauthViaPopup":case"reauthViaRedirect":return rT;default:Ce(this.auth,"internal-error")}}resolve(e){tt(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){tt(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()}}/**
3052
+ */class Sh{constructor(e,t,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,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(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:s,tenantId:i,error:a,type:c}=e;if(a){this.reject(a);return}const l={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(d){this.reject(d)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Qv;case"linkViaPopup":case"linkViaRedirect":return Xv;case"reauthViaPopup":case"reauthViaRedirect":return Yv;default:qe(this.auth,"internal-error")}}resolve(e){ft(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ft(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()}}/**
3009
3053
  * @license
3010
3054
  * Copyright 2020 Google LLC
3011
3055
  *
@@ -3020,7 +3064,7 @@ This typically indicates that your device does not have a healthy Internet conne
3020
3064
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3021
3065
  * See the License for the specific language governing permissions and
3022
3066
  * limitations under the License.
3023
- */const iT=new Sr(2e3,1e4);async function Da(t,e,n){const r=je(t);$h(t,e,si);const s=ka(r,n);return new wt(r,"signInViaPopup",e,s).executeNotNull()}async function Vd(t,e,n){const r=M(t);$h(r.auth,e,si);const s=ka(r.auth,n);return new wt(r.auth,"linkViaPopup",e,s,r).executeNotNull()}class wt extends Od{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,wt.currentPopupAction&&wt.currentPopupAction.cancel(),wt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return w(e,this.auth,"internal-error"),e}async onExecution(){tt(this.filter.length===1,"Popup operations only handle one event");const e=Ca();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject($e(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject($e(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,wt.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if(!((r=(n=this.authWindow)===null||n===void 0?void 0:n.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject($e(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,iT.get())};e()}}wt.currentPopupAction=null;/**
3067
+ */const Jv=new vr(2e3,1e4);async function ra(n,e,t){if(Fe(n.app))return Promise.reject(We(n,"operation-not-supported-in-this-environment"));const r=rt(n);Ll(n,e,Hs);const s=ta(r,t);return new Lt(r,"signInViaPopup",e,s).executeNotNull()}async function Ch(n,e,t){const r=Y(n);Ll(r.auth,e,Hs);const s=ta(r.auth,t);return new Lt(r.auth,"linkViaPopup",e,s,r).executeNotNull()}class Lt extends Sh{constructor(e,t,r,s,i){super(e,t,s,i),this.provider=r,this.authWindow=null,this.pollId=null,Lt.currentPopupAction&&Lt.currentPopupAction.cancel(),Lt.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return M(e,this.auth,"internal-error"),e}async onExecution(){ft(this.filter.length===1,"Popup operations only handle one event");const e=Zo();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(We(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(We(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Lt.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if(!((r=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(We(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Jv.get())};e()}}Lt.currentPopupAction=null;/**
3024
3068
  * @license
3025
3069
  * Copyright 2020 Google LLC
3026
3070
  *
@@ -3035,7 +3079,7 @@ This typically indicates that your device does not have a healthy Internet conne
3035
3079
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3036
3080
  * See the License for the specific language governing permissions and
3037
3081
  * limitations under the License.
3038
- */const oT="pendingRedirect",li=new Map;class aT extends Od{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=li.get(this.auth._key());if(!e){try{const r=await cT(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}li.set(this.auth._key(),e)}return this.bypassAuthState||li.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function cT(t,e){const n=hT(e),r=lT(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function uT(t,e){li.set(t._key(),e)}function lT(t){return rt(t._redirectPersistence)}function hT(t){return ti(oT,t.config.apiKey,t.name)}async function dT(t,e,n=!1){const r=je(t),s=ka(r,e),o=await new aT(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
3082
+ */const Zv="pendingRedirect",Xs=new Map;class eE extends Sh{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=Xs.get(this.auth._key());if(!e){try{const r=await tE(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}Xs.set(this.auth._key(),e)}return this.bypassAuthState||Xs.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function tE(n,e){const t=sE(e),r=rE(n);if(!await r._isAvailable())return!1;const s=await r._get(t)==="true";return await r._remove(t),s}function nE(n,e){Xs.set(n._key(),e)}function rE(n){return gt(n._redirectPersistence)}function sE(n){return qs(Zv,n.config.apiKey,n.name)}async function iE(n,e,t=!1){if(Fe(n.app))return Promise.reject(nt(n));const r=rt(n),s=ta(r,e),a=await new eE(r,s,t).execute();return a&&!t&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}/**
3039
3083
  * @license
3040
3084
  * Copyright 2020 Google LLC
3041
3085
  *
@@ -3050,7 +3094,7 @@ This typically indicates that your device does not have a healthy Internet conne
3050
3094
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3051
3095
  * See the License for the specific language governing permissions and
3052
3096
  * limitations under the License.
3053
- */const fT=10*60*1e3;class pT{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 n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!mT(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!Md(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";n.onError($e(this.auth,s))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=fT&&this.cachedEventUids.clear(),this.cachedEventUids.has(Ld(e))}saveEventToCache(e){this.cachedEventUids.add(Ld(e)),this.lastProcessedEventTime=Date.now()}}function Ld(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function Md({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function mT(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Md(t);default:return!1}}/**
3097
+ */const oE=10*60*1e3;class aE{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(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!cE(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Nh(e)){const s=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(We(this.auth,s))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=oE&&this.cachedEventUids.clear(),this.cachedEventUids.has(kh(e))}saveEventToCache(e){this.cachedEventUids.add(kh(e)),this.lastProcessedEventTime=Date.now()}}function kh(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Nh({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function cE(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Nh(n);default:return!1}}/**
3054
3098
  * @license
3055
3099
  * Copyright 2020 Google LLC
3056
3100
  *
@@ -3065,7 +3109,7 @@ This typically indicates that your device does not have a healthy Internet conne
3065
3109
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3066
3110
  * See the License for the specific language governing permissions and
3067
3111
  * limitations under the License.
3068
- */async function gT(t,e={}){return De(t,"GET","/v1/projects",e)}/**
3112
+ */async function uE(n,e={}){return Ge(n,"GET","/v1/projects",e)}/**
3069
3113
  * @license
3070
3114
  * Copyright 2020 Google LLC
3071
3115
  *
@@ -3080,7 +3124,7 @@ This typically indicates that your device does not have a healthy Internet conne
3080
3124
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3081
3125
  * See the License for the specific language governing permissions and
3082
3126
  * limitations under the License.
3083
- */const _T=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,yT=/^https?/;async function ET(t){if(t.config.emulator)return;const{authorizedDomains:e}=await gT(t);for(const n of e)try{if(vT(n))return}catch{}Ce(t,"unauthorized-domain")}function vT(t){const e=Ta(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const o=new URL(t);return o.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&o.hostname===r}if(!yT.test(n))return!1;if(_T.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
3127
+ */const lE=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,hE=/^https?/;async function dE(n){if(n.config.emulator)return;const{authorizedDomains:e}=await uE(n);for(const t of e)try{if(fE(t))return}catch{}qe(n,"unauthorized-domain")}function fE(n){const e=Ho(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const a=new URL(n);return a.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&a.hostname===r}if(!hE.test(t))return!1;if(lE.test(n))return r===n;const s=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
3084
3128
  * @license
3085
3129
  * Copyright 2020 Google LLC.
3086
3130
  *
@@ -3095,7 +3139,7 @@ This typically indicates that your device does not have a healthy Internet conne
3095
3139
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3096
3140
  * See the License for the specific language governing permissions and
3097
3141
  * limitations under the License.
3098
- */const TT=new Sr(3e4,6e4);function Ud(){const t=We().___jsl;if(t!=null&&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 n=0;n<t.CP.length;n++)t.CP[n]=null}}function IT(t){return new Promise((e,n)=>{var r,s,i;function o(){Ud(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Ud(),n($e(t,"network-request-failed"))},timeout:TT.get()})}if(!((s=(r=We().gapi)===null||r===void 0?void 0:r.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((i=We().gapi)===null||i===void 0)&&i.load)o();else{const a=lv("iframefcb");return We()[a]=()=>{gapi.load?o():n($e(t,"network-request-failed"))},cd(`https://apis.google.com/js/api.js?onload=${a}`).catch(c=>n(c))}}).catch(e=>{throw hi=null,e})}let hi=null;function wT(t){return hi=hi||IT(t),hi}/**
3142
+ */const pE=new vr(3e4,6e4);function Dh(){const n=ot().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function mE(n){return new Promise((e,t)=>{var r,s,i;function a(){Dh(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Dh(),t(We(n,"network-request-failed"))},timeout:pE.get()})}if(!((s=(r=ot().gapi)===null||r===void 0?void 0:r.iframes)===null||s===void 0)&&s.Iframe)e(gapi.iframes.getContext());else if(!((i=ot().gapi)===null||i===void 0)&&i.load)a();else{const c=sv("iframefcb");return ot()[c]=()=>{gapi.load?a():t(We(n,"network-request-failed"))},sh(`${rv()}?onload=${c}`).catch(l=>t(l))}}).catch(e=>{throw Js=null,e})}let Js=null;function gE(n){return Js=Js||mE(n),Js}/**
3099
3143
  * @license
3100
3144
  * Copyright 2020 Google LLC.
3101
3145
  *
@@ -3110,7 +3154,7 @@ This typically indicates that your device does not have a healthy Internet conne
3110
3154
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3111
3155
  * See the License for the specific language governing permissions and
3112
3156
  * limitations under the License.
3113
- */const AT=new Sr(5e3,15e3),RT="__/auth/iframe",PT="emulator/auth/iframe",ST={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},CT=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function bT(t){const e=t.config;w(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Ia(e,PT):`https://${t.config.authDomain}/${RT}`,r={apiKey:e.apiKey,appName:t.name,v:Ct},s=CT.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${Nn(r).slice(1)}`}async function kT(t){const e=await wT(t),n=We().gapi;return w(n,t,"internal-error"),e.open({where:document.body,url:bT(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ST,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=$e(t,"network-request-failed"),a=We().setTimeout(()=>{i(o)},AT.get());function c(){We().clearTimeout(a),s(r)}r.ping(c).then(c,()=>{i(o)})}))}/**
3157
+ */const _E=new vr(5e3,15e3),yE="__/auth/iframe",vE="emulator/auth/iframe",EE={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},TE=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function wE(n){const e=n.config;M(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?Wo(e,vE):`https://${n.config.authDomain}/${yE}`,r={apiKey:e.apiKey,appName:n.name,v:qt},s=TE.get(n.config.apiHost);s&&(r.eid=s);const i=n._getFrameworks();return i.length&&(r.fw=i.join(",")),`${t}?${Hn(r).slice(1)}`}async function IE(n){const e=await gE(n),t=ot().gapi;return M(t,n,"internal-error"),e.open({where:document.body,url:wE(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:EE,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const a=We(n,"network-request-failed"),c=ot().setTimeout(()=>{i(a)},_E.get());function l(){ot().clearTimeout(c),s(r)}r.ping(l).then(l,()=>{i(a)})}))}/**
3114
3158
  * @license
3115
3159
  * Copyright 2020 Google LLC.
3116
3160
  *
@@ -3125,7 +3169,7 @@ This typically indicates that your device does not have a healthy Internet conne
3125
3169
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3126
3170
  * See the License for the specific language governing permissions and
3127
3171
  * limitations under the License.
3128
- */const NT={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},DT=500,OT=600,VT="_blank",LT="http://localhost";class xd{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function MT(t,e,n,r=DT,s=OT){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},NT),{width:r.toString(),height:s.toString(),top:i,left:o}),u=ie().toLowerCase();n&&(a=ed(u)?VT:n),Zh(u)&&(e=e||LT,c.scrollbars="yes");const l=Object.entries(c).reduce((d,[f,E])=>`${d}${f}=${E},`,"");if(tv(u)&&a!=="_self")return UT(e||"",a),new xd(null);const h=window.open(e||"",a,l);w(h,t,"popup-blocked");try{h.focus()}catch{}return new xd(h)}function UT(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)}/**
3172
+ */const AE={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},RE=500,bE=600,PE="_blank",SE="http://localhost";class Oh{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function CE(n,e,t,r=RE,s=bE){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const l=Object.assign(Object.assign({},AE),{width:r.toString(),height:s.toString(),top:i,left:a}),d=Ee().toLowerCase();t&&(c=Yl(d)?PE:t),Kl(d)&&(e=e||SE,l.scrollbars="yes");const p=Object.entries(l).reduce((v,[R,C])=>`${v}${R}=${C},`,"");if(Ky(d)&&c!=="_self")return kE(e||"",c),new Oh(null);const g=window.open(e||"",c,p);M(g,n,"popup-blocked");try{g.focus()}catch{}return new Oh(g)}function kE(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
3129
3173
  * @license
3130
3174
  * Copyright 2021 Google LLC
3131
3175
  *
@@ -3140,7 +3184,7 @@ This typically indicates that your device does not have a healthy Internet conne
3140
3184
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3141
3185
  * See the License for the specific language governing permissions and
3142
3186
  * limitations under the License.
3143
- */const xT="__/auth/handler",FT="emulator/auth/handler",BT=encodeURIComponent("fac");async function Fd(t,e,n,r,s,i){w(t.config.authDomain,t,"auth-domain-config-required"),w(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 si){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",Bf(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[l,h]of Object.entries(i||{}))o[l]=h}if(e instanceof Or){const l=e.getScopes().filter(h=>h!=="");l.length>0&&(o.scopes=l.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const l of Object.keys(a))a[l]===void 0&&delete a[l];const c=await t._getAppCheckToken(),u=c?`#${BT}=${encodeURIComponent(c)}`:"";return`${qT(t)}?${Nn(a).slice(1)}${u}`}function qT({config:t}){return t.emulator?Ia(t,FT):`https://${t.authDomain}/${xT}`}/**
3187
+ */const NE="__/auth/handler",DE="emulator/auth/handler",OE=encodeURIComponent("fac");async function Vh(n,e,t,r,s,i){M(n.config.authDomain,n,"auth-domain-config-required"),M(n.config.apiKey,n,"invalid-api-key");const a={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:qt,eventId:s};if(e instanceof Hs){e.setDefaultLanguage(n.languageCode),a.providerId=e.providerId||"",xf(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(const[p,g]of Object.entries({}))a[p]=g}if(e instanceof Ar){const p=e.getScopes().filter(g=>g!=="");p.length>0&&(a.scopes=p.join(","))}n.tenantId&&(a.tid=n.tenantId);const c=a;for(const p of Object.keys(c))c[p]===void 0&&delete c[p];const l=await n._getAppCheckToken(),d=l?`#${OE}=${encodeURIComponent(l)}`:"";return`${VE(n)}?${Hn(c).slice(1)}${d}`}function VE({config:n}){return n.emulator?Wo(n,DE):`https://${n.authDomain}/${NE}`}/**
3144
3188
  * @license
3145
3189
  * Copyright 2020 Google LLC
3146
3190
  *
@@ -3155,7 +3199,7 @@ This typically indicates that your device does not have a healthy Internet conne
3155
3199
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3156
3200
  * See the License for the specific language governing permissions and
3157
3201
  * limitations under the License.
3158
- */const Oa="webStorageSupport";class $T{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Pd,this._completeRedirectFn=dT,this._overrideRedirectResult=uT}async _openPopup(e,n,r,s){var i;tt((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const o=await Fd(e,n,r,Ta(),s);return MT(e,o,Ca())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await Fd(e,n,r,Ta(),s);return Wv(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(tt(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await kT(e),r=new pT(e);return n.register("authEvent",s=>(w(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Oa,{type:Oa},s=>{var i;const o=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[Oa];o!==void 0&&n(!!o),Ce(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=ET(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return id()||Ra()||ni()}}const jT=$T;var Bd="@firebase/auth",qd="1.4.0";/**
3202
+ */const sa="webStorageSupport";class LE{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Th,this._completeRedirectFn=iE,this._overrideRedirectResult=nE}async _openPopup(e,t,r,s){var i;ft((i=this.eventManagers[e._key()])===null||i===void 0?void 0:i.manager,"_initialize() not called before _openPopup()");const a=await Vh(e,t,r,Ho(),s);return CE(e,a,Zo())}async _openRedirect(e,t,r,s){await this._originValidation(e);const i=await Vh(e,t,r,Ho(),s);return Fv(i),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:s,promise:i}=this.eventManagers[t];return s?Promise.resolve(s):(ft(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await IE(e),r=new aE(e);return t.register("authEvent",s=>(M(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(sa,{type:sa},s=>{var i;const a=(i=s==null?void 0:s[0])===null||i===void 0?void 0:i[sa];a!==void 0&&t(!!a),qe(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=dE(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return th()||Ql()||Yo()}}const ME=LE;var Lh="@firebase/auth",Mh="1.7.9";/**
3159
3203
  * @license
3160
3204
  * Copyright 2020 Google LLC
3161
3205
  *
@@ -3170,7 +3214,7 @@ This typically indicates that your device does not have a healthy Internet conne
3170
3214
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3171
3215
  * See the License for the specific language governing permissions and
3172
3216
  * limitations under the License.
3173
- */class zT{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const n=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){w(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
3217
+ */class UE{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(r=>{e((r==null?void 0:r.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(){M(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
3174
3218
  * @license
3175
3219
  * Copyright 2020 Google LLC
3176
3220
  *
@@ -3185,7 +3229,7 @@ This typically indicates that your device does not have a healthy Internet conne
3185
3229
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3186
3230
  * See the License for the specific language governing permissions and
3187
3231
  * limitations under the License.
3188
- */function HT(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}function WT(t){ut(new Ke("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;w(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const c={apiKey:o,authDomain:a,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:od(t)},u=new cv(r,s,i,c);return gv(u,n),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),ut(new Ke("auth-internal",e=>{const n=je(e.getProvider("auth").getImmediate());return(r=>new zT(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ae(Bd,qd,HT(t)),Ae(Bd,qd,"esm2017")}/**
3232
+ */function xE(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function FE(n){It(new ct("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;M(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});const l={apiKey:a,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:nh(n)},d=new ev(r,s,i,l);return uv(d,t),d},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),It(new ct("auth-internal",e=>{const t=rt(e.getProvider("auth").getImmediate());return(r=>new UE(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),Be(Lh,Mh,xE(n)),Be(Lh,Mh,"esm2017")}/**
3189
3233
  * @license
3190
3234
  * Copyright 2021 Google LLC
3191
3235
  *
@@ -3200,22 +3244,7 @@ This typically indicates that your device does not have a healthy Internet conne
3200
3244
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3201
3245
  * See the License for the specific language governing permissions and
3202
3246
  * limitations under the License.
3203
- */const GT=5*60,KT=Za("authIdTokenMaxAge")||GT;let $d=null;const QT=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>KT)return;const s=n==null?void 0:n.token;$d!==s&&($d=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function YT(t=$r()){const e=Vn(t,"auth");if(e.isInitialized())return e.getImmediate();const n=mv(t,{popupRedirectResolver:jT,persistence:[tT,jv,Pd]}),r=Za("authTokenSyncURL");if(r){const i=QT(r);Fv(n,i,()=>i(n.currentUser)),xv(n,o=>i(o))}const s=Xa("auth");return s&&ld(n,`http://${s}`),n}WT("Browser");/**
3204
- * @license
3205
- * Copyright 2017 Google LLC
3206
- *
3207
- * Licensed under the Apache License, Version 2.0 (the "License");
3208
- * you may not use this file except in compliance with the License.
3209
- * You may obtain a copy of the License at
3210
- *
3211
- * http://www.apache.org/licenses/LICENSE-2.0
3212
- *
3213
- * Unless required by applicable law or agreed to in writing, software
3214
- * distributed under the License is distributed on an "AS IS" BASIS,
3215
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3216
- * See the License for the specific language governing permissions and
3217
- * limitations under the License.
3218
- */const jd="firebasestorage.googleapis.com",zd="storageBucket",XT=2*60*1e3,JT=10*60*1e3,ZT=1e3;/**
3247
+ */const BE=5*60,jE=Ka("authIdTokenMaxAge")||BE;let Uh=null;const qE=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>jE)return;const s=t==null?void 0:t.token;Uh!==s&&(Uh=s,await fetch(n,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function $E(n=Xr()){const e=Kn(n,"auth");if(e.isInitialized())return e.getImmediate();const t=cv(n,{popupRedirectResolver:ME,persistence:[Kv,Mv,Th]}),r=Ka("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const a=qE(i.toString());Ov(t,a,()=>a(t.currentUser)),Dv(t,c=>a(c))}}const s=Wa("auth");return s&&oh(t,`http://${s}`),t}function zE(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}tv({loadJS(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=s=>{const i=We("internal-error");i.customData=s,t(i)},r.type="text/javascript",r.charset="UTF-8",zE().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),FE("Browser");/**
3219
3248
  * @license
3220
3249
  * Copyright 2017 Google LLC
3221
3250
  *
@@ -3230,8 +3259,7 @@ This typically indicates that your device does not have a healthy Internet conne
3230
3259
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3231
3260
  * See the License for the specific language governing permissions and
3232
3261
  * limitations under the License.
3233
- */class z extends be{constructor(e,n,r=0){super(Va(e),`Firebase Storage: ${n} (${Va(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,z.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Va(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3234
- ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})($||($={}));function Va(t){return"storage/"+t}function La(){const t="An unknown error occurred, please check the error payload for server response.";return new z($.UNKNOWN,t)}function eI(t){return new z($.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function tI(t){return new z($.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function nI(){const t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new z($.UNAUTHENTICATED,t)}function rI(){return new z($.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function sI(t){return new z($.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function Hd(){return new z($.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function Wd(){return new z($.CANCELED,"User canceled the upload/download.")}function iI(t){return new z($.INVALID_URL,"Invalid URL '"+t+"'.")}function oI(t){return new z($.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function aI(){return new z($.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+zd+"' property when initializing the app?")}function Gd(){return new z($.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function cI(){return new z($.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function uI(){return new z($.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function lI(t){return new z($.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function Ma(t){return new z($.INVALID_ARGUMENT,t)}function Kd(){return new z($.APP_DELETED,"The Firebase app was deleted.")}function hI(t){return new z($.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function Lr(t,e){return new z($.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Mr(t){throw new z($.INTERNAL_ERROR,"Internal error: "+t)}/**
3262
+ */const xh="firebasestorage.googleapis.com",Fh="storageBucket",HE=2*60*1e3,WE=10*60*1e3,GE=1e3;/**
3235
3263
  * @license
3236
3264
  * Copyright 2017 Google LLC
3237
3265
  *
@@ -3246,7 +3274,8 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3246
3274
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3247
3275
  * See the License for the specific language governing permissions and
3248
3276
  * limitations under the License.
3249
- */class we{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=we.makeFromUrl(e,n)}catch{return new we(e,"")}if(r.path==="")return r;throw oI(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(U){U.path.charAt(U.path.length-1)==="/"&&(U.path_=U.path_.slice(0,-1))}const o="(/(.*))?$",a=new RegExp("^gs://"+s+o,"i"),c={bucket:1,path:3};function u(U){U.path_=decodeURIComponent(U.path)}const l="v[A-Za-z0-9_]+",h=n.replace(/[.]/g,"\\."),d="(/([^?#]*).*)?$",f=new RegExp(`^https?://${h}/${l}/b/${s}/o${d}`,"i"),E={bucket:1,path:3},v=n===jd?"(?:storage.googleapis.com|storage.cloud.google.com)":n,g="([^?#]*)",k=new RegExp(`^https?://${v}/${s}/${g}`,"i"),b=[{regex:a,indices:c,postModify:i},{regex:f,indices:E,postModify:u},{regex:k,indices:{bucket:1,path:2},postModify:u}];for(let U=0;U<b.length;U++){const me=b[U],de=me.regex.exec(e);if(de){const ot=de[me.indices.bucket];let Rt=de[me.indices.path];Rt||(Rt=""),r=new we(ot,Rt),me.postModify(r);break}}if(r==null)throw iI(e);return r}}class dI{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3277
+ */class se extends $e{constructor(e,t,r=0){super(ia(e),`Firebase Storage: ${t} (${ia(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,se.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return ia(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3278
+ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var te;(function(n){n.UNKNOWN="unknown",n.OBJECT_NOT_FOUND="object-not-found",n.BUCKET_NOT_FOUND="bucket-not-found",n.PROJECT_NOT_FOUND="project-not-found",n.QUOTA_EXCEEDED="quota-exceeded",n.UNAUTHENTICATED="unauthenticated",n.UNAUTHORIZED="unauthorized",n.UNAUTHORIZED_APP="unauthorized-app",n.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",n.INVALID_CHECKSUM="invalid-checksum",n.CANCELED="canceled",n.INVALID_EVENT_NAME="invalid-event-name",n.INVALID_URL="invalid-url",n.INVALID_DEFAULT_BUCKET="invalid-default-bucket",n.NO_DEFAULT_BUCKET="no-default-bucket",n.CANNOT_SLICE_BLOB="cannot-slice-blob",n.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",n.NO_DOWNLOAD_URL="no-download-url",n.INVALID_ARGUMENT="invalid-argument",n.INVALID_ARGUMENT_COUNT="invalid-argument-count",n.APP_DELETED="app-deleted",n.INVALID_ROOT_OPERATION="invalid-root-operation",n.INVALID_FORMAT="invalid-format",n.INTERNAL_ERROR="internal-error",n.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(te||(te={}));function ia(n){return"storage/"+n}function oa(){const n="An unknown error occurred, please check the error payload for server response.";return new se(te.UNKNOWN,n)}function KE(n){return new se(te.OBJECT_NOT_FOUND,"Object '"+n+"' does not exist.")}function QE(n){return new se(te.QUOTA_EXCEEDED,"Quota for bucket '"+n+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function YE(){const n="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new se(te.UNAUTHENTICATED,n)}function XE(){return new se(te.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function JE(n){return new se(te.UNAUTHORIZED,"User does not have permission to access '"+n+"'.")}function Bh(){return new se(te.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function jh(){return new se(te.CANCELED,"User canceled the upload/download.")}function ZE(n){return new se(te.INVALID_URL,"Invalid URL '"+n+"'.")}function eT(n){return new se(te.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+n+"'.")}function tT(){return new se(te.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+Fh+"' property when initializing the app?")}function qh(){return new se(te.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function nT(){return new se(te.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function rT(){return new se(te.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function sT(n){return new se(te.UNSUPPORTED_ENVIRONMENT,`${n} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function aa(n){return new se(te.INVALID_ARGUMENT,n)}function $h(){return new se(te.APP_DELETED,"The Firebase app was deleted.")}function iT(n){return new se(te.INVALID_ROOT_OPERATION,"The operation '"+n+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function br(n,e){return new se(te.INVALID_FORMAT,"String does not match format '"+n+"': "+e)}function Pr(n){throw new se(te.INTERNAL_ERROR,"Internal error: "+n)}/**
3250
3279
  * @license
3251
3280
  * Copyright 2017 Google LLC
3252
3281
  *
@@ -3261,7 +3290,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3261
3290
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3262
3291
  * See the License for the specific language governing permissions and
3263
3292
  * limitations under the License.
3264
- */function fI(t,e,n){let r=1,s=null,i=null,o=!1,a=0;function c(){return a===2}let u=!1;function l(...g){u||(u=!0,e.apply(null,g))}function h(g){s=setTimeout(()=>{s=null,t(f,c())},g)}function d(){i&&clearTimeout(i)}function f(g,...k){if(u){d();return}if(g){d(),l.call(null,g,...k);return}if(c()||o){d(),l.call(null,g,...k);return}r<64&&(r*=2);let b;a===1?(a=2,b=0):b=(r+Math.random())*1e3,h(b)}let E=!1;function v(g){E||(E=!0,d(),!u&&(s!==null?(g||(a=2),clearTimeout(s),h(0)):g||(a=1)))}return h(0),i=setTimeout(()=>{o=!0,v(!0)},n),v}function pI(t){t(!1)}/**
3293
+ */class Ue{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let r;try{r=Ue.makeFromUrl(e,t)}catch{return new Ue(e,"")}if(r.path==="")return r;throw eT(e)}static makeFromUrl(e,t){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(z){z.path.charAt(z.path.length-1)==="/"&&(z.path_=z.path_.slice(0,-1))}const a="(/(.*))?$",c=new RegExp("^gs://"+s+a,"i"),l={bucket:1,path:3};function d(z){z.path_=decodeURIComponent(z.path)}const p="v[A-Za-z0-9_]+",g=t.replace(/[.]/g,"\\."),v="(/([^?#]*).*)?$",R=new RegExp(`^https?://${g}/${p}/b/${s}/o${v}`,"i"),C={bucket:1,path:3},N=t===xh?"(?:storage.googleapis.com|storage.cloud.google.com)":t,S="([^?#]*)",U=new RegExp(`^https?://${N}/${s}/${S}`,"i"),x=[{regex:c,indices:l,postModify:i},{regex:R,indices:C,postModify:d},{regex:U,indices:{bucket:1,path:2},postModify:d}];for(let z=0;z<x.length;z++){const le=x[z],J=le.regex.exec(e);if(J){const T=J[le.indices.bucket];let m=J[le.indices.path];m||(m=""),r=new Ue(T,m),le.postModify(r);break}}if(r==null)throw ZE(e);return r}}class oT{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3265
3294
  * @license
3266
3295
  * Copyright 2017 Google LLC
3267
3296
  *
@@ -3276,7 +3305,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3276
3305
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3277
3306
  * See the License for the specific language governing permissions and
3278
3307
  * limitations under the License.
3279
- */function mI(t){return t!==void 0}function gI(t){return typeof t=="function"}function _I(t){return typeof t=="object"&&!Array.isArray(t)}function di(t){return typeof t=="string"||t instanceof String}function Qd(t){return Ua()&&t instanceof Blob}function Ua(){return typeof Blob<"u"&&!Nf()}function Yd(t,e,n,r){if(r<e)throw Ma(`Invalid value for '${t}'. Expected ${e} or greater.`);if(r>n)throw Ma(`Invalid value for '${t}'. Expected ${n} or less.`)}/**
3308
+ */function aT(n,e,t){let r=1,s=null,i=null,a=!1,c=0;function l(){return c===2}let d=!1;function p(...S){d||(d=!0,e.apply(null,S))}function g(S){s=setTimeout(()=>{s=null,n(R,l())},S)}function v(){i&&clearTimeout(i)}function R(S,...U){if(d){v();return}if(S){v(),p.call(null,S,...U);return}if(l()||a){v(),p.call(null,S,...U);return}r<64&&(r*=2);let x;c===1?(c=2,x=0):x=(r+Math.random())*1e3,g(x)}let C=!1;function N(S){C||(C=!0,v(),!d&&(s!==null?(S||(c=2),clearTimeout(s),g(0)):S||(c=1)))}return g(0),i=setTimeout(()=>{a=!0,N(!0)},t),N}function cT(n){n(!1)}/**
3280
3309
  * @license
3281
3310
  * Copyright 2017 Google LLC
3282
3311
  *
@@ -3291,7 +3320,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3291
3320
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3292
3321
  * See the License for the specific language governing permissions and
3293
3322
  * limitations under the License.
3294
- */function Pn(t,e,n){let r=e;return n==null&&(r=`https://${e}`),`${n}://${r}/v0${t}`}function Xd(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}/**
3323
+ */function uT(n){return n!==void 0}function lT(n){return typeof n=="function"}function hT(n){return typeof n=="object"&&!Array.isArray(n)}function Zs(n){return typeof n=="string"||n instanceof String}function zh(n){return ca()&&n instanceof Blob}function ca(){return typeof Blob<"u"}function Hh(n,e,t,r){if(r<e)throw aa(`Invalid value for '${n}'. Expected ${e} or greater.`);if(r>t)throw aa(`Invalid value for '${n}'. Expected ${t} or less.`)}/**
3295
3324
  * @license
3296
3325
  * Copyright 2017 Google LLC
3297
3326
  *
@@ -3306,7 +3335,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3306
3335
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3307
3336
  * See the License for the specific language governing permissions and
3308
3337
  * limitations under the License.
3309
- */var jt;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(jt||(jt={}));/**
3338
+ */function Ln(n,e,t){let r=e;return t==null&&(r=`https://${e}`),`${t}://${r}/v0${n}`}function Wh(n){const e=encodeURIComponent;let t="?";for(const r in n)if(n.hasOwnProperty(r)){const s=e(r)+"="+e(n[r]);t=t+s+"&"}return t=t.slice(0,-1),t}var en;(function(n){n[n.NO_ERROR=0]="NO_ERROR",n[n.NETWORK_ERROR=1]="NETWORK_ERROR",n[n.ABORT=2]="ABORT"})(en||(en={}));/**
3310
3339
  * @license
3311
3340
  * Copyright 2022 Google LLC
3312
3341
  *
@@ -3321,7 +3350,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3321
3350
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3322
3351
  * See the License for the specific language governing permissions and
3323
3352
  * limitations under the License.
3324
- */function Jd(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/**
3353
+ */function Gh(n,e){const t=n>=500&&n<600,s=[408,429].indexOf(n)!==-1,i=e.indexOf(n)!==-1;return t||s||i}/**
3325
3354
  * @license
3326
3355
  * Copyright 2017 Google LLC
3327
3356
  *
@@ -3336,7 +3365,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3336
3365
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3337
3366
  * See the License for the specific language governing permissions and
3338
3367
  * limitations under the License.
3339
- */class yI{constructor(e,n,r,s,i,o,a,c,u,l,h,d=!0){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=a,this.errorCallback_=c,this.timeout_=u,this.progressCallback_=l,this.connectionFactory_=h,this.retry=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((f,E)=>{this.resolve_=f,this.reject_=E,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new fi(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=a=>{const c=a.loaded,u=a.lengthComputable?a.total:-1;this.progressCallback_!==null&&this.progressCallback_(c,u)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const a=i.getErrorCode()===jt.NO_ERROR,c=i.getStatus();if(!a||Jd(c,this.additionalRetryCodes_)&&this.retry){const l=i.getErrorCode()===jt.ABORT;r(!1,new fi(!1,null,l));return}const u=this.successCodes_.indexOf(c)!==-1;r(!0,new fi(u,i))})},n=(r,s)=>{const i=this.resolve_,o=this.reject_,a=s.connection;if(s.wasSuccessCode)try{const c=this.callback_(a,a.getResponse());mI(c)?i(c):i()}catch(c){o(c)}else if(a!==null){const c=La();c.serverResponse=a.getErrorText(),this.errorCallback_?o(this.errorCallback_(a,c)):o(c)}else if(s.canceled){const c=this.appDelete_?Kd():Wd();o(c)}else{const c=Hd();o(c)}};this.canceled_?n(!1,new fi(!1,null,!0)):this.backoffId_=fI(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&pI(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class fi{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function EI(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function vI(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function TI(t,e){e&&(t["X-Firebase-GMPID"]=e)}function II(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}function wI(t,e,n,r,s,i,o=!0){const a=Xd(t.urlParams),c=t.url+a,u=Object.assign({},t.headers);return TI(u,e),EI(u,n),vI(u,i),II(u,r),new yI(c,t.method,u,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o)}/**
3368
+ */class dT{constructor(e,t,r,s,i,a,c,l,d,p,g,v=!0){this.url_=e,this.method_=t,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=a,this.callback_=c,this.errorCallback_=l,this.timeout_=d,this.progressCallback_=p,this.connectionFactory_=g,this.retry=v,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((R,C)=>{this.resolve_=R,this.reject_=C,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new ei(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const a=c=>{const l=c.loaded,d=c.lengthComputable?c.total:-1;this.progressCallback_!==null&&this.progressCallback_(l,d)};this.progressCallback_!==null&&i.addUploadProgressListener(a),i.send(this.url_,this.method_,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(a),this.pendingConnection_=null;const c=i.getErrorCode()===en.NO_ERROR,l=i.getStatus();if(!c||Gh(l,this.additionalRetryCodes_)&&this.retry){const p=i.getErrorCode()===en.ABORT;r(!1,new ei(!1,null,p));return}const d=this.successCodes_.indexOf(l)!==-1;r(!0,new ei(d,i))})},t=(r,s)=>{const i=this.resolve_,a=this.reject_,c=s.connection;if(s.wasSuccessCode)try{const l=this.callback_(c,c.getResponse());uT(l)?i(l):i()}catch(l){a(l)}else if(c!==null){const l=oa();l.serverResponse=c.getErrorText(),this.errorCallback_?a(this.errorCallback_(c,l)):a(l)}else if(s.canceled){const l=this.appDelete_?$h():jh();a(l)}else{const l=Bh();a(l)}};this.canceled_?t(!1,new ei(!1,null,!0)):this.backoffId_=aT(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&cT(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class ei{constructor(e,t,r){this.wasSuccessCode=e,this.connection=t,this.canceled=!!r}}function fT(n,e){e!==null&&e.length>0&&(n.Authorization="Firebase "+e)}function pT(n,e){n["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function mT(n,e){e&&(n["X-Firebase-GMPID"]=e)}function gT(n,e){e!==null&&(n["X-Firebase-AppCheck"]=e)}function _T(n,e,t,r,s,i,a=!0){const c=Wh(n.urlParams),l=n.url+c,d=Object.assign({},n.headers);return mT(d,e),fT(d,t),pT(d,i),gT(d,r),new dT(l,n.method,d,n.body,n.successCodes,n.additionalRetryCodes,n.handler,n.errorHandler,n.timeout,n.progressCallback,s,a)}/**
3340
3369
  * @license
3341
3370
  * Copyright 2017 Google LLC
3342
3371
  *
@@ -3351,7 +3380,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3351
3380
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3352
3381
  * See the License for the specific language governing permissions and
3353
3382
  * limitations under the License.
3354
- */function AI(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function RI(...t){const e=AI();if(e!==void 0){const n=new e;for(let r=0;r<t.length;r++)n.append(t[r]);return n.getBlob()}else{if(Ua())return new Blob(t);throw new z($.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function PI(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}/**
3383
+ */function yT(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function vT(...n){const e=yT();if(e!==void 0){const t=new e;for(let r=0;r<n.length;r++)t.append(n[r]);return t.getBlob()}else{if(ca())return new Blob(n);throw new se(te.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function ET(n,e,t){return n.webkitSlice?n.webkitSlice(e,t):n.mozSlice?n.mozSlice(e,t):n.slice?n.slice(e,t):null}/**
3355
3384
  * @license
3356
3385
  * Copyright 2021 Google LLC
3357
3386
  *
@@ -3366,7 +3395,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3366
3395
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3367
3396
  * See the License for the specific language governing permissions and
3368
3397
  * limitations under the License.
3369
- */function SI(t){if(typeof atob>"u")throw lI("base-64");return atob(t)}/**
3398
+ */function TT(n){if(typeof atob>"u")throw sT("base-64");return atob(n)}/**
3370
3399
  * @license
3371
3400
  * Copyright 2017 Google LLC
3372
3401
  *
@@ -3381,7 +3410,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3381
3410
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3382
3411
  * See the License for the specific language governing permissions and
3383
3412
  * limitations under the License.
3384
- */const Ge={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class xa{constructor(e,n){this.data=e,this.contentType=n||null}}function CI(t,e){switch(t){case Ge.RAW:return new xa(Zd(e));case Ge.BASE64:case Ge.BASE64URL:return new xa(ef(t,e));case Ge.DATA_URL:return new xa(kI(e),NI(e))}throw La()}function Zd(t){const e=[];for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{const i=r,o=t.charCodeAt(++n);r=65536|(i&1023)<<10|o&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function bI(t){let e;try{e=decodeURIComponent(t)}catch{throw Lr(Ge.DATA_URL,"Malformed data URL.")}return Zd(e)}function ef(t,e){switch(t){case Ge.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw Lr(t,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case Ge.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw Lr(t,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=SI(e)}catch(s){throw s.message.includes("polyfill")?s:Lr(t,"Invalid character found")}const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}class tf{constructor(e){this.base64=!1,this.contentType=null;const n=e.match(/^data:([^,]+)?,/);if(n===null)throw Lr(Ge.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=n[1]||null;r!=null&&(this.base64=DI(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function kI(t){const e=new tf(t);return e.base64?ef(Ge.BASE64,e.rest):bI(e.rest)}function NI(t){return new tf(t).contentType}function DI(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}/**
3413
+ */const at={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class ua{constructor(e,t){this.data=e,this.contentType=t||null}}function wT(n,e){switch(n){case at.RAW:return new ua(Kh(e));case at.BASE64:case at.BASE64URL:return new ua(Qh(n,e));case at.DATA_URL:return new ua(AT(e),RT(e))}throw oa()}function Kh(n){const e=[];for(let t=0;t<n.length;t++){let r=n.charCodeAt(t);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(t<n.length-1&&(n.charCodeAt(t+1)&64512)===56320))e.push(239,191,189);else{const i=r,a=n.charCodeAt(++t);r=65536|(i&1023)<<10|a&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function IT(n){let e;try{e=decodeURIComponent(n)}catch{throw br(at.DATA_URL,"Malformed data URL.")}return Kh(e)}function Qh(n,e){switch(n){case at.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw br(n,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case at.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw br(n,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let t;try{t=TT(e)}catch(s){throw s.message.includes("polyfill")?s:br(n,"Invalid character found")}const r=new Uint8Array(t.length);for(let s=0;s<t.length;s++)r[s]=t.charCodeAt(s);return r}class Yh{constructor(e){this.base64=!1,this.contentType=null;const t=e.match(/^data:([^,]+)?,/);if(t===null)throw br(at.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=t[1]||null;r!=null&&(this.base64=bT(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function AT(n){const e=new Yh(n);return e.base64?Qh(at.BASE64,e.rest):IT(e.rest)}function RT(n){return new Yh(n).contentType}function bT(n,e){return n.length>=e.length?n.substring(n.length-e.length)===e:!1}/**
3385
3414
  * @license
3386
3415
  * Copyright 2017 Google LLC
3387
3416
  *
@@ -3396,7 +3425,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3396
3425
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3397
3426
  * See the License for the specific language governing permissions and
3398
3427
  * limitations under the License.
3399
- */class At{constructor(e,n){let r=0,s="";Qd(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,n){if(Qd(this.data_)){const r=this.data_,s=PI(r,e,n);return s===null?null:new At(s)}else{const r=new Uint8Array(this.data_.buffer,e,n-e);return new At(r,!0)}}static getBlob(...e){if(Ua()){const n=e.map(r=>r instanceof At?r.data_:r);return new At(RI.apply(null,n))}else{const n=e.map(o=>di(o)?CI(Ge.RAW,o).data:o.data_);let r=0;n.forEach(o=>{r+=o.byteLength});const s=new Uint8Array(r);let i=0;return n.forEach(o=>{for(let a=0;a<o.length;a++)s[i++]=o[a]}),new At(s,!0)}}uploadData(){return this.data_}}/**
3428
+ */class Mt{constructor(e,t){let r=0,s="";zh(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(t?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(t?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,t){if(zh(this.data_)){const r=this.data_,s=ET(r,e,t);return s===null?null:new Mt(s)}else{const r=new Uint8Array(this.data_.buffer,e,t-e);return new Mt(r,!0)}}static getBlob(...e){if(ca()){const t=e.map(r=>r instanceof Mt?r.data_:r);return new Mt(vT.apply(null,t))}else{const t=e.map(a=>Zs(a)?wT(at.RAW,a).data:a.data_);let r=0;t.forEach(a=>{r+=a.byteLength});const s=new Uint8Array(r);let i=0;return t.forEach(a=>{for(let c=0;c<a.length;c++)s[i++]=a[c]}),new Mt(s,!0)}}uploadData(){return this.data_}}/**
3400
3429
  * @license
3401
3430
  * Copyright 2017 Google LLC
3402
3431
  *
@@ -3411,7 +3440,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3411
3440
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3412
3441
  * See the License for the specific language governing permissions and
3413
3442
  * limitations under the License.
3414
- */function nf(t){let e;try{e=JSON.parse(t)}catch{return null}return _I(e)?e:null}/**
3443
+ */function Xh(n){let e;try{e=JSON.parse(n)}catch{return null}return hT(e)?e:null}/**
3415
3444
  * @license
3416
3445
  * Copyright 2017 Google LLC
3417
3446
  *
@@ -3426,7 +3455,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3426
3455
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3427
3456
  * See the License for the specific language governing permissions and
3428
3457
  * limitations under the License.
3429
- */function OI(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function VI(t,e){const n=e.split("/").filter(r=>r.length>0).join("/");return t.length===0?n:t+"/"+n}function rf(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/**
3458
+ */function PT(n){if(n.length===0)return null;const e=n.lastIndexOf("/");return e===-1?"":n.slice(0,e)}function ST(n,e){const t=e.split("/").filter(r=>r.length>0).join("/");return n.length===0?t:n+"/"+t}function Jh(n){const e=n.lastIndexOf("/",n.length-2);return e===-1?n:n.slice(e+1)}/**
3430
3459
  * @license
3431
3460
  * Copyright 2017 Google LLC
3432
3461
  *
@@ -3441,7 +3470,7 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3441
3470
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3442
3471
  * See the License for the specific language governing permissions and
3443
3472
  * limitations under the License.
3444
- */function LI(t,e){return e}class pe{constructor(e,n,r,s){this.server=e,this.local=n||e,this.writable=!!r,this.xform=s||LI}}let pi=null;function MI(t){return!di(t)||t.length<2?t:rf(t)}function sf(){if(pi)return pi;const t=[];t.push(new pe("bucket")),t.push(new pe("generation")),t.push(new pe("metageneration")),t.push(new pe("name","fullPath",!0));function e(i,o){return MI(o)}const n=new pe("name");n.xform=e,t.push(n);function r(i,o){return o!==void 0?Number(o):o}const s=new pe("size");return s.xform=r,t.push(s),t.push(new pe("timeCreated")),t.push(new pe("updated")),t.push(new pe("md5Hash",null,!0)),t.push(new pe("cacheControl",null,!0)),t.push(new pe("contentDisposition",null,!0)),t.push(new pe("contentEncoding",null,!0)),t.push(new pe("contentLanguage",null,!0)),t.push(new pe("contentType",null,!0)),t.push(new pe("metadata","customMetadata",!0)),pi=t,pi}function UI(t,e){function n(){const r=t.bucket,s=t.fullPath,i=new we(r,s);return e._makeStorageReference(i)}Object.defineProperty(t,"ref",{get:n})}function xI(t,e,n){const r={};r.type="file";const s=n.length;for(let i=0;i<s;i++){const o=n[i];r[o.local]=o.xform(r,e[o.server])}return UI(r,t),r}function of(t,e,n){const r=nf(e);return r===null?null:xI(t,r,n)}function FI(t,e,n,r){const s=nf(e);if(s===null||!di(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const o=encodeURIComponent;return i.split(",").map(u=>{const l=t.bucket,h=t.fullPath,d="/b/"+o(l)+"/o/"+o(h),f=Pn(d,n,r),E=Xd({alt:"media",token:u});return f+E})[0]}function af(t,e){const n={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(n[i.server]=t[i.local])}return JSON.stringify(n)}class zt{constructor(e,n,r,s){this.url=e,this.method=n,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
3473
+ */function CT(n,e){return e}class Se{constructor(e,t,r,s){this.server=e,this.local=t||e,this.writable=!!r,this.xform=s||CT}}let ti=null;function kT(n){return!Zs(n)||n.length<2?n:Jh(n)}function Zh(){if(ti)return ti;const n=[];n.push(new Se("bucket")),n.push(new Se("generation")),n.push(new Se("metageneration")),n.push(new Se("name","fullPath",!0));function e(i,a){return kT(a)}const t=new Se("name");t.xform=e,n.push(t);function r(i,a){return a!==void 0?Number(a):a}const s=new Se("size");return s.xform=r,n.push(s),n.push(new Se("timeCreated")),n.push(new Se("updated")),n.push(new Se("md5Hash",null,!0)),n.push(new Se("cacheControl",null,!0)),n.push(new Se("contentDisposition",null,!0)),n.push(new Se("contentEncoding",null,!0)),n.push(new Se("contentLanguage",null,!0)),n.push(new Se("contentType",null,!0)),n.push(new Se("metadata","customMetadata",!0)),ti=n,ti}function NT(n,e){function t(){const r=n.bucket,s=n.fullPath,i=new Ue(r,s);return e._makeStorageReference(i)}Object.defineProperty(n,"ref",{get:t})}function DT(n,e,t){const r={};r.type="file";const s=t.length;for(let i=0;i<s;i++){const a=t[i];r[a.local]=a.xform(r,e[a.server])}return NT(r,n),r}function ed(n,e,t){const r=Xh(e);return r===null?null:DT(n,r,t)}function OT(n,e,t,r){const s=Xh(e);if(s===null||!Zs(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const a=encodeURIComponent;return i.split(",").map(d=>{const p=n.bucket,g=n.fullPath,v="/b/"+a(p)+"/o/"+a(g),R=Ln(v,t,r),C=Wh({alt:"media",token:d});return R+C})[0]}function td(n,e){const t={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(t[i.server]=n[i.local])}return JSON.stringify(t)}class tn{constructor(e,t,r,s){this.url=e,this.method=t,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
3445
3474
  * @license
3446
3475
  * Copyright 2017 Google LLC
3447
3476
  *
@@ -3456,15 +3485,15 @@ ${this.customData.serverResponse}`:this.message=this._baseMessage}}var $;(functi
3456
3485
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3457
3486
  * See the License for the specific language governing permissions and
3458
3487
  * limitations under the License.
3459
- */function it(t){if(!t)throw La()}function Fa(t,e){function n(r,s){const i=of(t,s,e);return it(i!==null),i}return n}function BI(t,e){function n(r,s){const i=of(t,s,e);return it(i!==null),FI(i,s,t.host,t._protocol)}return n}function Ur(t){function e(n,r){let s;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?s=rI():s=nI():n.getStatus()===402?s=tI(t.bucket):n.getStatus()===403?s=sI(t.path):s=r,s.status=n.getStatus(),s.serverResponse=r.serverResponse,s}return e}function Ba(t){const e=Ur(t);function n(r,s){let i=e(r,s);return r.getStatus()===404&&(i=eI(t.path)),i.serverResponse=s.serverResponse,i}return n}function qI(t,e,n){const r=e.fullServerUrl(),s=Pn(r,t.host,t._protocol),i="GET",o=t.maxOperationRetryTime,a=new zt(s,i,Fa(t,n),o);return a.errorHandler=Ba(e),a}function $I(t,e,n){const r=e.fullServerUrl(),s=Pn(r,t.host,t._protocol),i="GET",o=t.maxOperationRetryTime,a=new zt(s,i,BI(t,n),o);return a.errorHandler=Ba(e),a}function jI(t,e){const n=e.fullServerUrl(),r=Pn(n,t.host,t._protocol),s="DELETE",i=t.maxOperationRetryTime;function o(c,u){}const a=new zt(r,s,o,i);return a.successCodes=[200,204],a.errorHandler=Ba(e),a}function zI(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function cf(t,e,n){const r=Object.assign({},n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=zI(null,e)),r}function HI(t,e,n,r,s){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};function a(){let b="";for(let U=0;U<2;U++)b=b+Math.random().toString().slice(2);return b}const c=a();o["Content-Type"]="multipart/related; boundary="+c;const u=cf(e,r,s),l=af(u,n),h="--"+c+`\r
3488
+ */function yt(n){if(!n)throw oa()}function la(n,e){function t(r,s){const i=ed(n,s,e);return yt(i!==null),i}return t}function VT(n,e){function t(r,s){const i=ed(n,s,e);return yt(i!==null),OT(i,s,n.host,n._protocol)}return t}function Sr(n){function e(t,r){let s;return t.getStatus()===401?t.getErrorText().includes("Firebase App Check token is invalid")?s=XE():s=YE():t.getStatus()===402?s=QE(n.bucket):t.getStatus()===403?s=JE(n.path):s=r,s.status=t.getStatus(),s.serverResponse=r.serverResponse,s}return e}function ha(n){const e=Sr(n);function t(r,s){let i=e(r,s);return r.getStatus()===404&&(i=KE(n.path)),i.serverResponse=s.serverResponse,i}return t}function LT(n,e,t){const r=e.fullServerUrl(),s=Ln(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new tn(s,i,la(n,t),a);return c.errorHandler=ha(e),c}function MT(n,e,t){const r=e.fullServerUrl(),s=Ln(r,n.host,n._protocol),i="GET",a=n.maxOperationRetryTime,c=new tn(s,i,VT(n,t),a);return c.errorHandler=ha(e),c}function UT(n,e){const t=e.fullServerUrl(),r=Ln(t,n.host,n._protocol),s="DELETE",i=n.maxOperationRetryTime;function a(l,d){}const c=new tn(r,s,a,i);return c.successCodes=[200,204],c.errorHandler=ha(e),c}function xT(n,e){return n&&n.contentType||e&&e.type()||"application/octet-stream"}function nd(n,e,t){const r=Object.assign({},t);return r.fullPath=n.path,r.size=e.size(),r.contentType||(r.contentType=xT(null,e)),r}function FT(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"};function c(){let x="";for(let z=0;z<2;z++)x=x+Math.random().toString().slice(2);return x}const l=c();a["Content-Type"]="multipart/related; boundary="+l;const d=nd(e,r,s),p=td(d,t),g="--"+l+`\r
3460
3489
  Content-Type: application/json; charset=utf-8\r
3461
3490
  \r
3462
- `+l+`\r
3463
- --`+c+`\r
3464
- Content-Type: `+u.contentType+`\r
3491
+ `+p+`\r
3492
+ --`+l+`\r
3493
+ Content-Type: `+d.contentType+`\r
3465
3494
  \r
3466
- `,d=`\r
3467
- --`+c+"--",f=At.getBlob(h,r,d);if(f===null)throw Gd();const E={name:u.fullPath},v=Pn(i,t.host,t._protocol),g="POST",k=t.maxUploadRetryTime,O=new zt(v,g,Fa(t,n),k);return O.urlParams=E,O.headers=o,O.body=f.uploadData(),O.errorHandler=Ur(e),O}class mi{constructor(e,n,r,s){this.current=e,this.total=n,this.finalized=!!r,this.metadata=s||null}}function qa(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch{it(!1)}return it(!!n&&(e||["active"]).indexOf(n)!==-1),n}function WI(t,e,n,r,s){const i=e.bucketOnlyServerUrl(),o=cf(e,r,s),a={name:o.fullPath},c=Pn(i,t.host,t._protocol),u="POST",l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":o.contentType,"Content-Type":"application/json; charset=utf-8"},h=af(o,n),d=t.maxUploadRetryTime;function f(v){qa(v);let g;try{g=v.getResponseHeader("X-Goog-Upload-URL")}catch{it(!1)}return it(di(g)),g}const E=new zt(c,u,f,d);return E.urlParams=a,E.headers=l,E.body=h,E.errorHandler=Ur(e),E}function GI(t,e,n,r){const s={"X-Goog-Upload-Command":"query"};function i(u){const l=qa(u,["active","final"]);let h=null;try{h=u.getResponseHeader("X-Goog-Upload-Size-Received")}catch{it(!1)}h||it(!1);const d=Number(h);return it(!isNaN(d)),new mi(d,r.size(),l==="final")}const o="POST",a=t.maxUploadRetryTime,c=new zt(n,o,i,a);return c.headers=s,c.errorHandler=Ur(e),c}const uf=256*1024;function KI(t,e,n,r,s,i,o,a){const c=new mi(0,0);if(o?(c.current=o.current,c.total=o.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw cI();const u=c.total-c.current;let l=u;s>0&&(l=Math.min(l,s));const h=c.current,d=h+l;let f="";l===0?f="finalize":u===l?f="upload, finalize":f="upload";const E={"X-Goog-Upload-Command":f,"X-Goog-Upload-Offset":`${c.current}`},v=r.slice(h,d);if(v===null)throw Gd();function g(U,me){const de=qa(U,["active","final"]),ot=c.current+l,Rt=r.size();let at;return de==="final"?at=Fa(e,i)(U,me):at=null,new mi(ot,Rt,de==="final",at)}const k="POST",O=e.maxUploadRetryTime,b=new zt(n,k,g,O);return b.headers=E,b.body=v.uploadData(),b.progressCallback=a||null,b.errorHandler=Ur(t),b}const _e={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function $a(t){switch(t){case"running":case"pausing":case"canceling":return _e.RUNNING;case"paused":return _e.PAUSED;case"success":return _e.SUCCESS;case"canceled":return _e.CANCELED;case"error":return _e.ERROR;default:return _e.ERROR}}/**
3495
+ `,v=`\r
3496
+ --`+l+"--",R=Mt.getBlob(g,r,v);if(R===null)throw qh();const C={name:d.fullPath},N=Ln(i,n.host,n._protocol),S="POST",U=n.maxUploadRetryTime,$=new tn(N,S,la(n,t),U);return $.urlParams=C,$.headers=a,$.body=R.uploadData(),$.errorHandler=Sr(e),$}class ni{constructor(e,t,r,s){this.current=e,this.total=t,this.finalized=!!r,this.metadata=s||null}}function da(n,e){let t=null;try{t=n.getResponseHeader("X-Goog-Upload-Status")}catch{yt(!1)}return yt(!!t&&(e||["active"]).indexOf(t)!==-1),t}function BT(n,e,t,r,s){const i=e.bucketOnlyServerUrl(),a=nd(e,r,s),c={name:a.fullPath},l=Ln(i,n.host,n._protocol),d="POST",p={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${r.size()}`,"X-Goog-Upload-Header-Content-Type":a.contentType,"Content-Type":"application/json; charset=utf-8"},g=td(a,t),v=n.maxUploadRetryTime;function R(N){da(N);let S;try{S=N.getResponseHeader("X-Goog-Upload-URL")}catch{yt(!1)}return yt(Zs(S)),S}const C=new tn(l,d,R,v);return C.urlParams=c,C.headers=p,C.body=g,C.errorHandler=Sr(e),C}function jT(n,e,t,r){const s={"X-Goog-Upload-Command":"query"};function i(d){const p=da(d,["active","final"]);let g=null;try{g=d.getResponseHeader("X-Goog-Upload-Size-Received")}catch{yt(!1)}g||yt(!1);const v=Number(g);return yt(!isNaN(v)),new ni(v,r.size(),p==="final")}const a="POST",c=n.maxUploadRetryTime,l=new tn(t,a,i,c);return l.headers=s,l.errorHandler=Sr(e),l}const rd=256*1024;function qT(n,e,t,r,s,i,a,c){const l=new ni(0,0);if(a?(l.current=a.current,l.total=a.total):(l.current=0,l.total=r.size()),r.size()!==l.total)throw nT();const d=l.total-l.current;let p=d;s>0&&(p=Math.min(p,s));const g=l.current,v=g+p;let R="";p===0?R="finalize":d===p?R="upload, finalize":R="upload";const C={"X-Goog-Upload-Command":R,"X-Goog-Upload-Offset":`${l.current}`},N=r.slice(g,v);if(N===null)throw qh();function S(z,le){const J=da(z,["active","final"]),T=l.current+p,m=r.size();let _;return J==="final"?_=la(e,i)(z,le):_=null,new ni(T,m,J==="final",_)}const U="POST",$=e.maxUploadRetryTime,x=new tn(t,U,S,$);return x.headers=C,x.body=N.uploadData(),x.progressCallback=c||null,x.errorHandler=Sr(n),x}const Oe={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};function fa(n){switch(n){case"running":case"pausing":case"canceling":return Oe.RUNNING;case"paused":return Oe.PAUSED;case"success":return Oe.SUCCESS;case"canceled":return Oe.CANCELED;case"error":return Oe.ERROR;default:return Oe.ERROR}}/**
3468
3497
  * @license
3469
3498
  * Copyright 2017 Google LLC
3470
3499
  *
@@ -3479,7 +3508,7 @@ Content-Type: `+u.contentType+`\r
3479
3508
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3480
3509
  * See the License for the specific language governing permissions and
3481
3510
  * limitations under the License.
3482
- */class QI{constructor(e,n,r){if(gI(e)||n!=null||r!=null)this.next=e,this.error=n??void 0,this.complete=r??void 0;else{const i=e;this.next=i.next,this.error=i.error,this.complete=i.complete}}}/**
3511
+ */class $T{constructor(e,t,r){if(lT(e)||t!=null||r!=null)this.next=e,this.error=t??void 0,this.complete=r??void 0;else{const i=e;this.next=i.next,this.error=i.error,this.complete=i.complete}}}/**
3483
3512
  * @license
3484
3513
  * Copyright 2017 Google LLC
3485
3514
  *
@@ -3494,7 +3523,7 @@ Content-Type: `+u.contentType+`\r
3494
3523
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3495
3524
  * See the License for the specific language governing permissions and
3496
3525
  * limitations under the License.
3497
- */function Sn(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class YI{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=jt.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=jt.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=jt.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,n,r,s){if(this.sent_)throw Mr("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(n,e,!0),s!==void 0)for(const i in s)s.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,s[i].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Mr("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Mr("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Mr("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Mr("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class XI extends YI{initXhr(){this.xhr_.responseType="text"}}function Ht(){return new XI}/**
3526
+ */function Mn(n){return(...e)=>{Promise.resolve().then(()=>n(...e))}}class zT{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=en.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=en.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=en.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,t,r,s){if(this.sent_)throw Pr("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(t,e,!0),s!==void 0)for(const i in s)s.hasOwnProperty(i)&&this.xhr_.setRequestHeader(i,s[i].toString());return r!==void 0?this.xhr_.send(r):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Pr("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Pr("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Pr("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Pr("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class HT extends zT{initXhr(){this.xhr_.responseType="text"}}function nn(){return new HT}/**
3498
3527
  * @license
3499
3528
  * Copyright 2017 Google LLC
3500
3529
  *
@@ -3509,7 +3538,7 @@ Content-Type: `+u.contentType+`\r
3509
3538
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3510
3539
  * See the License for the specific language governing permissions and
3511
3540
  * limitations under the License.
3512
- */class JI{constructor(e,n,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=n,this._metadata=r,this._mappings=sf(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals($.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(Jd(s.status,[]))if(i)s=Hd();else{this.sleepTime=Math.max(this.sleepTime*2,ZT),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals($.CANCELED)?this.completeTransitions_():(this._error=s,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((s,i)=>{this._resolve=s,this._reject=i,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const e=this._transferred;return n=>this._updateProgress(e+n)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([n,r])=>{switch(this._state){case"running":e(n,r);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,n)=>{const r=WI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,Ht,e,n);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._uploadUrl=i,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((n,r)=>{const s=GI(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,Ht,n,r);this._request=i,i.getPromise().then(o=>{o=o,this._request=void 0,this._updateProgress(o.current),this._needToFetchStatus=!1,o.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=uf*this._chunkMultiplier,n=new mi(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let o;try{o=KI(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,n,this._makeProgressCallback())}catch(c){this._error=c,this._transition("error");return}const a=this._ref.storage._makeRequest(o,Ht,s,i,!1);this._request=a,a.getPromise().then(c=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(c.current),c.finalized?(this._metadata=c.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){uf*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,n)=>{const r=qI(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,Ht,e,n);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,n)=>{const r=HI(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,Ht,e,n);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const n=this._transferred;this._transferred=e,this._transferred!==n&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const n=this._state==="paused";this._state=e,n&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=Wd(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=$a(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,n,r,s){const i=new QI(n||void 0,r||void 0,s||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,n){return this._promise.then(e,n)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const n=this._observers.indexOf(e);n!==-1&&this._observers.splice(n,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(n=>{this._notifyObserver(n)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch($a(this._state)){case _e.SUCCESS:Sn(this._resolve.bind(null,this.snapshot))();break;case _e.CANCELED:case _e.ERROR:const n=this._reject;Sn(n.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch($a(this._state)){case _e.RUNNING:case _e.PAUSED:e.next&&Sn(e.next.bind(e,this.snapshot))();break;case _e.SUCCESS:e.complete&&Sn(e.complete.bind(e))();break;case _e.CANCELED:case _e.ERROR:e.error&&Sn(e.error.bind(e,this._error))();break;default:e.error&&Sn(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
3541
+ */class WT{constructor(e,t,r=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=t,this._metadata=r,this._mappings=Zh(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=s=>{if(this._request=void 0,this._chunkMultiplier=1,s._codeEquals(te.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const i=this.isExponentialBackoffExpired();if(Gh(s.status,[]))if(i)s=Bh();else{this.sleepTime=Math.max(this.sleepTime*2,GE),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=s,this._transition("error")}},this._metadataErrorHandler=s=>{this._request=void 0,s._codeEquals(te.CANCELED)?this.completeTransitions_():(this._error=s,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((s,i)=>{this._resolve=s,this._reject=i,this._start()}),this._promise.then(null,()=>{})}isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}_makeProgressCallback(){const e=this._transferred;return t=>this._updateProgress(e+t)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([t,r])=>{switch(this._state){case"running":e(t,r);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,t)=>{const r=BT(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,nn,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._uploadUrl=i,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((t,r)=>{const s=jT(this._ref.storage,this._ref._location,e,this._blob),i=this._ref.storage._makeRequest(s,nn,t,r);this._request=i,i.getPromise().then(a=>{a=a,this._request=void 0,this._updateProgress(a.current),this._needToFetchStatus=!1,a.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=rd*this._chunkMultiplier,t=new ni(this._transferred,this._blob.size()),r=this._uploadUrl;this._resolveToken((s,i)=>{let a;try{a=qT(this._ref._location,this._ref.storage,r,this._blob,e,this._mappings,t,this._makeProgressCallback())}catch(l){this._error=l,this._transition("error");return}const c=this._ref.storage._makeRequest(a,nn,s,i,!1);this._request=c,c.getPromise().then(l=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(l.current),l.finalized?(this._metadata=l.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){rd*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,t)=>{const r=LT(this._ref.storage,this._ref._location,this._mappings),s=this._ref.storage._makeRequest(r,nn,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,t)=>{const r=FT(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),s=this._ref.storage._makeRequest(r,nn,e,t);this._request=s,s.getPromise().then(i=>{this._request=void 0,this._metadata=i,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const t=this._transferred;this._transferred=e,this._transferred!==t&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const t=this._state==="paused";this._state=e,t&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=jh(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=fa(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,t,r,s){const i=new $T(t||void 0,r||void 0,s||void 0);return this._addObserver(i),()=>{this._removeObserver(i)}}then(e,t){return this._promise.then(e,t)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const t=this._observers.indexOf(e);t!==-1&&this._observers.splice(t,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEach(t=>{this._notifyObserver(t)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(fa(this._state)){case Oe.SUCCESS:Mn(this._resolve.bind(null,this.snapshot))();break;case Oe.CANCELED:case Oe.ERROR:const t=this._reject;Mn(t.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(fa(this._state)){case Oe.RUNNING:case Oe.PAUSED:e.next&&Mn(e.next.bind(e,this.snapshot))();break;case Oe.SUCCESS:e.complete&&Mn(e.complete.bind(e))();break;case Oe.CANCELED:case Oe.ERROR:e.error&&Mn(e.error.bind(e,this._error))();break;default:e.error&&Mn(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
3513
3542
  * @license
3514
3543
  * Copyright 2019 Google LLC
3515
3544
  *
@@ -3524,7 +3553,7 @@ Content-Type: `+u.contentType+`\r
3524
3553
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3525
3554
  * See the License for the specific language governing permissions and
3526
3555
  * limitations under the License.
3527
- */class Wt{constructor(e,n){this._service=e,n instanceof we?this._location=n:this._location=we.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new Wt(e,n)}get root(){const e=new we(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return rf(this._location.path)}get storage(){return this._service}get parent(){const e=OI(this._location.path);if(e===null)return null;const n=new we(this._location.bucket,e);return new Wt(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw hI(e)}}function ZI(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new JI(t,new At(e),n)}function ew(t){t._throwIfRoot("getDownloadURL");const e=$I(t.storage,t._location,sf());return t.storage.makeRequestWithTokens(e,Ht).then(n=>{if(n===null)throw uI();return n})}function tw(t){t._throwIfRoot("deleteObject");const e=jI(t.storage,t._location);return t.storage.makeRequestWithTokens(e,Ht)}function nw(t,e){const n=VI(t._location.path,e),r=new we(t._location.bucket,n);return new Wt(t.storage,r)}/**
3556
+ */class rn{constructor(e,t){this._service=e,t instanceof Ue?this._location=t:this._location=Ue.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new rn(e,t)}get root(){const e=new Ue(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return Jh(this._location.path)}get storage(){return this._service}get parent(){const e=PT(this._location.path);if(e===null)return null;const t=new Ue(this._location.bucket,e);return new rn(this._service,t)}_throwIfRoot(e){if(this._location.path==="")throw iT(e)}}function GT(n,e,t){return n._throwIfRoot("uploadBytesResumable"),new WT(n,new Mt(e),t)}function KT(n){n._throwIfRoot("getDownloadURL");const e=MT(n.storage,n._location,Zh());return n.storage.makeRequestWithTokens(e,nn).then(t=>{if(t===null)throw rT();return t})}function QT(n){n._throwIfRoot("deleteObject");const e=UT(n.storage,n._location);return n.storage.makeRequestWithTokens(e,nn)}function YT(n,e){const t=ST(n._location.path,e),r=new Ue(n._location.bucket,t);return new rn(n.storage,r)}/**
3528
3557
  * @license
3529
3558
  * Copyright 2017 Google LLC
3530
3559
  *
@@ -3539,7 +3568,7 @@ Content-Type: `+u.contentType+`\r
3539
3568
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3540
3569
  * See the License for the specific language governing permissions and
3541
3570
  * limitations under the License.
3542
- */function rw(t){return/^[A-Za-z]+:\/\//.test(t)}function sw(t,e){return new Wt(t,e)}function lf(t,e){if(t instanceof ja){const n=t;if(n._bucket==null)throw aI();const r=new Wt(n,n._bucket);return e!=null?lf(r,e):r}else return e!==void 0?nw(t,e):t}function iw(t,e){if(e&&rw(e)){if(t instanceof ja)return sw(t,e);throw Ma("To use ref(service, url), the first argument must be a Storage instance.")}else return lf(t,e)}function hf(t,e){const n=e==null?void 0:e[zd];return n==null?null:we.makeFromBucketSpec(n,t)}function ow(t,e,n,r={}){t.host=`${e}:${n}`,t._protocol="http";const{mockUserToken:s}=r;s&&(t._overrideAuthToken=typeof s=="string"?s:ec(s,t.app.options.projectId))}class ja{constructor(e,n,r,s,i){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._bucket=null,this._host=jd,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=XT,this._maxUploadRetryTime=JT,this._requests=new Set,s!=null?this._bucket=we.makeFromBucketSpec(s,this._host):this._bucket=hf(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=we.makeFromBucketSpec(this._url,e):this._bucket=hf(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Yd("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Yd("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new Wt(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new dI(Kd());{const o=wI(e,this._appId,r,s,n,this._firebaseVersion,i);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const df="@firebase/storage",ff="0.11.2";/**
3571
+ */function XT(n){return/^[A-Za-z]+:\/\//.test(n)}function JT(n,e){return new rn(n,e)}function sd(n,e){if(n instanceof pa){const t=n;if(t._bucket==null)throw tT();const r=new rn(t,t._bucket);return e!=null?sd(r,e):r}else return e!==void 0?YT(n,e):n}function ZT(n,e){if(e&&XT(e)){if(n instanceof pa)return JT(n,e);throw aa("To use ref(service, url), the first argument must be a Storage instance.")}else return sd(n,e)}function id(n,e){const t=e==null?void 0:e[Fh];return t==null?null:Ue.makeFromBucketSpec(t,n)}function ew(n,e,t,r={}){n.host=`${e}:${t}`,n._protocol="http";const{mockUserToken:s}=r;s&&(n._overrideAuthToken=typeof s=="string"?s:Qa(s,n.app.options.projectId))}class pa{constructor(e,t,r,s,i){this.app=e,this._authProvider=t,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._bucket=null,this._host=xh,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=HE,this._maxUploadRetryTime=WE,this._requests=new Set,s!=null?this._bucket=Ue.makeFromBucketSpec(s,this._host):this._bucket=id(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Ue.makeFromBucketSpec(this._url,e):this._bucket=id(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Hh("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Hh("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const t=await e.getToken();if(t!==null)return t.accessToken}return null}async _getAppCheckToken(){const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new rn(this,e)}_makeRequest(e,t,r,s,i=!0){if(this._deleted)return new oT($h());{const a=_T(e,this._appId,r,s,t,this._firebaseVersion,i);return this._requests.add(a),a.getPromise().then(()=>this._requests.delete(a),()=>this._requests.delete(a)),a}}async makeRequestWithTokens(e,t){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,r,s).getPromise()}}const od="@firebase/storage",ad="0.13.2";/**
3543
3572
  * @license
3544
3573
  * Copyright 2020 Google LLC
3545
3574
  *
@@ -3554,7 +3583,7 @@ Content-Type: `+u.contentType+`\r
3554
3583
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3555
3584
  * See the License for the specific language governing permissions and
3556
3585
  * limitations under the License.
3557
- */const pf="storage";function aw(t,e,n){return t=M(t),ZI(t,e,n)}function cw(t){return t=M(t),ew(t)}function uw(t){return t=M(t),tw(t)}function za(t,e){return t=M(t),iw(t,e)}function lw(t=$r(),e){t=M(t);const r=Vn(t,pf).getImmediate({identifier:e}),s=yi("storage");return s&&mf(r,...s),r}function mf(t,e,n,r={}){ow(t,e,n,r)}function hw(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new ja(n,r,s,e,Ct)}function dw(){ut(new Ke(pf,hw,"PUBLIC").setMultipleInstances(!0)),Ae(df,ff,""),Ae(df,ff,"esm2017")}dw();/**
3586
+ */const cd="storage";function tw(n,e,t){return n=Y(n),GT(n,e,t)}function nw(n){return n=Y(n),KT(n)}function rw(n){return n=Y(n),QT(n)}function ma(n,e){return n=Y(n),ZT(n,e)}function sw(n=Xr(),e){n=Y(n);const r=Kn(n,cd).getImmediate({identifier:e}),s=wi("storage");return s&&ud(r,...s),r}function ud(n,e,t,r={}){ew(n,e,t,r)}function iw(n,{instanceIdentifier:e}){const t=n.getProvider("app").getImmediate(),r=n.getProvider("auth-internal"),s=n.getProvider("app-check-internal");return new pa(t,r,s,e,qt)}function ow(){It(new ct(cd,iw,"PUBLIC").setMultipleInstances(!0)),Be(od,ad,""),Be(od,ad,"esm2017")}ow();/**
3558
3587
  * @license
3559
3588
  * Copyright 2017 Google LLC
3560
3589
  *
@@ -3569,7 +3598,7 @@ Content-Type: `+u.contentType+`\r
3569
3598
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3570
3599
  * See the License for the specific language governing permissions and
3571
3600
  * limitations under the License.
3572
- */const fw="type.googleapis.com/google.protobuf.Int64Value",pw="type.googleapis.com/google.protobuf.UInt64Value";function gf(t,e){const n={};for(const r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function Ha(t){if(t==null)return null;if(t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&isFinite(t)||t===!0||t===!1||Object.prototype.toString.call(t)==="[object String]")return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e=>Ha(e));if(typeof t=="function"||typeof t=="object")return gf(t,e=>Ha(e));throw new Error("Data cannot be encoded in JSON: "+t)}function gi(t){if(t==null)return t;if(t["@type"])switch(t["@type"]){case fw:case pw:{const e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(e=>gi(e)):typeof t=="function"||typeof t=="object"?gf(t,e=>gi(e)):t}/**
3601
+ */const aw="type.googleapis.com/google.protobuf.Int64Value",cw="type.googleapis.com/google.protobuf.UInt64Value";function ld(n,e){const t={};for(const r in n)n.hasOwnProperty(r)&&(t[r]=e(n[r]));return t}function ga(n){if(n==null)return null;if(n instanceof Number&&(n=n.valueOf()),typeof n=="number"&&isFinite(n)||n===!0||n===!1||Object.prototype.toString.call(n)==="[object String]")return n;if(n instanceof Date)return n.toISOString();if(Array.isArray(n))return n.map(e=>ga(e));if(typeof n=="function"||typeof n=="object")return ld(n,e=>ga(e));throw new Error("Data cannot be encoded in JSON: "+n)}function ri(n){if(n==null)return n;if(n["@type"])switch(n["@type"]){case aw:case cw:{const e=Number(n.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+n);return e}default:throw new Error("Data cannot be decoded from JSON: "+n)}return Array.isArray(n)?n.map(e=>ri(e)):typeof n=="function"||typeof n=="object"?ld(n,e=>ri(e)):n}/**
3573
3602
  * @license
3574
3603
  * Copyright 2020 Google LLC
3575
3604
  *
@@ -3584,7 +3613,7 @@ Content-Type: `+u.contentType+`\r
3584
3613
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3585
3614
  * See the License for the specific language governing permissions and
3586
3615
  * limitations under the License.
3587
- */const Wa="functions";/**
3616
+ */const _a="functions";/**
3588
3617
  * @license
3589
3618
  * Copyright 2017 Google LLC
3590
3619
  *
@@ -3599,7 +3628,7 @@ Content-Type: `+u.contentType+`\r
3599
3628
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3600
3629
  * See the License for the specific language governing permissions and
3601
3630
  * limitations under the License.
3602
- */const _f={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 Cn extends be{constructor(e,n,r){super(`${Wa}/${e}`,n||""),this.details=r}}function mw(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function gw(t,e){let n=mw(t),r=n,s;try{const i=e&&e.error;if(i){const o=i.status;if(typeof o=="string"){if(!_f[o])return new Cn("internal","internal");n=_f[o],r=o}const a=i.message;typeof a=="string"&&(r=a),s=i.details,s!==void 0&&(s=gi(s))}}catch{}return n==="ok"?null:new Cn(n,r,s)}/**
3631
+ */const hd={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 Un extends $e{constructor(e,t,r){super(`${_a}/${e}`,t||""),this.details=r}}function uw(n){if(n>=200&&n<300)return"ok";switch(n){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function lw(n,e){let t=uw(n),r=t,s;try{const i=e&&e.error;if(i){const a=i.status;if(typeof a=="string"){if(!hd[a])return new Un("internal","internal");t=hd[a],r=a}const c=i.message;typeof c=="string"&&(r=c),s=i.details,s!==void 0&&(s=ri(s))}}catch{}return t==="ok"?null:new Un(t,r,s)}/**
3603
3632
  * @license
3604
3633
  * Copyright 2017 Google LLC
3605
3634
  *
@@ -3614,7 +3643,7 @@ Content-Type: `+u.contentType+`\r
3614
3643
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3615
3644
  * See the License for the specific language governing permissions and
3616
3645
  * limitations under the License.
3617
- */class _w{constructor(e,n,r){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=e.getImmediate({optional:!0}),this.messaging=n.getImmediate({optional:!0}),this.auth||e.get().then(s=>this.auth=s,()=>{}),this.messaging||n.get().then(s=>this.messaging=s,()=>{}),this.appCheck||r.get().then(s=>this.appCheck=s,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.appCheck){const n=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return n.error?null:n.token}return null}async getContext(e){const n=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:n,messagingToken:r,appCheckToken:s}}}/**
3646
+ */class hw{constructor(e,t,r){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=e.getImmediate({optional:!0}),this.messaging=t.getImmediate({optional:!0}),this.auth||e.get().then(s=>this.auth=s,()=>{}),this.messaging||t.get().then(s=>this.messaging=s,()=>{}),this.appCheck||r.get().then(s=>this.appCheck=s,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.appCheck){const t=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(e){const t=await this.getAuthToken(),r=await this.getMessagingToken(),s=await this.getAppCheckToken(e);return{authToken:t,messagingToken:r,appCheckToken:s}}}/**
3618
3647
  * @license
3619
3648
  * Copyright 2017 Google LLC
3620
3649
  *
@@ -3629,7 +3658,7 @@ Content-Type: `+u.contentType+`\r
3629
3658
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3630
3659
  * See the License for the specific language governing permissions and
3631
3660
  * limitations under the License.
3632
- */const Ga="us-central1";function yw(t){let e=null;return{promise:new Promise((n,r)=>{e=setTimeout(()=>{r(new Cn("deadline-exceeded","deadline-exceeded"))},t)}),cancel:()=>{e&&clearTimeout(e)}}}class Ew{constructor(e,n,r,s,i=Ga,o){this.app=e,this.fetchImpl=o,this.emulatorOrigin=null,this.contextProvider=new _w(n,r,s),this.cancelAllRequests=new Promise(a=>{this.deleteService=()=>Promise.resolve(a())});try{const a=new URL(i);this.customDomain=a.origin,this.region=Ga}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const n=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${n}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${n}.cloudfunctions.net/${e}`}}function vw(t,e,n){t.emulatorOrigin=`http://${e}:${n}`}function Tw(t,e,n){return r=>ww(t,e,r,n||{})}async function Iw(t,e,n,r){n["Content-Type"]="application/json";let s;try{s=await r(t,{method:"POST",body:JSON.stringify(e),headers:n})}catch{return{status:0,json:null}}let i=null;try{i=await s.json()}catch{}return{status:s.status,json:i}}function ww(t,e,n,r){const s=t._url(e);return Aw(t,s,n,r)}async function Aw(t,e,n,r){n=Ha(n);const s={data:n},i={},o=await t.contextProvider.getContext(r.limitedUseAppCheckTokens);o.authToken&&(i.Authorization="Bearer "+o.authToken),o.messagingToken&&(i["Firebase-Instance-ID-Token"]=o.messagingToken),o.appCheckToken!==null&&(i["X-Firebase-AppCheck"]=o.appCheckToken);const a=r.timeout||7e4,c=yw(a),u=await Promise.race([Iw(e,s,i,t.fetchImpl),c.promise,t.cancelAllRequests]);if(c.cancel(),!u)throw new Cn("cancelled","Firebase Functions instance was deleted.");const l=gw(u.status,u.json);if(l)throw l;if(!u.json)throw new Cn("internal","Response is not valid JSON object.");let h=u.json.data;if(typeof h>"u"&&(h=u.json.result),typeof h>"u")throw new Cn("internal","Response is missing data field.");return{data:gi(h)}}const yf="@firebase/functions",Ef="0.10.0";/**
3661
+ */const ya="us-central1";function dw(n){let e=null;return{promise:new Promise((t,r)=>{e=setTimeout(()=>{r(new Un("deadline-exceeded","deadline-exceeded"))},n)}),cancel:()=>{e&&clearTimeout(e)}}}class fw{constructor(e,t,r,s,i=ya,a){this.app=e,this.fetchImpl=a,this.emulatorOrigin=null,this.contextProvider=new hw(t,r,s),this.cancelAllRequests=new Promise(c=>{this.deleteService=()=>Promise.resolve(c())});try{const c=new URL(i);this.customDomain=c.origin+(c.pathname==="/"?"":c.pathname),this.region=ya}catch{this.customDomain=null,this.region=i}}_delete(){return this.deleteService()}_url(e){const t=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${t}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${t}.cloudfunctions.net/${e}`}}function pw(n,e,t){n.emulatorOrigin=`http://${e}:${t}`}function mw(n,e,t){return r=>_w(n,e,r,{})}async function gw(n,e,t,r){t["Content-Type"]="application/json";let s;try{s=await r(n,{method:"POST",body:JSON.stringify(e),headers:t})}catch{return{status:0,json:null}}let i=null;try{i=await s.json()}catch{}return{status:s.status,json:i}}function _w(n,e,t,r){const s=n._url(e);return yw(n,s,t,r)}async function yw(n,e,t,r){t=ga(t);const s={data:t},i={},a=await n.contextProvider.getContext(r.limitedUseAppCheckTokens);a.authToken&&(i.Authorization="Bearer "+a.authToken),a.messagingToken&&(i["Firebase-Instance-ID-Token"]=a.messagingToken),a.appCheckToken!==null&&(i["X-Firebase-AppCheck"]=a.appCheckToken);const c=r.timeout||7e4,l=dw(c),d=await Promise.race([gw(e,s,i,n.fetchImpl),l.promise,n.cancelAllRequests]);if(l.cancel(),!d)throw new Un("cancelled","Firebase Functions instance was deleted.");const p=lw(d.status,d.json);if(p)throw p;if(!d.json)throw new Un("internal","Response is not valid JSON object.");let g=d.json.data;if(typeof g>"u"&&(g=d.json.result),typeof g>"u")throw new Un("internal","Response is missing data field.");return{data:ri(g)}}const dd="@firebase/functions",fd="0.11.8";/**
3633
3662
  * @license
3634
3663
  * Copyright 2019 Google LLC
3635
3664
  *
@@ -3644,7 +3673,7 @@ Content-Type: `+u.contentType+`\r
3644
3673
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3645
3674
  * See the License for the specific language governing permissions and
3646
3675
  * limitations under the License.
3647
- */const Rw="auth-internal",Pw="app-check-internal",Sw="messaging-internal";function Cw(t,e){const n=(r,{instanceIdentifier:s})=>{const i=r.getProvider("app").getImmediate(),o=r.getProvider(Rw),a=r.getProvider(Sw),c=r.getProvider(Pw);return new Ew(i,o,a,c,s,t)};ut(new Ke(Wa,n,"PUBLIC").setMultipleInstances(!0)),Ae(yf,Ef,e),Ae(yf,Ef,"esm2017")}/**
3676
+ */const vw="auth-internal",Ew="app-check-internal",Tw="messaging-internal";function ww(n,e){const t=(r,{instanceIdentifier:s})=>{const i=r.getProvider("app").getImmediate(),a=r.getProvider(vw),c=r.getProvider(Tw),l=r.getProvider(Ew);return new fw(i,a,c,l,s,n)};It(new ct(_a,t,"PUBLIC").setMultipleInstances(!0)),Be(dd,fd,e),Be(dd,fd,"esm2017")}/**
3648
3677
  * @license
3649
3678
  * Copyright 2020 Google LLC
3650
3679
  *
@@ -3659,5 +3688,5 @@ Content-Type: `+u.contentType+`\r
3659
3688
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3660
3689
  * See the License for the specific language governing permissions and
3661
3690
  * limitations under the License.
3662
- */function bw(t=$r(),e=Ga){const r=Vn(M(t),Wa).getImmediate({identifier:e}),s=yi("functions");return s&&vf(r,...s),r}function vf(t,e,n){vw(M(t),e,n)}function kw(t,e,n){return Tw(M(t),e,n)}Cw(fetch.bind(self));const Ve=class Ve{static setFirebaseConfig(e){Ve._firebaseConfig=e}static useEmulator(e){this._emulatorConfig={...Ve.defaultEmulatorConfig,emulate:!0,...e}}static get emulator(){return this._emulatorConfig}constructor(){if(!Ve._firebaseConfig)throw new Error("You should set a firebase config object before using Firebase");this._firebaseApp=cc(Ve._firebaseConfig)}static get instance(){return this._instance||(this._instance=new Ve)}firestore(){return Fy(this._firebaseApp)}storage(){return lw(this._firebaseApp)}auth(){return YT(this._firebaseApp)}functions(){return bw(this._firebaseApp,Ve._region)}static setRegion(e){this._region=e}};Ve.defaultEmulatorConfig={host:"localhost",firestorePort:8080,storagePort:9199,authPort:9099,functionsPort:5001,emulate:!1},Ve._emulatorConfig=Ve.defaultEmulatorConfig;let C=Ve;class Nw extends Ys{constructor(e){var n;if(super(),this._lastLimit=0,e&&C.useEmulator(e),(n=C.emulator)!=null&&n.emulate){const{host:r,firestorePort:s}=C.emulator;ph(C.instance.firestore(),r,s)}}findById(e,n){const r=C.instance.firestore();return new Promise(async s=>{try{const i=await aE(ra(r,n,e));s(i.data())}catch(i){return console.log(i),null}})}save(e){const n=C.instance.firestore(),r=pE(n);return Object.entries(e).forEach(([s,i])=>{i==null||i.forEach(o=>{const a=ra(n,s,o.id);r.set(a,o)})}),r.commit()}find(e,n){const r=this.queryObjectToQueryConstraints(e,n);return this.getFromQuery(r)}async count(e,n){const r=this.queryObjectToQueryConstraints(e,n);return(await hE(r)).data().count}delete(e,n){const r=C.instance.firestore();return uE(ra(r,n,e))}next(e){if(!this._lastConstraints||!this._lastCollectionName)throw new Error("You should perform a query prior to using method next");const n=C.instance.firestore();this._lastLimit=e||this._lastLimit;const r=this._lastConstraints.nonFilterConstraints.concat(Rh(this._lastLimit),eE(this._lastDocRetrieved));return this.getFromQuery(wh(mh(n,this._lastCollectionName),...r))}queryObjectToQueryConstraints(e,n){var a;const r=C.instance.firestore(),s=[],i=[],o=[];return Ys.toPropertyPathOperations(e.operations).forEach(c=>{const u=this.toFirebaseOperator(c.operator);c.aggregate?i.push(Ah(c.property,u,c.value)):s.push(Ah(c.property,u,c.value))}),(a=e.sort)!=null&&a.propertyName&&o.push(Zy(e.sort.propertyName,e.sort.order)),this._lastConstraints={orConstraints:i,andConstraints:s,nonFilterConstraints:o},this._lastCollectionName=n,e.limit&&(this._lastLimit=e.limit,o.push(Rh(e.limit))),wh(mh(r,n),Xy(...i,Jy(...s)),...o)}toFirebaseOperator(e){switch(e){case"==":case"!=":case"<":case"<=":case">":case">=":return e;case"contains":return"array-contains";case"containsAny":return"array-contains-any";default:return e}}getFromQuery(e){return new Promise(async n=>{const r=await cE(e);this._lastDocRetrieved=r.docs[r.docs.length-1],n(r.docs.map(s=>s.data()))})}}var Dw=Object.defineProperty,Ow=Object.getOwnPropertyDescriptor,Vw=(t,e,n,r)=>{for(var s=r>1?void 0:r?Ow(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&Dw(e,n,s),s};Ee.FirebaseCloudStorage=class extends vn{constructor(e){var n;if(super(),e&&C.useEmulator(e),(n=C.emulator)!=null&&n.emulate){const{host:r,storagePort:s}=C.emulator;mf(C.instance.storage(),r,s)}}save(e,n,r){const s=C.instance.storage();return new Promise((i,o)=>{if(this._uploadTask=aw(za(s,e),n),r)var a=this._uploadTask.on("state_changed",c=>{r(c.bytesTransferred,c.totalBytes)},null,()=>a());this._uploadTask.then(()=>i(e)).catch(c=>o(c))})}getUrl(e){if(!e)return Promise.reject("needs a reference");const n=C.instance.storage();return cw(za(n,e))}uploadControl(){if(!this._uploadTask)throw new Error("You should call save() before uploadControl()");return{cancel:()=>{var e;return(e=this._uploadTask)==null?void 0:e.cancel()},pause:()=>{var e;return(e=this._uploadTask)==null?void 0:e.pause()},resume:()=>{var e;return(e=this._uploadTask)==null?void 0:e.resume()},onProgress:e=>{var n;return(n=this._uploadTask)==null?void 0:n.on("state_changed",r=>{e&&e(r.bytesTransferred,r.totalBytes)})}}}delete(e){const n=C.instance.storage();return uw(za(n,e))}},Ee.FirebaseCloudStorage=Vw([Mh("FirebaseCloudStorage",()=>new Ee.FirebaseCloudStorage)],Ee.FirebaseCloudStorage);const Tf={twitter:()=>new Oe,facebook:()=>new ze,google:()=>new He};class Ka extends Uh{constructor(e){var n;if(super(),this.credentialProviders={},e&&C.useEmulator(e),(n=C.emulator)!=null&&n.emulate){const{host:r,authPort:s}=C.emulator;if(!r||!s)throw new Error("You should define a host and an auth emulator port to use the emulator");ld(C.instance.auth(),`http://${r}:${s}`)}this.registerCredentialProviders()}signUp(e){const{authProvider:n,verificationLink:r}=e;return n.slice(0,5)==="email"?new Promise(async(s,i)=>{try{const o=this.credentialProviders["email-sign-up"];if(!o)throw new Error(`The provider ${n} is not registered`);const a=await o(e);e.name&&await Uv(a.user,{displayName:e.name}),r&&await Id(a.user,{url:r}),s(await this.toUserCredentials(a.user))}catch(o){i({code:Xs(o.code.slice(5)),message:o.message})}}):this.login(e)}login(e){const{authProvider:n}=e;return new Promise(async(r,s)=>{try{const i=this.credentialProviders[n];if(!i)throw new Error(`The provider ${n} is not registered`);const o=await i(e);r(await this.toUserCredentials(o.user))}catch(i){s({code:i.code===400?"missingPassword":Xs(i.code.slice(5)),message:i.message})}})}logout(){return C.instance.auth().signOut()}resetEmailPassword(e){return new Promise(async(n,r)=>{try{await Vv(C.instance.auth(),e),n()}catch(s){r({code:Xs(s.code.slice(5)),message:s.message})}})}resendVerificationEmail(e,n,r){return new Promise(async(s,i)=>{try{await Td(C.instance.auth(),e,n);const o=C.instance.auth().currentUser;if(!o){i({code:"userNotFound",message:"There is no logged in user"});return}await Id(o,{url:r}),s()}catch(o){i({code:Xs(o.code.slice(5)),message:r})}})}refreshToken(){var e;return(e=C.instance.auth().currentUser)==null?void 0:e.getIdToken(!0)}onAuthStateChange(e){C.instance.auth().onAuthStateChanged(async n=>{e(n?await this.toUserCredentials(n):void 0)})}linkAdditionalProvider(e){const n=Tf[e](),r=C.instance.auth().currentUser;if(!r)throw new Error("There is no logged in user");return Vd(r,n)}unlinkProvider(e){const{currentUser:n}=C.instance.auth();if(!n)throw new Error("There is no logged in user");return n.providerData,bv(n,Tf[e]().providerId)}async toUserCredentials(e){if(!e)throw new Error("The user in user credentials is not defined");const n=(await e.getIdTokenResult()).claims;return Ka.convertCredentials(e,n)}static convertCredentials(e,n){return{id:e.uid,email:e.email??"",name:e.displayName??void 0,pictureUrl:e.photoURL??void 0,phoneNumber:e.phoneNumber??void 0,emailVerified:e.emailVerified,customData:{...n},lastLogin:Date.now(),creationDate:e.metadata.creationTime?new Date(e.metadata.creationTime).getTime():void 0}}registerCredentialProvider(e,n){this.credentialProviders[e]=n}registerCredentialProviders(){this.registerCredentialProvider("email-sign-up",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return Lv(C.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("email",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return Td(C.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("google",()=>Da(C.instance.auth(),new He)),this.registerCredentialProvider("facebook",()=>Da(C.instance.auth(),new ze)),this.registerCredentialProvider("twitter",()=>Da(C.instance.auth(),new Oe)),this.registerCredentialProvider("link-twitter",()=>{const e=C.instance.auth().currentUser;if(!e)throw new Error("There is no logged in user");return Vd(e,new Oe)}),this.registerCredentialProvider("anonymous",()=>Cv(C.instance.auth()))}}class Lw{constructor(e,n){var r;if(e&&C.setRegion(e),n&&C.useEmulator(n),(r=C.emulator)!=null&&r.emulate){const{host:s,functionsPort:i}=C.emulator;vf(C.instance.functions(),s,i)}}retrieveFunction(e){return kw(C.instance.functions(),e)}async callFunction(e,n){return(await e(n)).data}}Ee.FirebaseAuth=Ka,Ee.FirebaseCloudFunctions=Lw,Ee.FirebaseDatasource=Nw,Ee.FirebaseHelper=C,Object.defineProperty(Ee,Symbol.toStringTag,{value:"Module"})});
3691
+ */function Iw(n=Xr(),e=ya){const r=Kn(Y(n),_a).getImmediate({identifier:e}),s=wi("functions");return s&&pd(r,...s),r}function pd(n,e,t){pw(Y(n),e,t)}function Aw(n,e,t){return mw(Y(n),e)}ww(fetch.bind(self));const Qe=class Qe{static setFirebaseConfig(e){Qe._firebaseConfig=e}static useEmulator(e){this._emulatorConfig={...Qe.defaultEmulatorConfig,emulate:!0,...e}}static get emulator(){return this._emulatorConfig}constructor(){if(!Qe._firebaseConfig)throw new Error("You should set a firebase config object before using Firebase");this._firebaseApp=sc(Qe._firebaseConfig)}static get instance(){return this._instance||(this._instance=new Qe)}firestore(){return F_(this._firebaseApp)}storage(){return sw(this._firebaseApp)}auth(){return $E(this._firebaseApp)}functions(){return Iw(this._firebaseApp,Qe._region)}static setRegion(e){this._region=e}};Qe.defaultEmulatorConfig={host:"localhost",firestorePort:8080,storagePort:9199,authPort:9099,functionsPort:5001,emulate:!1},Qe._emulatorConfig=Qe.defaultEmulatorConfig;let j=Qe;class Rw extends Xt{constructor(e){var t;if(super(),this._lastLimit=0,e&&j.useEmulator(e),(t=j.emulator)!=null&&t.emulate){const{host:r,firestorePort:s}=j.emulator;tl(j.instance.firestore(),r,s)}}findById(e,t){const r=j.instance.firestore();return new Promise(async s=>{try{const i=await iy(Ss(r,t,e));s(i.data())}catch(i){return console.log(i),null}})}save(e){const t=j.instance.firestore(),r=hy(t);return Object.entries(e).forEach(([s,i])=>{i==null||i.forEach(a=>{const c=Ss(t,s,a.id);r.set(c,a)})}),r.commit()}find(e,t){const r=this.queryObjectToQueryConstraints(e,t);return this.getFromQuery(r)}async count(e,t){const r=this.queryObjectToQueryConstraints(e,t);return(await cy(r)).data().count}delete(e,t){const r=j.instance.firestore();return ay(Ss(r,t,e))}next(e){if(!this._lastConstraints||!this._lastCollectionName)throw new Error("You should perform a query prior to using method next");const t=j.instance.firestore();this._lastLimit=e||this._lastLimit;const r=this._lastConstraints.nonFilterConstraints.concat(pl(this._lastLimit),Z_(this._lastDocRetrieved));return this.getFromQuery(dl(nl(t,this._lastCollectionName),...r))}onCollectionChange(e,t,r){const s=this.queryObjectToQueryConstraints(e,t);return Tl(s,i=>{i.docChanges().forEach(a=>{r({type:a.type==="added"?"create":a.type==="modified"?"update":"delete",after:a.doc.data(),before:void 0,params:{}})})})}onDocumentChange(e,t,r){const s=j.instance.firestore();return Tl(Ss(s,e,t),i=>{r({type:"update",before:void 0,after:i.data(),params:{}})})}queryObjectToQueryConstraints(e,t){var c;const r=j.instance.firestore(),s=[],i=[],a=[];return Xt.toPropertyPathOperations(e.operations).forEach(l=>{const d=this.toFirebaseOperator(l.operator);l.aggregate?i.push(fl(l.property,d,l.value)):s.push(fl(l.property,d,l.value))}),(c=e.sort)!=null&&c.propertyName&&a.push(J_(e.sort.propertyName,e.sort.order)),this._lastConstraints={orConstraints:i,andConstraints:s,nonFilterConstraints:a},this._lastCollectionName=t,e.limit&&(this._lastLimit=e.limit,a.push(pl(e.limit))),dl(nl(r,t),Y_(...i,X_(...s)),...a)}toFirebaseOperator(e){switch(e){case"==":case"!=":case"<":case"<=":case">":case">=":return e;case"contains":return"array-contains";case"containsAny":return"array-contains-any";default:return e}}getFromQuery(e){return new Promise(async t=>{const r=await oy(e);this._lastDocRetrieved=r.docs[r.docs.length-1],t(r.docs.map(s=>s.data()))})}}var bw=Object.defineProperty,Pw=Object.getOwnPropertyDescriptor,Sw=(n,e,t,r)=>{for(var s=r>1?void 0:r?Pw(e,t):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(s=(r?a(e,t,s):a(s))||s);return r&&s&&bw(e,t,s),s};Le.FirebaseCloudStorage=class extends Sn{constructor(e){var t;if(super(),e&&j.useEmulator(e),(t=j.emulator)!=null&&t.emulate){const{host:r,storagePort:s}=j.emulator;ud(j.instance.storage(),r,s)}}save(e,t,r){const s=j.instance.storage();return new Promise((i,a)=>{if(this._uploadTask=tw(ma(s,e),t),r)var c=this._uploadTask.on("state_changed",l=>{r(l.bytesTransferred,l.totalBytes)},null,()=>c());this._uploadTask.then(()=>i(e)).catch(l=>a(l))})}getUrl(e){if(!e)return Promise.reject("needs a reference");const t=j.instance.storage();return nw(ma(t,e))}uploadControl(){if(!this._uploadTask)throw new Error("You should call save() before uploadControl()");return{cancel:()=>{var e;return(e=this._uploadTask)==null?void 0:e.cancel()},pause:()=>{var e;return(e=this._uploadTask)==null?void 0:e.pause()},resume:()=>{var e;return(e=this._uploadTask)==null?void 0:e.resume()},onProgress:e=>{var t;return(t=this._uploadTask)==null?void 0:t.on("state_changed",r=>{e&&e(r.bytesTransferred,r.totalBytes)})}}}delete(e){const t=j.instance.storage();return rw(ma(t,e))}},Le.FirebaseCloudStorage=Sw([kl("FirebaseCloudStorage",()=>new Le.FirebaseCloudStorage)],Le.FirebaseCloudStorage);const md={twitter:()=>new Ke,facebook:()=>new st,google:()=>new it};class va extends Nl{constructor(e){var t;if(super(),this.credentialProviders={},e&&j.useEmulator(e),(t=j.emulator)!=null&&t.emulate){const{host:r,authPort:s}=j.emulator;if(!r||!s)throw new Error("You should define a host and an auth emulator port to use the emulator");oh(j.instance.auth(),`http://${r}:${s}`)}this.registerCredentialProviders()}signUp(e){const{authProvider:t,verificationLink:r}=e;return t.slice(0,5)==="email"?new Promise(async(s,i)=>{try{const a=this.credentialProviders["email-sign-up"];if(!a)throw new Error(`The provider ${t} is not registered`);const c=await a(e);e.name&&await Nv(c.user,{displayName:e.name}),r&&await _h(c.user,{url:r}),s(await this.toUserCredentials(c.user))}catch(a){i({code:xs(a.code.slice(5)),message:a.message})}}):this.login(e)}login(e){const{authProvider:t}=e;return new Promise(async(r,s)=>{try{const i=this.credentialProviders[t];if(!i)throw new Error(`The provider ${t} is not registered`);const a=await i(e);r(await this.toUserCredentials(a.user))}catch(i){s({code:i.code===400?"missingPassword":xs(i.code.slice(5)),message:i.message})}})}logout(){return j.instance.auth().signOut()}resetEmailPassword(e){return new Promise(async(t,r)=>{try{await Sv(j.instance.auth(),e),t()}catch(s){r({code:xs(s.code.slice(5)),message:s.message})}})}resendVerificationEmail(e,t,r){return new Promise(async(s,i)=>{try{await gh(j.instance.auth(),e,t);const a=j.instance.auth().currentUser;if(!a){i({code:"userNotFound",message:"There is no logged in user"});return}await _h(a,{url:r}),s()}catch(a){i({code:xs(a.code.slice(5)),message:r})}})}refreshToken(){var e;return(e=j.instance.auth().currentUser)==null?void 0:e.getIdToken(!0)}onAuthStateChange(e){j.instance.auth().onAuthStateChanged(async t=>{e(t?await this.toUserCredentials(t):void 0)})}linkAdditionalProvider(e){const t=md[e](),r=j.instance.auth().currentUser;if(!r)throw new Error("There is no logged in user");return Ch(r,t)}unlinkProvider(e){const{currentUser:t}=j.instance.auth();if(!t)throw new Error("There is no logged in user");return t.providerData,wv(t,md[e]().providerId)}async toUserCredentials(e){if(!e)throw new Error("The user in user credentials is not defined");const t=(await e.getIdTokenResult()).claims;return va.convertCredentials(e,t)}static convertCredentials(e,t){return{id:e.uid,email:e.email??"",name:e.displayName??void 0,pictureUrl:e.photoURL??void 0,phoneNumber:e.phoneNumber??void 0,emailVerified:e.emailVerified,customData:{...t},lastLogin:Date.now(),creationDate:e.metadata.creationTime?new Date(e.metadata.creationTime).getTime():void 0}}registerCredentialProvider(e,t){this.credentialProviders[e]=t}registerCredentialProviders(){this.registerCredentialProvider("email-sign-up",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return Cv(j.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("email",e=>{if(!e.email||!e.password)throw new Error("Email and password are required");return gh(j.instance.auth(),e.email,e.password)}),this.registerCredentialProvider("google",()=>ra(j.instance.auth(),new it)),this.registerCredentialProvider("facebook",()=>ra(j.instance.auth(),new st)),this.registerCredentialProvider("twitter",()=>ra(j.instance.auth(),new Ke)),this.registerCredentialProvider("link-twitter",()=>{const e=j.instance.auth().currentUser;if(!e)throw new Error("There is no logged in user");return Ch(e,new Ke)}),this.registerCredentialProvider("anonymous",()=>Tv(j.instance.auth()))}}class Cw{constructor(e,t){var r;if(e&&j.setRegion(e),t&&j.useEmulator(t),(r=j.emulator)!=null&&r.emulate){const{host:s,functionsPort:i}=j.emulator;pd(j.instance.functions(),s,i)}}retrieveFunction(e){return Aw(j.instance.functions(),e)}async callFunction(e,t){return(await e(t)).data}}Le.FirebaseAuth=va,Le.FirebaseCloudFunctions=Cw,Le.FirebaseDatasource=Rw,Le.FirebaseHelper=j,Object.defineProperty(Le,Symbol.toStringTag,{value:"Module"})});
3663
3692
  //# sourceMappingURL=entropic-bond-firebase.umd.cjs.map