@thefittingroom/sdk 2.0.0-alpha-3 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.env.tmp +25 -0
  2. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/fetcher.d.ts +12 -0
  3. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/fetcher.js +49 -0
  4. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/fetcher.js.map +1 -0
  5. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/requests.d.ts +155 -0
  6. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/requests.js +3 -0
  7. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/requests.js.map +1 -0
  8. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/responses.d.ts +130 -0
  9. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/responses.js +2 -0
  10. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/responses.js.map +1 -0
  11. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/shop.d.ts +33 -0
  12. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/shop.js +261 -0
  13. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/shop.js.map +1 -0
  14. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/utils.d.ts +1 -0
  15. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/utils.js +9 -0
  16. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/api/utils.js.map +1 -0
  17. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase-error.d.ts +2 -0
  18. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase-error.js +10 -0
  19. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase-error.js.map +1 -0
  20. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase-user.d.ts +26 -0
  21. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase-user.js +122 -0
  22. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase-user.js.map +1 -0
  23. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase.d.ts +15 -0
  24. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase.js +40 -0
  25. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/firebase/firebase.js.map +1 -0
  26. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/async.d.ts +2 -0
  27. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/async.js +3 -0
  28. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/async.js.map +1 -0
  29. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/config.d.ts +22 -0
  30. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/config.js +70 -0
  31. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/config.js.map +1 -0
  32. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/date.d.ts +6 -0
  33. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/date.js +5 -0
  34. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/date.js.map +1 -0
  35. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/errors.d.ts +32 -0
  36. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/errors.js +47 -0
  37. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/helpers/errors.js.map +1 -0
  38. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/index.d.ts +8 -0
  39. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/index.js +6 -0
  40. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/index.js.map +1 -0
  41. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/types/index.d.ts +89 -0
  42. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/types/index.js +8 -0
  43. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/types/index.js.map +1 -0
  44. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/types/measurement.d.ts +292 -0
  45. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/types/measurement.js +377 -0
  46. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/esm/types/measurement.js.map +1 -0
  47. package/.rollup.cache/home/runner/work/shop-sdk/shop-sdk/dist/tsconfig.tsbuildinfo +1 -0
  48. package/LICENSE +373 -0
  49. package/README.md +67 -73
  50. package/dist/esm/firebase/firebase.d.ts +2 -2
  51. package/dist/esm/index.js +23044 -23183
  52. package/dist/esm/index.js.map +1 -1
  53. package/dist/esm/index.min.js +366 -265
  54. package/dist/esm/index.min.js.map +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -0
  56. package/package.json +16 -24
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * thefittingroom v2.0.0-alpha-3 (2025-04-18T19:19:57.543Z)
2
+ * thefittingroom v2.0.1 (2025-07-31T05:00:17.540Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
- var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
5
+ var e=Object.freeze({__proto__:null}),t=Object.freeze({__proto__:null});const n=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,o=i?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const i=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==o||null==a||null==c)throw new s;const u=i<<2|o>>4;if(r.push(u),64!==a){const e=o<<4&240|a>>2;if(r.push(e),64!==c){const e=a<<6&192|c;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};
6
6
  /**
7
7
  * @license
8
8
  * Copyright 2017 Google LLC
@@ -18,10 +18,10 @@ var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
18
18
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19
19
  * See the License for the specific language governing permissions and
20
20
  * limitations under the License.
21
- */
21
+ */class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const i=function(e){return function(e){const t=n(e);return r.encodeByteArray(t,!0)}(e).replace(/\./g,"")},o=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
22
22
  /**
23
23
  * @license
24
- * Copyright 2017 Google LLC
24
+ * Copyright 2022 Google LLC
25
25
  *
26
26
  * Licensed under the Apache License, Version 2.0 (the "License");
27
27
  * you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@ var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
35
35
  * See the License for the specific language governing permissions and
36
36
  * limitations under the License.
37
37
  */
38
- const n=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++r)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const s=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(n(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const u=i<<2|o>>4;if(r.push(u),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const i=function(t){return function(t){const e=n(t);return r.encodeByteArray(e,!0)}(t).replace(/\./g,"")},o=function(t){try{return r.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
38
+ const a=()=>
39
39
  /**
40
40
  * @license
41
41
  * Copyright 2022 Google LLC
@@ -52,10 +52,10 @@ const n=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charC
52
52
  * See the License for the specific language governing permissions and
53
53
  * limitations under the License.
54
54
  */
55
- const a=()=>
55
+ function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,c=()=>{try{return a()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&o(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},u=e=>{var t,n;return null===(n=null===(t=c())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},h=()=>{var e;return null===(e=c())||void 0===e?void 0:e.config},l=e=>{var t;return null===(t=c())||void 0===t?void 0:t[`_${e}`]};
56
56
  /**
57
57
  * @license
58
- * Copyright 2022 Google LLC
58
+ * Copyright 2017 Google LLC
59
59
  *
60
60
  * Licensed under the Apache License, Version 2.0 (the "License");
61
61
  * you may not use this file except in compliance with the License.
@@ -69,10 +69,10 @@ const a=()=>
69
69
  * See the License for the specific language governing permissions and
70
70
  * limitations under the License.
71
71
  */
72
- function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,c=()=>{try{return a()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||(()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&o(t[1]);return e&&JSON.parse(e)})()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},u=()=>{var t;return null===(t=c())||void 0===t?void 0:t.config},h=t=>{var e;return null===(e=c())||void 0===e?void 0:e[`_${t}`]};
72
+ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}
73
73
  /**
74
74
  * @license
75
- * Copyright 2017 Google LLC
75
+ * Copyright 2025 Google LLC
76
76
  *
77
77
  * Licensed under the Apache License, Version 2.0 (the "License");
78
78
  * you may not use this file except in compliance with the License.
@@ -85,8 +85,23 @@ function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window
85
85
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
86
86
  * See the License for the specific language governing permissions and
87
87
  * limitations under the License.
88
- */
89
- class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}wrapCallback(t){return(e,n)=>{e?this.reject(e):this.resolve(n),"function"==typeof t&&(this.promise.catch((()=>{})),1===t.length?t(e):t(e,n))}}}
88
+ */function f(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch(e){return!1}}async function p(e){return(await fetch(e,{credentials:"include"})).ok}
89
+ /**
90
+ * @license
91
+ * Copyright 2021 Google LLC
92
+ *
93
+ * Licensed under the Apache License, Version 2.0 (the "License");
94
+ * you may not use this file except in compliance with the License.
95
+ * You may obtain a copy of the License at
96
+ *
97
+ * http://www.apache.org/licenses/LICENSE-2.0
98
+ *
99
+ * Unless required by applicable law or agreed to in writing, software
100
+ * distributed under the License is distributed on an "AS IS" BASIS,
101
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
102
+ * See the License for the specific language governing permissions and
103
+ * limitations under the License.
104
+ */const g={};let m=!1;function y(e,t){if("undefined"==typeof window||"undefined"==typeof document||!f(window.location.host)||g[e]===t||g[e]||m)return;function n(e){return`__firebase__banner__${e}`}g[e]=t;const r="__firebase__banner",s=function(){const e={prod:[],emulator:[]};for(const t of Object.keys(g))g[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function i(){const e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" &times;",e.onclick=()=>{m=!0,function(){const e=document.getElementById(r);e&&e.remove()}()},e}function o(){const e=function(e){let t=document.getElementById(e),n=!1;return t||(t=document.createElement("div"),t.setAttribute("id",e),n=!0),{created:n,element:t}}(r),t=n("text"),o=document.getElementById(t)||document.createElement("span"),a=n("learnmore"),c=document.getElementById(a)||document.createElement("a"),u=n("preprendIcon"),h=document.getElementById(u)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(e.created){const t=e.element;!function(e){e.style.display="flex",e.style.background="#7faaf0",e.style.position="fixed",e.style.bottom="5px",e.style.left="5px",e.style.padding=".5em",e.style.borderRadius="5px",e.style.alignItems="center"}(t),function(e,t){e.setAttribute("id",t),e.innerText="Learn more",e.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",e.setAttribute("target","__blank"),e.style.paddingLeft="5px",e.style.textDecoration="underline"}(c,a);const n=i();!function(e,t){e.setAttribute("width","24"),e.setAttribute("id",t),e.setAttribute("height","24"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.style.marginLeft="-6px"}(h,u),t.append(h,o,c,n),document.body.appendChild(t)}s?(o.innerText="Preview backend disconnected.",h.innerHTML='<g clip-path="url(#clip0_6013_33858)">\n<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6013_33858">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>'):(h.innerHTML='<g clip-path="url(#clip0_6083_34804)">\n<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>\n</g>\n<defs>\n<clipPath id="clip0_6083_34804">\n<rect width="24" height="24" fill="white"/>\n</clipPath>\n</defs>',o.innerText="Preview backend running in this workspace."),o.setAttribute("id",t)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",o):o()}
90
105
  /**
91
106
  * @license
92
107
  * Copyright 2017 Google LLC
@@ -102,7 +117,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
102
117
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
103
118
  * See the License for the specific language governing permissions and
104
119
  * limitations under the License.
105
- */function d(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class f extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,f.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,p.prototype.create)}}class p{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(g,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new f(r,o,n)}}const g=/\{\$([^}]+)}/g;function m(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const n=t[s],i=e[s];if(y(n)&&y(i)){if(!m(n,i))return!1}else if(n!==i)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function y(t){return null!==t&&"object"==typeof t}
120
+ */function v(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function _(){return!function(){var e;const t=null===(e=c())||void 0===e?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}class w extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,w.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,T.prototype.create)}}class T{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],i=s?function(e,t){return e.replace(E,(e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`})}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new w(r,o,n)}}const E=/\{\$([^}]+)}/g;function S(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const s of n){if(!r.includes(s))return!1;const n=e[s],i=t[s];if(I(n)&&I(i)){if(!S(n,i))return!1}else if(n!==i)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function I(e){return null!==e&&"object"==typeof e}
106
121
  /**
107
122
  * @license
108
123
  * Copyright 2017 Google LLC
@@ -118,7 +133,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
118
133
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
119
134
  * See the License for the specific language governing permissions and
120
135
  * limitations under the License.
121
- */function v(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function w(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function _(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class T{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),s}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function E(){}
136
+ */function b(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function A(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function C(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class k{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=R),void 0===r.error&&(r.error=R),void 0===r.complete&&(r.complete=R);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function R(){}
122
137
  /**
123
138
  * @license
124
139
  * Copyright 2021 Google LLC
@@ -134,7 +149,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
134
149
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135
150
  * See the License for the specific language governing permissions and
136
151
  * limitations under the License.
137
- */function S(t){return t&&t._delegate?t._delegate:t}class I{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
152
+ */function O(e){return e&&e._delegate?e._delegate:e}class N{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}
138
153
  /**
139
154
  * @license
140
155
  * Copyright 2019 Google LLC
@@ -150,7 +165,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
150
165
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
151
166
  * See the License for the specific language governing permissions and
152
167
  * limitations under the License.
153
- */const b="[DEFAULT]";
168
+ */const D="[DEFAULT]";
154
169
  /**
155
170
  * @license
156
171
  * Copyright 2019 Google LLC
@@ -166,7 +181,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
166
181
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
167
182
  * See the License for the specific language governing permissions and
168
183
  * limitations under the License.
169
- */class A{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new l;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
184
+ */class P{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new d;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}
170
185
  /**
171
186
  * @license
172
187
  * Copyright 2019 Google LLC
@@ -182,7 +197,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
182
197
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
198
  * See the License for the specific language governing permissions and
184
199
  * limitations under the License.
185
- */(t))try{this.getOrInitializeService({instanceIdentifier:b})}catch(t){}for(const[t,e]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(t);try{const t=this.getOrInitializeService({instanceIdentifier:n});e.resolve(t)}catch(t){}}}}clearInstance(t=b){this.instancesDeferred.delete(t),this.instancesOptions.delete(t),this.instances.delete(t)}async delete(){const t=Array.from(this.instances.values());await Promise.all([...t.filter((t=>"INTERNAL"in t)).map((t=>t.INTERNAL.delete())),...t.filter((t=>"_delete"in t)).map((t=>t._delete()))])}isComponentSet(){return null!=this.component}isInitialized(t=b){return this.instances.has(t)}getOptions(t=b){return this.instancesOptions.get(t)||{}}initialize(t={}){const{options:e={}}=t,n=this.normalizeInstanceIdentifier(t.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:e});for(const[t,e]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(t)&&e.resolve(r)}return r}onInit(t,e){var n;const r=this.normalizeInstanceIdentifier(e),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(t),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&t(i,r),()=>{s.delete(t)}}invokeOnInitCallbacks(t,e){const n=this.onInitCallbacks.get(e);if(n)for(const r of n)try{r(t,e)}catch(t){}}getOrInitializeService({instanceIdentifier:t,options:e={}}){let n=this.instances.get(t);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=t,r===b?void 0:r),options:e}),this.instances.set(t,n),this.instancesOptions.set(t,e),this.invokeOnInitCallbacks(n,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,n)}catch(t){}var r;return n||null}normalizeInstanceIdentifier(t=b){return this.component?this.component.multipleInstances?t:b:t}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class C{constructor(t){this.name=t,this.providers=new Map}addComponent(t){const e=this.getProvider(t.name);if(e.isComponentSet())throw new Error(`Component ${t.name} has already been registered with ${this.name}`);e.setComponent(t)}addOrOverwriteComponent(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)}getProvider(t){if(this.providers.has(t))return this.providers.get(t);const e=new A(t,this);return this.providers.set(t,e),e}getProviders(){return Array.from(this.providers.values())}}
200
+ */(e))try{this.getOrInitializeService({instanceIdentifier:D})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=D){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=D){return this.instances.has(e)}getOptions(e=D){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(r)}return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),s=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===D?void 0:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e=D){return this.component?this.component.multipleInstances?e:D:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class L{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 P(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}
186
201
  /**
187
202
  * @license
188
203
  * Copyright 2017 Google LLC
@@ -198,7 +213,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
198
213
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
214
  * See the License for the specific language governing permissions and
200
215
  * limitations under the License.
201
- */var k;!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"}(k||(k={}));const N={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},R=k.INFO,O={[k.DEBUG]:"log",[k.VERBOSE]:"log",[k.INFO]:"info",[k.WARN]:"warn",[k.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=O[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class L{constructor(t){this.name=t,this._logLevel=R,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in k))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,k.DEBUG,...t),this._logHandler(this,k.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,k.VERBOSE,...t),this._logHandler(this,k.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,k.INFO,...t),this._logHandler(this,k.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,k.WARN,...t),this._logHandler(this,k.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,k.ERROR,...t),this._logHandler(this,k.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,x;const U=new WeakMap,F=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||V.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const r=t.call(W(this),e,...n);return V.set(r,e.sort?e.sort():[e]),K(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(F.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(K(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(B.has(t))return B.get(t);const e=q(t);return e!==t&&(B.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const z=["get","getKey","getAll","getAllKeys","count"],G=["put","add","delete","clear"],Q=new Map;function Y(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Q.get(e))return Q.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=G.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!z.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return Q.set(e,i),i}j=(t=>({...t,get:(e,n,r)=>Y(e,n)||t.get(e,n,r),has:(e,n)=>!!Y(e,n)||t.has(e,n)}))(j);
216
+ */var M;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(M||(M={}));const x={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},U=M.INFO,F={[M.DEBUG]:"log",[M.VERBOSE]:"log",[M.INFO]:"info",[M.WARN]:"warn",[M.ERROR]:"error"},V=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=F[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}] ${e.name}:`,...n)};class j{constructor(e){this.name=e,this._logLevel=U,this._logHandler=V,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in M))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?x[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,M.DEBUG,...e),this._logHandler(this,M.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,M.VERBOSE,...e),this._logHandler(this,M.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,M.INFO,...e),this._logHandler(this,M.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,M.WARN,...e),this._logHandler(this,M.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,M.ERROR,...e),this._logHandler(this,M.ERROR,...e)}}let B,H;const $=new WeakMap,z=new WeakMap,q=new WeakMap,G=new WeakMap,K=new WeakMap;let W={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return z.get(e);if("objectStoreNames"===t)return e.objectStoreNames||q.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Q(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(H||(H=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(X(this),t),Y($.get(this))}:function(...t){return Y(e.apply(X(this),t))}:function(t,...n){const r=e.call(X(this),t,...n);return q.set(r,t.sort?t.sort():[t]),Y(r)}}function J(e){return"function"==typeof e?Q(e):(e instanceof IDBTransaction&&function(e){if(z.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)});z.set(e,t)}(e),t=e,(B||(B=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,W):e);var t}function Y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{t(Y(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",s),e.addEventListener("error",i)});return t.then(t=>{t instanceof IDBCursor&&$.set(t,e)}).catch(()=>{}),K.set(t,e),t}(e);if(G.has(e))return G.get(e);const t=J(e);return t!==e&&(G.set(e,t),K.set(t,e)),t}const X=e=>K.get(e);const Z=["get","getKey","getAll","getAllKeys","count"],ee=["put","add","delete","clear"],te=new Map;function ne(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(te.get(t))return te.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=ee.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!Z.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),s&&i.done]))[0]};return te.set(t,i),i}W=(e=>({...e,get:(t,n,r)=>ne(t,n)||e.get(t,n,r),has:(t,n)=>!!ne(t,n)||e.has(t,n)}))(W);
202
217
  /**
203
218
  * @license
204
219
  * Copyright 2019 Google LLC
@@ -215,7 +230,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
215
230
  * See the License for the specific language governing permissions and
216
231
  * limitations under the License.
217
232
  */
218
- class J{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const X="@firebase/app",Z="0.10.9",tt=new L("@firebase/app"),et="@firebase/app-compat",nt="@firebase/analytics-compat",rt="@firebase/analytics",st="@firebase/app-check-compat",it="@firebase/app-check",ot="@firebase/auth",at="@firebase/auth-compat",ct="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",lt="@firebase/functions-compat",dt="@firebase/installations",ft="@firebase/installations-compat",pt="@firebase/messaging",gt="@firebase/messaging-compat",mt="@firebase/performance",yt="@firebase/performance-compat",vt="@firebase/remote-config",wt="@firebase/remote-config-compat",_t="@firebase/storage",Tt="@firebase/storage-compat",Et="@firebase/firestore",St="@firebase/vertexai-preview",It="@firebase/firestore-compat",bt="firebase",At="[DEFAULT]",Ct={[X]:"fire-core",[et]:"fire-core-compat",[rt]:"fire-analytics",[nt]:"fire-analytics-compat",[it]:"fire-app-check",[st]:"fire-app-check-compat",[ot]:"fire-auth",[at]:"fire-auth-compat",[ct]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[lt]:"fire-fn-compat",[dt]:"fire-iid",[ft]:"fire-iid-compat",[pt]:"fire-fcm",[gt]:"fire-fcm-compat",[mt]:"fire-perf",[yt]:"fire-perf-compat",[vt]:"fire-rc",[wt]:"fire-rc-compat",[_t]:"fire-gcs",[Tt]:"fire-gcs-compat",[Et]:"fire-fst",[It]:"fire-fst-compat",[St]:"fire-vertex","fire-js":"fire-js",[bt]:"fire-js-all"},kt=new Map,Nt=new Map,Rt=new Map;function Ot(t,e){try{t.container.addComponent(e)}catch(n){tt.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Dt(t){const e=t.name;if(Rt.has(e))return tt.debug(`There were multiple attempts to register component ${e}.`),!1;Rt.set(e,t);for(const e of kt.values())Ot(e,t);for(const e of Nt.values())Ot(e,t);return!0}function Lt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Pt(t){return void 0!==t.settings}
233
+ class re{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const se="@firebase/app",ie="0.13.2",oe=new j("@firebase/app"),ae="@firebase/app-compat",ce="@firebase/analytics-compat",ue="@firebase/analytics",he="@firebase/app-check-compat",le="@firebase/app-check",de="@firebase/auth",fe="@firebase/auth-compat",pe="@firebase/database",ge="@firebase/data-connect",me="@firebase/database-compat",ye="@firebase/functions",ve="@firebase/functions-compat",_e="@firebase/installations",we="@firebase/installations-compat",Te="@firebase/messaging",Ee="@firebase/messaging-compat",Se="@firebase/performance",Ie="@firebase/performance-compat",be="@firebase/remote-config",Ae="@firebase/remote-config-compat",Ce="@firebase/storage",ke="@firebase/storage-compat",Re="@firebase/firestore",Oe="@firebase/ai",Ne="@firebase/firestore-compat",De="firebase",Pe="[DEFAULT]",Le={[se]:"fire-core",[ae]:"fire-core-compat",[ue]:"fire-analytics",[ce]:"fire-analytics-compat",[le]:"fire-app-check",[he]:"fire-app-check-compat",[de]:"fire-auth",[fe]:"fire-auth-compat",[pe]:"fire-rtdb",[ge]:"fire-data-connect",[me]:"fire-rtdb-compat",[ye]:"fire-fn",[ve]:"fire-fn-compat",[_e]:"fire-iid",[we]:"fire-iid-compat",[Te]:"fire-fcm",[Ee]:"fire-fcm-compat",[Se]:"fire-perf",[Ie]:"fire-perf-compat",[be]:"fire-rc",[Ae]:"fire-rc-compat",[Ce]:"fire-gcs",[ke]:"fire-gcs-compat",[Re]:"fire-fst",[Ne]:"fire-fst-compat",[Oe]:"fire-vertex","fire-js":"fire-js",[De]:"fire-js-all"},Me=new Map,xe=new Map,Ue=new Map;function Fe(e,t){try{e.container.addComponent(t)}catch(n){oe.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Ve(e){const t=e.name;if(Ue.has(t))return oe.debug(`There were multiple attempts to register component ${t}.`),!1;Ue.set(t,e);for(const t of Me.values())Fe(t,e);for(const t of xe.values())Fe(t,e);return!0}function je(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Be(e){return null!=e&&void 0!==e.settings}
219
234
  /**
220
235
  * @license
221
236
  * Copyright 2019 Google LLC
@@ -231,7 +246,7 @@ class J{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
231
246
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
232
247
  * See the License for the specific language governing permissions and
233
248
  * limitations under the License.
234
- */const Mt=new p("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","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."});
249
+ */const He=new T("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","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."});
235
250
  /**
236
251
  * @license
237
252
  * Copyright 2019 Google LLC
@@ -248,7 +263,7 @@ class J{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
248
263
  * See the License for the specific language governing permissions and
249
264
  * limitations under the License.
250
265
  */
251
- class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Mt.create("app-deleted",{appName:this._name})}}
266
+ class $e{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new N("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 He.create("app-deleted",{appName:this._name})}}
252
267
  /**
253
268
  * @license
254
269
  * Copyright 2019 Google LLC
@@ -264,7 +279,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
264
279
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
265
280
  * See the License for the specific language governing permissions and
266
281
  * limitations under the License.
267
- */const Ut="10.13.0";function Ft(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:At,automaticDataCollectionEnabled:!1},e),s=r.name;if("string"!=typeof s||!s)throw Mt.create("bad-app-name",{appName:String(s)});if(n||(n=u()),!n)throw Mt.create("no-options");const i=kt.get(s);if(i){if(m(n,i.options)&&m(r,i.config))return i;throw Mt.create("duplicate-app",{appName:s})}const o=new C(s);for(const t of Rt.values())o.addComponent(t);const a=new xt(n,r,o);return kt.set(s,a),a}function Vt(t=At){const e=kt.get(t);if(!e&&t===At&&u())return Ft();if(!e)throw Mt.create("no-app",{appName:t});return e}function Bt(t,e,n){var r;let s=null!==(r=Ct[t])&&void 0!==r?r:t;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=e.match(/\s|\//);if(i||o){const t=[`Unable to register library "${s}" with version "${e}":`];return i&&t.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void tt.warn(t.join(" "))}Dt(new I(`${s}-version`,(()=>({library:s,version:e})),"VERSION"))}
282
+ */const ze="11.10.0";function qe(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),s=r.name;if("string"!=typeof s||!s)throw He.create("bad-app-name",{appName:String(s)});if(n||(n=h()),!n)throw He.create("no-options");const i=Me.get(s);if(i){if(S(n,i.options)&&S(r,i.config))return i;throw He.create("duplicate-app",{appName:s})}const o=new L(s);for(const e of Ue.values())o.addComponent(e);const a=new $e(n,r,o);return Me.set(s,a),a}function Ge(e=Pe){const t=Me.get(e);if(!t&&e===Pe&&h())return qe();if(!t)throw He.create("no-app",{appName:e});return t}function Ke(e,t,n){var r;let s=null!==(r=Le[e])&&void 0!==r?r:e;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${s}" with version "${t}":`];return i&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void oe.warn(e.join(" "))}Ve(new N(`${s}-version`,()=>({library:s,version:t}),"VERSION"))}
268
283
  /**
269
284
  * @license
270
285
  * Copyright 2021 Google LLC
@@ -280,7 +295,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
280
295
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
281
296
  * See the License for the specific language governing permissions and
282
297
  * limitations under the License.
283
- */const Ht="firebase-heartbeat-database",jt=1,$t="firebase-heartbeat-store";let qt=null;function Kt(){return qt||(qt=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(t=>s(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore($t)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),qt}async function Wt(t,e){try{const n=(await Kt()).transaction($t,"readwrite"),r=n.objectStore($t);await r.put(e,zt(t)),await n.done}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}function zt(t){return`${t.name}!${t.options.appId}`}
298
+ */const We="firebase-heartbeat-store";let Qe=null;function Je(){return Qe||(Qe=function(e,t,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(e,t),a=Y(o);return r&&o.addEventListener("upgradeneeded",e=>{r(Y(o.result),e.oldVersion,e.newVersion,Y(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{i&&e.addEventListener("close",()=>i()),s&&e.addEventListener("versionchange",e=>s(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(We)}catch(e){console.warn(e)}}}).catch(e=>{throw He.create("idb-open",{originalErrorMessage:e.message})})),Qe}async function Ye(e,t){try{const n=(await Je()).transaction(We,"readwrite"),r=n.objectStore(We);await r.put(t,Xe(e)),await n.done}catch(e){if(e instanceof w)oe.warn(e.message);else{const t=He.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});oe.warn(t.message)}}}function Xe(e){return`${e.name}!${e.options.appId}`}
284
299
  /**
285
300
  * @license
286
301
  * Copyright 2021 Google LLC
@@ -296,7 +311,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
296
311
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
297
312
  * See the License for the specific language governing permissions and
298
313
  * limitations under the License.
299
- */class Gt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Yt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Qt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some((t=>t.date===s)))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(t){tt.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Qt(),{heartbeatsToSend:n,unsentEntries:r}=function(t,e=1024){const n=[];let r=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),Jt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Jt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return tt.warn(t),""}}}function Qt(){return(new Date).toISOString().substring(0,10)}class Yt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Kt()).transaction($t),n=await e.objectStore($t).get(zt(t));return await e.done,n}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Jt(t){return i(JSON.stringify({version:2,heartbeats:t})).length}
314
+ */class Ze{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new tt(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=et();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(e=>e.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}
300
315
  /**
301
316
  * @license
302
317
  * Copyright 2019 Google LLC
@@ -312,7 +327,26 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
312
327
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
328
  * See the License for the specific language governing permissions and
314
329
  * limitations under the License.
315
- */var Xt;Xt="",Dt(new I("platform-logger",(t=>new J(t)),"PRIVATE")),Dt(new I("heartbeat",(t=>new Gt(t)),"PRIVATE")),Bt(X,Z,Xt),Bt(X,Z,"esm2017"),Bt("fire-js","");
330
+ */(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){oe.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=et(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),nt(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),nt(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return oe.warn(e),""}}}function et(){return(new Date).toISOString().substring(0,10)}class tt{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Je()).transaction(We),n=await t.objectStore(We).get(Xe(e));return await t.done,n}catch(e){if(e instanceof w)oe.warn(e.message);else{const t=He.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});oe.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Ye(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Ye(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function nt(e){return i(JSON.stringify({version:2,heartbeats:e})).length}var rt;rt="",Ve(new N("platform-logger",e=>new re(e),"PRIVATE")),Ve(new N("heartbeat",e=>new Ze(e),"PRIVATE")),Ke(se,ie,rt),Ke(se,ie,"esm2017"),Ke("fire-js","");var st,it,ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
331
+ /** @license
332
+ Copyright The Closure Library Authors.
333
+ SPDX-License-Identifier: Apache-2.0
334
+ */(function(){var e;
335
+ /** @license
336
+
337
+ Copyright The Closure Library Authors.
338
+ SPDX-License-Identifier: Apache-2.0
339
+ */function t(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.B=Array(this.blockSize),this.o=this.h=0,this.s()}function n(e,t,n){n||(n=0);var r=Array(16);if("string"==typeof t)for(var s=0;16>s;++s)r[s]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(s=0;16>s;++s)r[s]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],s=e.g[2];var i=e.g[3],o=t+(i^n&(s^i))+r[0]+3614090360&4294967295;o=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=(n=(s=(i=(t=n+(o<<7&4294967295|o>>>25))+((o=i+(s^t&(n^s))+r[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(t^n))+r[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^s&(i^t))+r[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(i^n&(s^i))+r[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=i+(s^t&(n^s))+r[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(t^n))+r[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^s&(i^t))+r[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(i^n&(s^i))+r[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=i+(s^t&(n^s))+r[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(t^n))+r[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^s&(i^t))+r[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(i^n&(s^i))+r[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=i+(s^t&(n^s))+r[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=s+(n^i&(t^n))+r[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^s&(i^t))+r[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^i&(n^s))+r[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(t^n))+r[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=s+(t^n&(i^t))+r[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^t&(s^i))+r[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(s^i&(n^s))+r[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(t^n))+r[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=s+(t^n&(i^t))+r[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^t&(s^i))+r[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(s^i&(n^s))+r[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(t^n))+r[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=s+(t^n&(i^t))+r[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^t&(s^i))+r[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(s^i&(n^s))+r[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=i+(n^s&(t^n))+r[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=s+(t^n&(i^t))+r[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(i^t&(s^i))+r[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^s^i)+r[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=i+(t^n^s)+r[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^t^n)+r[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^t)+r[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^s^i)+r[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=i+(t^n^s)+r[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^t^n)+r[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^t)+r[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^s^i)+r[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=i+(t^n^s)+r[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^t^n)+r[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^t)+r[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^s^i)+r[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=i+(t^n^s)+r[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=s+(i^t^n)+r[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(s^i^t)+r[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(s^(n|~i))+r[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(t|~s))+r[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=s+(t^(i|~n))+r[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(i^(s|~t))+r[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(s^(n|~i))+r[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(t|~s))+r[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=s+(t^(i|~n))+r[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(i^(s|~t))+r[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(s^(n|~i))+r[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(t|~s))+r[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=s+(t^(i|~n))+r[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(i^(s|~t))+r[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((i=(t=n+((o=t+(s^(n|~i))+r[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=i+(n^(t|~s))+r[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((s=i+((o=s+(t^(i|~n))+r[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+r[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(s+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+s&4294967295,e.g[3]=e.g[3]+i&4294967295}function r(e,t){this.h=t;for(var n=[],r=!0,s=e.length-1;0<=s;s--){var i=0|e[s];r&&i==t||(n[s]=i,r=!1)}this.g=n}!function(e,t){function n(){}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}(t,function(){this.blockSize=-1}),t.prototype.s=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0},t.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var r=t-this.blockSize,s=this.B,i=this.h,o=0;o<t;){if(0==i)for(;o<=r;)n(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(s[i++]=e.charCodeAt(o++),i==this.blockSize){n(this,s),i=0;break}}else for(;o<t;)if(s[i++]=e[o++],i==this.blockSize){n(this,s),i=0;break}}this.h=i,this.o+=t},t.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var s={};function i(e){return-128<=e&&128>e?function(e,t){var n=s;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new r([0|e],0>e?-1:0)}):new r([0|e],0>e?-1:0)}function o(e){if(isNaN(e)||!isFinite(e))return a;if(0>e)return d(o(-e));for(var t=[],n=1,s=0;e>=n;s++)t[s]=e/n|0,n*=4294967296;return new r(t,0)}var a=i(0),c=i(1),u=i(16777216);function h(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function l(e){return-1==e.h}function d(e){for(var t=e.g.length,n=[],s=0;s<t;s++)n[s]=~e.g[s];return new r(n,~e.h).add(c)}function f(e,t){return e.add(d(t))}function p(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function g(e,t){this.g=e,this.h=t}function m(e,t){if(h(t))throw Error("division by zero");if(h(e))return new g(a,a);if(l(e))return t=m(d(e),t),new g(d(t.g),d(t.h));if(l(t))return t=m(e,d(t)),new g(d(t.g),t.h);if(30<e.g.length){if(l(e)||l(t))throw Error("slowDivide_ only works with positive integers.");for(var n=c,r=t;0>=r.l(e);)n=y(n),r=y(r);var s=v(n,1),i=v(r,1);for(r=v(r,2),n=v(n,2);!h(r);){var u=i.add(r);0>=u.l(e)&&(s=s.add(n),i=u),r=v(r,1),n=v(n,1)}return t=f(e,s.j(t)),new g(s,t)}for(s=a;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),r=48>=(r=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,r-48),u=(i=o(n)).j(t);l(u)||0<u.l(e);)u=(i=o(n-=r)).j(t);h(i)&&(i=c),s=s.add(i),e=f(e,u)}return new g(s,e)}function y(e){for(var t=e.g.length+1,n=[],s=0;s<t;s++)n[s]=e.i(s)<<1|e.i(s-1)>>>31;return new r(n,e.h)}function v(e,t){var n=t>>5;t%=32;for(var s=e.g.length-n,i=[],o=0;o<s;o++)i[o]=0<t?e.i(o+n)>>>t|e.i(o+n+1)<<32-t:e.i(o+n);return new r(i,e.h)}(e=r.prototype).m=function(){if(l(this))return-d(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:4294967296+r)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(h(this))return"0";if(l(this))return"-"+d(this).toString(e);for(var t=o(Math.pow(e,6)),n=this,r="";;){var s=m(n,t).g,i=((0<(n=f(n,s.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(h(n=s))return i+r;for(;6>i.length;)i="0"+i;r=i+r}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return l(e=f(this,e))?-1:h(e)?0:1},e.abs=function(){return l(this)?d(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0,i=0;i<=t;i++){var o=s+(65535&this.i(i))+(65535&e.i(i)),a=(o>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);s=a>>>16,o&=65535,a&=65535,n[i]=a<<16|o}return new r(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(h(this)||h(e))return a;if(l(this))return l(e)?d(this).j(d(e)):d(d(this).j(e));if(l(e))return d(this.j(d(e)));if(0>this.l(u)&&0>e.l(u))return o(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],s=0;s<2*t;s++)n[s]=0;for(s=0;s<this.g.length;s++)for(var i=0;i<e.g.length;i++){var c=this.i(s)>>>16,f=65535&this.i(s),g=e.i(i)>>>16,m=65535&e.i(i);n[2*s+2*i]+=f*m,p(n,2*s+2*i),n[2*s+2*i+1]+=c*m,p(n,2*s+2*i+1),n[2*s+2*i+1]+=f*g,p(n,2*s+2*i+1),n[2*s+2*i+2]+=c*g,p(n,2*s+2*i+2)}for(s=0;s<t;s++)n[s]=n[2*s+1]<<16|n[2*s];for(s=t;s<2*t;s++)n[s]=0;return new r(n,0)},e.A=function(e){return m(this,e).h},e.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.i(s)&e.i(s);return new r(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.i(s)|e.i(s);return new r(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],s=0;s<t;s++)n[s]=this.i(s)^e.i(s);return new r(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,it=t,r.prototype.add=r.prototype.add,r.prototype.multiply=r.prototype.j,r.prototype.modulo=r.prototype.A,r.prototype.compare=r.prototype.l,r.prototype.toNumber=r.prototype.m,r.prototype.toString=r.prototype.toString,r.prototype.getBits=r.prototype.i,r.fromNumber=o,r.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);if("-"==t.charAt(0))return d(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var r=o(Math.pow(n,8)),s=a,i=0;i<t.length;i+=8){var c=Math.min(8,t.length-i),u=parseInt(t.substring(i,i+c),n);8>c?(c=o(Math.pow(n,c)),s=s.j(c).add(o(u))):s=(s=s.j(r)).add(o(u))}return s},st=r}).apply(void 0!==ot?ot:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var at,ct,ut,ht,lt,dt,ft,pt,gt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
340
+ /** @license
341
+ Copyright The Closure Library Authors.
342
+ SPDX-License-Identifier: Apache-2.0
343
+ */(function(){var e,t="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e};var n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof gt&&gt];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);!function(e,r){if(r)e:{var s=n;e=e.split(".");for(var i=0;i<e.length-1;i++){var o=e[i];if(!(o in s))break e;s=s[o]}(r=r(i=s[e=e[e.length-1]]))!=i&&null!=r&&t(s,e,{configurable:!0,writable:!0,value:r})}}("Array.prototype.values",function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var n=0,r=!1,s={next:function(){if(!r&&n<e.length){var s=n++;return{value:t(s,e[s]),done:!1}}return r=!0,{done:!0,value:void 0}}};return s[Symbol.iterator]=function(){return s},s}(this,function(e,t){return t})}});
344
+ /** @license
345
+
346
+ Copyright The Closure Library Authors.
347
+ SPDX-License-Identifier: Apache-2.0
348
+ */
349
+ var r=r||{},s=this||self;function i(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function u(e,t,n){return(u=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}function h(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function l(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}function d(e){const t=e.length;if(0<t){const n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function f(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(i(n)){const t=e.length||0,r=n.length||0;e.length=t+r;for(let s=0;s<r;s++)e[t+s]=n[s]}else e.push(n)}}function p(e){return/^[\s\xa0]*$/.test(e)}function g(){var e=s.navigator;return e&&(e=e.userAgent)?e:""}function m(e){return m[" "](e),e}m[" "]=function(){};var y=!(-1==g().indexOf("Gecko")||-1!=g().toLowerCase().indexOf("webkit")&&-1==g().indexOf("Edge")||-1!=g().indexOf("Trident")||-1!=g().indexOf("MSIE")||-1!=g().indexOf("Edge"));function v(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function _(e){const t={};for(const n in e)t[n]=e[n];return t}const w="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<w.length;t++)n=w[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function E(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function S(e){s.setTimeout(()=>{throw e},0)}function I(){var e=R;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var b=new class{constructor(e,t){this.i=e,this.j=t,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}}(()=>new A,e=>e.reset());class A{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let C,k=!1,R=new class{constructor(){this.h=this.g=null}add(e,t){const n=b.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},O=()=>{const e=s.Promise.resolve(void 0);C=()=>{e.then(N)}};var N=()=>{for(var e;e=I();){try{e.h.call(e.g)}catch(e){S(e)}var t=b;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}k=!1};function D(){this.s=this.s,this.C=this.C}function P(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}D.prototype.s=!1,D.prototype.ma=function(){this.s||(this.s=!0,this.N())},D.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},P.prototype.h=function(){this.defaultPrevented=!0};var L=function(){if(!s.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};s.addEventListener("test",e,t),s.removeEventListener("test",e,t)}catch(e){}return e}();function M(e,t){if(P.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(y){e:{try{m(t.nodeName);var s=!0;break e}catch(e){}s=!1}s||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:x[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&M.aa.h.call(this)}}l(M,P);var x={2:"touch",3:"pen",4:"mouse"};M.prototype.h=function(){M.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var U="closure_listenable_"+(1e6*Math.random()|0),F=0;function V(e,t,n,r,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=s,this.key=++F,this.da=this.fa=!1}function j(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function B(e){this.src=e,this.g={},this.h=0}function H(e,t){var n=t.type;if(n in e.g){var r,s=e.g[n],i=Array.prototype.indexOf.call(s,t,void 0);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(j(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function $(e,t,n,r){for(var s=0;s<e.length;++s){var i=e[s];if(!i.da&&i.listener==t&&i.capture==!!n&&i.ha==r)return s}return-1}B.prototype.add=function(e,t,n,r,s){var i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);var o=$(e,t,r,s);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new V(t,this.src,i,!!r,s)).fa=n,e.push(t)),t};var z="closure_lm_"+(1e6*Math.random()|0),q={};function G(e,t,n,r,s){if(Array.isArray(t)){for(var i=0;i<t.length;i++)G(e,t[i],n,r,s);return null}return n=Z(n),e&&e[U]?e.K(t,n,!!o(r)&&!!r.capture,s):function(e,t,n,r,s,i){if(!t)throw Error("Invalid event type");var a=o(s)?!!s.capture:!!s,c=Y(e);if(c||(e[z]=c=new B(e)),n=c.add(t,n,r,a,i),n.proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)L||(s=a),void 0===s&&(s=!1),e.addEventListener(t.toString(),r,s);else if(e.attachEvent)e.attachEvent(Q(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}(e,t,n,!1,r,s)}function K(e,t,n,r,s){if(Array.isArray(t))for(var i=0;i<t.length;i++)K(e,t[i],n,r,s);else r=o(r)?!!r.capture:!!r,n=Z(n),e&&e[U]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=$(i=e.g[t],n,r,s))&&(j(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete e.g[t],e.h--)))):e&&(e=Y(e))&&(t=e.g[t.toString()],e=-1,t&&(e=$(t,n,r,s)),(n=-1<e?t[e]:null)&&W(n))}function W(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[U])H(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Q(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Y(t))?(H(n,e),0==n.h&&(n.src=null,t[z]=null)):j(e)}}}function Q(e){return e in q?q[e]:q[e]="on"+e}function J(e,t){if(e.da)e=!0;else{t=new M(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&W(e),e=n.call(r,t)}return e}function Y(e){return(e=e[z])instanceof B?e:null}var X="__closure_events_fn_"+(1e9*Math.random()>>>0);function Z(e){return"function"==typeof e?e:(e[X]||(e[X]=function(t){return e.handleEvent(t)}),e[X])}function ee(){D.call(this),this.i=new B(this),this.M=this,this.F=null}function te(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new P(t,e);else if(t instanceof P)t.target=t.target||e;else{var s=t;T(t=new P(r,e),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=t.g=n[i];s=ne(o,r,!0,t)&&s}if(s=ne(o=t.g=e,r,!0,t)&&s,s=ne(o,r,!1,t)&&s,n)for(i=0;i<n.length;i++)s=ne(o=t.g=n[i],r,!1,t)&&s}function ne(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var s=!0,i=0;i<t.length;++i){var o=t[i];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&H(e.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}function re(e,t,n){if("function"==typeof e)n&&(e=u(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=u(e.handleEvent,e)}return 2147483647<Number(t)?-1:s.setTimeout(e,t||0)}function se(e){e.g=re(()=>{e.g=null,e.i&&(e.i=!1,se(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}l(ee,D),ee.prototype[U]=!0,ee.prototype.removeEventListener=function(e,t,n,r){K(this,e,t,n,r)},ee.prototype.N=function(){if(ee.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)j(n[r]);delete t.g[e],t.h--}}this.F=null},ee.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},ee.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class ie extends D{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:se(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function oe(e){D.call(this),this.h=e,this.g={}}l(oe,D);var ae=[];function ce(e){v(e.g,function(e,t){this.g.hasOwnProperty(t)&&W(e)},e),e.g={}}oe.prototype.N=function(){oe.aa.N.call(this),ce(this)},oe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ue=s.JSON.stringify,he=s.JSON.parse,le=class{stringify(e){return s.JSON.stringify(e,void 0)}parse(e){return s.JSON.parse(e,void 0)}};function de(){}function fe(e){return e.h||(e.h=e.i())}function pe(){}de.prototype.h=null;var ge={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function me(){P.call(this,"d")}function ye(){P.call(this,"c")}l(me,P),l(ye,P);var ve={},_e=null;function we(){return _e=_e||new ee}function Te(e){P.call(this,ve.La,e)}function Ee(e){const t=we();te(t,new Te(t))}function Se(e,t){P.call(this,ve.STAT_EVENT,e),this.stat=t}function Ie(e){const t=we();te(t,new Se(t,e))}function be(e,t){P.call(this,ve.Ma,e),this.size=t}function Ae(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){e()},t)}function Ce(){this.g=!0}function ke(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return ue(n)}catch(e){return t}}(e,n)+(r?" "+r:"")})}ve.La="serverreachability",l(Te,P),ve.STAT_EVENT="statevent",l(Se,P),ve.Ma="timingevent",l(be,P),Ce.prototype.xa=function(){this.g=!1},Ce.prototype.info=function(){};var Re,Oe={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Ne={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function De(){}function Pe(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new oe(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 Le}function Le(){this.i=null,this.g="",this.h=!1}l(De,de),De.prototype.g=function(){return new XMLHttpRequest},De.prototype.i=function(){return{}},Re=new De;var Me={},xe={};function Ue(e,t,n){e.L=1,e.v=vt(st(t)),e.m=n,e.P=!0,Fe(e,null)}function Fe(e,t){e.F=Date.now(),Be(e),e.A=st(e.v);var n=e.A,r=e.R;Array.isArray(r)||(r=[String(r)]),Dt(n.i,"t",r),e.C=0,n=e.j.J,e.h=new Le,e.g=wn(e.j,n?t:null,!e.m),0<e.O&&(e.M=new ie(u(e.Y,e,e.g),e.O)),t=e.U,n=e.g,r=e.ca;var s="readystatechange";Array.isArray(s)||(s&&(ae[0]=s.toString()),s=ae);for(var i=0;i<s.length;i++){var o=G(n,s[i],r||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?_(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Ee(),function(e,t,n,r,s,i){e.info(function(){if(e.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Ve(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function je(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?xe:(n=Number(t.substring(n,r)),isNaN(n)?Me:(r+=1)+n>t.length?xe:(t=t.slice(r,r+n),e.C=r+n,t))}function Be(e){e.S=Date.now()+e.I,He(e,e.I)}function He(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ae(u(e.ba,e),t)}function $e(e){e.B&&(s.clearTimeout(e.B),e.B=null)}function ze(e){0==e.j.G||e.J||gn(e.j,e)}function qe(e){$e(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ce(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function Ge(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||Ye(n.h,e)))if(!e.K&&Ye(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;pn(n),rn(n)}ln(n),Ie(18)}}else n.za=s[1],0<n.za-n.T&&37500>s[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ae(u(n.Za,n),6e3));if(1>=Je(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else yn(n,11)}else if((e.K||n.g==e)&&pn(n),!p(t))for(s=n.Da.g.parse(t),t=0;t<s.length;t++){let u=s[t];if(n.T=u[0],u=u[1],2==n.G)if("c"==u[0]){n.K=u[1],n.ia=u[2];const t=u[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const s=u[4];null!=s&&(n.Aa=s,n.j.info("SVER="+n.Aa));const h=u[5];null!=h&&"number"==typeof h&&0<h&&(r=1.5*h,n.L=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;const l=e.g;if(l){const e=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var i=r.h;i.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(Xe(i,i.h),i.h=null))}if(r.D){const e=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.ya=e,yt(r.I,r.D,e))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var o=e;if((r=n).qa=_n(r,r.J?r.ia:null,r.W),o.K){Ze(r.h,o);var a=o,c=r.L;c&&(a.I=c),a.B&&($e(a),Be(a)),r.g=o}else hn(r);0<n.i.length&&on(n)}else"stop"!=u[0]&&"close"!=u[0]||yn(n,7);else 3==n.G&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?yn(n,7):nn(n):"noop"!=u[0]&&n.l&&n.l.ta(u),n.v=0)}Ee()}catch(e){}}Pe.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==Xt(e)?t.j():this.Y(e)},Pe.prototype.Y=function(e){try{if(e==this.g)e:{const d=Xt(this.g);var t=this.g.Ba();this.g.Z();if(!(3>d)&&(3!=d||this.g&&(this.h.h||this.g.oa()||Zt(this.g)))){this.J||4!=d||7==t||Ee(),$e(this);var n=this.g.Z();this.X=n;t:if(Ve(this)){var r=Zt(this.g);e="";var i=r.length,o=4==Xt(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){qe(this),ze(this);var a="";break t}this.h.i=new s.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(r[t],{stream:!(o&&t==i-1)});r.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,function(e,t,n,r,s,i,o){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+i+" "+o})}(this.i,this.u,this.A,this.l,this.R,d,n),this.o){if(this.T&&!this.K){t:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!p(c)){var h=c;break t}}h=null}if(!(n=h)){this.o=!1,this.s=3,Ie(12),qe(this),ze(this);break e}ke(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ge(this,n)}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;){if(e=je(this,a),e==xe){4==d&&(this.s=4,Ie(14),n=!1),ke(this.i,this.l,null,"[Incomplete Response]");break}if(e==Me){this.s=4,Ie(15),ke(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}ke(this.i,this.l,e,null),Ge(this,e)}if(Ve(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=a.length||this.h.h||(this.s=1,Ie(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var l=this.j;l.g==this&&l.ba&&!l.M&&(l.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),dn(l),l.M=!0,Ie(11))}}else ke(this.i,this.l,a,"[Invalid Chunked Response]"),qe(this),ze(this)}else ke(this.i,this.l,a,null),Ge(this,a);4==d&&qe(this),this.o&&!this.J&&(4==d?gn(this.j,this):(this.o=!1,Be(this)))}else(function(e){const t={};e=(e.g&&2<=Xt(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(p(e[r]))continue;var n=E(e[r]);const s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=t[s]||[];t[s]=i,i.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,Ie(12)):(this.s=0,Ie(13)),qe(this),ze(this)}}}catch(e){}},Pe.prototype.cancel=function(){this.J=!0,qe(this)},Pe.prototype.ba=function(){this.B=null;const e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Ee(),Ie(17)),qe(this),this.s=2,ze(this)):He(this,this.S-e)};var Ke=class{constructor(e,t){this.g=e,this.map=t}};function We(e){this.l=e||10,s.PerformanceNavigationTiming?e=0<(e=s.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(s.chrome&&s.chrome.loadTimes&&s.chrome.loadTimes()&&s.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Qe(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Je(e){return e.h?1:e.g?e.g.size:0}function Ye(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xe(e,t){e.g?e.g.add(t):e.h=t}function Ze(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function et(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.D);return t}return d(e.i)}function tt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(i(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(i(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const r in e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(i(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),s=r.length,o=0;o<s;o++)t.call(void 0,r[o],n&&n[o],e)}We.prototype.cancel=function(){if(this.i=et(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var nt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function rt(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof rt){this.h=e.h,it(this,e.j),this.o=e.o,this.g=e.g,ot(this,e.s),this.l=e.l;var t=e.i,n=new kt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),mt(this,n),this.m=e.m}else e&&(t=String(e).match(nt))?(this.h=!1,it(this,t[1]||"",!0),this.o=_t(t[2]||""),this.g=_t(t[3]||"",!0),ot(this,t[4]),this.l=_t(t[5]||"",!0),mt(this,t[6]||"",!0),this.m=_t(t[7]||"")):(this.h=!1,this.i=new kt(null,this.h))}function st(e){return new rt(e)}function it(e,t,n){e.j=n?_t(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function ot(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function mt(e,t,n){t instanceof kt?(e.i=t,function(e,t){t&&!e.j&&(Rt(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(Ot(this,t),Dt(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=wt(t,At)),e.i=new kt(t,e.h))}function yt(e,t,n){e.i.set(t,n)}function vt(e){return yt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function _t(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function wt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Tt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Tt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}rt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(wt(t,St,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(wt(t,St,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(wt(n,"/"==n.charAt(0)?bt:It,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",wt(n,Ct)),e.join("")};var Et,St=/[#\/\?@]/g,It=/[#\?:]/g,bt=/[#\?]/g,At=/[#\?@]/g,Ct=/#/g;function kt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Rt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),s=null;if(0<=r){var i=e[n].substring(0,r);s=e[n].substring(r+1)}else i=e[n];t(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function Ot(e,t){Rt(e),t=Pt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Nt(e,t){return Rt(e),t=Pt(e,t),e.g.has(t)}function Dt(e,t,n){Ot(e,t),0<n.length&&(e.i=null,e.g.set(Pt(e,t),d(n)),e.h+=n.length)}function Pt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Lt(e,t,n,r,s){try{s&&(s.onload=null,s.onerror=null,s.onabort=null,s.ontimeout=null),r(n)}catch(e){}}function Mt(){this.g=new le}function xt(e,t,n){const r=n||"";try{tt(e,function(e,n){let s=e;o(e)&&(s=ue(e)),t.push(r+n+"="+encodeURIComponent(s))})}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}function Ut(e){this.l=e.Ub||null,this.j=e.eb||!1}function Ft(e,t){ee.call(this),this.D=e,this.o=t,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}function Vt(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function jt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,Bt(e)}function Bt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ht(e){let t="";return v(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function $t(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ht(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):yt(e,t,n))}function zt(e){ee.call(this),this.headers=new Map,this.o=e||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}(e=kt.prototype).add=function(e,t){Rt(this),this.i=null,e=Pt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Rt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.na=function(){Rt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let r=0;r<t.length;r++){const s=e[r];for(let e=0;e<s.length;e++)n.push(t[r])}return n},e.V=function(e){Rt(this);let t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Pt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Rt(this),this.i=null,Nt(this,e=Pt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var r=t[n];const i=encodeURIComponent(String(r)),o=this.V(r);for(r=0;r<o.length;r++){var s=i;""!==o[r]&&(s+="="+encodeURIComponent(String(o[r]))),e.push(s)}}return this.i=e.join("&")},l(Ut,de),Ut.prototype.g=function(){return new Ft(this.l,this.j)},Ut.prototype.i=(Et={},function(){return Et}),l(Ft,ee),(e=Ft.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,Bt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||s).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.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&&4!=this.readyState&&(this.g=!1,jt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Bt(this)),this.g&&(this.readyState=3,Bt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==s.ReadableStream&&"body"in e){if(this.j=e.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;Vt(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?jt(this):Bt(this),3==this.readyState&&Vt(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,jt(this))},e.Qa=function(e){this.g&&(this.response=e,jt(this))},e.ga=function(){this.g&&jt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Ft.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),l(zt,ee);var qt=/^https?$/i,Gt=["POST","PUT"];function Kt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Wt(e),Jt(e)}function Wt(e){e.A||(e.A=!0,te(e,"complete"),te(e,"error"))}function Qt(e){if(e.h&&void 0!==r&&(!e.v[1]||4!=Xt(e)||2!=e.Z()))if(e.u&&4==Xt(e))re(e.Ea,0,e);else if(te(e,"readystatechange"),4==Xt(e)){e.h=!1;try{const r=e.Z();e:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var i;if(i=0===r){var o=String(e.D).match(nt)[1]||null;!o&&s.self&&s.self.location&&(o=s.self.location.protocol.slice(0,-1)),i=!qt.test(o?o.toLowerCase():"")}n=i}if(n)te(e,"complete"),te(e,"success");else{e.m=6;try{var a=2<Xt(e)?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.Z()+"]",Wt(e)}}finally{Jt(e)}}}function Jt(e,t){if(e.g){Yt(e);const n=e.g,r=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||te(e,"ready");try{n.onreadystatechange=r}catch(e){}}}function Yt(e){e.I&&(s.clearTimeout(e.I),e.I=null)}function Xt(e){return e.g?e.g.readyState:0}function Zt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function en(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tn(e){this.Aa=0,this.i=[],this.j=new Ce,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=en("failFast",!1,e),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=en("baseRetryDelayMs",5e3,e),this.cb=en("retryDelaySeedMs",1e4,e),this.Wa=en("forwardChannelMaxRetries",2,e),this.wa=en("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new We(e&&e.concurrentRequestLimit),this.Da=new Mt,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function nn(e){if(sn(e),3==e.G){var t=e.U++,n=st(e.I);if(yt(n,"SID",e.K),yt(n,"RID",t),yt(n,"TYPE","terminate"),cn(e,n),(t=new Pe(e,e.j,t)).L=2,t.v=vt(st(n)),n=!1,s.navigator&&s.navigator.sendBeacon)try{n=s.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&s.Image&&((new Image).src=t.v,n=!0),n||(t.g=wn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Be(t)}vn(e)}function rn(e){e.g&&(dn(e),e.g.cancel(),e.g=null)}function sn(e){rn(e),e.u&&(s.clearTimeout(e.u),e.u=null),pn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&s.clearTimeout(e.s),e.s=null)}function on(e){if(!Qe(e.h)&&!e.s){e.s=!0;var t=e.Ga;C||O(),k||(C(),k=!0),R.add(t,e),e.B=0}}function an(e,t){var n;n=t?t.l:e.U++;const r=st(e.I);yt(r,"SID",e.K),yt(r,"RID",n),yt(r,"AID",e.T),cn(e,r),e.m&&e.o&&$t(r,e.m,e.o),n=new Pe(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=un(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),Xe(e.h,n),Ue(n,r,t)}function cn(e,t){e.H&&v(e.H,function(e,n){yt(t,n,e)}),e.l&&tt({},function(e,n){yt(t,n,e)})}function un(e,t,n){n=Math.min(e.i.length,n);var r=e.l?u(e.l.Na,e.l,e):null;e:{var s=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=s[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let i=!0;for(let o=0;o<n;o++){let n=s[o].g;const a=s[o].map;if(n-=t,0>n)t=Math.max(0,s[o].g-100),i=!1;else try{xt(a,e,"req"+n+"_")}catch(e){r&&r(a)}}if(i){r=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,r}function hn(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;C||O(),k||(C(),k=!0),R.add(t,e),e.v=0}}function ln(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ae(u(e.Fa,e),mn(e,e.v)),e.v++,!0)}function dn(e){null!=e.A&&(s.clearTimeout(e.A),e.A=null)}function fn(e){e.g=new Pe(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=st(e.qa);yt(t,"RID","rpc"),yt(t,"SID",e.K),yt(t,"AID",e.T),yt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&yt(t,"TO",e.ja),yt(t,"TYPE","xmlhttp"),cn(e,t),e.m&&e.o&&$t(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=vt(st(t)),n.m=null,n.P=!0,Fe(n,e)}function pn(e){null!=e.C&&(s.clearTimeout(e.C),e.C=null)}function gn(e,t){var n=null;if(e.g==t){pn(e),dn(e),e.g=null;var r=2}else{if(!Ye(e.h,t))return;n=t.D,Ze(e.h,t),r=1}if(0!=e.G)if(t.o)if(1==r){n=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;te(r=we(),new be(r,n)),on(e)}else hn(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==r&&function(e,t){return!(Je(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ae(u(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==r&&ln(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),s){case 1:yn(e,5);break;case 4:yn(e,10);break;case 3:yn(e,6);break;default:yn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function yn(e,t){if(e.j.info("Error code "+t),2==t){var n=u(e.fb,e),r=e.Xa;const t=!r;r=new rt(r||"//www.google.com/images/cleardot.gif"),s.location&&"http"==s.location.protocol||it(r,"https"),vt(r),t?function(e,t){const n=new Ce;if(s.Image){const r=new Image;r.onload=h(Lt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=h(Lt,n,"TestLoadImage: error",!1,t,r),r.onabort=h(Lt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=h(Lt,n,"TestLoadImage: timeout",!1,t,r),s.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new Ce;const n=new AbortController,r=setTimeout(()=>{n.abort(),Lt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(r),e.ok?Lt(0,0,!0,t):Lt(0,0,!1,t)}).catch(()=>{clearTimeout(r),Lt(0,0,!1,t)})}(r.toString(),n)}else Ie(2);e.G=0,e.l&&e.l.sa(t),vn(e),sn(e)}function vn(e){if(e.G=0,e.ka=[],e.l){const t=et(e.h);0==t.length&&0==e.i.length||(f(e.ka,t),f(e.ka,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.ra()}}function _n(e,t,n){var r=n instanceof rt?st(n):new rt(n);if(""!=r.g)t&&(r.g=t+"."+r.g),ot(r,r.s);else{var i=s.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var o=new rt(null);r&&it(o,r),t&&(o.g=t),i&&ot(o,i),n&&(o.l=n),r=o}return n=e.D,t=e.ya,n&&t&&yt(r,n,t),yt(r,"VER",e.la),cn(e,r),r}function wn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new zt(new Ut({eb:n})):new zt(e.pa)).Ha(e.J),t}function Tn(){}function En(){}function Sn(e,t){ee.call(this),this.g=new tn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!p(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!p(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new An(this)}function In(e){me.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function bn(){ye.call(this),this.status=1}function An(e){this.g=e}(e=zt.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Re.g(),this.v=this.o?fe(this.o):fe(Re),this.g.onreadystatechange=u(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Kt(this,e)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),i=s.FormData&&e instanceof s.FormData,!(0<=Array.prototype.indexOf.call(Gt,t,void 0))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Yt(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){Kt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,te(this,"complete"),te(this,"abort"),Jt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Jt(this,!0)),zt.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Qt(this):this.bb())},e.bb=function(){Qt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<Xt(this)?this.g.status:-1}catch(e){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),he(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=tn.prototype).la=8,e.G=1,e.connect=function(e,t,n,r){Ie(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=_n(this,null,this.W),on(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;const s=new Pe(this,this.j,e);let i=this.o;if(this.S&&(i?(i=_(i),T(i,this.S)):i=this.S),null!==this.m||this.O||(s.H=i,i=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var r=this.i[n];if(void 0===(r="__data__"in r.map&&"string"==typeof(r=r.map.__data__)?r.length:void 0))break;if(4096<(t+=r)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=un(this,s,t),yt(n=st(this.I),"RID",e),yt(n,"CVER",22),this.D&&yt(n,"X-HTTP-Session-Id",this.D),cn(this,n),i&&(this.O?t="headers="+encodeURIComponent(String(Ht(i)))+"&"+t:this.m&&$t(n,this.m,i)),Xe(this.h,s),this.Ua&&yt(n,"TYPE","init"),this.P?(yt(n,"$req",t),yt(n,"SID","null"),s.T=!0,Ue(s,n,null)):Ue(s,n,t),this.G=2}}else 3==this.G&&(e?an(this,e):0==this.i.length||Qe(this.h)||an(this))},e.Fa=function(){if(this.u=null,fn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ae(u(this.ab,this),e)}},e.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,Ie(10),rn(this),fn(this))},e.Za=function(){null!=this.C&&(this.C=null,rn(this),ln(this),Ie(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Ie(2)):(this.j.info("Failed to ping google.com"),Ie(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=Tn.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},En.prototype.g=function(e,t){return new Sn(e,t)},l(Sn,ee),Sn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Sn.prototype.close=function(){nn(this.g)},Sn.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=ue(e),e=n);t.i.push(new Ke(t.Ya++,e)),3==t.G&&on(t)},Sn.prototype.N=function(){this.g.l=null,delete this.j,nn(this.g),delete this.g,Sn.aa.N.call(this)},l(In,me),l(bn,ye),l(An,Tn),An.prototype.ua=function(){te(this.g,"a")},An.prototype.ta=function(e){te(this.g,new In(e))},An.prototype.sa=function(e){te(this.g,new bn)},An.prototype.ra=function(){te(this.g,"b")},En.prototype.createWebChannel=En.prototype.g,Sn.prototype.send=Sn.prototype.o,Sn.prototype.open=Sn.prototype.m,Sn.prototype.close=Sn.prototype.close,pt=function(){return new En},ft=function(){return we()},dt=ve,lt={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},Oe.NO_ERROR=0,Oe.TIMEOUT=8,Oe.HTTP_ERROR=6,ht=Oe,Ne.COMPLETE="complete",ut=Ne,pe.EventType=ge,ge.OPEN="a",ge.CLOSE="b",ge.ERROR="c",ge.MESSAGE="d",ee.prototype.listen=ee.prototype.K,ct=pe,zt.prototype.listenOnce=zt.prototype.L,zt.prototype.getLastError=zt.prototype.Ka,zt.prototype.getLastErrorCode=zt.prototype.Ba,zt.prototype.getStatus=zt.prototype.Z,zt.prototype.getResponseJson=zt.prototype.Oa,zt.prototype.getResponseText=zt.prototype.oa,zt.prototype.send=zt.prototype.ea,zt.prototype.setWithCredentials=zt.prototype.Ha,at=zt}).apply(void 0!==gt?gt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const mt="@firebase/firestore",yt="4.8.0";
316
350
  /**
317
351
  * @license
318
352
  * Copyright 2017 Google LLC
@@ -328,7 +362,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
328
362
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
329
363
  * See the License for the specific language governing permissions and
330
364
  * limitations under the License.
331
- */
365
+ */class vt{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}vt.UNAUTHENTICATED=new vt(null),vt.GOOGLE_CREDENTIALS=new vt("google-credentials-uid"),vt.FIRST_PARTY=new vt("first-party-uid"),vt.MOCK_USER=new vt("mock-user");
332
366
  /**
333
367
  * @license
334
368
  * Copyright 2017 Google LLC
@@ -345,10 +379,10 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
345
379
  * See the License for the specific language governing permissions and
346
380
  * limitations under the License.
347
381
  */
348
- const Zt=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=63&s|128):55296==(64512&s)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&t.charCodeAt(++r)),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=63&s|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=63&s|128)}return e},te={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const s=t[e],i=e+1<t.length,o=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Zt(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const s=n[t.charAt(e++)],i=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==s||null==i||null==o||null==a)throw Error();const c=s<<2|i>>4;if(r.push(c),64!==o){const t=i<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},ee=function(t){return function(t){const e=Zt(t);return te.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
382
+ let _t="11.10.0";
349
383
  /**
350
384
  * @license
351
- * Copyright 2022 Google LLC
385
+ * Copyright 2017 Google LLC
352
386
  *
353
387
  * Licensed under the Apache License, Version 2.0 (the "License");
354
388
  * you may not use this file except in compliance with the License.
@@ -361,11 +395,10 @@ const Zt=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.char
361
395
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
362
396
  * See the License for the specific language governing permissions and
363
397
  * limitations under the License.
364
- */
365
- const ne=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,re=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return te.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},se=()=>{try{return ne()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||re()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},ie=t=>{const e=(t=>{var e,n;return null===(n=null===(e=se())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(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]};class oe extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,oe.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ae.prototype.create)}}class ae{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,s=this.errors[t],i=s?function(t,e){return t.replace(ce,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(s,n):"Error",o=`${this.serviceName}: ${i} (${r}).`;return new oe(r,o,n)}}const ce=/\{\$([^}]+)}/g;
398
+ */const wt=new j("@firebase/firestore");function Tt(){return wt.logLevel}function Et(e,...t){if(wt.logLevel<=M.DEBUG){const n=t.map(bt);wt.debug(`Firestore (${_t}): ${e}`,...n)}}function St(e,...t){if(wt.logLevel<=M.ERROR){const n=t.map(bt);wt.error(`Firestore (${_t}): ${e}`,...n)}}function It(e,...t){if(wt.logLevel<=M.WARN){const n=t.map(bt);wt.warn(`Firestore (${_t}): ${e}`,...n)}}function bt(e){if("string"==typeof e)return e;try{
366
399
  /**
367
400
  * @license
368
- * Copyright 2021 Google LLC
401
+ * Copyright 2020 Google LLC
369
402
  *
370
403
  * Licensed under the Apache License, Version 2.0 (the "License");
371
404
  * you may not use this file except in compliance with the License.
@@ -378,7 +411,8 @@ const ne=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
378
411
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
379
412
  * See the License for the specific language governing permissions and
380
413
  * limitations under the License.
381
- */function ue(t){return t&&t._delegate?t._delegate:t}class he{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
414
+ */
415
+ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
382
416
  /**
383
417
  * @license
384
418
  * Copyright 2017 Google LLC
@@ -394,7 +428,7 @@ const ne=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
394
428
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
395
429
  * See the License for the specific language governing permissions and
396
430
  * limitations under the License.
397
- */var le;!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"}(le||(le={}));const de={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},fe=le.INFO,pe={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},ge=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=pe[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};var me=function(t,e){return me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},me(t,e)};function ye(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ve(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var we,_e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Te=Te||{},Ee=_e||self;function Se(){}function Ie(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function be(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ae="closure_uid_"+(1e9*Math.random()>>>0),Ce=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ne(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Re(t,e,n){return(Re=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ne).apply(null,arguments)}function Oe(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function De(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ae)&&t[Ae]||(t[Ae]=++Ce))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Pe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Ie(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function Ue(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Ue.prototype.h=function(){this.defaultPrevented=!0};var Fe=function(){if(!Ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ee.addEventListener("test",Se,e),Ee.removeEventListener("test",Se,e)}catch(t){}return t}();function Ve(t){return/^[\s\xa0]*$/.test(t)}var Be=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=Ee.navigator;return t&&(t=t.userAgent)?t:""}function $e(t){return-1!=je().indexOf(t)}function qe(t){return qe[" "](t),t}qe[" "]=Se;var Ke,We,ze=$e("Opera"),Ge=$e("Trident")||$e("MSIE"),Qe=$e("Edge"),Ye=Qe||Ge,Je=$e("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge"))&&!($e("Trident")||$e("MSIE"))&&!$e("Edge"),Xe=-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge");function Ze(){var t=Ee.document;return t?t.documentMode:void 0}t:{var tn="",en=(We=je(),Je?/rv:([^\);]+)(\)|;)/.exec(We):Qe?/Edge\/([\d\.]+)/.exec(We):Ge?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(We):Xe?/WebKit\/(\S+)/.exec(We):ze?/(?:Version)[ \/]?(\S+)/.exec(We):void 0);if(en&&(tn=en?en[1]:""),Ge){var nn=Ze();if(null!=nn&&nn>parseFloat(tn)){Ke=String(nn);break t}}Ke=tn}var rn,sn={};function on(){return function(t){var e=sn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Be(String(Ke)).split("."),n=Be("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=He(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==i[2].length,0==o[2].length)||He(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ee.document&&Ge){var an=Ze();rn=an||(parseInt(Ke,10)||void 0)}else rn=void 0;var cn=rn;function un(t,e){if(Ue.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(Je){t:{try{qe(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}De(un,Ue);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),dn=0;function fn(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++dn,this.ba=this.ea=!1}function pn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function gn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function mn(t){var e={};for(var n in t)e[n]=t[n];return e}var yn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function vn(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<yn.length;i++)n=yn[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function wn(t){this.src=t,this.g={},this.h=0}function _n(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Pe(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(pn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Tn(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}wn.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Tn(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new fn(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var En="closure_lm_"+(1e6*Math.random()|0),Sn={};function In(t,e,n,r,s){if(r&&r.once)return An(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)In(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!1,r,s)}function bn(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=be(s)?!!s.capture:!!s,a=On(t);if(a||(t[En]=a=new wn(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Rn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Fe||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function An(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)An(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!0,r,s)}function Cn(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Cn(t,e[i],n,r,s);else r=be(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Tn(i=t.g[e],n,r,s))&&(pn(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=On(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Tn(e,n,r,s)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])_n(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=On(e))?(_n(n,t),0==n.h&&(n.src=null,e[En]=null)):pn(t)}}}function Nn(t){return t in Sn?Sn[t]:Sn[t]="on"+t}function Rn(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function On(t){return(t=t[En])instanceof wn?t:null}var Dn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Dn]||(t[Dn]=function(e){return t.handleEvent(e)}),t[Dn])}function Pn(){Le.call(this),this.i=new wn(this),this.P=this,this.I=null}function Mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Ue(e,t);else if(e instanceof Ue)e.target=e.target||t;else{var s=e;vn(e=new Ue(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=xn(o,r,!0,e)&&s}if(s=xn(o=e.g=t,r,!0,e)&&s,s=xn(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=xn(o=e.g=n[i],r,!1,e)&&s}function xn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&_n(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}De(Pn,Le),Pn.prototype[ln]=!0,Pn.prototype.removeEventListener=function(t,e,n,r){Cn(this,t,e,n,r)},Pn.prototype.M=function(){if(Pn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)pn(n[r]);delete e.g[t],e.h--}}this.I=null},Pn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Pn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Un=Ee.JSON.stringify;function Fn(){var t=Wn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Vn,Bn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new jn}),(function(t){return t.reset()})),jn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $n(t){Ee.setTimeout((function(){throw t}),0)}function qn(t,e){Vn||function(){var t=Ee.Promise.resolve(void 0);Vn=function(){t.then(zn)}}(),Kn||(Vn(),Kn=!0),Wn.add(t,e)}var Kn=!1,Wn=new Bn;function zn(){for(var t;t=Fn();){try{t.h.call(t.g)}catch(t){$n(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Kn=!1}function Gn(t,e){Pn.call(this),this.h=t||1,this.g=e||Ee,this.j=Re(this.lb,this),this.l=Date.now()}function Qn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Yn(t,e,n){if("function"==typeof t)n&&(t=Re(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Re(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ee.setTimeout(t,e||0)}function Jn(t){t.g=Yn((function(){t.g=null,t.i&&(t.i=!1,Jn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}De(Gn,Pn),(we=Gn.prototype).ca=!1,we.R=null,we.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Mn(this,"tick"),this.ca&&(Qn(this),this.start()))}},we.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},we.M=function(){Gn.X.M.call(this),Qn(this),delete this.g};var Xn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}me(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:Jn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Zn(t){Le.call(this),this.h=t,this.g={}}De(Zn,Le);var tr=[];function er(t,e,n,r){Array.isArray(n)||(n&&(tr[0]=n.toString()),n=tr);for(var s=0;s<n.length;s++){var i=In(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function nr(t){gn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function rr(){this.g=!0}function sr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return Un(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Zn.prototype.M=function(){Zn.X.M.call(this),nr(this)},Zn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},rr.prototype.Aa=function(){this.g=!1},rr.prototype.info=function(){};var ir={},or=null;function ar(){return or=or||new Pn}function cr(t){Ue.call(this,ir.Pa,t)}function ur(t){var e=ar();Mn(e,new cr(e))}function hr(t,e){Ue.call(this,ir.STAT_EVENT,t),this.stat=e}function lr(t){var e=ar();Mn(e,new hr(e,t))}function dr(t,e){Ue.call(this,ir.Qa,t),this.size=e}function fr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ee.setTimeout((function(){t()}),e)}ir.Pa="serverreachability",De(cr,Ue),ir.STAT_EVENT="statevent",De(hr,Ue),ir.Qa="timingevent",De(dr,Ue);var pr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},gr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function mr(){}function yr(t){return t.h||(t.h=t.i())}function vr(){}mr.prototype.h=null;var wr,_r={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Tr(){Ue.call(this,"d")}function Er(){Ue.call(this,"c")}function Sr(){}function Ir(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Zn(this),this.O=Ar,t=Ye?125:void 0,this.T=new Gn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new br}function br(){this.i=null,this.g="",this.h=!1}De(Tr,Ue),De(Er,Ue),De(Sr,mr),Sr.prototype.g=function(){return new XMLHttpRequest},Sr.prototype.i=function(){return{}},wr=new Sr;var Ar=45e3,Cr={},kr={};function Nr(t,e,n){t.K=1,t.v=Gr($r(e)),t.s=n,t.P=!0,Rr(t,null)}function Rr(t,e){t.F=Date.now(),Pr(t),t.A=$r(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),as(n.i,"t",r),t.C=0,n=t.l.H,t.h=new br,t.g=ai(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Xn(Re(t.La,t,t.g),t.N)),er(t.S,t.g,"readystatechange",t.ib),e=t.H?mn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),ur(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Or(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Dr(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),s=!1),sr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Cr){t.o=4,lr(15),sr(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}sr(t.j,t.m,r,null),Vr(t,r)}Or(t)&&r!=kr&&r!=Cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Zs(e),e.K=!0,lr(11))):(sr(t.j,t.m,n,"[Invalid Chunked Response]"),Fr(t),Ur(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Cr:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Pr(t){t.V=Date.now()+t.O,Mr(t,t.O)}function Mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=fr(Re(t.gb,t),e)}function xr(t){t.B&&(Ee.clearTimeout(t.B),t.B=null)}function Ur(t){0==t.l.G||t.I||ni(t.l,t)}function Fr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Qn(t.T),nr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Vr(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||ps(n.h,t)))if(!t.J&&ps(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ei(n),Ks(n)}Xs(n),lr(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=fr(Re(n.cb,n),6e3));if(1>=fs(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else si(n,11)}else if((t.J||n.g==t)&&ei(n),!Ve(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(gs(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,zr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=oi(r,r.H?r.ka:null,r.V),f.J){ms(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Pr(p)),r.g=f}else Js(r);0<n.i.length&&zs(n)}else"stop"!=i[0]&&"close"!=i[0]||si(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?si(n,7):qs(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}ur()}catch(i){}}function Br(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Ie(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Ie(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(we=Ir.prototype).setTimeout=function(t){this.O=t},we.ib=function(t){t=t.target;var e=this.L;e&&3==Fs(t)?e.l():this.La(t)},we.La=function(t){try{if(t==this.g)t:{var e=Fs(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ye||this.g&&(this.h.h||this.g.fa()||Vs(this.g)))){this.I||4!=e||7==n||ur(),xr(this);var r=this.g.aa();this.Y=r;e:if(Or(this)){var s=Vs(this.g);t="";var i=s.length,o=4==Fs(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Fr(this),Ur(this);var a="";break e}this.h.i=new Ee.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Ve(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,lr(12),Fr(this),Ur(this);break t}sr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Vr(this,r)}this.P?(Dr(this,e,a),Ye&&this.i&&3==e&&(er(this.S,this.T,"tick",this.hb),this.T.start())):(sr(this.j,this.m,a,null),Vr(this,a)),4==e&&Fr(this),this.i&&!this.I&&(4==e?ni(this.l,this):(this.i=!1,Pr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Fr(this),Ur(this)}}}catch(e){}},we.hb=function(){if(this.g){var t=Fs(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Dr(this,t,e),this.i&&4!=t&&Pr(this))}},we.cancel=function(){this.I=!0,Fr(this)},we.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(ur(),lr(17)),Fr(this),this.o=2,Ur(this)):Mr(this,this.V-t)};var Hr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof jr){this.h=void 0!==e?e:t.h,qr(this,t.j),this.s=t.s,this.g=t.g,Kr(this,t.m),this.l=t.l,e=t.i;var n=new rs;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Wr(this,n),this.o=t.o}else t&&(n=String(t).match(Hr))?(this.h=!!e,qr(this,n[1]||"",!0),this.s=Qr(n[2]||""),this.g=Qr(n[3]||"",!0),Kr(this,n[4]),this.l=Qr(n[5]||"",!0),Wr(this,n[6]||"",!0),this.o=Qr(n[7]||"")):(this.h=!!e,this.i=new rs(null,this.h))}function $r(t){return new jr(t)}function qr(t,e,n){t.j=n?Qr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Kr(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 Wr(t,e,n){e instanceof rs?(t.i=e,function(t,e){e&&!t.j&&(ss(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(is(this,e),as(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Yr(e,es)),t.i=new rs(e,t.h))}function zr(t,e,n){t.i.set(e,n)}function Gr(t){return zr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Qr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Yr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Jr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Jr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}jr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Yr(e,Xr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Yr(e,Xr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Yr(n,"/"==n.charAt(0)?ts:Zr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Yr(n,ns)),t.join("")};var Xr=/[#\/\?@]/g,Zr=/[#\?:]/g,ts=/[#\?]/g,es=/[#\?@]/g,ns=/#/g;function rs(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ss(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function is(t,e){ss(t),e=cs(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function os(t,e){return ss(t),e=cs(t,e),t.g.has(e)}function as(t,e,n){is(t,e),0<n.length&&(t.i=null,t.g.set(cs(t,e),Me(n)),t.h+=n.length)}function cs(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(we=rs.prototype).add=function(t,e){ss(this),this.i=null,t=cs(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},we.forEach=function(t,e){ss(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},we.oa=function(){ss(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},we.W=function(t){ss(this);var e=[];if("string"==typeof t)os(this,t)&&(e=e.concat(this.g.get(cs(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},we.set=function(t,e){return ss(this),this.i=null,os(this,t=cs(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},we.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},we.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var us=function(t,e){this.h=t,this.g=e};function hs(t){this.l=t||ls,Ee.PerformanceNavigationTiming?t=0<(t=Ee.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ee.g&&Ee.g.Ga&&Ee.g.Ga()&&Ee.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var ls=10;function ds(t){return!!t.h||!!t.g&&t.g.size>=t.j}function fs(t){return t.h?1:t.g?t.g.size:0}function ps(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function gs(t,e){t.g?t.g.add(e):t.h=e}function ms(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function ys(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=ye(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return Me(t.i)}function vs(){}function ws(){this.g=new vs}function _s(t,e,n){var r=n||"";try{Br(t,(function(t,n){var s=t;be(t)&&(s=Un(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Ts(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function Es(t){this.l=t.ac||null,this.j=t.jb||!1}function Ss(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Is,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}hs.prototype.cancel=function(){var t,e;if(this.i=ys(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ye(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},vs.prototype.stringify=function(t){return Ee.JSON.stringify(t,void 0)},vs.prototype.parse=function(t){return Ee.JSON.parse(t,void 0)},De(Es,mr),Es.prototype.g=function(){return new Ss(this.l,this.j)},Es.prototype.i=function(t){return function(){return t}}({}),De(Ss,Pn);var Is=0;function bs(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function As(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Cs(t)}function Cs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(we=Ss.prototype).open=function(t,e){if(this.readyState!=Is)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Cs(this)},we.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||Ee).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},we.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,As(this)),this.readyState=Is},we.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Cs(this)),this.g&&(this.readyState=3,Cs(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ee.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;bs(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},we.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?As(this):Cs(this),3==this.readyState&&bs(this)}},we.Va=function(t){this.g&&(this.response=this.responseText=t,As(this))},we.Ua=function(t){this.g&&(this.response=t,As(this))},we.ga=function(){this.g&&As(this)},we.setRequestHeader=function(t,e){this.v.append(t,e)},we.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},we.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Ss.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ks=Ee.JSON.parse;function Ns(t){Pn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Rs,this.K=this.L=!1}De(Ns,Pn);var Rs="",Os=/^https?$/i,Ds=["POST","PUT"];function Ls(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Ps(t),xs(t)}function Ps(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Ms(t){if(t.h&&void 0!==Te&&(!t.C[1]||4!=Fs(t)||2!=t.aa()))if(t.v&&4==Fs(t))Yn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==Fs(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Hr)[1]||null;if(!i&&Ee.self&&Ee.self.location){var o=Ee.self.location.protocol;i=o.substr(0,o.length-1)}s=!Os.test(i?i.toLowerCase():"")}e=s}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<Fs(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Ps(t)}}finally{xs(t)}}}function xs(t,e){if(t.g){Us(t);var n=t.g,r=t.C[0]?Se:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Us(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ee.clearTimeout(t.A),t.A=null)}function Fs(t){return t.g?t.g.readyState:0}function Vs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Rs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Bs(t){var e="";return gn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hs(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Bs(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):zr(t,e,n))}function js(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function $s(t){this.Ca=0,this.i=[],this.j=new rr,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=js("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=js("baseRetryDelayMs",5e3,t),this.bb=js("retryDelaySeedMs",1e4,t),this.$a=js("forwardChannelMaxRetries",2,t),this.ta=js("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new hs(t&&t.concurrentRequestLimit),this.Fa=new ws,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function qs(t){if(Ws(t),3==t.G){var e=t.U++,n=$r(t.F);zr(n,"SID",t.I),zr(n,"RID",e),zr(n,"TYPE","terminate"),Qs(t,n),(e=new Ir(t,t.j,e,void 0)).K=2,e.v=Gr($r(n)),n=!1,Ee.navigator&&Ee.navigator.sendBeacon&&(n=Ee.navigator.sendBeacon(e.v.toString(),"")),!n&&Ee.Image&&((new Image).src=e.v,n=!0),n||(e.g=ai(e.l,null),e.g.da(e.v)),e.F=Date.now(),Pr(e)}ii(t)}function Ks(t){t.g&&(Zs(t),t.g.cancel(),t.g=null)}function Ws(t){Ks(t),t.u&&(Ee.clearTimeout(t.u),t.u=null),ei(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ee.clearTimeout(t.m),t.m=null)}function zs(t){ds(t.h)||t.m||(t.m=!0,qn(t.Ja,t),t.C=0)}function Gs(t,e){var n;n=e?e.m:t.U++;var r=$r(t.F);zr(r,"SID",t.I),zr(r,"RID",n),zr(r,"AID",t.T),Qs(t,r),t.o&&t.s&&Hs(r,t.o,t.s),n=new Ir(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Ys(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),gs(t.h,n),Nr(n,r,e)}function Qs(t,e){t.ia&&gn(t.ia,(function(t,n){zr(e,n,t)})),t.l&&Br({},(function(t,n){zr(e,n,t)}))}function Ys(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Re(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{_s(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Js(t){t.g||t.u||(t.Z=1,qn(t.Ia,t),t.A=0)}function Xs(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=fr(Re(t.Ia,t),ri(t,t.A)),t.A++,!0)}function Zs(t){null!=t.B&&(Ee.clearTimeout(t.B),t.B=null)}function ti(t){t.g=new Ir(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=$r(t.sa);zr(e,"RID","rpc"),zr(e,"SID",t.I),zr(e,"CI",t.L?"0":"1"),zr(e,"AID",t.T),zr(e,"TYPE","xmlhttp"),Qs(t,e),t.o&&t.s&&Hs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Gr($r(e)),n.s=null,n.P=!0,Rr(n,t)}function ei(t){null!=t.v&&(Ee.clearTimeout(t.v),t.v=null)}function ni(t,e){var n=null;if(t.g==e){ei(t),Zs(t),t.g=null;var r=2}else{if(!ps(t.h,e))return;n=e.D,ms(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Mn(r=ar(),new dr(r,n)),zs(t)}else Js(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(fs(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=fr(Re(t.Ja,t,e),ri(t,t.C)),t.C++,0)))}(t,e)||2==r&&Xs(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:si(t,5);break;case 4:si(t,10);break;case 3:si(t,6);break;default:si(t,2)}}function ri(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function si(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Re(t.kb,t);n||(n=new jr("//www.google.com/images/cleardot.gif"),Ee.location&&"http"==Ee.location.protocol||qr(n,"https"),Gr(n)),function(t,e){var n=new rr;if(Ee.Image){var r=new Image;r.onload=Oe(Ts,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Oe(Ts,n,r,"TestLoadImage: error",!1,e),r.onabort=Oe(Ts,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Oe(Ts,n,r,"TestLoadImage: timeout",!1,e),Ee.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),ii(t),Ws(t)}function ii(t){if(t.G=0,t.la=[],t.l){var e=ys(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function oi(t,e,n){var r=n instanceof jr?$r(n):new jr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Kr(r,r.m);else{var s=Ee.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new jr(null,void 0);r&&qr(i,r),e&&(i.g=e),s&&Kr(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&zr(r,n,e),zr(r,"VER",t.ma),Qs(t,r),r}function ai(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Ns(new Es({jb:!0})):new Ns(t.ra)).Ka(t.H),e}function ci(){}function ui(){if(Ge&&!(10<=Number(cn)))throw Error("Environmental error: no available transport.")}function hi(t,e){Pn.call(this),this.g=new $s(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Ve(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ve(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new fi(this)}function li(t){Tr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function di(){Er.call(this),this.status=1}function fi(t){this.g=t}(we=Ns.prototype).Ka=function(t){this.L=t},we.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():wr.g(),this.C=this.u?yr(this.u):yr(wr),this.g.onreadystatechange=Re(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ls(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=ye(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=Ee.FormData&&t instanceof Ee.FormData,!(0<=Pe(Ds,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ye(n),f=d.next();!f.done;f=d.next()){var p=ve(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Us(this),0<this.B&&((this.K=function(t){return Ge&&on()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Re(this.qa,this)):this.A=Yn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ls(this,l)}},we.qa=function(){void 0!==Te&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},we.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),xs(this))},we.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xs(this,!0)),Ns.X.M.call(this)},we.Ha=function(){this.s||(this.F||this.v||this.l?Ms(this):this.fb())},we.fb=function(){Ms(this)},we.aa=function(){try{return 2<Fs(this)?this.g.status:-1}catch(t){return-1}},we.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},we.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ks(e)}},we.Ea=function(){return this.m},we.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(we=$s.prototype).ma=8,we.G=1,we.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Ir(this,this.j,t,void 0),n=this.s;if(this.S&&(n?vn(n=mn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=Ys(this,e,r),zr(s=$r(this.F),"RID",t),zr(s,"CVER",22),this.D&&zr(s,"X-HTTP-Session-Id",this.D),Qs(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Bs(n)))+"&"+r:this.o&&Hs(s,this.o,n)),gs(this.h,e),this.Ya&&zr(s,"TYPE","init"),this.O?(zr(s,"$req",r),zr(s,"SID","null"),e.Z=!0,Nr(e,s,null)):Nr(e,s,r),this.G=2}}else 3==this.G&&(t?Gs(this,t):0==this.i.length||ds(this.h)||Gs(this))},we.Ia=function(){if(this.u=null,ti(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=fr(Re(this.eb,this),t)}},we.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,lr(10),Ks(this),ti(this))},we.cb=function(){null!=this.v&&(this.v=null,Ks(this),Xs(this),lr(19))},we.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(we=ci.prototype).xa=function(){},we.wa=function(){},we.va=function(){},we.ua=function(){},we.Ra=function(){},ui.prototype.g=function(t,e){return new hi(t,e)},De(hi,Pn),hi.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=oi(t,null,t.V),zs(t)},hi.prototype.close=function(){qs(this.g)},hi.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Un(t),t=n);e.i.push(new us(e.ab++,t)),3==e.G&&zs(e)},hi.prototype.M=function(){this.g.l=null,delete this.j,qs(this.g),delete this.g,hi.X.M.call(this)},De(li,Tr),De(di,Er),De(fi,ci),fi.prototype.xa=function(){Mn(this.g,"a")},fi.prototype.wa=function(t){Mn(this.g,new li(t))},fi.prototype.va=function(t){Mn(this.g,new di)},fi.prototype.ua=function(){Mn(this.g,"b")},ui.prototype.createWebChannel=ui.prototype.g,hi.prototype.send=hi.prototype.u,hi.prototype.open=hi.prototype.m,hi.prototype.close=hi.prototype.close,pr.NO_ERROR=0,pr.TIMEOUT=8,pr.HTTP_ERROR=6,gr.COMPLETE="complete",vr.EventType=_r,_r.OPEN="a",_r.CLOSE="b",_r.ERROR="c",_r.MESSAGE="d",Pn.prototype.listen=Pn.prototype.N,Ns.prototype.listenOnce=Ns.prototype.O,Ns.prototype.getLastError=Ns.prototype.Oa,Ns.prototype.getLastErrorCode=Ns.prototype.Ea,Ns.prototype.getStatus=Ns.prototype.aa,Ns.prototype.getResponseJson=Ns.prototype.Sa,Ns.prototype.getResponseText=Ns.prototype.fa,Ns.prototype.send=Ns.prototype.da,Ns.prototype.setWithCredentials=Ns.prototype.Ka;var pi=pr,gi=gr,mi=ir,yi=10,vi=11,wi=Es,_i=vr,Ti=Ns;const Ei="@firebase/firestore";
431
+ */function At(e,t,n){let r="Unexpected state";"string"==typeof t?r=t:n=t,Ct(e,r,n)}function Ct(e,t,n){let r=`FIRESTORE (${_t}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{r+=" CONTEXT: "+JSON.stringify(n)}catch(e){r+=" CONTEXT: "+n}throw St(r),new Error(r)}function kt(e,t,n,r){let s="Unexpected state";"string"==typeof n?s=n:r=n,e||Ct(t,s,r)}function Rt(e,t){return e}
398
432
  /**
399
433
  * @license
400
434
  * Copyright 2017 Google LLC
@@ -410,7 +444,7 @@ const ne=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
410
444
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
411
445
  * See the License for the specific language governing permissions and
412
446
  * limitations under the License.
413
- */class Si{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}Si.UNAUTHENTICATED=new Si(null),Si.GOOGLE_CREDENTIALS=new Si("google-credentials-uid"),Si.FIRST_PARTY=new Si("first-party-uid"),Si.MOCK_USER=new Si("mock-user");
447
+ */const Ot={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 Nt extends w{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
414
448
  /**
415
449
  * @license
416
450
  * Copyright 2017 Google LLC
@@ -426,8 +460,7 @@ const ne=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
426
460
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
427
461
  * See the License for the specific language governing permissions and
428
462
  * limitations under the License.
429
- */
430
- let Ii="9.15.0";
463
+ */class Dt{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}
431
464
  /**
432
465
  * @license
433
466
  * Copyright 2017 Google LLC
@@ -443,7 +476,7 @@ let Ii="9.15.0";
443
476
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
444
477
  * See the License for the specific language governing permissions and
445
478
  * limitations under the License.
446
- */const bi=new class{constructor(t){this.name=t,this._logLevel=fe,this._logHandler=ge,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in le))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?de[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,le.DEBUG,...t),this._logHandler(this,le.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,le.VERBOSE,...t),this._logHandler(this,le.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,le.INFO,...t),this._logHandler(this,le.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,le.WARN,...t),this._logHandler(this,le.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,le.ERROR,...t),this._logHandler(this,le.ERROR,...t)}}("@firebase/firestore");function Ai(){return bi.logLevel}function Ci(t,...e){if(bi.logLevel<=le.DEBUG){const n=e.map(Ri);bi.debug(`Firestore (${Ii}): ${t}`,...n)}}function ki(t,...e){if(bi.logLevel<=le.ERROR){const n=e.map(Ri);bi.error(`Firestore (${Ii}): ${t}`,...n)}}function Ni(t,...e){if(bi.logLevel<=le.WARN){const n=e.map(Ri);bi.warn(`Firestore (${Ii}): ${t}`,...n)}}function Ri(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
479
+ */class Pt{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Lt{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(vt.UNAUTHENTICATED))}shutdown(){}}class Mt{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 xt{constructor(e){this.t=e,this.currentUser=vt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){kt(void 0===this.o,42304);let n=this.i;const r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let s=new Dt;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Dt,e.enqueueRetryable(()=>r(this.currentUser))};const i=()=>{const t=s;e.enqueueRetryable(async()=>{await t.promise,await r(this.currentUser)})},o=e=>{Et("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),i())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){const e=this.t.getImmediate({optional:!0});e?o(e):(Et("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Dt)}},0),i()}getToken(){const e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(Et("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(kt("string"==typeof t.accessToken,31837,{l:t}),new Pt(t.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return kt(null===e||"string"==typeof e,2055,{h:e}),new vt(e)}}class Ut{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=vt.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);const e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Ft{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new Ut(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(vt.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Vt{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 jt{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Be(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){kt(void 0===this.o,3512);const n=e=>{null!=e.error&&Et("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);const n=e.token!==this.m;return this.m=e.token,Et("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};const r=e=>{Et("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>r(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?r(e):Et("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Vt(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(kt("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Vt(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}
447
480
  /**
448
481
  * @license
449
482
  * Copyright 2020 Google LLC
@@ -459,7 +492,23 @@ let Ii="9.15.0";
459
492
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
460
493
  * See the License for the specific language governing permissions and
461
494
  * limitations under the License.
462
- */var e}
495
+ */function Bt(e){const t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(e);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let t=0;t<e;t++)n[t]=Math.floor(256*Math.random());return n}
496
+ /**
497
+ * @license
498
+ * Copyright 2023 Google LLC
499
+ *
500
+ * Licensed under the Apache License, Version 2.0 (the "License");
501
+ * you may not use this file except in compliance with the License.
502
+ * You may obtain a copy of the License at
503
+ *
504
+ * http://www.apache.org/licenses/LICENSE-2.0
505
+ *
506
+ * Unless required by applicable law or agreed to in writing, software
507
+ * distributed under the License is distributed on an "AS IS" BASIS,
508
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
509
+ * See the License for the specific language governing permissions and
510
+ * limitations under the License.
511
+ */function Ht(){return new TextEncoder}
463
512
  /**
464
513
  * @license
465
514
  * Copyright 2017 Google LLC
@@ -475,7 +524,7 @@ let Ii="9.15.0";
475
524
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
476
525
  * See the License for the specific language governing permissions and
477
526
  * limitations under the License.
478
- */function Oi(t="Unexpected state"){const e=`FIRESTORE (${Ii}) INTERNAL ASSERTION FAILED: `+t;throw ki(e),new Error(e)}function Di(t,e){t||Oi()}function Li(t,e){return t}
527
+ */class $t{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=Bt(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function zt(e,t){return e<t?-1:e>t?1:0}function qt(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=e.codePointAt(n),s=t.codePointAt(n);if(r!==s){if(r<128&&s<128)return zt(r,s);{const i=Ht(),o=Kt(i.encode(Gt(e,n)),i.encode(Gt(t,n)));return 0!==o?o:zt(r,s)}}n+=r>65535?2:1}return zt(e.length,t.length)}function Gt(e,t){return e.codePointAt(t)>65535?e.substring(t,t+2):e.substring(t,t+1)}function Kt(e,t){for(let n=0;n<e.length&&n<t.length;++n)if(e[n]!==t[n])return zt(e[n],t[n]);return zt(e.length,t.length)}function Wt(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}
479
528
  /**
480
529
  * @license
481
530
  * Copyright 2017 Google LLC
@@ -491,7 +540,7 @@ let Ii="9.15.0";
491
540
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
492
541
  * See the License for the specific language governing permissions and
493
542
  * limitations under the License.
494
- */const Pi={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 Mi extends oe{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
543
+ */const Qt="__name__";class Jt{constructor(e,t,n){void 0===t?t=0:t>e.length&&At(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&At(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===Jt.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Jt?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=Jt.compareSegments(e.get(r),t.get(r));if(0!==n)return n}return zt(e.length,t.length)}static compareSegments(e,t){const n=Jt.isNumericId(e),r=Jt.isNumericId(t);return n&&!r?-1:!n&&r?1:n&&r?Jt.extractNumericId(e).compare(Jt.extractNumericId(t)):qt(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return st.fromString(e.substring(4,e.length-2))}}class Yt extends Jt{construct(e,t,n){return new Yt(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new Nt(Ot.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new Yt(t)}static emptyPath(){return new Yt([])}}const Xt=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Zt extends Jt{construct(e,t,n){return new Zt(e,t,n)}static isValidIdentifier(e){return Xt.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Zt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Qt}static keyField(){return new Zt([Qt])}static fromServerFormat(e){const t=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Nt(Ot.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let i=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new Nt(Ot.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new Nt(Ot.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?(i=!i,r++):"."!==t||i?(n+=t,r++):(s(),r++)}if(s(),i)throw new Nt(Ot.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Zt(t)}static emptyPath(){return new Zt([])}}
495
544
  /**
496
545
  * @license
497
546
  * Copyright 2017 Google LLC
@@ -507,7 +556,7 @@ let Ii="9.15.0";
507
556
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508
557
  * See the License for the specific language governing permissions and
509
558
  * limitations under the License.
510
- */class xi{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
559
+ */class en{constructor(e){this.path=e}static fromPath(e){return new en(Yt.fromString(e))}static fromName(e){return new en(Yt.fromString(e).popFirst(5))}static empty(){return new en(Yt.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(e){return this.path.length>=2&&this.path.get(this.path.length-2)===e}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(e){return null!==e&&0===Yt.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return Yt.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new en(new Yt(e.slice()))}}
511
560
  /**
512
561
  * @license
513
562
  * Copyright 2017 Google LLC
@@ -523,10 +572,10 @@ let Ii="9.15.0";
523
572
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
524
573
  * See the License for the specific language governing permissions and
525
574
  * limitations under the License.
526
- */class Ui{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Fi{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(Si.UNAUTHENTICATED)))}shutdown(){}}class Vi{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Bi{constructor(t){this.t=t,this.currentUser=Si.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let s=new xi;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new xi,t.enqueueRetryable((()=>r(this.currentUser)))};const i=()=>{const e=s;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Ci("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),i()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Ci("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new xi)}}),0),i()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Ci("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Di("string"==typeof e.accessToken),new Ui(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Di(null===t||"string"==typeof t),new Si(t)}}class Hi{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=Si.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Di(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class ji{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new Hi(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(Si.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class $i{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class qi{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Ci("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Ci("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Ci("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Ci("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Di("string"==typeof t.token),this.A=t.token,new $i(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
575
+ */function tn(e,t,n){if(!n)throw new Nt(Ot.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function nn(e){if(!en.isDocumentKey(e))throw new Nt(Ot.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function rn(e){if(en.isDocumentKey(e))throw new Nt(Ot.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function sn(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function on(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":At(12329,{type:typeof e})}function an(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Nt(Ot.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=on(e);throw new Nt(Ot.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}
527
576
  /**
528
577
  * @license
529
- * Copyright 2020 Google LLC
578
+ * Copyright 2025 Google LLC
530
579
  *
531
580
  * Licensed under the Apache License, Version 2.0 (the "License");
532
581
  * you may not use this file except in compliance with the License.
@@ -539,7 +588,7 @@ let Ii="9.15.0";
539
588
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
540
589
  * See the License for the specific language governing permissions and
541
590
  * limitations under the License.
542
- */function Ki(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
591
+ */function cn(e,t){const n={typeString:e};return t&&(n.value=t),n}function un(e,t){if(!sn(e))throw new Nt(Ot.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in t)if(t[r]){const s=t[r].typeString,i="value"in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}const o=e[r];if(s&&typeof o!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(void 0!==i&&o!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new Nt(Ot.INVALID_ARGUMENT,n);return!0}
543
592
  /**
544
593
  * @license
545
594
  * Copyright 2017 Google LLC
@@ -555,7 +604,7 @@ let Ii="9.15.0";
555
604
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
556
605
  * See the License for the specific language governing permissions and
557
606
  * limitations under the License.
558
- */class Wi{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=Ki(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%62))}return n}}function zi(t,e){return t<e?-1:t>e?1:0}function Gi(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
607
+ */const hn=-62135596800,ln=1e6;class dn{static now(){return dn.fromMillis(Date.now())}static fromDate(e){return dn.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*ln);return new dn(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new Nt(Ot.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new Nt(Ot.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<hn)throw new Nt(Ot.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Nt(Ot.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/ln}_compareTo(e){return this.seconds===e.seconds?zt(this.nanoseconds,e.nanoseconds):zt(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{type:dn._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(un(e,dn._jsonSchema))return new dn(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-hn;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}dn._jsonSchemaVersion="firestore/timestamp/1.0",dn._jsonSchema={type:cn("string",dn._jsonSchemaVersion),seconds:cn("number"),nanoseconds:cn("number")};
559
608
  /**
560
609
  * @license
561
610
  * Copyright 2017 Google LLC
@@ -571,10 +620,11 @@ let Ii="9.15.0";
571
620
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
572
621
  * See the License for the specific language governing permissions and
573
622
  * limitations under the License.
574
- */class Qi{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Qi.fromMillis(Date.now())}static fromDate(t){return Qi.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Qi(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?zi(this.nanoseconds,t.nanoseconds):zi(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
623
+ */
624
+ class fn{static fromTimestamp(e){return new fn(e)}static min(){return new fn(new dn(0,0))}static max(){return new fn(new dn(253402300799,999999999))}constructor(e){this.timestamp=e}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}}
575
625
  /**
576
626
  * @license
577
- * Copyright 2017 Google LLC
627
+ * Copyright 2021 Google LLC
578
628
  *
579
629
  * Licensed under the Apache License, Version 2.0 (the "License");
580
630
  * you may not use this file except in compliance with the License.
@@ -587,10 +637,10 @@ let Ii="9.15.0";
587
637
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
588
638
  * See the License for the specific language governing permissions and
589
639
  * limitations under the License.
590
- */class Yi{constructor(t){this.timestamp=t}static fromTimestamp(t){return new Yi(t)}static min(){return new Yi(new Qi(0,0))}static max(){return new Yi(new Qi(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
640
+ */function pn(e){return new gn(e.readTime,e.key,-1)}class gn{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new gn(fn.min(),en.empty(),-1)}static max(){return new gn(fn.max(),en.empty(),-1)}}function mn(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=en.comparator(e.documentKey,t.documentKey),0!==n?n:zt(e.largestBatchId,t.largestBatchId)
591
641
  /**
592
642
  * @license
593
- * Copyright 2017 Google LLC
643
+ * Copyright 2020 Google LLC
594
644
  *
595
645
  * Licensed under the Apache License, Version 2.0 (the "License");
596
646
  * you may not use this file except in compliance with the License.
@@ -603,7 +653,7 @@ let Ii="9.15.0";
603
653
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
604
654
  * See the License for the specific language governing permissions and
605
655
  * limitations under the License.
606
- */class Ji{constructor(t,e,n){void 0===e?e=0:e>t.length&&Oi(),void 0===n?n=t.length-e:n>t.length-e&&Oi(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Ji.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Ji?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),s=e.get(r);if(n<s)return-1;if(n>s)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class Xi extends Ji{construct(t,e,n){return new Xi(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Xi(e)}static emptyPath(){return new Xi([])}}const Zi=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class to extends Ji{construct(t,e,n){return new to(t,e,n)}static isValidIdentifier(t){return Zi.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),to.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new to(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let i=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Mi(Pi.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Mi(Pi.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(i=!i,r++):"."!==e||i?(n+=e,r++):(s(),r++)}if(s(),i)throw new Mi(Pi.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new to(e)}static emptyPath(){return new to([])}}
656
+ */)}class yn{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}
607
657
  /**
608
658
  * @license
609
659
  * Copyright 2017 Google LLC
@@ -619,10 +669,10 @@ let Ii="9.15.0";
619
669
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
620
670
  * See the License for the specific language governing permissions and
621
671
  * limitations under the License.
622
- */class eo{constructor(t){this.path=t}static fromPath(t){return new eo(Xi.fromString(t))}static fromName(t){return new eo(Xi.fromString(t).popFirst(5))}static empty(){return new eo(Xi.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Xi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Xi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new eo(new Xi(t.slice()))}}function no(t){return new ro(t.readTime,t.key,-1)}class ro{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ro(Yi.min(),eo.empty(),-1)}static max(){return new ro(Yi.max(),eo.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=eo.comparator(t.documentKey,e.documentKey),0!==n?n:zi(t.largestBatchId,e.largestBatchId)
672
+ */async function vn(e){if(e.code!==Ot.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;Et("LocalStore","Unexpectedly lost primary lease")}
623
673
  /**
624
674
  * @license
625
- * Copyright 2020 Google LLC
675
+ * Copyright 2017 Google LLC
626
676
  *
627
677
  * Licensed under the Apache License, Version 2.0 (the "License");
628
678
  * you may not use this file except in compliance with the License.
@@ -635,10 +685,10 @@ let Ii="9.15.0";
635
685
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
636
686
  * See the License for the specific language governing permissions and
637
687
  * limitations under the License.
638
- */)}const io="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class oo{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
688
+ */class _n{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&At(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new _n((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof _n?t:_n.resolve(t)}catch(e){return _n.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):_n.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):_n.reject(t)}static resolve(e){return new _n((t,n)=>{t(e)})}static reject(e){return new _n((t,n)=>{n(e)})}static waitFor(e){return new _n((t,n)=>{let r=0,s=0,i=!1;e.forEach(e=>{++r,e.next(()=>{++s,i&&s===r&&t()},e=>n(e))}),i=!0,s===r&&t()})}static or(e){let t=_n.resolve(!1);for(const n of e)t=t.next(e=>e?_n.resolve(e):n());return t}static forEach(e,t){const n=[];return e.forEach((e,r)=>{n.push(t.call(this,e,r))}),this.waitFor(n)}static mapArray(e,t){return new _n((n,r)=>{const s=e.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;t(e[c]).next(e=>{i[c]=e,++o,o===s&&n(i)},e=>r(e))}})}static doWhile(e,t){return new _n((n,r)=>{const s=()=>{!0===e()?t().next(()=>{s()},r):n()};s()})}}function wn(e){return"IndexedDbTransactionError"===e.name}
639
689
  /**
640
690
  * @license
641
- * Copyright 2017 Google LLC
691
+ * Copyright 2018 Google LLC
642
692
  *
643
693
  * Licensed under the Apache License, Version 2.0 (the "License");
644
694
  * you may not use this file except in compliance with the License.
@@ -651,7 +701,7 @@ let Ii="9.15.0";
651
701
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
652
702
  * See the License for the specific language governing permissions and
653
703
  * limitations under the License.
654
- */async function ao(t){if(t.code!==Pi.FAILED_PRECONDITION||t.message!==io)throw t;Ci("LocalStore","Unexpectedly lost primary lease")}
704
+ */class Tn{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this._e(e),this.ae=e=>t.writeSequenceNumber(e))}_e(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ae&&this.ae(e),e}}Tn.ue=-1;function En(e){return null==e}function Sn(e){return 0===e&&1/e==-1/0}function In(e,t){let n=t;const r=e.length;for(let t=0;t<r;t++){const r=e.charAt(t);switch(r){case"\0":n+="";break;case"":n+="";break;default:n+=r}}return n}function bn(e){return e+""}
655
705
  /**
656
706
  * @license
657
707
  * Copyright 2017 Google LLC
@@ -667,10 +717,10 @@ let Ii="9.15.0";
667
717
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
668
718
  * See the License for the specific language governing permissions and
669
719
  * limitations under the License.
670
- */class co{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Oi(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new co(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof co?e:co.resolve(e)}catch(t){return co.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):co.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):co.reject(e)}static resolve(t){return new co(((e,n)=>{e(t)}))}static reject(t){return new co(((e,n)=>{n(t)}))}static waitFor(t){return new co(((e,n)=>{let r=0,s=0,i=!1;t.forEach((t=>{++r,t.next((()=>{++s,i&&s===r&&e()}),(t=>n(t)))})),i=!0,s===r&&e()}))}static or(t){let e=co.resolve(!1);for(const n of t)e=e.next((t=>t?co.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new co(((n,r)=>{const s=t.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;e(t[c]).next((t=>{i[c]=t,++o,o===s&&n(i)}),(t=>r(t)))}}))}static doWhile(t,e){return new co(((n,r)=>{const s=()=>{!0===t()?e().next((()=>{s()}),r):n()};s()}))}}function uo(t){return"IndexedDbTransactionError"===t.name}
720
+ */function An(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function Cn(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function kn(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}
671
721
  /**
672
722
  * @license
673
- * Copyright 2018 Google LLC
723
+ * Copyright 2017 Google LLC
674
724
  *
675
725
  * Licensed under the Apache License, Version 2.0 (the "License");
676
726
  * you may not use this file except in compliance with the License.
@@ -683,7 +733,7 @@ let Ii="9.15.0";
683
733
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
684
734
  * See the License for the specific language governing permissions and
685
735
  * limitations under the License.
686
- */class ho{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}ho.at=-1;
736
+ */class Rn{constructor(e,t){this.comparator=e,this.root=t||Nn.EMPTY}insert(e,t){return new Rn(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,Nn.BLACK,null,null))}remove(e){return new Rn(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Nn.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,n)=>(e(t,n),!1))}toString(){const e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new On(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new On(this.root,e,this.comparator,!1)}getReverseIterator(){return new On(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new On(this.root,e,this.comparator,!0)}}class On{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&r&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(0===s){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class Nn{constructor(e,t,n,r,s){this.key=e,this.value=t,this.color=null!=n?n:Nn.RED,this.left=null!=r?r:Nn.EMPTY,this.right=null!=s?s:Nn.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,s){return new Nn(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const s=n(e,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===s?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return Nn.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return Nn.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,Nn.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,Nn.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw At(43730,{key:this.key,value:this.value});if(this.right.isRed())throw At(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw At(27949);return e+(this.isRed()?0:1)}}Nn.EMPTY=null,Nn.RED=!0,Nn.BLACK=!1,Nn.EMPTY=new class{constructor(){this.size=0}get key(){throw At(57766)}get value(){throw At(16141)}get color(){throw At(16727)}get left(){throw At(29726)}get right(){throw At(36894)}copy(e,t,n,r,s){return this}insert(e,t,n){return new Nn(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}};
687
737
  /**
688
738
  * @license
689
739
  * Copyright 2017 Google LLC
@@ -700,10 +750,10 @@ let Ii="9.15.0";
700
750
  * See the License for the specific language governing permissions and
701
751
  * limitations under the License.
702
752
  */
703
- class lo{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class fo{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new fo("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof fo&&t.projectId===this.projectId&&t.database===this.database}}
753
+ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Pn(this.data.getIterator())}getIteratorFrom(e){return new Pn(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof Dn))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new Dn(this.comparator);return t.data=e,t}}class Pn{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
704
754
  /**
705
755
  * @license
706
- * Copyright 2017 Google LLC
756
+ * Copyright 2020 Google LLC
707
757
  *
708
758
  * Licensed under the Apache License, Version 2.0 (the "License");
709
759
  * you may not use this file except in compliance with the License.
@@ -716,10 +766,10 @@ class lo{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
716
766
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717
767
  * See the License for the specific language governing permissions and
718
768
  * limitations under the License.
719
- */function po(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function go(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function mo(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
769
+ */class Ln{constructor(e){this.fields=e,e.sort(Zt.comparator)}static empty(){return new Ln([])}unionWith(e){let t=new Dn(Zt.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new Ln(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Wt(this.fields,e.fields,(e,t)=>e.isEqual(t))}}
720
770
  /**
721
771
  * @license
722
- * Copyright 2017 Google LLC
772
+ * Copyright 2023 Google LLC
723
773
  *
724
774
  * Licensed under the Apache License, Version 2.0 (the "License");
725
775
  * you may not use this file except in compliance with the License.
@@ -732,7 +782,7 @@ class lo{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
732
782
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
733
783
  * See the License for the specific language governing permissions and
734
784
  * limitations under the License.
735
- */function yo(t){return null==t}function vo(t){return 0===t&&1/t==-1/0}
785
+ */class Mn extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}
736
786
  /**
737
787
  * @license
738
788
  * Copyright 2020 Google LLC
@@ -748,8 +798,7 @@ class lo{constructor(t,e,n,r,s,i,o,a){this.databaseId=t,this.appId=e,this.persis
748
798
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
749
799
  * See the License for the specific language governing permissions and
750
800
  * limitations under the License.
751
- */
752
- class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new wo(e)}static fromUint8Array(t){const e=function(t){let e="";for(let n=0;n<t.length;++n)e+=String.fromCharCode(t[n]);return e}(t);return new wo(e)}[Symbol.iterator](){let t=0;return{next:()=>t<this.binaryString.length?{value:this.binaryString.charCodeAt(t++),done:!1}:{value:void 0,done:!0}}}toBase64(){return t=this.binaryString,btoa(t);var t}toUint8Array(){return function(t){const e=new Uint8Array(t.length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}
801
+ */class xn{constructor(e){this.binaryString=e}static fromBase64String(e){const t=function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new Mn("Invalid base64 string: "+e):e}}(e);return new xn(t)}static fromUint8Array(e){const t=function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e);return new xn(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return e=this.binaryString,btoa(e);var e}toUint8Array(){return function(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}
753
802
  /**
754
803
  * @license
755
804
  * Copyright 2020 Google LLC
@@ -765,7 +814,7 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
765
814
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
766
815
  * See the License for the specific language governing permissions and
767
816
  * limitations under the License.
768
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return zi(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}wo.EMPTY_BYTE_STRING=new wo("");const _o=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function To(t){if(Di(!!t),"string"==typeof t){let e=0;const n=_o.exec(t);if(Di(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Eo(t.seconds),nanos:Eo(t.nanos)}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function So(t){return"string"==typeof t?wo.fromBase64String(t):wo.fromUint8Array(t)}
817
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return zt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}xn.EMPTY_BYTE_STRING=new xn("");const Un=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Fn(e){if(kt(!!e,39018),"string"==typeof e){let t=0;const n=Un.exec(e);if(kt(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const r=new Date(e);return{seconds:Math.floor(r.getTime()/1e3),nanos:t}}return{seconds:Vn(e.seconds),nanos:Vn(e.nanos)}}function Vn(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function jn(e){return"string"==typeof e?xn.fromBase64String(e):xn.fromUint8Array(e)}
769
818
  /**
770
819
  * @license
771
820
  * Copyright 2020 Google LLC
@@ -781,7 +830,23 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
781
830
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
782
831
  * See the License for the specific language governing permissions and
783
832
  * limitations under the License.
784
- */function Io(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function bo(t){const e=t.mapValue.fields.__previous_value__;return Io(e)?bo(e):e}function Ao(t){const e=To(t.mapValue.fields.__local_write_time__.timestampValue);return new Qi(e.seconds,e.nanos)}
833
+ */const Bn="server_timestamp",Hn="__type__",$n="__previous_value__",zn="__local_write_time__";function qn(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Hn])||void 0===n?void 0:n.stringValue)===Bn}function Gn(e){const t=e.mapValue.fields[$n];return qn(t)?Gn(t):t}function Kn(e){const t=Fn(e.mapValue.fields[zn].timestampValue);return new dn(t.seconds,t.nanos)}
834
+ /**
835
+ * @license
836
+ * Copyright 2017 Google LLC
837
+ *
838
+ * Licensed under the Apache License, Version 2.0 (the "License");
839
+ * you may not use this file except in compliance with the License.
840
+ * You may obtain a copy of the License at
841
+ *
842
+ * http://www.apache.org/licenses/LICENSE-2.0
843
+ *
844
+ * Unless required by applicable law or agreed to in writing, software
845
+ * distributed under the License is distributed on an "AS IS" BASIS,
846
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
847
+ * See the License for the specific language governing permissions and
848
+ * limitations under the License.
849
+ */class Wn{constructor(e,t,n,r,s,i,o,a,c,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=s,this.forceLongPolling=i,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=c,this.isUsingEmulator=u}}const Qn="(default)";class Jn{constructor(e,t){this.projectId=e,this.database=t||Qn}static empty(){return new Jn("","")}get isDefaultDatabase(){return this.database===Qn}isEqual(e){return e instanceof Jn&&e.projectId===this.projectId&&e.database===this.database}}
785
850
  /**
786
851
  * @license
787
852
  * Copyright 2020 Google LLC
@@ -797,10 +862,10 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
797
862
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
798
863
  * See the License for the specific language governing permissions and
799
864
  * limitations under the License.
800
- */const Co={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function ko(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?Io(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
865
+ */const Yn="__type__",Xn="__max__",Zn={},er="__vector__",tr="value";function nr(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?qn(e)?4:function(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===Xn}
801
866
  /**
802
867
  * @license
803
- * Copyright 2022 Google LLC
868
+ * Copyright 2017 Google LLC
804
869
  *
805
870
  * Licensed under the Apache License, Version 2.0 (the "License");
806
871
  * you may not use this file except in compliance with the License.
@@ -813,10 +878,10 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
813
878
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814
879
  * See the License for the specific language governing permissions and
815
880
  * limitations under the License.
816
- */(t)?9007199254740991:10:Oi()}function No(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ao(t).isEqual(Ao(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=To(t.timestampValue),r=To(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return So(t.bytesValue).isEqual(So(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Eo(t.geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Eo(t.doubleValue),r=Eo(e.doubleValue);return n===r?vo(n)===vo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Gi(t.arrayValue.values||[],e.arrayValue.values||[],No);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(po(n)!==po(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!No(n[t],r[t])))return!1;return!0}(t,e);default:return Oi()}}function Ro(t,e){return void 0!==(t.values||[]).find((t=>No(t,e)))}function Oo(t,e){if(t===e)return 0;const n=ko(t),r=ko(e);if(n!==r)return zi(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return zi(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Eo(t.integerValue||t.doubleValue),r=Eo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Do(t.timestampValue,e.timestampValue);case 4:return Do(Ao(t),Ao(e));case 5:return zi(t.stringValue,e.stringValue);case 6:return function(t,e){const n=So(t),r=So(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=zi(n[t],r[t]);if(0!==e)return e}return zi(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=zi(Eo(t.latitude),Eo(e.latitude));return 0!==n?n:zi(Eo(t.longitude),Eo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Oo(n[t],r[t]);if(e)return e}return zi(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Co.mapValue&&e===Co.mapValue)return 0;if(t===Co.mapValue)return 1;if(e===Co.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=zi(r[t],i[t]);if(0!==e)return e;const o=Oo(n[r[t]],s[i[t]]);if(0!==o)return o}return zi(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Oi()}}function Do(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return zi(t,e);const n=To(t),r=To(e),s=zi(n.seconds,r.seconds);return 0!==s?s:zi(n.nanos,r.nanos)}function Lo(t){return Po(t)}function Po(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=To(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?So(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,eo.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Po(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Po(t.fields[s])}`;return n+"}"}(t.mapValue):Oi();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function xo(t){return!!t&&"integerValue"in t}function Uo(t){return!!t&&"arrayValue"in t}function Fo(t){return!!t&&"nullValue"in t}function Vo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Bo(t){return!!t&&"mapValue"in t}function Ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return go(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function $o(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?eo.comparator(eo.fromName(o.referenceValue),n.key):Oo(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function qo(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!No(t.position[n],e.position[n]))return!1;return!0}
881
+ */(e)?9007199254740991:function(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Yn])||void 0===n?void 0:n.stringValue)===er}(e)?10:11:At(28295,{value:e})}function rr(e,t){if(e===t)return!0;const n=nr(e);if(n!==nr(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Kn(e).isEqual(Kn(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=Fn(e.timestampValue),r=Fn(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return jn(e.bytesValue).isEqual(jn(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Vn(e.geoPointValue.latitude)===Vn(t.geoPointValue.latitude)&&Vn(e.geoPointValue.longitude)===Vn(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Vn(e.integerValue)===Vn(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Vn(e.doubleValue),r=Vn(t.doubleValue);return n===r?Sn(n)===Sn(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Wt(e.arrayValue.values||[],t.arrayValue.values||[],rr);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(An(n)!==An(r))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===r[e]||!rr(n[e],r[e])))return!1;return!0}(e,t);default:return At(52216,{left:e})}}function sr(e,t){return void 0!==(e.values||[]).find(e=>rr(e,t))}function ir(e,t){if(e===t)return 0;const n=nr(e),r=nr(t);if(n!==r)return zt(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return zt(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Vn(e.integerValue||e.doubleValue),r=Vn(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return or(e.timestampValue,t.timestampValue);case 4:return or(Kn(e),Kn(t));case 5:return qt(e.stringValue,t.stringValue);case 6:return function(e,t){const n=jn(e),r=jn(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let e=0;e<n.length&&e<r.length;e++){const t=zt(n[e],r[e]);if(0!==t)return t}return zt(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=zt(Vn(e.latitude),Vn(t.latitude));return 0!==n?n:zt(Vn(e.longitude),Vn(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ar(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,r,s,i;const o=e.fields||{},a=t.fields||{},c=null===(n=o[tr])||void 0===n?void 0:n.arrayValue,u=null===(r=a[tr])||void 0===r?void 0:r.arrayValue,h=zt((null===(s=null==c?void 0:c.values)||void 0===s?void 0:s.length)||0,(null===(i=null==u?void 0:u.values)||void 0===i?void 0:i.length)||0);return 0!==h?h:ar(c,u)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Zn&&t===Zn)return 0;if(e===Zn)return 1;if(t===Zn)return-1;const n=e.fields||{},r=Object.keys(n),s=t.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let e=0;e<r.length&&e<i.length;++e){const t=qt(r[e],i[e]);if(0!==t)return t;const o=ir(n[r[e]],s[i[e]]);if(0!==o)return o}return zt(r.length,i.length)}(e.mapValue,t.mapValue);default:throw At(23264,{le:n})}}function or(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return zt(e,t);const n=Fn(e),r=Fn(t),s=zt(n.seconds,r.seconds);return 0!==s?s:zt(n.nanos,r.nanos)}function ar(e,t){const n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){const t=ir(n[e],r[e]);if(t)return t}return zt(n.length,r.length)}function cr(e){return ur(e)}function ur(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=Fn(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return jn(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return en.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const r of e.values||[])n?n=!1:t+=",",t+=ur(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",r=!0;for(const s of t)r?r=!1:n+=",",n+=`${s}:${ur(e.fields[s])}`;return n+"}"}(e.mapValue):At(61005,{value:e})}function hr(e){switch(nr(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Gn(e);return t?16+hr(t):16;case 5:return 2*e.stringValue.length;case 6:return jn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+hr(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return Cn(e.fields,(e,n)=>{t+=e.length+hr(n)}),t}(e.mapValue);default:throw At(13486,{value:e})}}function lr(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function dr(e){return!!e&&"integerValue"in e}function fr(e){return!!e&&"arrayValue"in e}function pr(e){return!!e&&"nullValue"in e}function gr(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function mr(e){return!!e&&"mapValue"in e}function yr(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return Cn(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=yr(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=yr(e.arrayValue.values[n]);return t}return Object.assign({},e)}class vr{constructor(e){this.value=e}static empty(){return new vr({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!mr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=yr(t)}setAll(e){let t=Zt.emptyPath(),n={},r=[];e.forEach((e,s)=>{if(!t.isImmediateParentOf(s)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=s.popLast()}e?n[s.lastSegment()]=yr(e):r.push(s.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,n,r)}delete(e){const t=this.field(e.popLast());mr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return rr(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];mr(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){Cn(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new vr(yr(this.value))}}function _r(e){const t=[];return Cn(e.fields,(e,n)=>{const r=new Zt([e]);if(mr(n)){const e=_r(n.mapValue).fields;if(0===e.length)t.push(r);else for(const n of e)t.push(r.child(n))}else t.push(r)}),new Ln(t)
817
882
  /**
818
883
  * @license
819
- * Copyright 2022 Google LLC
884
+ * Copyright 2017 Google LLC
820
885
  *
821
886
  * Licensed under the Apache License, Version 2.0 (the "License");
822
887
  * you may not use this file except in compliance with the License.
@@ -829,7 +894,7 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
829
894
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830
895
  * See the License for the specific language governing permissions and
831
896
  * limitations under the License.
832
- */class Ko{}class Wo extends Ko{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Zo(t,e,n):"array-contains"===e?new ra(t,n):"in"===e?new sa(t,n):"not-in"===e?new ia(t,n):"array-contains-any"===e?new oa(t,n):new Wo(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ta(t,n):new ea(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Oo(e,this.value)):null!==e&&ko(this.value)===ko(e)&&this.matchesComparison(Oo(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Oi()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class zo extends Ko{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new zo(t,e)}matches(t){return Go(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Go(t){return"and"===t.op}function Qo(t){return function(t){for(const e of t.filters)if(e instanceof zo)return!1;return!0}(t)&&Go(t)}function Yo(t){if(t instanceof Wo)return t.field.canonicalString()+t.op.toString()+Lo(t.value);{const e=t.filters.map((t=>Yo(t))).join(",");return`${t.op}(${e})`}}function Jo(t,e){return t instanceof Wo?function(t,e){return e instanceof Wo&&t.op===e.op&&t.field.isEqual(e.field)&&No(t.value,e.value)}(t,e):t instanceof zo?function(t,e){return e instanceof zo&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Jo(n,e.filters[r])),!0)}(t,e):void Oi()}function Xo(t){return t instanceof Wo?function(t){return`${t.field.canonicalString()} ${t.op} ${Lo(t.value)}`}(t):t instanceof zo?function(t){return t.op.toString()+" {"+t.getFilters().map(Xo).join(" ,")+"}"}(t):"Filter"}class Zo extends Wo{constructor(t,e,n){super(t,e,n),this.key=eo.fromName(n.referenceValue)}matches(t){const e=eo.comparator(t.key,this.key);return this.matchesComparison(e)}}class ta extends Wo{constructor(t,e){super(t,"in",e),this.keys=na("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class ea extends Wo{constructor(t,e){super(t,"not-in",e),this.keys=na("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function na(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>eo.fromName(t.referenceValue)))}class ra extends Wo{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Uo(e)&&Ro(e.arrayValue,this.value)}}class sa extends Wo{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Ro(this.value.arrayValue,e)}}class ia extends Wo{constructor(t,e){super(t,"not-in",e)}matches(t){if(Ro(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Ro(this.value.arrayValue,e)}}class oa extends Wo{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Uo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Ro(this.value.arrayValue,t)))}}
897
+ */}class wr{constructor(e,t,n,r,s,i,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(e){return new wr(e,0,fn.min(),fn.min(),fn.min(),vr.empty(),0)}static newFoundDocument(e,t,n,r){return new wr(e,1,t,fn.min(),n,r,0)}static newNoDocument(e,t){return new wr(e,2,t,fn.min(),fn.min(),vr.empty(),0)}static newUnknownDocument(e,t){return new wr(e,3,t,fn.min(),fn.min(),vr.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(fn.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=vr.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=vr.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=fn.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof wr&&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 wr(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}})`}}
833
898
  /**
834
899
  * @license
835
900
  * Copyright 2022 Google LLC
@@ -845,10 +910,10 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
845
910
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
846
911
  * See the License for the specific language governing permissions and
847
912
  * limitations under the License.
848
- */class aa{constructor(t,e="asc"){this.field=t,this.dir=e}}function ca(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
913
+ */class Tr{constructor(e,t){this.position=e,this.inclusive=t}}function Er(e,t,n){let r=0;for(let s=0;s<e.position.length;s++){const i=t[s],o=e.position[s];if(r=i.field.isKeyField()?en.comparator(en.fromName(o.referenceValue),n.key):ir(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function Sr(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!rr(e.position[n],t.position[n]))return!1;return!0}
849
914
  /**
850
915
  * @license
851
- * Copyright 2017 Google LLC
916
+ * Copyright 2022 Google LLC
852
917
  *
853
918
  * Licensed under the Apache License, Version 2.0 (the "License");
854
919
  * you may not use this file except in compliance with the License.
@@ -861,10 +926,10 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
861
926
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
862
927
  * See the License for the specific language governing permissions and
863
928
  * limitations under the License.
864
- */class ua{constructor(t,e){this.comparator=t,this.root=e||la.EMPTY}insert(t,e){return new ua(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,la.BLACK,null,null))}remove(t){return new ua(this.comparator,this.root.remove(t,this.comparator).copy(null,null,la.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new ha(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ha(this.root,t,this.comparator,!1)}getReverseIterator(){return new ha(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ha(this.root,t,this.comparator,!0)}}class ha{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!t.isEmpty();)if(s=e?n(t.key,e):1,e&&r&&(s*=-1),s<0)t=this.isReverse?t.left:t.right;else{if(0===s){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class la{constructor(t,e,n,r,s){this.key=t,this.value=e,this.color=null!=n?n:la.RED,this.left=null!=r?r:la.EMPTY,this.right=null!=s?s:la.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,s){return new la(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const s=n(t,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===s?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return la.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return la.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,la.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,la.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Oi();if(this.right.isRed())throw Oi();const t=this.left.check();if(t!==this.right.check())throw Oi();return t+(this.isRed()?0:1)}}la.EMPTY=null,la.RED=!0,la.BLACK=!1,la.EMPTY=new class{constructor(){this.size=0}get key(){throw Oi()}get value(){throw Oi()}get color(){throw Oi()}get left(){throw Oi()}get right(){throw Oi()}copy(t,e,n,r,s){return this}insert(t,e,n){return new la(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
929
+ */class Ir{constructor(e,t="asc"){this.field=e,this.dir=t}}function br(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}
865
930
  /**
866
931
  * @license
867
- * Copyright 2017 Google LLC
932
+ * Copyright 2022 Google LLC
868
933
  *
869
934
  * Licensed under the Apache License, Version 2.0 (the "License");
870
935
  * you may not use this file except in compliance with the License.
@@ -877,11 +942,10 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
877
942
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
878
943
  * See the License for the specific language governing permissions and
879
944
  * limitations under the License.
880
- */
881
- class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new fa(this.data.getIterator())}getIteratorFrom(t){return new fa(this.data.getIteratorFrom(t))}add(t){return this.copy(this.data.remove(t).insert(t,!0))}delete(t){return this.has(t)?this.copy(this.data.remove(t)):this}isEmpty(){return this.data.isEmpty()}unionWith(t){let e=this;return e.size<t.size&&(e=t,t=this),t.forEach((t=>{e=e.add(t)})),e}isEqual(t){if(!(t instanceof da))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new da(this.comparator);return e.data=t,e}}class fa{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
945
+ */class Ar{}class Cr extends Ar{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new Lr(e,t,n):"array-contains"===t?new Fr(e,n):"in"===t?new Vr(e,n):"not-in"===t?new jr(e,n):"array-contains-any"===t?new Br(e,n):new Cr(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Mr(e,n):new xr(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(ir(t,this.value)):null!==t&&nr(this.value)===nr(t)&&this.matchesComparison(ir(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return At(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class kr extends Ar{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new kr(e,t)}matches(e){return Rr(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.he||(this.he=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}}function Rr(e){return"and"===e.op}function Or(e){return function(e){for(const t of e.filters)if(t instanceof kr)return!1;return!0}(e)&&Rr(e)}function Nr(e){if(e instanceof Cr)return e.field.canonicalString()+e.op.toString()+cr(e.value);if(Or(e))return e.filters.map(e=>Nr(e)).join(",");{const t=e.filters.map(e=>Nr(e)).join(",");return`${e.op}(${t})`}}function Dr(e,t){return e instanceof Cr?function(e,t){return t instanceof Cr&&e.op===t.op&&e.field.isEqual(t.field)&&rr(e.value,t.value)}(e,t):e instanceof kr?function(e,t){return t instanceof kr&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,r)=>e&&Dr(n,t.filters[r]),!0)}(e,t):void At(19439)}function Pr(e){return e instanceof Cr?function(e){return`${e.field.canonicalString()} ${e.op} ${cr(e.value)}`}(e):e instanceof kr?function(e){return e.op.toString()+" {"+e.getFilters().map(Pr).join(" ,")+"}"}(e):"Filter"}class Lr extends Cr{constructor(e,t,n){super(e,t,n),this.key=en.fromName(n.referenceValue)}matches(e){const t=en.comparator(e.key,this.key);return this.matchesComparison(t)}}class Mr extends Cr{constructor(e,t){super(e,"in",t),this.keys=Ur("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class xr extends Cr{constructor(e,t){super(e,"not-in",t),this.keys=Ur("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Ur(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>en.fromName(e.referenceValue))}class Fr extends Cr{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return fr(t)&&sr(t.arrayValue,this.value)}}class Vr extends Cr{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&sr(this.value.arrayValue,t)}}class jr extends Cr{constructor(e,t){super(e,"not-in",t)}matches(e){if(sr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!sr(this.value.arrayValue,t)}}class Br extends Cr{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!fr(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>sr(this.value.arrayValue,e))}}
882
946
  /**
883
947
  * @license
884
- * Copyright 2020 Google LLC
948
+ * Copyright 2019 Google LLC
885
949
  *
886
950
  * Licensed under the Apache License, Version 2.0 (the "License");
887
951
  * you may not use this file except in compliance with the License.
@@ -894,7 +958,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
894
958
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
895
959
  * See the License for the specific language governing permissions and
896
960
  * limitations under the License.
897
- */class pa{constructor(t){this.fields=t,t.sort(to.comparator)}static empty(){return new pa([])}unionWith(t){let e=new da(to.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new pa(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Gi(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
961
+ */class Hr{constructor(e,t=null,n=[],r=[],s=null,i=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.Pe=null}}function $r(e,t=null,n=[],r=[],s=null,i=null,o=null){return new Hr(e,t,n,r,s,i,o)}function zr(e){const t=Rt(e);if(null===t.Pe){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>Nr(e)).join(","),e+="|ob:",e+=t.orderBy.map(e=>function(e){return e.field.canonicalString()+e.dir}(e)).join(","),En(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(e=>cr(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>cr(e)).join(",")),t.Pe=e}return t.Pe}function qr(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!br(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Dr(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Sr(e.startAt,t.startAt)&&Sr(e.endAt,t.endAt)}function Gr(e){return en.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}
898
962
  /**
899
963
  * @license
900
964
  * Copyright 2017 Google LLC
@@ -910,7 +974,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
910
974
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
911
975
  * See the License for the specific language governing permissions and
912
976
  * limitations under the License.
913
- */class ga{constructor(t){this.value=t}static empty(){return new ga({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Bo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=Ho(e)}setAll(t){let e=to.emptyPath(),n={},r=[];t.forEach(((t,s)=>{if(!e.isImmediateParentOf(s)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=s.popLast()}t?n[s.lastSegment()]=Ho(t):r.push(s.lastSegment())}));const s=this.getFieldsMap(e);this.applyChanges(s,n,r)}delete(t){const e=this.field(t.popLast());Bo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return No(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Bo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){go(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new ga(Ho(this.value))}}function ma(t){const e=[];return go(t.fields,((t,n)=>{const r=new to([t]);if(Bo(n)){const t=ma(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new pa(e)
977
+ */class Kr{constructor(e,t=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}}function Wr(e){return new Kr(e)}function Qr(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Jr(e){return null!==e.collectionGroup}function Yr(e){const t=Rt(e);if(null===t.Te){t.Te=[];const e=new Set;for(const n of t.explicitOrderBy)t.Te.push(n),e.add(n.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",r=function(e){let t=new Dn(Zt.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t}(t);r.forEach(r=>{e.has(r.canonicalString())||r.isKeyField()||t.Te.push(new Ir(r,n))}),e.has(Zt.keyField().canonicalString())||t.Te.push(new Ir(Zt.keyField(),n))}return t.Te}function Xr(e){const t=Rt(e);return t.Ie||(t.Ie=function(e,t){if("F"===e.limitType)return $r(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{const t="desc"===e.dir?"asc":"desc";return new Ir(e.field,t)});const n=e.endAt?new Tr(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Tr(e.startAt.position,e.startAt.inclusive):null;return $r(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}(t,Yr(e))),t.Ie}function Zr(e,t){const n=e.filters.concat([t]);return new Kr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function es(e,t,n){return new Kr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function ts(e,t){return qr(Xr(e),Xr(t))&&e.limitType===t.limitType}function ns(e){return`${zr(Xr(e))}|lt:${e.limitType}`}function rs(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map(e=>Pr(e)).join(", ")}]`),En(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map(e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e)).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>cr(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>cr(e)).join(",")),`Target(${t})`}(Xr(e))}; limitType=${e.limitType})`}function ss(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):en.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Yr(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=Er(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Yr(e),t))&&!(e.endAt&&!function(e,t,n){const r=Er(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Yr(e),t))}(e,t)}function is(e){return(t,n)=>{let r=!1;for(const s of Yr(e)){const e=os(s,t,n);if(0!==e)return e;r=r||s.field.isKeyField()}return 0}}function os(e,t,n){const r=e.field.isKeyField()?en.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),s=n.data.field(e);return null!==r&&null!==s?ir(r,s):At(42886)}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return At(19790,{direction:e.dir})}}
914
978
  /**
915
979
  * @license
916
980
  * Copyright 2017 Google LLC
@@ -926,10 +990,10 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
926
990
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
927
991
  * See the License for the specific language governing permissions and
928
992
  * limitations under the License.
929
- */}class ya{constructor(t,e,n,r,s,i,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=s,this.data=i,this.documentState=o}static newInvalidDocument(t){return new ya(t,0,Yi.min(),Yi.min(),Yi.min(),ga.empty(),0)}static newFoundDocument(t,e,n,r){return new ya(t,1,e,Yi.min(),n,r,0)}static newNoDocument(t,e){return new ya(t,2,e,Yi.min(),Yi.min(),ga.empty(),0)}static newUnknownDocument(t,e){return new ya(t,3,e,Yi.min(),Yi.min(),ga.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Yi.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=ga.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=ga.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Yi.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof ya&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new ya(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}})`}}
993
+ */class as{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,r]of n)if(this.equalsFn(t,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){Cn(this.inner,(t,n)=>{for(const[t,r]of n)e(t,r)})}isEmpty(){return kn(this.inner)}size(){return this.innerSize}}
930
994
  /**
931
995
  * @license
932
- * Copyright 2019 Google LLC
996
+ * Copyright 2017 Google LLC
933
997
  *
934
998
  * Licensed under the Apache License, Version 2.0 (the "License");
935
999
  * you may not use this file except in compliance with the License.
@@ -942,10 +1006,10 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
942
1006
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
943
1007
  * See the License for the specific language governing permissions and
944
1008
  * limitations under the License.
945
- */class va{constructor(t,e=null,n=[],r=[],s=null,i=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.ft=null}}function wa(t,e=null,n=[],r=[],s=null,i=null,o=null){return new va(t,e,n,r,s,i,o)}function _a(t){const e=Li(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Yo(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),yo(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Lo(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Lo(t))).join(",")),e.ft=t}return e.ft}function Ta(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!ca(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(!Jo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!qo(t.startAt,e.startAt)&&qo(t.endAt,e.endAt)}function Ea(t){return eo.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
1009
+ */const cs=new Rn(en.comparator);function us(){return cs}const hs=new Rn(en.comparator);function ls(...e){let t=hs;for(const n of e)t=t.insert(n.key,n);return t}function ds(e){let t=hs;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function fs(){return gs()}function ps(){return gs()}function gs(){return new as(e=>e.toString(),(e,t)=>e.isEqual(t))}const ms=new Rn(en.comparator),ys=new Dn(en.comparator);function vs(...e){let t=ys;for(const n of e)t=t.add(n);return t}const _s=new Dn(zt);
946
1010
  /**
947
1011
  * @license
948
- * Copyright 2017 Google LLC
1012
+ * Copyright 2020 Google LLC
949
1013
  *
950
1014
  * Licensed under the Apache License, Version 2.0 (the "License");
951
1015
  * you may not use this file except in compliance with the License.
@@ -958,10 +1022,11 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
958
1022
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
959
1023
  * See the License for the specific language governing permissions and
960
1024
  * limitations under the License.
961
- */class Sa{constructor(t,e=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Ia(t){return new Sa(t)}function ba(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Aa(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Ca(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ka(t){return null!==t.collectionGroup}function Na(t){const e=Li(t);if(null===e.dt){e.dt=[];const t=Ca(e),n=Aa(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new aa(t)),e.dt.push(new aa(to.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new aa(to.keyField(),t))}}}return e.dt}function Ra(t){const e=Li(t);if(!e._t)if("F"===e.limitType)e._t=wa(e.path,e.collectionGroup,Na(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Na(e)){const e="desc"===n.dir?"asc":"desc";t.push(new aa(n.field,e))}const n=e.endAt?new jo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new jo(e.startAt.position,e.startAt.inclusive):null;e._t=wa(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Oa(t,e){e.getFirstInequalityField(),Ca(t);const n=t.filters.concat([e]);return new Sa(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Da(t,e,n){return new Sa(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function La(t,e){return Ta(Ra(t),Ra(e))&&t.limitType===e.limitType}function Pa(t){return`${_a(Ra(t))}|lt:${t.limitType}`}function Ma(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Xo(t))).join(", ")}]`),yo(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Lo(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Lo(t))).join(",")),`Target(${e})`}(Ra(t))}; limitType=${t.limitType})`}function xa(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):eo.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Na(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Na(t),e))&&!(t.endAt&&!function(t,e,n){const r=$o(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Na(t),e))}(t,e)}function Ua(t){return(e,n)=>{let r=!1;for(const s of Na(t)){const t=Fa(s,e,n);if(0!==t)return t;r=r||s.field.isKeyField()}return 0}}function Fa(t,e,n){const r=t.field.isKeyField()?eo.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),s=n.data.field(t);return null!==r&&null!==s?Oo(r,s):Oi()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Oi()}}
1025
+ */
1026
+ function ws(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:Sn(t)?"-0":t}}function Ts(e){return{integerValue:""+e}}function Es(e,t){return function(e){return"number"==typeof e&&Number.isInteger(e)&&!Sn(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}
962
1027
  /**
963
1028
  * @license
964
- * Copyright 2020 Google LLC
1029
+ * Copyright 2017 Google LLC
965
1030
  *
966
1031
  * Licensed under the Apache License, Version 2.0 (the "License");
967
1032
  * you may not use this file except in compliance with the License.
@@ -974,7 +1039,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
974
1039
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
975
1040
  * See the License for the specific language governing permissions and
976
1041
  * limitations under the License.
977
- */function Va(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:vo(e)?"-0":e}}function Ba(t){return{integerValue:""+t}}function Ha(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!vo(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Ba(e):Va(t,e)}
1042
+ */(t)?Ts(t):ws(e,t)}
978
1043
  /**
979
1044
  * @license
980
1045
  * Copyright 2018 Google LLC
@@ -990,7 +1055,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
990
1055
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
991
1056
  * See the License for the specific language governing permissions and
992
1057
  * limitations under the License.
993
- */class ja{constructor(){this._=void 0}}function $a(t,e,n){return t instanceof Wa?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof za?Ga(t,e):t instanceof Qa?Ya(t,e):function(t,e){const n=Ka(t,e),r=Xa(n)+Xa(t.gt);return xo(n)&&xo(t.gt)?Ba(r):Va(t.yt,r)}(t,e)}function qa(t,e,n){return t instanceof za?Ga(t,e):t instanceof Qa?Ya(t,e):n}function Ka(t,e){return t instanceof Ja?xo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Wa extends ja{}class za extends ja{constructor(t){super(),this.elements=t}}function Ga(t,e){const n=Za(e);for(const e of t.elements)n.some((t=>No(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Qa extends ja{constructor(t){super(),this.elements=t}}function Ya(t,e){let n=Za(e);for(const e of t.elements)n=n.filter((t=>!No(t,e)));return{arrayValue:{values:n}}}class Ja extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Xa(t){return Eo(t.integerValue||t.doubleValue)}function Za(t){return Uo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class tc{constructor(t,e){this.version=t,this.transformResults=e}}class ec{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ec}static exists(t){return new ec(void 0,t)}static updateTime(t){return new ec(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function nc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class rc{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new pc(t.key,ec.none()):new uc(t.key,t.data,ec.none());{const n=t.data,r=ga.empty();let s=new da(to.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new hc(t.key,r,new pa(s.toArray()),ec.none())}}function ic(t,e,n){t instanceof uc?function(t,e,n){const r=t.value.clone(),s=dc(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!nc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=dc(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(lc(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function oc(t,e,n,r){return t instanceof uc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=t.value.clone(),i=fc(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof hc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=fc(t.fieldTransforms,r,e),i=e.data;return i.setAll(lc(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return nc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ac(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=Ka(r.transform,t||null);null!=s&&(null===n&&(n=ga.empty()),n.set(r.field,s))}return n||null}function cc(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Gi(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof za&&e instanceof za||t instanceof Qa&&e instanceof Qa?Gi(t.elements,e.elements,No):t instanceof Ja&&e instanceof Ja?No(t.gt,e.gt):t instanceof Wa&&e instanceof Wa}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class uc extends rc{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class hc extends rc{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function lc(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 dc(t,e,n){const r=new Map;Di(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,qa(o,a,n[s]))}return r}function fc(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,$a(t,i,e))}return r}class pc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class gc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
1058
+ */class Ss{constructor(){this._=void 0}}function Is(e,t,n){return e instanceof Cs?function(e,t){const n={fields:{[Hn]:{stringValue:Bn},[zn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&qn(t)&&(t=Gn(t)),t&&(n.fields[$n]=t),{mapValue:n}}(n,t):e instanceof ks?Rs(e,t):e instanceof Os?Ns(e,t):function(e,t){const n=As(e,t),r=Ps(n)+Ps(e.Ee);return dr(n)&&dr(e.Ee)?Ts(r):ws(e.serializer,r)}(e,t)}function bs(e,t,n){return e instanceof ks?Rs(e,t):e instanceof Os?Ns(e,t):n}function As(e,t){return e instanceof Ds?function(e){return dr(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class Cs extends Ss{}class ks extends Ss{constructor(e){super(),this.elements=e}}function Rs(e,t){const n=Ls(t);for(const t of e.elements)n.some(e=>rr(e,t))||n.push(t);return{arrayValue:{values:n}}}class Os extends Ss{constructor(e){super(),this.elements=e}}function Ns(e,t){let n=Ls(t);for(const t of e.elements)n=n.filter(e=>!rr(e,t));return{arrayValue:{values:n}}}class Ds extends Ss{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function Ps(e){return Vn(e.integerValue||e.doubleValue)}function Ls(e){return fr(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Ms{constructor(e,t){this.version=e,this.transformResults=t}}class xs{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new xs}static exists(e){return new xs(void 0,e)}static updateTime(e){return new xs(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Us(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Fs{}function Vs(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new Qs(e.key,xs.none()):new zs(e.key,e.data,xs.none());{const n=e.data,r=vr.empty();let s=new Dn(Zt.comparator);for(let e of t.fields)if(!s.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),s=s.add(e)}return new qs(e.key,r,new Ln(s.toArray()),xs.none())}}function js(e,t,n){e instanceof zs?function(e,t,n){const r=e.value.clone(),s=Ks(e.fieldTransforms,t,n.transformResults);r.setAll(s),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof qs?function(e,t,n){if(!Us(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=Ks(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(Gs(e)),s.setAll(r),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Bs(e,t,n,r){return e instanceof zs?function(e,t,n,r){if(!Us(e.precondition,t))return n;const s=e.value.clone(),i=Ws(e.fieldTransforms,r,t);return s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,r):e instanceof qs?function(e,t,n,r){if(!Us(e.precondition,t))return n;const s=Ws(e.fieldTransforms,r,t),i=t.data;return i.setAll(Gs(e)),i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,r):function(e,t,n){return Us(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Hs(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),s=As(r.transform,e||null);null!=s&&(null===n&&(n=vr.empty()),n.set(r.field,s))}return n||null}function $s(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Wt(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof ks&&t instanceof ks||e instanceof Os&&t instanceof Os?Wt(e.elements,t.elements,rr):e instanceof Ds&&t instanceof Ds?rr(e.Ee,t.Ee):e instanceof Cs&&t instanceof Cs}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class zs extends Fs{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class qs extends Fs{constructor(e,t,n,r,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Gs(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}}),t}function Ks(e,t,n){const r=new Map;kt(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let s=0;s<n.length;s++){const i=e[s],o=i.transform,a=t.data.field(i.field);r.set(i.field,bs(o,a,n[s]))}return r}function Ws(e,t,n){const r=new Map;for(const s of e){const e=s.transform,i=n.data.field(s.field);r.set(s.field,Is(e,i,t))}return r}class Qs extends Fs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Js extends Fs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
994
1059
  /**
995
1060
  * @license
996
1061
  * Copyright 2017 Google LLC
@@ -1006,10 +1071,10 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
1006
1071
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1007
1072
  * See the License for the specific language governing permissions and
1008
1073
  * limitations under the License.
1009
- */class mc{constructor(t){this.count=t}}
1074
+ */class Ys{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const r=this.mutations[t];r.key.isEqual(e.key)&&js(r,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=Bs(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=Bs(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=ps();return this.mutations.forEach(r=>{const s=e.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=t.has(r.key)?null:o;const a=Vs(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(fn.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),vs())}isEqual(e){return this.batchId===e.batchId&&Wt(this.mutations,e.mutations,(e,t)=>$s(e,t))&&Wt(this.baseMutations,e.baseMutations,(e,t)=>$s(e,t))}}class Xs{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){kt(e.mutations.length===n.length,58842,{Ve:e.mutations.length,me:n.length});let r=ms;const s=e.mutations;for(let e=0;e<s.length;e++)r=r.insert(s[e].key,n[e].version);return new Xs(e,t,n,r)}}
1010
1075
  /**
1011
1076
  * @license
1012
- * Copyright 2017 Google LLC
1077
+ * Copyright 2022 Google LLC
1013
1078
  *
1014
1079
  * Licensed under the Apache License, Version 2.0 (the "License");
1015
1080
  * you may not use this file except in compliance with the License.
@@ -1022,7 +1087,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
1022
1087
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1023
1088
  * See the License for the specific language governing permissions and
1024
1089
  * limitations under the License.
1025
- */var yc,vc;function wc(t){if(void 0===t)return ki("GRPC error has no .code"),Pi.UNKNOWN;switch(t){case yc.OK:return Pi.OK;case yc.CANCELLED:return Pi.CANCELLED;case yc.UNKNOWN:return Pi.UNKNOWN;case yc.DEADLINE_EXCEEDED:return Pi.DEADLINE_EXCEEDED;case yc.RESOURCE_EXHAUSTED:return Pi.RESOURCE_EXHAUSTED;case yc.INTERNAL:return Pi.INTERNAL;case yc.UNAVAILABLE:return Pi.UNAVAILABLE;case yc.UNAUTHENTICATED:return Pi.UNAUTHENTICATED;case yc.INVALID_ARGUMENT:return Pi.INVALID_ARGUMENT;case yc.NOT_FOUND:return Pi.NOT_FOUND;case yc.ALREADY_EXISTS:return Pi.ALREADY_EXISTS;case yc.PERMISSION_DENIED:return Pi.PERMISSION_DENIED;case yc.FAILED_PRECONDITION:return Pi.FAILED_PRECONDITION;case yc.ABORTED:return Pi.ABORTED;case yc.OUT_OF_RANGE:return Pi.OUT_OF_RANGE;case yc.UNIMPLEMENTED:return Pi.UNIMPLEMENTED;case yc.DATA_LOSS:return Pi.DATA_LOSS;default:return Oi()}}(vc=yc||(yc={}))[vc.OK=0]="OK",vc[vc.CANCELLED=1]="CANCELLED",vc[vc.UNKNOWN=2]="UNKNOWN",vc[vc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",vc[vc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",vc[vc.NOT_FOUND=5]="NOT_FOUND",vc[vc.ALREADY_EXISTS=6]="ALREADY_EXISTS",vc[vc.PERMISSION_DENIED=7]="PERMISSION_DENIED",vc[vc.UNAUTHENTICATED=16]="UNAUTHENTICATED",vc[vc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",vc[vc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",vc[vc.ABORTED=10]="ABORTED",vc[vc.OUT_OF_RANGE=11]="OUT_OF_RANGE",vc[vc.UNIMPLEMENTED=12]="UNIMPLEMENTED",vc[vc.INTERNAL=13]="INTERNAL",vc[vc.UNAVAILABLE=14]="UNAVAILABLE",vc[vc.DATA_LOSS=15]="DATA_LOSS";
1090
+ */class Zs{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
1026
1091
  /**
1027
1092
  * @license
1028
1093
  * Copyright 2017 Google LLC
@@ -1038,8 +1103,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
1038
1103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1039
1104
  * See the License for the specific language governing permissions and
1040
1105
  * limitations under the License.
1041
- */
1042
- class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){go(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return mo(this.inner)}size(){return this.innerSize}}
1106
+ */class ei{constructor(e,t){this.count=e,this.unchangedNames=t}}
1043
1107
  /**
1044
1108
  * @license
1045
1109
  * Copyright 2017 Google LLC
@@ -1055,7 +1119,24 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1055
1119
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1056
1120
  * See the License for the specific language governing permissions and
1057
1121
  * limitations under the License.
1058
- */const Tc=new ua(eo.comparator);function Ec(){return Tc}const Sc=new ua(eo.comparator);function Ic(...t){let e=Sc;for(const n of t)e=e.insert(n.key,n);return e}function bc(t){let e=Sc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Ac(){return kc()}function Cc(){return kc()}function kc(){return new _c((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Nc=new ua(eo.comparator),Rc=new da(eo.comparator);function Oc(...t){let e=Rc;for(const n of t)e=e.add(n);return e}const Dc=new da(zi);function Lc(){return Dc}
1122
+ */var ti,ni;function ri(e){if(void 0===e)return St("GRPC error has no .code"),Ot.UNKNOWN;switch(e){case ti.OK:return Ot.OK;case ti.CANCELLED:return Ot.CANCELLED;case ti.UNKNOWN:return Ot.UNKNOWN;case ti.DEADLINE_EXCEEDED:return Ot.DEADLINE_EXCEEDED;case ti.RESOURCE_EXHAUSTED:return Ot.RESOURCE_EXHAUSTED;case ti.INTERNAL:return Ot.INTERNAL;case ti.UNAVAILABLE:return Ot.UNAVAILABLE;case ti.UNAUTHENTICATED:return Ot.UNAUTHENTICATED;case ti.INVALID_ARGUMENT:return Ot.INVALID_ARGUMENT;case ti.NOT_FOUND:return Ot.NOT_FOUND;case ti.ALREADY_EXISTS:return Ot.ALREADY_EXISTS;case ti.PERMISSION_DENIED:return Ot.PERMISSION_DENIED;case ti.FAILED_PRECONDITION:return Ot.FAILED_PRECONDITION;case ti.ABORTED:return Ot.ABORTED;case ti.OUT_OF_RANGE:return Ot.OUT_OF_RANGE;case ti.UNIMPLEMENTED:return Ot.UNIMPLEMENTED;case ti.DATA_LOSS:return Ot.DATA_LOSS;default:return At(39323,{code:e})}}(ni=ti||(ti={}))[ni.OK=0]="OK",ni[ni.CANCELLED=1]="CANCELLED",ni[ni.UNKNOWN=2]="UNKNOWN",ni[ni.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ni[ni.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ni[ni.NOT_FOUND=5]="NOT_FOUND",ni[ni.ALREADY_EXISTS=6]="ALREADY_EXISTS",ni[ni.PERMISSION_DENIED=7]="PERMISSION_DENIED",ni[ni.UNAUTHENTICATED=16]="UNAUTHENTICATED",ni[ni.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ni[ni.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ni[ni.ABORTED=10]="ABORTED",ni[ni.OUT_OF_RANGE=11]="OUT_OF_RANGE",ni[ni.UNIMPLEMENTED=12]="UNIMPLEMENTED",ni[ni.INTERNAL=13]="INTERNAL",ni[ni.UNAVAILABLE=14]="UNAVAILABLE",ni[ni.DATA_LOSS=15]="DATA_LOSS";
1123
+ /**
1124
+ * @license
1125
+ * Copyright 2022 Google LLC
1126
+ *
1127
+ * Licensed under the Apache License, Version 2.0 (the "License");
1128
+ * you may not use this file except in compliance with the License.
1129
+ * You may obtain a copy of the License at
1130
+ *
1131
+ * http://www.apache.org/licenses/LICENSE-2.0
1132
+ *
1133
+ * Unless required by applicable law or agreed to in writing, software
1134
+ * distributed under the License is distributed on an "AS IS" BASIS,
1135
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1136
+ * See the License for the specific language governing permissions and
1137
+ * limitations under the License.
1138
+ */
1139
+ const si=new st([4294967295,4294967295],0);function ii(e){const t=Ht().encode(e),n=new it;return n.update(t),new Uint8Array(n.digest())}function oi(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),r=t.getUint32(4,!0),s=t.getUint32(8,!0),i=t.getUint32(12,!0);return[new st([n,r],0),new st([s,i],0)]}class ai{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new ci(`Invalid padding: ${t}`);if(n<0)throw new ci(`Invalid hash count: ${n}`);if(e.length>0&&0===this.hashCount)throw new ci(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new ci(`Invalid padding when bitmap length is 0: ${t}`);this.fe=8*e.length-t,this.ge=st.fromNumber(this.fe)}pe(e,t,n){let r=e.add(t.multiply(st.fromNumber(n)));return 1===r.compare(si)&&(r=new st([r.getBits(0),r.getBits(1)],0)),r.modulo(this.ge).toNumber()}ye(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.fe)return!1;const t=ii(e),[n,r]=oi(t);for(let e=0;e<this.hashCount;e++){const t=this.pe(n,r,e);if(!this.ye(t))return!1}return!0}static create(e,t,n){const r=e%8==0?0:8-e%8,s=new Uint8Array(Math.ceil(e/8)),i=new ai(s,r,t);return n.forEach(e=>i.insert(e)),i}insert(e){if(0===this.fe)return;const t=ii(e),[n,r]=oi(t);for(let e=0;e<this.hashCount;e++){const t=this.pe(n,r,e);this.we(t)}}we(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class ci extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}
1059
1140
  /**
1060
1141
  * @license
1061
1142
  * Copyright 2017 Google LLC
@@ -1071,7 +1152,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1071
1152
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1072
1153
  * See the License for the specific language governing permissions and
1073
1154
  * limitations under the License.
1074
- */class Pc{constructor(t,e,n,r,s){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Mc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Pc(Yi.min(),r,Lc(),Ec(),Oc())}}class Mc{constructor(t,e,n,r,s){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Mc(n,e,Oc(),Oc(),Oc())}}
1155
+ */class ui{constructor(e,t,n,r,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const r=new Map;return r.set(e,hi.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new ui(fn.min(),r,new Rn(zt),us(),vs())}}class hi{constructor(e,t,n,r,s){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new hi(n,t,vs(),vs(),vs())}}
1075
1156
  /**
1076
1157
  * @license
1077
1158
  * Copyright 2017 Google LLC
@@ -1087,7 +1168,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1087
1168
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1088
1169
  * See the License for the specific language governing permissions and
1089
1170
  * limitations under the License.
1090
- */class xc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Uc{constructor(t,e){this.targetId=t,this.Et=e}}class Fc{constructor(t,e,n=wo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Vc{constructor(){this.At=0,this.Rt=jc(),this.bt=wo.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Oc(),e=Oc(),n=Oc();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Oi()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Bc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(zi)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Oi()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ea(t))if(0===n){const n=new eo(t.path);this.Qt(e,n,ya.newNoDocument(n,Yi.min()))}else Di(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&Ea(s.target)){const e=new eo(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,ya.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Oc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new Pc(t,e,this.Ut,this.Lt,n);return this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(zi),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Vc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new da(zi),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ci("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Vc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(eo.comparator)}function jc(){return new ua(eo.comparator)}
1171
+ */class li{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=r}}class di{constructor(e,t){this.targetId=e,this.De=t}}class fi{constructor(e,t,n=xn.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class pi{constructor(){this.ve=0,this.Ce=yi(),this.Fe=xn.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=vs(),t=vs(),n=vs();return this.Ce.forEach((r,s)=>{switch(s){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:At(38017,{changeType:s})}}),new hi(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=yi()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,kt(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class gi{constructor(e){this.We=e,this.Ge=new Map,this.ze=us(),this.je=mi(),this.Je=mi(),this.He=new Rn(zt)}Ye(e){for(const t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(const t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,t=>{const n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:At(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach((e,n)=>{this.nt(n)&&t(n)})}it(e){const t=e.targetId,n=e.De.count,r=this.st(t);if(r){const s=r.target;if(Gr(s))if(0===n){const e=new en(s.path);this.Xe(t,e,wr.newNoDocument(e,fn.min()))}else kt(1===n,20013,{expectedCount:n});else{const r=this.ot(t);if(r!==n){const n=this._t(e),s=n?this.ut(n,e,r):1;if(0!==s){this.rt(t);const e=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(t,e)}}}}}_t(e){const t=e.De.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:s=0}=t;let i,o;try{i=jn(n).toUint8Array()}catch(e){if(e instanceof Mn)return It("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{o=new ai(i,r,s)}catch(e){return It(e instanceof ci?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===o.fe?null:o}ut(e,t,n){return t.De.count===n-this.ht(e,t.targetId)?0:2}ht(e,t){const n=this.We.getRemoteKeysForTarget(t);let r=0;return n.forEach(n=>{const s=this.We.lt(),i=`projects/${s.projectId}/databases/${s.database}/documents/${n.path.canonicalString()}`;e.mightContain(i)||(this.Xe(t,n,null),r++)}),r}Pt(e){const t=new Map;this.Ge.forEach((n,r)=>{const s=this.st(r);if(s){if(n.current&&Gr(s.target)){const t=new en(s.target.path);this.Tt(t).has(r)||this.It(r,t)||this.Xe(r,t,wr.newNoDocument(t,e))}n.Ne&&(t.set(r,n.Le()),n.ke())}});let n=vs();this.Je.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)}),r&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));const r=new ui(e,t,this.He,this.ze,n);return this.ze=us(),this.je=mi(),this.Je=mi(),this.He=new Rn(zt),r}Ze(e,t){if(!this.nt(e))return;const n=this.It(e,t.key)?2:0;this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;const r=this.tt(e);this.It(e,t)?r.qe(t,1):r.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){const t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new pi,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new Dn(zt),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new Dn(zt),this.je=this.je.insert(e,t)),t}nt(e){const t=null!==this.st(e);return t||Et("WatchChangeAggregator","Detected inactive target",e),t}st(e){const t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new pi),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function mi(){return new Rn(en.comparator)}function yi(){return new Rn(en.comparator)}const vi={asc:"ASCENDING",desc:"DESCENDING"},_i={"<":"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"},wi={and:"AND",or:"OR"};class Ti{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ei(e,t){return e.useProto3Json||En(t)?t:{value:t}}function Si(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ii(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function bi(e,t){return Si(e,t.toTimestamp())}function Ai(e){return kt(!!e,49232),fn.fromTimestamp(function(e){const t=Fn(e);return new dn(t.seconds,t.nanos)}(e))}function Ci(e,t){return ki(e,t).canonicalString()}function ki(e,t){const n=function(e){return new Yt(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Ri(e){const t=Yt.fromString(e);return kt(Ki(t),10190,{key:t.toString()}),t}function Oi(e,t){return Ci(e.databaseId,t.path)}function Ni(e,t){const n=Ri(t);if(n.get(1)!==e.databaseId.projectId)throw new Nt(Ot.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Nt(Ot.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new en(Li(n))}function Di(e,t){return Ci(e.databaseId,t)}function Pi(e){return new Yt(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Li(e){return kt(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Mi(e,t,n){return{name:Oi(e,t),fields:n.value.mapValue.fields}}function xi(e,t){return{documents:[Di(e,t.path)]}}function Ui(e,t){const n={structuredQuery:{}},r=t.path;let s;null!==t.collectionGroup?(s=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Di(e,s);const i=function(e){if(0!==e.length)return qi(kr.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);const o=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:$i(e.field),direction:ji(e.dir)}}(e))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Ei(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{Vt:n,parent:s}}function Fi(e){let t=function(e){const t=Ri(e);return 4===t.length?Yt.emptyPath():Li(t)}(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){kt(1===r,65062);const e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=Vi(e);return t instanceof kr&&Or(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new Ir(zi(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,En(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new Tr(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new Tr(n,t)}(n.endAt)),function(e,t,n,r,s,i,o,a){return new Kr(e,t,n,r,s,i,o,a)}(t,s,o,i,a,"F",c,u)}function Vi(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=zi(e.unaryFilter.field);return Cr.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=zi(e.unaryFilter.field);return Cr.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=zi(e.unaryFilter.field);return Cr.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=zi(e.unaryFilter.field);return Cr.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return At(61313);default:return At(60726)}}(e):void 0!==e.fieldFilter?function(e){return Cr.create(zi(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return At(58110);default:return At(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return kr.create(e.compositeFilter.filters.map(e=>Vi(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return At(1026)}}(e.compositeFilter.op))}(e):At(30097,{filter:e})}function ji(e){return vi[e]}function Bi(e){return _i[e]}function Hi(e){return wi[e]}function $i(e){return{fieldPath:e.canonicalString()}}function zi(e){return Zt.fromServerFormat(e.fieldPath)}function qi(e){return e instanceof Cr?function(e){if("=="===e.op){if(gr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NAN"}};if(pr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(gr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NOT_NAN"}};if(pr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$i(e.field),op:Bi(e.op),value:e.value}}}(e):e instanceof kr?function(e){const t=e.getFilters().map(e=>qi(e));return 1===t.length?t[0]:{compositeFilter:{op:Hi(e.op),filters:t}}}(e):At(54877,{filter:e})}function Gi(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Ki(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
1091
1172
  /**
1092
1173
  * @license
1093
1174
  * Copyright 2017 Google LLC
@@ -1103,7 +1184,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1103
1184
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1104
1185
  * See the License for the specific language governing permissions and
1105
1186
  * limitations under the License.
1106
- */const $c={asc:"ASCENDING",desc:"DESCENDING"},qc={"<":"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"},Kc={and:"AND",or:"OR"};class Wc{constructor(t,e){this.databaseId=t,this.wt=e}}function zc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Gc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Qc(t,e){return zc(t,e.toTimestamp())}function Yc(t){return Di(!!t),Yi.fromTimestamp(function(t){const e=To(t);return new Qi(e.seconds,e.nanos)}(t))}function Jc(t,e){return function(t){return new Xi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Xc(t){const e=Xi.fromString(t);return Di(mu(e)),e}function Zc(t,e){return Jc(t.databaseId,e.path)}function tu(t,e){const n=Xc(e);if(n.get(1)!==t.databaseId.projectId)throw new Mi(Pi.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 Mi(Pi.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new eo(ru(n))}function eu(t,e){return Jc(t.databaseId,e)}function nu(t){return new Xi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function ru(t){return Di(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function su(t,e,n){return{name:Zc(t,e),fields:n.value.mapValue.fields}}function iu(t,e){return{documents:[eu(t,e.path)]}}function ou(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=eu(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=eu(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return pu(zo.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:du(t.field),direction:uu(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||yo(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function au(t){let e=function(t){const e=Xc(t);return 4===e.length?Xi.emptyPath():ru(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Di(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=cu(t);return e instanceof zo&&Qo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new aa(fu(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,yo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new Sa(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function cu(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=fu(t.unaryFilter.field);return Wo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=fu(t.unaryFilter.field);return Wo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=fu(t.unaryFilter.field);return Wo.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=fu(t.unaryFilter.field);return Wo.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Oi()}}(t):void 0!==t.fieldFilter?function(t){return Wo.create(fu(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Oi()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return zo.create(t.compositeFilter.filters.map((t=>cu(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Oi()}}(t.compositeFilter.op))}(t):Oi()}function uu(t){return $c[t]}function hu(t){return qc[t]}function lu(t){return Kc[t]}function du(t){return{fieldPath:t.canonicalString()}}function fu(t){return to.fromServerFormat(t.fieldPath)}function pu(t){return t instanceof Wo?function(t){if("=="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:du(t.field),op:hu(t.op),value:t.value}}}(t):t instanceof zo?function(t){const e=t.getFilters().map((t=>pu(t)));return 1===e.length?e[0]:{compositeFilter:{op:lu(t.op),filters:e}}}(t):Oi()}function gu(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function mu(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1187
+ */class Wi{constructor(e,t,n,r,s=fn.min(),i=fn.min(),o=xn.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new Wi(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Wi(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Wi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Wi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}
1107
1188
  /**
1108
1189
  * @license
1109
1190
  * Copyright 2017 Google LLC
@@ -1119,10 +1200,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1119
1200
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1120
1201
  * See the License for the specific language governing permissions and
1121
1202
  * limitations under the License.
1122
- */class yu{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&ic(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Cc();return this.mutations.forEach((r=>{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=sc(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(Yi.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Oc())}isEqual(t){return this.batchId===t.batchId&&Gi(this.mutations,t.mutations,((t,e)=>cc(t,e)))&&Gi(this.baseMutations,t.baseMutations,((t,e)=>cc(t,e)))}}class vu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Di(t.mutations.length===n.length);let r=Nc;const s=t.mutations;for(let t=0;t<s.length;t++)r=r.insert(s[t].key,n[t].version);return new vu(t,e,n,r)}}
1203
+ */class Qi{constructor(e){this.gt=e}}function Ji(e){const t=Fi({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?es(t,t.limit,"L"):t}
1123
1204
  /**
1124
1205
  * @license
1125
- * Copyright 2022 Google LLC
1206
+ * Copyright 2019 Google LLC
1126
1207
  *
1127
1208
  * Licensed under the Apache License, Version 2.0 (the "License");
1128
1209
  * you may not use this file except in compliance with the License.
@@ -1135,10 +1216,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1135
1216
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1136
1217
  * See the License for the specific language governing permissions and
1137
1218
  * limitations under the License.
1138
- */class wu{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
1219
+ */class Yi{constructor(){this.Dn=new Xi}addToCollectionParentIndex(e,t){return this.Dn.add(t),_n.resolve()}getCollectionParents(e,t){return _n.resolve(this.Dn.getEntries(t))}addFieldIndex(e,t){return _n.resolve()}deleteFieldIndex(e,t){return _n.resolve()}deleteAllFieldIndexes(e){return _n.resolve()}createTargetIndexes(e,t){return _n.resolve()}getDocumentsMatchingTarget(e,t){return _n.resolve(null)}getIndexType(e,t){return _n.resolve(0)}getFieldIndexes(e,t){return _n.resolve([])}getNextCollectionGroupToUpdate(e){return _n.resolve(null)}getMinOffset(e,t){return _n.resolve(gn.min())}getMinOffsetFromCollectionGroup(e,t){return _n.resolve(gn.min())}updateCollectionGroup(e,t,n){return _n.resolve()}updateIndexEntries(e,t){return _n.resolve()}}class Xi{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new Dn(Yt.comparator),s=!r.has(n);return this.index[t]=r.add(n),s}has(e){const t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new Dn(Yt.comparator)).toArray()}}
1139
1220
  /**
1140
1221
  * @license
1141
- * Copyright 2017 Google LLC
1222
+ * Copyright 2018 Google LLC
1142
1223
  *
1143
1224
  * Licensed under the Apache License, Version 2.0 (the "License");
1144
1225
  * you may not use this file except in compliance with the License.
@@ -1151,7 +1232,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1151
1232
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1152
1233
  * See the License for the specific language governing permissions and
1153
1234
  * limitations under the License.
1154
- */class _u{constructor(t,e,n,r,s=Yi.min(),i=Yi.min(),o=wo.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=i,this.resumeToken=o}withSequenceNumber(t){return new _u(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new _u(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new _u(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
1235
+ */const Zi={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},eo=41943040;class to{static withCacheSize(e){return new to(e,to.DEFAULT_COLLECTION_PERCENTILE,to.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}
1155
1236
  /**
1156
1237
  * @license
1157
1238
  * Copyright 2017 Google LLC
@@ -1167,10 +1248,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1167
1248
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1168
1249
  * See the License for the specific language governing permissions and
1169
1250
  * limitations under the License.
1170
- */class Tu{constructor(t){this.ie=t}}function Eu(t){const e=au({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Da(e,e.limit,"L"):e}
1251
+ */to.DEFAULT_COLLECTION_PERCENTILE=10,to.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,to.DEFAULT=new to(eo,to.DEFAULT_COLLECTION_PERCENTILE,to.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),to.DISABLED=new to(-1,0,0);
1171
1252
  /**
1172
1253
  * @license
1173
- * Copyright 2019 Google LLC
1254
+ * Copyright 2017 Google LLC
1174
1255
  *
1175
1256
  * Licensed under the Apache License, Version 2.0 (the "License");
1176
1257
  * you may not use this file except in compliance with the License.
@@ -1183,10 +1264,11 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1183
1264
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1184
1265
  * See the License for the specific language governing permissions and
1185
1266
  * limitations under the License.
1186
- */class Su{constructor(){this.Je=new Iu}addToCollectionParentIndex(t,e){return this.Je.add(e),co.resolve()}getCollectionParents(t,e){return co.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return co.resolve()}deleteFieldIndex(t,e){return co.resolve()}getDocumentsMatchingTarget(t,e){return co.resolve(null)}getIndexType(t,e){return co.resolve(0)}getFieldIndexes(t,e){return co.resolve([])}getNextCollectionGroupToUpdate(t){return co.resolve(null)}getMinOffset(t,e){return co.resolve(ro.min())}getMinOffsetFromCollectionGroup(t,e){return co.resolve(ro.min())}updateCollectionGroup(t,e,n){return co.resolve()}updateIndexEntries(t,e){return co.resolve()}}class Iu{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new da(Xi.comparator),s=!r.has(n);return this.index[e]=r.add(n),s}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new da(Xi.comparator)).toArray()}}
1267
+ */
1268
+ class no{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new no(0)}static ur(){return new no(-1)}}
1187
1269
  /**
1188
1270
  * @license
1189
- * Copyright 2017 Google LLC
1271
+ * Copyright 2020 Google LLC
1190
1272
  *
1191
1273
  * Licensed under the Apache License, Version 2.0 (the "License");
1192
1274
  * you may not use this file except in compliance with the License.
@@ -1199,7 +1281,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1199
1281
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1200
1282
  * See the License for the specific language governing permissions and
1201
1283
  * limitations under the License.
1202
- */class bu{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new bu(0)}static vn(){return new bu(-1)}}
1284
+ */const ro="LruGarbageCollector";function so([e,t],[n,r]){const s=zt(e,n);return 0===s?zt(t,r):s}class io{constructor(e){this.Tr=e,this.buffer=new Dn(so),this.Ir=0}dr(){return++this.Ir}Er(e){const t=[e,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(t);else{const e=this.buffer.last();so(t,e)<0&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class oo{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Ar=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.Rr(6e4)}stop(){this.Ar&&(this.Ar.cancel(),this.Ar=null)}get started(){return null!==this.Ar}Rr(e){Et(ro,`Garbage collection scheduled in ${e}ms`),this.Ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){wn(e)?Et(ro,"Ignoring IndexedDB error during garbage collection: ",e):await vn(e)}await this.Rr(3e5)})}}class ao{constructor(e,t){this.Vr=e,this.params=t}calculateTargetCount(e,t){return this.Vr.mr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return _n.resolve(Tn.ue);const n=new io(t);return this.Vr.forEachTarget(e,e=>n.Er(e.sequenceNumber)).next(()=>this.Vr.gr(e,e=>n.Er(e))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.Vr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.Vr.removeOrphanedDocuments(e,t)}collect(e,t){return-1===this.params.cacheSizeCollectionThreshold?(Et("LruGarbageCollector","Garbage collection skipped; disabled"),_n.resolve(Zi)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(Et("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),Zi):this.pr(e,t))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,t){let n,r,s,i,o,a,c;const u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(Et("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,i=Date.now(),this.nthSequenceNumber(e,r))).next(r=>(n=r,o=Date.now(),this.removeTargets(e,n,t))).next(t=>(s=t,a=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(c=Date.now(),Tt()<=M.DEBUG&&Et("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${i-u}ms\n\tDetermined least recently used ${r} in `+(o-i)+"ms\n"+`\tRemoved ${s} targets in `+(a-o)+"ms\n"+`\tRemoved ${e} documents in `+(c-a)+"ms\n"+`Total Duration: ${c-u}ms`),_n.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:s,documentsRemoved:e})))}}
1203
1285
  /**
1204
1286
  * @license
1205
1287
  * Copyright 2017 Google LLC
@@ -1215,7 +1297,8 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1215
1297
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1216
1298
  * See the License for the specific language governing permissions and
1217
1299
  * limitations under the License.
1218
- */class Au{constructor(){this.changes=new _c((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,ya.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?co.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
1300
+ */
1301
+ class co{constructor(){this.changes=new as(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,wr.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?_n.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}
1219
1302
  /**
1220
1303
  * @license
1221
1304
  * Copyright 2017 Google LLC
@@ -1247,7 +1330,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1247
1330
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1248
1331
  * See the License for the specific language governing permissions and
1249
1332
  * limitations under the License.
1250
- */class Cu{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
1333
+ */class uo{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}
1251
1334
  /**
1252
1335
  * @license
1253
1336
  * Copyright 2017 Google LLC
@@ -1263,7 +1346,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1263
1346
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1264
1347
  * See the License for the specific language governing permissions and
1265
1348
  * limitations under the License.
1266
- */class ku{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&oc(n.mutation,t,pa.empty(),Qi.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Oc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Oc()){const r=Ac();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Ic();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Ac();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Oc())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let s=Ec();const i=kc(),o=kc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof hc)?s=s.insert(e.key,e):void 0!==o&&(i.set(e.key,o.mutation.getFieldMask()),oc(o.mutation,e,o.mutation.getFieldMask(),Qi.now()))})),this.recalculateAndSaveOverlays(t,s).next((t=>(t.forEach(((t,e)=>i.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Cu(e,null!==(n=i.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=kc();let r=new ua(((t,e)=>t-e)),s=Oc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const s of t)s.keys().forEach((t=>{const i=e.get(t);if(null===i)return;let o=n.get(t)||pa.empty();o=s.applyToLocalView(i,o),n.set(t,o);const a=(r.get(s.batchId)||Oc()).add(t);r=r.insert(s.batchId,a)}))})).next((()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=Cc();c.forEach((t=>{if(!s.has(t)){const r=sc(e.get(t),n.get(t));null!==r&&u.set(t,r),s=s.add(t)}})),i.push(this.documentOverlayCache.saveOverlays(t,a,u))}return co.waitFor(i)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return eo.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ka(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-s.size):co.resolve(Ac());let o=-1,a=s;return i.next((e=>co.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(e)?co.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,s))).next((()=>this.computeViews(t,a,e,Oc()))).next((t=>({batchId:o,changes:bc(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new eo(e)).next((t=>{let e=Ic();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let s=Ic();return this.indexManager.getCollectionParents(t,r).next((i=>co.forEach(i,(i=>{const o=function(t,e){return new Sa(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,i.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{s=s.insert(t,e)}))}))})).next((()=>s))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((s=>(r=s,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,ya.newInvalidDocument(n)))}));let n=Ic();return r.forEach(((r,s)=>{const i=t.get(r);void 0!==i&&oc(i.mutation,s,pa.empty(),Qi.now()),xa(e,s)&&(n=n.insert(r,s))})),n}))}}
1349
+ */class ho{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(n=r,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&Bs(n.mutation,e,Ln.empty(),dn.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,vs()).next(()=>t))}getLocalViewOfDocuments(e,t,n=vs()){const r=fs();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=ls();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=fs();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,vs()))}populateOverlays(e,t,n){const r=[];return n.forEach(e=>{t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,r){let s=us();const i=gs(),o=gs();return t.forEach((e,t)=>{const o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof qs)?s=s.insert(t.key,t):void 0!==o?(i.set(t.key,o.mutation.getFieldMask()),Bs(o.mutation,t,o.mutation.getFieldMask(),dn.now())):i.set(t.key,Ln.empty())}),this.recalculateAndSaveOverlays(e,s).next(e=>(e.forEach((e,t)=>i.set(e,t)),t.forEach((e,t)=>{var n;return o.set(e,new uo(t,null!==(n=i.get(e))&&void 0!==n?n:null))}),o))}recalculateAndSaveOverlays(e,t){const n=gs();let r=new Rn((e,t)=>e-t),s=vs();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const s of e)s.keys().forEach(e=>{const i=t.get(e);if(null===i)return;let o=n.get(e)||Ln.empty();o=s.applyToLocalView(i,o),n.set(e,o);const a=(r.get(s.batchId)||vs()).add(e);r=r.insert(s.batchId,a)})}).next(()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=ps();c.forEach(e=>{if(!s.has(e)){const r=Vs(t.get(e),n.get(e));null!==r&&u.set(e,r),s=s.add(e)}}),i.push(this.documentOverlayCache.saveOverlays(e,a,u))}return _n.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return function(e){return en.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Jr(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-s.size):_n.resolve(fs());let o=-1,a=s;return i.next(t=>_n.forEach(t,(t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(t)?_n.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{a=a.insert(t,e)}))).next(()=>this.populateOverlays(e,t,s)).next(()=>this.computeViews(e,a,t,vs())).next(e=>({batchId:o,changes:ds(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new en(t)).next(e=>{let t=ls();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const s=t.collectionGroup;let i=ls();return this.indexManager.getCollectionParents(e,s).next(o=>_n.forEach(o,o=>{const a=function(e,t){return new Kr(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(s));return this.getDocumentsMatchingCollectionQuery(e,a,n,r).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(e,t,n,r){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,r))).next(e=>{s.forEach((t,n)=>{const r=n.getKey();null===e.get(r)&&(e=e.insert(r,wr.newInvalidDocument(r)))});let n=ls();return e.forEach((e,r)=>{const i=s.get(e);void 0!==i&&Bs(i.mutation,r,Ln.empty(),dn.now()),ss(t,r)&&(n=n.insert(e,r))}),n})}}
1267
1350
  /**
1268
1351
  * @license
1269
1352
  * Copyright 2020 Google LLC
@@ -1279,7 +1362,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1279
1362
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1280
1363
  * See the License for the specific language governing permissions and
1281
1364
  * limitations under the License.
1282
- */class Nu{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return co.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Yc(n.createTime)}),co.resolve()}getNamedQuery(t,e){return co.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:Eu(t.bundledQuery),readTime:Yc(t.readTime)}}(e)),co.resolve()}}
1365
+ */class lo{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,t){return _n.resolve(this.Br.get(t))}saveBundleMetadata(e,t){return this.Br.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Ai(e.createTime)}}(t)),_n.resolve()}getNamedQuery(e,t){return _n.resolve(this.Lr.get(t))}saveNamedQuery(e,t){return this.Lr.set(t.name,function(e){return{name:e.name,query:Ji(e.bundledQuery),readTime:Ai(e.readTime)}}(t)),_n.resolve()}}
1283
1366
  /**
1284
1367
  * @license
1285
1368
  * Copyright 2022 Google LLC
@@ -1295,7 +1378,23 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1295
1378
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1296
1379
  * See the License for the specific language governing permissions and
1297
1380
  * limitations under the License.
1298
- */class Ru{constructor(){this.overlays=new ua(eo.comparator),this.es=new Map}getOverlay(t,e){return co.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Ac();return co.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),co.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),co.resolve()}getOverlaysForCollection(t,e,n){const r=Ac(),s=e.length+1,i=new eo(e.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const t=o.getNext().value,i=t.getKey();if(!e.isPrefixOf(i.path))break;i.path.length===s&&t.largestBatchId>n&&r.set(t.getKey(),t)}return co.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let s=new ua(((t,e)=>t-e));const i=this.overlays.getIterator();for(;i.hasNext();){const t=i.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=s.get(t.largestBatchId);null===e&&(e=Ac(),s=s.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Ac(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return co.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new wu(e,n));let s=this.es.get(e);void 0===s&&(s=Oc(),this.es.set(e,s)),this.es.set(e,s.add(n.key))}}
1381
+ */class fo{constructor(){this.overlays=new Rn(en.comparator),this.kr=new Map}getOverlay(e,t){return _n.resolve(this.overlays.get(t))}getOverlays(e,t){const n=fs();return _n.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}saveOverlays(e,t,n){return n.forEach((n,r)=>{this.wt(e,t,r)}),_n.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.kr.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.kr.delete(n)),_n.resolve()}getOverlaysForCollection(e,t,n){const r=fs(),s=t.length+1,i=new en(t.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const e=o.getNext().value,i=e.getKey();if(!t.isPrefixOf(i.path))break;i.path.length===s&&e.largestBatchId>n&&r.set(e.getKey(),e)}return _n.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let s=new Rn((e,t)=>e-t);const i=this.overlays.getIterator();for(;i.hasNext();){const e=i.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=s.get(e.largestBatchId);null===t&&(t=fs(),s=s.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=fs(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((e,t)=>o.set(e,t)),!(o.size()>=r)););return _n.resolve(o)}wt(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.kr.get(r.largestBatchId).delete(n.key);this.kr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Zs(t,n));let s=this.kr.get(t);void 0===s&&(s=vs(),this.kr.set(t,s)),this.kr.set(t,s.add(n.key))}}
1382
+ /**
1383
+ * @license
1384
+ * Copyright 2024 Google LLC
1385
+ *
1386
+ * Licensed under the Apache License, Version 2.0 (the "License");
1387
+ * you may not use this file except in compliance with the License.
1388
+ * You may obtain a copy of the License at
1389
+ *
1390
+ * http://www.apache.org/licenses/LICENSE-2.0
1391
+ *
1392
+ * Unless required by applicable law or agreed to in writing, software
1393
+ * distributed under the License is distributed on an "AS IS" BASIS,
1394
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1395
+ * See the License for the specific language governing permissions and
1396
+ * limitations under the License.
1397
+ */class po{constructor(){this.sessionToken=xn.EMPTY_BYTE_STRING}getSessionToken(e){return _n.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,_n.resolve()}}
1299
1398
  /**
1300
1399
  * @license
1301
1400
  * Copyright 2017 Google LLC
@@ -1311,7 +1410,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1311
1410
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
1411
  * See the License for the specific language governing permissions and
1313
1412
  * limitations under the License.
1314
- */class Ou{constructor(){this.ns=new da(Du.ss),this.rs=new da(Du.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Du(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Du(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1),s=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),s.push(t.key)})),s}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1);let s=Oc();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Du(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Du{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return eo.comparator(t.key,e.key)||zi(t._s,e._s)}static os(t,e){return zi(t._s,e._s)||eo.comparator(t.key,e.key)}}
1413
+ */class go{constructor(){this.qr=new Dn(mo.Qr),this.$r=new Dn(mo.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,t){const n=new mo(e,t);this.qr=this.qr.add(n),this.$r=this.$r.add(n)}Kr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Wr(new mo(e,t))}Gr(e,t){e.forEach(e=>this.removeReference(e,t))}zr(e){const t=new en(new Yt([])),n=new mo(t,e),r=new mo(t,e+1),s=[];return this.$r.forEachInRange([n,r],e=>{this.Wr(e),s.push(e.key)}),s}jr(){this.qr.forEach(e=>this.Wr(e))}Wr(e){this.qr=this.qr.delete(e),this.$r=this.$r.delete(e)}Jr(e){const t=new en(new Yt([])),n=new mo(t,e),r=new mo(t,e+1);let s=vs();return this.$r.forEachInRange([n,r],e=>{s=s.add(e.key)}),s}containsKey(e){const t=new mo(e,0),n=this.qr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class mo{constructor(e,t){this.key=e,this.Hr=t}static Qr(e,t){return en.comparator(e.key,t.key)||zt(e.Hr,t.Hr)}static Ur(e,t){return zt(e.Hr,t.Hr)||en.comparator(e.key,t.key)}}
1315
1414
  /**
1316
1415
  * @license
1317
1416
  * Copyright 2017 Google LLC
@@ -1327,7 +1426,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1327
1426
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1328
1427
  * See the License for the specific language governing permissions and
1329
1428
  * limitations under the License.
1330
- */class Lu{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new da(Du.ss)}checkEmpty(t){return co.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new yu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Du(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return co.resolve(i)}lookupMutationBatch(t,e){return co.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return co.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return co.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return co.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Du(e,0),r=new Du(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),co.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new da(zi);return e.forEach((t=>{const e=new Du(t,0),r=new Du(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),co.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;eo.isDocumentKey(s)||(s=s.child(""));const i=new Du(new eo(s),0);let o=new da(zi);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),co.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Di(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return co.forEach(e.mutations,(r=>{const s=new Du(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Du(e,0),r=this.gs.firstAfterOrEqual(n);return co.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,co.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
1429
+ */class yo{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.er=1,this.Yr=new Dn(mo.Qr)}checkEmpty(e){return _n.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){const s=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new Ys(s,t,n,r);this.mutationQueue.push(i);for(const t of r)this.Yr=this.Yr.add(new mo(t.key,s)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return _n.resolve(i)}lookupMutationBatch(e,t){return _n.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,r=this.Xr(n),s=r<0?0:r;return _n.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return _n.resolve(0===this.mutationQueue.length?-1:this.er-1)}getAllMutationBatches(e){return _n.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new mo(t,0),r=new mo(t,Number.POSITIVE_INFINITY),s=[];return this.Yr.forEachInRange([n,r],e=>{const t=this.Zr(e.Hr);s.push(t)}),_n.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Dn(zt);return t.forEach(e=>{const t=new mo(e,0),r=new mo(e,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([t,r],e=>{n=n.add(e.Hr)})}),_n.resolve(this.ei(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,r=n.length+1;let s=n;en.isDocumentKey(s)||(s=s.child(""));const i=new mo(new en(s),0);let o=new Dn(zt);return this.Yr.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.Hr)),!0)},i),_n.resolve(this.ei(o))}ei(e){const t=[];return e.forEach(e=>{const n=this.Zr(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){kt(0===this.ti(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.Yr;return _n.forEach(t.mutations,r=>{const s=new mo(r.key,t.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.Yr=n})}rr(e){}containsKey(e,t){const n=new mo(t,0),r=this.Yr.firstAfterOrEqual(n);return _n.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,_n.resolve()}ti(e,t){return this.Xr(e)}Xr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Zr(e){const t=this.Xr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}
1331
1430
  /**
1332
1431
  * @license
1333
1432
  * Copyright 2017 Google LLC
@@ -1343,7 +1442,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1343
1442
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1344
1443
  * See the License for the specific language governing permissions and
1345
1444
  * limitations under the License.
1346
- */class Pu{constructor(t){this.Es=t,this.docs=new ua(eo.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),s=r?r.size:0,i=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return co.resolve(n?n.document.mutableCopy():ya.newInvalidDocument(e))}getEntries(t,e){let n=Ec();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():ya.newInvalidDocument(t))})),co.resolve(n)}getAllFromCollection(t,e,n){let r=Ec();const s=new eo(e.child("")),i=this.docs.getIteratorFrom(s);for(;i.hasNext();){const{key:t,value:{document:s}}=i.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||so(no(s),n)<=0||(r=r.insert(s.key,s.mutableCopy()))}return co.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Oi()}As(t,e){return co.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Mu(this)}getSize(t){return co.resolve(this.size)}}class Mu extends Au{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),co.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
1445
+ */class vo{constructor(e){this.ni=e,this.docs=new Rn(en.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),s=r?r.size:0,i=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return _n.resolve(n?n.document.mutableCopy():wr.newInvalidDocument(t))}getEntries(e,t){let n=us();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():wr.newInvalidDocument(e))}),_n.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let s=us();const i=t.path,o=new en(i.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!i.isPrefixOf(e.path))break;e.path.length>i.length+1||mn(pn(o),n)<=0||(r.has(o.key)||ss(t,o))&&(s=s.insert(o.key,o.mutableCopy()))}return _n.resolve(s)}getAllFromCollectionGroup(e,t,n,r){At(9500)}ri(e,t){return _n.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new _o(this)}getSize(e){return _n.resolve(this.size)}}class _o extends co{constructor(e){super(),this.Or=e}applyChanges(e){const t=[];return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.Or.addEntry(e,r)):this.Or.removeEntry(n)}),_n.waitFor(t)}getFromCache(e,t){return this.Or.getEntry(e,t)}getAllFromCache(e,t){return this.Or.getEntries(e,t)}}
1347
1446
  /**
1348
1447
  * @license
1349
1448
  * Copyright 2017 Google LLC
@@ -1359,7 +1458,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1359
1458
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1360
1459
  * See the License for the specific language governing permissions and
1361
1460
  * limitations under the License.
1362
- */class xu{constructor(t){this.persistence=t,this.Rs=new _c((t=>_a(t)),Ta),this.lastRemoteSnapshotVersion=Yi.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Ou,this.targetCount=0,this.vs=bu.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),co.resolve()}getLastRemoteSnapshotVersion(t){return co.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return co.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),co.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),co.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new bu(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,co.resolve()}updateTargetData(t,e){return this.Dn(e),co.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,co.resolve()}removeTargets(t,e,n){let r=0;const s=[];return this.Rs.forEach(((i,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(i),s.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),co.waitFor(s).next((()=>r))}getTargetCount(t){return co.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return co.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),co.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,s=[];return r&&e.forEach((e=>{s.push(r.markPotentiallyOrphaned(t,e))})),co.waitFor(s)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),co.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return co.resolve(n)}containsKey(t,e){return co.resolve(this.Ps.containsKey(e))}}
1461
+ */class wo{constructor(e){this.persistence=e,this.ii=new as(e=>zr(e),qr),this.lastRemoteSnapshotVersion=fn.min(),this.highestTargetId=0,this.si=0,this.oi=new go,this.targetCount=0,this._i=no.ar()}forEachTarget(e,t){return this.ii.forEach((e,n)=>t(n)),_n.resolve()}getLastRemoteSnapshotVersion(e){return _n.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return _n.resolve(this.si)}allocateTargetId(e){return this.highestTargetId=this._i.next(),_n.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.si&&(this.si=t),_n.resolve()}hr(e){this.ii.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this._i=new no(t),this.highestTargetId=t),e.sequenceNumber>this.si&&(this.si=e.sequenceNumber)}addTargetData(e,t){return this.hr(t),this.targetCount+=1,_n.resolve()}updateTargetData(e,t){return this.hr(t),_n.resolve()}removeTargetData(e,t){return this.ii.delete(t.target),this.oi.zr(t.targetId),this.targetCount-=1,_n.resolve()}removeTargets(e,t,n){let r=0;const s=[];return this.ii.forEach((i,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.ii.delete(i),s.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)}),_n.waitFor(s).next(()=>r)}getTargetCount(e){return _n.resolve(this.targetCount)}getTargetData(e,t){const n=this.ii.get(t)||null;return _n.resolve(n)}addMatchingKeys(e,t,n){return this.oi.Kr(t,n),_n.resolve()}removeMatchingKeys(e,t,n){this.oi.Gr(t,n);const r=this.persistence.referenceDelegate,s=[];return r&&t.forEach(t=>{s.push(r.markPotentiallyOrphaned(e,t))}),_n.waitFor(s)}removeMatchingKeysForTargetId(e,t){return this.oi.zr(t),_n.resolve()}getMatchingKeysForTargetId(e,t){const n=this.oi.Jr(t);return _n.resolve(n)}containsKey(e,t){return _n.resolve(this.oi.containsKey(t))}}
1363
1462
  /**
1364
1463
  * @license
1365
1464
  * Copyright 2017 Google LLC
@@ -1375,7 +1474,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1375
1474
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1376
1475
  * See the License for the specific language governing permissions and
1377
1476
  * limitations under the License.
1378
- */class Uu{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new ho(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new xu(this),this.indexManager=new Su,this.remoteDocumentCache=function(t){return new Pu(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new Tu(e),this.Ns=new Nu(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Ru,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Lu(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Ci("MemoryPersistence","Starting transaction:",t);const r=new Fu(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return co.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Fu extends oo{constructor(t){super(),this.currentSequenceNumber=t}}class Vu{constructor(t){this.persistence=t,this.Fs=new Ou,this.$s=null}static Bs(t){return new Vu(t)}get Ls(){if(this.$s)return this.$s;throw Oi()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),co.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),co.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),co.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return co.forEach(this.Ls,(n=>{const r=eo.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Yi.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return co.or([()=>co.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
1477
+ */class To{constructor(e,t){this.ai={},this.overlays={},this.ui=new Tn(0),this.ci=!1,this.ci=!0,this.li=new po,this.referenceDelegate=e(this),this.hi=new wo(this),this.indexManager=new Yi,this.remoteDocumentCache=function(e){return new vo(e)}(e=>this.referenceDelegate.Pi(e)),this.serializer=new Qi(t),this.Ti=new lo(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new fo,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new yo(t,this.referenceDelegate),this.ai[e.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,t,n){Et("MemoryPersistence","Starting transaction:",e);const r=new Eo(this.ui.next());return this.referenceDelegate.Ii(),n(r).next(e=>this.referenceDelegate.di(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}Ei(e,t){return _n.or(Object.values(this.ai).map(n=>()=>n.containsKey(e,t)))}}class Eo extends yn{constructor(e){super(),this.currentSequenceNumber=e}}class So{constructor(e){this.persistence=e,this.Ai=new go,this.Ri=null}static Vi(e){return new So(e)}get mi(){if(this.Ri)return this.Ri;throw At(60996)}addReference(e,t,n){return this.Ai.addReference(n,t),this.mi.delete(n.toString()),_n.resolve()}removeReference(e,t,n){return this.Ai.removeReference(n,t),this.mi.add(n.toString()),_n.resolve()}markPotentiallyOrphaned(e,t){return this.mi.add(t.toString()),_n.resolve()}removeTarget(e,t){this.Ai.zr(t.targetId).forEach(e=>this.mi.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.mi.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Ii(){this.Ri=new Set}di(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return _n.forEach(this.mi,n=>{const r=en.fromPath(n);return this.fi(e,r).next(e=>{e||t.removeEntry(r,fn.min())})}).next(()=>(this.Ri=null,t.apply(e)))}updateLimboDocument(e,t){return this.fi(e,t).next(e=>{e?this.mi.delete(t.toString()):this.mi.add(t.toString())})}Pi(e){return 0}fi(e,t){return _n.or([()=>_n.resolve(this.Ai.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ei(e,t)])}}class Io{constructor(e,t){this.persistence=e,this.gi=new as(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=bn(t)),t=In(e.get(n),t);return bn(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new ao(e,t)}(this,t)}static Vi(e,t){return new Io(e,t)}Ii(){}di(e){return _n.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}mr(e){const t=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}yr(e){let t=0;return this.gr(e,e=>{t++}).next(()=>t)}gr(e,t){return _n.forEach(this.gi,(n,r)=>this.Sr(e,n,r).next(e=>e?_n.resolve():t(r)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const r=this.persistence.getRemoteDocumentCache(),s=r.newChangeBuffer();return r.ri(e,r=>this.Sr(e,r,t).next(e=>{e||(n++,s.removeEntry(r,fn.min()))})).next(()=>s.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.gi.set(t,e.currentSequenceNumber),_n.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),_n.resolve()}removeReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),_n.resolve()}updateLimboDocument(e,t){return this.gi.set(t,e.currentSequenceNumber),_n.resolve()}Pi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=hr(e.data.value)),t}Sr(e,t,n){return _n.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.gi.get(t);return _n.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}
1379
1478
  /**
1380
1479
  * @license
1381
1480
  * Copyright 2017 Google LLC
@@ -1391,7 +1490,23 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1391
1490
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1392
1491
  * See the License for the specific language governing permissions and
1393
1492
  * limitations under the License.
1394
- */class Bu{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Oc(),r=Oc();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Bu(t,e.fromCache,n,r)}}
1493
+ */class bo{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.Is=n,this.ds=r}static Es(e,t){let n=vs(),r=vs();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:r=r.add(e.doc.key)}return new bo(e,t.fromCache,n,r)}}
1494
+ /**
1495
+ * @license
1496
+ * Copyright 2023 Google LLC
1497
+ *
1498
+ * Licensed under the Apache License, Version 2.0 (the "License");
1499
+ * you may not use this file except in compliance with the License.
1500
+ * You may obtain a copy of the License at
1501
+ *
1502
+ * http://www.apache.org/licenses/LICENSE-2.0
1503
+ *
1504
+ * Unless required by applicable law or agreed to in writing, software
1505
+ * distributed under the License is distributed on an "AS IS" BASIS,
1506
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1507
+ * See the License for the specific language governing permissions and
1508
+ * limitations under the License.
1509
+ */class Ao{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}
1395
1510
  /**
1396
1511
  * @license
1397
1512
  * Copyright 2019 Google LLC
@@ -1407,7 +1522,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1407
1522
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1408
1523
  * See the License for the specific language governing permissions and
1409
1524
  * limitations under the License.
1410
- */class Hu{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((s=>s||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(ba(e))return co.resolve(null);let n=Ra(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Da(e,null,"F"),n=Ra(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const s=Oc(...r);return this.Ni.getDocuments(t,s).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const i=this.Fi(e,r);return this.$i(e,i,s,n.readTime)?this.ki(t,Da(e,null,"F")):this.Bi(t,i,e,n)}))))})))))}Oi(t,e,n,r){return ba(e)||r.isEqual(Yi.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((s=>{const i=this.Fi(e,s);return this.$i(e,i,n,r)?this.Mi(t,e):(Ai()<=le.DEBUG&&Ci("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Ma(e)),this.Bi(t,i,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=Yi.fromTimestamp(1e9===r?new Qi(n+1,0):new Qi(n,r));return new ro(s,eo.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new da(Ua(t));return e.forEach(((e,r)=>{xa(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const s="F"===t.limitType?e.last():e.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}Mi(t,e){return Ai()<=le.DEBUG&&Ci("QueryEngine","Using full collection scan to execute query:",Ma(e)),this.Ni.getDocumentsMatchingQuery(t,e,ro.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
1525
+ */class Co{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=_()?8:function(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(v())>0?6:4}initialize(e,t){this.gs=e,this.indexManager=t,this.As=!0}getDocumentsMatchingQuery(e,t,n,r){const s={result:null};return this.ps(e,t).next(e=>{s.result=e}).next(()=>{if(!s.result)return this.ys(e,t,r,n).next(e=>{s.result=e})}).next(()=>{if(s.result)return;const n=new Ao;return this.ws(e,t,n).next(r=>{if(s.result=r,this.Rs)return this.Ss(e,t,n,r.size)})}).next(()=>s.result)}Ss(e,t,n,r){return n.documentReadCount<this.Vs?(Tt()<=M.DEBUG&&Et("QueryEngine","SDK will not create cache indexes for query:",rs(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),_n.resolve()):(Tt()<=M.DEBUG&&Et("QueryEngine","Query:",rs(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.fs*r?(Tt()<=M.DEBUG&&Et("QueryEngine","The SDK decides to create cache indexes for query:",rs(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Xr(t))):_n.resolve())}ps(e,t){if(Qr(t))return _n.resolve(null);let n=Xr(t);return this.indexManager.getIndexType(e,n).next(r=>0===r?null:(null!==t.limit&&1===r&&(t=es(t,null,"F"),n=Xr(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(r=>{const s=vs(...r);return this.gs.getDocuments(e,s).next(r=>this.indexManager.getMinOffset(e,n).next(n=>{const i=this.bs(t,r);return this.Ds(t,i,s,n.readTime)?this.ps(e,es(t,null,"F")):this.vs(e,i,t,n)}))})))}ys(e,t,n,r){return Qr(t)||r.isEqual(fn.min())?_n.resolve(null):this.gs.getDocuments(e,n).next(s=>{const i=this.bs(t,s);return this.Ds(t,i,n,r)?_n.resolve(null):(Tt()<=M.DEBUG&&Et("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),rs(t)),this.vs(e,i,t,function(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,s=fn.fromTimestamp(1e9===r?new dn(n+1,0):new dn(n,r));return new gn(s,en.empty(),t)}(r,-1)).next(e=>e))})}bs(e,t){let n=new Dn(is(e));return t.forEach((t,r)=>{ss(e,r)&&(n=n.add(r))}),n}Ds(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const s="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}ws(e,t,n){return Tt()<=M.DEBUG&&Et("QueryEngine","Using full collection scan to execute query:",rs(t)),this.gs.getDocumentsMatchingQuery(e,t,gn.min(),n)}vs(e,t,n,r){return this.gs.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}
1411
1526
  /**
1412
1527
  * @license
1413
1528
  * Copyright 2020 Google LLC
@@ -1423,7 +1538,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1423
1538
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1424
1539
  * See the License for the specific language governing permissions and
1425
1540
  * limitations under the License.
1426
- */class ju{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new ua(zi),this.Ui=new _c((t=>_a(t)),Ta),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new ku(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function $u(t,e){const n=Li(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Oc();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function qu(t){const e=Li(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Ku(t,e){const n=Li(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(wo.EMPTY_BYTE_STRING,Yi.min()).withLastLimboFreeSnapshotVersion(Yi.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ec(),c=Oc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Oc(),s=Oc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ec();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Yi.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ci("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Yi.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return co.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}function Wu(t,e){const n=Li(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function zu(t,e,n){const r=Li(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!uo(t))throw t;Ci("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function Gu(t,e,n){const r=Li(t);let s=Yi.min(),i=Oc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Li(t),s=r.Ui.get(n);return void 0!==s?co.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Ra(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:Yi.min(),n?i:Oc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Yi.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class Qu{constructor(){this.activeTargetIds=Lc()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class Yu{constructor(){this.Lr=new Qu,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Qu,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1541
+ */const ko="LocalStore";class Ro{constructor(e,t,n,r){this.persistence=e,this.Cs=t,this.serializer=r,this.Fs=new Rn(zt),this.Ms=new as(e=>zr(e),qr),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(n)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ho(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Fs))}}async function Oo(e,t){const n=Rt(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next(s=>(r=s,n.Ns(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const s=[],i=[];let o=vs();for(const e of r){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){i.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next(e=>({Bs:e,removedBatchIds:s,addedBatchIds:i}))})})}function No(e){const t=Rt(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.hi.getLastRemoteSnapshotVersion(e))}function Do(e,t){const n=Rt(e),r=t.snapshotVersion;let s=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{const i=n.Os.newChangeBuffer({trackRemovals:!0});s=n.Fs;const o=[];t.targetChanges.forEach((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.hi.removeMatchingKeys(e,i.removedDocuments,a).next(()=>n.hi.addMatchingKeys(e,i.addedDocuments,a)));let u=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?u=u.withResumeToken(xn.EMPTY_BYTE_STRING,fn.min()).withLastLimboFreeSnapshotVersion(fn.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(e,t,n){if(0===e.resumeToken.approximateByteSize())return!0;if(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8)return!0;return n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,u,i)&&o.push(n.hi.updateTargetData(e,u))});let a=us(),c=vs();if(t.documentUpdates.forEach(r=>{t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))}),o.push(function(e,t,n){let r=vs(),s=vs();return n.forEach(e=>r=r.add(e)),t.getEntries(e,r).next(e=>{let r=us();return n.forEach((n,i)=>{const o=e.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(fn.min())?(t.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(i),r=r.insert(n,i)):Et(ko,"Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)}),{Ls:r,ks:s}})}(e,i,t.documentUpdates).next(e=>{a=e.Ls,c=e.ks})),!r.isEqual(fn.min())){const t=n.hi.getLastRemoteSnapshotVersion(e).next(t=>n.hi.setTargetsMetadata(e,e.currentSequenceNumber,r));o.push(t)}return _n.waitFor(o).next(()=>i.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,a,c)).next(()=>a)}).then(e=>(n.Fs=s,e))}function Po(e,t){const n=Rt(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}async function Lo(e,t,n){const r=Rt(e),s=r.Fs.get(t),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,e=>r.persistence.referenceDelegate.removeTarget(e,s))}catch(e){if(!wn(e))throw e;Et(ko,`Failed to update sequence numbers for target ${t}: ${e}`)}r.Fs=r.Fs.remove(t),r.Ms.delete(s.target)}function Mo(e,t,n){const r=Rt(e);let s=fn.min(),i=vs();return r.persistence.runTransaction("Execute query","readwrite",e=>function(e,t,n){const r=Rt(e),s=r.Ms.get(n);return void 0!==s?_n.resolve(r.Fs.get(s)):r.hi.getTargetData(t,n)}(r,e,Xr(t)).next(t=>{if(t)return s=t.lastLimboFreeSnapshotVersion,r.hi.getMatchingKeysForTargetId(e,t.targetId).next(e=>{i=e})}).next(()=>r.Cs.getDocumentsMatchingQuery(e,t,n?s:fn.min(),n?i:vs())).next(e=>(function(e,t,n){let r=e.xs.get(t)||fn.min();n.forEach((e,t)=>{t.readTime.compareTo(r)>0&&(r=t.readTime)}),e.xs.set(t,r)}(r,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,qs:i})))}class xo{constructor(){this.activeTargetIds=_s}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Uo{constructor(){this.Fo=new xo,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,t,n){this.Mo[e]=t}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new xo,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}
1427
1542
  /**
1428
1543
  * @license
1429
1544
  * Copyright 2019 Google LLC
@@ -1439,7 +1554,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1439
1554
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1440
1555
  * See the License for the specific language governing permissions and
1441
1556
  * limitations under the License.
1442
- */class Ju{Ur(t){}shutdown(){}}
1557
+ */class Fo{xo(e){}shutdown(){}}
1443
1558
  /**
1444
1559
  * @license
1445
1560
  * Copyright 2019 Google LLC
@@ -1455,10 +1570,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1455
1570
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1456
1571
  * See the License for the specific language governing permissions and
1457
1572
  * limitations under the License.
1458
- */class Xu{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Ci("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Ci("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
1573
+ */const Vo="ConnectivityMonitor";class jo{constructor(){this.Oo=()=>this.No(),this.Bo=()=>this.Lo(),this.ko=[],this.qo()}xo(e){this.ko.push(e)}shutdown(){window.removeEventListener("online",this.Oo),window.removeEventListener("offline",this.Bo)}qo(){window.addEventListener("online",this.Oo),window.addEventListener("offline",this.Bo)}No(){Et(Vo,"Network connectivity changed: AVAILABLE");for(const e of this.ko)e(0)}Lo(){Et(Vo,"Network connectivity changed: UNAVAILABLE");for(const e of this.ko)e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
1459
1574
  /**
1460
1575
  * @license
1461
- * Copyright 2020 Google LLC
1576
+ * Copyright 2023 Google LLC
1462
1577
  *
1463
1578
  * Licensed under the Apache License, Version 2.0 (the "License");
1464
1579
  * you may not use this file except in compliance with the License.
@@ -1471,10 +1586,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1471
1586
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1472
1587
  * See the License for the specific language governing permissions and
1473
1588
  * limitations under the License.
1474
- */const Zu={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
1589
+ */let Bo=null;function Ho(){return null===Bo?Bo=268435456+Math.round(2147483648*Math.random()):Bo++,"0x"+Bo.toString(16)
1475
1590
  /**
1476
1591
  * @license
1477
- * Copyright 2017 Google LLC
1592
+ * Copyright 2020 Google LLC
1478
1593
  *
1479
1594
  * Licensed under the Apache License, Version 2.0 (the "License");
1480
1595
  * you may not use this file except in compliance with the License.
@@ -1487,7 +1602,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1487
1602
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1488
1603
  * See the License for the specific language governing permissions and
1489
1604
  * limitations under the License.
1490
- */class th{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
1605
+ */}const $o="RestConnection",zo={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class qo{get Qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.$o=t+"://"+e.host,this.Uo=`projects/${n}/databases/${r}`,this.Ko=this.databaseId.database===Qn?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Wo(e,t,n,r,s){const i=Ho(),o=this.Go(e,t.toUriEncodedString());Et($o,`Sending RPC '${e}' ${i}:`,o,n);const a={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(a,r,s);const{host:c}=new URL(o),u=f(c);return this.jo(e,o,a,n,u).then(t=>(Et($o,`Received RPC '${e}' ${i}: `,t),t),t=>{throw It($o,`RPC '${e}' ${i} failed with error: `,t,"url: ",o,"request:",n),t})}Jo(e,t,n,r,s,i){return this.Wo(e,t,n,r,s)}zo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+_t,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,n)=>e[n]=t),n&&n.headers.forEach((t,n)=>e[n]=t)}Go(e,t){const n=zo[e];return`${this.$o}/v1/${t}:${n}`}terminate(){}}
1491
1606
  /**
1492
1607
  * @license
1493
1608
  * Copyright 2017 Google LLC
@@ -1503,10 +1618,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1503
1618
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1504
1619
  * See the License for the specific language governing permissions and
1505
1620
  * limitations under the License.
1506
- */class eh extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,s){const i=this.ho(t,e);Ci("RestConnection","Sending: ",i,n);const o={};return this.lo(o,r,s),this.fo(t,i,o,n).then((t=>(Ci("RestConnection","Received: ",t),t)),(e=>{throw Ni("RestConnection",`${t} failed with error: `,e,"url: ",i,"request:",n),e}))}_o(t,e,n,r,s,i){return this.ao(t,e,n,r,s)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Ii,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=Zu[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((s,i)=>{const o=new Ti;o.setWithCredentials(!0),o.listenOnce(gi.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case pi.NO_ERROR:const e=o.getResponseJson();Ci("Connection","XHR received:",JSON.stringify(e)),s(e);break;case pi.TIMEOUT:Ci("Connection",'RPC "'+t+'" timed out'),i(new Mi(Pi.DEADLINE_EXCEEDED,"Request time out"));break;case pi.HTTP_ERROR:const n=o.getStatus();if(Ci("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Pi).indexOf(e)>=0?e:Pi.UNKNOWN}(e.status);i(new Mi(t,e.message))}else i(new Mi(Pi.UNKNOWN,"Server responded with status "+o.getStatus()))}else i(new Mi(Pi.UNAVAILABLE,"Connection failed."));break;default:Oi()}}finally{Ci("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],s=new ui,i=ar(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new wi({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Ci("Connection","Creating WebChannel: "+a,o);const c=s.createWebChannel(a,o);let u=!1,h=!1;const l=new th({Hr:t=>{h?Ci("Connection","Not sending because WebChannel is closed:",t):(u||(Ci("Connection","Opening WebChannel transport."),c.open(),u=!0),Ci("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,_i.EventType.OPEN,(()=>{h||Ci("Connection","WebChannel transport opened.")})),d(c,_i.EventType.CLOSE,(()=>{h||(h=!0,Ci("Connection","WebChannel transport closed"),l.io())})),d(c,_i.EventType.ERROR,(t=>{h||(h=!0,Ni("Connection","WebChannel transport errored:",t),l.io(new Mi(Pi.UNAVAILABLE,"The operation could not be completed")))})),d(c,_i.EventType.MESSAGE,(t=>{var e;if(!h){const n=t.data[0];Di(!!n);const r=n,s=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(s){Ci("Connection","WebChannel received error:",s);const t=s.status;let e=function(t){const e=yc[t];if(void 0!==e)return wc(e)}(t),n=s.message;void 0===e&&(e=Pi.INTERNAL,n="Unknown error status: "+t+" with message "+s.message),h=!0,l.io(new Mi(e,n)),c.close()}else Ci("Connection","WebChannel received:",n),l.ro(n)}})),d(i,mi.STAT_EVENT,(t=>{t.stat===yi?Ci("Connection","Detected buffering proxy"):t.stat===vi&&Ci("Connection","Detected no buffering proxy")})),setTimeout((()=>{l.so()}),0),l}}function nh(){return"undefined"!=typeof document?document:null}
1621
+ */class Go{constructor(e){this.Ho=e.Ho,this.Yo=e.Yo}Zo(e){this.Xo=e}e_(e){this.t_=e}n_(e){this.r_=e}onMessage(e){this.i_=e}close(){this.Yo()}send(e){this.Ho(e)}s_(){this.Xo()}o_(){this.t_()}__(e){this.r_(e)}a_(e){this.i_(e)}}
1507
1622
  /**
1508
1623
  * @license
1509
- * Copyright 2020 Google LLC
1624
+ * Copyright 2017 Google LLC
1510
1625
  *
1511
1626
  * Licensed under the Apache License, Version 2.0 (the "License");
1512
1627
  * you may not use this file except in compliance with the License.
@@ -1519,10 +1634,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1519
1634
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1520
1635
  * See the License for the specific language governing permissions and
1521
1636
  * limitations under the License.
1522
- */function rh(t){return new Wc(t,!0)}class sh{constructor(t,e,n=1e3,r=1.5,s=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=s,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&Ci("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
1637
+ */const Ko="WebChannelConnection";class Wo extends qo{constructor(e){super(e),this.u_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}jo(e,t,n,r,s){const i=Ho();return new Promise((s,o)=>{const a=new at;a.setWithCredentials(!0),a.listenOnce(ut.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case ht.NO_ERROR:const t=a.getResponseJson();Et(Ko,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),s(t);break;case ht.TIMEOUT:Et(Ko,`RPC '${e}' ${i} timed out`),o(new Nt(Ot.DEADLINE_EXCEEDED,"Request time out"));break;case ht.HTTP_ERROR:const n=a.getStatus();if(Et(Ko,`RPC '${e}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(Ot).indexOf(t)>=0?t:Ot.UNKNOWN}(t.status);o(new Nt(e,t.message))}else o(new Nt(Ot.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new Nt(Ot.UNAVAILABLE,"Connection failed."));break;default:At(9055,{c_:e,streamId:i,l_:a.getLastErrorCode(),h_:a.getLastError()})}}finally{Et(Ko,`RPC '${e}' ${i} completed.`)}});const c=JSON.stringify(r);Et(Ko,`RPC '${e}' ${i} sending request:`,r),a.send(t,"POST",c,n,15)})}P_(e,t,n){const r=Ho(),s=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],i=pt(),o=ft(),a={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},c=this.longPollingOptions.timeoutSeconds;void 0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.useFetchStreams=!0),this.zo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const u=s.join("");Et(Ko,`Creating RPC '${e}' stream ${r}: ${u}`,a);const h=i.createWebChannel(u,a);this.T_(h);let l=!1,d=!1;const f=new Go({Ho:t=>{d?Et(Ko,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(l||(Et(Ko,`Opening RPC '${e}' stream ${r} transport.`),h.open(),l=!0),Et(Ko,`RPC '${e}' stream ${r} sending:`,t),h.send(t))},Yo:()=>h.close()}),p=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return p(h,ct.EventType.OPEN,()=>{d||(Et(Ko,`RPC '${e}' stream ${r} transport opened.`),f.s_())}),p(h,ct.EventType.CLOSE,()=>{d||(d=!0,Et(Ko,`RPC '${e}' stream ${r} transport closed`),f.__(),this.I_(h))}),p(h,ct.EventType.ERROR,t=>{d||(d=!0,It(Ko,`RPC '${e}' stream ${r} transport errored. Name:`,t.name,"Message:",t.message),f.__(new Nt(Ot.UNAVAILABLE,"The operation could not be completed")))}),p(h,ct.EventType.MESSAGE,t=>{var n;if(!d){const s=t.data[0];kt(!!s,16349);const i=s,o=(null==i?void 0:i.error)||(null===(n=i[0])||void 0===n?void 0:n.error);if(o){Et(Ko,`RPC '${e}' stream ${r} received error:`,o);const t=o.status;let n=function(e){const t=ti[e];if(void 0!==t)return ri(t)}(t),s=o.message;void 0===n&&(n=Ot.INTERNAL,s="Unknown error status: "+t+" with message "+o.message),d=!0,f.__(new Nt(n,s)),h.close()}else Et(Ko,`RPC '${e}' stream ${r} received:`,s),f.a_(s)}}),p(o,dt.STAT_EVENT,t=>{t.stat===lt.PROXY?Et(Ko,`RPC '${e}' stream ${r} detected buffering proxy`):t.stat===lt.NOPROXY&&Et(Ko,`RPC '${e}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{f.o_()},0),f}terminate(){this.u_.forEach(e=>e.close()),this.u_=[]}T_(e){this.u_.push(e)}I_(e){this.u_=this.u_.filter(t=>t===e)}}function Qo(){return"undefined"!=typeof document?document:null}
1523
1638
  /**
1524
1639
  * @license
1525
- * Copyright 2017 Google LLC
1640
+ * Copyright 2020 Google LLC
1526
1641
  *
1527
1642
  * Licensed under the Apache License, Version 2.0 (the "License");
1528
1643
  * you may not use this file except in compliance with the License.
@@ -1535,7 +1650,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1535
1650
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1536
1651
  * See the License for the specific language governing permissions and
1537
1652
  * limitations under the License.
1538
- */class ih{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new sh(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Pi.RESOURCE_EXHAUSTED?(ki(e.toString()),ki("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Pi.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Mi(Pi.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Ci("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ci("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class oh extends ih{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Oi()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Di(void 0===e||"string"==typeof e),wo.fromBase64String(e||"")):(Di(void 0===e||e instanceof Uint8Array),wo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Pi.UNKNOWN:wc(t.code);return new Mi(e,t.message||"")}(o);n=new Fc(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=tu(t,r.document.name),i=Yc(r.document.updateTime),o=r.document.createTime?Yc(r.document.createTime):Yi.min(),a=new ga({mapValue:{fields:r.document.fields}}),c=ya.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new xc(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=tu(t,r.document),i=r.readTime?Yc(r.readTime):Yi.min(),o=ya.newNoDocument(s,i),a=r.removedTargetIds||[];n=new xc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=tu(t,r.document),i=r.removedTargetIds||[];n=new xc([],i,s,null)}else{if(!("filter"in e))return Oi();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new mc(r),i=t.targetId;n=new Uc(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Yi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Yi.min():e.readTime?Yc(e.readTime):Yi.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=nu(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ea(r)?{documents:iu(t,r)}:{query:ou(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Gc(t,e.resumeToken):e.snapshotVersion.compareTo(Yi.min())>0&&(n.readTime=zc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Oi()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=nu(this.yt),e.removeTarget=t,this.Bo(e)}}class ah extends ih{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.yt=s,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Di(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Di(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Yc(t.updateTime):Yc(e);return n.isEqual(Yi.min())&&(n=Yc(e)),new tc(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Yc(t.commitTime);return this.listener.Zo(n,e)}return Di(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=nu(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:su(t,e.key,e.value)};else if(e instanceof pc)n={delete:Zc(t,e.key)};else if(e instanceof hc)n={update:su(t,e.key,e.data),updateMask:gu(e.fieldMask)};else{if(!(e instanceof gc))return Oi();n={verify:Zc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof za)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Qa)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ja)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Oi()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Qc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Oi()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1653
+ */function Jo(e){return new Ti(e,!0)}
1539
1654
  /**
1540
1655
  * @license
1541
1656
  * Copyright 2017 Google LLC
@@ -1551,7 +1666,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1551
1666
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1552
1667
  * See the License for the specific language governing permissions and
1553
1668
  * limitations under the License.
1554
- */class ch extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Mi(Pi.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,s])=>this.connection.ao(t,e,n,r,s))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Pi.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Mi(Pi.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([s,i])=>this.connection._o(t,e,n,s,i,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Pi.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Mi(Pi.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class uh{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(ki(e),this.ou=!1):Ci("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
1669
+ */class Yo{constructor(e,t,n=1e3,r=1.5,s=6e4){this.Fi=e,this.timerId=t,this.d_=n,this.E_=r,this.A_=s,this.R_=0,this.V_=null,this.m_=Date.now(),this.reset()}reset(){this.R_=0}f_(){this.R_=this.A_}g_(e){this.cancel();const t=Math.floor(this.R_+this.p_()),n=Math.max(0,Date.now()-this.m_),r=Math.max(0,t-n);r>0&&Et("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.R_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.V_=this.Fi.enqueueAfterDelay(this.timerId,r,()=>(this.m_=Date.now(),e())),this.R_*=this.E_,this.R_<this.d_&&(this.R_=this.d_),this.R_>this.A_&&(this.R_=this.A_)}y_(){null!==this.V_&&(this.V_.skipDelay(),this.V_=null)}cancel(){null!==this.V_&&(this.V_.cancel(),this.V_=null)}p_(){return(Math.random()-.5)*this.R_}}
1555
1670
  /**
1556
1671
  * @license
1557
1672
  * Copyright 2017 Google LLC
@@ -1567,10 +1682,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1567
1682
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1568
1683
  * See the License for the specific language governing permissions and
1569
1684
  * limitations under the License.
1570
- */class hh{constructor(t,e,n,r,s){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=s,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{wh(this)&&(Ci("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Li(t);e._u.add(4),await dh(e),e.gu.set("Unknown"),e._u.delete(4),await lh(e)}(this))}))})),this.gu=new uh(n,r)}}async function lh(t){if(wh(t))for(const e of t.wu)await e(!0)}async function dh(t){for(const e of t.wu)await e(!1)}function fh(t,e){const n=Li(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),vh(n)?yh(n):xh(n).ko()&&gh(n,e))}function ph(t,e){const n=Li(t),r=xh(n);n.du.delete(e),r.ko()&&mh(n,e),0===n.du.size&&(r.ko()?r.Fo():wh(n)&&n.gu.set("Unknown"))}function gh(t,e){t.yu.Ot(e.targetId),xh(t).zo(e)}function mh(t,e){t.yu.Ot(e),xh(t).Ho(e)}function yh(t){t.yu=new Bc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),xh(t).start(),t.gu.uu()}function vh(t){return wh(t)&&!xh(t).No()&&t.du.size>0}function wh(t){return 0===Li(t)._u.size}function _h(t){t.yu=void 0}async function Th(t){t.du.forEach(((e,n)=>{gh(t,e)}))}async function Eh(t,e){_h(t),vh(t)?(t.gu.hu(e),yh(t)):t.gu.set("Unknown")}async function Sh(t,e,n){if(t.gu.set("Online"),e instanceof Fc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){Ci("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Ih(t,n)}else if(e instanceof xc?t.yu.Kt(e):e instanceof Uc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Yi.min()))try{const e=await qu(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=t.du.get(r);s&&t.du.set(r,s.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(wo.EMPTY_BYTE_STRING,n.snapshotVersion)),mh(t,e);const r=new _u(n.target,e,1,n.sequenceNumber);gh(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Ci("RemoteStore","Failed to raise snapshot:",e),await Ih(t,e)}}async function Ih(t,e,n){if(!uo(e))throw e;t._u.add(1),await dh(t),t.gu.set("Offline"),n||(n=()=>qu(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Ci("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await lh(t)}))}function bh(t,e){return e().catch((n=>Ih(t,n,e)))}async function Ah(t){const e=Li(t),n=Uh(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Ch(e);)try{const t=await Wu(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,kh(e,t)}catch(t){await Ih(e,t)}Nh(e)&&Rh(e)}function Ch(t){return wh(t)&&t.fu.length<10}function kh(t,e){t.fu.push(e);const n=Uh(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Nh(t){return wh(t)&&!Uh(t).No()&&t.fu.length>0}function Rh(t){Uh(t).start()}async function Oh(t){Uh(t).eu()}async function Dh(t){const e=Uh(t);for(const n of t.fu)e.Xo(n.mutations)}async function Lh(t,e,n){const r=t.fu.shift(),s=vu.from(r,e,n);await bh(t,(()=>t.remoteSyncer.applySuccessfulWrite(s))),await Ah(t)}async function Ph(t,e){e&&Uh(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return Oi();case Pi.CANCELLED:case Pi.UNKNOWN:case Pi.DEADLINE_EXCEEDED:case Pi.RESOURCE_EXHAUSTED:case Pi.INTERNAL:case Pi.UNAVAILABLE:case Pi.UNAUTHENTICATED:return!1;case Pi.INVALID_ARGUMENT:case Pi.NOT_FOUND:case Pi.ALREADY_EXISTS:case Pi.PERMISSION_DENIED:case Pi.FAILED_PRECONDITION:case Pi.ABORTED:case Pi.OUT_OF_RANGE:case Pi.UNIMPLEMENTED:case Pi.DATA_LOSS:return!0}}(n=e.code)&&n!==Pi.ABORTED){const n=t.fu.shift();Uh(t).Mo(),await bh(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Ah(t)}var n}(t,e),Nh(t)&&Rh(t)}async function Mh(t,e){const n=Li(t);n.asyncQueue.verifyOperationInProgress(),Ci("RemoteStore","RemoteStore received new credentials");const r=wh(n);n._u.add(3),await dh(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await lh(n)}function xh(t){return t.pu||(t.pu=function(t,e,n){const r=Li(t);return r.su(),new oh(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
1685
+ */const Xo="PersistentStream";class Zo{constructor(e,t,n,r,s,i,o,a){this.Fi=e,this.w_=n,this.S_=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Yo(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===Ot.RESOURCE_EXHAUSTED?(St(t.toString()),St("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===Ot.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.n_(t)}U_(){}auth(){this.state=1;const e=this.K_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.b_===t&&this.W_(e,n)},t=>{e(()=>{const e=new Nt(Ot.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)})})}W_(e,t){const n=this.K_(this.b_);this.stream=this.z_(e,t),this.stream.Zo(()=>{n(()=>this.listener.Zo())}),this.stream.e_(()=>{n(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(e=>{n(()=>this.G_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.C_?this.j_(e):this.onNext(e))})}O_(){this.state=5,this.F_.g_(async()=>{this.state=0,this.start()})}G_(e){return Et(Xo,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget(()=>this.b_===e?t():(Et(Xo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ea extends Zo{constructor(e,t,n,r,s,i){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,i),this.serializer=s}z_(e,t){return this.connection.P_("Listen",e,t)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:At(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),s=t.targetChange.targetIds||[],i=function(e,t){return e.useProto3Json?(kt(void 0===t||"string"==typeof t,58123),xn.fromBase64String(t||"")):(kt(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),xn.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Ot.UNKNOWN:ri(e.code);return new Nt(t,e.message||"")}(o);n=new fi(r,s,i,a||null)}else if("documentChange"in t){t.documentChange;const r=t.documentChange;r.document,r.document.name,r.document.updateTime;const s=Ni(e,r.document.name),i=Ai(r.document.updateTime),o=r.document.createTime?Ai(r.document.createTime):fn.min(),a=new vr({mapValue:{fields:r.document.fields}}),c=wr.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new li(u,h,c.key,c)}else if("documentDelete"in t){t.documentDelete;const r=t.documentDelete;r.document;const s=Ni(e,r.document),i=r.readTime?Ai(r.readTime):fn.min(),o=wr.newNoDocument(s,i),a=r.removedTargetIds||[];n=new li([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const r=t.documentRemove;r.document;const s=Ni(e,r.document),i=r.removedTargetIds||[];n=new li([],i,s,null)}else{if(!("filter"in t))return At(11601,{At:t});{t.filter;const e=t.filter;e.targetId;const{count:r=0,unchangedNames:s}=e,i=new ei(r,s),o=e.targetId;n=new di(o,i)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return fn.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?fn.min():t.readTime?Ai(t.readTime):fn.min()}(e);return this.listener.J_(t,n)}H_(e){const t={};t.database=Pi(this.serializer),t.addTarget=function(e,t){let n;const r=t.target;if(n=Gr(r)?{documents:xi(e,r)}:{query:Ui(e,r).Vt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Ii(e,t.resumeToken);const r=Ei(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(fn.min())>0){n.readTime=Si(e,t.snapshotVersion.toTimestamp());const r=Ei(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return At(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.k_(t)}Y_(e){const t={};t.database=Pi(this.serializer),t.removeTarget=e,this.k_(t)}}class ta extends Zo{constructor(e,t,n,r,s,i){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,i),this.serializer=s}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return kt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,kt(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){kt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();const t=function(e,t){return e&&e.length>0?(kt(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?Ai(e.updateTime):Ai(t);return n.isEqual(fn.min())&&(n=Ai(t)),new Ms(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=Ai(e.commitTime);return this.listener.ta(n,t)}na(){const e={};e.database=Pi(this.serializer),this.k_(e)}X_(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof zs)n={update:Mi(e,t.key,t.value)};else if(t instanceof Qs)n={delete:Oi(e,t.key)};else if(t instanceof qs)n={update:Mi(e,t.key,t.data),updateMask:Gi(t.fieldMask)};else{if(!(t instanceof Js))return At(16599,{Rt:t.type});n={verify:Oi(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Cs)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof ks)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Os)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ds)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw At(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:bi(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:At(27497)}(e,t.precondition)),n}(this.serializer,e))};this.k_(t)}}
1571
1686
  /**
1572
1687
  * @license
1573
- * Copyright 2018 Google LLC
1688
+ * Copyright 2017 Google LLC
1574
1689
  *
1575
1690
  * Licensed under the Apache License, Version 2.0 (the "License");
1576
1691
  * you may not use this file except in compliance with the License.
@@ -1583,7 +1698,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1583
1698
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1584
1699
  * See the License for the specific language governing permissions and
1585
1700
  * limitations under the License.
1586
- */}(t.datastore,t.asyncQueue,{Yr:Th.bind(null,t),Zr:Eh.bind(null,t),Wo:Sh.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),vh(t)?yh(t):t.gu.set("Unknown")):(await t.pu.stop(),_h(t))}))),t.pu}function Uh(t){return t.Iu||(t.Iu=function(t,e,n){const r=Li(t);return r.su(),new ah(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:Oh.bind(null,t),Zr:Ph.bind(null,t),tu:Dh.bind(null,t),Zo:Lh.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Ah(t)):(await t.Iu.stop(),t.fu.length>0&&(Ci("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
1701
+ */class na{}class ra extends na{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.ra=!1}ia(){if(this.ra)throw new Nt(Ot.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,t,n,r){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,i])=>this.connection.Wo(e,ki(t,n),r,s,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Ot.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Nt(Ot.UNKNOWN,e.toString())})}Jo(e,t,n,r,s){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Jo(e,ki(t,n),r,i,o,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Ot.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Nt(Ot.UNKNOWN,e.toString())})}terminate(){this.ra=!0,this.connection.terminate()}}class sa{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.sa=0,this.oa=null,this._a=!0}aa(){0===this.sa&&(this.ua("Unknown"),this.oa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.oa=null,this.ca("Backend didn't respond within 10 seconds."),this.ua("Offline"),Promise.resolve())))}la(e){"Online"===this.state?this.ua("Unknown"):(this.sa++,this.sa>=1&&(this.ha(),this.ca(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ua("Offline")))}set(e){this.ha(),this.sa=0,"Online"===e&&(this._a=!1),this.ua(e)}ua(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ca(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this._a?(St(t),this._a=!1):Et("OnlineStateTracker",t)}ha(){null!==this.oa&&(this.oa.cancel(),this.oa=null)}}
1587
1702
  /**
1588
1703
  * @license
1589
1704
  * Copyright 2017 Google LLC
@@ -1599,10 +1714,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1599
1714
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1600
1715
  * See the License for the specific language governing permissions and
1601
1716
  * limitations under the License.
1602
- */}class Fh{constructor(t,e,n,r,s){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new xi,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,s){const i=Date.now()+n,o=new Fh(t,e,i,r,s);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Mi(Pi.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Vh(t,e){if(ki("AsyncQueue",`${e}: ${t}`),uo(t))return new Mi(Pi.UNAVAILABLE,`${e}: ${t}`);throw t}
1717
+ */const ia="RemoteStore";class oa{constructor(e,t,n,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=s,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{ga(this)&&(Et(ia,"Restarting streams for network reachability change."),await async function(e){const t=Rt(e);t.Ia.add(4),await ca(t),t.Aa.set("Unknown"),t.Ia.delete(4),await aa(t)}(this))})}),this.Aa=new sa(n,r)}}async function aa(e){if(ga(e))for(const t of e.da)await t(!0)}async function ca(e){for(const t of e.da)await t(!1)}function ua(e,t){const n=Rt(e);n.Ta.has(t.targetId)||(n.Ta.set(t.targetId,t),pa(n)?fa(n):Pa(n).x_()&&la(n,t))}function ha(e,t){const n=Rt(e),r=Pa(n);n.Ta.delete(t),r.x_()&&da(n,t),0===n.Ta.size&&(r.x_()?r.B_():ga(n)&&n.Aa.set("Unknown"))}function la(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(fn.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Pa(e).H_(t)}function da(e,t){e.Ra.$e(t),Pa(e).Y_(t)}function fa(e){e.Ra=new gi({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),Pa(e).start(),e.Aa.aa()}function pa(e){return ga(e)&&!Pa(e).M_()&&e.Ta.size>0}function ga(e){return 0===Rt(e).Ia.size}function ma(e){e.Ra=void 0}async function ya(e){e.Aa.set("Online")}async function va(e){e.Ta.forEach((t,n)=>{la(e,t)})}async function _a(e,t){ma(e),pa(e)?(e.Aa.la(t),fa(e)):e.Aa.set("Unknown")}async function wa(e,t,n){if(e.Aa.set("Online"),t instanceof fi&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const r of t.targetIds)e.Ta.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.Ta.delete(r),e.Ra.removeTarget(r))}(e,t)}catch(n){Et(ia,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Ta(e,n)}else if(t instanceof li?e.Ra.Ye(t):t instanceof di?e.Ra.it(t):e.Ra.et(t),!n.isEqual(fn.min()))try{const t=await No(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Ra.Pt(t);return n.targetChanges.forEach((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=e.Ta.get(r);s&&e.Ta.set(r,s.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{const r=e.Ta.get(t);if(!r)return;e.Ta.set(t,r.withResumeToken(xn.EMPTY_BYTE_STRING,r.snapshotVersion)),da(e,t);const s=new Wi(r.target,t,n,r.sequenceNumber);la(e,s)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Et(ia,"Failed to raise snapshot:",t),await Ta(e,t)}}async function Ta(e,t,n){if(!wn(t))throw t;e.Ia.add(1),await ca(e),e.Aa.set("Offline"),n||(n=()=>No(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Et(ia,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await aa(e)})}function Ea(e,t){return t().catch(n=>Ta(e,n,t))}async function Sa(e){const t=Rt(e),n=La(t);let r=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:-1;for(;Ia(t);)try{const e=await Po(t.localStore,r);if(null===e){0===t.Pa.length&&n.B_();break}r=e.batchId,ba(t,e)}catch(e){await Ta(t,e)}Aa(t)&&Ca(t)}function Ia(e){return ga(e)&&e.Pa.length<10}function ba(e,t){e.Pa.push(t);const n=La(e);n.x_()&&n.Z_&&n.X_(t.mutations)}function Aa(e){return ga(e)&&!La(e).M_()&&e.Pa.length>0}function Ca(e){La(e).start()}async function ka(e){La(e).na()}async function Ra(e){const t=La(e);for(const n of e.Pa)t.X_(n.mutations)}async function Oa(e,t,n){const r=e.Pa.shift(),s=Xs.from(r,t,n);await Ea(e,()=>e.remoteSyncer.applySuccessfulWrite(s)),await Sa(e)}async function Na(e,t){t&&La(e).Z_&&await async function(e,t){if(function(e){return function(e){switch(e){case Ot.OK:return At(64938);case Ot.CANCELLED:case Ot.UNKNOWN:case Ot.DEADLINE_EXCEEDED:case Ot.RESOURCE_EXHAUSTED:case Ot.INTERNAL:case Ot.UNAVAILABLE:case Ot.UNAUTHENTICATED:return!1;case Ot.INVALID_ARGUMENT:case Ot.NOT_FOUND:case Ot.ALREADY_EXISTS:case Ot.PERMISSION_DENIED:case Ot.FAILED_PRECONDITION:case Ot.ABORTED:case Ot.OUT_OF_RANGE:case Ot.UNIMPLEMENTED:case Ot.DATA_LOSS:return!0;default:return At(15467,{code:e})}}(e)&&e!==Ot.ABORTED}(t.code)){const n=e.Pa.shift();La(e).N_(),await Ea(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await Sa(e)}}(e,t),Aa(e)&&Ca(e)}async function Da(e,t){const n=Rt(e);n.asyncQueue.verifyOperationInProgress(),Et(ia,"RemoteStore received new credentials");const r=ga(n);n.Ia.add(3),await ca(n),r&&n.Aa.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ia.delete(3),await aa(n)}function Pa(e){return e.Va||(e.Va=function(e,t,n){const r=Rt(e);return r.ia(),new ea(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)
1603
1718
  /**
1604
1719
  * @license
1605
- * Copyright 2017 Google LLC
1720
+ * Copyright 2018 Google LLC
1606
1721
  *
1607
1722
  * Licensed under the Apache License, Version 2.0 (the "License");
1608
1723
  * you may not use this file except in compliance with the License.
@@ -1615,7 +1730,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1615
1730
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1616
1731
  * See the License for the specific language governing permissions and
1617
1732
  * limitations under the License.
1618
- */class Bh{constructor(t){this.comparator=t?(e,n)=>t(e,n)||eo.comparator(e.key,n.key):(t,e)=>eo.comparator(t.key,e.key),this.keyedMap=Ic(),this.sortedSet=new ua(this.comparator)}static emptySet(t){return new Bh(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Bh))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Bh;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
1733
+ */}(e.datastore,e.asyncQueue,{Zo:ya.bind(null,e),e_:va.bind(null,e),n_:_a.bind(null,e),J_:wa.bind(null,e)}),e.da.push(async t=>{t?(e.Va.N_(),pa(e)?fa(e):e.Aa.set("Unknown")):(await e.Va.stop(),ma(e))})),e.Va}function La(e){return e.ma||(e.ma=function(e,t,n){const r=Rt(e);return r.ia(),new ta(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),e_:ka.bind(null,e),n_:Na.bind(null,e),ea:Ra.bind(null,e),ta:Oa.bind(null,e)}),e.da.push(async t=>{t?(e.ma.N_(),await Sa(e)):(await e.ma.stop(),e.Pa.length>0&&(Et(ia,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))})),e.ma
1619
1734
  /**
1620
1735
  * @license
1621
1736
  * Copyright 2017 Google LLC
@@ -1631,7 +1746,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1631
1746
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1632
1747
  * See the License for the specific language governing permissions and
1633
1748
  * limitations under the License.
1634
- */class Hh{constructor(){this.Tu=new ua(eo.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):Oi():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class jh{constructor(t,e,n,r,s,i,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,s){const i=[];return e.forEach((t=>{i.push({type:0,doc:t})})),new jh(t,e,Bh.emptySet(e),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&La(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
1749
+ */}class Ma{constructor(e,t,n,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Dt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,s){const i=Date.now()+n,o=new Ma(e,t,i,r,s);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Nt(Ot.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function xa(e,t){if(St("AsyncQueue",`${t}: ${e}`),wn(e))return new Nt(Ot.UNAVAILABLE,`${t}: ${e}`);throw e}
1635
1750
  /**
1636
1751
  * @license
1637
1752
  * Copyright 2017 Google LLC
@@ -1647,7 +1762,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1647
1762
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1648
1763
  * See the License for the specific language governing permissions and
1649
1764
  * limitations under the License.
1650
- */class $h{constructor(){this.Au=void 0,this.listeners=[]}}class qh{constructor(){this.queries=new _c((t=>Pa(t)),La),this.onlineState="Unknown",this.Ru=new Set}}async function Kh(t,e){const n=Li(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new $h),s)try{i.Au=await n.onListen(r)}catch(t){const n=Vh(t,`Initialization of query '${Ma(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Qh(n)}async function Wh(t,e){const n=Li(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function zh(t,e){const n=Li(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.listeners)e.Pu(t)&&(r=!0);s.Au=t}}r&&Qh(n)}function Gh(t,e,n){const r=Li(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Qh(t){t.Ru.forEach((t=>{t.next()}))}class Yh{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new jh(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=jh.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1765
+ */class Ua{static emptySet(e){return new Ua(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||en.comparator(t.key,n.key):(e,t)=>en.comparator(e.key,t.key),this.keyedMap=ls(),this.sortedSet=new Rn(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Ua))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new Ua;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}
1651
1766
  /**
1652
1767
  * @license
1653
1768
  * Copyright 2017 Google LLC
@@ -1663,10 +1778,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1663
1778
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1664
1779
  * See the License for the specific language governing permissions and
1665
1780
  * limitations under the License.
1666
- */class Jh{constructor(t){this.key=t}}class Xh{constructor(t){this.key=t}}class Zh{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Oc(),this.mutatedKeys=Oc(),this.Gu=Ua(t),this.Qu=new Bh(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new Hh,r=e?e.Qu:this.Qu;let s=e?e.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const u=r.get(t),h=xa(this.query,e)?e:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.Hu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Gu(h,a)>0||c&&this.Gu(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(t):s.delete(t)):(i=i.delete(t),s=s.delete(t)))})),null!==this.query.limit)for(;i.size>this.query.limit;){const t="F"===this.query.limitType?i.last():i.first();i=i.delete(t.key),s=s.delete(t.key),n.track({type:1,doc:t})}return{Qu:i,zu:n,$i:o,mutatedKeys:s}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const s=t.zu.Eu();s.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Oi()}};return n(t)-n(e)}
1781
+ */class Fa{constructor(){this.fa=new Rn(en.comparator)}track(e){const t=e.doc.key,n=this.fa.get(t);n?0!==e.type&&3===n.type?this.fa=this.fa.insert(t,e):3===e.type&&1!==n.type?this.fa=this.fa.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.fa=this.fa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.fa=this.fa.remove(t):1===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):At(63341,{At:e,ga:n}):this.fa=this.fa.insert(t,e)}pa(){const e=[];return this.fa.inorderTraversal((t,n)=>{e.push(n)}),e}}class Va{constructor(e,t,n,r,s,i,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,r,s){const i=[];return t.forEach(e=>{i.push({type:0,doc:e})}),new Va(e,t,Ua.emptySet(t),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&ts(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}
1667
1782
  /**
1668
1783
  * @license
1669
- * Copyright 2020 Google LLC
1784
+ * Copyright 2017 Google LLC
1670
1785
  *
1671
1786
  * Licensed under the Apache License, Version 2.0 (the "License");
1672
1787
  * you may not use this file except in compliance with the License.
@@ -1679,7 +1794,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1679
1794
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1680
1795
  * See the License for the specific language governing permissions and
1681
1796
  * limitations under the License.
1682
- */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new jh(this.query,t.Qu,r,s,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hh,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Xh(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Jh(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return jh.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class tl{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class el{constructor(t){this.key=t,this.nc=!1}}class nl{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _c((t=>Pa(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new ua(eo.comparator),this.cc=new Map,this.ac=new Ou,this.hc={},this.lc=new Map,this.fc=bu.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function rl(t,e){const n=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ol.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=_l.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=cl.bind(null,e),e.sc.Wo=zh.bind(null,e.eventManager),e.sc.wc=Gh.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,co.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new _u(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Ra(e));n.isPrimaryClient&&fh(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await Gu(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return gl(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await Gu(t.localStore,e,!0),o=new Zh(e,i.Hi),a=o.Wu(i.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);gl(t,n,u.Xu);const h=new tl(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,r,"current"===i,t.resumeToken)}return s}async function sl(t,e){const n=Li(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await zu(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),ph(n.remoteStore,r.targetId),fl(n,r.targetId)})).catch(ao)):(fl(n,r.targetId),await zu(n.localStore,r.targetId,!0))}async function il(t,e,n){const r=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ul.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hl.bind(null,e),e}(t);try{const t=await function(t,e){const n=Li(t),r=Qi.now(),s=e.reduce(((t,e)=>t.add(e.key)),Oc());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=Ec(),c=Oc();return n.Gi.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=ac(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ma(e.value.mapValue),ec.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:bc(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new ua(zi)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await vl(r,t.changes),await Ah(r.remoteStore)}catch(t){const e=Vh(t,"Failed to persist write");n.reject(e)}}async function ol(t,e){const n=Li(t);try{const t=await Ku(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Di(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Di(r.nc):t.removedDocuments.size>0&&(Di(r.nc),r.nc=!1))})),await vl(n,t,e)}catch(t){await ao(t)}}function al(t,e,n){const r=Li(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Li(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Qh(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function cl(t,e,n){const r=Li(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new ua(eo.comparator);t=t.insert(i,ya.newNoDocument(i,Yi.min()));const n=Oc().add(i),s=new Pc(Yi.min(),new Map,new da(zi),t,n);await ol(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),yl(r)}else await zu(r.localStore,e,!1).then((()=>fl(r,e,n))).catch(ao)}async function ul(t,e){const n=Li(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=co.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Di(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Oc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);dl(n,r,null),ll(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await vl(n,t)}catch(t){await ao(t)}}async function hl(t,e,n){const r=Li(t);try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Di(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);dl(r,e,n),ll(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await vl(r,t)}catch(n){await ao(n)}}function ll(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function dl(t,e,n){const r=Li(t);let s=r.hc[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.hc[r.currentUser.toKey()]=s}}function fl(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||pl(t,e)}))}function pl(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ph(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),yl(t))}function gl(t,e,n){for(const r of n)r instanceof Jh?(t.ac.addReference(r.key,e),ml(t,r)):r instanceof Xh?(Ci("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||pl(t,r.key)):Oi()}function ml(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ci("SyncEngine","New document in limbo: "+n),t.oc.add(r),yl(t))}function yl(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new eo(Xi.fromString(e)),r=t.fc.next();t.cc.set(r,new el(n)),t.uc=t.uc.insert(n,r),fh(t.remoteStore,new _u(Ra(Ia(n.path)),r,2,ho.at))}}async function vl(t,e,n){const r=Li(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Bu.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Li(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>co.forEach(e,(e=>co.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>co.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!uo(t))throw t;Ci("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function wl(t,e){const n=Li(t);if(!n.currentUser.isEqual(e)){Ci("SyncEngine","User change. New user:",e.toKey());const t=await $u(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Mi(Pi.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await vl(n,t.ji)}}function _l(t,e){const n=Li(t),r=n.cc.get(e);if(r&&r.nc)return Oc().add(r.key);{let t=Oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Tl{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=rh(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new ju(t,e,n,r)}(this.persistence,new Hu,t.initialUser,this.yt)}yc(t){return new Uu(Vu.Bs,this.yt)}gc(t){return new Yu}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class El{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>al(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=wl.bind(null,this.syncEngine),await async function(t,e){const n=Li(t);e?(n._u.delete(2),await lh(n)):e||(n._u.add(2),await dh(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new qh}createDatastore(t){const e=rh(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new eh(r));var r;return function(t,e,n,r){return new ch(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>al(this.syncEngine,t,0),i=Xu.C()?new Xu:new Ju,new hh(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new nl(t,e,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Li(t);Ci("RemoteStore","RemoteStore shutting down."),e._u.add(5),await dh(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1797
+ */class ja{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class Ba{constructor(){this.queries=Ha(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=Rt(e),r=n.queries;n.queries=Ha(),r.forEach((e,n)=>{for(const e of n.wa)e.onError(t)})}(this,new Nt(Ot.ABORTED,"Firestore shutting down"))}}function Ha(){return new as(e=>ns(e),ts)}async function $a(e,t){const n=Rt(e);let r=3;const s=t.query;let i=n.queries.get(s);i?!i.Sa()&&t.ba()&&(r=2):(i=new ja,r=t.ba()?0:1);try{switch(r){case 0:i.ya=await n.onListen(s,!0);break;case 1:i.ya=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(e){const n=xa(e,`Initialization of query '${rs(t.query)}' failed`);return void t.onError(n)}n.queries.set(s,i),i.wa.push(t),t.va(n.onlineState),i.ya&&t.Ca(i.ya)&&Ka(n)}async function za(e,t){const n=Rt(e),r=t.query;let s=3;const i=n.queries.get(r);if(i){const e=i.wa.indexOf(t);e>=0&&(i.wa.splice(e,1),0===i.wa.length?s=t.ba()?0:1:!i.Sa()&&t.ba()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function qa(e,t){const n=Rt(e);let r=!1;for(const e of t){const t=e.query,s=n.queries.get(t);if(s){for(const t of s.wa)t.Ca(e)&&(r=!0);s.ya=e}}r&&Ka(n)}function Ga(e,t,n){const r=Rt(e),s=r.queries.get(t);if(s)for(const e of s.wa)e.onError(n);r.queries.delete(t)}function Ka(e){e.Da.forEach(e=>{e.next()})}var Wa,Qa;(Qa=Wa||(Wa={})).Fa="default",Qa.Cache="cache";class Ja{constructor(e,t,n){this.query=e,this.Ma=t,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new Va(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),t=!0):this.Ba(e,this.onlineState)&&(this.La(e),t=!0),this.Oa=e,t}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let t=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),t=!0),t}Ba(e,t){if(!e.fromCache)return!0;if(!this.ba())return!0;const n="Offline"!==t;return(!this.options.ka||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Na(e){if(e.docChanges.length>0)return!0;const t=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}La(e){e=Va.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==Wa.Cache}}
1683
1798
  /**
1684
1799
  * @license
1685
1800
  * Copyright 2017 Google LLC
@@ -1695,7 +1810,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1695
1810
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1696
1811
  * See the License for the specific language governing permissions and
1697
1812
  * limitations under the License.
1698
- */function Sl(t,e,n){if(!n)throw new Mi(Pi.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Il(t){if(!eo.isDocumentKey(t))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function bl(t){if(eo.isDocumentKey(t))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Al(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Oi()}function Cl(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Mi(Pi.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Al(t);throw new Mi(Pi.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
1813
+ */class Ya{constructor(e){this.key=e}}class Xa{constructor(e){this.key=e}}class Za{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=vs(),this.mutatedKeys=vs(),this.Xa=is(e),this.eu=new Ua(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new Fa,r=t?t.eu:this.eu;let s=t?t.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal((e,t)=>{const u=r.get(e),h=ss(this.query,t)?t:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.iu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Xa(h,a)>0||c&&this.Xa(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(e):s.delete(e)):(i=i.delete(e),s=s.delete(e)))}),null!==this.query.limit)for(;i.size>this.query.limit;){const e="F"===this.query.limitType?i.last():i.first();i=i.delete(e.key),s=s.delete(e.key),n.track({type:1,doc:e})}return{eu:i,ru:n,Ds:o,mutatedKeys:s}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){const s=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const i=e.ru.pa();i.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return At(20277,{At:e})}};return n(e)-n(t)}
1699
1814
  /**
1700
1815
  * @license
1701
1816
  * Copyright 2020 Google LLC
@@ -1711,7 +1826,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1711
1826
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1712
1827
  * See the License for the specific language governing permissions and
1713
1828
  * limitations under the License.
1714
- */const kl=new Map;class Nl{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Mi(Pi.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=t.host,this.ssl=null===(e=t.ssl)||void 0===e||e;if(this.credentials=t.credentials,this.ignoreUndefinedProperties=!!t.ignoreUndefinedProperties,void 0===t.cacheSizeBytes)this.cacheSizeBytes=41943040;else{if(-1!==t.cacheSizeBytes&&t.cacheSizeBytes<1048576)throw new Mi(Pi.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Mi(Pi.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}("experimentalForceLongPolling",t.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",t.experimentalAutoDetectLongPolling)}isEqual(t){return this.host===t.host&&this.ssl===t.ssl&&this.credentials===t.credentials&&this.cacheSizeBytes===t.cacheSizeBytes&&this.experimentalForceLongPolling===t.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===t.experimentalAutoDetectLongPolling&&this.ignoreUndefinedProperties===t.ignoreUndefinedProperties&&this.useFetchStreams===t.useFetchStreams}}
1829
+ */(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),r=null!=r&&r;const o=t&&!r?this.ou():[],a=0===this.Za.size&&this.current&&!r?1:0,c=a!==this.Ya;return this.Ya=a,0!==i.length||c?{snapshot:new Va(this.query,e.eu,s,i,e.mutatedKeys,0===a,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Fa,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}ou(){if(!this.current)return[];const e=this.Za;this.Za=vs(),this.eu.forEach(e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))});const t=[];return e.forEach(e=>{this.Za.has(e)||t.push(new Xa(e))}),this.Za.forEach(n=>{e.has(n)||t.push(new Ya(n))}),t}uu(e){this.Ha=e.qs,this.Za=vs();const t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return Va.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}const ec="SyncEngine";class tc{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class nc{constructor(e){this.key=e,this.lu=!1}}class rc{constructor(e,t,n,r,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.hu={},this.Pu=new as(e=>ns(e),ts),this.Tu=new Map,this.Iu=new Set,this.du=new Rn(en.comparator),this.Eu=new Map,this.Au=new go,this.Ru={},this.Vu=new Map,this.mu=no.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function sc(e,t,n=!0){const r=bc(e);let s;const i=r.Pu.get(t);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.cu()):s=await oc(r,t,n,!0),s}async function ic(e,t){const n=bc(e);await oc(n,t,!0,!1)}async function oc(e,t,n,r){const s=await function(e,t){const n=Rt(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let r;return n.hi.getTargetData(e,t).next(s=>s?(r=s,_n.resolve(r)):n.hi.allocateTargetId(e).next(s=>(r=new Wi(t,s,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,r).next(()=>r))))}).then(e=>{const r=n.Fs.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e})}(e.localStore,Xr(t)),i=s.targetId,o=e.sharedClientState.addLocalQueryTarget(i,n);let a;return r&&(a=await async function(e,t,n,r,s){e.gu=(t,n,r)=>async function(e,t,n,r){let s=t.view.nu(n);s.Ds&&(s=await Mo(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,s)));const i=r&&r.targetChanges.get(t.targetId),o=r&&null!=r.targetMismatches.get(t.targetId),a=t.view.applyChanges(s,e.isPrimaryClient,i,o);return _c(e,t.targetId,a._u),a.snapshot}(e,t,n,r);const i=await Mo(e.localStore,t,!0),o=new Za(t,i.qs),a=o.nu(i.documents),c=hi.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,s),u=o.applyChanges(a,e.isPrimaryClient,c);_c(e,n,u._u);const h=new tc(t,n,o);return e.Pu.set(t,h),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),u.snapshot}(e,t,i,"current"===o,s.resumeToken)),e.isPrimaryClient&&n&&ua(e.remoteStore,s),a}async function ac(e,t,n){const r=Rt(e),s=r.Pu.get(t),i=r.Tu.get(s.targetId);if(i.length>1)return r.Tu.set(s.targetId,i.filter(e=>!ts(e,t))),void r.Pu.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Lo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&ha(r.remoteStore,s.targetId),yc(r,s.targetId)}).catch(vn)):(yc(r,s.targetId),await Lo(r.localStore,s.targetId,!0))}async function cc(e,t){const n=Rt(e),r=n.Pu.get(t),s=n.Tu.get(r.targetId);n.isPrimaryClient&&1===s.length&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),ha(n.remoteStore,r.targetId))}async function uc(e,t,n){const r=function(e){const t=Rt(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=fc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=pc.bind(null,t),t}(e);try{const e=await function(e,t){const n=Rt(e),r=dn.now(),s=t.reduce((e,t)=>e.add(t.key),vs());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=us(),c=vs();return n.Os.getEntries(e,s).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(s=>{i=s;const o=[];for(const e of t){const t=Hs(e,i.get(e.key).overlayedDocument);null!=t&&o.push(new qs(e.key,t,_r(t.value.mapValue),xs.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)}).next(t=>{o=t;const r=t.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)})}).then(()=>({batchId:o.batchId,changes:ds(i)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.Ru[e.currentUser.toKey()];r||(r=new Rn(zt)),r=r.insert(t,n),e.Ru[e.currentUser.toKey()]=r}(r,e.batchId,n),await Ec(r,e.changes),await Sa(r.remoteStore)}catch(e){const t=xa(e,"Failed to persist write");n.reject(t)}}async function hc(e,t){const n=Rt(e);try{const e=await Do(n.localStore,t);t.targetChanges.forEach((e,t)=>{const r=n.Eu.get(t);r&&(kt(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.lu=!0:e.modifiedDocuments.size>0?kt(r.lu,14607):e.removedDocuments.size>0&&(kt(r.lu,42227),r.lu=!1))}),await Ec(n,e,t)}catch(e){await vn(e)}}function lc(e,t,n){const r=Rt(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.Pu.forEach((n,r)=>{const s=r.view.va(t);s.snapshot&&e.push(s.snapshot)}),function(e,t){const n=Rt(e);n.onlineState=t;let r=!1;n.queries.forEach((e,n)=>{for(const e of n.wa)e.va(t)&&(r=!0)}),r&&Ka(n)}(r.eventManager,t),e.length&&r.hu.J_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function dc(e,t,n){const r=Rt(e);r.sharedClientState.updateQueryState(t,"rejected",n);const s=r.Eu.get(t),i=s&&s.key;if(i){let e=new Rn(en.comparator);e=e.insert(i,wr.newNoDocument(i,fn.min()));const n=vs().add(i),s=new ui(fn.min(),new Map,new Rn(zt),e,n);await hc(r,s),r.du=r.du.remove(i),r.Eu.delete(t),Tc(r)}else await Lo(r.localStore,t,!1).then(()=>yc(r,t,n)).catch(vn)}async function fc(e,t){const n=Rt(e),r=t.batch.batchId;try{const e=await function(e,t){const n=Rt(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const r=t.batch.keys(),s=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const s=n.batch,i=s.keys();let o=_n.resolve();return i.forEach(e=>{o=o.next(()=>r.getEntry(t,e)).next(t=>{const i=n.docVersions.get(e);kt(null!==i,48541),t.version.compareTo(i)<0&&(s.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,s))}(n,e,t,s).next(()=>s.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=vs();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,r))})}(n.localStore,t);mc(n,r,null),gc(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ec(n,e)}catch(e){await vn(e)}}async function pc(e,t,n){const r=Rt(e);try{const e=await function(e,t){const n=Rt(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(kt(null!==t,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)).next(()=>n.localDocuments.getDocuments(e,r))})}(r.localStore,t);mc(r,t,n),gc(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await Ec(r,e)}catch(n){await vn(n)}}function gc(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function mc(e,t,n){const r=Rt(e);let s=r.Ru[r.currentUser.toKey()];if(s){const e=s.get(t);e&&(n?e.reject(n):e.resolve(),s=s.remove(t)),r.Ru[r.currentUser.toKey()]=s}}function yc(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.Tu.get(t))e.Pu.delete(r),n&&e.hu.pu(r,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||vc(e,t)})}function vc(e,t){e.Iu.delete(t.path.canonicalString());const n=e.du.get(t);null!==n&&(ha(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),Tc(e))}function _c(e,t,n){for(const r of n)r instanceof Ya?(e.Au.addReference(r.key,t),wc(e,r)):r instanceof Xa?(Et(ec,"Document no longer in limbo: "+r.key),e.Au.removeReference(r.key,t),e.Au.containsKey(r.key)||vc(e,r.key)):At(19791,{yu:r})}function wc(e,t){const n=t.key,r=n.path.canonicalString();e.du.get(n)||e.Iu.has(r)||(Et(ec,"New document in limbo: "+n),e.Iu.add(r),Tc(e))}function Tc(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){const t=e.Iu.values().next().value;e.Iu.delete(t);const n=new en(Yt.fromString(t)),r=e.mu.next();e.Eu.set(r,new nc(n)),e.du=e.du.insert(n,r),ua(e.remoteStore,new Wi(Xr(Wr(n.path)),r,"TargetPurposeLimboResolution",Tn.ue))}}async function Ec(e,t,n){const r=Rt(e),s=[],i=[],o=[];r.Pu.isEmpty()||(r.Pu.forEach((e,a)=>{o.push(r.gu(a,t,n).then(e=>{var t;if((e||n)&&r.isPrimaryClient){const s=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;r.sharedClientState.updateQueryState(a.targetId,s?"current":"not-current")}if(e){s.push(e);const t=bo.Es(a.targetId,e);i.push(t)}}))}),await Promise.all(o),r.hu.J_(s),await async function(e,t){const n=Rt(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>_n.forEach(t,t=>_n.forEach(t.Is,r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r)).next(()=>_n.forEach(t.ds,r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))}catch(e){if(!wn(e))throw e;Et(ko,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Fs.get(t),r=e.snapshotVersion,s=e.withLastLimboFreeSnapshotVersion(r);n.Fs=n.Fs.insert(t,s)}}}(r.localStore,i))}async function Sc(e,t){const n=Rt(e);if(!n.currentUser.isEqual(t)){Et(ec,"User change. New user:",t.toKey());const e=await Oo(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new Nt(Ot.CANCELLED,t))})}),e.Vu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ec(n,e.Bs)}}function Ic(e,t){const n=Rt(e),r=n.Eu.get(t);if(r&&r.lu)return vs().add(r.key);{let e=vs();const r=n.Tu.get(t);if(!r)return e;for(const t of r){const r=n.Pu.get(t);e=e.unionWith(r.view.tu)}return e}}function bc(e){const t=Rt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=hc.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ic.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=dc.bind(null,t),t.hu.J_=qa.bind(null,t.eventManager),t.hu.pu=Ga.bind(null,t.eventManager),t}class Ac{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Jo(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){return function(e,t,n,r){return new Ro(e,t,n,r)}(this.persistence,new Co,e.initialUser,this.serializer)}Du(e){return new To(So.Vi,this.serializer)}bu(e){return new Uo}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Ac.provider={build:()=>new Ac};class Cc extends Ac{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){kt(this.persistence.referenceDelegate instanceof Io,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new oo(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?to.withCacheSize(this.cacheSizeBytes):to.DEFAULT;return new To(e=>Io.Vi(e,t),this.serializer)}}class kc{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>lc(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Sc.bind(null,this.syncEngine),await async function(e,t){const n=Rt(e);t?(n.Ia.delete(2),await aa(n)):t||(n.Ia.add(2),await ca(n),n.Aa.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Ba}createDatastore(e){const t=Jo(e.databaseInfo.databaseId),n=function(e){return new Wo(e)}(e.databaseInfo);return function(e,t,n,r){return new ra(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,s){return new oa(e,t,n,r,s)}(this.localStore,this.datastore,e.asyncQueue,e=>lc(this.syncEngine,e,0),jo.C()?new jo:new Fo)}createSyncEngine(e,t){return function(e,t,n,r,s,i,o){const a=new rc(e,t,n,r,s,i);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){const t=Rt(e);Et(ia,"RemoteStore shutting down."),t.Ia.add(5),await ca(t),t.Ea.shutdown(),t.Aa.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate(),null===(t=this.eventManager)||void 0===t||t.terminate()}}kc.provider={build:()=>new kc};
1715
1830
  /**
1716
1831
  * @license
1717
1832
  * Copyright 2020 Google LLC
@@ -1727,10 +1842,10 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1727
1842
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1728
1843
  * See the License for the specific language governing permissions and
1729
1844
  * limitations under the License.
1730
- */class Rl{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Nl({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Mi(Pi.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Mi(Pi.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 Nl(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Fi;switch(t.type){case"gapi":const e=t.client;return new ji(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Mi(Pi.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=kl.get(t);e&&(Ci("ComponentProvider","Removing Datastore"),kl.delete(t),e.terminate())}(this),Promise.resolve()}}function Ol(t,e,n,r={}){var s;const i=(t=Cl(t,Rl))._getSettings();if("firestore.googleapis.com"!==i.host&&i.host!==e&&Ni("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},i),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=Si.MOCK_USER;else{e=
1845
+ */
1731
1846
  /**
1732
1847
  * @license
1733
- * Copyright 2021 Google LLC
1848
+ * Copyright 2017 Google LLC
1734
1849
  *
1735
1850
  * Licensed under the Apache License, Version 2.0 (the "License");
1736
1851
  * you may not use this file except in compliance with the License.
@@ -1744,7 +1859,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1744
1859
  * See the License for the specific language governing permissions and
1745
1860
  * limitations under the License.
1746
1861
  */
1747
- function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,s=t.sub||t.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const i=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},t);return[ee(JSON.stringify({alg:"none",type:"JWT"})),ee(JSON.stringify(i)),""].join(".")}
1862
+ class Rc{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):St("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}
1748
1863
  /**
1749
1864
  * @license
1750
1865
  * Copyright 2017 Google LLC
@@ -1760,10 +1875,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1760
1875
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1761
1876
  * See the License for the specific language governing permissions and
1762
1877
  * limitations under the License.
1763
- */(r.mockUserToken,null===(s=t._app)||void 0===s?void 0:s.options.projectId);const i=r.mockUserToken.sub||r.mockUserToken.user_id;if(!i)throw new Mi(Pi.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new Si(i)}t._authCredentials=new Vi(new Ui(e,n))}}
1878
+ */const Oc="FirestoreClient";class Nc{constructor(e,t,n,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=vt.UNAUTHENTICATED,this.clientId=$t.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(n,async e=>{Et(Oc,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Et(Oc,"Received new app check token=",e),this.appCheckCredentialListener(e,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}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Dt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=xa(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Dc(e,t){e.asyncQueue.verifyOperationInProgress(),Et(Oc,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await Oo(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>{It("Terminating Firestore due to IndexedDb database deletion"),e.terminate().then(()=>{Et("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(e=>{It("Terminating Firestore due to IndexedDb database deletion failed",e)})}),e._offlineComponents=t}async function Pc(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Et(Oc,"Using user provided OfflineComponentProvider");try{await Dc(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===Ot.FAILED_PRECONDITION||e.code===Ot.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;It("Error using user provided cache. Falling back to memory cache: "+n),await Dc(e,new Ac)}}else Et(Oc,"Using default OfflineComponentProvider"),await Dc(e,new Cc(void 0));return e._offlineComponents}(e);Et(Oc,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>Da(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>Da(t.remoteStore,n)),e._onlineComponents=t}async function Lc(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Et(Oc,"Using user provided OnlineComponentProvider"),await Pc(e,e._uninitializedComponentsProvider._online)):(Et(Oc,"Using default OnlineComponentProvider"),await Pc(e,new kc))),e._onlineComponents}async function Mc(e){const t=await Lc(e),n=t.eventManager;return n.onListen=sc.bind(null,t.syncEngine),n.onUnlisten=ac.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=ic.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=cc.bind(null,t.syncEngine),n}
1764
1879
  /**
1765
1880
  * @license
1766
- * Copyright 2020 Google LLC
1881
+ * Copyright 2023 Google LLC
1767
1882
  *
1768
1883
  * Licensed under the Apache License, Version 2.0 (the "License");
1769
1884
  * you may not use this file except in compliance with the License.
@@ -1776,7 +1891,8 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1776
1891
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1777
1892
  * See the License for the specific language governing permissions and
1778
1893
  * limitations under the License.
1779
- */class Dl{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Pl(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Dl(this.firestore,t,this._key)}}class Ll{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Ll(this.firestore,t,this._query)}}class Pl extends Ll{constructor(t,e,n){super(t,e,Ia(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Dl(this.firestore,null,new eo(t))}withConverter(t){return new Pl(this.firestore,t,this._path)}}function Ml(t,e,...n){if(t=ue(t),Sl("collection","path",e),t instanceof Rl){const r=Xi.fromString(e,...n);return bl(r),new Pl(t,null,r)}{if(!(t instanceof Dl||t instanceof Pl))throw new Mi(Pi.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Xi.fromString(e,...n));return bl(r),new Pl(t.firestore,null,r)}}function xl(t,e,...n){if(t=ue(t),1===arguments.length&&(e=Wi.R()),Sl("doc","path",e),t instanceof Rl){const r=Xi.fromString(e,...n);return Il(r),new Dl(t,null,new eo(r))}{if(!(t instanceof Dl||t instanceof Pl))throw new Mi(Pi.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Xi.fromString(e,...n));return Il(r),new Dl(t.firestore,t instanceof Pl?t.converter:null,new eo(r))}}
1894
+ */
1895
+ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t
1780
1896
  /**
1781
1897
  * @license
1782
1898
  * Copyright 2020 Google LLC
@@ -1792,10 +1908,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1792
1908
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1793
1909
  * See the License for the specific language governing permissions and
1794
1910
  * limitations under the License.
1795
- */
1911
+ */}const Uc=new Map,Fc="firestore.googleapis.com",Vc=!0;
1796
1912
  /**
1797
1913
  * @license
1798
- * Copyright 2017 Google LLC
1914
+ * Copyright 2020 Google LLC
1799
1915
  *
1800
1916
  * Licensed under the Apache License, Version 2.0 (the "License");
1801
1917
  * you may not use this file except in compliance with the License.
@@ -1808,10 +1924,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1808
1924
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1809
1925
  * See the License for the specific language governing permissions and
1810
1926
  * limitations under the License.
1811
- */class Ul{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):ki("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
1927
+ */class jc{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new Nt(Ot.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Fc,this.ssl=Vc}else this.host=e.host,this.ssl=null!==(t=e.ssl)&&void 0!==t?t:Vc;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=eo;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Nt(Ot.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new Nt(Ot.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=xc(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Nt(Ot.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Nt(Ot.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Nt(Ot.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}
1812
1928
  /**
1813
1929
  * @license
1814
- * Copyright 2017 Google LLC
1930
+ * Copyright 2020 Google LLC
1815
1931
  *
1816
1932
  * Licensed under the Apache License, Version 2.0 (the "License");
1817
1933
  * you may not use this file except in compliance with the License.
@@ -1824,10 +1940,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1824
1940
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1825
1941
  * See the License for the specific language governing permissions and
1826
1942
  * limitations under the License.
1827
- */class Fl{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=Si.UNAUTHENTICATED,this.clientId=Wi.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Ci("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Ci("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Mi(Pi.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new xi;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Vh(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Vl(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Ci("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Ci("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await $u(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new Tl)),t.offlineComponents}(t);Ci("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Mh(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Mh(e.remoteStore,n))),t.onlineComponents=e}async function Bl(t){return t.onlineComponents||(Ci("FirestoreClient","Using default OnlineComponentProvider"),await Vl(t,new El)),t.onlineComponents}async function Hl(t){const e=await Bl(t),n=e.eventManager;return n.onListen=rl.bind(null,e.syncEngine),n.onUnlisten=sl.bind(null,e.syncEngine),n}class jl{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new sh(this,"async_queue_retry"),this.Wc=()=>{const t=nh();t&&Ci("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=nh();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=nh();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new xi;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!uo(t))throw t;Ci("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
1943
+ */(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(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Bc{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new jc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Nt(Ot.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"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Nt(Ot.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 jc(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Lt;switch(e.type){case"firstParty":return new Ft(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Nt(Ot.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=Uc.get(e);t&&(Et("ComponentProvider","Removing Datastore"),Uc.delete(e),t.terminate())}(this),Promise.resolve()}}function Hc(e,t,n,r={}){var s;e=an(e,Bc);const o=f(t),a=e._getSettings(),c=Object.assign(Object.assign({},a),{emulatorOptions:e._getEmulatorOptions()}),u=`${t}:${n}`;o&&(p(`https://${u}`),y("Firestore",!0)),a.host!==Fc&&a.host!==u&&It("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const h=Object.assign(Object.assign({},a),{host:u,ssl:o,emulatorOptions:r});if(!S(h,c)&&(e._setSettings(h),r.mockUserToken)){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=vt.MOCK_USER;else{t=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e);return[i(JSON.stringify({alg:"none",type:"JWT"})),i(JSON.stringify(o)),""].join(".")}(r.mockUserToken,null===(s=e._app)||void 0===s?void 0:s.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new Nt(Ot.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new vt(o)}e._authCredentials=new Mt(new Pt(t,n))}}
1828
1944
  /**
1829
1945
  * @license
1830
- * Copyright 2017 Google LLC
1946
+ * Copyright 2020 Google LLC
1831
1947
  *
1832
1948
  * Licensed under the Apache License, Version 2.0 (the "License");
1833
1949
  * you may not use this file except in compliance with the License.
@@ -1840,7 +1956,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1840
1956
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1841
1957
  * See the License for the specific language governing permissions and
1842
1958
  * limitations under the License.
1843
- */(t);throw ki("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=Fh.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Oi()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function $l(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
1959
+ */class $c{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new $c(this.firestore,e,this._query)}}class zc{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new qc(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new zc(this.firestore,e,this._key)}toJSON(){return{type:zc._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(un(t,zc._jsonSchema))return new zc(e,n||null,new en(Yt.fromString(t.referencePath)))}}zc._jsonSchemaVersion="firestore/documentReference/1.0",zc._jsonSchema={type:cn("string",zc._jsonSchemaVersion),referencePath:cn("string")};class qc extends $c{constructor(e,t,n){super(e,t,Wr(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new zc(this.firestore,null,new en(e))}withConverter(e){return new qc(this.firestore,e,this._path)}}function Gc(e,t,...n){if(e=O(e),tn("collection","path",t),e instanceof Bc){const r=Yt.fromString(t,...n);return rn(r),new qc(e,null,r)}{if(!(e instanceof zc||e instanceof qc))throw new Nt(Ot.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(Yt.fromString(t,...n));return rn(r),new qc(e.firestore,null,r)}}function Kc(e,t,...n){if(e=O(e),1===arguments.length&&(t=$t.newId()),tn("doc","path",t),e instanceof Bc){const r=Yt.fromString(t,...n);return nn(r),new zc(e,null,new en(r))}{if(!(e instanceof zc||e instanceof qc))throw new Nt(Ot.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(Yt.fromString(t,...n));return nn(r),new zc(e.firestore,e instanceof qc?e.converter:null,new en(r))}}
1844
1960
  /**
1845
1961
  * @license
1846
1962
  * Copyright 2020 Google LLC
@@ -1856,10 +1972,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1856
1972
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1857
1973
  * See the License for the specific language governing permissions and
1858
1974
  * limitations under the License.
1859
- */(t)}class ql extends Rl{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new jl,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||Wl(this),this._firestoreClient.terminate()}}function Kl(t){return t._firestoreClient||Wl(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function Wl(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new lo(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
1975
+ */const Wc="AsyncQueue";class Qc{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new Yo(this,"async_queue_retry"),this.oc=()=>{const e=Qo();e&&Et(Wc,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this._c=e;const t=Qo();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;const t=Qo();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});const t=new Dt;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}async cc(){if(0!==this.Zu.length){try{await this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!wn(e))throw e;Et(Wc,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}}uc(e){const t=this._c.then(()=>(this.nc=!0,e().catch(e=>{throw this.tc=e,this.nc=!1,St("INTERNAL UNHANDLED ERROR: ",Jc(e)),e}).then(e=>(this.nc=!1,e))));return this._c=t,t}enqueueAfterDelay(e,t,n){this.ac(),this.sc.indexOf(e)>-1&&(t=0);const r=Ma.createAndSchedule(this,e,t,n,e=>this.lc(e));return this.ec.push(r),r}ac(){this.tc&&At(47125,{hc:Jc(this.tc)})}verifyOperationInProgress(){}async Pc(){let e;do{e=this._c,await e}while(e!==this._c)}Tc(e){for(const t of this.ec)if(t.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.ec)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){const t=this.ec.indexOf(e);this.ec.splice(t,1)}}function Jc(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t
1860
1976
  /**
1861
1977
  * @license
1862
- * Copyright 2020 Google LLC
1978
+ * Copyright 2017 Google LLC
1863
1979
  *
1864
1980
  * Licensed under the Apache License, Version 2.0 (the "License");
1865
1981
  * you may not use this file except in compliance with the License.
@@ -1872,7 +1988,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1872
1988
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1873
1989
  * See the License for the specific language governing permissions and
1874
1990
  * limitations under the License.
1875
- */(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new Fl(t._authCredentials,t._appCheckCredentials,t._queue,r)}
1991
+ */}function Yc(e){return function(e,t){if("object"!=typeof e||null===e)return!1;const n=e;for(const e of t)if(e in n&&"function"==typeof n[e])return!0;return!1}
1876
1992
  /**
1877
1993
  * @license
1878
1994
  * Copyright 2020 Google LLC
@@ -1888,7 +2004,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1888
2004
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1889
2005
  * See the License for the specific language governing permissions and
1890
2006
  * limitations under the License.
1891
- */
2007
+ */(e,["next","error","complete"])}class Xc extends Bc{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new Qc,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Qc(e),this._firestoreClient=void 0,await e}}}function Zc(e,t){const n="object"==typeof e?e:Ge(),r="string"==typeof e?e:Qn,s=je(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const e=(e=>{const t=u(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]})("firestore");e&&Hc(s,...e)}return s}function eu(e){if(e._terminated)throw new Nt(Ot.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,r;const s=e._freezeSettings(),i=function(e,t,n,r){return new Wn(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,xc(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,s);e._componentsProvider||(null===(n=s.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=s.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._componentsProvider={_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider}),e._firestoreClient=new Nc(e._authCredentials,e._appCheckCredentials,e._queue,i,e._componentsProvider&&function(e){const t=null==e?void 0:e._online.build();return{_offline:null==e?void 0:e._offline.build(t),_online:t}}(e._componentsProvider))}
1892
2008
  /**
1893
2009
  * @license
1894
2010
  * Copyright 2020 Google LLC
@@ -1904,7 +2020,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1904
2020
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1905
2021
  * See the License for the specific language governing permissions and
1906
2022
  * limitations under the License.
1907
- */class zl{constructor(t){this._byteString=t}static fromBase64String(t){try{return new zl(wo.fromBase64String(t))}catch(t){throw new Mi(Pi.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new zl(wo.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
2023
+ */(e),e._firestoreClient}class tu{constructor(e){this._byteString=e}static fromBase64String(e){try{return new tu(xn.fromBase64String(e))}catch(e){throw new Nt(Ot.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new tu(xn.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)}toJSON(){return{type:tu._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(un(e,tu._jsonSchema))return tu.fromBase64String(e.bytes)}}tu._jsonSchemaVersion="firestore/bytes/1.0",tu._jsonSchema={type:cn("string",tu._jsonSchemaVersion),bytes:cn("string")};
1908
2024
  /**
1909
2025
  * @license
1910
2026
  * Copyright 2020 Google LLC
@@ -1920,7 +2036,8 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1920
2036
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1921
2037
  * See the License for the specific language governing permissions and
1922
2038
  * limitations under the License.
1923
- */class Gl{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new to(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}function Ql(){return new Gl("__name__")}
2039
+ */
2040
+ class nu{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new Nt(Ot.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Zt(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function ru(){return new nu(Qt)}
1924
2041
  /**
1925
2042
  * @license
1926
2043
  * Copyright 2020 Google LLC
@@ -1936,7 +2053,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1936
2053
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1937
2054
  * See the License for the specific language governing permissions and
1938
2055
  * limitations under the License.
1939
- */class Yl{constructor(t){this._methodName=t}}
2056
+ */class su{constructor(e){this._methodName=e}}
1940
2057
  /**
1941
2058
  * @license
1942
2059
  * Copyright 2017 Google LLC
@@ -1952,10 +2069,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1952
2069
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1953
2070
  * See the License for the specific language governing permissions and
1954
2071
  * limitations under the License.
1955
- */class Jl{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Mi(Pi.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Mi(Pi.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return zi(this._lat,t._lat)||zi(this._long,t._long)}}
2072
+ */class iu{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new Nt(Ot.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new Nt(Ot.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}_compareTo(e){return zt(this._lat,e._lat)||zt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:iu._jsonSchemaVersion}}static fromJSON(e){if(un(e,iu._jsonSchema))return new iu(e.latitude,e.longitude)}}iu._jsonSchemaVersion="firestore/geoPoint/1.0",iu._jsonSchema={type:cn("string",iu._jsonSchemaVersion),latitude:cn("number"),longitude:cn("number")};
1956
2073
  /**
1957
2074
  * @license
1958
- * Copyright 2017 Google LLC
2075
+ * Copyright 2024 Google LLC
1959
2076
  *
1960
2077
  * Licensed under the Apache License, Version 2.0 (the "License");
1961
2078
  * you may not use this file except in compliance with the License.
@@ -1968,10 +2085,11 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1968
2085
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1969
2086
  * See the License for the specific language governing permissions and
1970
2087
  * limitations under the License.
1971
- */const Xl=/^__.*__$/;class Zl{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function td(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Oi()}}class ed{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new ed(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return dd(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(td(this.sa)&&Xl.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class nd{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||rh(t)}da(t,e,n,r=!1){return new ed({sa:t,methodName:e,fa:n,path:to.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function rd(t){const e=t._freezeSettings(),n=rh(t._databaseId);return new nd(t._databaseId,!!e.ignoreUndefinedProperties,n)}function sd(t,e,n,r,s,i={}){const o=t.da(i.merge||i.mergeFields?2:0,e,n,s);cd("Data must be an object, but it was:",o,r);const a=od(r,o);let c,u;if(i.merge)c=new pa(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const t=[];for(const r of i.mergeFields){const s=ud(e,r,n);if(!o.contains(s))throw new Mi(Pi.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);fd(t,s)||t.push(s)}c=new pa(t),u=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,u=o.fieldTransforms;return new Zl(new ga(a),c,u)}function id(t,e){if(ad(t=ue(t)))return cd("Unsupported field value:",e,t),od(t,e);if(t instanceof Yl)return function(t,e){if(!td(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=id(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Qi.fromDate(t);return{timestampValue:zc(e.yt,n)}}if(t instanceof Qi){const n=new Qi(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:zc(e.yt,n)}}if(t instanceof Jl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof zl)return{bytesValue:Gc(e.yt,t._byteString)};if(t instanceof Dl){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Jc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Al(t)}`)}(t,e)}function od(t,e){const n={};return mo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):go(t,((t,r)=>{const s=id(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function ad(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Qi||t instanceof Jl||t instanceof zl||t instanceof Dl||t instanceof Yl)}function cd(t,e,n){if(!ad(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Al(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function ud(t,e,n){if((e=ue(e))instanceof Gl)return e._internalPath;if("string"==typeof e)return ld(t,e);throw dd("Field path arguments must be of type string or ",t,!1,void 0,n)}const hd=new RegExp("[~\\*/\\[\\]]");function ld(t,e,n){if(e.search(hd)>=0)throw dd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Gl(...e.split("."))._internalPath}catch(r){throw dd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function dd(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Mi(Pi.INVALID_ARGUMENT,a+t+c)}function fd(t,e){return t.some((t=>t.isEqual(e)))}
2088
+ */
2089
+ class ou{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:ou._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(un(e,ou._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new ou(e.vectorValues);throw new Nt(Ot.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}ou._jsonSchemaVersion="firestore/vectorValue/1.0",ou._jsonSchema={type:cn("string",ou._jsonSchemaVersion),vectorValues:cn("object")};
1972
2090
  /**
1973
2091
  * @license
1974
- * Copyright 2020 Google LLC
2092
+ * Copyright 2017 Google LLC
1975
2093
  *
1976
2094
  * Licensed under the Apache License, Version 2.0 (the "License");
1977
2095
  * you may not use this file except in compliance with the License.
@@ -1984,7 +2102,8 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1984
2102
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1985
2103
  * See the License for the specific language governing permissions and
1986
2104
  * limitations under the License.
1987
- */class pd{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Dl(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new gd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class gd extends pd{data(){return super.data()}}function md(t,e){return"string"==typeof e?ld(t,e):e instanceof Gl?e._internalPath:e._delegate._internalPath}
2105
+ */
2106
+ const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new qs(e,this.data,this.fieldMask,t,this.fieldTransforms):new zs(e,this.data,t,this.fieldTransforms)}}function uu(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw At(40011,{Ec:e})}}class hu{constructor(e,t,n,r,s,i){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===s&&this.Ac(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new hu(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Rc({path:n,mc:!1});return r.fc(e),r}gc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Rc({path:n,mc:!1});return r.Ac(),r}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Tu(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(0===e.length)throw this.wc("Document fields must not be empty");if(uu(this.Ec)&&au.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class lu{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Jo(e)}Dc(e,t,n,r=!1){return new hu({Ec:e,methodName:t,bc:n,path:Zt.emptyPath(),mc:!1,Sc:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function du(e){const t=e._freezeSettings(),n=Jo(e._databaseId);return new lu(e._databaseId,!!t.ignoreUndefinedProperties,n)}function fu(e,t,n,r,s,i={}){const o=e.Dc(i.merge||i.mergeFields?2:0,t,n,s);yu("Data must be an object, but it was:",o,r);const a=gu(r,o);let c,u;if(i.merge)c=new Ln(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const e=[];for(const r of i.mergeFields){const s=vu(t,r,n);if(!o.contains(s))throw new Nt(Ot.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);Eu(e,s)||e.push(s)}c=new Ln(e),u=o.fieldTransforms.filter(e=>c.covers(e.field))}else c=null,u=o.fieldTransforms;return new cu(new vr(a),c,u)}function pu(e,t){if(mu(e=O(e)))return yu("Unsupported field value:",t,e),gu(e,t);if(e instanceof su)return function(e,t){if(!uu(t.Ec))throw t.wc(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.wc(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.mc&&4!==t.Ec)throw t.wc("Nested arrays are not supported");return function(e,t){const n=[];let r=0;for(const s of e){let e=pu(s,t.yc(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=O(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Es(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=dn.fromDate(e);return{timestampValue:Si(t.serializer,n)}}if(e instanceof dn){const n=new dn(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Si(t.serializer,n)}}if(e instanceof iu)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof tu)return{bytesValue:Ii(t.serializer,e._byteString)};if(e instanceof zc){const n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.wc(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ci(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof ou)return function(e,t){return{mapValue:{fields:{[Yn]:{stringValue:er},[tr]:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.wc("VectorValues must only contain numeric values.");return ws(t.serializer,e)})}}}}}}(e,t);throw t.wc(`Unsupported field value: ${on(e)}`)}(e,t)}function gu(e,t){const n={};return kn(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):Cn(e,(e,r)=>{const s=pu(r,t.Vc(e));null!=s&&(n[e]=s)}),{mapValue:{fields:n}}}function mu(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof dn||e instanceof iu||e instanceof tu||e instanceof zc||e instanceof su||e instanceof ou)}function yu(e,t,n){if(!mu(n)||!sn(n)){const r=on(n);throw"an object"===r?t.wc(e+" a custom object"):t.wc(e+" "+r)}}function vu(e,t,n){if((t=O(t))instanceof nu)return t._internalPath;if("string"==typeof t)return wu(e,t);throw Tu("Field path arguments must be of type string or ",e,!1,void 0,n)}const _u=new RegExp("[~\\*/\\[\\]]");function wu(e,t,n){if(t.search(_u)>=0)throw Tu(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new nu(...t.split("."))._internalPath}catch(r){throw Tu(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function Tu(e,t,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Nt(Ot.INVALID_ARGUMENT,a+e+c)}function Eu(e,t){return e.some(e=>e.isEqual(t))}
1988
2107
  /**
1989
2108
  * @license
1990
2109
  * Copyright 2020 Google LLC
@@ -2000,7 +2119,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
2000
2119
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2001
2120
  * See the License for the specific language governing permissions and
2002
2121
  * limitations under the License.
2003
- */function yd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Mi(Pi.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class vd{}class wd extends vd{}function _d(t,e,...n){let r=[];e instanceof vd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Sd)).length,n=t.filter((t=>t instanceof Td)).length;if(e>1||e>0&&n>0)throw new Mi(Pi.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(...)))`.")}
2122
+ */class Su{constructor(e,t,n,r,s){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new zc(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Iu(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(bu("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Iu extends Su{data(){return super.data()}}function bu(e,t){return"string"==typeof t?wu(e,t):t instanceof nu?t._internalPath:t._delegate._internalPath}
2004
2123
  /**
2005
2124
  * @license
2006
2125
  * Copyright 2020 Google LLC
@@ -2016,7 +2135,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
2016
2135
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2017
2136
  * See the License for the specific language governing permissions and
2018
2137
  * limitations under the License.
2019
- */(r);for(const e of r)t=e._apply(t);return t}class Td extends wd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Td(t,e,n)}_apply(t){const e=this._parse(t);return Ad(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e))}_parse(t){const e=rd(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){bd(o,i);const e=[];for(const n of o)e.push(Id(r,t,n));a={arrayValue:{values:e}}}else a=Id(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||bd(o,i),a=function(t,e,n,r=!1){return id(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Wo.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function Ed(t,e,n){const r=e,s=md("where",t);return Td._create(s,r,n)}class Sd extends vd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Sd(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:zo.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Ad(n,t),n=Oa(n,t)}(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Id(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ka(e)&&-1!==n.indexOf("/"))throw new Mi(Pi.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(Xi.fromString(n));if(!eo.isDocumentKey(r))throw new Mi(Pi.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 Mo(t,new eo(r))}if(n instanceof Dl)return Mo(t,n._key);throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Al(n)}.`)}function bd(t,e){if(!Array.isArray(t)||0===t.length)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Ad(t,e){if(e.isInequality()){const n=Ca(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Aa(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Cd{convertValue(t,e="none"){switch(ko(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(So(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Oi()}}convertObject(t,e){const n={};return go(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Jl(Eo(t.latitude),Eo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=bo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ao(t));default:return null}}convertTimestamp(t){const e=To(t);return new Qi(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Xi.fromString(t);Di(mu(n));const r=new fo(n.get(1),n.get(3)),s=new eo(n.popFirst(5));return r.isEqual(e)||ki(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
2138
+ */function Au(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new Nt(Ot.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Cu{}class ku extends Cu{}function Ru(e,t,...n){let r=[];t instanceof Cu&&r.push(t),r=r.concat(n),function(e){const t=e.filter(e=>e instanceof Du).length,n=e.filter(e=>e instanceof Ou).length;if(t>1||t>0&&n>0)throw new Nt(Ot.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(...)))`.")}
2020
2139
  /**
2021
2140
  * @license
2022
2141
  * Copyright 2020 Google LLC
@@ -2032,7 +2151,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
2032
2151
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2033
2152
  * See the License for the specific language governing permissions and
2034
2153
  * limitations under the License.
2035
- */
2154
+ */(r);for(const t of r)e=t._apply(e);return e}class Ou extends ku{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Ou(e,t,n)}_apply(e){const t=this._parse(e);return Mu(e._query,t),new $c(e.firestore,e.converter,Zr(e._query,t))}_parse(e){const t=du(e.firestore),n=function(e,t,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Nt(Ot.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Lu(o,i);const t=[];for(const n of o)t.push(Pu(r,e,n));a={arrayValue:{values:t}}}else a=Pu(r,e,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Lu(o,i),a=function(e,t,n,r=!1){return pu(n,e.Dc(r?4:3,t))}(n,t,o,"in"===i||"not-in"===i);return Cr.create(s,i,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Nu(e,t,n){const r=t,s=bu("where",e);return Ou._create(s,r,n)}class Du extends Cu{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Du(e,t)}_parse(e){const t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:kr.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const r=t.getFlattenedFilters();for(const e of r)Mu(n,e),n=Zr(n,e)}(e._query,t),new $c(e.firestore,e.converter,Zr(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Pu(e,t,n){if("string"==typeof(n=O(n))){if(""===n)throw new Nt(Ot.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Jr(t)&&-1!==n.indexOf("/"))throw new Nt(Ot.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=t.path.child(Yt.fromString(n));if(!en.isDocumentKey(r))throw new Nt(Ot.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 lr(e,new en(r))}if(n instanceof zc)return lr(e,n._key);throw new Nt(Ot.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${on(n)}.`)}function Lu(e,t){if(!Array.isArray(e)||0===e.length)throw new Nt(Ot.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Mu(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Nt(Ot.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Nt(Ot.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class xu{convertValue(e,t="none"){switch(nr(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Vn(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(jn(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 At(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return Cn(e,(e,r)=>{n[e]=this.convertValue(r,t)}),n}convertVectorValue(e){var t,n,r;const s=null===(r=null===(n=null===(t=e.fields)||void 0===t?void 0:t[tr].arrayValue)||void 0===n?void 0:n.values)||void 0===r?void 0:r.map(e=>Vn(e.doubleValue));return new ou(s)}convertGeoPoint(e){return new iu(Vn(e.latitude),Vn(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Gn(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Kn(e));default:return null}}convertTimestamp(e){const t=Fn(e);return new dn(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=Yt.fromString(e);kt(Ki(n),9688,{name:e});const r=new Jn(n.get(1),n.get(3)),s=new en(n.popFirst(5));return r.isEqual(t)||St(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}}
2036
2155
  /**
2037
2156
  * @license
2038
2157
  * Copyright 2020 Google LLC
@@ -2048,8 +2167,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
2048
2167
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2049
2168
  * See the License for the specific language governing permissions and
2050
2169
  * limitations under the License.
2051
- */
2052
- class kd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Nd extends pd{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Rd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Rd extends Nd{data(t={}){return super.data(t)}}class Od{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new kd(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Rd(this._firestore,this._userDataWriter,n.key,n,new kd(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Mi(Pi.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Rd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new kd(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Rd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new kd(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Dd(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Dd(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Oi()}}
2170
+ */class Uu{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Fu extends Su{constructor(e,t,n,r,s,i){super(e,t,n,r,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(bu("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Nt(Ot.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Fu._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}Fu._jsonSchemaVersion="firestore/documentSnapshot/1.0",Fu._jsonSchema={type:cn("string",Fu._jsonSchemaVersion),bundleSource:cn("string","DocumentSnapshot"),bundleName:cn("string"),bundle:cn("string")};class Vu extends Fu{data(e={}){return super.data(e)}}class ju{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new Uu(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new Vu(this._firestore,this._userDataWriter,n.key,n,new Uu(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Nt(Ot.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{const r=new Vu(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Uu(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const r=new Vu(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Uu(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let s=-1,i=-1;return 0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),i=n.indexOf(t.doc.key)),{type:Bu(t.type),doc:r,oldIndex:s,newIndex:i}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Nt(Ot.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ju._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=$t.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],r=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),r.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function Bu(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return At(61501,{type:e})}}
2053
2171
  /**
2054
2172
  * @license
2055
2173
  * Copyright 2020 Google LLC
@@ -2065,7 +2183,7 @@ class kd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2065
2183
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2066
2184
  * See the License for the specific language governing permissions and
2067
2185
  * limitations under the License.
2068
- */function Ld(t){t=Cl(t,Dl);const e=Cl(t.firestore,ql);return function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:i=>{e.enqueueAndForget((()=>Wh(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Mi(Pi.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Mi(Pi.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Yh(Ia(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(Kl(e),t._key).then((n=>Fd(e,t,n)))}class Pd extends Cd{constructor(t){super(),this.firestore=t}convertBytes(t){return new zl(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Dl(this.firestore,null,e)}}function Md(t){t=Cl(t,Ll);const e=Cl(t.firestore,ql),n=Kl(e),r=new Pd(e);return yd(t._query),function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:n=>{e.enqueueAndForget((()=>Wh(t,o))),n.fromCache&&"server"===r.source?s.reject(new Mi(Pi.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Yh(n,i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Od(e,r,t,n)))}function xd(t,e,n){t=Cl(t,Dl);const r=Cl(t.firestore,ql),s=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new xi;return t.asyncQueue.enqueueAndForget((async()=>il(await function(t){return Bl(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Kl(t),e)}(r,[sd(rd(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,ec.none())])}function Ud(t,...e){var n,r,s;t=ue(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||$l(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if($l(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof Dl)u=Cl(t.firestore,ql),h=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Fd(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Cl(t,Ll);u=Cl(n.firestore,ql),h=n._query;const r=new Pd(u);c={next:t=>{e[o]&&e[o](new Od(u,r,n,t))},error:e[o+1],complete:e[o+2]},yd(t._query)}return function(t,e,n,r){const s=new Ul(r),i=new Yh(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Kh(await Hl(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Wh(await Hl(t),i)))}}(Kl(u),h,a,c)}function Fd(t,e,n){const r=n.docs.get(e._key),s=new Pd(t);return new Nd(t,s,e._key,r,new kd(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ii=Ut,Dt(new he("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new ql(new Bi(t.getProvider("auth-internal")),new qi(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Mi(Pi.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new fo(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),Bt(Ei,"3.8.0",t),Bt(Ei,"3.8.0","esm2017")}();
2186
+ */function Hu(e){e=an(e,zc);const t=an(e.firestore,Xc);return function(e,t,n={}){const r=new Dt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new Rc({next:a=>{i.Ou(),t.enqueueAndForget(()=>za(e,o));const c=a.docs.has(n);!c&&a.fromCache?s.reject(new Nt(Ot.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&a.fromCache&&r&&"server"===r.source?s.reject(new Nt(Ot.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(a)},error:e=>s.reject(e)}),o=new Ja(Wr(n.path),i,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,r)),r.promise}(eu(t),e._key).then(n=>Ku(t,e,n))}ju._jsonSchemaVersion="firestore/querySnapshot/1.0",ju._jsonSchema={type:cn("string",ju._jsonSchemaVersion),bundleSource:cn("string","QuerySnapshot"),bundleName:cn("string"),bundle:cn("string")};class $u extends xu{constructor(e){super(),this.firestore=e}convertBytes(e){return new tu(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new zc(this.firestore,null,t)}}function zu(e){e=an(e,$c);const t=an(e.firestore,Xc),n=eu(t),r=new $u(t);return Au(e._query),function(e,t,n={}){const r=new Dt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new Rc({next:n=>{i.Ou(),t.enqueueAndForget(()=>za(e,o)),n.fromCache&&"server"===r.source?s.reject(new Nt(Ot.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:e=>s.reject(e)}),o=new Ja(n,i,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,r)),r.promise}(n,e._query).then(n=>new ju(t,r,e,n))}function qu(e,t,n){e=an(e,zc);const r=an(e.firestore,Xc),s=function(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}(e.converter,t,n);return function(e,t){return function(e,t){const n=new Dt;return e.asyncQueue.enqueueAndForget(async()=>uc(await function(e){return Lc(e).then(e=>e.syncEngine)}(e),t,n)),n.promise}(eu(e),t)}(r,[fu(du(r),"setDoc",e._key,s,null!==e.converter,n).toMutation(e._key,xs.none())])}function Gu(e,...t){var n,r,s;e=O(e);let i={includeMetadataChanges:!1,source:"default"},o=0;"object"!=typeof t[o]||Yc(t[o])||(i=t[o++]);const a={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(Yc(t[o])){const e=t[o];t[o]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[o+1]=null===(r=e.error)||void 0===r?void 0:r.bind(e),t[o+2]=null===(s=e.complete)||void 0===s?void 0:s.bind(e)}let c,u,h;if(e instanceof zc)u=an(e.firestore,Xc),h=Wr(e._key.path),c={next:n=>{t[o]&&t[o](Ku(u,e,n))},error:t[o+1],complete:t[o+2]};else{const n=an(e,$c);u=an(n.firestore,Xc),h=n._query;const r=new $u(u);c={next:e=>{t[o]&&t[o](new ju(u,r,n,e))},error:t[o+1],complete:t[o+2]},Au(e._query)}return function(e,t,n,r){const s=new Rc(r),i=new Ja(t,s,n);return e.asyncQueue.enqueueAndForget(async()=>$a(await Mc(e),i)),()=>{s.Ou(),e.asyncQueue.enqueueAndForget(async()=>za(await Mc(e),i))}}(eu(u),h,a,c)}function Ku(e,t,n){const r=n.docs.get(t._key),s=new $u(e);return new Fu(e,s,t._key,r,new Uu(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){_t=e}(ze),Ve(new N("firestore",(e,{instanceIdentifier:n,options:r})=>{const s=e.getProvider("app").getImmediate(),i=new Xc(new xt(e.getProvider("auth-internal")),new jt(s,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Nt(Ot.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Jn(e.options.projectId,t)}(s,n),s);return r=Object.assign({useFetchStreams:t},r),i._setSettings(r),i},"PUBLIC").setMultipleInstances(!0)),Ke(mt,yt,e),Ke(mt,yt,"esm2017")}();
2069
2187
  /**
2070
2188
  * @license
2071
2189
  * Copyright 2020 Google LLC
@@ -2082,7 +2200,7 @@ class kd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2082
2200
  * See the License for the specific language governing permissions and
2083
2201
  * limitations under the License.
2084
2202
  */
2085
- Bt("firebase","10.13.0","app");class Vd{constructor(){}static getInstance(){return Vd.instance||(Vd.instance=new Vd),Vd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Hd.firebase:Bd.firebase}get api(){return"prod"===this.env?Hd.api:Bd.api}get config(){return"prod"===this.env?Hd.config:Bd.config}}const Bd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Hd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var jd=1e3,$d=6e4,qd=36e5,Kd="millisecond",Wd="second",zd="minute",Gd="hour",Qd="day",Yd="week",Jd="month",Xd="quarter",Zd="year",tf="date",ef="Invalid Date",nf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,sf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},of=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},af={s:of,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+of(r,2,"0")+":"+of(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,Jd),i=n-s<0,o=e.clone().add(r+(i?-1:1),Jd);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Jd,y:Zd,w:Yd,d:Qd,D:tf,h:Gd,m:zd,s:Wd,ms:Kd,Q:Xd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},cf="en",uf={};uf[cf]=sf;var hf="$isDayjsObject",lf=function(t){return t instanceof gf||!(!t||!t[hf])},df=function t(e,n,r){var s;if(!e)return cf;if("string"==typeof e){var i=e.toLowerCase();uf[i]&&(s=i),n&&(uf[i]=n,s=i);var o=e.split("-");if(!s&&o.length>1)return t(o[0])}else{var a=e.name;uf[a]=e,s=a}return!r&&s&&(cf=s),s||!r&&cf},ff=function(t,e){if(lf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new gf(n)},pf=af;pf.l=df,pf.i=lf,pf.w=function(t,e){return ff(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var gf=function(){function t(t){this.$L=df(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[hf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(pf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(nf);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return pf},e.isValid=function(){return!(this.$d.toString()===ef)},e.isSame=function(t,e){var n=ff(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return ff(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<ff(t)},e.$g=function(t,e,n){return pf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!pf.u(e)||e,s=pf.p(t),i=function(t,e){var s=pf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(Qd)},o=function(t,e){return pf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case Zd:return r?i(1,0):i(31,11);case Jd:return r?i(1,c):i(0,c+1);case Yd:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case Qd:case tf:return o(h+"Hours",0);case Gd:return o(h+"Minutes",1);case zd:return o(h+"Seconds",2);case Wd:return o(h+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=pf.p(t),s="set"+(this.$u?"UTC":""),i=(n={},n[Qd]=s+"Date",n[tf]=s+"Date",n[Jd]=s+"Month",n[Zd]=s+"FullYear",n[Gd]=s+"Hours",n[zd]=s+"Minutes",n[Wd]=s+"Seconds",n[Kd]=s+"Milliseconds",n)[r],o=r===Qd?this.$D+(e-this.$W):e;if(r===Jd||r===Zd){var a=this.clone().set(tf,1);a.$d[i](o),a.init(),this.$d=a.set(tf,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[pf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var s=pf.p(e),i=function(e){var n=ff(r);return pf.w(n.date(n.date()+Math.round(e*t)),r)};if(s===Jd)return this.set(Jd,this.$M+t);if(s===Zd)return this.set(Zd,this.$y+t);if(s===Qd)return i(1);if(s===Yd)return i(7);var o=(n={},n[zd]=$d,n[Gd]=qd,n[Wd]=jd,n)[s]||1,a=this.$d.getTime()+t*o;return pf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||ef;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=pf.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].slice(0,i)},d=function(t){return pf.s(i%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(rf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return pf.s(e.$y,4,"0");case"M":return a+1;case"MM":return pf.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return e.$D;case"DD":return pf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(n.weekdaysMin,e.$W,c,2);case"ddd":return l(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(i);case"HH":return pf.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return pf.s(o,2,"0");case"s":return String(e.$s);case"ss":return pf.s(e.$s,2,"0");case"SSS":return pf.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,s=this,i=pf.p(e),o=ff(t),a=(o.utcOffset()-this.utcOffset())*$d,c=this-o,u=function(){return pf.m(s,o)};switch(i){case Zd:r=u()/12;break;case Jd:r=u();break;case Xd:r=u()/3;break;case Yd:r=(c-a)/6048e5;break;case Qd:r=(c-a)/864e5;break;case Gd:r=c/qd;break;case zd:r=c/$d;break;case Wd:r=c/jd;break;default:r=c}return n?r:pf.a(r)},e.daysInMonth=function(){return this.endOf(Jd).$D},e.$locale=function(){return uf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=df(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return pf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),mf=gf.prototype;function yf(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n}function vf(){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."}}ff.prototype=mf,[["$ms",Kd],["$s",Wd],["$m",zd],["$H",Gd],["$W",Qd],["$M",Jd],["$y",Zd],["$D",tf]].forEach((function(t){mf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),ff.extend=function(t,e){return t.$i||(t(e,gf,ff),t.$i=!0),ff},ff.locale=df,ff.isDayjs=lf,ff.unix=function(t){return ff(1e3*t)},ff.en=uf[cf],ff.Ls=uf,ff.p={},"function"==typeof SuppressedError&&SuppressedError;const wf=vf,_f=new p("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Tf="auth/user-disabled",Ef=new L("@firebase/auth");function Sf(t,...e){Ef.logLevel<=k.ERROR&&Ef.error(`Auth (${Ut}): ${t}`,...e)}
2203
+ Ke("firebase","11.10.0","app");class Wu{constructor(){}static getInstance(){return Wu.instance||(Wu.instance=new Wu),Wu.instance}setEnv(e){switch(e){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Ju.firebase:Qu.firebase}get api(){return"prod"===this.env?Ju.api:Qu.api}get config(){return"prod"===this.env?Ju.config:Qu.config}}const Qu={firebase:{apiKey:process.env.DEV_FIREBASE_API_KEY,authDomain:process.env.DEV_FIREBASE_AUTH_DOMAIN,projectId:process.env.DEV_FIREBASE_PROJECT_ID,storageBucket:process.env.DEV_FIREBASE_STORAGE_BUCKET,messagingSenderId:process.env.DEV_FIREBASE_MESSAGING_SENDER_ID,appId:process.env.DEV_FIREBASE_APP_ID},api:{url:process.env.DEV_API_ENDPOINT},config:{avatarTimeout:Number(process.env.DEV_AVATAR_TIMEOUT_MS),vtoTimeout:Number(process.env.DEV_VTO_TIMEOUT_MS)}},Ju={firebase:{apiKey:process.env.PROD_FIREBASE_API_KEY,authDomain:process.env.PROD_FIREBASE_AUTH_DOMAIN,projectId:process.env.PROD_FIREBASE_PROJECT_ID,storageBucket:process.env.PROD_FIREBASE_STORAGE_BUCKET,messagingSenderId:process.env.PROD_FIREBASE_MESSAGING_SENDER_ID,appId:process.env.PROD_FIREBASE_APP_ID},api:{url:process.env.PROD_API_ENDPOINT},config:{avatarTimeout:Number(process.env.PROD_AVATAR_TIMEOUT_MS),vtoTimeout:Number(process.env.PROD_VTO_TIMEOUT_MS)}};var Yu=1e3,Xu=6e4,Zu=36e5,eh="millisecond",th="second",nh="minute",rh="hour",sh="day",ih="week",oh="month",ah="quarter",ch="year",uh="date",hh="Invalid Date",lh=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,dh=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,fh={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},ph=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},gh={s:ph,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),s=n%60;return(t<=0?"+":"-")+ph(r,2,"0")+":"+ph(s,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),s=t.clone().add(r,oh),i=n-s<0,o=t.clone().add(r+(i?-1:1),oh);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:oh,y:ch,w:ih,d:sh,D:uh,h:rh,m:nh,s:th,ms:eh,Q:ah}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},mh="en",yh={};yh[mh]=fh;var vh="$isDayjsObject",_h=function(e){return e instanceof Sh||!(!e||!e[vh])},wh=function e(t,n,r){var s;if(!t)return mh;if("string"==typeof t){var i=t.toLowerCase();yh[i]&&(s=i),n&&(yh[i]=n,s=i);var o=t.split("-");if(!s&&o.length>1)return e(o[0])}else{var a=t.name;yh[a]=t,s=a}return!r&&s&&(mh=s),s||!r&&mh},Th=function(e,t){if(_h(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new Sh(n)},Eh=gh;Eh.l=wh,Eh.i=_h,Eh.w=function(e,t){return Th(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var Sh=function(){function e(e){this.$L=wh(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[vh]=!0}var t=e.prototype;return t.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(Eh.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(lh);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},t.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},t.$utils=function(){return Eh},t.isValid=function(){return!(this.$d.toString()===hh)},t.isSame=function(e,t){var n=Th(e);return this.startOf(t)<=n&&n<=this.endOf(t)},t.isAfter=function(e,t){return Th(e)<this.startOf(t)},t.isBefore=function(e,t){return this.endOf(t)<Th(e)},t.$g=function(e,t,n){return Eh.u(e)?this[t]:this.set(n,e)},t.unix=function(){return Math.floor(this.valueOf()/1e3)},t.valueOf=function(){return this.$d.getTime()},t.startOf=function(e,t){var n=this,r=!!Eh.u(t)||t,s=Eh.p(e),i=function(e,t){var s=Eh.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?s:s.endOf(sh)},o=function(e,t){return Eh.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case ch:return r?i(1,0):i(31,11);case oh:return r?i(1,c):i(0,c+1);case ih:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case sh:case uh:return o(h+"Hours",0);case rh:return o(h+"Minutes",1);case nh:return o(h+"Seconds",2);case th:return o(h+"Milliseconds",3);default:return this.clone()}},t.endOf=function(e){return this.startOf(e,!1)},t.$set=function(e,t){var n,r=Eh.p(e),s="set"+(this.$u?"UTC":""),i=(n={},n[sh]=s+"Date",n[uh]=s+"Date",n[oh]=s+"Month",n[ch]=s+"FullYear",n[rh]=s+"Hours",n[nh]=s+"Minutes",n[th]=s+"Seconds",n[eh]=s+"Milliseconds",n)[r],o=r===sh?this.$D+(t-this.$W):t;if(r===oh||r===ch){var a=this.clone().set(uh,1);a.$d[i](o),a.init(),this.$d=a.set(uh,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},t.set=function(e,t){return this.clone().$set(e,t)},t.get=function(e){return this[Eh.p(e)]()},t.add=function(e,t){var n,r=this;e=Number(e);var s=Eh.p(t),i=function(t){var n=Th(r);return Eh.w(n.date(n.date()+Math.round(t*e)),r)};if(s===oh)return this.set(oh,this.$M+e);if(s===ch)return this.set(ch,this.$y+e);if(s===sh)return i(1);if(s===ih)return i(7);var o=(n={},n[nh]=Xu,n[rh]=Zu,n[th]=Yu,n)[s]||1,a=this.$d.getTime()+e*o;return Eh.w(a,this)},t.subtract=function(e,t){return this.add(-1*e,t)},t.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||hh;var r=e||"YYYY-MM-DDTHH:mm:ssZ",s=Eh.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(e,n,s,i){return e&&(e[n]||e(t,r))||s[n].slice(0,i)},d=function(e){return Eh.s(i%12||12,e,"0")},f=h||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(dh,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return Eh.s(t.$y,4,"0");case"M":return a+1;case"MM":return Eh.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return t.$D;case"DD":return Eh.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return l(n.weekdaysMin,t.$W,c,2);case"ddd":return l(n.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(i);case"HH":return Eh.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return Eh.s(o,2,"0");case"s":return String(t.$s);case"ss":return Eh.s(t.$s,2,"0");case"SSS":return Eh.s(t.$ms,3,"0");case"Z":return s}return null}(e)||s.replace(":","")})},t.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},t.diff=function(e,t,n){var r,s=this,i=Eh.p(t),o=Th(e),a=(o.utcOffset()-this.utcOffset())*Xu,c=this-o,u=function(){return Eh.m(s,o)};switch(i){case ch:r=u()/12;break;case oh:r=u();break;case ah:r=u()/3;break;case ih:r=(c-a)/6048e5;break;case sh:r=(c-a)/864e5;break;case rh:r=c/Zu;break;case nh:r=c/Xu;break;case th:r=c/Yu;break;default:r=c}return n?r:Eh.a(r)},t.daysInMonth=function(){return this.endOf(oh).$D},t.$locale=function(){return yh[this.$L]},t.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=wh(e,t,!0);return r&&(n.$L=r),n},t.clone=function(){return Eh.w(this.$d,this)},t.toDate=function(){return new Date(this.valueOf())},t.toJSON=function(){return this.isValid()?this.toISOString():null},t.toISOString=function(){return this.$d.toISOString()},t.toString=function(){return this.$d.toUTCString()},e}(),Ih=Sh.prototype;function bh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}function Ah(){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."}}Th.prototype=Ih,[["$ms",eh],["$s",th],["$m",nh],["$H",rh],["$W",sh],["$M",oh],["$y",ch],["$D",uh]].forEach(function(e){Ih[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),Th.extend=function(e,t){return e.$i||(e(t,Sh,Th),e.$i=!0),Th},Th.locale=wh,Th.isDayjs=_h,Th.unix=function(e){return Th(1e3*e)},Th.en=yh[mh],Th.Ls=yh,Th.p={},"function"==typeof SuppressedError&&SuppressedError;const Ch=Ah,kh=new T("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Rh="auth/user-disabled",Oh=new j("@firebase/auth");function Nh(e,...t){Oh.logLevel<=M.ERROR&&Oh.error(`Auth (${ze}): ${e}`,...t)}
2086
2204
  /**
2087
2205
  * @license
2088
2206
  * Copyright 2020 Google LLC
@@ -2098,7 +2216,7 @@ Bt("firebase","10.13.0","app");class Vd{constructor(){}static getInstance(){retu
2098
2216
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2099
2217
  * See the License for the specific language governing permissions and
2100
2218
  * limitations under the License.
2101
- */function If(t,...e){throw kf(t,...e)}function bf(t,...e){return kf(t,...e)}function Af(t,e,n){const r=Object.assign(Object.assign({},wf()),{[e]:n});return new p("auth","Firebase",r).create(e,{appName:t.name})}function Cf(t){return Af(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function kf(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return _f.create(t,...e)}function Nf(t,e,...n){if(!t)throw kf(e,...n)}function Rf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Sf(e),new Error(e)}function Of(t,e){t||Rf(e)}
2219
+ */function Dh(e,...t){throw xh(e,...t)}function Ph(e,...t){return xh(e,...t)}function Lh(e,t,n){const r=Object.assign(Object.assign({},Ch()),{[t]:n});return new T("auth","Firebase",r).create(t,{appName:e.name})}function Mh(e){return Lh(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function xh(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return kh.create(e,...t)}function Uh(e,t,...n){if(!e)throw xh(t,...n)}function Fh(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Nh(t),new Error(t)}function Vh(e,t){e||Fh(t)}
2102
2220
  /**
2103
2221
  * @license
2104
2222
  * Copyright 2020 Google LLC
@@ -2114,7 +2232,7 @@ Bt("firebase","10.13.0","app");class Vd{constructor(){}static getInstance(){retu
2114
2232
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2115
2233
  * See the License for the specific language governing permissions and
2116
2234
  * limitations under the License.
2117
- */function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Lf(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2235
+ */function jh(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Bh(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}
2118
2236
  /**
2119
2237
  * @license
2120
2238
  * Copyright 2020 Google LLC
@@ -2130,7 +2248,7 @@ Bt("firebase","10.13.0","app");class Vd{constructor(){}static getInstance(){retu
2130
2248
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2131
2249
  * See the License for the specific language governing permissions and
2132
2250
  * limitations under the License.
2133
- */function Pf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Lf()&&"https:"!==Lf()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2251
+ */function Hh(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Bh()&&"https:"!==Bh()&&!function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()&&!("connection"in navigator)||navigator.onLine}
2134
2252
  /**
2135
2253
  * @license
2136
2254
  * Copyright 2020 Google LLC
@@ -2147,7 +2265,7 @@ Bt("firebase","10.13.0","app");class Vd{constructor(){}static getInstance(){retu
2147
2265
  * See the License for the specific language governing permissions and
2148
2266
  * limitations under the License.
2149
2267
  */
2150
- class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Pf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2268
+ class $h{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vh(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Hh()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2151
2269
  /**
2152
2270
  * @license
2153
2271
  * Copyright 2020 Google LLC
@@ -2163,7 +2281,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2163
2281
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2164
2282
  * See the License for the specific language governing permissions and
2165
2283
  * limitations under the License.
2166
- */function xf(t,e){Of(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2284
+ */function zh(e,t){Vh(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}
2167
2285
  /**
2168
2286
  * @license
2169
2287
  * Copyright 2020 Google LLC
@@ -2179,7 +2297,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2179
2297
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2180
2298
  * See the License for the specific language governing permissions and
2181
2299
  * limitations under the License.
2182
- */class Uf{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Rf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Rf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Rf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2300
+ */class qh{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Fh("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Fh("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Fh("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2183
2301
  /**
2184
2302
  * @license
2185
2303
  * Copyright 2020 Google LLC
@@ -2195,7 +2313,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2195
2313
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2196
2314
  * See the License for the specific language governing permissions and
2197
2315
  * limitations under the License.
2198
- */const Ff={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"},Vf=new Mf(3e4,6e4);
2316
+ */const Gh={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"},Kh=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Wh=new $h(3e4,6e4);
2199
2317
  /**
2200
2318
  * @license
2201
2319
  * Copyright 2020 Google LLC
@@ -2211,7 +2329,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2211
2329
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2212
2330
  * See the License for the specific language governing permissions and
2213
2331
  * limitations under the License.
2214
- */function Bf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Hf(t,e,n,r,s={}){return jf(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=v(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Uf.fetch()(qf(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function jf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ff),e);try{const e=new Wf(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw zf(t,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const e=s.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw zf(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw zf(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw zf(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Af(t,a,o);If(t,a)}}catch(e){if(e instanceof f)throw e;If(t,"network-request-failed",{message:String(e)})}}async function $f(t,e,n,r,s={}){const i=await Hf(t,e,n,r,s);return"mfaPendingCredential"in i&&If(t,"multi-factor-auth-required",{_serverResponse:i}),i}function qf(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?xf(t.config,s):`${t.config.apiScheme}://${s}`}function Kf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Wf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(bf(this.auth,"network-request-failed"))),Vf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function zf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=bf(t,e,r);return s.customData._tokenResponse=n,s}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class Qf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return Kf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Yf(t,e){return Hf(t,"POST","/v1/accounts:lookup",e)}
2332
+ */function Qh(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Jh(e,t,n,r,s={}){return Yh(e,s,async()=>{let s={},i={};r&&("GET"===t?i=r:s={body:JSON.stringify(r)});const o=b(Object.assign({key:e.config.apiKey},i)).slice(1),a=await e._getAdditionalHeaders();a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode);const c=Object.assign({method:t,headers:a},s);return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&f(e.emulatorConfig.host)&&(c.credentials="include"),qh.fetch()(await Zh(e,e.config.apiHost,n,o),c)})}async function Yh(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Gh),t);try{const t=new tl(e),s=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw nl(e,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const t=s.ok?i.errorMessage:i.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw nl(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw nl(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw nl(e,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Lh(e,a,o);Dh(e,a)}}catch(t){if(t instanceof w)throw t;Dh(e,"network-request-failed",{message:String(t)})}}async function Xh(e,t,n,r,s={}){const i=await Jh(e,t,n,r,s);return"mfaPendingCredential"in i&&Dh(e,"multi-factor-auth-required",{_serverResponse:i}),i}async function Zh(e,t,n,r){const s=`${t}${n}?${r}`,i=e,o=i.config.emulator?zh(e.config,s):`${e.config.apiScheme}://${s}`;if(Kh.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(o).toString()}return o}function el(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class tl{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(Ph(this.auth,"network-request-failed")),Wh.get())})}}function nl(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Ph(e,t,r);return s.customData._tokenResponse=n,s}function rl(e){return void 0!==e&&void 0!==e.enterprise}class sl{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return el(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function il(e,t){return Jh(e,"POST","/v1/accounts:lookup",t)}
2215
2333
  /**
2216
2334
  * @license
2217
2335
  * Copyright 2020 Google LLC
@@ -2227,7 +2345,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2227
2345
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2228
2346
  * See the License for the specific language governing permissions and
2229
2347
  * limitations under the License.
2230
- */function Jf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Xf(t){return 1e3*Number(t)}function Zf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return Sf("JWT malformed, contained fewer than 3 sections"),null;try{const t=o(n);return t?JSON.parse(t):(Sf("Failed to decode base64 JWT payload"),null)}catch(t){return Sf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function tp(t){const e=Zf(t);return Nf(e,"internal-error"),Nf(void 0!==e.exp,"internal-error"),Nf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2348
+ */function ol(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function al(e){return 1e3*Number(e)}function cl(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return Nh("JWT malformed, contained fewer than 3 sections"),null;try{const e=o(n);return e?JSON.parse(e):(Nh("Failed to decode base64 JWT payload"),null)}catch(e){return Nh("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function ul(e){const t=cl(e);return Uh(t,"internal-error"),Uh(void 0!==t.exp,"internal-error"),Uh(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}
2231
2349
  /**
2232
2350
  * @license
2233
2351
  * Copyright 2020 Google LLC
@@ -2243,7 +2361,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2243
2361
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2244
2362
  * See the License for the specific language governing permissions and
2245
2363
  * limitations under the License.
2246
- */async function ep(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof f&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2364
+ */async function hl(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof w&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}
2247
2365
  /**
2248
2366
  * @license
2249
2367
  * Copyright 2020 Google LLC
@@ -2259,7 +2377,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2259
2377
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2260
2378
  * See the License for the specific language governing permissions and
2261
2379
  * limitations under the License.
2262
- */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class np{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
2380
+ */(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class ll{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}
2263
2381
  /**
2264
2382
  * @license
2265
2383
  * Copyright 2020 Google LLC
@@ -2275,7 +2393,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2275
2393
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2276
2394
  * See the License for the specific language governing permissions and
2277
2395
  * limitations under the License.
2278
- */class rp{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Jf(this.lastLoginAt),this.creationTime=Jf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2396
+ */class dl{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ol(this.lastLoginAt),this.creationTime=ol(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2279
2397
  /**
2280
2398
  * @license
2281
2399
  * Copyright 2019 Google LLC
@@ -2291,7 +2409,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2291
2409
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2292
2410
  * See the License for the specific language governing permissions and
2293
2411
  * limitations under the License.
2294
- */async function sp(t){var e;const n=t.auth,r=await t.getIdToken(),s=await ep(t,Yf(n,{idToken:r}));Nf(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?ip(i.providerUserInfo):[],a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new rp(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}function ip(t){return t.map((t=>{var{providerId:e}=t,n=yf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
2412
+ */async function fl(e){var t;const n=e.auth,r=await e.getIdToken(),s=await hl(e,il(n,{idToken:r}));Uh(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];e._notifyReloadListener(i);const o=(null===(t=i.providerUserInfo)||void 0===t?void 0:t.length)?pl(i.providerUserInfo):[],a=(c=e.providerData,u=o,[...c.filter(e=>!u.some(t=>t.providerId===e.providerId)),...u]);var c,u;const h=e.isAnonymous,l=!(e.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new dl(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(e,f)}function pl(e){return e.map(e=>{var{providerId:t}=e,n=bh(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}
2295
2413
  /**
2296
2414
  * @license
2297
2415
  * Copyright 2020 Google LLC
@@ -2324,7 +2442,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay
2324
2442
  * See the License for the specific language governing permissions and
2325
2443
  * limitations under the License.
2326
2444
  */
2327
- class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Nf(t.idToken,"internal-error"),Nf(void 0!==t.idToken,"internal-error"),Nf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):tp(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Nf(0!==t.length,"internal-error");const e=tp(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Nf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:s}=await async function(t,e){const n=await jf(t,{},(async()=>{const n=v({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=qf(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Uf.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new op;return n&&(Nf("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(Nf("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(Nf("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new op,this.toJSON())}_performRefresh(){return Rf("not implemented")}}
2445
+ class gl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Uh(e.idToken,"internal-error"),Uh(void 0!==e.idToken,"internal-error"),Uh(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):ul(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){Uh(0!==e.length,"internal-error");const t=ul(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(Uh(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:n,refreshToken:r,expiresIn:s}=await async function(e,t){const n=await Yh(e,{},async()=>{const n=b({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:s}=e.config,i=await Zh(e,r,"/v1/token",`key=${s}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return e.emulatorConfig&&f(e.emulatorConfig.host)&&(a.credentials="include"),qh.fetch()(i,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:s}=t,i=new gl;return n&&(Uh("string"==typeof n,"internal-error",{appName:e}),i.refreshToken=n),r&&(Uh("string"==typeof r,"internal-error",{appName:e}),i.accessToken=r),s&&(Uh("number"==typeof s,"internal-error",{appName:e}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new gl,this.toJSON())}_performRefresh(){return Fh("not implemented")}}
2328
2446
  /**
2329
2447
  * @license
2330
2448
  * Copyright 2020 Google LLC
@@ -2340,7 +2458,7 @@ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2340
2458
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2341
2459
  * See the License for the specific language governing permissions and
2342
2460
  * limitations under the License.
2343
- */function ap(t,e){Nf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class cp{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=yf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new np(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new rp(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await ep(this,this.stsTokenManager.getToken(this.auth,t));return Nf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=S(t),r=await n.getIdToken(e),s=Zf(r);Nf(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Jf(Xf(s.auth_time)),issuedAtTime:Jf(Xf(s.iat)),expirationTime:Jf(Xf(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=S(t);await sp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Nf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new cp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Nf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await sp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Cf(this.auth));const t=await this.getIdToken();return await ep(this,
2461
+ */function ml(e,t){Uh("string"==typeof e||void 0===e,"internal-error",{appName:t})}class yl{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,s=bh(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ll(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new dl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await hl(this,this.stsTokenManager.getToken(this.auth,e));return Uh(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=O(e),r=await n.getIdToken(t),s=cl(r);Uh(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:ol(al(s.auth_time)),issuedAtTime:ol(al(s.iat)),expirationTime:ol(al(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=O(e);await fl(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Uh(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new yl(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){Uh(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await fl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Be(this.auth.app))return Promise.reject(Mh(this.auth));const e=await this.getIdToken();return await hl(this,
2344
2462
  /**
2345
2463
  * @license
2346
2464
  * Copyright 2020 Google LLC
@@ -2357,7 +2475,7 @@ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2357
2475
  * See the License for the specific language governing permissions and
2358
2476
  * limitations under the License.
2359
2477
  */
2360
- async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:E}=e;Nf(v&&E,t,"internal-error");const S=op.fromJSON(this.name,E);Nf("string"==typeof v,t,"internal-error"),ap(h,t.name),ap(l,t.name),Nf("boolean"==typeof w,t,"internal-error"),Nf("boolean"==typeof _,t,"internal-error"),ap(d,t.name),ap(f,t.name),ap(p,t.name),ap(g,t.name),ap(m,t.name),ap(y,t.name);const I=new cp({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const r=new op;r.updateFromServerResponse(e);const s=new cp({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await sp(s),s}static async _fromGetAccountInfoResponse(t,e,n){const r=e.users[0];Nf(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?ip(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||(null==s?void 0:s.length)),o=new op;o.updateFromIdToken(n);const a=new cp({uid:r.localId,auth:t,stsTokenManager:o,isAnonymous:i}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new rp(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==s?void 0:s.length))};return Object.assign(a,c),a}}
2478
+ async function(e,t){return Jh(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,r,s,i,o,a,c,u;const h=null!==(n=t.displayName)&&void 0!==n?n:void 0,l=null!==(r=t.email)&&void 0!==r?r:void 0,d=null!==(s=t.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=t.photoURL)&&void 0!==i?i:void 0,p=null!==(o=t.tenantId)&&void 0!==o?o:void 0,g=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(u=t.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:_,isAnonymous:w,providerData:T,stsTokenManager:E}=t;Uh(v&&E,e,"internal-error");const S=gl.fromJSON(this.name,E);Uh("string"==typeof v,e,"internal-error"),ml(h,e.name),ml(l,e.name),Uh("boolean"==typeof _,e,"internal-error"),Uh("boolean"==typeof w,e,"internal-error"),ml(d,e.name),ml(f,e.name),ml(p,e.name),ml(g,e.name),ml(m,e.name),ml(y,e.name);const I=new yl({uid:v,auth:e,email:l,emailVerified:_,displayName:h,isAnonymous:w,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map(e=>Object.assign({},e))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(e,t,n=!1){const r=new gl;r.updateFromServerResponse(t);const s=new yl({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await fl(s),s}static async _fromGetAccountInfoResponse(e,t,n){const r=t.users[0];Uh(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?pl(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||(null==s?void 0:s.length)),o=new gl;o.updateFromIdToken(n);const a=new yl({uid:r.localId,auth:e,stsTokenManager:o,isAnonymous:i}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new dl(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==s?void 0:s.length))};return Object.assign(a,c),a}}
2361
2479
  /**
2362
2480
  * @license
2363
2481
  * Copyright 2020 Google LLC
@@ -2373,7 +2491,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2373
2491
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2374
2492
  * See the License for the specific language governing permissions and
2375
2493
  * limitations under the License.
2376
- */const up=new Map;function hp(t){Of(t instanceof Function,"Expected a class definition");let e=up.get(t);return e?(Of(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,up.set(t,e),e)}
2494
+ */const vl=new Map;function _l(e){Vh(e instanceof Function,"Expected a class definition");let t=vl.get(e);return t?(Vh(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,vl.set(e,t),t)}
2377
2495
  /**
2378
2496
  * @license
2379
2497
  * Copyright 2019 Google LLC
@@ -2389,7 +2507,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2389
2507
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2390
2508
  * See the License for the specific language governing permissions and
2391
2509
  * limitations under the License.
2392
- */class lp{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}lp.type="NONE";const dp=lp;
2510
+ */class wl{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}wl.type="NONE";const Tl=wl;
2393
2511
  /**
2394
2512
  * @license
2395
2513
  * Copyright 2019 Google LLC
@@ -2405,7 +2523,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2405
2523
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2406
2524
  * See the License for the specific language governing permissions and
2407
2525
  * limitations under the License.
2408
- */function fp(t,e,n){return`firebase:${t}:${e}:${n}`}class pp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=fp(this.userKey,r.apiKey,s),this.fullPersistenceKey=fp("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?cp._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new pp(hp(dp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||hp(dp);const i=fp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=cp._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new pp(s,t,n)):new pp(s,t,n)}}
2526
+ */function El(e,t,n){return`firebase:${e}:${t}:${n}`}class Sl{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=El(this.userKey,r.apiKey,s),this.fullPersistenceKey=El("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){const t=await il(this.auth,{idToken:e}).catch(()=>{});return t?yl._fromGetAccountInfoResponse(this.auth,t,e):null}return yl._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new Sl(_l(Tl),e,n);const r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let s=r[0]||_l(Tl);const i=El(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(i);if(t){let r;if("string"==typeof t){const n=await il(e,{idToken:t}).catch(()=>{});if(!n)break;r=await yl._fromGetAccountInfoResponse(e,n,t)}else r=yl._fromJSON(e,t);n!==s&&(o=r),s=n;break}}catch(e){}const a=r.filter(e=>e._shouldAllowMigration);return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==s)try{await e._remove(i)}catch(e){}})),new Sl(s,e,n)):new Sl(s,e,n)}}
2409
2527
  /**
2410
2528
  * @license
2411
2529
  * Copyright 2020 Google LLC
@@ -2421,7 +2539,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2421
2539
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2422
2540
  * See the License for the specific language governing permissions and
2423
2541
  * limitations under the License.
2424
- */function gp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(wp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(mp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Tp(e))return"Blackberry";if(Ep(e))return"Webos";if(yp(e))return"Safari";if((e.includes("chrome/")||vp(e))&&!e.includes("edge/"))return"Chrome";if(_p(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function mp(t=d()){return/firefox\//i.test(t)}function yp(t=d()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vp(t=d()){return/crios\//i.test(t)}function wp(t=d()){return/iemobile/i.test(t)}function _p(t=d()){return/android/i.test(t)}function Tp(t=d()){return/blackberry/i.test(t)}function Ep(t=d()){return/webos/i.test(t)}function Sp(t=d()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ip(){return function(){const t=d();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function bp(t=d()){return Sp(t)||_p(t)||Ep(t)||Tp(t)||/windows phone/i.test(t)||wp(t)}
2542
+ */function Il(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(kl(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(bl(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Ol(t))return"Blackberry";if(Nl(t))return"Webos";if(Al(t))return"Safari";if((t.includes("chrome/")||Cl(t))&&!t.includes("edge/"))return"Chrome";if(Rl(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function bl(e=v()){return/firefox\//i.test(e)}function Al(e=v()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Cl(e=v()){return/crios\//i.test(e)}function kl(e=v()){return/iemobile/i.test(e)}function Rl(e=v()){return/android/i.test(e)}function Ol(e=v()){return/blackberry/i.test(e)}function Nl(e=v()){return/webos/i.test(e)}function Dl(e=v()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Pl(){return function(){const e=v();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ll(e=v()){return Dl(e)||Rl(e)||Nl(e)||Ol(e)||/windows phone/i.test(e)||kl(e)}
2425
2543
  /**
2426
2544
  * @license
2427
2545
  * Copyright 2020 Google LLC
@@ -2437,7 +2555,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2437
2555
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2438
2556
  * See the License for the specific language governing permissions and
2439
2557
  * limitations under the License.
2440
- */function Ap(t,e=[]){let n;switch(t){case"Browser":n=gp(d());break;case"Worker":n=`${gp(d())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ut}/${r}`}
2558
+ */function Ml(e,t=[]){let n;switch(e){case"Browser":n=Il(v());break;case"Worker":n=`${Il(v())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${ze}/${r}`}
2441
2559
  /**
2442
2560
  * @license
2443
2561
  * Copyright 2022 Google LLC
@@ -2453,7 +2571,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2453
2571
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2454
2572
  * See the License for the specific language governing permissions and
2455
2573
  * limitations under the License.
2456
- */class Cp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2574
+ */class xl{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,r)=>{try{n(e(t))}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}
2457
2575
  /**
2458
2576
  * @license
2459
2577
  * Copyright 2023 Google LLC
@@ -2469,7 +2587,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2469
2587
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2470
2588
  * See the License for the specific language governing permissions and
2471
2589
  * limitations under the License.
2472
- */class kp{constructor(t){var e,n,r,s;const i=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=i.minPasswordLength)&&void 0!==e?e:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(s=t.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,r,s,i,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void 0===s||s),a.isValid&&(a.isValid=null===(i=a.containsNumericCharacter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let r=0;r<t.length;r++)n=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,r,s){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=s))}}
2590
+ */class Ul{constructor(e){var t,n,r,s;const i=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=i.minPasswordLength)&&void 0!==t?t:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(s=e.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,s,i,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null===(t=a.meetsMinPasswordLength)||void 0===t||t),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void 0===s||s),a.isValid&&(a.isValid=null===(i=a.containsNumericCharacter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}
2473
2591
  /**
2474
2592
  * @license
2475
2593
  * Copyright 2020 Google LLC
@@ -2485,7 +2603,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2485
2603
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2486
2604
  * See the License for the specific language governing permissions and
2487
2605
  * limitations under the License.
2488
- */class Np{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Op(this),this.idTokenSubscription=new Op(this),this.beforeStateQueue=new Cp(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=_f,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=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=hp(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await pp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Yf(this,{idToken:t}),n=await cp._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(Pt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Nf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await sp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Cf(this));const e=t?S(t):null;return e&&Nf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Nf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Cf(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Cf(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(hp(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Hf(t,"GET","/v2/passwordPolicy",Bf(t,e))}
2606
+ */class Fl{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jl(this),this.idTokenSubscription=new jl(this),this.beforeStateQueue=new xl(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=kh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=_l(t)),this._initializationPromise=this.queue(async()=>{var n,r,s;if(!this._deleted&&(this.persistenceManager=await Sl.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(r=this._popupRedirectResolver)||void 0===r?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(s=this.currentUser)||void 0===s?void 0:s.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await il(this,{idToken:e}),n=await yl._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(Be(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Uh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await fl(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Be(this.app))return Promise.reject(Mh(this));const t=e?O(e):null;return t&&Uh(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&&Uh(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 Be(this.app)?Promise.reject(Mh(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Be(this.app)?Promise.reject(Mh(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(_l(e))})}_getRecaptchaConfig(){return null==this.tenantId?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 null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return Jh(e,"GET","/v2/passwordPolicy",Qh(e,t))}
2489
2607
  /**
2490
2608
  * @license
2491
2609
  * Copyright 2023 Google LLC
@@ -2501,7 +2619,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2501
2619
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2502
2620
  * See the License for the specific language governing permissions and
2503
2621
  * limitations under the License.
2504
- */(this),e=new kp(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new p("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Hf(t,"POST","/v2/accounts:revokeToken",Bf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&hp(t)||this._popupRedirectResolver;Nf(e,this,"argument-error"),this.redirectPersistenceManager=await pp.create(this,[hp(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Nf(o,this,"internal-error"),o.then((()=>{i||s(this.currentUser)})),"function"==typeof e){const s=t.addObserver(e,n,r);return()=>{i=!0,s()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Nf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Ap(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){Ef.logLevel<=k.WARN&&Ef.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Rp(t){return S(t)}class Op{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new T(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Nf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2622
+ */(this),t=new Ul(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new T("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Jh(e,"POST","/v2/accounts:revokeToken",Qh(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&_l(e)||this._popupRedirectResolver;Uh(t,this,"argument-error"),this.redirectPersistenceManager=await Sl.create(this,[_l(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const s="function"==typeof t?t:t.next.bind(t);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Uh(o,this,"internal-error"),o.then(()=>{i||s(this.currentUser)}),"function"==typeof t){const s=e.addObserver(t,n,r);return()=>{i=!0,s()}}{const n=e.addObserver(t);return()=>{i=!0,n()}}}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 Uh(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ml(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;if(Be(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Oh.logLevel<=M.WARN&&Oh.warn(`Auth (${ze}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Vl(e){return O(e)}class jl{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new k(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Uh(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2505
2623
  /**
2506
2624
  * @license
2507
2625
  * Copyright 2020 Google LLC
@@ -2517,7 +2635,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2517
2635
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2518
2636
  * See the License for the specific language governing permissions and
2519
2637
  * limitations under the License.
2520
- */let Dp={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Lp(t){return Dp.loadJS(t)}class Pp{constructor(t){this.type="recaptcha-enterprise",this.auth=Rp(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Hf(t,"GET","/v2/recaptchaConfig",Bf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new Qf(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function r(e,n,r){const s=window.grecaptcha;Gf(s)?s.enterprise.ready((()=>{s.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,s)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))r(n,t,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let e=Dp.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Lp(e).then((()=>{r(n,t,s)})).catch((t=>{s(t)}))}})).catch((t=>{s(t)}))}))}}async function Mp(t,e,n,r=!1){const s=new Pp(t);let i;try{i=await s.verify(n)}catch(t){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 xp(t,e,n,r){var s;if(null===(s=t._getRecaptchaConfig())||void 0===s?void 0:s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Mp(t,e,n,"getOobCode"===n);return r(t,s)}return r(t,e).catch((async s=>{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Mp(t,e,n,"getOobCode"===n);return r(t,s)}return Promise.reject(s)}))}
2638
+ */let Bl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Hl(e){return Bl.loadJS(e)}class $l{constructor(){this.enterprise=new zl}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class zl{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const ql="NO_RECAPTCHA";class Gl{constructor(e){this.type="recaptcha-enterprise",this.auth=Vl(e)}async verify(e="verify",t=!1){async function n(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>{(async function(e,t){return Jh(e,"GET","/v2/recaptchaConfig",Qh(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0!==r.recaptchaKey){const n=new sl(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{n(e)})})}function r(t,n,r){const s=window.grecaptcha;rl(s)?s.enterprise.ready(()=>{s.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(ql)})}):r(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new $l).execute("siteKey",{action:"verify"})}return new Promise((e,s)=>{n(this.auth).then(n=>{if(!t&&rl(window.grecaptcha))r(n,e,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let t=Bl.recaptchaEnterpriseScript;0!==t.length&&(t+=n),Hl(t).then(()=>{r(n,e,s)}).catch(e=>{s(e)})}}).catch(e=>{s(e)})})}}async function Kl(e,t,n,r=!1,s=!1){const i=new Gl(e);let o;if(s)o=ql;else try{o=await i.verify(n)}catch(e){o=await i.verify(n,!0)}const a=Object.assign({},t);if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const e=a.phoneEnrollmentInfo.phoneNumber,t=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const e=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Wl(e,t,n,r,s){var i;if(null===(i=e._getRecaptchaConfig())||void 0===i?void 0:i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Kl(e,t,n,"getOobCode"===n);return r(e,s)}return r(e,t).catch(async s=>{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Kl(e,t,n,"getOobCode"===n);return r(e,s)}return Promise.reject(s)})}
2521
2639
  /**
2522
2640
  * @license
2523
2641
  * Copyright 2020 Google LLC
@@ -2533,7 +2651,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2533
2651
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2534
2652
  * See the License for the specific language governing permissions and
2535
2653
  * limitations under the License.
2536
- */function Up(t,e,n){const r=Rp(t);Nf(r._canInitEmulator,r,"emulator-config-failed"),Nf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=Fp(e),{host:o,port:a}=function(t){const e=Fp(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:Vp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Vp(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
2654
+ */function Ql(e,t,n){const r=Vl(e);Uh(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const s=Jl(t),{host:i,port:o}=function(e){const t=Jl(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const e=s[1];return{host:e,port:Yl(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:Yl(t)}}}(t),a=null===o?"":`:${o}`,c={url:`${s}//${i}${a}/`},u=Object.freeze({host:i,port:o,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!r._canInitEmulator)return Uh(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),void Uh(S(c,r.config.emulator)&&S(u,r.emulatorConfig),r,"emulator-config-failed");r.config.emulator=c,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,f(i)?(p(`${s}//${i}${a}`),y("Auth",!0)):function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}
2537
2655
  /**
2538
2656
  * @license
2539
2657
  * Copyright 2020 Google LLC
@@ -2549,7 +2667,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2549
2667
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2550
2668
  * See the License for the specific language governing permissions and
2551
2669
  * limitations under the License.
2552
- */()}function Fp(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Vp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Bp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Rf("not implemented")}_getIdTokenResponse(t){return Rf("not implemented")}_linkToIdToken(t,e){return Rf("not implemented")}_getReauthenticationResolver(t){return Rf("not implemented")}}
2670
+ */()}function Jl(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Yl(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Xl{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Fh("not implemented")}_getIdTokenResponse(e){return Fh("not implemented")}_linkToIdToken(e,t){return Fh("not implemented")}_getReauthenticationResolver(e){return Fh("not implemented")}}
2553
2671
  /**
2554
2672
  * @license
2555
2673
  * Copyright 2020 Google LLC
@@ -2565,7 +2683,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2565
2683
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2566
2684
  * See the License for the specific language governing permissions and
2567
2685
  * limitations under the License.
2568
- */async function Hp(t,e){return Hf(t,"POST","/v1/accounts:signUp",e)}
2686
+ */async function Zl(e,t){return Jh(e,"POST","/v1/accounts:signUp",t)}
2569
2687
  /**
2570
2688
  * @license
2571
2689
  * Copyright 2020 Google LLC
@@ -2581,7 +2699,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2581
2699
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2582
2700
  * See the License for the specific language governing permissions and
2583
2701
  * limitations under the License.
2584
- */async function jp(t,e){return $f(t,"POST","/v1/accounts:signInWithPassword",Bf(t,e))}async function $p(t,e){return async function(t,e){return Hf(t,"POST","/v1/accounts:sendOobCode",Bf(t,e))}(t,e)}
2702
+ */async function ed(e,t){return Xh(e,"POST","/v1/accounts:signInWithPassword",Qh(e,t))}async function td(e,t){return async function(e,t){return Jh(e,"POST","/v1/accounts:sendOobCode",Qh(e,t))}(e,t)}
2585
2703
  /**
2586
2704
  * @license
2587
2705
  * Copyright 2020 Google LLC
@@ -2614,7 +2732,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2614
2732
  * See the License for the specific language governing permissions and
2615
2733
  * limitations under the License.
2616
2734
  */
2617
- class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new qp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new qp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return xp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",jp);case"emailLink":return async function(t,e){return $f(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{email:this._email,oobCode:this._password});default:If(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return xp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Hp);case"emailLink":return async function(t,e){return $f(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:If(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2735
+ class nd extends Xl{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new nd(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new nd(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return Wl(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",ed);case"emailLink":return async function(e,t){return Xh(e,"POST","/v1/accounts:signInWithEmailLink",Qh(e,t))}(e,{email:this._email,oobCode:this._password});default:Dh(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Wl(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Zl);case"emailLink":return async function(e,t){return Xh(e,"POST","/v1/accounts:signInWithEmailLink",Qh(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Dh(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}
2618
2736
  /**
2619
2737
  * @license
2620
2738
  * Copyright 2020 Google LLC
@@ -2630,7 +2748,7 @@ class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2630
2748
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2631
2749
  * See the License for the specific language governing permissions and
2632
2750
  * limitations under the License.
2633
- */async function Kp(t,e){return $f(t,"POST","/v1/accounts:signInWithIdp",Bf(t,e))}
2751
+ */async function rd(e,t){return Xh(e,"POST","/v1/accounts:signInWithIdp",Qh(e,t))}
2634
2752
  /**
2635
2753
  * @license
2636
2754
  * Copyright 2020 Google LLC
@@ -2646,7 +2764,7 @@ class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2646
2764
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2647
2765
  * See the License for the specific language governing permissions and
2648
2766
  * limitations under the License.
2649
- */class Wp extends Bp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Wp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):If("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,s=yf(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Wp(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(t){return Kp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Kp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Kp(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=v(e)}return t}}
2767
+ */class sd extends Xl{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new sd(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):Dh("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r}=t,s=bh(t,["providerId","signInMethod"]);if(!n||!r)return null;const i=new sd(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(e){return rd(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,rd(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,rd(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=b(t)}return e}}
2650
2768
  /**
2651
2769
  * @license
2652
2770
  * Copyright 2020 Google LLC
@@ -2662,7 +2780,7 @@ class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2662
2780
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2663
2781
  * See the License for the specific language governing permissions and
2664
2782
  * limitations under the License.
2665
- */class zp{constructor(t){var e,n,r,s,i,o;const a=w(_(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Nf(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=w(_(t)).link,n=e?w(_(e)).deep_link_id:null,r=w(_(t)).deep_link_id;return(r?w(_(r)).link:null)||r||n||e||t}(t);try{return new zp(e)}catch(t){return null}}}
2783
+ */class id{constructor(e){var t,n,r,s,i,o;const a=A(C(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Uh(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.lang)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=A(C(e)).link,n=t?A(C(t)).deep_link_id:null,r=A(C(e)).deep_link_id;return(r?A(C(r)).link:null)||r||n||t||e}(e);try{return new id(t)}catch(e){return null}}}
2666
2784
  /**
2667
2785
  * @license
2668
2786
  * Copyright 2020 Google LLC
@@ -2678,7 +2796,7 @@ class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2678
2796
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2679
2797
  * See the License for the specific language governing permissions and
2680
2798
  * limitations under the License.
2681
- */class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return qp._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=zp.parseLink(e);return Nf(n,"argument-error"),qp._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2799
+ */class od{constructor(){this.providerId=od.PROVIDER_ID}static credential(e,t){return nd._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=id.parseLink(t);return Uh(n,"argument-error"),nd._fromEmailAndCode(e,n.code,n.tenantId)}}od.PROVIDER_ID="password",od.EMAIL_PASSWORD_SIGN_IN_METHOD="password",od.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2682
2800
  /**
2683
2801
  * @license
2684
2802
  * Copyright 2020 Google LLC
@@ -2695,7 +2813,7 @@ class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2695
2813
  * See the License for the specific language governing permissions and
2696
2814
  * limitations under the License.
2697
2815
  */
2698
- class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
2816
+ class ad{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}}
2699
2817
  /**
2700
2818
  * @license
2701
2819
  * Copyright 2019 Google LLC
@@ -2711,7 +2829,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2711
2829
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2712
2830
  * See the License for the specific language governing permissions and
2713
2831
  * limitations under the License.
2714
- */class Yp extends Qp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2832
+ */class cd extends ad{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}
2715
2833
  /**
2716
2834
  * @license
2717
2835
  * Copyright 2020 Google LLC
@@ -2727,7 +2845,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2727
2845
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2728
2846
  * See the License for the specific language governing permissions and
2729
2847
  * limitations under the License.
2730
- */class Jp extends Yp{constructor(){super("facebook.com")}static credential(t){return Wp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Jp.credential(t.oauthAccessToken)}catch(t){return null}}}Jp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Jp.PROVIDER_ID="facebook.com";
2848
+ */class ud extends cd{constructor(){super("facebook.com")}static credential(e){return sd._fromParams({providerId:ud.PROVIDER_ID,signInMethod:ud.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ud.credentialFromTaggedObject(e)}static credentialFromError(e){return ud.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ud.credential(e.oauthAccessToken)}catch(e){return null}}}ud.FACEBOOK_SIGN_IN_METHOD="facebook.com",ud.PROVIDER_ID="facebook.com";
2731
2849
  /**
2732
2850
  * @license
2733
2851
  * Copyright 2020 Google LLC
@@ -2744,7 +2862,7 @@ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2744
2862
  * See the License for the specific language governing permissions and
2745
2863
  * limitations under the License.
2746
2864
  */
2747
- class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Wp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Xp.credential(e,n)}catch(t){return null}}}Xp.GOOGLE_SIGN_IN_METHOD="google.com",Xp.PROVIDER_ID="google.com";
2865
+ class hd extends cd{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return sd._fromParams({providerId:hd.PROVIDER_ID,signInMethod:hd.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return hd.credentialFromTaggedObject(e)}static credentialFromError(e){return hd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return hd.credential(t,n)}catch(e){return null}}}hd.GOOGLE_SIGN_IN_METHOD="google.com",hd.PROVIDER_ID="google.com";
2748
2866
  /**
2749
2867
  * @license
2750
2868
  * Copyright 2020 Google LLC
@@ -2761,7 +2879,7 @@ class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}s
2761
2879
  * See the License for the specific language governing permissions and
2762
2880
  * limitations under the License.
2763
2881
  */
2764
- class Zp extends Yp{constructor(){super("github.com")}static credential(t){return Wp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Zp.credential(t.oauthAccessToken)}catch(t){return null}}}Zp.GITHUB_SIGN_IN_METHOD="github.com",Zp.PROVIDER_ID="github.com";
2882
+ class ld extends cd{constructor(){super("github.com")}static credential(e){return sd._fromParams({providerId:ld.PROVIDER_ID,signInMethod:ld.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return ld.credentialFromTaggedObject(e)}static credentialFromError(e){return ld.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return ld.credential(e.oauthAccessToken)}catch(e){return null}}}ld.GITHUB_SIGN_IN_METHOD="github.com",ld.PROVIDER_ID="github.com";
2765
2883
  /**
2766
2884
  * @license
2767
2885
  * Copyright 2020 Google LLC
@@ -2778,7 +2896,7 @@ class Zp extends Yp{constructor(){super("github.com")}static credential(t){retur
2778
2896
  * See the License for the specific language governing permissions and
2779
2897
  * limitations under the License.
2780
2898
  */
2781
- class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){return Wp._fromParams({providerId:tg.PROVIDER_ID,signInMethod:tg.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return tg.credentialFromTaggedObject(t)}static credentialFromError(t){return tg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return tg.credential(e,n)}catch(t){return null}}}tg.TWITTER_SIGN_IN_METHOD="twitter.com",tg.PROVIDER_ID="twitter.com";
2899
+ class dd extends cd{constructor(){super("twitter.com")}static credential(e,t){return sd._fromParams({providerId:dd.PROVIDER_ID,signInMethod:dd.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return dd.credentialFromTaggedObject(e)}static credentialFromError(e){return dd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return dd.credential(t,n)}catch(e){return null}}}dd.TWITTER_SIGN_IN_METHOD="twitter.com",dd.PROVIDER_ID="twitter.com";
2782
2900
  /**
2783
2901
  * @license
2784
2902
  * Copyright 2020 Google LLC
@@ -2795,23 +2913,7 @@ class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){re
2795
2913
  * See the License for the specific language governing permissions and
2796
2914
  * limitations under the License.
2797
2915
  */
2798
- class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await cp._fromIdTokenResponse(t,n,r),i=ng(n);return new eg({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=ng(n);return new eg({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function ng(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2799
- /**
2800
- * @license
2801
- * Copyright 2020 Google LLC
2802
- *
2803
- * Licensed under the Apache License, Version 2.0 (the "License");
2804
- * you may not use this file except in compliance with the License.
2805
- * You may obtain a copy of the License at
2806
- *
2807
- * http://www.apache.org/licenses/LICENSE-2.0
2808
- *
2809
- * Unless required by applicable law or agreed to in writing, software
2810
- * distributed under the License is distributed on an "AS IS" BASIS,
2811
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2812
- * See the License for the specific language governing permissions and
2813
- * limitations under the License.
2814
- */class rg extends f{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,rg.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new rg(t,e,n,r)}}function sg(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw rg._fromErrorAndOperation(t,n,e,r);throw n}))}
2916
+ class fd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){const s=await yl._fromIdTokenResponse(e,n,r),i=pd(n);return new fd({user:s,providerId:i,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=pd(n);return new fd({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function pd(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}
2815
2917
  /**
2816
2918
  * @license
2817
2919
  * Copyright 2020 Google LLC
@@ -2827,8 +2929,7 @@ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2827
2929
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2828
2930
  * See the License for the specific language governing permissions and
2829
2931
  * limitations under the License.
2830
- */
2831
- async function ig(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const r="signIn",s=await sg(t,r,e),i=await eg._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2932
+ */class gd extends w{constructor(e,t,n,r){var s;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,gd.prototype),this.customData={appName:e.name,tenantId:null!==(s=e.tenantId)&&void 0!==s?s:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new gd(e,t,n,r)}}function md(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw gd._fromErrorAndOperation(e,n,t,r);throw n})}
2832
2933
  /**
2833
2934
  * @license
2834
2935
  * Copyright 2020 Google LLC
@@ -2845,7 +2946,7 @@ async function ig(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const r="s
2845
2946
  * See the License for the specific language governing permissions and
2846
2947
  * limitations under the License.
2847
2948
  */
2848
- async function og(t){const e=Rp(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ag(t,e,n){const r=Rp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
2949
+ async function yd(e,t,n=!1){if(Be(e.app))return Promise.reject(Mh(e));const r="signIn",s=await md(e,r,t),i=await fd._fromIdTokenResponse(e,r,s);return n||await e._updateCurrentUser(i.user),i}
2849
2950
  /**
2850
2951
  * @license
2851
2952
  * Copyright 2020 Google LLC
@@ -2862,7 +2963,7 @@ async function og(t){const e=Rp(t);e._getPasswordPolicyInternal()&&await e._upda
2862
2963
  * See the License for the specific language governing permissions and
2863
2964
  * limitations under the License.
2864
2965
  */
2865
- function(t,e,n){var r;Nf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Nf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Nf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Nf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,s,n),await xp(r,s,"getOobCode",$p)}async function cg(t,e,n){await async function(t,e){return Hf(t,"POST","/v1/accounts:resetPassword",Bf(t,e))}(S(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}function ug(t,e,n){return Pt(t.app)?Promise.reject(Cf(t)):async function(t,e){return ig(Rp(t),e)}(S(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}const hg="__sak";
2966
+ async function vd(e){const t=Vl(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function _d(e,t,n){await async function(e,t){return Jh(e,"POST","/v1/accounts:resetPassword",Qh(e,t))}(O(e),{oobCode:t,newPassword:n}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&vd(e),t})}function wd(e,t,n){return Be(e.app)?Promise.reject(Mh(e)):async function(e,t){return yd(Vl(e),t)}(O(e),od.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&vd(e),t})}const Td="__sak";
2866
2967
  /**
2867
2968
  * @license
2868
2969
  * Copyright 2019 Google LLC
@@ -2878,7 +2979,7 @@ function(t,e,n){var r;Nf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2878
2979
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2879
2980
  * See the License for the specific language governing permissions and
2880
2981
  * limitations under the License.
2881
- */class lg{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(hg,"1"),this.storage.removeItem(hg),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
2982
+ */class Ed{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Td,"1"),this.storage.removeItem(Td),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}
2882
2983
  /**
2883
2984
  * @license
2884
2985
  * Copyright 2020 Google LLC
@@ -2894,7 +2995,7 @@ function(t,e,n){var r;Nf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2894
2995
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2895
2996
  * See the License for the specific language governing permissions and
2896
2997
  * limitations under the License.
2897
- */class dg extends lg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=bp(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);Ip()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}dg.type="LOCAL";const fg=dg;
2998
+ */class Sd extends Ed{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ll(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});const n=e.key;t?this.detachListener():this.stopPolling();const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.storage.getItem(n);Pl()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}Sd.type="LOCAL";const Id=Sd;
2898
2999
  /**
2899
3000
  * @license
2900
3001
  * Copyright 2020 Google LLC
@@ -2910,7 +3011,7 @@ function(t,e,n){var r;Nf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2910
3011
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2911
3012
  * See the License for the specific language governing permissions and
2912
3013
  * limitations under the License.
2913
- */class pg extends lg{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}pg.type="SESSION";const gg=pg;
3014
+ */class bd extends Ed{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}bd.type="SESSION";const Ad=bd;
2914
3015
  /**
2915
3016
  * @license
2916
3017
  * Copyright 2019 Google LLC
@@ -2943,7 +3044,7 @@ function(t,e,n){var r;Nf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2943
3044
  * See the License for the specific language governing permissions and
2944
3045
  * limitations under the License.
2945
3046
  */
2946
- class mg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new mg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:s}=e.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
3047
+ class Cd{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;const n=new Cd(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:s}=t.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map(async e=>e(t.origin,s)),a=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(o);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2947
3048
  /**
2948
3049
  * @license
2949
3050
  * Copyright 2020 Google LLC
@@ -2960,7 +3061,7 @@ class mg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
2960
3061
  * See the License for the specific language governing permissions and
2961
3062
  * limitations under the License.
2962
3063
  */
2963
- function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
3064
+ function kd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}
2964
3065
  /**
2965
3066
  * @license
2966
3067
  * Copyright 2019 Google LLC
@@ -2976,7 +3077,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2976
3077
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2977
3078
  * See the License for the specific language governing permissions and
2978
3079
  * limitations under the License.
2979
- */mg.receivers=[];class vg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=yg("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
3080
+ */Cd.receivers=[];class Rd{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise((o,a)=>{const c=kd("",20);r.port1.start();const u=setTimeout(()=>{a(new Error("unsupported_event"))},n);i={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),o(t.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}
2980
3081
  /**
2981
3082
  * @license
2982
3083
  * Copyright 2020 Google LLC
@@ -2992,7 +3093,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2992
3093
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2993
3094
  * See the License for the specific language governing permissions and
2994
3095
  * limitations under the License.
2995
- */function wg(){return window}
3096
+ */function Od(){return window}
2996
3097
  /**
2997
3098
  * @license
2998
3099
  * Copyright 2020 Google LLC.
@@ -3009,7 +3110,7 @@ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
3009
3110
  * See the License for the specific language governing permissions and
3010
3111
  * limitations under the License.
3011
3112
  */
3012
- function _g(){return void 0!==wg().WorkerGlobalScope&&"function"==typeof wg().importScripts}
3113
+ function Nd(){return void 0!==Od().WorkerGlobalScope&&"function"==typeof Od().importScripts}
3013
3114
  /**
3014
3115
  * @license
3015
3116
  * Copyright 2019 Google LLC
@@ -3026,7 +3127,7 @@ function _g(){return void 0!==wg().WorkerGlobalScope&&"function"==typeof wg().im
3026
3127
  * See the License for the specific language governing permissions and
3027
3128
  * limitations under the License.
3028
3129
  */
3029
- const Tg="firebaseLocalStorageDb",Eg="firebaseLocalStorage",Sg="fbase_key";class Ig{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function bg(t,e){return t.transaction([Eg],e?"readwrite":"readonly").objectStore(Eg)}function Ag(){const t=indexedDB.open(Tg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Eg,{keyPath:Sg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Eg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Tg);return new Ig(t).toPromise()}(),e(await Ag()))}))}))}async function Cg(t,e,n){const r=bg(t,!0).put({[Sg]:e,value:n});return new Ig(r).toPromise()}function kg(t,e){const n=bg(t,!0).delete(e);return new Ig(n).toPromise()}class Ng{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Ag()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return _g()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=mg._getInstance(_g()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new vg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Ag();return await Cg(t,hg,"1"),await kg(t,hg),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Cg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=bg(t,!1).get(e),r=await new Ig(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>kg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=bg(t,!1).getAll();return new Ig(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Ng.type="LOCAL";const Rg=Ng;new Mf(3e4,6e4);
3130
+ const Dd="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Ld="fbase_key";class Md{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function xd(e,t){return e.transaction([Pd],t?"readwrite":"readonly").objectStore(Pd)}function Ud(){const e=indexedDB.open(Dd,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Pd,{keyPath:Ld})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Pd)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Dd);return new Md(e).toPromise()}(),t(await Ud()))})})}async function Fd(e,t,n){const r=xd(e,!0).put({[Ld]:t,value:n});return new Md(r).toPromise()}function Vd(e,t){const n=xd(e,!0).delete(t);return new Md(n).toPromise()}class jd{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await Ud()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Nd()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Cd._getInstance(Nd()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new Rd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Ud();return await Fd(e,Td,"1"),await Vd(e,Td),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Fd(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=xd(e,!1).get(t),r=await new Md(n).toPromise();return void 0===r?null:r.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Vd(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=xd(e,!1).getAll();return new Md(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:r,value:s}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}jd.type="LOCAL";const Bd=jd;new $h(3e4,6e4);
3030
3131
  /**
3031
3132
  * @license
3032
3133
  * Copyright 2019 Google LLC
@@ -3043,7 +3144,7 @@ const Tg="firebaseLocalStorageDb",Eg="firebaseLocalStorage",Sg="fbase_key";class
3043
3144
  * See the License for the specific language governing permissions and
3044
3145
  * limitations under the License.
3045
3146
  */
3046
- class Og extends Bp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Kp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Kp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Kp(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Dg(t){return ig(t.auth,new Og(t),t.bypassAuthState)}function Lg(t){const{auth:e,user:n}=t;return Nf(n,e,"internal-error"),
3147
+ class Hd extends Xl{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return rd(e,this._buildIdpRequest())}_linkToIdToken(e,t){return rd(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return rd(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 $d(e){return yd(e.auth,new Hd(e),e.bypassAuthState)}function zd(e){const{auth:t,user:n}=e;return Uh(n,t,"internal-error"),
3047
3148
  /**
3048
3149
  * @license
3049
3150
  * Copyright 2019 Google LLC
@@ -3060,7 +3161,7 @@ class Og extends Bp{constructor(t){super("custom","custom"),this.params=t}_getId
3060
3161
  * See the License for the specific language governing permissions and
3061
3162
  * limitations under the License.
3062
3163
  */
3063
- async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Cf(r));const s="reauthenticate";try{const i=await ep(t,sg(r,s,e,t),n);Nf(i.idToken,r,"internal-error");const o=Zf(i.idToken);Nf(o,r,"internal-error");const{sub:a}=o;return Nf(t.uid===a,r,"user-mismatch"),eg._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&If(r,"user-mismatch"),t}}(n,new Og(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Nf(n,e,"internal-error"),async function(t,e,n=!1){const r=await ep(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return eg._forOperation(t,"link",r)}(n,new Og(t),t.bypassAuthState)}
3164
+ async function(e,t,n=!1){const{auth:r}=e;if(Be(r.app))return Promise.reject(Mh(r));const s="reauthenticate";try{const i=await hl(e,md(r,s,t,e),n);Uh(i.idToken,r,"internal-error");const o=cl(i.idToken);Uh(o,r,"internal-error");const{sub:a}=o;return Uh(e.uid===a,r,"user-mismatch"),fd._forOperation(e,s,i)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Dh(r,"user-mismatch"),e}}(n,new Hd(e),e.bypassAuthState)}async function qd(e){const{auth:t,user:n}=e;return Uh(n,t,"internal-error"),async function(e,t,n=!1){const r=await hl(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return fd._forOperation(e,"link",r)}(n,new Hd(e),e.bypassAuthState)}
3064
3165
  /**
3065
3166
  * @license
3066
3167
  * Copyright 2020 Google LLC
@@ -3076,7 +3177,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Cf(r
3076
3177
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3077
3178
  * See the License for the specific language governing permissions and
3078
3179
  * limitations under the License.
3079
- */class Mg{constructor(t,e,n,r,s=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Dg;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Lg;default:If(this.auth,"internal-error")}}resolve(t){Of(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Of(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
3180
+ */class Gd{constructor(e,t,n,r,s=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=e;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return $d;case"linkViaPopup":case"linkViaRedirect":return qd;case"reauthViaPopup":case"reauthViaRedirect":return zd;default:Dh(this.auth,"internal-error")}}resolve(e){Vh(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Vh(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()}}
3080
3181
  /**
3081
3182
  * @license
3082
3183
  * Copyright 2020 Google LLC
@@ -3092,7 +3193,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Cf(r
3092
3193
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3093
3194
  * See the License for the specific language governing permissions and
3094
3195
  * limitations under the License.
3095
- */const xg=new Mf(2e3,1e4);class Ug extends Mg{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Ug.currentPopupAction&&Ug.currentPopupAction.cancel(),Ug.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Nf(t,this.auth,"internal-error"),t}async onExecution(){Of(1===this.filter.length,"Popup operations only handle one event");const t=yg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(bf(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(bf(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ug.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(bf(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,xg.get())};t()}}Ug.currentPopupAction=null;
3196
+ */const Kd=new $h(2e3,1e4);class Wd extends Gd{constructor(e,t,n,r,s){super(e,t,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Wd.currentPopupAction&&Wd.currentPopupAction.cancel(),Wd.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Uh(e,this.auth,"internal-error"),e}async onExecution(){Vh(1===this.filter.length,"Popup operations only handle one event");const e=kd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(Ph(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(Ph(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Wd.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Ph(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,Kd.get())};e()}}Wd.currentPopupAction=null;
3096
3197
  /**
3097
3198
  * @license
3098
3199
  * Copyright 2020 Google LLC
@@ -3109,7 +3210,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Cf(r
3109
3210
  * See the License for the specific language governing permissions and
3110
3211
  * limitations under the License.
3111
3212
  */
3112
- const Fg="pendingRedirect",Vg=new Map;class Bg extends Mg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Vg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return fp(Fg,t.config.apiKey,t.name)}(e),r=function(t){return hp(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}Vg.set(this.auth._key(),t)}return this.bypassAuthState||Vg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Hg(t,e){Vg.set(t._key(),e)}async function jg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const r=Rp(t),s=
3213
+ const Qd="pendingRedirect",Jd=new Map;class Yd extends Gd{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=Jd.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return El(Qd,e.config.apiKey,e.name)}(t),r=function(e){return _l(e._redirectPersistence)}(e);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}Jd.set(this.auth._key(),e)}return this.bypassAuthState||Jd.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Xd(e,t){Jd.set(e._key(),t)}async function Zd(e,t,n=!1){if(Be(e.app))return Promise.reject(Mh(e));const r=Vl(e),s=
3113
3214
  /**
3114
3215
  * @license
3115
3216
  * Copyright 2021 Google LLC
@@ -3126,7 +3227,7 @@ const Fg="pendingRedirect",Vg=new Map;class Bg extends Mg{constructor(t,e,n=!1){
3126
3227
  * See the License for the specific language governing permissions and
3127
3228
  * limitations under the License.
3128
3229
  */
3129
- function(t,e){return e?hp(e):(Nf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new Bg(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
3230
+ function(e,t){return t?_l(t):(Uh(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(r,t),i=new Yd(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,t)),o}
3130
3231
  /**
3131
3232
  * @license
3132
3233
  * Copyright 2020 Google LLC
@@ -3142,7 +3243,7 @@ function(t,e){return e?hp(e):(Nf(t._popupRedirectResolver,t,"argument-error"),t.
3142
3243
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3143
3244
  * See the License for the specific language governing permissions and
3144
3245
  * limitations under the License.
3145
- */class $g{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Kg(t);default:return!1}}
3246
+ */class ef{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return nf(e);default:return!1}}
3146
3247
  /**
3147
3248
  * @license
3148
3249
  * Copyright 2020 Google LLC
@@ -3158,7 +3259,7 @@ function(t,e){return e?hp(e):(Nf(t._popupRedirectResolver,t,"argument-error"),t.
3158
3259
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3159
3260
  * See the License for the specific language governing permissions and
3160
3261
  * limitations under the License.
3161
- */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Kg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(bf(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(qg(t))}saveEventToCache(t){this.cachedEventUids.add(qg(t)),this.lastProcessedEventTime=Date.now()}}function qg(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Kg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3262
+ */(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!nf(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Ph(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(tf(e))}saveEventToCache(e){this.cachedEventUids.add(tf(e)),this.lastProcessedEventTime=Date.now()}}function tf(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function nf({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}
3162
3263
  /**
3163
3264
  * @license
3164
3265
  * Copyright 2020 Google LLC
@@ -3175,7 +3276,7 @@ function(t,e){return e?hp(e):(Nf(t._popupRedirectResolver,t,"argument-error"),t.
3175
3276
  * See the License for the specific language governing permissions and
3176
3277
  * limitations under the License.
3177
3278
  */
3178
- const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Hf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Qg(t))return}catch(t){}If(t,"unauthorized-domain")}function Qg(t){const e=Df(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!zg.test(n))return!1;if(Wg.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3279
+ const rf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,sf=/^https?/;async function of(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return Jh(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(af(e))return}catch(e){}Dh(e,"unauthorized-domain")}function af(e){const t=jh(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const s=new URL(e);return""===s.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!sf.test(n))return!1;if(rf.test(e))return r===e;const s=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3179
3280
  /**
3180
3281
  * @license
3181
3282
  * Copyright 2020 Google LLC.
@@ -3191,7 +3292,7 @@ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zg=/^https?/;async function Gg(t
3191
3292
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3192
3293
  * See the License for the specific language governing permissions and
3193
3294
  * limitations under the License.
3194
- */const Yg=new Mf(3e4,6e4);function Jg(){const t=wg().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Xg(t){return new Promise(((e,n)=>{var r,s,i;function o(){Jg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Jg(),n(bf(t,"network-request-failed"))},timeout:Yg.get()})}if(null===(s=null===(r=wg().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=wg().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return wg()[e]=()=>{gapi.load?o():n(bf(t,"network-request-failed"))},Lp(`${Dp.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Zg=null,t}))}let Zg=null;
3295
+ */const cf=new $h(3e4,6e4);function uf(){const e=Od().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}function hf(e){return new Promise((t,n)=>{var r,s,i;function o(){uf(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{uf(),n(Ph(e,"network-request-failed"))},timeout:cf.get()})}if(null===(s=null===(r=Od().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)t(gapi.iframes.getContext());else{if(!(null===(i=Od().gapi)||void 0===i?void 0:i.load)){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Od()[t]=()=>{gapi.load?o():n(Ph(e,"network-request-failed"))},Hl(`${Bl.gapiScript}?onload=${t}`).catch(e=>n(e))}o()}}).catch(e=>{throw lf=null,e})}let lf=null;
3195
3296
  /**
3196
3297
  * @license
3197
3298
  * Copyright 2020 Google LLC.
@@ -3208,7 +3309,7 @@ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zg=/^https?/;async function Gg(t
3208
3309
  * See the License for the specific language governing permissions and
3209
3310
  * limitations under the License.
3210
3311
  */
3211
- const tm=new Mf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},sm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function im(t){const e=t.config;Nf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?xf(e,nm):`https://${t.config.authDomain}/${em}`,r={apiKey:e.apiKey,appName:t.name,v:Ut},s=sm.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${v(r).slice(1)}`}async function om(t){const e=await function(t){return Zg=Zg||Xg(t),Zg}(t),n=wg().gapi;return Nf(n,t,"internal-error"),e.open({where:document.body,url:im(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rm,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=bf(t,"network-request-failed"),i=wg().setTimeout((()=>{r(s)}),tm.get());function o(){wg().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3312
+ const df=new $h(5e3,15e3),ff={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},pf=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gf(e){const t=e.config;Uh(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?zh(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:ze},s=pf.get(e.config.apiHost);s&&(r.eid=s);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${b(r).slice(1)}`}async function mf(e){const t=await function(e){return lf=lf||hf(e),lf}(e),n=Od().gapi;return Uh(n,e,"internal-error"),t.open({where:document.body,url:gf(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ff,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});const s=Ph(e,"network-request-failed"),i=Od().setTimeout(()=>{r(s)},df.get());function o(){Od().clearTimeout(i),n(t)}t.ping(o).then(o,()=>{r(s)})}))}
3212
3313
  /**
3213
3314
  * @license
3214
3315
  * Copyright 2020 Google LLC.
@@ -3224,7 +3325,7 @@ const tm=new Mf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3224
3325
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3225
3326
  * See the License for the specific language governing permissions and
3226
3327
  * limitations under the License.
3227
- */const am={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class cm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function um(t,e,n,r=500,s=600){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({},am),{width:r.toString(),height:s.toString(),top:i,left:o}),u=d().toLowerCase();n&&(a=vp(u)?"_blank":n),mp(u)&&(e=e||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=d()){var e;return Sp(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3328
+ */const yf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class vf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function _f(e,t,n,r=500,s=600){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({},yf),{width:r.toString(),height:s.toString(),top:i,left:o}),u=v().toLowerCase();n&&(a=Cl(u)?"_blank":n),bl(u)&&(t=t||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=v()){var t;return Dl(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(u)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3228
3329
  /**
3229
3330
  * @license
3230
3331
  * Copyright 2021 Google LLC
@@ -3240,7 +3341,7 @@ const tm=new Mf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3240
3341
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3241
3342
  * See the License for the specific language governing permissions and
3242
3343
  * limitations under the License.
3243
- */(e||"",a),new cm(null);const l=window.open(e||"",a,h);Nf(l,t,"popup-blocked");try{l.focus()}catch(t){}return new cm(l)}const hm="__/auth/handler",lm="emulator/auth/handler",dm=encodeURIComponent("fac");async function fm(t,e,n,r,s,i){Nf(t.config.authDomain,t,"auth-domain-config-required"),Nf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ut,eventId:s};if(e instanceof Qp){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof Yp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),u=c?`#${dm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${hm}`;return xf(t,lm)}
3344
+ */(t||"",a),new vf(null);const l=window.open(t||"",a,h);Uh(l,e,"popup-blocked");try{l.focus()}catch(e){}return new vf(l)}const wf="__/auth/handler",Tf="emulator/auth/handler",Ef=encodeURIComponent("fac");async function Sf(e,t,n,r,s,i){Uh(e.config.authDomain,e,"auth-domain-config-required"),Uh(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:ze,eventId:s};if(t instanceof ad){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries({}))o[e]=t}if(t instanceof cd){const e=t.getScopes().filter(e=>""!==e);e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];const c=await e._getAppCheckToken(),u=c?`#${Ef}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${wf}`;return zh(e,Tf)}
3244
3345
  /**
3245
3346
  * @license
3246
3347
  * Copyright 2020 Google LLC
@@ -3256,7 +3357,7 @@ const tm=new Mf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3256
3357
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3257
3358
  * See the License for the specific language governing permissions and
3258
3359
  * limitations under the License.
3259
- */(t)}?${v(a).slice(1)}${u}`}const pm="webStorageSupport";const gm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=gg,this._completeRedirectFn=jg,this._overrideRedirectResult=Hg}async _openPopup(t,e,n,r){var s;Of(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return um(t,await fm(t,e,n,Df(),r),yg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){wg().location.href=t}(await fm(t,e,n,Df(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Of(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await om(t),n=new $g(t);return e.register("authEvent",(e=>{Nf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(pm,{type:pm},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[pm];void 0!==s&&e(!!s),If(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return bp()||yp()||Sp()}};var mm="@firebase/auth",ym="1.7.7";
3360
+ */(e)}?${b(a).slice(1)}${u}`}const If="webStorageSupport";const bf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Ad,this._completeRedirectFn=Zd,this._overrideRedirectResult=Xd}async _openPopup(e,t,n,r){var s;Vh(null===(s=this.eventManagers[e._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return _f(e,await Sf(e,t,n,jh(),r),kd())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){Od().location.href=e}(await Sf(e,t,n,jh(),r)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Vh(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await mf(e),n=new ef(e);return t.register("authEvent",t=>{Uh(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(If,{type:If},n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[If];void 0!==s&&t(!!s),Dh(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=of(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Ll()||Al()||Dl()}};var Af="@firebase/auth",Cf="1.10.8";
3260
3361
  /**
3261
3362
  * @license
3262
3363
  * Copyright 2020 Google LLC
@@ -3273,7 +3374,7 @@ const tm=new Mf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={styl
3273
3374
  * See the License for the specific language governing permissions and
3274
3375
  * limitations under the License.
3275
3376
  */
3276
- class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Nf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3377
+ class kf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(e)}}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){Uh(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3277
3378
  /**
3278
3379
  * @license
3279
3380
  * Copyright 2020 Google LLC
@@ -3306,5 +3407,5 @@ class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3306
3407
  * See the License for the specific language governing permissions and
3307
3408
  * limitations under the License.
3308
3409
  */
3309
- const wm=h("authIdTokenMaxAge")||300;let _m=null;function Tm(t=Vt()){const e=Lt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Lt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;If(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Rg,fg,gg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const r=null==e?void 0:e.token;_m!==r&&(_m=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&Up(n,`http://${i}`),n}var Em;!function(t){Dp=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=bf("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),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="}),Em="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Nf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Em,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ap(Em)},c=new Np(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(hp);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Dt(new I("auth-internal",(t=>(t=>new vm(t))(Rp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Bt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Em)),Bt(mm,ym,"esm2017");class Sm extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Im extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class bm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Am extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Cm extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class km extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class Nm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Rm="avatar not created";var Om=Object.freeze({__proto__:null,AvatarNotCreatedError:Sm,UserNotLoggedInError:Im,NoColorwaySizeAssetsFoundError:bm,BrandUserIdNotSetError:Am,NoFramesFoundError:Cm,RecommendedAvailableSizesError:km,NoStylesFoundError:Nm,AvatarNotCreated:Rm});class Dm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Tm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&(this.logUserLogin(t,e),this.setBrandUserId(e.uid))})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),this.setBrandUserId(null==e?void 0:e.uid),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=xl(this.firestore,"user_logging",e.uid),c=await Ld(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&ff(u).diff(ff(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await xd(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return await this.user.getIdToken()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return(await Ld(xl(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return new Promise((r=>{e=Ud(n,(async n=>{await t(n)&&(e(),r(n.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await ug(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Lm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ud(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Ft(Vd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Lt("object"==typeof t?t:Vt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ie("firestore");t&&Ol(r,...t)}return r}(t),this.user=new Dm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=_d(Ml(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Md(_d(Ml(this.firestore,t),...e))}async getDoc(t,e){const n=xl(this.firestore,t,e),r=await Ld(n);return r.exists()?r.data():null}}const Pm=t=>{if(t.code===Tf)throw new Error("account has been disabled");throw new Error(t.message)};class Mm{static get endpoint(){return Vd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}const xm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Um{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Im;try{const r=await Mm.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===Rm)throw new Sm;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new bm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new bm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){console.log({sku:t});const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[Ed("brand_id","==",this.brandId)];r.push(Ed("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Pm(t)}}async getColorwaySizeAssets(t,e){const n=[Ed("brand_id","==",this.brandId)];t&&n.push(Ed("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Ed("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return Pm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Pm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async tryOn(t,e){if(!this.isLoggedIn)throw new Im;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Cm))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,r,s;try{const i=[Ed("brand_id","==",this.brandId)];i.push(Ed("style_id","==",t)),i.push(Ed("size_id","==",e));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(t){return Pm(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Pm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Pm(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(r=this.getColorwaySizeAssetFromSku(t),r.then((t=>[null,t])).catch((t=>[t])));var r;if(e)throw e;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(t){}return this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Rm)throw new Sm;throw new Nm}}async awaitColorwaySizeAssetFrames(t){var e,n,r,s;if(!this.isLoggedIn)throw new Im;const i=await this.user.watchUserProfileForFrames((async e=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[t])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&xm(o[0])}));if(!(null===(s=null===(r=null===(n=null===(e=null==i?void 0:i.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Cm;return i.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Im;if(!this.user.brandUserId)throw new Am;await Mm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Cm;if(!await xm(i[0]))throw new Cm;return i}}const Fm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Vd.getInstance().setEnv(e),new Um(t,new Lm));var Vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Vm||(Vm={}));const Bm={[Vm.ACROSS_BACK]:"Across back",[Vm.ACROSS_FRONT]:"Across front",[Vm.ACROSS_SHOULDER]:"Across shoulder",[Vm.ANKLE]:"Ankle",[Vm.ARMEYE]:"Armeye",[Vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Vm.BACK_CROTCH_LENGTH]:"Back crotch length",[Vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Vm.BELOW_KNEE]:"Below knee",[Vm.BICEP]:"Bicep",[Vm.BUST]:"Chest/Bust",[Vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Vm.CALF]:"Calf",[Vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Vm.ELBOW]:"Elbow",[Vm.FOREARM]:"Forearm",[Vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Vm.HIGH_HIP]:"High hip",[Vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Vm.INSEAM]:"Inseam",[Vm.KNEE]:"Knee",[Vm.LOW_HIP]:"Low hip",[Vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Vm.MID_NECK]:"Mid neck",[Vm.NECK_AT_BASE]:"Neck at base",[Vm.SHOULDER_DROP]:"Shoulder drop",[Vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Vm.THIGH]:"Thigh",[Vm.TOTAL_RISE_LENGTH]:"Total rise length",[Vm.UNDER_BUST]:"Under bust",[Vm.VERTICAL_TRUNK]:"Vertical trunk",[Vm.WAIST]:"Waist",[Vm.WRIST]:"Wrist"};var Hm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Hm||(Hm={}));const jm={[Hm.BLOUSES]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.COATS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.DRESSES]:[Vm.LOW_HIP,Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST],[Hm.JACKETS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.PANTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.PUFFERS_AND_PARKAS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.SHORTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.SKIRTS]:[Vm.LOW_HIP,Vm.WAIST],[Hm.SWEATERS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.T_SHIRTS_AND_TANKS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP]},$m={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},qm={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Km={activewear:{leggings:Hm.PANTS,joggers:Hm.PANTS,sweatshirts:Hm.SWEATERS},dresses:{a_line:Hm.DRESSES,bodycon:Hm.DRESSES,fit_and_flare:Hm.DRESSES,knit:Hm.DRESSES,shirt:Hm.DRESSES,slip:Hm.DRESSES,straight:Hm.DRESSES,wrap:Hm.DRESSES},jackets_and_coats:{denim_jackets:Hm.JACKETS,parkas:Hm.PUFFERS_AND_PARKAS,peacoats:Hm.COATS,puffer_jackets:Hm.PUFFERS_AND_PARKAS,raincoats:Hm.COATS,rompers:Hm.COATS,shackets:Hm.JACKETS,trench_coats:Hm.COATS},jeans:{bootcut:Hm.PANTS,flared:Hm.PANTS,mom:Hm.PANTS,relaxed:Hm.PANTS,skinny:Hm.PANTS,slim:Hm.PANTS,straight:Hm.PANTS,tapered:Hm.PANTS,wide_leg:Hm.PANTS},jumpsuits_and_rompers:{boiler_suits:Hm.DRESSES,denim:Hm.DRESSES,jumpsuits:Hm.DRESSES,overalls:Hm.DRESSES,rompers:Hm.DRESSES,unitards:Hm.DRESSES},pants_and_shorts:{cigarette:Hm.PANTS,culottes:Hm.SHORTS,denim_shorts:Hm.SHORTS,flared:Hm.PANTS,joggers:Hm.PANTS,leggings:Hm.PANTS,skinny:Hm.PANTS,wide_leg:Hm.PANTS},skirts:{a_line_flared:Hm.SKIRTS,denim:Hm.SKIRTS,knit:Hm.SKIRTS,pencil:Hm.SKIRTS,pleated:Hm.SKIRTS,skater:Hm.SKIRTS,slip:Hm.SKIRTS,wrap:Hm.SKIRTS},suits_and_tailoring:{blazers:Hm.JACKETS,suit_jackets:Hm.JACKETS,suit_skirts:Hm.SKIRTS,suit_trousers:Hm.PANTS,suit_vests:Hm.SWEATERS,trousers:Hm.PANTS},sweaters:{cardigans:Hm.SWEATERS,crewnecks:Hm.SWEATERS,hoodies_and_zipups:Hm.SWEATERS,sweatshirts:Hm.SWEATERS,turtlenecks:Hm.SWEATERS,v_necks:Hm.SWEATERS},tops:{bodysuits:Hm.BLOUSES,corsets_and_bustiers:Hm.BLOUSES,polos:Hm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Hm.BLOUSES,t_shirts:Hm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Hm.T_SHIRTS_AND_TANKS}};var Wm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Wm||(Wm={}));const zm={[Wm.TOO_TIGHT]:"Too Tight",[Wm.TIGHT]:"Tight",[Wm.SLIGHTLY_TIGHT]:"Slightly Tight",[Wm.PERFECT_FIT]:"Perfect Fit",[Wm.SLIGHTLY_LOOSE]:"Slightly Loose",[Wm.LOOSE]:"Loose",[Wm.OVERSIZED]:"Oversized",[Wm.TOO_SHORT]:"Too Short",[Wm.SHORT]:"Short",[Wm.SLIGHTLY_SHORT]:"Slightly Short",[Wm.SLIGHTLY_LONG]:"Slightly Long",[Wm.LONG]:"Long",[Wm.TOO_LONG]:"Too Long"};var Gm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Gm||(Gm={}));var Qm=Object.freeze({__proto__:null,get AvatarState(){return Gm},get MeasurementLocation(){return Vm},MeasurementLocationName:Bm,get Classification(){return Hm},ClassificationLocations:jm,CategoryNames:$m,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:qm,Taxonomy:Km,get Fit(){return Wm},FitNames:zm});export{Om as Errors,Fm as initShop,t as requests,e as responses,Qm as types};
3410
+ const Rf=l("authIdTokenMaxAge")||300;let Of=null;function Nf(e=Ge()){const t=je(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=je(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(S(n.getOptions(),null!=t?t:{}))return e;Dh(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:bf,persistence:[Bd,Id,Ad]}),r=l("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(r,location.origin);if(location.origin===e.origin){const t=(s=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Rf)return;const r=null==t?void 0:t.token;Of!==r&&(Of=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){O(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,r){O(e).onIdTokenChanged(t,n,r)}(n,e=>t(e))}}var s;const i=u("auth");return i&&Ql(n,`http://${i}`),n}var Df;Bl={loadJS:e=>new Promise((t,n)=>{const r=document.createElement("script");var s,i;r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Ph("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(null!==(i=null===(s=document.getElementsByTagName("head"))||void 0===s?void 0:s[0])&&void 0!==i?i:document).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="},Df="Browser",Ve(new N("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Uh(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Df,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ml(Df)},c=new Fl(n,r,s,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(_l);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Ve(new N("auth-internal",e=>(e=>new kf(e))(Vl(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Ke(Af,Cf,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Df)),Ke(Af,Cf,"esm2017");class Pf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Lf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Mf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class xf extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Uf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Ff extends Error{constructor(e,t){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=e,this.available_sizes=t}}class Vf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const jf="avatar not created";var Bf=Object.freeze({__proto__:null,AvatarNotCreated:jf,AvatarNotCreatedError:Pf,BrandUserIdNotSetError:xf,NoColorwaySizeAssetsFoundError:Mf,NoFramesFoundError:Uf,NoStylesFoundError:Vf,RecommendedAvailableSizesError:Ff,UserNotLoggedInError:Lf});class Hf{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Nf(t),this.auth.setPersistence(Id)}get id(){var e;return null===(e=this.user)||void 0===e?void 0:e.uid}async onInit(e){this.auth.onAuthStateChanged(t=>{this.setUser(t),t&&(this.logUserLogin(e,t),this.setBrandUserId(t.uid))}),await this.auth.authStateReady();const t=this.auth.currentUser;return this.setUser(t),this.setBrandUserId(null==t?void 0:t.uid),Boolean(t)}setUser(e){this.user=e}async logUserLogin(e,t){var n,r,s,i,o;try{const a=Kc(this.firestore,"user_logging",t.uid),c=await Hu(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[e])||void 0===r?void 0:r.last_login;if(l&&Th(u).diff(Th(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[e])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[e]:{brand_id:e,last_login:u,logins:d}},last_brand_id:e,created_at:c.exists()?c.data().created_at:u,updated_at:u};await qu(a,f,{merge:!0})}catch(e){console.error("LOGGING ERROR:",e)}}setBrandUserId(e){this.brandUserId=e}async getToken(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return await this.user.getIdToken()}get userId(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return this.user.uid}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return(await Hu(Kc(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(e){let t;const n=Ru(Gc(this.firestore,"users"),Nu(ru(),"==",this.id));return t=Gu(n,t=>e(t.docs[0].data())),()=>t()}watchUserProfileForFrames(e){let t;const n=Ru(Gc(this.firestore,"users"),Nu(ru(),"==",this.id));return new Promise(r=>{t=Gu(n,async n=>{await e(n)&&(t(),r(n.docs[0].data()))})})}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await wd(this.auth,e,t);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(e){await async function(e,t){const n=Vl(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Wl(n,r,"getOobCode",td)}(this.auth,e)}async confirmPasswordReset(e,t){await _d(this.auth,e,t)}}class $f{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise(r=>{n=Gu(e,e=>{r(e),t&&n()})}),unsubscribe:()=>n()}};const e=qe(Wu.getInstance().firebase);this.firestore=Zc(e),this.user=new Hf(this.firestore,e)}onInit(e){return this.user.onInit(e)}query(e,t,n=!0){const r=Ru(Gc(this.firestore,e),t);return this.promisefyOnSnapshot(r,n)}getDocs(e,t){return zu(Ru(Gc(this.firestore,e),...t))}async getDoc(e,t){const n=Kc(this.firestore,e,t),r=await Hu(n);return r.exists()?r.data():null}}const zf=e=>{if(e.code===Rh)throw new Error("account has been disabled");throw new Error(e.message)};class qf{static get endpoint(){return Wu.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:r,useToken:s=!0}){const i=this.getUrl(t,s),o={method:n,headers:await this.getHeaders(e,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(e,t){return t?`${this.endpoint}/v1${e}`:this.endpoint+e}static async getHeaders(e,t){if(!t)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await e.getToken()}`}}static Get(e,t,n){return this.Fetch({user:e,endpointPath:t,method:"GET",body:null,useToken:n})}static Post(e,t,n=null,r){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:r})}static Put(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:r})}static Patch(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:r})}static Delete(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:r})}}const Gf=e=>{const t=new Image;return t.src=e,new Promise(e=>{t.onerror=()=>e(!1),t.onload=()=>e(!0)})};class Kf{constructor(e,t){this.brandId=e,this.firebase=t,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(e){var t,n;if(!this.isLoggedIn)throw new Lf;try{const r=await qf.Get(this.user,`/styles/${e}/recommendation`),s=await r.json();return(null===(t=null==s?void 0:s.fits)||void 0===t?void 0:t.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(e){if((null==e?void 0:e.error)===jf)throw new Pf;throw e}}async submitTelephoneNumber(e){const t=e.replace(/[^\+0-9]/g,""),n=await qf.Post(this.user,"/ios-app-link",{phone_number:t},!1);console.log(n)}async getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getColorwaySizeAssetFromBrandStyleId(e){const t=await this.getColorwaySizeAssets(e);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getMeasurementLocationsFromSku(e,t=[]){console.log({sku:e});const n=await this.getColorwaySizeAssetFromSku(e);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(t.length?s.measurement_locations.female.filter(e=>t.includes(e)):s.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getMeasurementLocationsFromBrandStyleId(e,t=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(e);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(t.length?s.measurement_locations.female.filter(e=>t.includes(e)):s.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getStyleByBrandStyleId(e){var t,n;try{const r=[Nu("brand_id","==",this.brandId)];r.push(Nu("brand_style_id","==",e));return null===(n=null===(t=(await this.firebase.getDocs("styles",r)).docs)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data()}catch(e){return zf(e)}}async getColorwaySizeAssets(e,t){const n=[Nu("brand_id","==",this.brandId)];e&&n.push(Nu("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(Nu("sku","in",t));try{const e=await this.firebase.getDocs("colorway_size_assets",n),t=new Map;return e.forEach(e=>{const n=e.data();t.set(n.id,n)}),t}catch(e){return zf(e)}}async getStyle(e){try{return await this.firebase.getDoc("styles",String(e))}catch(e){return zf(e)}}getMeasurementLocationName(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).name:e}getMeasurementLocationSortOrder(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).sort_order:1/0}async tryOn(e,t){if(!this.isLoggedIn)throw new Lf;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t);try{return await this.getColorwaySizeAssetFrames(n)}catch(e){if(!(e instanceof Uf))throw e;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t){var n,r,s;try{const i=[Nu("brand_id","==",this.brandId)];i.push(Nu("style_id","==",e)),i.push(Nu("size_id","==",t));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(e){return zf(e)}}async getGetTaxonomy(e){try{return await this.firebase.getDoc("style_garment_categories",String(e))}catch(e){return zf(e)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach(e=>{this.measurementLocations.set(e.name,{name:e.garment_label,sort_order:e.sort_order})})}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map(e=>e.data())}catch(e){return zf(e)}}async requestThenGetColorwaySizeAssetFrames(e){const[t,n]=await(r=this.getColorwaySizeAssetFromSku(e),r.then(e=>[null,e]).catch(e=>[e]));var r;if(t)throw t;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(e){}return this.awaitColorwaySizeAssetFrames(e)}catch(t){if((null==t?void 0:t.error)===jf)throw new Pf;throw new Vf}}async awaitColorwaySizeAssetFrames(e){var t,n,r,s;if(!this.isLoggedIn)throw new Lf;const i=await this.user.watchUserProfileForFrames(async t=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[e])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&Gf(o[0])});if(!(null===(s=null===(r=null===(n=null===(t=null==i?void 0:i.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Uf;return i.vto[this.brandId][e].frames}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Lf;if(!this.user.brandUserId)throw new xf;await qf.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(t=null==s?void 0:s.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Uf;if(!await Gf(i[0]))throw new Uf;return i}}const Wf=(e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),Wu.getInstance().setEnv(t),new Kf(e,new $f));var Qf;!function(e){e.ACROSS_BACK="across_back",e.ACROSS_FRONT="across_front",e.ACROSS_SHOULDER="across_shoulder",e.ANKLE="ankle",e.ARMEYE="arm_eye",e.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",e.BACK_CROTCH_LENGTH="back_crotch_length",e.BACK_NECK_TO_EBLOW="back_neck_to_elbow",e.BELOW_KNEE="below_knee",e.BICEP="bicep",e.BUST="bust",e.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",e.CALF="calf",e.CB_NECK_TO_WAIST="cb_neck_to_waist",e.CB_NECK_TO_WRIST="cb_neck_to_wrist",e.CF_NECK_TO_WAIST="cf_neck_to_waist",e.ELBOW="elbow",e.FOREARM="forearm",e.FRONT_CROTCH_LENGTH="front_crotch_length",e.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",e.HIGH_HIP="high_hip",e.HSP_TO_ACROSS_BACK="hsp_to_across_back",e.HSP_TO_ACROSS_FRONT="hsp_to_across_front",e.HSP_TO_BUST_POINT="hsp_to_bust_point",e.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",e.HSP_TO_WAIST_POSITION="hsp_to_waist_position",e.INSEAM="inseam",e.KNEE="knee",e.LOW_HIP="low_hip",e.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",e.MID_NECK="mid_neck",e.NECK_AT_BASE="neck_base",e.SHOULDER_DROP="shoulder_drop",e.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",e.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",e.SIDE_WAIST_TO_KNEE="side_waist_to_knee",e.THIGH="thigh",e.TOTAL_RISE_LENGTH="total_rise_length",e.UNDER_BUST="under_bust",e.VERTICAL_TRUNK="vertical_trunk",e.WAIST="waist",e.WRIST="wrist"}(Qf||(Qf={}));const Jf={[Qf.ACROSS_BACK]:"Across back",[Qf.ACROSS_FRONT]:"Across front",[Qf.ACROSS_SHOULDER]:"Across shoulder",[Qf.ANKLE]:"Ankle",[Qf.ARMEYE]:"Armeye",[Qf.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Qf.BACK_CROTCH_LENGTH]:"Back crotch length",[Qf.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Qf.BELOW_KNEE]:"Below knee",[Qf.BICEP]:"Bicep",[Qf.BUST]:"Chest/Bust",[Qf.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Qf.CALF]:"Calf",[Qf.CB_NECK_TO_WAIST]:"Cb neck to waist",[Qf.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Qf.CF_NECK_TO_WAIST]:"Cf neck to waist",[Qf.ELBOW]:"Elbow",[Qf.FOREARM]:"Forearm",[Qf.FRONT_CROTCH_LENGTH]:"Front crotch length",[Qf.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Qf.HIGH_HIP]:"High hip",[Qf.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Qf.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Qf.HSP_TO_BUST_POINT]:"Hsp to bust point",[Qf.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Qf.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Qf.INSEAM]:"Inseam",[Qf.KNEE]:"Knee",[Qf.LOW_HIP]:"Low hip",[Qf.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Qf.MID_NECK]:"Mid neck",[Qf.NECK_AT_BASE]:"Neck at base",[Qf.SHOULDER_DROP]:"Shoulder drop",[Qf.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Qf.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Qf.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Qf.THIGH]:"Thigh",[Qf.TOTAL_RISE_LENGTH]:"Total rise length",[Qf.UNDER_BUST]:"Under bust",[Qf.VERTICAL_TRUNK]:"Vertical trunk",[Qf.WAIST]:"Waist",[Qf.WRIST]:"Wrist"};var Yf;!function(e){e.BLOUSES="blouses",e.COATS="coats",e.DRESSES="dresses",e.JACKETS="jackets",e.PANTS="pants",e.PUFFERS_AND_PARKAS="puffer_and_parkas",e.SHORTS="shorts",e.SKIRTS="skirts",e.SWEATERS="sweaters",e.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Yf||(Yf={}));const Xf={[Yf.BLOUSES]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.COATS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.DRESSES]:[Qf.LOW_HIP,Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST],[Yf.JACKETS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.PANTS]:[Qf.LOW_HIP,Qf.WAIST,Qf.THIGH,Qf.INSEAM],[Yf.PUFFERS_AND_PARKAS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.SHORTS]:[Qf.LOW_HIP,Qf.WAIST,Qf.THIGH,Qf.INSEAM],[Yf.SKIRTS]:[Qf.LOW_HIP,Qf.WAIST],[Yf.SWEATERS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.T_SHIRTS_AND_TANKS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP]},Zf={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},ep={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},tp={activewear:{leggings:Yf.PANTS,joggers:Yf.PANTS,sweatshirts:Yf.SWEATERS},dresses:{a_line:Yf.DRESSES,bodycon:Yf.DRESSES,fit_and_flare:Yf.DRESSES,knit:Yf.DRESSES,shirt:Yf.DRESSES,slip:Yf.DRESSES,straight:Yf.DRESSES,wrap:Yf.DRESSES},jackets_and_coats:{denim_jackets:Yf.JACKETS,parkas:Yf.PUFFERS_AND_PARKAS,peacoats:Yf.COATS,puffer_jackets:Yf.PUFFERS_AND_PARKAS,raincoats:Yf.COATS,rompers:Yf.COATS,shackets:Yf.JACKETS,trench_coats:Yf.COATS},jeans:{bootcut:Yf.PANTS,flared:Yf.PANTS,mom:Yf.PANTS,relaxed:Yf.PANTS,skinny:Yf.PANTS,slim:Yf.PANTS,straight:Yf.PANTS,tapered:Yf.PANTS,wide_leg:Yf.PANTS},jumpsuits_and_rompers:{boiler_suits:Yf.DRESSES,denim:Yf.DRESSES,jumpsuits:Yf.DRESSES,overalls:Yf.DRESSES,rompers:Yf.DRESSES,unitards:Yf.DRESSES},pants_and_shorts:{cigarette:Yf.PANTS,culottes:Yf.SHORTS,denim_shorts:Yf.SHORTS,flared:Yf.PANTS,joggers:Yf.PANTS,leggings:Yf.PANTS,skinny:Yf.PANTS,wide_leg:Yf.PANTS},skirts:{a_line_flared:Yf.SKIRTS,denim:Yf.SKIRTS,knit:Yf.SKIRTS,pencil:Yf.SKIRTS,pleated:Yf.SKIRTS,skater:Yf.SKIRTS,slip:Yf.SKIRTS,wrap:Yf.SKIRTS},suits_and_tailoring:{blazers:Yf.JACKETS,suit_jackets:Yf.JACKETS,suit_skirts:Yf.SKIRTS,suit_trousers:Yf.PANTS,suit_vests:Yf.SWEATERS,trousers:Yf.PANTS},sweaters:{cardigans:Yf.SWEATERS,crewnecks:Yf.SWEATERS,hoodies_and_zipups:Yf.SWEATERS,sweatshirts:Yf.SWEATERS,turtlenecks:Yf.SWEATERS,v_necks:Yf.SWEATERS},tops:{bodysuits:Yf.BLOUSES,corsets_and_bustiers:Yf.BLOUSES,polos:Yf.T_SHIRTS_AND_TANKS,shirts_and_blouses:Yf.BLOUSES,t_shirts:Yf.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Yf.T_SHIRTS_AND_TANKS}};var np;!function(e){e.TOO_TIGHT="too_tight",e.TIGHT="tight",e.SLIGHTLY_TIGHT="slightly_tight",e.PERFECT_FIT="perfect_fit",e.SLIGHTLY_LOOSE="slightly_loose",e.LOOSE="loose",e.OVERSIZED="oversized",e.TOO_SHORT="too_short",e.SHORT="short",e.SLIGHTLY_SHORT="slightly_short",e.SLIGHTLY_LONG="slightly_long",e.LONG="long",e.TOO_LONG="too_long"}(np||(np={}));const rp={[np.TOO_TIGHT]:"Too Tight",[np.TIGHT]:"Tight",[np.SLIGHTLY_TIGHT]:"Slightly Tight",[np.PERFECT_FIT]:"Perfect Fit",[np.SLIGHTLY_LOOSE]:"Slightly Loose",[np.LOOSE]:"Loose",[np.OVERSIZED]:"Oversized",[np.TOO_SHORT]:"Too Short",[np.SHORT]:"Short",[np.SLIGHTLY_SHORT]:"Slightly Short",[np.SLIGHTLY_LONG]:"Slightly Long",[np.LONG]:"Long",[np.TOO_LONG]:"Too Long"};var sp;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(sp||(sp={}));var ip=Object.freeze({__proto__:null,get AvatarState(){return sp},Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],CategoryNames:Zf,get Classification(){return Yf},ClassificationLocations:Xf,get Fit(){return np},FitNames:rp,get MeasurementLocation(){return Qf},MeasurementLocationName:Jf,SubcategoryNames:ep,Taxonomy:tp});export{Bf as Errors,Wf as initShop,e as requests,t as responses,ip as types};
3310
3411
  //# sourceMappingURL=index.min.js.map