@thefittingroom/shop-ui 3.0.0-alpha-15 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/esm/index.js +23055 -23194
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +356 -269
- package/dist/esm/index.min.js.map +1 -0
- package/package.json +6 -6
- /package/{.env.dev → .env.tmp} +0 -0
package/dist/esm/index.min.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v3.0.0
|
|
2
|
+
* thefittingroom v3.0.0 (2025-07-31T18:25:26.172Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
|
-
function t
|
|
5
|
+
function e(t,n){let i=function(){0!==n.length&&e(n.slice(-1),n.slice(0,-1))};var r=new Image;r.onload=i,r.onerror=i,r.src=t}function t(t){e(t.slice(-1),t.slice(0,-1))}const n=(e,n)=>{const i=document.getElementById(e);if(!i)throw new Error(`Slider with id ${e} not found`);return{Load(e,r){if(!Array.isArray(e)||!e.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");t(e);const s=void 0!==r?r:0;i.value=s.toString(),i.max=(e.length-1).toString();const o=()=>{const t=parseInt(i.value);n(i,e[t])};return n(i,e[s]),i.removeEventListener("input",o),i.addEventListener("input",o),()=>{i.removeEventListener("input",o)}}}},i=function(e){const t=[];let n=0;for(let i=0;i<e.length;i++){let r=e.charCodeAt(i);r<128?t[n++]=r:r<2048?(t[n++]=r>>6|192,t[n++]=63&r|128):55296==(64512&r)&&i+1<e.length&&56320==(64512&e.charCodeAt(i+1))?(r=65536+((1023&r)<<10)+(1023&e.charCodeAt(++i)),t[n++]=r>>18|240,t[n++]=r>>12&63|128,t[n++]=r>>6&63|128,t[n++]=63&r|128):(t[n++]=r>>12|224,t[n++]=r>>6&63|128,t[n++]=63&r|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_,i=[];for(let t=0;t<e.length;t+=3){const r=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,l=r>>2,u=(3&r)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),i.push(n[l],n[u],n[h],n[d])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,i=0;for(;n<e.length;){const r=e[n++];if(r<128)t[i++]=String.fromCharCode(r);else if(r>191&&r<224){const s=e[n++];t[i++]=String.fromCharCode((31&r)<<6|63&s)}else if(r>239&&r<365){const s=((7&r)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[i++]=String.fromCharCode(55296+(s>>10)),t[i++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[i++]=String.fromCharCode((15&r)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let t=0;t<e.length;){const r=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==r||null==o||null==a||null==c)throw new s;const l=r<<2|o>>4;if(i.push(l),64!==a){const e=o<<4&240|a>>2;if(i.push(e),64!==c){const e=a<<6&192|c;i.push(e)}}}return i},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
|
-
* thefittingroom v2.0.
|
|
7
|
+
* thefittingroom v2.0.1 (2025-07-31T05:00:17.540Z)
|
|
8
8
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
9
|
-
*/
|
|
9
|
+
*/class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(e){return function(e){const t=i(e);return r.encodeByteArray(t,!0)}(e).replace(/\./g,"")},a=function(e){try{return r.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
12
|
-
* Copyright
|
|
12
|
+
* Copyright 2022 Google LLC
|
|
13
13
|
*
|
|
14
14
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
15
15
|
* you may not use this file except in compliance with the License.
|
|
@@ -23,9 +23,10 @@ function t(e,n){let i=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var
|
|
|
23
23
|
* See the License for the specific language governing permissions and
|
|
24
24
|
* limitations under the License.
|
|
25
25
|
*/
|
|
26
|
+
const c=()=>
|
|
26
27
|
/**
|
|
27
28
|
* @license
|
|
28
|
-
* Copyright
|
|
29
|
+
* Copyright 2022 Google LLC
|
|
29
30
|
*
|
|
30
31
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
31
32
|
* you may not use this file except in compliance with the License.
|
|
@@ -38,10 +39,11 @@ function t(e,n){let i=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var
|
|
|
38
39
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
39
40
|
* See the License for the specific language governing permissions and
|
|
40
41
|
* limitations under the License.
|
|
41
|
-
*/
|
|
42
|
+
*/
|
|
43
|
+
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__,l=()=>{try{return c()||(()=>{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&&a(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=l())||void 0===t?void 0:t.emulatorHosts)||void 0===n?void 0:n[e]},h=()=>{var e;return null===(e=l())||void 0===e?void 0:e.config},d=e=>{var t;return null===(t=l())||void 0===t?void 0:t[`_${e}`]};
|
|
42
44
|
/**
|
|
43
45
|
* @license
|
|
44
|
-
* Copyright
|
|
46
|
+
* Copyright 2017 Google LLC
|
|
45
47
|
*
|
|
46
48
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
47
49
|
* you may not use this file except in compliance with the License.
|
|
@@ -55,10 +57,10 @@ function t(e,n){let i=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var
|
|
|
55
57
|
* See the License for the specific language governing permissions and
|
|
56
58
|
* limitations under the License.
|
|
57
59
|
*/
|
|
58
|
-
|
|
60
|
+
class f{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))}}}
|
|
59
61
|
/**
|
|
60
62
|
* @license
|
|
61
|
-
* Copyright
|
|
63
|
+
* Copyright 2025 Google LLC
|
|
62
64
|
*
|
|
63
65
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
64
66
|
* you may not use this file except in compliance with the License.
|
|
@@ -71,11 +73,10 @@ const c=()=>
|
|
|
71
73
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
72
74
|
* See the License for the specific language governing permissions and
|
|
73
75
|
* limitations under the License.
|
|
74
|
-
*/
|
|
75
|
-
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__,l=()=>{try{return c()||(()=>{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&&a(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=l())||void 0===t?void 0:t.config},h=t=>{var e;return null===(e=l())||void 0===e?void 0:e[`_${t}`]};
|
|
76
|
+
*/function p(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch(e){return!1}}async function g(e){return(await fetch(e,{credentials:"include"})).ok}
|
|
76
77
|
/**
|
|
77
78
|
* @license
|
|
78
|
-
* Copyright
|
|
79
|
+
* Copyright 2021 Google LLC
|
|
79
80
|
*
|
|
80
81
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
81
82
|
* you may not use this file except in compliance with the License.
|
|
@@ -88,8 +89,7 @@ function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window
|
|
|
88
89
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
89
90
|
* See the License for the specific language governing permissions and
|
|
90
91
|
* limitations under the License.
|
|
91
|
-
*/
|
|
92
|
-
class d{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))}}}
|
|
92
|
+
*/const m={};let v=!1;function y(e,t){if("undefined"==typeof window||"undefined"==typeof document||!p(window.location.host)||m[e]===t||m[e]||v)return;function n(e){return`__firebase__banner__${e}`}m[e]=t;const i="__firebase__banner",r=function(){const e={prod:[],emulator:[]};for(const t of Object.keys(m))m[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){const e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" ×",e.onclick=()=>{v=!0,function(){const e=document.getElementById(i);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}}(i),t=n("text"),o=document.getElementById(t)||document.createElement("span"),a=n("learnmore"),c=document.getElementById(a)||document.createElement("a"),l=n("preprendIcon"),u=document.getElementById(l)||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=s();!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"}(u,l),t.append(u,o,c,n),document.body.appendChild(t)}r?(o.innerText="Preview backend disconnected.",u.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>'):(u.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()}
|
|
93
93
|
/**
|
|
94
94
|
* @license
|
|
95
95
|
* Copyright 2017 Google LLC
|
|
@@ -105,7 +105,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
105
105
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
106
106
|
* See the License for the specific language governing permissions and
|
|
107
107
|
* limitations under the License.
|
|
108
|
-
*/function
|
|
108
|
+
*/function w(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function b(){return!function(){var e;const t=null===(e=l())||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 _ extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,_.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,S.prototype.create)}}class S{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},i=`${this.service}/${e}`,r=this.errors[e],s=r?function(e,t){return e.replace(E,(e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`})}(r,n):"Error",o=`${this.serviceName}: ${s} (${i}).`;return new _(i,o,n)}}const E=/\{\$([^}]+)}/g;function T(e,t){if(e===t)return!0;const n=Object.keys(e),i=Object.keys(t);for(const r of n){if(!i.includes(r))return!1;const n=e[r],s=t[r];if(I(n)&&I(s)){if(!T(n,s))return!1}else if(n!==s)return!1}for(const e of i)if(!n.includes(e))return!1;return!0}function I(e){return null!==e&&"object"==typeof e}
|
|
109
109
|
/**
|
|
110
110
|
* @license
|
|
111
111
|
* Copyright 2017 Google LLC
|
|
@@ -121,7 +121,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
121
121
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
122
122
|
* See the License for the specific language governing permissions and
|
|
123
123
|
* limitations under the License.
|
|
124
|
-
*/function
|
|
124
|
+
*/function C(e){const t=[];for(const[n,i]of Object.entries(e))Array.isArray(i)?i.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(i));return t.length?"&"+t.join("&"):""}function k(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,i]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(i)}}),t}function A(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class R{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 i;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");i=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===i.next&&(i.next=x),void 0===i.error&&(i.error=x),void 0===i.complete&&(i.complete=x);const r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch(e){}}),this.observers.push(i),r}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 x(){}
|
|
125
125
|
/**
|
|
126
126
|
* @license
|
|
127
127
|
* Copyright 2021 Google LLC
|
|
@@ -137,7 +137,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
137
137
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
138
138
|
* See the License for the specific language governing permissions and
|
|
139
139
|
* limitations under the License.
|
|
140
|
-
*/function
|
|
140
|
+
*/function N(e){return e&&e._delegate?e._delegate:e}class O{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}}
|
|
141
141
|
/**
|
|
142
142
|
* @license
|
|
143
143
|
* Copyright 2019 Google LLC
|
|
@@ -153,7 +153,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
153
153
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
154
154
|
* See the License for the specific language governing permissions and
|
|
155
155
|
* limitations under the License.
|
|
156
|
-
*/const
|
|
156
|
+
*/const L="[DEFAULT]";
|
|
157
157
|
/**
|
|
158
158
|
* @license
|
|
159
159
|
* Copyright 2019 Google LLC
|
|
@@ -169,7 +169,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
169
169
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
170
170
|
* See the License for the specific language governing permissions and
|
|
171
171
|
* limitations under the License.
|
|
172
|
-
*/class
|
|
172
|
+
*/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 f;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),i=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(i)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(i)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}
|
|
173
173
|
/**
|
|
174
174
|
* @license
|
|
175
175
|
* Copyright 2019 Google LLC
|
|
@@ -185,7 +185,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
185
185
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
186
186
|
* See the License for the specific language governing permissions and
|
|
187
187
|
* limitations under the License.
|
|
188
|
-
*/(
|
|
188
|
+
*/(e))try{this.getOrInitializeService({instanceIdentifier:L})}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=L){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=L){return this.instances.has(e)}getOptions(e=L){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 i=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries()){n===this.normalizeInstanceIdentifier(e)&&t.resolve(i)}return i}onInit(e,t){var n;const i=this.normalizeInstanceIdentifier(t),r=null!==(n=this.onInitCallbacks.get(i))&&void 0!==n?n:new Set;r.add(e),this.onInitCallbacks.set(i,r);const s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const i of n)try{i(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:(i=e,i===L?void 0:i),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 i;return n||null}normalizeInstanceIdentifier(e=L){return this.component?this.component.multipleInstances?e:L:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class D{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())}}
|
|
189
189
|
/**
|
|
190
190
|
* @license
|
|
191
191
|
* Copyright 2017 Google LLC
|
|
@@ -201,7 +201,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
201
201
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
202
202
|
* See the License for the specific language governing permissions and
|
|
203
203
|
* limitations under the License.
|
|
204
|
-
*/var
|
|
204
|
+
*/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 F={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},z=M.INFO,U={[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 i=(new Date).toISOString(),r=U[t];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[r](`[${i}] ${e.name}:`,...n)};class B{constructor(e){this.name=e,this._logLevel=z,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?F[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 j,H;const $=new WeakMap,q=new WeakMap,G=new WeakMap,K=new WeakMap,W=new WeakMap;let Q={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return q.get(e);if("objectStoreNames"===t)return e.objectStoreNames||G.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return X(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function J(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(Z(this),t),X($.get(this))}:function(...t){return X(e.apply(Z(this),t))}:function(t,...n){const i=e.call(Z(this),t,...n);return G.set(i,t.sort?t.sort():[t]),X(i)}}function Y(e){return"function"==typeof e?J(e):(e instanceof IDBTransaction&&function(e){if(q.has(e))return;const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",s),e.removeEventListener("abort",s)},r=()=>{t(),i()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",s),e.addEventListener("abort",s)});q.set(e,t)}(e),t=e,(j||(j=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,Q):e);var t}function X(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",s)},r=()=>{t(X(e.result)),i()},s=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&$.set(t,e)}).catch(()=>{}),W.set(t,e),t}(e);if(K.has(e))return K.get(e);const t=Y(e);return t!==e&&(K.set(e,t),W.set(t,e)),t}const Z=e=>W.get(e);const ee=["get","getKey","getAll","getAllKeys","count"],te=["put","add","delete","clear"],ne=new Map;function ie(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ne.get(t))return ne.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,r=te.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!r&&!ee.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,r?"readwrite":"readonly");let o=s.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),r&&s.done]))[0]};return ne.set(t,s),s}Q=(e=>({...e,get:(t,n,i)=>ie(t,n)||e.get(t,n,i),has:(t,n)=>!!ie(t,n)||e.has(t,n)}))(Q);
|
|
205
205
|
/**
|
|
206
206
|
* @license
|
|
207
207
|
* Copyright 2019 Google LLC
|
|
@@ -218,7 +218,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
218
218
|
* See the License for the specific language governing permissions and
|
|
219
219
|
* limitations under the License.
|
|
220
220
|
*/
|
|
221
|
-
class
|
|
221
|
+
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",oe="0.13.2",ae=new B("@firebase/app"),ce="@firebase/app-compat",le="@firebase/analytics-compat",ue="@firebase/analytics",he="@firebase/app-check-compat",de="@firebase/app-check",fe="@firebase/auth",pe="@firebase/auth-compat",ge="@firebase/database",me="@firebase/data-connect",ve="@firebase/database-compat",ye="@firebase/functions",we="@firebase/functions-compat",be="@firebase/installations",_e="@firebase/installations-compat",Se="@firebase/messaging",Ee="@firebase/messaging-compat",Te="@firebase/performance",Ie="@firebase/performance-compat",Ce="@firebase/remote-config",ke="@firebase/remote-config-compat",Ae="@firebase/storage",Re="@firebase/storage-compat",xe="@firebase/firestore",Ne="@firebase/ai",Oe="@firebase/firestore-compat",Le="firebase",Pe="[DEFAULT]",De={[se]:"fire-core",[ce]:"fire-core-compat",[ue]:"fire-analytics",[le]:"fire-analytics-compat",[de]:"fire-app-check",[he]:"fire-app-check-compat",[fe]:"fire-auth",[pe]:"fire-auth-compat",[ge]:"fire-rtdb",[me]:"fire-data-connect",[ve]:"fire-rtdb-compat",[ye]:"fire-fn",[we]:"fire-fn-compat",[be]:"fire-iid",[_e]:"fire-iid-compat",[Se]:"fire-fcm",[Ee]:"fire-fcm-compat",[Te]:"fire-perf",[Ie]:"fire-perf-compat",[Ce]:"fire-rc",[ke]:"fire-rc-compat",[Ae]:"fire-gcs",[Re]:"fire-gcs-compat",[xe]:"fire-fst",[Oe]:"fire-fst-compat",[Ne]:"fire-vertex","fire-js":"fire-js",[Le]:"fire-js-all"},Me=new Map,Fe=new Map,ze=new Map;function Ue(e,t){try{e.container.addComponent(t)}catch(n){ae.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Ve(e){const t=e.name;if(ze.has(t))return ae.debug(`There were multiple attempts to register component ${t}.`),!1;ze.set(t,e);for(const t of Me.values())Ue(t,e);for(const t of Fe.values())Ue(t,e);return!0}function Be(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function je(e){return null!=e&&void 0!==e.settings}
|
|
222
222
|
/**
|
|
223
223
|
* @license
|
|
224
224
|
* Copyright 2019 Google LLC
|
|
@@ -234,7 +234,7 @@ class X{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
|
|
|
234
234
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
235
235
|
* See the License for the specific language governing permissions and
|
|
236
236
|
* limitations under the License.
|
|
237
|
-
*/const
|
|
237
|
+
*/const He=new S("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."});
|
|
238
238
|
/**
|
|
239
239
|
* @license
|
|
240
240
|
* Copyright 2019 Google LLC
|
|
@@ -251,7 +251,7 @@ class X{constructor(t){this.container=t}getPlatformInfoString(){return this.cont
|
|
|
251
251
|
* See the License for the specific language governing permissions and
|
|
252
252
|
* limitations under the License.
|
|
253
253
|
*/
|
|
254
|
-
class
|
|
254
|
+
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 O("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})}}
|
|
255
255
|
/**
|
|
256
256
|
* @license
|
|
257
257
|
* Copyright 2019 Google LLC
|
|
@@ -267,7 +267,7 @@ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
267
267
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
268
268
|
* See the License for the specific language governing permissions and
|
|
269
269
|
* limitations under the License.
|
|
270
|
-
*/const
|
|
270
|
+
*/const qe="11.10.0";function Ge(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const i=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),r=i.name;if("string"!=typeof r||!r)throw He.create("bad-app-name",{appName:String(r)});if(n||(n=h()),!n)throw He.create("no-options");const s=Me.get(r);if(s){if(T(n,s.options)&&T(i,s.config))return s;throw He.create("duplicate-app",{appName:r})}const o=new D(r);for(const e of ze.values())o.addComponent(e);const a=new $e(n,i,o);return Me.set(r,a),a}function Ke(e=Pe){const t=Me.get(e);if(!t&&e===Pe&&h())return Ge();if(!t)throw He.create("no-app",{appName:e});return t}function We(e,t,n){var i;let r=null!==(i=De[e])&&void 0!==i?i:e;n&&(r+=`-${n}`);const s=r.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const e=[`Unable to register library "${r}" with version "${t}":`];return s&&e.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void ae.warn(e.join(" "))}Ve(new O(`${r}-version`,()=>({library:r,version:t}),"VERSION"))}
|
|
271
271
|
/**
|
|
272
272
|
* @license
|
|
273
273
|
* Copyright 2021 Google LLC
|
|
@@ -283,7 +283,7 @@ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
283
283
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
284
284
|
* See the License for the specific language governing permissions and
|
|
285
285
|
* limitations under the License.
|
|
286
|
-
*/const
|
|
286
|
+
*/const Qe="firebase-heartbeat-store";let Je=null;function Ye(){return Je||(Je=function(e,t,{blocked:n,upgrade:i,blocking:r,terminated:s}={}){const o=indexedDB.open(e,t),a=X(o);return i&&o.addEventListener("upgradeneeded",e=>{i(X(o.result),e.oldVersion,e.newVersion,X(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{s&&e.addEventListener("close",()=>s()),r&&e.addEventListener("versionchange",e=>r(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Qe)}catch(e){console.warn(e)}}}).catch(e=>{throw He.create("idb-open",{originalErrorMessage:e.message})})),Je}async function Xe(e,t){try{const n=(await Ye()).transaction(Qe,"readwrite"),i=n.objectStore(Qe);await i.put(t,Ze(e)),await n.done}catch(e){if(e instanceof _)ae.warn(e.message);else{const t=He.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});ae.warn(t.message)}}}function Ze(e){return`${e.name}!${e.options.appId}`}
|
|
287
287
|
/**
|
|
288
288
|
* @license
|
|
289
289
|
* Copyright 2021 Google LLC
|
|
@@ -299,7 +299,7 @@ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
299
299
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
300
300
|
* See the License for the specific language governing permissions and
|
|
301
301
|
* limitations under the License.
|
|
302
|
-
*/class
|
|
302
|
+
*/class et{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new nt(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(),i=tt();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===i||this._heartbeatsCache.heartbeats.some(e=>e.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,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 i=1;i<e.length;i++)e[i].date<n&&(n=e[i].date,t=i);return t}
|
|
303
303
|
/**
|
|
304
304
|
* @license
|
|
305
305
|
* Copyright 2019 Google LLC
|
|
@@ -315,7 +315,26 @@ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
315
315
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
316
316
|
* See the License for the specific language governing permissions and
|
|
317
317
|
* limitations under the License.
|
|
318
|
-
*/var
|
|
318
|
+
*/(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ae.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=tt(),{heartbeatsToSend:n,unsentEntries:i}=function(e,t=1024){const n=[];let i=e.slice();for(const r of e){const e=n.find(e=>e.agent===r.agent);if(e){if(e.dates.push(r.date),it(n)>t){e.dates.pop();break}}else if(n.push({agent:r.agent,dates:[r.date]}),it(n)>t){n.pop();break}i=i.slice(1)}return{heartbeatsToSend:n,unsentEntries:i}}(this._heartbeatsCache.heartbeats),r=o(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return ae.warn(e),""}}}function tt(){return(new Date).toISOString().substring(0,10)}class nt{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 i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},r.onupgradeneeded=()=>{n=!1},r.onerror=()=>{var e;t((null===(e=r.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 Ye()).transaction(Qe),n=await t.objectStore(Qe).get(Ze(e));return await t.done,n}catch(e){if(e instanceof _)ae.warn(e.message);else{const t=He.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});ae.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 Xe(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 Xe(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function it(e){return o(JSON.stringify({version:2,heartbeats:e})).length}var rt;rt="",Ve(new O("platform-logger",e=>new re(e),"PRIVATE")),Ve(new O("heartbeat",e=>new et(e),"PRIVATE")),We(se,oe,rt),We(se,oe,"esm2017"),We("fire-js","");var st,ot,at="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
|
|
319
|
+
/** @license
|
|
320
|
+
Copyright The Closure Library Authors.
|
|
321
|
+
SPDX-License-Identifier: Apache-2.0
|
|
322
|
+
*/(function(){var e;
|
|
323
|
+
/** @license
|
|
324
|
+
|
|
325
|
+
Copyright The Closure Library Authors.
|
|
326
|
+
SPDX-License-Identifier: Apache-2.0
|
|
327
|
+
*/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 i=Array(16);if("string"==typeof t)for(var r=0;16>r;++r)i[r]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(r=0;16>r;++r)i[r]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],r=e.g[2];var s=e.g[3],o=t+(s^n&(r^s))+i[0]+3614090360&4294967295;o=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=(n=(r=(s=(t=n+(o<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[1]+3905402710&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[2]+606105819&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[3]+3250441966&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[4]+4118548399&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[5]+1200080426&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[6]+2821735955&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[7]+4249261313&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[8]+1770035416&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[9]+2336552879&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[10]+4294925233&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[11]+2304563134&4294967295)<<22&4294967295|o>>>10))+((o=t+(s^n&(r^s))+i[12]+1804603682&4294967295)<<7&4294967295|o>>>25))+((o=s+(r^t&(n^r))+i[13]+4254626195&4294967295)<<12&4294967295|o>>>20))+((o=r+(n^s&(t^n))+i[14]+2792965006&4294967295)<<17&4294967295|o>>>15))+((o=n+(t^r&(s^t))+i[15]+1236535329&4294967295)<<22&4294967295|o>>>10))+((o=t+(r^s&(n^r))+i[1]+4129170786&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[6]+3225465664&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[11]+643717713&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[0]+3921069994&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[5]+3593408605&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[10]+38016083&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[15]+3634488961&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[4]+3889429448&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[9]+568446438&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[14]+3275163606&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[3]+4107603335&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[8]+1163531501&4294967295)<<20&4294967295|o>>>12))+((o=t+(r^s&(n^r))+i[13]+2850285829&4294967295)<<5&4294967295|o>>>27))+((o=s+(n^r&(t^n))+i[2]+4243563512&4294967295)<<9&4294967295|o>>>23))+((o=r+(t^n&(s^t))+i[7]+1735328473&4294967295)<<14&4294967295|o>>>18))+((o=n+(s^t&(r^s))+i[12]+2368359562&4294967295)<<20&4294967295|o>>>12))+((o=t+(n^r^s)+i[5]+4294588738&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[8]+2272392833&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[11]+1839030562&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[14]+4259657740&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[1]+2763975236&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[4]+1272893353&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[7]+4139469664&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[10]+3200236656&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[13]+681279174&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[0]+3936430074&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[3]+3572445317&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[6]+76029189&4294967295)<<23&4294967295|o>>>9))+((o=t+(n^r^s)+i[9]+3654602809&4294967295)<<4&4294967295|o>>>28))+((o=s+(t^n^r)+i[12]+3873151461&4294967295)<<11&4294967295|o>>>21))+((o=r+(s^t^n)+i[15]+530742520&4294967295)<<16&4294967295|o>>>16))+((o=n+(r^s^t)+i[2]+3299628645&4294967295)<<23&4294967295|o>>>9))+((o=t+(r^(n|~s))+i[0]+4096336452&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[7]+1126891415&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[14]+2878612391&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[5]+4237533241&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[12]+1700485571&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[3]+2399980690&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[10]+4293915773&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[1]+2240044497&4294967295)<<21&4294967295|o>>>11))+((o=t+(r^(n|~s))+i[8]+1873313359&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[15]+4264355552&4294967295)<<10&4294967295|o>>>22))+((o=r+(t^(s|~n))+i[6]+2734768916&4294967295)<<15&4294967295|o>>>17))+((o=n+(s^(r|~t))+i[13]+1309151649&4294967295)<<21&4294967295|o>>>11))+((s=(t=n+((o=t+(r^(n|~s))+i[4]+4149444226&4294967295)<<6&4294967295|o>>>26))+((o=s+(n^(t|~r))+i[11]+3174756917&4294967295)<<10&4294967295|o>>>22))^((r=s+((o=r+(t^(s|~n))+i[2]+718787259&4294967295)<<15&4294967295|o>>>17))|~t))+i[9]+3951481745&4294967295,e.g[0]=e.g[0]+t&4294967295,e.g[1]=e.g[1]+(r+(o<<21&4294967295|o>>>11))&4294967295,e.g[2]=e.g[2]+r&4294967295,e.g[3]=e.g[3]+s&4294967295}function i(e,t){this.h=t;for(var n=[],i=!0,r=e.length-1;0<=r;r--){var s=0|e[r];i&&s==t||(n[r]=s,i=!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,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}(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 i=t-this.blockSize,r=this.B,s=this.h,o=0;o<t;){if(0==s)for(;o<=i;)n(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(r[s++]=e.charCodeAt(o++),s==this.blockSize){n(this,r),s=0;break}}else for(;o<t;)if(r[s++]=e[o++],s==this.blockSize){n(this,r),s=0;break}}this.h=s,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 i=0;32>i;i+=8)e[n++]=this.g[t]>>>i&255;return e};var r={};function s(e){return-128<=e&&128>e?function(e,t){var n=r;return Object.prototype.hasOwnProperty.call(n,e)?n[e]:n[e]=t(e)}(e,function(e){return new i([0|e],0>e?-1:0)}):new i([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,r=0;e>=n;r++)t[r]=e/n|0,n*=4294967296;return new i(t,0)}var a=s(0),c=s(1),l=s(16777216);function u(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 h(e){return-1==e.h}function d(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new i(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(u(t))throw Error("division by zero");if(u(e))return new g(a,a);if(h(e))return t=m(d(e),t),new g(d(t.g),d(t.h));if(h(t))return t=m(e,d(t)),new g(d(t.g),t.h);if(30<e.g.length){if(h(e)||h(t))throw Error("slowDivide_ only works with positive integers.");for(var n=c,i=t;0>=i.l(e);)n=v(n),i=v(i);var r=y(n,1),s=y(i,1);for(i=y(i,2),n=y(n,2);!u(i);){var l=s.add(i);0>=l.l(e)&&(r=r.add(n),s=l),i=y(i,1),n=y(n,1)}return t=f(e,r.j(t)),new g(r,t)}for(r=a;0<=e.l(t);){for(n=Math.max(1,Math.floor(e.m()/t.m())),i=48>=(i=Math.ceil(Math.log(n)/Math.LN2))?1:Math.pow(2,i-48),l=(s=o(n)).j(t);h(l)||0<l.l(e);)l=(s=o(n-=i)).j(t);u(s)&&(s=c),r=r.add(s),e=f(e,l)}return new g(r,e)}function v(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new i(n,e.h)}function y(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,s=[],o=0;o<r;o++)s[o]=0<t?e.i(o+n)>>>t|e.i(o+n+1)<<32-t:e.i(o+n);return new i(s,e.h)}(e=i.prototype).m=function(){if(h(this))return-d(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var i=this.i(n);e+=(0<=i?i:4294967296+i)*t,t*=4294967296}return e},e.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(u(this))return"0";if(h(this))return"-"+d(this).toString(e);for(var t=o(Math.pow(e,6)),n=this,i="";;){var r=m(n,t).g,s=((0<(n=f(n,r.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(u(n=r))return s+i;for(;6>s.length;)s="0"+s;i=s+i}},e.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},e.l=function(e){return h(e=f(this,e))?-1:u(e)?0:1},e.abs=function(){return h(this)?d(this):this},e.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,s=0;s<=t;s++){var o=r+(65535&this.i(s))+(65535&e.i(s)),a=(o>>>16)+(this.i(s)>>>16)+(e.i(s)>>>16);r=a>>>16,o&=65535,a&=65535,n[s]=a<<16|o}return new i(n,-2147483648&n[n.length-1]?-1:0)},e.j=function(e){if(u(this)||u(e))return a;if(h(this))return h(e)?d(this).j(d(e)):d(d(this).j(e));if(h(e))return d(this.j(d(e)));if(0>this.l(l)&&0>e.l(l))return o(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var s=0;s<e.g.length;s++){var c=this.i(r)>>>16,f=65535&this.i(r),g=e.i(s)>>>16,m=65535&e.i(s);n[2*r+2*s]+=f*m,p(n,2*r+2*s),n[2*r+2*s+1]+=c*m,p(n,2*r+2*s+1),n[2*r+2*s+1]+=f*g,p(n,2*r+2*s+1),n[2*r+2*s+2]+=c*g,p(n,2*r+2*s+2)}for(r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=t;r<2*t;r++)n[r]=0;return new i(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=[],r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new i(n,this.h&e.h)},e.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new i(n,this.h|e.h)},e.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new i(n,this.h^e.h)},t.prototype.digest=t.prototype.v,t.prototype.reset=t.prototype.s,t.prototype.update=t.prototype.u,ot=t,i.prototype.add=i.prototype.add,i.prototype.multiply=i.prototype.j,i.prototype.modulo=i.prototype.A,i.prototype.compare=i.prototype.l,i.prototype.toNumber=i.prototype.m,i.prototype.toString=i.prototype.toString,i.prototype.getBits=i.prototype.i,i.fromNumber=o,i.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 i=o(Math.pow(n,8)),r=a,s=0;s<t.length;s+=8){var c=Math.min(8,t.length-s),l=parseInt(t.substring(s,s+c),n);8>c?(c=o(Math.pow(n,c)),r=r.j(c).add(o(l))):r=(r=r.j(i)).add(o(l))}return r},st=i}).apply(void 0!==at?at:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var ct,lt,ut,ht,dt,ft,pt,gt,mt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
|
|
328
|
+
/** @license
|
|
329
|
+
Copyright The Closure Library Authors.
|
|
330
|
+
SPDX-License-Identifier: Apache-2.0
|
|
331
|
+
*/(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 mt&&mt];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,i){if(i)e:{var r=n;e=e.split(".");for(var s=0;s<e.length-1;s++){var o=e[s];if(!(o in r))break e;r=r[o]}(i=i(s=r[e=e[e.length-1]]))!=s&&null!=i&&t(r,e,{configurable:!0,writable:!0,value:i})}}("Array.prototype.values",function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var n=0,i=!1,r={next:function(){if(!i&&n<e.length){var r=n++;return{value:t(r,e[r]),done:!1}}return i=!0,{done:!0,value:void 0}}};return r[Symbol.iterator]=function(){return r},r}(this,function(e,t){return t})}});
|
|
332
|
+
/** @license
|
|
333
|
+
|
|
334
|
+
Copyright The Closure Library Authors.
|
|
335
|
+
SPDX-License-Identifier: Apache-2.0
|
|
336
|
+
*/
|
|
337
|
+
var i=i||{},r=this||self;function s(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 i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function l(e,t,n){return(l=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}function u(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 h(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,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return t.prototype[n].apply(e,r)}}function d(e){const t=e.length;if(0<t){const n=Array(t);for(let i=0;i<t;i++)n[i]=e[i];return n}return[]}function f(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(s(n)){const t=e.length||0,i=n.length||0;e.length=t+i;for(let r=0;r<i;r++)e[t+r]=n[r]}else e.push(n)}}function p(e){return/^[\s\xa0]*$/.test(e)}function g(){var e=r.navigator;return e&&(e=e.userAgent)?e:""}function m(e){return m[" "](e),e}m[" "]=function(){};var v=!(-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 y(e,t,n){for(const i in e)t.call(n,e[i],i,e)}function w(e){const t={};for(const n in e)t[n]=e[n];return t}const b="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function _(e,t){let n,i;for(let t=1;t<arguments.length;t++){for(n in i=arguments[t],i)e[n]=i[n];for(let t=0;t<b.length;t++)n=b[t],Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}}function S(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 E(e){r.setTimeout(()=>{throw e},0)}function T(){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 I=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 C,e=>e.reset());class C{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 k,A=!1,R=new class{constructor(){this.h=this.g=null}add(e,t){const n=I.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},x=()=>{const e=r.Promise.resolve(void 0);k=()=>{e.then(N)}};var N=()=>{for(var e;e=T();){try{e.h.call(e.g)}catch(e){E(e)}var t=I;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}A=!1};function O(){this.s=this.s,this.C=this.C}function L(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}O.prototype.s=!1,O.prototype.ma=function(){this.s||(this.s=!0,this.N())},O.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},L.prototype.h=function(){this.defaultPrevented=!0};var P=function(){if(!r.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};r.addEventListener("test",e,t),r.removeEventListener("test",e,t)}catch(e){}return e}();function D(e,t){if(L.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,i=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(v){e:{try{m(t.nodeName);var r=!0;break e}catch(e){}r=!1}r||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.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:M[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&D.aa.h.call(this)}}h(D,L);var M={2:"touch",3:"pen",4:"mouse"};D.prototype.h=function(){D.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var F="closure_listenable_"+(1e6*Math.random()|0),z=0;function U(e,t,n,i,r){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!i,this.ha=r,this.key=++z,this.da=this.fa=!1}function V(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 j(e,t){var n=t.type;if(n in e.g){var i,r=e.g[n],s=Array.prototype.indexOf.call(r,t,void 0);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(V(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function H(e,t,n,i){for(var r=0;r<e.length;++r){var s=e[r];if(!s.da&&s.listener==t&&s.capture==!!n&&s.ha==i)return r}return-1}B.prototype.add=function(e,t,n,i,r){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var o=H(e,t,i,r);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new U(t,this.src,s,!!i,r)).fa=n,e.push(t)),t};var $="closure_lm_"+(1e6*Math.random()|0),q={};function G(e,t,n,i,r){if(Array.isArray(t)){for(var s=0;s<t.length;s++)G(e,t[s],n,i,r);return null}return n=Z(n),e&&e[F]?e.K(t,n,!!o(i)&&!!i.capture,r):function(e,t,n,i,r,s){if(!t)throw Error("Invalid event type");var a=o(r)?!!r.capture:!!r,c=Y(e);if(c||(e[$]=c=new B(e)),n=c.add(t,n,i,a,s),n.proxy)return n;if(i=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=i,i.src=e,i.listener=n,e.addEventListener)P||(r=a),void 0===r&&(r=!1),e.addEventListener(t.toString(),i,r);else if(e.attachEvent)e.attachEvent(Q(t.toString()),i);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(i)}return n}(e,t,n,!1,i,r)}function K(e,t,n,i,r){if(Array.isArray(t))for(var s=0;s<t.length;s++)K(e,t[s],n,i,r);else i=o(i)?!!i.capture:!!i,n=Z(n),e&&e[F]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=H(s=e.g[t],n,i,r))&&(V(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete e.g[t],e.h--)))):e&&(e=Y(e))&&(t=e.g[t.toString()],e=-1,t&&(e=H(t,n,i,r)),(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[F])j(t.i,e);else{var n=e.type,i=e.proxy;t.removeEventListener?t.removeEventListener(n,i,e.capture):t.detachEvent?t.detachEvent(Q(n),i):t.addListener&&t.removeListener&&t.removeListener(i),(n=Y(t))?(j(n,e),0==n.h&&(n.src=null,t[$]=null)):V(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 D(t,this);var n=e.listener,i=e.ha||e.src;e.fa&&W(e),e=n.call(i,t)}return e}function Y(e){return(e=e[$])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(){O.call(this),this.i=new B(this),this.M=this,this.F=null}function te(e,t){var n,i=e.F;if(i)for(n=[];i;i=i.F)n.push(i);if(e=e.M,i=t.type||t,"string"==typeof t)t=new L(t,e);else if(t instanceof L)t.target=t.target||e;else{var r=t;_(t=new L(i,e),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];r=ne(o,i,!0,t)&&r}if(r=ne(o=t.g=e,i,!0,t)&&r,r=ne(o,i,!1,t)&&r,n)for(s=0;s<n.length;s++)r=ne(o=t.g=n[s],i,!1,t)&&r}function ne(e,t,n,i){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var r=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&j(e.i,o),r=!1!==a.call(c,i)&&r}}return r&&!i.defaultPrevented}function ie(e,t,n){if("function"==typeof e)n&&(e=l(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=l(e.handleEvent,e)}return 2147483647<Number(t)?-1:r.setTimeout(e,t||0)}function re(e){e.g=ie(()=>{e.g=null,e.i&&(e.i=!1,re(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}h(ee,O),ee.prototype[F]=!0,ee.prototype.removeEventListener=function(e,t,n,i){K(this,e,t,n,i)},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],i=0;i<n.length;i++)V(n[i]);delete t.g[e],t.h--}}this.F=null},ee.prototype.K=function(e,t,n,i){return this.i.add(String(e),t,!1,n,i)},ee.prototype.L=function(e,t,n,i){return this.i.add(String(e),t,!0,n,i)};class se extends O{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:re(this)}N(){super.N(),this.g&&(r.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function oe(e){O.call(this),this.h=e,this.g={}}h(oe,O);var ae=[];function ce(e){y(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 le=r.JSON.stringify,ue=r.JSON.parse,he=class{stringify(e){return r.JSON.stringify(e,void 0)}parse(e){return r.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(){L.call(this,"d")}function ve(){L.call(this,"c")}h(me,L),h(ve,L);var ye={},we=null;function be(){return we=we||new ee}function _e(e){L.call(this,ye.La,e)}function Se(e){const t=be();te(t,new _e(t))}function Ee(e,t){L.call(this,ye.STAT_EVENT,e),this.stat=t}function Te(e){const t=be();te(t,new Ee(t,e))}function Ie(e,t){L.call(this,ye.Ma,e),this.size=t}function Ce(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return r.setTimeout(function(){e()},t)}function ke(){this.g=!0}function Ae(e,t,n,i){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 i=n[e];if(!(2>i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<r.length;o++)r[o]=""}}}return le(n)}catch(e){return t}}(e,n)+(i?" "+i:"")})}ye.La="serverreachability",h(_e,L),ye.STAT_EVENT="statevent",h(Ee,L),ye.Ma="timingevent",h(Ie,L),ke.prototype.xa=function(){this.g=!1},ke.prototype.info=function(){};var Re,xe={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 Oe(){}function Le(e,t,n,i){this.j=e,this.i=t,this.l=n,this.R=i||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 Pe}function Pe(){this.i=null,this.g="",this.h=!1}h(Oe,de),Oe.prototype.g=function(){return new XMLHttpRequest},Oe.prototype.i=function(){return{}},Re=new Oe;var De={},Me={};function Fe(e,t,n){e.L=1,e.v=yt(rt(t)),e.m=n,e.P=!0,ze(e,null)}function ze(e,t){e.F=Date.now(),Be(e),e.A=rt(e.v);var n=e.A,i=e.R;Array.isArray(i)||(i=[String(i)]),Ot(n.i,"t",i),e.C=0,n=e.j.J,e.h=new Pe,e.g=bn(e.j,n?t:null,!e.m),0<e.O&&(e.M=new se(l(e.Y,e,e.g),e.O)),t=e.U,n=e.g,i=e.ca;var r="readystatechange";Array.isArray(r)||(r&&(ae[0]=r.toString()),r=ae);for(var s=0;s<r.length;s++){var o=G(n,r[s],i||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?w(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)),Se(),function(e,t,n,i,r,s){e.info(function(){if(e.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+i+") [attempt "+r+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Ue(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function Ve(e,t){var n=e.C,i=t.indexOf("\n",n);return-1==i?Me:(n=Number(t.substring(n,i)),isNaN(n)?De:(i+=1)+n>t.length?Me:(t=t.slice(i,i+n),e.C=i+n,t))}function Be(e){e.S=Date.now()+e.I,je(e,e.I)}function je(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ce(l(e.ba,e),t)}function He(e){e.B&&(r.clearTimeout(e.B),e.B=null)}function $e(e){0==e.j.G||e.J||gn(e.j,e)}function qe(e){He(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 i=n.Da.g.parse(t)}catch(e){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;pn(n),rn(n)}hn(n),Te(18)}}else n.za=r[1],0<n.za-n.T&&37500>r[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ce(l(n.Za,n),6e3));if(1>=Je(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else vn(n,11)}else if((e.K||n.g==e)&&pn(n),!p(t))for(r=n.Da.g.parse(t),t=0;t<r.length;t++){let l=r[t];if(n.T=l[0],l=l[1],2==n.G)if("c"==l[0]){n.K=l[1],n.ia=l[2];const t=l[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const r=l[4];null!=r&&(n.Aa=r,n.j.info("SVER="+n.Aa));const u=l[5];null!=u&&"number"==typeof u&&0<u&&(i=1.5*u,n.L=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;const h=e.g;if(h){const e=h.g?h.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=i.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(Xe(s,s.h),s.h=null))}if(i.D){const e=h.g?h.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(i.ya=e,vt(i.I,i.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((i=n).qa=wn(i,i.J?i.ia:null,i.W),o.K){Ze(i.h,o);var a=o,c=i.L;c&&(a.I=c),a.B&&(He(a),Be(a)),i.g=o}else un(i);0<n.i.length&&on(n)}else"stop"!=l[0]&&"close"!=l[0]||vn(n,7);else 3==n.G&&("stop"==l[0]||"close"==l[0]?"stop"==l[0]?vn(n,7):nn(n):"noop"!=l[0]&&n.l&&n.l.ta(l),n.v=0)}Se()}catch(e){}}Le.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==Xt(e)?t.j():this.Y(e)},Le.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||Se(),He(this);var n=this.g.Z();this.X=n;t:if(Ue(this)){var i=Zt(this.g);e="";var s=i.length,o=4==Xt(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){qe(this),$e(this);var a="";break t}this.h.i=new r.TextDecoder}for(t=0;t<s;t++)this.h.h=!0,e+=this.h.i.decode(i[t],{stream:!(o&&t==s-1)});i.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,i,r,s,o){e.info(function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+t+"\n"+n+"\n"+s+" "+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,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!p(c)){var u=c;break t}}u=null}if(!(n=u)){this.o=!1,this.s=3,Te(12),qe(this),$e(this);break e}Ae(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=Ve(this,a),e==Me){4==d&&(this.s=4,Te(14),n=!1),Ae(this.i,this.l,null,"[Incomplete Response]");break}if(e==De){this.s=4,Te(15),Ae(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}Ae(this.i,this.l,e,null),Ge(this,e)}if(Ue(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,Te(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var h=this.j;h.g==this&&h.ba&&!h.M&&(h.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),dn(h),h.M=!0,Te(11))}}else Ae(this.i,this.l,a,"[Invalid Chunked Response]"),qe(this),$e(this)}else Ae(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 i=0;i<e.length;i++){if(p(e[i]))continue;var n=S(e[i]);const r=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const s=t[r]||[];t[r]=s,s.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,Te(12)):(this.s=0,Te(13)),qe(this),$e(this)}}}catch(e){}},Le.prototype.cancel=function(){this.J=!0,qe(this)},Le.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&&(Se(),Te(17)),qe(this),this.s=2,$e(this)):je(this,this.S-e)};var Ke=class{constructor(e,t){this.g=e,this.map=t}};function We(e){this.l=e||10,r.PerformanceNavigationTiming?e=0<(e=r.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(r.chrome&&r.chrome.loadTimes&&r.chrome.loadTimes()&&r.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(s(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(s(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 i in e)t[n++]=i;return t}}}(e),i=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(s(e)){for(var t=[],n=e.length,i=0;i<n;i++)t.push(e[i]);return t}for(i in t=[],n=0,e)t[n++]=e[i];return t}(e),r=i.length,o=0;o<r;o++)t.call(void 0,i[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 it(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof it){this.h=e.h,st(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 At;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),at(this,n),this.m=e.m}else e&&(t=String(e).match(nt))?(this.h=!1,st(this,t[1]||"",!0),this.o=wt(t[2]||""),this.g=wt(t[3]||"",!0),ot(this,t[4]),this.l=wt(t[5]||"",!0),at(this,t[6]||"",!0),this.m=wt(t[7]||"")):(this.h=!1,this.i=new At(null,this.h))}function rt(e){return new it(e)}function st(e,t,n){e.j=n?wt(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 at(e,t,n){t instanceof At?(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&&(xt(this,t),Ot(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=bt(t,Ct)),e.i=new At(t,e.h))}function vt(e,t,n){e.i.set(t,n)}function yt(e){return vt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function wt(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function bt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,_t),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function _t(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}it.prototype.toString=function(){var e=[],t=this.j;t&&e.push(bt(t,Et,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(bt(t,Et,!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(bt(n,"/"==n.charAt(0)?It:Tt,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",bt(n,kt)),e.join("")};var St,Et=/[#\/\?@]/g,Tt=/[#\?:]/g,It=/[#\?]/g,Ct=/[#\?@]/g,kt=/#/g;function At(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 i=e[n].indexOf("="),r=null;if(0<=i){var s=e[n].substring(0,i);r=e[n].substring(i+1)}else s=e[n];t(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function xt(e,t){Rt(e),t=Lt(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=Lt(e,t),e.g.has(t)}function Ot(e,t,n){xt(e,t),0<n.length&&(e.i=null,e.g.set(Lt(e,t),d(n)),e.h+=n.length)}function Lt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Pt(e,t,n,i,r){try{r&&(r.onload=null,r.onerror=null,r.onabort=null,r.ontimeout=null),i(n)}catch(e){}}function Dt(){this.g=new he}function Mt(e,t,n){const i=n||"";try{tt(e,function(e,n){let r=e;o(e)&&(r=le(e)),t.push(i+n+"="+encodeURIComponent(r))})}catch(e){throw t.push(i+"type="+encodeURIComponent("_badmap")),e}}function Ft(e){this.l=e.Ub||null,this.j=e.eb||!1}function zt(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 Ut(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function Vt(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 jt(e){let t="";return y(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function Ht(e,t,n){e:{for(i in n){var i=!1;break e}i=!0}i||(n=jt(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):vt(e,t,n))}function $t(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=At.prototype).add=function(e,t){Rt(this),this.i=null,e=Lt(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,i){n.forEach(function(n){e.call(t,n,i,this)},this)},this)},e.na=function(){Rt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let i=0;i<t.length;i++){const r=e[i];for(let e=0;e<r.length;e++)n.push(t[i])}return n},e.V=function(e){Rt(this);let t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Lt(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=Lt(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 i=t[n];const s=encodeURIComponent(String(i)),o=this.V(i);for(i=0;i<o.length;i++){var r=s;""!==o[i]&&(r+="="+encodeURIComponent(String(o[i]))),e.push(r)}}return this.i=e.join("&")},h(Ft,de),Ft.prototype.g=function(){return new zt(this.l,this.j)},Ft.prototype.i=(St={},function(){return St}),h(zt,ee),(e=zt.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||r).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,Vt(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!==r.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;Ut(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?Vt(this):Bt(this),3==this.readyState&&Ut(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,Vt(this))},e.Qa=function(e){this.g&&(this.response=e,Vt(this))},e.ga=function(){this.g&&Vt(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(zt.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),h($t,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!==i&&(!e.v[1]||4!=Xt(e)||2!=e.Z()))if(e.u&&4==Xt(e))ie(e.Ea,0,e);else if(te(e,"readystatechange"),4==Xt(e)){e.h=!1;try{const i=e.Z();e:switch(i){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 s;if(s=0===i){var o=String(e.D).match(nt)[1]||null;!o&&r.self&&r.self.location&&(o=r.self.location.protocol.slice(0,-1)),s=!qt.test(o?o.toLowerCase():"")}n=s}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,i=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||te(e,"ready");try{n.onreadystatechange=i}catch(e){}}}function Yt(e){e.I&&(r.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 ke,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 Dt,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=rt(e.I);if(vt(n,"SID",e.K),vt(n,"RID",t),vt(n,"TYPE","terminate"),cn(e,n),(t=new Le(e,e.j,t)).L=2,t.v=yt(rt(n)),n=!1,r.navigator&&r.navigator.sendBeacon)try{n=r.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&r.Image&&((new Image).src=t.v,n=!0),n||(t.g=bn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Be(t)}yn(e)}function rn(e){e.g&&(dn(e),e.g.cancel(),e.g=null)}function sn(e){rn(e),e.u&&(r.clearTimeout(e.u),e.u=null),pn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&r.clearTimeout(e.s),e.s=null)}function on(e){if(!Qe(e.h)&&!e.s){e.s=!0;var t=e.Ga;k||x(),A||(k(),A=!0),R.add(t,e),e.B=0}}function an(e,t){var n;n=t?t.l:e.U++;const i=rt(e.I);vt(i,"SID",e.K),vt(i,"RID",n),vt(i,"AID",e.T),cn(e,i),e.m&&e.o&&Ht(i,e.m,e.o),n=new Le(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=ln(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),Xe(e.h,n),Fe(n,i,t)}function cn(e,t){e.H&&y(e.H,function(e,n){vt(t,n,e)}),e.l&&tt({},function(e,n){vt(t,n,e)})}function ln(e,t,n){n=Math.min(e.i.length,n);var i=e.l?l(e.l.Na,e.l,e):null;e:{var r=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=r[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let o=0;o<n;o++){let n=r[o].g;const a=r[o].map;if(n-=t,0>n)t=Math.max(0,r[o].g-100),s=!1;else try{Mt(a,e,"req"+n+"_")}catch(e){i&&i(a)}}if(s){i=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,i}function un(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;k||x(),A||(k(),A=!0),R.add(t,e),e.v=0}}function hn(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ce(l(e.Fa,e),mn(e,e.v)),e.v++,!0)}function dn(e){null!=e.A&&(r.clearTimeout(e.A),e.A=null)}function fn(e){e.g=new Le(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=rt(e.qa);vt(t,"RID","rpc"),vt(t,"SID",e.K),vt(t,"AID",e.T),vt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&vt(t,"TO",e.ja),vt(t,"TYPE","xmlhttp"),cn(e,t),e.m&&e.o&&Ht(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=yt(rt(t)),n.m=null,n.P=!0,ze(n,e)}function pn(e){null!=e.C&&(r.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 i=2}else{if(!Ye(e.h,t))return;n=t.D,Ze(e.h,t),i=1}if(0!=e.G)if(t.o)if(1==i){n=t.m?t.m.length:0,t=Date.now()-t.F;var r=e.B;te(i=be(),new Ie(i,n)),on(e)}else un(e);else if(3==(r=t.s)||0==r&&0<t.X||!(1==i&&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=Ce(l(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==i&&hn(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),r){case 1:vn(e,5);break;case 4:vn(e,10);break;case 3:vn(e,6);break;default:vn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function vn(e,t){if(e.j.info("Error code "+t),2==t){var n=l(e.fb,e),i=e.Xa;const t=!i;i=new it(i||"//www.google.com/images/cleardot.gif"),r.location&&"http"==r.location.protocol||st(i,"https"),yt(i),t?function(e,t){const n=new ke;if(r.Image){const i=new Image;i.onload=u(Pt,n,"TestLoadImage: loaded",!0,t,i),i.onerror=u(Pt,n,"TestLoadImage: error",!1,t,i),i.onabort=u(Pt,n,"TestLoadImage: abort",!1,t,i),i.ontimeout=u(Pt,n,"TestLoadImage: timeout",!1,t,i),r.setTimeout(function(){i.ontimeout&&i.ontimeout()},1e4),i.src=e}else t(!1)}(i.toString(),n):function(e,t){new ke;const n=new AbortController,i=setTimeout(()=>{n.abort(),Pt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(i),e.ok?Pt(0,0,!0,t):Pt(0,0,!1,t)}).catch(()=>{clearTimeout(i),Pt(0,0,!1,t)})}(i.toString(),n)}else Te(2);e.G=0,e.l&&e.l.sa(t),yn(e),sn(e)}function yn(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 wn(e,t,n){var i=n instanceof it?rt(n):new it(n);if(""!=i.g)t&&(i.g=t+"."+i.g),ot(i,i.s);else{var s=r.location;i=s.protocol,t=t?t+"."+s.hostname:s.hostname,s=+s.port;var o=new it(null);i&&st(o,i),t&&(o.g=t),s&&ot(o,s),n&&(o.l=n),i=o}return n=e.D,t=e.ya,n&&t&&vt(i,n,t),vt(i,"VER",e.la),cn(e,i),i}function bn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new $t(new Ft({eb:n})):new $t(e.pa)).Ha(e.J),t}function _n(){}function Sn(){}function En(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 Cn(this)}function Tn(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 In(){ve.call(this),this.status=1}function Cn(e){this.g=e}(e=$t.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,i){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=l(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),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));for(const e of i.keys())n.set(e,i.get(e))}i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),s=r.FormData&&e instanceof r.FormData,!(0<=Array.prototype.indexOf.call(Gt,t,void 0))||i||s||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)),$t.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)),ue(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,i){Te(0),this.W=e,this.H=t||{},n&&void 0!==i&&(this.H.OSID=n,this.H.OAID=i),this.F=this.X,this.I=wn(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 r=new Le(this,this.j,e);let s=this.o;if(this.S&&(s?(s=w(s),_(s,this.S)):s=this.S),null!==this.m||this.O||(r.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var i=this.i[n];if(void 0===(i="__data__"in i.map&&"string"==typeof(i=i.map.__data__)?i.length:void 0))break;if(4096<(t+=i)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=ln(this,r,t),vt(n=rt(this.I),"RID",e),vt(n,"CVER",22),this.D&&vt(n,"X-HTTP-Session-Id",this.D),cn(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(jt(s)))+"&"+t:this.m&&Ht(n,this.m,s)),Xe(this.h,r),this.Ua&&vt(n,"TYPE","init"),this.P?(vt(n,"$req",t),vt(n,"SID","null"),r.T=!0,Fe(r,n,null)):Fe(r,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=Ce(l(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,Te(10),rn(this),fn(this))},e.Za=function(){null!=this.C&&(this.C=null,rn(this),hn(this),Te(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Te(2)):(this.j.info("Failed to ping google.com"),Te(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=_n.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},Sn.prototype.g=function(e,t){return new En(e,t)},h(En,ee),En.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},En.prototype.close=function(){nn(this.g)},En.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=le(e),e=n);t.i.push(new Ke(t.Ya++,e)),3==t.G&&on(t)},En.prototype.N=function(){this.g.l=null,delete this.j,nn(this.g),delete this.g,En.aa.N.call(this)},h(Tn,me),h(In,ve),h(Cn,_n),Cn.prototype.ua=function(){te(this.g,"a")},Cn.prototype.ta=function(e){te(this.g,new Tn(e))},Cn.prototype.sa=function(e){te(this.g,new In)},Cn.prototype.ra=function(){te(this.g,"b")},Sn.prototype.createWebChannel=Sn.prototype.g,En.prototype.send=En.prototype.o,En.prototype.open=En.prototype.m,En.prototype.close=En.prototype.close,gt=function(){return new Sn},pt=function(){return be()},ft=ye,dt={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},xe.NO_ERROR=0,xe.TIMEOUT=8,xe.HTTP_ERROR=6,ht=xe,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,lt=pe,$t.prototype.listenOnce=$t.prototype.L,$t.prototype.getLastError=$t.prototype.Ka,$t.prototype.getLastErrorCode=$t.prototype.Ba,$t.prototype.getStatus=$t.prototype.Z,$t.prototype.getResponseJson=$t.prototype.Oa,$t.prototype.getResponseText=$t.prototype.oa,$t.prototype.send=$t.prototype.ea,$t.prototype.setWithCredentials=$t.prototype.Ha,ct=$t}).apply(void 0!==mt?mt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const vt="@firebase/firestore",yt="4.8.0";
|
|
319
338
|
/**
|
|
320
339
|
* @license
|
|
321
340
|
* Copyright 2017 Google LLC
|
|
@@ -331,7 +350,7 @@ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
331
350
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
332
351
|
* See the License for the specific language governing permissions and
|
|
333
352
|
* limitations under the License.
|
|
334
|
-
*/
|
|
353
|
+
*/class wt{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}}wt.UNAUTHENTICATED=new wt(null),wt.GOOGLE_CREDENTIALS=new wt("google-credentials-uid"),wt.FIRST_PARTY=new wt("first-party-uid"),wt.MOCK_USER=new wt("mock-user");
|
|
335
354
|
/**
|
|
336
355
|
* @license
|
|
337
356
|
* Copyright 2017 Google LLC
|
|
@@ -348,10 +367,10 @@ class Ft{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
348
367
|
* See the License for the specific language governing permissions and
|
|
349
368
|
* limitations under the License.
|
|
350
369
|
*/
|
|
351
|
-
|
|
370
|
+
let bt="11.10.0";
|
|
352
371
|
/**
|
|
353
372
|
* @license
|
|
354
|
-
* Copyright
|
|
373
|
+
* Copyright 2017 Google LLC
|
|
355
374
|
*
|
|
356
375
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
357
376
|
* you may not use this file except in compliance with the License.
|
|
@@ -364,11 +383,10 @@ const te=function(t){const e=[];let n=0;for(let i=0;i<t.length;i++){let r=t.char
|
|
|
364
383
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
365
384
|
* See the License for the specific language governing permissions and
|
|
366
385
|
* limitations under the License.
|
|
367
|
-
*/
|
|
368
|
-
const ie=()=>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 ee.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},se=()=>{try{return ie()||(()=>{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}`)}},oe=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 i=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),i]:[e.substring(0,n),i]};class ae extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,ae.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,ce.prototype.create)}}class ce{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},i=`${this.service}/${t}`,r=this.errors[t],s=r?function(t,e){return t.replace(le,((t,n)=>{const i=e[n];return null!=i?String(i):`<${n}?>`}))}(r,n):"Error",o=`${this.serviceName}: ${s} (${i}).`;return new ae(i,o,n)}}const le=/\{\$([^}]+)}/g;
|
|
386
|
+
*/const _t=new B("@firebase/firestore");function St(){return _t.logLevel}function Et(e,...t){if(_t.logLevel<=M.DEBUG){const n=t.map(Ct);_t.debug(`Firestore (${bt}): ${e}`,...n)}}function Tt(e,...t){if(_t.logLevel<=M.ERROR){const n=t.map(Ct);_t.error(`Firestore (${bt}): ${e}`,...n)}}function It(e,...t){if(_t.logLevel<=M.WARN){const n=t.map(Ct);_t.warn(`Firestore (${bt}): ${e}`,...n)}}function Ct(e){if("string"==typeof e)return e;try{
|
|
369
387
|
/**
|
|
370
388
|
* @license
|
|
371
|
-
* Copyright
|
|
389
|
+
* Copyright 2020 Google LLC
|
|
372
390
|
*
|
|
373
391
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
374
392
|
* you may not use this file except in compliance with the License.
|
|
@@ -381,7 +399,8 @@ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
381
399
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
382
400
|
* See the License for the specific language governing permissions and
|
|
383
401
|
* limitations under the License.
|
|
384
|
-
*/
|
|
402
|
+
*/
|
|
403
|
+
return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
385
404
|
/**
|
|
386
405
|
* @license
|
|
387
406
|
* Copyright 2017 Google LLC
|
|
@@ -397,7 +416,7 @@ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
397
416
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
398
417
|
* See the License for the specific language governing permissions and
|
|
399
418
|
* limitations under the License.
|
|
400
|
-
*/var de;!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"}(de||(de={}));const fe={debug:de.DEBUG,verbose:de.VERBOSE,info:de.INFO,warn:de.WARN,error:de.ERROR,silent:de.SILENT},pe=de.INFO,ge={[de.DEBUG]:"log",[de.VERBOSE]:"log",[de.INFO]:"info",[de.WARN]:"warn",[de.ERROR]:"error"},me=(t,e,...n)=>{if(e<t.logLevel)return;const i=(new Date).toISOString(),r=ge[e];if(!r)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[r](`[${i}] ${t.name}:`,...n)};var ye=function(t,e){return ye=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])},ye(t,e)};function ve(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],i=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function we(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var i,r,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(t){r={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}var be,Se="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Ee=Ee||{},_e=Se||self;function Ie(){}function Te(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 ke(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ce="closure_uid_"+(1e9*Math.random()>>>0),Ae=0;function Re(t,e,n){return t.call.apply(t.bind,arguments)}function Le(t,e,n){if(!t)throw Error();if(2<arguments.length){var i=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,i),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Ne(t,e,n){return(Ne=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?Re:Le).apply(null,arguments)}function xe(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 Oe(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,i){for(var r=Array(arguments.length-2),s=2;s<arguments.length;s++)r[s-2]=arguments[s];return e.prototype[n].apply(t,r)}}function De(){this.s=this.s,this.o=this.o}De.prototype.s=!1,De.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ce)&&t[Ce]||(t[Ce]=++Ae))},De.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),i=0;i<e;i++)n[i]=t[i];return n}return[]}function Fe(t,e){for(var n=1;n<arguments.length;n++){var i=arguments[n];if(Te(i)){var r=t.length||0,s=i.length||0;t.length=r+s;for(var o=0;o<s;o++)t[r+o]=i[o]}else t.push(i)}}function Ue(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Ue.prototype.h=function(){this.defaultPrevented=!0};var ze=function(){if(!_e.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{_e.addEventListener("test",Ie,e),_e.removeEventListener("test",Ie,e)}catch(t){}return t}();function Be(t){return/^[\s\xa0]*$/.test(t)}var Ve=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=_e.navigator;return t&&(t=t.userAgent)?t:""}function qe(t){return-1!=je().indexOf(t)}function $e(t){return $e[" "](t),t}$e[" "]=Ie;var Ke,We,Ge=qe("Opera"),Qe=qe("Trident")||qe("MSIE"),Ye=qe("Edge"),Je=Ye||Qe,Xe=qe("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!qe("Edge"))&&!(qe("Trident")||qe("MSIE"))&&!qe("Edge"),Ze=-1!=je().toLowerCase().indexOf("webkit")&&!qe("Edge");function tn(){var t=_e.document;return t?t.documentMode:void 0}t:{var en="",nn=(We=je(),Xe?/rv:([^\);]+)(\)|;)/.exec(We):Ye?/Edge\/([\d\.]+)/.exec(We):Qe?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(We):Ze?/WebKit\/(\S+)/.exec(We):Ge?/(?:Version)[ \/]?(\S+)/.exec(We):void 0);if(nn&&(en=nn?nn[1]:""),Qe){var rn=tn();if(null!=rn&&rn>parseFloat(en)){Ke=String(rn);break t}}Ke=en}var sn,on={};function an(){return function(t){var e=on;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Ve(String(Ke)).split("."),n=Ve("9").split("."),i=Math.max(e.length,n.length),r=0;0==t&&r<i;r++){var s=e[r]||"",o=n[r]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=He(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==s[2].length,0==o[2].length)||He(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(_e.document&&Qe){var cn=tn();sn=cn||(parseInt(Ke,10)||void 0)}else sn=void 0;var ln=sn;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,i=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Xe){t:{try{$e(e.nodeName);var r=!0;break t}catch(t){}r=!1}r||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,i?(this.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.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)}}Oe(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 dn="closure_listenable_"+(1e6*Math.random()|0),fn=0;function pn(t,e,n,i,r){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!i,this.ha=r,this.key=++fn,this.ba=this.ea=!1}function gn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function mn(t,e,n){for(var i in t)e.call(n,t[i],i,t)}function yn(t){var e={};for(var n in t)e[n]=t[n];return e}var vn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function wn(t,e){for(var n,i,r=1;r<arguments.length;r++){for(n in i=arguments[r])t[n]=i[n];for(var s=0;s<vn.length;s++)n=vn[s],Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}}function bn(t){this.src=t,this.g={},this.h=0}function Sn(t,e){var n=e.type;if(n in t.g){var i,r=t.g[n],s=Pe(r,e);(i=0<=s)&&Array.prototype.splice.call(r,s,1),i&&(gn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function En(t,e,n,i){for(var r=0;r<t.length;++r){var s=t[r];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==i)return r}return-1}bn.prototype.add=function(t,e,n,i,r){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=En(t,e,i,r);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new pn(e,this.src,s,!!i,r)).ea=n,t.push(e)),e};var _n="closure_lm_"+(1e6*Math.random()|0),In={};function Tn(t,e,n,i,r){if(i&&i.once)return Cn(t,e,n,i,r);if(Array.isArray(e)){for(var s=0;s<e.length;s++)Tn(t,e[s],n,i,r);return null}return n=Dn(n),t&&t[dn]?t.N(e,n,ke(i)?!!i.capture:!!i,r):kn(t,e,n,!1,i,r)}function kn(t,e,n,i,r,s){if(!e)throw Error("Invalid event type");var o=ke(r)?!!r.capture:!!r,a=xn(t);if(a||(t[_n]=a=new bn(t)),(n=a.add(e,n,i,o,s)).proxy)return n;if(i=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Nn;return t}(),n.proxy=i,i.src=t,i.listener=n,t.addEventListener)ze||(r=o),void 0===r&&(r=!1),t.addEventListener(e.toString(),i,r);else if(t.attachEvent)t.attachEvent(Ln(e.toString()),i);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(i)}return n}function Cn(t,e,n,i,r){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Cn(t,e[s],n,i,r);return null}return n=Dn(n),t&&t[dn]?t.O(e,n,ke(i)?!!i.capture:!!i,r):kn(t,e,n,!0,i,r)}function An(t,e,n,i,r){if(Array.isArray(e))for(var s=0;s<e.length;s++)An(t,e[s],n,i,r);else i=ke(i)?!!i.capture:!!i,n=Dn(n),t&&t[dn]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=En(s=t.g[e],n,i,r))&&(gn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=xn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=En(e,n,i,r)),(n=-1<t?e[t]:null)&&Rn(n))}function Rn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[dn])Sn(e.i,t);else{var n=t.type,i=t.proxy;e.removeEventListener?e.removeEventListener(n,i,t.capture):e.detachEvent?e.detachEvent(Ln(n),i):e.addListener&&e.removeListener&&e.removeListener(i),(n=xn(e))?(Sn(n,t),0==n.h&&(n.src=null,e[_n]=null)):gn(t)}}}function Ln(t){return t in In?In[t]:In[t]="on"+t}function Nn(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,i=t.ha||t.src;t.ea&&Rn(t),t=n.call(i,e)}return t}function xn(t){return(t=t[_n])instanceof bn?t:null}var On="__closure_events_fn_"+(1e9*Math.random()>>>0);function Dn(t){return"function"==typeof t?t:(t[On]||(t[On]=function(e){return t.handleEvent(e)}),t[On])}function Pn(){De.call(this),this.i=new bn(this),this.P=this,this.I=null}function Mn(t,e){var n,i=t.I;if(i)for(n=[];i;i=i.I)n.push(i);if(t=t.P,i=e.type||e,"string"==typeof e)e=new Ue(e,t);else if(e instanceof Ue)e.target=e.target||t;else{var r=e;wn(e=new Ue(i,t),r)}if(r=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];r=Fn(o,i,!0,e)&&r}if(r=Fn(o=e.g=t,i,!0,e)&&r,r=Fn(o,i,!1,e)&&r,n)for(s=0;s<n.length;s++)r=Fn(o=e.g=n[s],i,!1,e)&&r}function Fn(t,e,n,i){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var r=!0,s=0;s<e.length;++s){var o=e[s];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&Sn(t.i,o),r=!1!==a.call(c,i)&&r}}return r&&!i.defaultPrevented}Oe(Pn,De),Pn.prototype[dn]=!0,Pn.prototype.removeEventListener=function(t,e,n,i){An(this,t,e,n,i)},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],i=0;i<n.length;i++)gn(n[i]);delete e.g[t],e.h--}}this.I=null},Pn.prototype.N=function(t,e,n,i){return this.i.add(String(t),e,!1,n,i)},Pn.prototype.O=function(t,e,n,i){return this.i.add(String(t),e,!0,n,i)};var Un=_e.JSON.stringify;function zn(){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 Bn,Vn=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 qn(t){_e.setTimeout((function(){throw t}),0)}function $n(t,e){Bn||function(){var t=_e.Promise.resolve(void 0);Bn=function(){t.then(Gn)}}(),Kn||(Bn(),Kn=!0),Wn.add(t,e)}var Kn=!1,Wn=new Vn;function Gn(){for(var t;t=zn();){try{t.h.call(t.g)}catch(t){qn(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Kn=!1}function Qn(t,e){Pn.call(this),this.h=t||1,this.g=e||_e,this.j=Ne(this.lb,this),this.l=Date.now()}function Yn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Jn(t,e,n){if("function"==typeof t)n&&(t=Ne(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ne(t.handleEvent,t)}return 2147483647<Number(e)?-1:_e.setTimeout(t,e||0)}function Xn(t){t.g=Jn((function(){t.g=null,t.i&&(t.i=!1,Xn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Oe(Qn,Pn),(be=Qn.prototype).ca=!1,be.R=null,be.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&&(Yn(this),this.start()))}},be.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},be.M=function(){Qn.X.M.call(this),Yn(this),delete this.g};var Zn=function(t){function e(e,n){var i=t.call(this)||this;return i.m=e,i.j=n,i.h=null,i.i=!1,i.g=null,i}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}ye(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:Xn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(_e.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(De);function ti(t){De.call(this),this.h=t,this.g={}}Oe(ti,De);var ei=[];function ni(t,e,n,i){Array.isArray(n)||(n&&(ei[0]=n.toString()),n=ei);for(var r=0;r<n.length;r++){var s=Tn(e,n[r],i||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function ii(t){mn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&Rn(t)}),t),t.g={}}function ri(){this.g=!0}function si(t,e,n,i){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 i=n[t];if(!(2>i.length)){var r=i[1];if(Array.isArray(r)&&!(1>r.length)){var s=r[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<r.length;o++)r[o]=""}}}return Un(n)}catch(t){return e}}(t,n)+(i?" "+i:"")}))}ti.prototype.M=function(){ti.X.M.call(this),ii(this)},ti.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},ri.prototype.Aa=function(){this.g=!1},ri.prototype.info=function(){};var oi={},ai=null;function ci(){return ai=ai||new Pn}function li(t){Ue.call(this,oi.Pa,t)}function ui(t){var e=ci();Mn(e,new li(e))}function hi(t,e){Ue.call(this,oi.STAT_EVENT,t),this.stat=e}function di(t){var e=ci();Mn(e,new hi(e,t))}function fi(t,e){Ue.call(this,oi.Qa,t),this.size=e}function pi(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return _e.setTimeout((function(){t()}),e)}oi.Pa="serverreachability",Oe(li,Ue),oi.STAT_EVENT="statevent",Oe(hi,Ue),oi.Qa="timingevent",Oe(fi,Ue);var gi={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},mi={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function yi(){}function vi(t){return t.h||(t.h=t.i())}function wi(){}yi.prototype.h=null;var bi,Si={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Ei(){Ue.call(this,"d")}function _i(){Ue.call(this,"c")}function Ii(){}function Ti(t,e,n,i){this.l=t,this.j=e,this.m=n,this.U=i||1,this.S=new ti(this),this.O=Ci,t=Je?125:void 0,this.T=new Qn(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 ki}function ki(){this.i=null,this.g="",this.h=!1}Oe(Ei,Ue),Oe(_i,Ue),Oe(Ii,yi),Ii.prototype.g=function(){return new XMLHttpRequest},Ii.prototype.i=function(){return{}},bi=new Ii;var Ci=45e3,Ai={},Ri={};function Li(t,e,n){t.K=1,t.v=Qi(qi(e)),t.s=n,t.P=!0,Ni(t,null)}function Ni(t,e){t.F=Date.now(),Pi(t),t.A=qi(t.v);var n=t.A,i=t.U;Array.isArray(i)||(i=[String(i)]),cr(n.i,"t",i),t.C=0,n=t.l.H,t.h=new ki,t.g=cs(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Zn(Ne(t.La,t,t.g),t.N)),ni(t.S,t.g,"readystatechange",t.ib),e=t.H?yn(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)),ui(),function(t,e,n,i,r,s){t.info((function(){if(t.g)if(s)for(var o="",a=s.split("&"),c=0;c<a.length;c++){var l=a[c].split("=");if(1<l.length){var u=l[0];l=l[1];var h=u.split("_");o=2<=h.length&&"type"==h[1]?o+(u+"=")+l+"&":o+(u+"=redacted&")}}else o=null;else o=s;return"XMLHTTP REQ ("+i+") [attempt "+r+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function xi(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Oi(t,e,n){for(var i,r=!0;!t.I&&t.C<n.length;){if((i=Di(t,n))==Ri){4==e&&(t.o=4,di(14),r=!1),si(t.j,t.m,null,"[Incomplete Response]");break}if(i==Ai){t.o=4,di(15),si(t.j,t.m,n,"[Invalid Chunk]"),r=!1;break}si(t.j,t.m,i,null),Bi(t,i)}xi(t)&&i!=Ri&&i!=Ai&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,di(16),r=!1),t.i=t.i&&r,r?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),ts(e),e.K=!0,di(11))):(si(t.j,t.m,n,"[Invalid Chunked Response]"),zi(t),Ui(t))}function Di(t,e){var n=t.C,i=e.indexOf("\n",n);return-1==i?Ri:(n=Number(e.substring(n,i)),isNaN(n)?Ai:(i+=1)+n>e.length?Ri:(e=e.substr(i,n),t.C=i+n,e))}function Pi(t){t.V=Date.now()+t.O,Mi(t,t.O)}function Mi(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=pi(Ne(t.gb,t),e)}function Fi(t){t.B&&(_e.clearTimeout(t.B),t.B=null)}function Ui(t){0==t.l.G||t.I||is(t.l,t)}function zi(t){Fi(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Yn(t.T),ii(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Bi(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||gr(n.h,t)))if(!t.J&&gr(n.h,t)&&3==n.G){try{var i=n.Fa.g.parse(e)}catch(s){i=null}if(Array.isArray(i)&&3==i.length){var r=i;if(0==r[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ns(n),Kr(n)}Zr(n),di(18)}}else n.Ba=r[1],0<n.Ba-n.T&&37500>r[2]&&n.L&&0==n.A&&!n.v&&(n.v=pi(Ne(n.cb,n),6e3));if(1>=pr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ss(n,11)}else if((t.J||n.g==t)&&ns(n),!Be(e))for(r=n.Fa.g.parse(e),e=0;e<r.length;e++){var s=r[e];if(n.T=s[0],s=s[1],2==n.G)if("c"==s[0]){n.I=s[1],n.ka=s[2];var o=s[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=s[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=s[5];null!=c&&"number"==typeof c&&0<c&&(i=1.5*c,n.J=i,n.j.info("backChannelRequestTimeoutMs_="+i)),i=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=i.h;h.g||-1==u.indexOf("spdy")&&-1==u.indexOf("quic")&&-1==u.indexOf("h2")||(h.j=h.l,h.g=new Set,h.h&&(mr(h,h.h),h.h=null))}if(i.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(i.za=d,Gi(i.F,i.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((i=n).sa=as(i,i.H?i.ka:null,i.V),f.J){yr(i.h,f);var p=f,g=i.J;g&&p.setTimeout(g),p.B&&(Fi(p),Pi(p)),i.g=f}else Xr(i);0<n.i.length&&Gr(n)}else"stop"!=s[0]&&"close"!=s[0]||ss(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ss(n,7):$r(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ui()}catch(s){}}function Vi(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Te(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(Te(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var i in e=[],n=0,t)e[n++]=i;return e}}}(t),i=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(Te(t)){for(var e=[],n=t.length,i=0;i<n;i++)e.push(t[i]);return e}for(i in e=[],n=0,t)e[n++]=t[i];return e}(t),r=i.length,s=0;s<r;s++)e.call(void 0,i[s],n&&n[s],t)}(be=Ti.prototype).setTimeout=function(t){this.O=t},be.ib=function(t){t=t.target;var e=this.L;e&&3==zr(t)?e.l():this.La(t)},be.La=function(t){try{if(t==this.g)t:{var e=zr(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Je||this.g&&(this.h.h||this.g.fa()||Br(this.g)))){this.I||4!=e||7==n||ui(),Fi(this);var i=this.g.aa();this.Y=i;e:if(xi(this)){var r=Br(this.g);t="";var s=r.length,o=4==zr(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){zi(this),Ui(this);var a="";break e}this.h.i=new _e.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(r[n],{stream:o&&n==s-1});r.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==i,function(t,e,n,i,r,s,o){t.info((function(){return"XMLHTTP RESP ("+i+") [ attempt "+r+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,i),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Be(c)){var u=c;break e}}u=null}if(!(i=u)){this.i=!1,this.o=3,di(12),zi(this),Ui(this);break t}si(this.j,this.m,i,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Bi(this,i)}this.P?(Oi(this,e,a),Je&&this.i&&3==e&&(ni(this.S,this.T,"tick",this.hb),this.T.start())):(si(this.j,this.m,a,null),Bi(this,a)),4==e&&zi(this),this.i&&!this.I&&(4==e?is(this.l,this):(this.i=!1,Pi(this)))}else 400==i&&0<a.indexOf("Unknown SID")?(this.o=3,di(12)):(this.o=0,di(13)),zi(this),Ui(this)}}}catch(e){}},be.hb=function(){if(this.g){var t=zr(this.g),e=this.g.fa();this.C<e.length&&(Fi(this),Oi(this,t,e),this.i&&4!=t&&Pi(this))}},be.cancel=function(){this.I=!0,zi(this)},be.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&&(ui(),di(17)),zi(this),this.o=2,Ui(this)):Mi(this,this.V-t)};var Hi=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function ji(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof ji){this.h=void 0!==e?e:t.h,$i(this,t.j),this.s=t.s,this.g=t.g,Ki(this,t.m),this.l=t.l,e=t.i;var n=new rr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Wi(this,n),this.o=t.o}else t&&(n=String(t).match(Hi))?(this.h=!!e,$i(this,n[1]||"",!0),this.s=Yi(n[2]||""),this.g=Yi(n[3]||"",!0),Ki(this,n[4]),this.l=Yi(n[5]||"",!0),Wi(this,n[6]||"",!0),this.o=Yi(n[7]||"")):(this.h=!!e,this.i=new rr(null,this.h))}function qi(t){return new ji(t)}function $i(t,e,n){t.j=n?Yi(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Ki(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 Wi(t,e,n){e instanceof rr?(t.i=e,function(t,e){e&&!t.j&&(sr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(or(this,e),cr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Ji(e,nr)),t.i=new rr(e,t.h))}function Gi(t,e,n){t.i.set(e,n)}function Qi(t){return Gi(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Yi(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Ji(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Xi),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Xi(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}ji.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Ji(e,Zi,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Ji(e,Zi,!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(Ji(n,"/"==n.charAt(0)?er:tr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Ji(n,ir)),t.join("")};var Zi=/[#\/\?@]/g,tr=/[#\?:]/g,er=/[#\?]/g,nr=/[#\?@]/g,ir=/#/g;function rr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function sr(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 i=t[n].indexOf("="),r=null;if(0<=i){var s=t[n].substring(0,i);r=t[n].substring(i+1)}else s=t[n];e(s,r?decodeURIComponent(r.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function or(t,e){sr(t),e=lr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ar(t,e){return sr(t),e=lr(t,e),t.g.has(e)}function cr(t,e,n){or(t,e),0<n.length&&(t.i=null,t.g.set(lr(t,e),Me(n)),t.h+=n.length)}function lr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(be=rr.prototype).add=function(t,e){sr(this),this.i=null,t=lr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},be.forEach=function(t,e){sr(this),this.g.forEach((function(n,i){n.forEach((function(n){t.call(e,n,i,this)}),this)}),this)},be.oa=function(){sr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],i=0;i<e.length;i++)for(var r=t[i],s=0;s<r.length;s++)n.push(e[i]);return n},be.W=function(t){sr(this);var e=[];if("string"==typeof t)ar(this,t)&&(e=e.concat(this.g.get(lr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},be.set=function(t,e){return sr(this),this.i=null,ar(this,t=lr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},be.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},be.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 i=e[n],r=encodeURIComponent(String(i)),s=this.W(i);for(i=0;i<s.length;i++){var o=r;""!==s[i]&&(o+="="+encodeURIComponent(String(s[i]))),t.push(o)}}return this.i=t.join("&")};var ur=function(t,e){this.h=t,this.g=e};function hr(t){this.l=t||dr,_e.PerformanceNavigationTiming?t=0<(t=_e.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(_e.g&&_e.g.Ga&&_e.g.Ga()&&_e.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 dr=10;function fr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function pr(t){return t.h?1:t.g?t.g.size:0}function gr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function mr(t,e){t.g?t.g.add(e):t.h=e}function yr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function vr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var i=t.i;try{for(var r=ve(t.g.values()),s=r.next();!s.done;s=r.next()){var o=s.value;i=i.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(e)throw e.error}}return i}return Me(t.i)}function wr(){}function br(){this.g=new wr}function Sr(t,e,n){var i=n||"";try{Vi(t,(function(t,n){var r=t;ke(t)&&(r=Un(t)),e.push(i+n+"="+encodeURIComponent(r))}))}catch(t){throw e.push(i+"type="+encodeURIComponent("_badmap")),t}}function Er(t,e,n,i,r){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,r(i)}catch(t){}}function _r(t){this.l=t.ac||null,this.j=t.jb||!1}function Ir(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Tr,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}hr.prototype.cancel=function(){var t,e;if(this.i=vr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ve(this.g.values()),i=n.next();!i.done;i=n.next()){i.value.cancel()}}catch(e){t={error:e}}finally{try{i&&!i.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},wr.prototype.stringify=function(t){return _e.JSON.stringify(t,void 0)},wr.prototype.parse=function(t){return _e.JSON.parse(t,void 0)},Oe(_r,yi),_r.prototype.g=function(){return new Ir(this.l,this.j)},_r.prototype.i=function(t){return function(){return t}}({}),Oe(Ir,Pn);var Tr=0;function kr(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Cr(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ar(t)}function Ar(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(be=Ir.prototype).open=function(t,e){if(this.readyState!=Tr)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ar(this)},be.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||_e).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},be.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,Cr(this)),this.readyState=Tr},be.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,Ar(this)),this.g&&(this.readyState=3,Ar(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==_e.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;kr(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},be.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?Cr(this):Ar(this),3==this.readyState&&kr(this)}},be.Va=function(t){this.g&&(this.response=this.responseText=t,Cr(this))},be.Ua=function(t){this.g&&(this.response=t,Cr(this))},be.ga=function(){this.g&&Cr(this)},be.setRequestHeader=function(t,e){this.v.append(t,e)},be.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},be.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(Ir.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var Rr=_e.JSON.parse;function Lr(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=Nr,this.K=this.L=!1}Oe(Lr,Pn);var Nr="",xr=/^https?$/i,Or=["POST","PUT"];function Dr(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Pr(t),Fr(t)}function Pr(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Mr(t){if(t.h&&void 0!==Ee&&(!t.C[1]||4!=zr(t)||2!=t.aa()))if(t.v&&4==zr(t))Jn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==zr(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 i=!0;break t;default:i=!1}if(!(e=i)){var r;if(r=0===n){var s=String(t.H).match(Hi)[1]||null;if(!s&&_e.self&&_e.self.location){var o=_e.self.location.protocol;s=o.substr(0,o.length-1)}r=!xr.test(s?s.toLowerCase():"")}e=r}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<zr(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Pr(t)}}finally{Fr(t)}}}function Fr(t,e){if(t.g){Ur(t);var n=t.g,i=t.C[0]?Ie:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=i}catch(t){}}}function Ur(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(_e.clearTimeout(t.A),t.A=null)}function zr(t){return t.g?t.g.readyState:0}function Br(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Nr:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Vr(t){var e="";return mn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hr(t,e,n){t:{for(i in n){var i=!1;break t}i=!0}i||(n=Vr(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Gi(t,e,n))}function jr(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function qr(t){this.Ca=0,this.i=[],this.j=new ri,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=jr("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=jr("baseRetryDelayMs",5e3,t),this.bb=jr("retryDelaySeedMs",1e4,t),this.$a=jr("forwardChannelMaxRetries",2,t),this.ta=jr("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 hr(t&&t.concurrentRequestLimit),this.Fa=new br,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function $r(t){if(Wr(t),3==t.G){var e=t.U++,n=qi(t.F);Gi(n,"SID",t.I),Gi(n,"RID",e),Gi(n,"TYPE","terminate"),Yr(t,n),(e=new Ti(t,t.j,e,void 0)).K=2,e.v=Qi(qi(n)),n=!1,_e.navigator&&_e.navigator.sendBeacon&&(n=_e.navigator.sendBeacon(e.v.toString(),"")),!n&&_e.Image&&((new Image).src=e.v,n=!0),n||(e.g=cs(e.l,null),e.g.da(e.v)),e.F=Date.now(),Pi(e)}os(t)}function Kr(t){t.g&&(ts(t),t.g.cancel(),t.g=null)}function Wr(t){Kr(t),t.u&&(_e.clearTimeout(t.u),t.u=null),ns(t),t.h.cancel(),t.m&&("number"==typeof t.m&&_e.clearTimeout(t.m),t.m=null)}function Gr(t){fr(t.h)||t.m||(t.m=!0,$n(t.Ja,t),t.C=0)}function Qr(t,e){var n;n=e?e.m:t.U++;var i=qi(t.F);Gi(i,"SID",t.I),Gi(i,"RID",n),Gi(i,"AID",t.T),Yr(t,i),t.o&&t.s&&Hr(i,t.o,t.s),n=new Ti(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Jr(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),mr(t.h,n),Li(n,i,e)}function Yr(t,e){t.ia&&mn(t.ia,(function(t,n){Gi(e,n,t)})),t.l&&Vi({},(function(t,n){Gi(e,n,t)}))}function Jr(t,e,n){n=Math.min(t.i.length,n);var i=t.l?Ne(t.l.Ra,t.l,t):null;t:for(var r=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=r[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=r[c].h,u=r[c].g;if(0>(l-=s))s=Math.max(0,r[c].h-100),a=!1;else try{Sr(u,o,"req"+l+"_")}catch(t){i&&i(u)}}if(a){i=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,i}function Xr(t){t.g||t.u||(t.Z=1,$n(t.Ia,t),t.A=0)}function Zr(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=pi(Ne(t.Ia,t),rs(t,t.A)),t.A++,!0)}function ts(t){null!=t.B&&(_e.clearTimeout(t.B),t.B=null)}function es(t){t.g=new Ti(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=qi(t.sa);Gi(e,"RID","rpc"),Gi(e,"SID",t.I),Gi(e,"CI",t.L?"0":"1"),Gi(e,"AID",t.T),Gi(e,"TYPE","xmlhttp"),Yr(t,e),t.o&&t.s&&Hr(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Qi(qi(e)),n.s=null,n.P=!0,Ni(n,t)}function ns(t){null!=t.v&&(_e.clearTimeout(t.v),t.v=null)}function is(t,e){var n=null;if(t.g==e){ns(t),ts(t),t.g=null;var i=2}else{if(!gr(t.h,e))return;n=e.D,yr(t.h,e),i=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==i){n=e.s?e.s.length:0,e=Date.now()-e.F;var r=t.C;Mn(i=ci(),new fi(i,n)),Gr(t)}else Xr(t);else if(3==(r=e.o)||0==r&&0<t.pa||!(1==i&&function(t,e){return!(pr(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=pi(Ne(t.Ja,t,e),rs(t,t.C)),t.C++,0)))}(t,e)||2==i&&Zr(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),r){case 1:ss(t,5);break;case 4:ss(t,10);break;case 3:ss(t,6);break;default:ss(t,2)}}function rs(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ss(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var i=Ne(t.kb,t);n||(n=new ji("//www.google.com/images/cleardot.gif"),_e.location&&"http"==_e.location.protocol||$i(n,"https"),Qi(n)),function(t,e){var n=new ri;if(_e.Image){var i=new Image;i.onload=xe(Er,n,i,"TestLoadImage: loaded",!0,e),i.onerror=xe(Er,n,i,"TestLoadImage: error",!1,e),i.onabort=xe(Er,n,i,"TestLoadImage: abort",!1,e),i.ontimeout=xe(Er,n,i,"TestLoadImage: timeout",!1,e),_e.setTimeout((function(){i.ontimeout&&i.ontimeout()}),1e4),i.src=t}else e(!1)}(n.toString(),i)}else di(2);t.G=0,t.l&&t.l.va(e),os(t),Wr(t)}function os(t){if(t.G=0,t.la=[],t.l){var e=vr(t.h);0==e.length&&0==t.i.length||(Fe(t.la,e),Fe(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function as(t,e,n){var i=n instanceof ji?qi(n):new ji(n,void 0);if(""!=i.g)e&&(i.g=e+"."+i.g),Ki(i,i.m);else{var r=_e.location;i=r.protocol,e=e?e+"."+r.hostname:r.hostname,r=+r.port;var s=new ji(null,void 0);i&&$i(s,i),e&&(s.g=e),r&&Ki(s,r),n&&(s.l=n),i=s}return n=t.D,e=t.za,n&&e&&Gi(i,n,e),Gi(i,"VER",t.ma),Yr(t,i),i}function cs(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 Lr(new _r({jb:!0})):new Lr(t.ra)).Ka(t.H),e}function ls(){}function us(){if(Qe&&!(10<=Number(ln)))throw Error("Environmental error: no available transport.")}function hs(t,e){Pn.call(this),this.g=new qr(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Be(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Be(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new ps(this)}function ds(t){Ei.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 fs(){_i.call(this),this.status=1}function ps(t){this.g=t}(be=Lr.prototype).Ka=function(t){this.L=t},be.da=function(t,e,n,i){var r,s,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():bi.g(),this.C=this.u?vi(this.u):vi(bi),this.g.onreadystatechange=Ne(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Dr(this,h)}if(t=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var c in i)n.set(c,i[c]);else{if("function"!=typeof i.keys||"function"!=typeof i.get)throw Error("Unknown input type for opt_headers: "+String(i));try{for(var l=ve(i.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,i.get(h))}}catch(t){r={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(r)throw r.error}}}i=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=_e.FormData&&t instanceof _e.FormData,!(0<=Pe(Or,e))||i||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ve(n),f=d.next();!f.done;f=d.next()){var p=we(f.value,2),g=(h=p[0],p[1]);this.g.setRequestHeader(h,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{Ur(this),0<this.B&&((this.K=function(t){return Qe&&an()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ne(this.qa,this)):this.A=Jn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Dr(this,h)}},be.qa=function(){void 0!==Ee&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},be.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"),Fr(this))},be.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Fr(this,!0)),Lr.X.M.call(this)},be.Ha=function(){this.s||(this.F||this.v||this.l?Mr(this):this.fb())},be.fb=function(){Mr(this)},be.aa=function(){try{return 2<zr(this)?this.g.status:-1}catch(t){return-1}},be.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},be.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),Rr(e)}},be.Ea=function(){return this.m},be.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(be=qr.prototype).ma=8,be.G=1,be.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 Ti(this,this.j,t,void 0),n=this.s;if(this.S&&(n?wn(n=yn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var i=0,r=0;r<this.i.length;r++){var s=this.i[r];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(i+=s)){i=r;break t}if(4096===i||r===this.i.length-1){i=r+1;break t}}i=1e3}else i=1e3;i=Jr(this,e,i),Gi(r=qi(this.F),"RID",t),Gi(r,"CVER",22),this.D&&Gi(r,"X-HTTP-Session-Id",this.D),Yr(this,r),n&&(this.N?i="headers="+encodeURIComponent(String(Vr(n)))+"&"+i:this.o&&Hr(r,this.o,n)),mr(this.h,e),this.Ya&&Gi(r,"TYPE","init"),this.O?(Gi(r,"$req",i),Gi(r,"SID","null"),e.Z=!0,Li(e,r,null)):Li(e,r,i),this.G=2}}else 3==this.G&&(t?Qr(this,t):0==this.i.length||fr(this.h)||Qr(this))},be.Ia=function(){if(this.u=null,es(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=pi(Ne(this.eb,this),t)}},be.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,di(10),Kr(this),es(this))},be.cb=function(){null!=this.v&&(this.v=null,Kr(this),Zr(this),di(19))},be.kb=function(t){t?(this.j.info("Successfully pinged google.com"),di(2)):(this.j.info("Failed to ping google.com"),di(1))},(be=ls.prototype).xa=function(){},be.wa=function(){},be.va=function(){},be.ua=function(){},be.Ra=function(){},us.prototype.g=function(t,e){return new hs(t,e)},Oe(hs,Pn),hs.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;di(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=as(t,null,t.V),Gr(t)},hs.prototype.close=function(){$r(this.g)},hs.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 ur(e.ab++,t)),3==e.G&&Gr(e)},hs.prototype.M=function(){this.g.l=null,delete this.j,$r(this.g),delete this.g,hs.X.M.call(this)},Oe(ds,Ei),Oe(fs,_i),Oe(ps,ls),ps.prototype.xa=function(){Mn(this.g,"a")},ps.prototype.wa=function(t){Mn(this.g,new ds(t))},ps.prototype.va=function(t){Mn(this.g,new fs)},ps.prototype.ua=function(){Mn(this.g,"b")},us.prototype.createWebChannel=us.prototype.g,hs.prototype.send=hs.prototype.u,hs.prototype.open=hs.prototype.m,hs.prototype.close=hs.prototype.close,gi.NO_ERROR=0,gi.TIMEOUT=8,gi.HTTP_ERROR=6,mi.COMPLETE="complete",wi.EventType=Si,Si.OPEN="a",Si.CLOSE="b",Si.ERROR="c",Si.MESSAGE="d",Pn.prototype.listen=Pn.prototype.N,Lr.prototype.listenOnce=Lr.prototype.O,Lr.prototype.getLastError=Lr.prototype.Oa,Lr.prototype.getLastErrorCode=Lr.prototype.Ea,Lr.prototype.getStatus=Lr.prototype.aa,Lr.prototype.getResponseJson=Lr.prototype.Sa,Lr.prototype.getResponseText=Lr.prototype.fa,Lr.prototype.send=Lr.prototype.da,Lr.prototype.setWithCredentials=Lr.prototype.Ka;var gs=gi,ms=mi,ys=oi,vs=10,ws=11,bs=_r,Ss=wi,Es=Lr;const _s="@firebase/firestore";
|
|
419
|
+
*/function kt(e,t,n){let i="Unexpected state";"string"==typeof t?i=t:n=t,At(e,i,n)}function At(e,t,n){let i=`FIRESTORE (${bt}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{i+=" CONTEXT: "+JSON.stringify(n)}catch(e){i+=" CONTEXT: "+n}throw Tt(i),new Error(i)}function Rt(e,t,n,i){let r="Unexpected state";"string"==typeof n?r=n:i=n,e||At(t,r,i)}function xt(e,t){return e}
|
|
401
420
|
/**
|
|
402
421
|
* @license
|
|
403
422
|
* Copyright 2017 Google LLC
|
|
@@ -413,7 +432,7 @@ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
413
432
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
414
433
|
* See the License for the specific language governing permissions and
|
|
415
434
|
* limitations under the License.
|
|
416
|
-
*/
|
|
435
|
+
*/const Nt={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 Ot extends _{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
417
436
|
/**
|
|
418
437
|
* @license
|
|
419
438
|
* Copyright 2017 Google LLC
|
|
@@ -429,8 +448,7 @@ const ie=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
|
|
|
429
448
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
430
449
|
* See the License for the specific language governing permissions and
|
|
431
450
|
* limitations under the License.
|
|
432
|
-
*/
|
|
433
|
-
let Ts="9.15.0";
|
|
451
|
+
*/class Lt{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}
|
|
434
452
|
/**
|
|
435
453
|
* @license
|
|
436
454
|
* Copyright 2017 Google LLC
|
|
@@ -446,7 +464,7 @@ let Ts="9.15.0";
|
|
|
446
464
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
447
465
|
* See the License for the specific language governing permissions and
|
|
448
466
|
* limitations under the License.
|
|
449
|
-
*/
|
|
467
|
+
*/class Pt{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class Dt{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(wt.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 Ft{constructor(e){this.t=e,this.currentUser=wt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){Rt(void 0===this.o,42304);let n=this.i;const i=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve();let r=new Lt;this.o=()=>{this.i++,this.currentUser=this.u(),r.resolve(),r=new Lt,e.enqueueRetryable(()=>i(this.currentUser))};const s=()=>{const t=r;e.enqueueRetryable(async()=>{await t.promise,await i(this.currentUser)})},o=e=>{Et("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};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"),r.resolve(),r=new Lt)}},0),s()}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?(Rt("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 Rt(null===e||"string"==typeof e,2055,{h:e}),new wt(e)}}class zt{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=wt.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 Ut{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new zt(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(wt.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 Bt{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,je(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){Rt(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 i=e=>{Et("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>i(e)),setTimeout(()=>{if(!this.appCheck){const e=this.V.getImmediate({optional:!0});e?i(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?(Rt("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}}
|
|
450
468
|
/**
|
|
451
469
|
* @license
|
|
452
470
|
* Copyright 2020 Google LLC
|
|
@@ -462,7 +480,23 @@ let Ts="9.15.0";
|
|
|
462
480
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
463
481
|
* See the License for the specific language governing permissions and
|
|
464
482
|
* limitations under the License.
|
|
465
|
-
*/
|
|
483
|
+
*/function jt(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}
|
|
484
|
+
/**
|
|
485
|
+
* @license
|
|
486
|
+
* Copyright 2023 Google LLC
|
|
487
|
+
*
|
|
488
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
489
|
+
* you may not use this file except in compliance with the License.
|
|
490
|
+
* You may obtain a copy of the License at
|
|
491
|
+
*
|
|
492
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
493
|
+
*
|
|
494
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
495
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
496
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
497
|
+
* See the License for the specific language governing permissions and
|
|
498
|
+
* limitations under the License.
|
|
499
|
+
*/function Ht(){return new TextEncoder}
|
|
466
500
|
/**
|
|
467
501
|
* @license
|
|
468
502
|
* Copyright 2017 Google LLC
|
|
@@ -478,7 +512,7 @@ let Ts="9.15.0";
|
|
|
478
512
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
479
513
|
* See the License for the specific language governing permissions and
|
|
480
514
|
* limitations under the License.
|
|
481
|
-
*/
|
|
515
|
+
*/class $t{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=jt(40);for(let i=0;i<n.length;++i)t.length<20&&n[i]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[i]%62))}return t}}function qt(e,t){return e<t?-1:e>t?1:0}function Gt(e,t){let n=0;for(;n<e.length&&n<t.length;){const i=e.codePointAt(n),r=t.codePointAt(n);if(i!==r){if(i<128&&r<128)return qt(i,r);{const s=Ht(),o=Wt(s.encode(Kt(e,n)),s.encode(Kt(t,n)));return 0!==o?o:qt(i,r)}}n+=i>65535?2:1}return qt(e.length,t.length)}function Kt(e,t){return e.codePointAt(t)>65535?e.substring(t,t+2):e.substring(t,t+1)}function Wt(e,t){for(let n=0;n<e.length&&n<t.length;++n)if(e[n]!==t[n])return qt(e[n],t[n]);return qt(e.length,t.length)}function Qt(e,t,n){return e.length===t.length&&e.every((e,i)=>n(e,t[i]))}
|
|
482
516
|
/**
|
|
483
517
|
* @license
|
|
484
518
|
* Copyright 2017 Google LLC
|
|
@@ -494,7 +528,7 @@ let Ts="9.15.0";
|
|
|
494
528
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
495
529
|
* See the License for the specific language governing permissions and
|
|
496
530
|
* limitations under the License.
|
|
497
|
-
*/const
|
|
531
|
+
*/const Jt="__name__";class Yt{constructor(e,t,n){void 0===t?t=0:t>e.length&&kt(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&kt(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===Yt.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Yt?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 i=0;i<n;i++){const n=Yt.compareSegments(e.get(i),t.get(i));if(0!==n)return n}return qt(e.length,t.length)}static compareSegments(e,t){const n=Yt.isNumericId(e),i=Yt.isNumericId(t);return n&&!i?-1:!n&&i?1:n&&i?Yt.extractNumericId(e).compare(Yt.extractNumericId(t)):Gt(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return st.fromString(e.substring(4,e.length-2))}}class Xt extends Yt{construct(e,t,n){return new Xt(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 Ot(Nt.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new Xt(t)}static emptyPath(){return new Xt([])}}const Zt=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class en extends Yt{construct(e,t,n){return new en(e,t,n)}static isValidIdentifier(e){return Zt.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),en.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Jt}static keyField(){return new en([Jt])}static fromServerFormat(e){const t=[];let n="",i=0;const r=()=>{if(0===n.length)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let s=!1;for(;i<e.length;){const t=e[i];if("\\"===t){if(i+1===e.length)throw new Ot(Nt.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[i+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new Ot(Nt.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,i+=2}else"`"===t?(s=!s,i++):"."!==t||s?(n+=t,i++):(r(),i++)}if(r(),s)throw new Ot(Nt.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new en(t)}static emptyPath(){return new en([])}}
|
|
498
532
|
/**
|
|
499
533
|
* @license
|
|
500
534
|
* Copyright 2017 Google LLC
|
|
@@ -510,7 +544,7 @@ let Ts="9.15.0";
|
|
|
510
544
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
511
545
|
* See the License for the specific language governing permissions and
|
|
512
546
|
* limitations under the License.
|
|
513
|
-
*/class
|
|
547
|
+
*/class tn{constructor(e){this.path=e}static fromPath(e){return new tn(Xt.fromString(e))}static fromName(e){return new tn(Xt.fromString(e).popFirst(5))}static empty(){return new tn(Xt.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===Xt.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return Xt.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new tn(new Xt(e.slice()))}}
|
|
514
548
|
/**
|
|
515
549
|
* @license
|
|
516
550
|
* Copyright 2017 Google LLC
|
|
@@ -526,10 +560,10 @@ let Ts="9.15.0";
|
|
|
526
560
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
527
561
|
* See the License for the specific language governing permissions and
|
|
528
562
|
* limitations under the License.
|
|
529
|
-
*/
|
|
563
|
+
*/function nn(e,t,n){if(!n)throw new Ot(Nt.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function rn(e){if(!tn.isDocumentKey(e))throw new Ot(Nt.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function sn(e){if(tn.isDocumentKey(e))throw new Ot(Nt.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function on(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function an(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":kt(12329,{type:typeof e})}function cn(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Ot(Nt.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=an(e);throw new Ot(Nt.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}
|
|
530
564
|
/**
|
|
531
565
|
* @license
|
|
532
|
-
* Copyright
|
|
566
|
+
* Copyright 2025 Google LLC
|
|
533
567
|
*
|
|
534
568
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
535
569
|
* you may not use this file except in compliance with the License.
|
|
@@ -542,7 +576,7 @@ let Ts="9.15.0";
|
|
|
542
576
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
543
577
|
* See the License for the specific language governing permissions and
|
|
544
578
|
* limitations under the License.
|
|
545
|
-
*/function
|
|
579
|
+
*/function ln(e,t){const n={typeString:e};return t&&(n.value=t),n}function un(e,t){if(!on(e))throw new Ot(Nt.INVALID_ARGUMENT,"JSON must be an object");let n;for(const i in t)if(t[i]){const r=t[i].typeString,s="value"in t[i]?{value:t[i].value}:void 0;if(!(i in e)){n=`JSON missing required field: '${i}'`;break}const o=e[i];if(r&&typeof o!==r){n=`JSON field '${i}' must be a ${r}.`;break}if(void 0!==s&&o!==s.value){n=`Expected '${i}' field to equal '${s.value}'`;break}}if(n)throw new Ot(Nt.INVALID_ARGUMENT,n);return!0}
|
|
546
580
|
/**
|
|
547
581
|
* @license
|
|
548
582
|
* Copyright 2017 Google LLC
|
|
@@ -558,7 +592,7 @@ let Ts="9.15.0";
|
|
|
558
592
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
559
593
|
* See the License for the specific language governing permissions and
|
|
560
594
|
* limitations under the License.
|
|
561
|
-
*/class
|
|
595
|
+
*/const hn=-62135596800,dn=1e6;class fn{static now(){return fn.fromMillis(Date.now())}static fromDate(e){return fn.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*dn);return new fn(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new Ot(Nt.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new Ot(Nt.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<hn)throw new Ot(Nt.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Ot(Nt.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/dn}_compareTo(e){return this.seconds===e.seconds?qt(this.nanoseconds,e.nanoseconds):qt(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:fn._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(un(e,fn._jsonSchema))return new fn(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-hn;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}fn._jsonSchemaVersion="firestore/timestamp/1.0",fn._jsonSchema={type:ln("string",fn._jsonSchemaVersion),seconds:ln("number"),nanoseconds:ln("number")};
|
|
562
596
|
/**
|
|
563
597
|
* @license
|
|
564
598
|
* Copyright 2017 Google LLC
|
|
@@ -574,10 +608,11 @@ let Ts="9.15.0";
|
|
|
574
608
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
575
609
|
* See the License for the specific language governing permissions and
|
|
576
610
|
* limitations under the License.
|
|
577
|
-
*/
|
|
611
|
+
*/
|
|
612
|
+
class pn{static fromTimestamp(e){return new pn(e)}static min(){return new pn(new fn(0,0))}static max(){return new pn(new fn(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}}
|
|
578
613
|
/**
|
|
579
614
|
* @license
|
|
580
|
-
* Copyright
|
|
615
|
+
* Copyright 2021 Google LLC
|
|
581
616
|
*
|
|
582
617
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
583
618
|
* you may not use this file except in compliance with the License.
|
|
@@ -590,10 +625,10 @@ let Ts="9.15.0";
|
|
|
590
625
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
591
626
|
* See the License for the specific language governing permissions and
|
|
592
627
|
* limitations under the License.
|
|
593
|
-
*/class
|
|
628
|
+
*/function gn(e){return new mn(e.readTime,e.key,-1)}class mn{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new mn(pn.min(),tn.empty(),-1)}static max(){return new mn(pn.max(),tn.empty(),-1)}}function vn(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n?n:(n=tn.comparator(e.documentKey,t.documentKey),0!==n?n:qt(e.largestBatchId,t.largestBatchId)
|
|
594
629
|
/**
|
|
595
630
|
* @license
|
|
596
|
-
* Copyright
|
|
631
|
+
* Copyright 2020 Google LLC
|
|
597
632
|
*
|
|
598
633
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
599
634
|
* you may not use this file except in compliance with the License.
|
|
@@ -606,7 +641,7 @@ let Ts="9.15.0";
|
|
|
606
641
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
607
642
|
* See the License for the specific language governing permissions and
|
|
608
643
|
* limitations under the License.
|
|
609
|
-
*/class
|
|
644
|
+
*/)}class yn{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}
|
|
610
645
|
/**
|
|
611
646
|
* @license
|
|
612
647
|
* Copyright 2017 Google LLC
|
|
@@ -622,10 +657,10 @@ let Ts="9.15.0";
|
|
|
622
657
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
623
658
|
* See the License for the specific language governing permissions and
|
|
624
659
|
* limitations under the License.
|
|
625
|
-
*/
|
|
660
|
+
*/async function wn(e){if(e.code!==Nt.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")}
|
|
626
661
|
/**
|
|
627
662
|
* @license
|
|
628
|
-
* Copyright
|
|
663
|
+
* Copyright 2017 Google LLC
|
|
629
664
|
*
|
|
630
665
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
631
666
|
* you may not use this file except in compliance with the License.
|
|
@@ -638,10 +673,10 @@ let Ts="9.15.0";
|
|
|
638
673
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
639
674
|
* See the License for the specific language governing permissions and
|
|
640
675
|
* limitations under the License.
|
|
641
|
-
*/)
|
|
676
|
+
*/class bn{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&&kt(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new bn((n,i)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,i)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,i)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof bn?t:bn.resolve(t)}catch(e){return bn.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):bn.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):bn.reject(t)}static resolve(e){return new bn((t,n)=>{t(e)})}static reject(e){return new bn((t,n)=>{n(e)})}static waitFor(e){return new bn((t,n)=>{let i=0,r=0,s=!1;e.forEach(e=>{++i,e.next(()=>{++r,s&&r===i&&t()},e=>n(e))}),s=!0,r===i&&t()})}static or(e){let t=bn.resolve(!1);for(const n of e)t=t.next(e=>e?bn.resolve(e):n());return t}static forEach(e,t){const n=[];return e.forEach((e,i)=>{n.push(t.call(this,e,i))}),this.waitFor(n)}static mapArray(e,t){return new bn((n,i)=>{const r=e.length,s=new Array(r);let o=0;for(let a=0;a<r;a++){const c=a;t(e[c]).next(e=>{s[c]=e,++o,o===r&&n(s)},e=>i(e))}})}static doWhile(e,t){return new bn((n,i)=>{const r=()=>{!0===e()?t().next(()=>{r()},i):n()};r()})}}function _n(e){return"IndexedDbTransactionError"===e.name}
|
|
642
677
|
/**
|
|
643
678
|
* @license
|
|
644
|
-
* Copyright
|
|
679
|
+
* Copyright 2018 Google LLC
|
|
645
680
|
*
|
|
646
681
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
647
682
|
* you may not use this file except in compliance with the License.
|
|
@@ -654,7 +689,7 @@ let Ts="9.15.0";
|
|
|
654
689
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
655
690
|
* See the License for the specific language governing permissions and
|
|
656
691
|
* limitations under the License.
|
|
657
|
-
*/
|
|
692
|
+
*/class Sn{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}}Sn.ue=-1;function En(e){return null==e}function Tn(e){return 0===e&&1/e==-1/0}function In(e,t){let n=t;const i=e.length;for(let t=0;t<i;t++){const i=e.charAt(t);switch(i){case"\0":n+="";break;case"":n+="";break;default:n+=i}}return n}function Cn(e){return e+""}
|
|
658
693
|
/**
|
|
659
694
|
* @license
|
|
660
695
|
* Copyright 2017 Google LLC
|
|
@@ -670,10 +705,10 @@ let Ts="9.15.0";
|
|
|
670
705
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
671
706
|
* See the License for the specific language governing permissions and
|
|
672
707
|
* limitations under the License.
|
|
673
|
-
*/
|
|
708
|
+
*/function kn(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function An(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function Rn(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}
|
|
674
709
|
/**
|
|
675
710
|
* @license
|
|
676
|
-
* Copyright
|
|
711
|
+
* Copyright 2017 Google LLC
|
|
677
712
|
*
|
|
678
713
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
679
714
|
* you may not use this file except in compliance with the License.
|
|
@@ -686,7 +721,7 @@ let Ts="9.15.0";
|
|
|
686
721
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
687
722
|
* See the License for the specific language governing permissions and
|
|
688
723
|
* limitations under the License.
|
|
689
|
-
*/class
|
|
724
|
+
*/class xn{constructor(e,t){this.comparator=e,this.root=t||On.EMPTY}insert(e,t){return new xn(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,On.BLACK,null,null))}remove(e){return new xn(this.comparator,this.root.remove(e,this.comparator).copy(null,null,On.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 i=this.comparator(e,n.key);if(0===i)return t+n.left.size;i<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 Nn(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Nn(this.root,e,this.comparator,!1)}getReverseIterator(){return new Nn(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Nn(this.root,e,this.comparator,!0)}}class Nn{constructor(e,t,n,i){this.isReverse=i,this.nodeStack=[];let r=1;for(;!e.isEmpty();)if(r=t?n(e.key,t):1,t&&i&&(r*=-1),r<0)e=this.isReverse?e.left:e.right;else{if(0===r){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 On{constructor(e,t,n,i,r){this.key=e,this.value=t,this.color=null!=n?n:On.RED,this.left=null!=i?i:On.EMPTY,this.right=null!=r?r:On.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,i,r){return new On(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=i?i:this.left,null!=r?r: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 i=this;const r=n(e,i.key);return i=r<0?i.copy(null,null,null,i.left.insert(e,t,n),null):0===r?i.copy(null,t,null,null,null):i.copy(null,null,null,null,i.right.insert(e,t,n)),i.fixUp()}removeMin(){if(this.left.isEmpty())return On.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,i=this;if(t(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,t),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),0===t(e,i.key)){if(i.right.isEmpty())return On.EMPTY;n=i.right.min(),i=i.copy(n.key,n.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,t))}return i.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,On.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,On.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 kt(43730,{key:this.key,value:this.value});if(this.right.isRed())throw kt(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw kt(27949);return e+(this.isRed()?0:1)}}On.EMPTY=null,On.RED=!0,On.BLACK=!1,On.EMPTY=new class{constructor(){this.size=0}get key(){throw kt(57766)}get value(){throw kt(16141)}get color(){throw kt(16727)}get left(){throw kt(29726)}get right(){throw kt(36894)}copy(e,t,n,i,r){return this}insert(e,t,n){return new On(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}};
|
|
690
725
|
/**
|
|
691
726
|
* @license
|
|
692
727
|
* Copyright 2017 Google LLC
|
|
@@ -703,10 +738,10 @@ let Ts="9.15.0";
|
|
|
703
738
|
* See the License for the specific language governing permissions and
|
|
704
739
|
* limitations under the License.
|
|
705
740
|
*/
|
|
706
|
-
class
|
|
741
|
+
class Ln{constructor(e){this.comparator=e,this.data=new xn(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 i=n.getNext();if(this.comparator(i.key,e[1])>=0)return;t(i.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 Ln))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,i=n.getNext().key;if(0!==this.comparator(e,i))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 Ln(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()}}
|
|
707
742
|
/**
|
|
708
743
|
* @license
|
|
709
|
-
* Copyright
|
|
744
|
+
* Copyright 2020 Google LLC
|
|
710
745
|
*
|
|
711
746
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
712
747
|
* you may not use this file except in compliance with the License.
|
|
@@ -719,10 +754,10 @@ class fo{constructor(t,e,n,i,r,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
719
754
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
720
755
|
* See the License for the specific language governing permissions and
|
|
721
756
|
* limitations under the License.
|
|
722
|
-
*/
|
|
757
|
+
*/class Dn{constructor(e){this.fields=e,e.sort(en.comparator)}static empty(){return new Dn([])}unionWith(e){let t=new Ln(en.comparator);for(const e of this.fields)t=t.add(e);for(const n of e)t=t.add(n);return new Dn(t.toArray())}covers(e){for(const t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return Qt(this.fields,e.fields,(e,t)=>e.isEqual(t))}}
|
|
723
758
|
/**
|
|
724
759
|
* @license
|
|
725
|
-
* Copyright
|
|
760
|
+
* Copyright 2023 Google LLC
|
|
726
761
|
*
|
|
727
762
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
728
763
|
* you may not use this file except in compliance with the License.
|
|
@@ -735,7 +770,7 @@ class fo{constructor(t,e,n,i,r,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
735
770
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
736
771
|
* See the License for the specific language governing permissions and
|
|
737
772
|
* limitations under the License.
|
|
738
|
-
*/
|
|
773
|
+
*/class Mn extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}
|
|
739
774
|
/**
|
|
740
775
|
* @license
|
|
741
776
|
* Copyright 2020 Google LLC
|
|
@@ -751,8 +786,7 @@ class fo{constructor(t,e,n,i,r,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
751
786
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
752
787
|
* See the License for the specific language governing permissions and
|
|
753
788
|
* limitations under the License.
|
|
754
|
-
*/
|
|
755
|
-
class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new bo(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 bo(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}
|
|
789
|
+
*/class Fn{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 Fn(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 Fn(t)}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return function(e){return btoa(e)}(this.binaryString)}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}
|
|
756
790
|
/**
|
|
757
791
|
* @license
|
|
758
792
|
* Copyright 2020 Google LLC
|
|
@@ -768,7 +802,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
768
802
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
769
803
|
* See the License for the specific language governing permissions and
|
|
770
804
|
* limitations under the License.
|
|
771
|
-
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(
|
|
805
|
+
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return qt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Fn.EMPTY_BYTE_STRING=new Fn("");const zn=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Un(e){if(Rt(!!e,39018),"string"==typeof e){let t=0;const n=zn.exec(e);if(Rt(!!n,46558,{timestamp:e}),n[1]){let e=n[1];e=(e+"000000000").substr(0,9),t=Number(e)}const i=new Date(e);return{seconds:Math.floor(i.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 Bn(e){return"string"==typeof e?Fn.fromBase64String(e):Fn.fromUint8Array(e)}
|
|
772
806
|
/**
|
|
773
807
|
* @license
|
|
774
808
|
* Copyright 2020 Google LLC
|
|
@@ -784,7 +818,23 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
784
818
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
785
819
|
* See the License for the specific language governing permissions and
|
|
786
820
|
* limitations under the License.
|
|
787
|
-
*/function
|
|
821
|
+
*/const jn="server_timestamp",Hn="__type__",$n="__previous_value__",qn="__local_write_time__";function Gn(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)===jn}function Kn(e){const t=e.mapValue.fields[$n];return Gn(t)?Kn(t):t}function Wn(e){const t=Un(e.mapValue.fields[qn].timestampValue);return new fn(t.seconds,t.nanos)}
|
|
822
|
+
/**
|
|
823
|
+
* @license
|
|
824
|
+
* Copyright 2017 Google LLC
|
|
825
|
+
*
|
|
826
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
827
|
+
* you may not use this file except in compliance with the License.
|
|
828
|
+
* You may obtain a copy of the License at
|
|
829
|
+
*
|
|
830
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
831
|
+
*
|
|
832
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
833
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
834
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
835
|
+
* See the License for the specific language governing permissions and
|
|
836
|
+
* limitations under the License.
|
|
837
|
+
*/class Qn{constructor(e,t,n,i,r,s,o,a,c,l){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=i,this.ssl=r,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=c,this.isUsingEmulator=l}}const Jn="(default)";class Yn{constructor(e,t){this.projectId=e,this.database=t||Jn}static empty(){return new Yn("","")}get isDefaultDatabase(){return this.database===Jn}isEqual(e){return e instanceof Yn&&e.projectId===this.projectId&&e.database===this.database}}
|
|
788
838
|
/**
|
|
789
839
|
* @license
|
|
790
840
|
* Copyright 2020 Google LLC
|
|
@@ -800,10 +850,10 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
800
850
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
801
851
|
* See the License for the specific language governing permissions and
|
|
802
852
|
* limitations under the License.
|
|
803
|
-
*/const
|
|
853
|
+
*/const Xn="__type__",Zn="__max__",ei={},ti="__vector__",ni="value";function ii(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?Gn(e)?4:function(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===Zn}
|
|
804
854
|
/**
|
|
805
855
|
* @license
|
|
806
|
-
* Copyright
|
|
856
|
+
* Copyright 2017 Google LLC
|
|
807
857
|
*
|
|
808
858
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
809
859
|
* you may not use this file except in compliance with the License.
|
|
@@ -816,10 +866,10 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
816
866
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
817
867
|
* See the License for the specific language governing permissions and
|
|
818
868
|
* limitations under the License.
|
|
819
|
-
*/(
|
|
869
|
+
*/(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)||{})[Xn])||void 0===n?void 0:n.stringValue)===ti}(e)?10:11:kt(28295,{value:e})}function ri(e,t){if(e===t)return!0;const n=ii(e);if(n!==ii(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Wn(e).isEqual(Wn(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=Un(e.timestampValue),i=Un(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return Bn(e.bytesValue).isEqual(Bn(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),i=Vn(t.doubleValue);return n===i?Tn(n)===Tn(i):isNaN(n)&&isNaN(i)}return!1}(e,t);case 9:return Qt(e.arrayValue.values||[],t.arrayValue.values||[],ri);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},i=t.mapValue.fields||{};if(kn(n)!==kn(i))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===i[e]||!ri(n[e],i[e])))return!1;return!0}(e,t);default:return kt(52216,{left:e})}}function si(e,t){return void 0!==(e.values||[]).find(e=>ri(e,t))}function oi(e,t){if(e===t)return 0;const n=ii(e),i=ii(t);if(n!==i)return qt(n,i);switch(n){case 0:case 9007199254740991:return 0;case 1:return qt(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Vn(e.integerValue||e.doubleValue),i=Vn(t.integerValue||t.doubleValue);return n<i?-1:n>i?1:n===i?0:isNaN(n)?isNaN(i)?0:-1:1}(e,t);case 3:return ai(e.timestampValue,t.timestampValue);case 4:return ai(Wn(e),Wn(t));case 5:return Gt(e.stringValue,t.stringValue);case 6:return function(e,t){const n=Bn(e),i=Bn(t);return n.compareTo(i)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),i=t.split("/");for(let e=0;e<n.length&&e<i.length;e++){const t=qt(n[e],i[e]);if(0!==t)return t}return qt(n.length,i.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=qt(Vn(e.latitude),Vn(t.latitude));return 0!==n?n:qt(Vn(e.longitude),Vn(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ci(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,i,r,s;const o=e.fields||{},a=t.fields||{},c=null===(n=o[ni])||void 0===n?void 0:n.arrayValue,l=null===(i=a[ni])||void 0===i?void 0:i.arrayValue,u=qt((null===(r=null==c?void 0:c.values)||void 0===r?void 0:r.length)||0,(null===(s=null==l?void 0:l.values)||void 0===s?void 0:s.length)||0);return 0!==u?u:ci(c,l)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===ei&&t===ei)return 0;if(e===ei)return 1;if(t===ei)return-1;const n=e.fields||{},i=Object.keys(n),r=t.fields||{},s=Object.keys(r);i.sort(),s.sort();for(let e=0;e<i.length&&e<s.length;++e){const t=Gt(i[e],s[e]);if(0!==t)return t;const o=oi(n[i[e]],r[s[e]]);if(0!==o)return o}return qt(i.length,s.length)}(e.mapValue,t.mapValue);default:throw kt(23264,{le:n})}}function ai(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return qt(e,t);const n=Un(e),i=Un(t),r=qt(n.seconds,i.seconds);return 0!==r?r:qt(n.nanos,i.nanos)}function ci(e,t){const n=e.values||[],i=t.values||[];for(let e=0;e<n.length&&e<i.length;++e){const t=oi(n[e],i[e]);if(t)return t}return qt(n.length,i.length)}function li(e){return ui(e)}function ui(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=Un(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return Bn(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return tn.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 i of e.values||[])n?n=!1:t+=",",t+=ui(i);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",i=!0;for(const r of t)i?i=!1:n+=",",n+=`${r}:${ui(e.fields[r])}`;return n+"}"}(e.mapValue):kt(61005,{value:e})}function hi(e){switch(ii(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Kn(e);return t?16+hi(t):16;case 5:return 2*e.stringValue.length;case 6:return Bn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+hi(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return An(e.fields,(e,n)=>{t+=e.length+hi(n)}),t}(e.mapValue);default:throw kt(13486,{value:e})}}function di(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function fi(e){return!!e&&"integerValue"in e}function pi(e){return!!e&&"arrayValue"in e}function gi(e){return!!e&&"nullValue"in e}function mi(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function vi(e){return!!e&&"mapValue"in e}function yi(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 An(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=yi(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=yi(e.arrayValue.values[n]);return t}return Object.assign({},e)}class wi{constructor(e){this.value=e}static empty(){return new wi({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)],!vi(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=yi(t)}setAll(e){let t=en.emptyPath(),n={},i=[];e.forEach((e,r)=>{if(!t.isImmediateParentOf(r)){const e=this.getFieldsMap(t);this.applyChanges(e,n,i),n={},i=[],t=r.popLast()}e?n[r.lastSegment()]=yi(e):i.push(r.lastSegment())});const r=this.getFieldsMap(t);this.applyChanges(r,n,i)}delete(e){const t=this.field(e.popLast());vi(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return ri(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let i=t.mapValue.fields[e.get(n)];vi(i)&&i.mapValue.fields||(i={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=i),t=i}return t.mapValue.fields}applyChanges(e,t,n){An(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new wi(yi(this.value))}}function bi(e){const t=[];return An(e.fields,(e,n)=>{const i=new en([e]);if(vi(n)){const e=bi(n.mapValue).fields;if(0===e.length)t.push(i);else for(const n of e)t.push(i.child(n))}else t.push(i)}),new Dn(t)
|
|
820
870
|
/**
|
|
821
871
|
* @license
|
|
822
|
-
* Copyright
|
|
872
|
+
* Copyright 2017 Google LLC
|
|
823
873
|
*
|
|
824
874
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
825
875
|
* you may not use this file except in compliance with the License.
|
|
@@ -832,7 +882,7 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
832
882
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
833
883
|
* See the License for the specific language governing permissions and
|
|
834
884
|
* limitations under the License.
|
|
835
|
-
*/
|
|
885
|
+
*/}class _i{constructor(e,t,n,i,r,s,o){this.key=e,this.documentType=t,this.version=n,this.readTime=i,this.createTime=r,this.data=s,this.documentState=o}static newInvalidDocument(e){return new _i(e,0,pn.min(),pn.min(),pn.min(),wi.empty(),0)}static newFoundDocument(e,t,n,i){return new _i(e,1,t,pn.min(),n,i,0)}static newNoDocument(e,t){return new _i(e,2,t,pn.min(),pn.min(),wi.empty(),0)}static newUnknownDocument(e,t){return new _i(e,3,t,pn.min(),pn.min(),wi.empty(),2)}convertToFoundDocument(e,t){return!this.createTime.isEqual(pn.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=wi.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=wi.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=pn.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 _i&&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 _i(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}})`}}
|
|
836
886
|
/**
|
|
837
887
|
* @license
|
|
838
888
|
* Copyright 2022 Google LLC
|
|
@@ -848,10 +898,10 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
848
898
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
849
899
|
* See the License for the specific language governing permissions and
|
|
850
900
|
* limitations under the License.
|
|
851
|
-
*/class
|
|
901
|
+
*/class Si{constructor(e,t){this.position=e,this.inclusive=t}}function Ei(e,t,n){let i=0;for(let r=0;r<e.position.length;r++){const s=t[r],o=e.position[r];if(i=s.field.isKeyField()?tn.comparator(tn.fromName(o.referenceValue),n.key):oi(o,n.data.field(s.field)),"desc"===s.dir&&(i*=-1),0!==i)break}return i}function Ti(e,t){if(null===e)return null===t;if(null===t)return!1;if(e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!ri(e.position[n],t.position[n]))return!1;return!0}
|
|
852
902
|
/**
|
|
853
903
|
* @license
|
|
854
|
-
* Copyright
|
|
904
|
+
* Copyright 2022 Google LLC
|
|
855
905
|
*
|
|
856
906
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
857
907
|
* you may not use this file except in compliance with the License.
|
|
@@ -864,10 +914,10 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
864
914
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
865
915
|
* See the License for the specific language governing permissions and
|
|
866
916
|
* limitations under the License.
|
|
867
|
-
*/class
|
|
917
|
+
*/class Ii{constructor(e,t="asc"){this.field=e,this.dir=t}}function Ci(e,t){return e.dir===t.dir&&e.field.isEqual(t.field)}
|
|
868
918
|
/**
|
|
869
919
|
* @license
|
|
870
|
-
* Copyright
|
|
920
|
+
* Copyright 2022 Google LLC
|
|
871
921
|
*
|
|
872
922
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
873
923
|
* you may not use this file except in compliance with the License.
|
|
@@ -880,11 +930,10 @@ class bo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
880
930
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
881
931
|
* See the License for the specific language governing permissions and
|
|
882
932
|
* limitations under the License.
|
|
883
|
-
*/
|
|
884
|
-
class fa{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 i=n.getNext();if(this.comparator(i.key,t[1])>=0)return;e(i.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 pa(this.data.getIterator())}getIteratorFrom(t){return new pa(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 fa))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,i=n.getNext().key;if(0!==this.comparator(t,i))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 fa(this.comparator);return e.data=t,e}}class pa{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
|
|
933
|
+
*/class ki{}class Ai extends ki{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 Di(e,t,n):"array-contains"===t?new Ui(e,n):"in"===t?new Vi(e,n):"not-in"===t?new Bi(e,n):"array-contains-any"===t?new ji(e,n):new Ai(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Mi(e,n):new Fi(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(oi(t,this.value)):null!==t&&ii(this.value)===ii(t)&&this.matchesComparison(oi(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 kt(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Ri extends ki{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new Ri(e,t)}matches(e){return xi(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 xi(e){return"and"===e.op}function Ni(e){return function(e){for(const t of e.filters)if(t instanceof Ri)return!1;return!0}(e)&&xi(e)}function Oi(e){if(e instanceof Ai)return e.field.canonicalString()+e.op.toString()+li(e.value);if(Ni(e))return e.filters.map(e=>Oi(e)).join(",");{const t=e.filters.map(e=>Oi(e)).join(",");return`${e.op}(${t})`}}function Li(e,t){return e instanceof Ai?function(e,t){return t instanceof Ai&&e.op===t.op&&e.field.isEqual(t.field)&&ri(e.value,t.value)}(e,t):e instanceof Ri?function(e,t){return t instanceof Ri&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,i)=>e&&Li(n,t.filters[i]),!0)}(e,t):void kt(19439)}function Pi(e){return e instanceof Ai?function(e){return`${e.field.canonicalString()} ${e.op} ${li(e.value)}`}(e):e instanceof Ri?function(e){return e.op.toString()+" {"+e.getFilters().map(Pi).join(" ,")+"}"}(e):"Filter"}class Di extends Ai{constructor(e,t,n){super(e,t,n),this.key=tn.fromName(n.referenceValue)}matches(e){const t=tn.comparator(e.key,this.key);return this.matchesComparison(t)}}class Mi extends Ai{constructor(e,t){super(e,"in",t),this.keys=zi("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class Fi extends Ai{constructor(e,t){super(e,"not-in",t),this.keys=zi("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function zi(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>tn.fromName(e.referenceValue))}class Ui extends Ai{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return pi(t)&&si(t.arrayValue,this.value)}}class Vi extends Ai{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&si(this.value.arrayValue,t)}}class Bi extends Ai{constructor(e,t){super(e,"not-in",t)}matches(e){if(si(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!si(this.value.arrayValue,t)}}class ji extends Ai{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!pi(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>si(this.value.arrayValue,e))}}
|
|
885
934
|
/**
|
|
886
935
|
* @license
|
|
887
|
-
* Copyright
|
|
936
|
+
* Copyright 2019 Google LLC
|
|
888
937
|
*
|
|
889
938
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
890
939
|
* you may not use this file except in compliance with the License.
|
|
@@ -897,7 +946,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
897
946
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
898
947
|
* See the License for the specific language governing permissions and
|
|
899
948
|
* limitations under the License.
|
|
900
|
-
*/class
|
|
949
|
+
*/class Hi{constructor(e,t=null,n=[],i=[],r=null,s=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=i,this.limit=r,this.startAt=s,this.endAt=o,this.Pe=null}}function $i(e,t=null,n=[],i=[],r=null,s=null,o=null){return new Hi(e,t,n,i,r,s,o)}function qi(e){const t=xt(e);if(null===t.Pe){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>Oi(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=>li(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>li(e)).join(",")),t.Pe=e}return t.Pe}function Gi(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(!Ci(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(!Li(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Ti(e.startAt,t.startAt)&&Ti(e.endAt,t.endAt)}function Ki(e){return tn.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}
|
|
901
950
|
/**
|
|
902
951
|
* @license
|
|
903
952
|
* Copyright 2017 Google LLC
|
|
@@ -913,7 +962,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
913
962
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
914
963
|
* See the License for the specific language governing permissions and
|
|
915
964
|
* limitations under the License.
|
|
916
|
-
*/class
|
|
965
|
+
*/class Wi{constructor(e,t=null,n=[],i=[],r=null,s="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=i,this.limit=r,this.limitType=s,this.startAt=o,this.endAt=a,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}}function Qi(e){return new Wi(e)}function Ji(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 Yi(e){return null!==e.collectionGroup}function Xi(e){const t=xt(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",i=function(e){let t=new Ln(en.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t}(t);i.forEach(i=>{e.has(i.canonicalString())||i.isKeyField()||t.Te.push(new Ii(i,n))}),e.has(en.keyField().canonicalString())||t.Te.push(new Ii(en.keyField(),n))}return t.Te}function Zi(e){const t=xt(e);return t.Ie||(t.Ie=function(e,t){if("F"===e.limitType)return $i(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 Ii(e.field,t)});const n=e.endAt?new Si(e.endAt.position,e.endAt.inclusive):null,i=e.startAt?new Si(e.startAt.position,e.startAt.inclusive):null;return $i(e.path,e.collectionGroup,t,e.filters,e.limit,n,i)}}(t,Xi(e))),t.Ie}function er(e,t){const n=e.filters.concat([t]);return new Wi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function tr(e,t,n){return new Wi(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function nr(e,t){return Gi(Zi(e),Zi(t))&&e.limitType===t.limitType}function ir(e){return`${qi(Zi(e))}|lt:${e.limitType}`}function rr(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=>Pi(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=>li(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>li(e)).join(",")),`Target(${t})`}(Zi(e))}; limitType=${e.limitType})`}function sr(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):tn.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Xi(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 i=Ei(e,t,n);return e.inclusive?i<=0:i<0}(e.startAt,Xi(e),t))&&!(e.endAt&&!function(e,t,n){const i=Ei(e,t,n);return e.inclusive?i>=0:i>0}(e.endAt,Xi(e),t))}(e,t)}function or(e){return(t,n)=>{let i=!1;for(const r of Xi(e)){const e=ar(r,t,n);if(0!==e)return e;i=i||r.field.isKeyField()}return 0}}function ar(e,t,n){const i=e.field.isKeyField()?tn.comparator(t.key,n.key):function(e,t,n){const i=t.data.field(e),r=n.data.field(e);return null!==i&&null!==r?oi(i,r):kt(42886)}(e.field,t,n);switch(e.dir){case"asc":return i;case"desc":return-1*i;default:return kt(19790,{direction:e.dir})}}
|
|
917
966
|
/**
|
|
918
967
|
* @license
|
|
919
968
|
* Copyright 2017 Google LLC
|
|
@@ -929,10 +978,10 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
929
978
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
930
979
|
* See the License for the specific language governing permissions and
|
|
931
980
|
* limitations under the License.
|
|
932
|
-
*/
|
|
981
|
+
*/class cr{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,i]of n)if(this.equalsFn(t,e))return i}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),i=this.inner[n];if(void 0===i)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<i.length;n++)if(this.equalsFn(i[n][0],e))return void(i[n]=[e,t]);i.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],e))return 1===n.length?delete this.inner[t]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(e){An(this.inner,(t,n)=>{for(const[t,i]of n)e(t,i)})}isEmpty(){return Rn(this.inner)}size(){return this.innerSize}}
|
|
933
982
|
/**
|
|
934
983
|
* @license
|
|
935
|
-
* Copyright
|
|
984
|
+
* Copyright 2017 Google LLC
|
|
936
985
|
*
|
|
937
986
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
938
987
|
* you may not use this file except in compliance with the License.
|
|
@@ -945,10 +994,10 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
945
994
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
946
995
|
* See the License for the specific language governing permissions and
|
|
947
996
|
* limitations under the License.
|
|
948
|
-
*/
|
|
997
|
+
*/const lr=new xn(tn.comparator);function ur(){return lr}const hr=new xn(tn.comparator);function dr(...e){let t=hr;for(const n of e)t=t.insert(n.key,n);return t}function fr(e){let t=hr;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function pr(){return mr()}function gr(){return mr()}function mr(){return new cr(e=>e.toString(),(e,t)=>e.isEqual(t))}const vr=new xn(tn.comparator),yr=new Ln(tn.comparator);function wr(...e){let t=yr;for(const n of e)t=t.add(n);return t}const br=new Ln(qt);
|
|
949
998
|
/**
|
|
950
999
|
* @license
|
|
951
|
-
* Copyright
|
|
1000
|
+
* Copyright 2020 Google LLC
|
|
952
1001
|
*
|
|
953
1002
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
954
1003
|
* you may not use this file except in compliance with the License.
|
|
@@ -961,10 +1010,11 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
961
1010
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
962
1011
|
* See the License for the specific language governing permissions and
|
|
963
1012
|
* limitations under the License.
|
|
964
|
-
*/
|
|
1013
|
+
*/
|
|
1014
|
+
function _r(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:Tn(t)?"-0":t}}function Sr(e){return{integerValue:""+e}}function Er(e,t){return function(e){return"number"==typeof e&&Number.isInteger(e)&&!Tn(e)&&e<=Number.MAX_SAFE_INTEGER&&e>=Number.MIN_SAFE_INTEGER}
|
|
965
1015
|
/**
|
|
966
1016
|
* @license
|
|
967
|
-
* Copyright
|
|
1017
|
+
* Copyright 2017 Google LLC
|
|
968
1018
|
*
|
|
969
1019
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
970
1020
|
* you may not use this file except in compliance with the License.
|
|
@@ -977,7 +1027,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
977
1027
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
978
1028
|
* See the License for the specific language governing permissions and
|
|
979
1029
|
* limitations under the License.
|
|
980
|
-
*/
|
|
1030
|
+
*/(t)?Sr(t):_r(e,t)}
|
|
981
1031
|
/**
|
|
982
1032
|
* @license
|
|
983
1033
|
* Copyright 2018 Google LLC
|
|
@@ -993,7 +1043,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
993
1043
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
994
1044
|
* See the License for the specific language governing permissions and
|
|
995
1045
|
* limitations under the License.
|
|
996
|
-
*/class
|
|
1046
|
+
*/class Tr{constructor(){this._=void 0}}function Ir(e,t,n){return e instanceof Ar?function(e,t){const n={fields:{[Hn]:{stringValue:jn},[qn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&Gn(t)&&(t=Kn(t)),t&&(n.fields[$n]=t),{mapValue:n}}(n,t):e instanceof Rr?xr(e,t):e instanceof Nr?Or(e,t):function(e,t){const n=kr(e,t),i=Pr(n)+Pr(e.Ee);return fi(n)&&fi(e.Ee)?Sr(i):_r(e.serializer,i)}(e,t)}function Cr(e,t,n){return e instanceof Rr?xr(e,t):e instanceof Nr?Or(e,t):n}function kr(e,t){return e instanceof Lr?function(e){return fi(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class Ar extends Tr{}class Rr extends Tr{constructor(e){super(),this.elements=e}}function xr(e,t){const n=Dr(t);for(const t of e.elements)n.some(e=>ri(e,t))||n.push(t);return{arrayValue:{values:n}}}class Nr extends Tr{constructor(e){super(),this.elements=e}}function Or(e,t){let n=Dr(t);for(const t of e.elements)n=n.filter(e=>!ri(e,t));return{arrayValue:{values:n}}}class Lr extends Tr{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function Pr(e){return Vn(e.integerValue||e.doubleValue)}function Dr(e){return pi(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Mr{constructor(e,t){this.version=e,this.transformResults=t}}class Fr{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new Fr}static exists(e){return new Fr(void 0,e)}static updateTime(e){return new Fr(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 zr(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Ur{}function Vr(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new Jr(e.key,Fr.none()):new qr(e.key,e.data,Fr.none());{const n=e.data,i=wi.empty();let r=new Ln(en.comparator);for(let e of t.fields)if(!r.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?i.delete(e):i.set(e,t),r=r.add(e)}return new Gr(e.key,i,new Dn(r.toArray()),Fr.none())}}function Br(e,t,n){e instanceof qr?function(e,t,n){const i=e.value.clone(),r=Wr(e.fieldTransforms,t,n.transformResults);i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):e instanceof Gr?function(e,t,n){if(!zr(e.precondition,t))return void t.convertToUnknownDocument(n.version);const i=Wr(e.fieldTransforms,t,n.transformResults),r=t.data;r.setAll(Kr(e)),r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function jr(e,t,n,i){return e instanceof qr?function(e,t,n,i){if(!zr(e.precondition,t))return n;const r=e.value.clone(),s=Qr(e.fieldTransforms,i,t);return r.setAll(s),t.convertToFoundDocument(t.version,r).setHasLocalMutations(),null}(e,t,n,i):e instanceof Gr?function(e,t,n,i){if(!zr(e.precondition,t))return n;const r=Qr(e.fieldTransforms,i,t),s=t.data;return s.setAll(Kr(e)),s.setAll(r),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,i):function(e,t,n){return zr(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Hr(e,t){let n=null;for(const i of e.fieldTransforms){const e=t.data.field(i.field),r=kr(i.transform,e||null);null!=r&&(null===n&&(n=wi.empty()),n.set(i.field,r))}return n||null}function $r(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)&&Qt(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof Rr&&t instanceof Rr||e instanceof Nr&&t instanceof Nr?Qt(e.elements,t.elements,ri):e instanceof Lr&&t instanceof Lr?ri(e.Ee,t.Ee):e instanceof Ar&&t instanceof Ar}(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 qr extends Ur{constructor(e,t,n,i=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Gr extends Ur{constructor(e,t,n,i,r=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=i,this.fieldTransforms=r,this.type=1}getFieldMask(){return this.fieldMask}}function Kr(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const i=e.data.field(n);t.set(n,i)}}),t}function Wr(e,t,n){const i=new Map;Rt(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let r=0;r<n.length;r++){const s=e[r],o=s.transform,a=t.data.field(s.field);i.set(s.field,Cr(o,a,n[r]))}return i}function Qr(e,t,n){const i=new Map;for(const r of e){const e=r.transform,s=n.data.field(r.field);i.set(r.field,Ir(e,s,t))}return i}class Jr extends Ur{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Yr extends Ur{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
997
1047
|
/**
|
|
998
1048
|
* @license
|
|
999
1049
|
* Copyright 2017 Google LLC
|
|
@@ -1009,10 +1059,10 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
1009
1059
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1010
1060
|
* See the License for the specific language governing permissions and
|
|
1011
1061
|
* limitations under the License.
|
|
1012
|
-
*/class
|
|
1062
|
+
*/class Xr{constructor(e,t,n,i){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=i}applyToRemoteDocument(e,t){const n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){const i=this.mutations[t];i.key.isEqual(e.key)&&Br(i,e,n[t])}}applyToLocalView(e,t){for(const n of this.baseMutations)n.key.isEqual(e.key)&&(t=jr(n,e,t,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(e.key)&&(t=jr(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){const n=gr();return this.mutations.forEach(i=>{const r=e.get(i.key),s=r.overlayedDocument;let o=this.applyToLocalView(s,r.mutatedFields);o=t.has(i.key)?null:o;const a=Vr(s,o);null!==a&&n.set(i.key,a),s.isValidDocument()||s.convertToNoDocument(pn.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),wr())}isEqual(e){return this.batchId===e.batchId&&Qt(this.mutations,e.mutations,(e,t)=>$r(e,t))&&Qt(this.baseMutations,e.baseMutations,(e,t)=>$r(e,t))}}class Zr{constructor(e,t,n,i){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=i}static from(e,t,n){Rt(e.mutations.length===n.length,58842,{Ve:e.mutations.length,me:n.length});let i=vr;const r=e.mutations;for(let e=0;e<r.length;e++)i=i.insert(r[e].key,n[e].version);return new Zr(e,t,n,i)}}
|
|
1013
1063
|
/**
|
|
1014
1064
|
* @license
|
|
1015
|
-
* Copyright
|
|
1065
|
+
* Copyright 2022 Google LLC
|
|
1016
1066
|
*
|
|
1017
1067
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1018
1068
|
* you may not use this file except in compliance with the License.
|
|
@@ -1025,7 +1075,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
1025
1075
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1026
1076
|
* See the License for the specific language governing permissions and
|
|
1027
1077
|
* limitations under the License.
|
|
1028
|
-
*/
|
|
1078
|
+
*/class es{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 }`}}
|
|
1029
1079
|
/**
|
|
1030
1080
|
* @license
|
|
1031
1081
|
* Copyright 2017 Google LLC
|
|
@@ -1041,8 +1091,7 @@ class fa{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
|
|
|
1041
1091
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1042
1092
|
* See the License for the specific language governing permissions and
|
|
1043
1093
|
* limitations under the License.
|
|
1044
|
-
*/
|
|
1045
|
-
class Sc{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,i]of n)if(this.equalsFn(e,t))return i}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),i=this.inner[n];if(void 0===i)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<i.length;n++)if(this.equalsFn(i[n][0],t))return void(i[n]=[t,e]);i.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let i=0;i<n.length;i++)if(this.equalsFn(n[i][0],t))return 1===n.length?delete this.inner[e]:n.splice(i,1),this.innerSize--,!0;return!1}forEach(t){mo(this.inner,((e,n)=>{for(const[e,i]of n)t(e,i)}))}isEmpty(){return yo(this.inner)}size(){return this.innerSize}}
|
|
1094
|
+
*/class ts{constructor(e,t){this.count=e,this.unchangedNames=t}}
|
|
1046
1095
|
/**
|
|
1047
1096
|
* @license
|
|
1048
1097
|
* Copyright 2017 Google LLC
|
|
@@ -1058,7 +1107,24 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1058
1107
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1059
1108
|
* See the License for the specific language governing permissions and
|
|
1060
1109
|
* limitations under the License.
|
|
1061
|
-
*/
|
|
1110
|
+
*/var ns,is;function rs(e){if(void 0===e)return Tt("GRPC error has no .code"),Nt.UNKNOWN;switch(e){case ns.OK:return Nt.OK;case ns.CANCELLED:return Nt.CANCELLED;case ns.UNKNOWN:return Nt.UNKNOWN;case ns.DEADLINE_EXCEEDED:return Nt.DEADLINE_EXCEEDED;case ns.RESOURCE_EXHAUSTED:return Nt.RESOURCE_EXHAUSTED;case ns.INTERNAL:return Nt.INTERNAL;case ns.UNAVAILABLE:return Nt.UNAVAILABLE;case ns.UNAUTHENTICATED:return Nt.UNAUTHENTICATED;case ns.INVALID_ARGUMENT:return Nt.INVALID_ARGUMENT;case ns.NOT_FOUND:return Nt.NOT_FOUND;case ns.ALREADY_EXISTS:return Nt.ALREADY_EXISTS;case ns.PERMISSION_DENIED:return Nt.PERMISSION_DENIED;case ns.FAILED_PRECONDITION:return Nt.FAILED_PRECONDITION;case ns.ABORTED:return Nt.ABORTED;case ns.OUT_OF_RANGE:return Nt.OUT_OF_RANGE;case ns.UNIMPLEMENTED:return Nt.UNIMPLEMENTED;case ns.DATA_LOSS:return Nt.DATA_LOSS;default:return kt(39323,{code:e})}}(is=ns||(ns={}))[is.OK=0]="OK",is[is.CANCELLED=1]="CANCELLED",is[is.UNKNOWN=2]="UNKNOWN",is[is.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",is[is.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",is[is.NOT_FOUND=5]="NOT_FOUND",is[is.ALREADY_EXISTS=6]="ALREADY_EXISTS",is[is.PERMISSION_DENIED=7]="PERMISSION_DENIED",is[is.UNAUTHENTICATED=16]="UNAUTHENTICATED",is[is.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",is[is.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",is[is.ABORTED=10]="ABORTED",is[is.OUT_OF_RANGE=11]="OUT_OF_RANGE",is[is.UNIMPLEMENTED=12]="UNIMPLEMENTED",is[is.INTERNAL=13]="INTERNAL",is[is.UNAVAILABLE=14]="UNAVAILABLE",is[is.DATA_LOSS=15]="DATA_LOSS";
|
|
1111
|
+
/**
|
|
1112
|
+
* @license
|
|
1113
|
+
* Copyright 2022 Google LLC
|
|
1114
|
+
*
|
|
1115
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1116
|
+
* you may not use this file except in compliance with the License.
|
|
1117
|
+
* You may obtain a copy of the License at
|
|
1118
|
+
*
|
|
1119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1120
|
+
*
|
|
1121
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1122
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1124
|
+
* See the License for the specific language governing permissions and
|
|
1125
|
+
* limitations under the License.
|
|
1126
|
+
*/
|
|
1127
|
+
const ss=new st([4294967295,4294967295],0);function os(e){const t=Ht().encode(e),n=new ot;return n.update(t),new Uint8Array(n.digest())}function as(e){const t=new DataView(e.buffer),n=t.getUint32(0,!0),i=t.getUint32(4,!0),r=t.getUint32(8,!0),s=t.getUint32(12,!0);return[new st([n,i],0),new st([r,s],0)]}class cs{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new ls(`Invalid padding: ${t}`);if(n<0)throw new ls(`Invalid hash count: ${n}`);if(e.length>0&&0===this.hashCount)throw new ls(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new ls(`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 i=e.add(t.multiply(st.fromNumber(n)));return 1===i.compare(ss)&&(i=new st([i.getBits(0),i.getBits(1)],0)),i.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=os(e),[n,i]=as(t);for(let e=0;e<this.hashCount;e++){const t=this.pe(n,i,e);if(!this.ye(t))return!1}return!0}static create(e,t,n){const i=e%8==0?0:8-e%8,r=new Uint8Array(Math.ceil(e/8)),s=new cs(r,i,t);return n.forEach(e=>s.insert(e)),s}insert(e){if(0===this.fe)return;const t=os(e),[n,i]=as(t);for(let e=0;e<this.hashCount;e++){const t=this.pe(n,i,e);this.we(t)}}we(e){const t=Math.floor(e/8),n=e%8;this.bitmap[t]|=1<<n}}class ls extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}
|
|
1062
1128
|
/**
|
|
1063
1129
|
* @license
|
|
1064
1130
|
* Copyright 2017 Google LLC
|
|
@@ -1074,7 +1140,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1074
1140
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1075
1141
|
* See the License for the specific language governing permissions and
|
|
1076
1142
|
* limitations under the License.
|
|
1077
|
-
*/class
|
|
1143
|
+
*/class us{constructor(e,t,n,i,r){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=i,this.resolvedLimboDocuments=r}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const i=new Map;return i.set(e,hs.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new us(pn.min(),i,new xn(qt),ur(),wr())}}class hs{constructor(e,t,n,i,r){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=i,this.removedDocuments=r}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new hs(n,t,wr(),wr(),wr())}}
|
|
1078
1144
|
/**
|
|
1079
1145
|
* @license
|
|
1080
1146
|
* Copyright 2017 Google LLC
|
|
@@ -1090,7 +1156,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1090
1156
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1091
1157
|
* See the License for the specific language governing permissions and
|
|
1092
1158
|
* limitations under the License.
|
|
1093
|
-
*/class Fc{constructor(t,e,n,i){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=i}}class Uc{constructor(t,e){this.targetId=t,this.Et=e}}class zc{constructor(t,e,n=bo.EMPTY_BYTE_STRING,i=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=i}}class Bc{constructor(){this.At=0,this.Rt=jc(),this.bt=bo.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=xc(),e=xc(),n=xc();return this.Rt.forEach(((i,r)=>{switch(r){case 0:t=t.add(i);break;case 2:e=e.add(i);break;case 1:n=n.add(i);break;default:xs()}})),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 Vc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=_c(),this.qt=Hc(),this.Ut=new fa(Gs)}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:xs()}}))}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,i=this.Yt(e);if(i){const t=i.target;if(_a(t))if(0===n){const n=new no(t.path);this.Qt(e,n,va.newNoDocument(n,Js.min()))}else Os(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,i)=>{const r=this.Yt(i);if(r){if(n.current&&_a(r.target)){const e=new no(r.target.path);null!==this.Lt.get(e)||this.te(i,e)||this.Qt(i,e,va.newNoDocument(e,t))}n.St&&(e.set(i,n.Ct()),n.xt())}}));let n=xc();this.qt.forEach(((t,e)=>{let i=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(i=!1,!1)})),i&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const i=new Pc(t,e,this.Ut,this.Lt,n);return this.Lt=_c(),this.qt=Hc(),this.Ut=new fa(Gs),i}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 i=this.Wt(t);this.te(t,e)?i.Nt(e,1):i.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 Bc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new fa(Gs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||As("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 Bc),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(no.comparator)}function jc(){return new ua(no.comparator)}
|
|
1159
|
+
*/class ds{constructor(e,t,n,i){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=i}}class fs{constructor(e,t){this.targetId=e,this.De=t}}class ps{constructor(e,t,n=Fn.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=i}}class gs{constructor(){this.ve=0,this.Ce=ys(),this.Fe=Fn.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=wr(),t=wr(),n=wr();return this.Ce.forEach((i,r)=>{switch(r){case 0:e=e.add(i);break;case 2:t=t.add(i);break;case 1:n=n.add(i);break;default:kt(38017,{changeType:r})}}),new hs(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=ys()}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,Rt(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class ms{constructor(e){this.We=e,this.Ge=new Map,this.ze=ur(),this.je=vs(),this.Je=vs(),this.He=new xn(qt)}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:kt(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,i=this.st(t);if(i){const r=i.target;if(Ki(r))if(0===n){const e=new tn(r.path);this.Xe(t,e,_i.newNoDocument(e,pn.min()))}else Rt(1===n,20013,{expectedCount:n});else{const i=this.ot(t);if(i!==n){const n=this._t(e),r=n?this.ut(n,e,i):1;if(0!==r){this.rt(t);const e=2===r?"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:i=0},hashCount:r=0}=t;let s,o;try{s=Bn(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 cs(s,i,r)}catch(e){return It(e instanceof ls?"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 i=0;return n.forEach(n=>{const r=this.We.lt(),s=`projects/${r.projectId}/databases/${r.database}/documents/${n.path.canonicalString()}`;e.mightContain(s)||(this.Xe(t,n,null),i++)}),i}Pt(e){const t=new Map;this.Ge.forEach((n,i)=>{const r=this.st(i);if(r){if(n.current&&Ki(r.target)){const t=new tn(r.target.path);this.Tt(t).has(i)||this.It(i,t)||this.Xe(i,t,_i.newNoDocument(t,e))}n.Ne&&(t.set(i,n.Le()),n.ke())}});let n=wr();this.Je.forEach((e,t)=>{let i=!0;t.forEachWhile(e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(i=!1,!1)}),i&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));const i=new us(e,t,this.He,this.ze,n);return this.ze=ur(),this.je=vs(),this.Je=vs(),this.He=new xn(qt),i}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 i=this.tt(e);this.It(e,t)?i.qe(t,1):i.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 gs,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new Ln(qt),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new Ln(qt),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 gs),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function vs(){return new xn(tn.comparator)}function ys(){return new xn(tn.comparator)}const ws={asc:"ASCENDING",desc:"DESCENDING"},bs={"<":"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"},_s={and:"AND",or:"OR"};class Ss{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Es(e,t){return e.useProto3Json||En(t)?t:{value:t}}function Ts(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 Is(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function Cs(e,t){return Ts(e,t.toTimestamp())}function ks(e){return Rt(!!e,49232),pn.fromTimestamp(function(e){const t=Un(e);return new fn(t.seconds,t.nanos)}(e))}function As(e,t){return Rs(e,t).canonicalString()}function Rs(e,t){const n=function(e){return new Xt(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function xs(e){const t=Xt.fromString(e);return Rt(Ws(t),10190,{key:t.toString()}),t}function Ns(e,t){return As(e.databaseId,t.path)}function Os(e,t){const n=xs(t);if(n.get(1)!==e.databaseId.projectId)throw new Ot(Nt.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 Ot(Nt.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new tn(Ds(n))}function Ls(e,t){return As(e.databaseId,t)}function Ps(e){return new Xt(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Ds(e){return Rt(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Ms(e,t,n){return{name:Ns(e,t),fields:n.value.mapValue.fields}}function Fs(e,t){return{documents:[Ls(e,t.path)]}}function zs(e,t){const n={structuredQuery:{}},i=t.path;let r;null!==t.collectionGroup?(r=i,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(r=i.popLast(),n.structuredQuery.from=[{collectionId:i.lastSegment()}]),n.parent=Ls(e,r);const s=function(e){if(0!==e.length)return Gs(Ri.create(e,"and"))}(t.filters);s&&(n.structuredQuery.where=s);const o=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:$s(e.field),direction:Bs(e.dir)}}(e))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Es(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:r}}function Us(e){let t=function(e){const t=xs(e);return 4===t.length?Xt.emptyPath():Ds(t)}(e.parent);const n=e.structuredQuery,i=n.from?n.from.length:0;let r=null;if(i>0){Rt(1===i,65062);const e=n.from[0];e.allDescendants?r=e.collectionId:t=t.child(e.collectionId)}let s=[];n.where&&(s=function(e){const t=Vs(e);return t instanceof Ri&&Ni(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new Ii(qs(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 Si(n,t)}(n.startAt));let l=null;return n.endAt&&(l=function(e){const t=!e.before,n=e.values||[];return new Si(n,t)}(n.endAt)),function(e,t,n,i,r,s,o,a){return new Wi(e,t,n,i,r,s,o,a)}(t,r,o,s,a,"F",c,l)}function Vs(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=qs(e.unaryFilter.field);return Ai.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=qs(e.unaryFilter.field);return Ai.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=qs(e.unaryFilter.field);return Ai.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const r=qs(e.unaryFilter.field);return Ai.create(r,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return kt(61313);default:return kt(60726)}}(e):void 0!==e.fieldFilter?function(e){return Ai.create(qs(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 kt(58110);default:return kt(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return Ri.create(e.compositeFilter.filters.map(e=>Vs(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return kt(1026)}}(e.compositeFilter.op))}(e):kt(30097,{filter:e})}function Bs(e){return ws[e]}function js(e){return bs[e]}function Hs(e){return _s[e]}function $s(e){return{fieldPath:e.canonicalString()}}function qs(e){return en.fromServerFormat(e.fieldPath)}function Gs(e){return e instanceof Ai?function(e){if("=="===e.op){if(mi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NAN"}};if(gi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(mi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NOT_NAN"}};if(gi(e.value))return{unaryFilter:{field:$s(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$s(e.field),op:js(e.op),value:e.value}}}(e):e instanceof Ri?function(e){const t=e.getFilters().map(e=>Gs(e));return 1===t.length?t[0]:{compositeFilter:{op:Hs(e.op),filters:t}}}(e):kt(54877,{filter:e})}function Ks(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Ws(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
|
|
1094
1160
|
/**
|
|
1095
1161
|
* @license
|
|
1096
1162
|
* Copyright 2017 Google LLC
|
|
@@ -1106,7 +1172,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1106
1172
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1107
1173
|
* See the License for the specific language governing permissions and
|
|
1108
1174
|
* limitations under the License.
|
|
1109
|
-
*/
|
|
1175
|
+
*/class Qs{constructor(e,t,n,i,r=pn.min(),s=pn.min(),o=Fn.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=i,this.snapshotVersion=r,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new Qs(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Qs(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}
|
|
1110
1176
|
/**
|
|
1111
1177
|
* @license
|
|
1112
1178
|
* Copyright 2017 Google LLC
|
|
@@ -1122,10 +1188,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1122
1188
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1123
1189
|
* See the License for the specific language governing permissions and
|
|
1124
1190
|
* limitations under the License.
|
|
1125
|
-
*/class
|
|
1191
|
+
*/class Js{constructor(e){this.gt=e}}function Ys(e){const t=Us({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?tr(t,t.limit,"L"):t}
|
|
1126
1192
|
/**
|
|
1127
1193
|
* @license
|
|
1128
|
-
* Copyright
|
|
1194
|
+
* Copyright 2019 Google LLC
|
|
1129
1195
|
*
|
|
1130
1196
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1131
1197
|
* you may not use this file except in compliance with the License.
|
|
@@ -1138,10 +1204,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1138
1204
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1139
1205
|
* See the License for the specific language governing permissions and
|
|
1140
1206
|
* limitations under the License.
|
|
1141
|
-
*/class
|
|
1207
|
+
*/class Xs{constructor(){this.Dn=new Zs}addToCollectionParentIndex(e,t){return this.Dn.add(t),bn.resolve()}getCollectionParents(e,t){return bn.resolve(this.Dn.getEntries(t))}addFieldIndex(e,t){return bn.resolve()}deleteFieldIndex(e,t){return bn.resolve()}deleteAllFieldIndexes(e){return bn.resolve()}createTargetIndexes(e,t){return bn.resolve()}getDocumentsMatchingTarget(e,t){return bn.resolve(null)}getIndexType(e,t){return bn.resolve(0)}getFieldIndexes(e,t){return bn.resolve([])}getNextCollectionGroupToUpdate(e){return bn.resolve(null)}getMinOffset(e,t){return bn.resolve(mn.min())}getMinOffsetFromCollectionGroup(e,t){return bn.resolve(mn.min())}updateCollectionGroup(e,t,n){return bn.resolve()}updateIndexEntries(e,t){return bn.resolve()}}class Zs{constructor(){this.index={}}add(e){const t=e.lastSegment(),n=e.popLast(),i=this.index[t]||new Ln(Xt.comparator),r=!i.has(n);return this.index[t]=i.add(n),r}has(e){const t=e.lastSegment(),n=e.popLast(),i=this.index[t];return i&&i.has(n)}getEntries(e){return(this.index[e]||new Ln(Xt.comparator)).toArray()}}
|
|
1142
1208
|
/**
|
|
1143
1209
|
* @license
|
|
1144
|
-
* Copyright
|
|
1210
|
+
* Copyright 2018 Google LLC
|
|
1145
1211
|
*
|
|
1146
1212
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1147
1213
|
* you may not use this file except in compliance with the License.
|
|
@@ -1154,7 +1220,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1154
1220
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1155
1221
|
* See the License for the specific language governing permissions and
|
|
1156
1222
|
* limitations under the License.
|
|
1157
|
-
*/
|
|
1223
|
+
*/const eo={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},to=41943040;class no{static withCacheSize(e){return new no(e,no.DEFAULT_COLLECTION_PERCENTILE,no.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}
|
|
1158
1224
|
/**
|
|
1159
1225
|
* @license
|
|
1160
1226
|
* Copyright 2017 Google LLC
|
|
@@ -1170,10 +1236,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1170
1236
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1171
1237
|
* See the License for the specific language governing permissions and
|
|
1172
1238
|
* limitations under the License.
|
|
1173
|
-
*/
|
|
1239
|
+
*/no.DEFAULT_COLLECTION_PERCENTILE=10,no.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,no.DEFAULT=new no(to,no.DEFAULT_COLLECTION_PERCENTILE,no.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),no.DISABLED=new no(-1,0,0);
|
|
1174
1240
|
/**
|
|
1175
1241
|
* @license
|
|
1176
|
-
* Copyright
|
|
1242
|
+
* Copyright 2017 Google LLC
|
|
1177
1243
|
*
|
|
1178
1244
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1179
1245
|
* you may not use this file except in compliance with the License.
|
|
@@ -1186,10 +1252,11 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1186
1252
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1187
1253
|
* See the License for the specific language governing permissions and
|
|
1188
1254
|
* limitations under the License.
|
|
1189
|
-
*/
|
|
1255
|
+
*/
|
|
1256
|
+
class io{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new io(0)}static ur(){return new io(-1)}}
|
|
1190
1257
|
/**
|
|
1191
1258
|
* @license
|
|
1192
|
-
* Copyright
|
|
1259
|
+
* Copyright 2020 Google LLC
|
|
1193
1260
|
*
|
|
1194
1261
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1195
1262
|
* you may not use this file except in compliance with the License.
|
|
@@ -1202,7 +1269,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1202
1269
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1203
1270
|
* See the License for the specific language governing permissions and
|
|
1204
1271
|
* limitations under the License.
|
|
1205
|
-
*/class
|
|
1272
|
+
*/const ro="LruGarbageCollector";function so([e,t],[n,i]){const r=qt(e,n);return 0===r?qt(t,i):r}class oo{constructor(e){this.Tr=e,this.buffer=new Ln(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 ao{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){_n(e)?Et(ro,"Ignoring IndexedDB error during garbage collection: ",e):await wn(e)}await this.Rr(3e5)})}}class co{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 bn.resolve(Sn.ue);const n=new oo(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"),bn.resolve(eo)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(Et("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),eo):this.pr(e,t))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,t){let n,i,r,s,o,a,c;const l=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}`),i=this.params.maximumSequenceNumbersToCollect):i=t,s=Date.now(),this.nthSequenceNumber(e,i))).next(i=>(n=i,o=Date.now(),this.removeTargets(e,n,t))).next(t=>(r=t,a=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(c=Date.now(),St()<=M.DEBUG&&Et("LruGarbageCollector",`LRU Garbage Collection\n\tCounted targets in ${s-l}ms\n\tDetermined least recently used ${i} in `+(o-s)+"ms\n"+`\tRemoved ${r} targets in `+(a-o)+"ms\n"+`\tRemoved ${e} documents in `+(c-a)+"ms\n"+`Total Duration: ${c-l}ms`),bn.resolve({didRun:!0,sequenceNumbersCollected:i,targetsRemoved:r,documentsRemoved:e})))}}
|
|
1206
1273
|
/**
|
|
1207
1274
|
* @license
|
|
1208
1275
|
* Copyright 2017 Google LLC
|
|
@@ -1218,7 +1285,8 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1218
1285
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1219
1286
|
* See the License for the specific language governing permissions and
|
|
1220
1287
|
* limitations under the License.
|
|
1221
|
-
*/
|
|
1288
|
+
*/
|
|
1289
|
+
class lo{constructor(){this.changes=new cr(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,_i.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();const n=this.changes.get(t);return void 0!==n?bn.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(){}}
|
|
1222
1290
|
/**
|
|
1223
1291
|
* @license
|
|
1224
1292
|
* Copyright 2017 Google LLC
|
|
@@ -1250,7 +1318,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1250
1318
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1251
1319
|
* See the License for the specific language governing permissions and
|
|
1252
1320
|
* limitations under the License.
|
|
1253
|
-
*/class
|
|
1321
|
+
*/class uo{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}
|
|
1254
1322
|
/**
|
|
1255
1323
|
* @license
|
|
1256
1324
|
* Copyright 2017 Google LLC
|
|
@@ -1266,7 +1334,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1266
1334
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1267
1335
|
* See the License for the specific language governing permissions and
|
|
1268
1336
|
* limitations under the License.
|
|
1269
|
-
*/class
|
|
1337
|
+
*/class ho{constructor(e,t,n,i){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=i}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(i=>(n=i,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&jr(n.mutation,e,Dn.empty(),fn.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,wr()).next(()=>t))}getLocalViewOfDocuments(e,t,n=wr()){const i=pr();return this.populateOverlays(e,i,t).next(()=>this.computeViews(e,t,i,n).next(e=>{let t=dr();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=pr();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,wr()))}populateOverlays(e,t,n){const i=[];return n.forEach(e=>{t.has(e)||i.push(e)}),this.documentOverlayCache.getOverlays(e,i).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,i){let r=ur();const s=mr(),o=mr();return t.forEach((e,t)=>{const o=n.get(t.key);i.has(t.key)&&(void 0===o||o.mutation instanceof Gr)?r=r.insert(t.key,t):void 0!==o?(s.set(t.key,o.mutation.getFieldMask()),jr(o.mutation,t,o.mutation.getFieldMask(),fn.now())):s.set(t.key,Dn.empty())}),this.recalculateAndSaveOverlays(e,r).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>{var n;return o.set(e,new uo(t,null!==(n=s.get(e))&&void 0!==n?n:null))}),o))}recalculateAndSaveOverlays(e,t){const n=mr();let i=new xn((e,t)=>e-t),r=wr();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const r of e)r.keys().forEach(e=>{const s=t.get(e);if(null===s)return;let o=n.get(e)||Dn.empty();o=r.applyToLocalView(s,o),n.set(e,o);const a=(i.get(r.batchId)||wr()).add(e);i=i.insert(r.batchId,a)})}).next(()=>{const s=[],o=i.getReverseIterator();for(;o.hasNext();){const i=o.getNext(),a=i.key,c=i.value,l=gr();c.forEach(e=>{if(!r.has(e)){const i=Vr(t.get(e),n.get(e));null!==i&&l.set(e,i),r=r.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,a,l))}return bn.waitFor(s)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,i){return function(e){return tn.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Yi(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,i):this.getDocumentsMatchingCollectionQuery(e,t,n,i)}getNextDocuments(e,t,n,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,i).next(r=>{const s=i-r.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,i-r.size):bn.resolve(pr());let o=-1,a=r;return s.next(t=>bn.forEach(t,(t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),r.get(t)?bn.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{a=a.insert(t,e)}))).next(()=>this.populateOverlays(e,t,r)).next(()=>this.computeViews(e,a,t,wr())).next(e=>({batchId:o,changes:fr(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new tn(t)).next(e=>{let t=dr();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,i){const r=t.collectionGroup;let s=dr();return this.indexManager.getCollectionParents(e,r).next(o=>bn.forEach(o,o=>{const a=function(e,t){return new Wi(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(r));return this.getDocumentsMatchingCollectionQuery(e,a,n,i).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,n,i){let r;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(s=>(r=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,r,i))).next(e=>{r.forEach((t,n)=>{const i=n.getKey();null===e.get(i)&&(e=e.insert(i,_i.newInvalidDocument(i)))});let n=dr();return e.forEach((e,i)=>{const s=r.get(e);void 0!==s&&jr(s.mutation,i,Dn.empty(),fn.now()),sr(t,i)&&(n=n.insert(e,i))}),n})}}
|
|
1270
1338
|
/**
|
|
1271
1339
|
* @license
|
|
1272
1340
|
* Copyright 2020 Google LLC
|
|
@@ -1282,7 +1350,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1282
1350
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1283
1351
|
* See the License for the specific language governing permissions and
|
|
1284
1352
|
* limitations under the License.
|
|
1285
|
-
*/class
|
|
1353
|
+
*/class fo{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,t){return bn.resolve(this.Br.get(t))}saveBundleMetadata(e,t){return this.Br.set(t.id,function(e){return{id:e.id,version:e.version,createTime:ks(e.createTime)}}(t)),bn.resolve()}getNamedQuery(e,t){return bn.resolve(this.Lr.get(t))}saveNamedQuery(e,t){return this.Lr.set(t.name,function(e){return{name:e.name,query:Ys(e.bundledQuery),readTime:ks(e.readTime)}}(t)),bn.resolve()}}
|
|
1286
1354
|
/**
|
|
1287
1355
|
* @license
|
|
1288
1356
|
* Copyright 2022 Google LLC
|
|
@@ -1298,7 +1366,23 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1298
1366
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1299
1367
|
* See the License for the specific language governing permissions and
|
|
1300
1368
|
* limitations under the License.
|
|
1301
|
-
*/class
|
|
1369
|
+
*/class po{constructor(){this.overlays=new xn(tn.comparator),this.kr=new Map}getOverlay(e,t){return bn.resolve(this.overlays.get(t))}getOverlays(e,t){const n=pr();return bn.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,i)=>{this.wt(e,t,i)}),bn.resolve()}removeOverlaysForBatchId(e,t,n){const i=this.kr.get(n);return void 0!==i&&(i.forEach(e=>this.overlays=this.overlays.remove(e)),this.kr.delete(n)),bn.resolve()}getOverlaysForCollection(e,t,n){const i=pr(),r=t.length+1,s=new tn(t.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const e=o.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===r&&e.largestBatchId>n&&i.set(e.getKey(),e)}return bn.resolve(i)}getOverlaysForCollectionGroup(e,t,n,i){let r=new xn((e,t)=>e-t);const s=this.overlays.getIterator();for(;s.hasNext();){const e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=r.get(e.largestBatchId);null===t&&(t=pr(),r=r.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=pr(),a=r.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((e,t)=>o.set(e,t)),!(o.size()>=i)););return bn.resolve(o)}wt(e,t,n){const i=this.overlays.get(n.key);if(null!==i){const e=this.kr.get(i.largestBatchId).delete(n.key);this.kr.set(i.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new es(t,n));let r=this.kr.get(t);void 0===r&&(r=wr(),this.kr.set(t,r)),this.kr.set(t,r.add(n.key))}}
|
|
1370
|
+
/**
|
|
1371
|
+
* @license
|
|
1372
|
+
* Copyright 2024 Google LLC
|
|
1373
|
+
*
|
|
1374
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1375
|
+
* you may not use this file except in compliance with the License.
|
|
1376
|
+
* You may obtain a copy of the License at
|
|
1377
|
+
*
|
|
1378
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1379
|
+
*
|
|
1380
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1381
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1382
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1383
|
+
* See the License for the specific language governing permissions and
|
|
1384
|
+
* limitations under the License.
|
|
1385
|
+
*/class go{constructor(){this.sessionToken=Fn.EMPTY_BYTE_STRING}getSessionToken(e){return bn.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,bn.resolve()}}
|
|
1302
1386
|
/**
|
|
1303
1387
|
* @license
|
|
1304
1388
|
* Copyright 2017 Google LLC
|
|
@@ -1314,7 +1398,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1314
1398
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1315
1399
|
* See the License for the specific language governing permissions and
|
|
1316
1400
|
* limitations under the License.
|
|
1317
|
-
*/class
|
|
1401
|
+
*/class mo{constructor(){this.qr=new Ln(vo.Qr),this.$r=new Ln(vo.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,t){const n=new vo(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 vo(e,t))}Gr(e,t){e.forEach(e=>this.removeReference(e,t))}zr(e){const t=new tn(new Xt([])),n=new vo(t,e),i=new vo(t,e+1),r=[];return this.$r.forEachInRange([n,i],e=>{this.Wr(e),r.push(e.key)}),r}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 tn(new Xt([])),n=new vo(t,e),i=new vo(t,e+1);let r=wr();return this.$r.forEachInRange([n,i],e=>{r=r.add(e.key)}),r}containsKey(e){const t=new vo(e,0),n=this.qr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class vo{constructor(e,t){this.key=e,this.Hr=t}static Qr(e,t){return tn.comparator(e.key,t.key)||qt(e.Hr,t.Hr)}static Ur(e,t){return qt(e.Hr,t.Hr)||tn.comparator(e.key,t.key)}}
|
|
1318
1402
|
/**
|
|
1319
1403
|
* @license
|
|
1320
1404
|
* Copyright 2017 Google LLC
|
|
@@ -1330,7 +1414,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1330
1414
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1331
1415
|
* See the License for the specific language governing permissions and
|
|
1332
1416
|
* limitations under the License.
|
|
1333
|
-
*/class
|
|
1417
|
+
*/class yo{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.er=1,this.Yr=new Ln(vo.Qr)}checkEmpty(e){return bn.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,i){const r=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new Xr(r,t,n,i);this.mutationQueue.push(s);for(const t of i)this.Yr=this.Yr.add(new vo(t.key,r)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return bn.resolve(s)}lookupMutationBatch(e,t){return bn.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){const n=t+1,i=this.Xr(n),r=i<0?0:i;return bn.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return bn.resolve(0===this.mutationQueue.length?-1:this.er-1)}getAllMutationBatches(e){return bn.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){const n=new vo(t,0),i=new vo(t,Number.POSITIVE_INFINITY),r=[];return this.Yr.forEachInRange([n,i],e=>{const t=this.Zr(e.Hr);r.push(t)}),bn.resolve(r)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new Ln(qt);return t.forEach(e=>{const t=new vo(e,0),i=new vo(e,Number.POSITIVE_INFINITY);this.Yr.forEachInRange([t,i],e=>{n=n.add(e.Hr)})}),bn.resolve(this.ei(n))}getAllMutationBatchesAffectingQuery(e,t){const n=t.path,i=n.length+1;let r=n;tn.isDocumentKey(r)||(r=r.child(""));const s=new vo(new tn(r),0);let o=new Ln(qt);return this.Yr.forEachWhile(e=>{const t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===i&&(o=o.add(e.Hr)),!0)},s),bn.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){Rt(0===this.ti(t.batchId,"removed"),55003),this.mutationQueue.shift();let n=this.Yr;return bn.forEach(t.mutations,i=>{const r=new vo(i.key,t.batchId);return n=n.delete(r),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.Yr=n})}rr(e){}containsKey(e,t){const n=new vo(t,0),i=this.Yr.firstAfterOrEqual(n);return bn.resolve(t.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,bn.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]}}
|
|
1334
1418
|
/**
|
|
1335
1419
|
* @license
|
|
1336
1420
|
* Copyright 2017 Google LLC
|
|
@@ -1346,7 +1430,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1346
1430
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1347
1431
|
* See the License for the specific language governing permissions and
|
|
1348
1432
|
* limitations under the License.
|
|
1349
|
-
*/class
|
|
1433
|
+
*/class wo{constructor(e){this.ni=e,this.docs=new xn(tn.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,i=this.docs.get(n),r=i?i.size:0,s=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-r,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 bn.resolve(n?n.document.mutableCopy():_i.newInvalidDocument(t))}getEntries(e,t){let n=ur();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():_i.newInvalidDocument(e))}),bn.resolve(n)}getDocumentsMatchingQuery(e,t,n,i){let r=ur();const s=t.path,o=new tn(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||vn(gn(o),n)<=0||(i.has(o.key)||sr(t,o))&&(r=r.insert(o.key,o.mutableCopy()))}return bn.resolve(r)}getAllFromCollectionGroup(e,t,n,i){kt(9500)}ri(e,t){return bn.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new bo(this)}getSize(e){return bn.resolve(this.size)}}class bo extends lo{constructor(e){super(),this.Or=e}applyChanges(e){const t=[];return this.changes.forEach((n,i)=>{i.isValidDocument()?t.push(this.Or.addEntry(e,i)):this.Or.removeEntry(n)}),bn.waitFor(t)}getFromCache(e,t){return this.Or.getEntry(e,t)}getAllFromCache(e,t){return this.Or.getEntries(e,t)}}
|
|
1350
1434
|
/**
|
|
1351
1435
|
* @license
|
|
1352
1436
|
* Copyright 2017 Google LLC
|
|
@@ -1362,7 +1446,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1362
1446
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1363
1447
|
* See the License for the specific language governing permissions and
|
|
1364
1448
|
* limitations under the License.
|
|
1365
|
-
*/class
|
|
1449
|
+
*/class _o{constructor(e){this.persistence=e,this.ii=new cr(e=>qi(e),Gi),this.lastRemoteSnapshotVersion=pn.min(),this.highestTargetId=0,this.si=0,this.oi=new mo,this.targetCount=0,this._i=io.ar()}forEachTarget(e,t){return this.ii.forEach((e,n)=>t(n)),bn.resolve()}getLastRemoteSnapshotVersion(e){return bn.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return bn.resolve(this.si)}allocateTargetId(e){return this.highestTargetId=this._i.next(),bn.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.si&&(this.si=t),bn.resolve()}hr(e){this.ii.set(e.target,e);const t=e.targetId;t>this.highestTargetId&&(this._i=new io(t),this.highestTargetId=t),e.sequenceNumber>this.si&&(this.si=e.sequenceNumber)}addTargetData(e,t){return this.hr(t),this.targetCount+=1,bn.resolve()}updateTargetData(e,t){return this.hr(t),bn.resolve()}removeTargetData(e,t){return this.ii.delete(t.target),this.oi.zr(t.targetId),this.targetCount-=1,bn.resolve()}removeTargets(e,t,n){let i=0;const r=[];return this.ii.forEach((s,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.ii.delete(s),r.push(this.removeMatchingKeysForTargetId(e,o.targetId)),i++)}),bn.waitFor(r).next(()=>i)}getTargetCount(e){return bn.resolve(this.targetCount)}getTargetData(e,t){const n=this.ii.get(t)||null;return bn.resolve(n)}addMatchingKeys(e,t,n){return this.oi.Kr(t,n),bn.resolve()}removeMatchingKeys(e,t,n){this.oi.Gr(t,n);const i=this.persistence.referenceDelegate,r=[];return i&&t.forEach(t=>{r.push(i.markPotentiallyOrphaned(e,t))}),bn.waitFor(r)}removeMatchingKeysForTargetId(e,t){return this.oi.zr(t),bn.resolve()}getMatchingKeysForTargetId(e,t){const n=this.oi.Jr(t);return bn.resolve(n)}containsKey(e,t){return bn.resolve(this.oi.containsKey(t))}}
|
|
1366
1450
|
/**
|
|
1367
1451
|
* @license
|
|
1368
1452
|
* Copyright 2017 Google LLC
|
|
@@ -1378,7 +1462,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1378
1462
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
1463
|
* See the License for the specific language governing permissions and
|
|
1380
1464
|
* limitations under the License.
|
|
1381
|
-
*/class
|
|
1465
|
+
*/class So{constructor(e,t){this.ai={},this.overlays={},this.ui=new Sn(0),this.ci=!1,this.ci=!0,this.li=new go,this.referenceDelegate=e(this),this.hi=new _o(this),this.indexManager=new Xs,this.remoteDocumentCache=function(e){return new wo(e)}(e=>this.referenceDelegate.Pi(e)),this.serializer=new Js(t),this.Ti=new fo(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 po,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 i=new Eo(this.ui.next());return this.referenceDelegate.Ii(),n(i).next(e=>this.referenceDelegate.di(i).next(()=>e)).toPromise().then(e=>(i.raiseOnCommittedEvent(),e))}Ei(e,t){return bn.or(Object.values(this.ai).map(n=>()=>n.containsKey(e,t)))}}class Eo extends yn{constructor(e){super(),this.currentSequenceNumber=e}}class To{constructor(e){this.persistence=e,this.Ai=new mo,this.Ri=null}static Vi(e){return new To(e)}get mi(){if(this.Ri)return this.Ri;throw kt(60996)}addReference(e,t,n){return this.Ai.addReference(n,t),this.mi.delete(n.toString()),bn.resolve()}removeReference(e,t,n){return this.Ai.removeReference(n,t),this.mi.add(n.toString()),bn.resolve()}markPotentiallyOrphaned(e,t){return this.mi.add(t.toString()),bn.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 bn.forEach(this.mi,n=>{const i=tn.fromPath(n);return this.fi(e,i).next(e=>{e||t.removeEntry(i,pn.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 bn.or([()=>bn.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 cr(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=Cn(t)),t=In(e.get(n),t);return Cn(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new co(e,t)}(this,t)}static Vi(e,t){return new Io(e,t)}Ii(){}di(e){return bn.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 bn.forEach(this.gi,(n,i)=>this.Sr(e,n,i).next(e=>e?bn.resolve():t(i)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const i=this.persistence.getRemoteDocumentCache(),r=i.newChangeBuffer();return i.ri(e,i=>this.Sr(e,i,t).next(e=>{e||(n++,r.removeEntry(i,pn.min()))})).next(()=>r.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.gi.set(t,e.currentSequenceNumber),bn.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),bn.resolve()}removeReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),bn.resolve()}updateLimboDocument(e,t){return this.gi.set(t,e.currentSequenceNumber),bn.resolve()}Pi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=hi(e.data.value)),t}Sr(e,t,n){return bn.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.gi.get(t);return bn.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}
|
|
1382
1466
|
/**
|
|
1383
1467
|
* @license
|
|
1384
1468
|
* Copyright 2017 Google LLC
|
|
@@ -1394,7 +1478,23 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1394
1478
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1395
1479
|
* See the License for the specific language governing permissions and
|
|
1396
1480
|
* limitations under the License.
|
|
1397
|
-
*/class
|
|
1481
|
+
*/class Co{constructor(e,t,n,i){this.targetId=e,this.fromCache=t,this.Is=n,this.ds=i}static Es(e,t){let n=wr(),i=wr();for(const e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:i=i.add(e.doc.key)}return new Co(e,t.fromCache,n,i)}}
|
|
1482
|
+
/**
|
|
1483
|
+
* @license
|
|
1484
|
+
* Copyright 2023 Google LLC
|
|
1485
|
+
*
|
|
1486
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1487
|
+
* you may not use this file except in compliance with the License.
|
|
1488
|
+
* You may obtain a copy of the License at
|
|
1489
|
+
*
|
|
1490
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1491
|
+
*
|
|
1492
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1493
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1494
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1495
|
+
* See the License for the specific language governing permissions and
|
|
1496
|
+
* limitations under the License.
|
|
1497
|
+
*/class ko{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}
|
|
1398
1498
|
/**
|
|
1399
1499
|
* @license
|
|
1400
1500
|
* Copyright 2019 Google LLC
|
|
@@ -1410,7 +1510,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1410
1510
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1411
1511
|
* See the License for the specific language governing permissions and
|
|
1412
1512
|
* limitations under the License.
|
|
1413
|
-
*/class
|
|
1513
|
+
*/class Ao{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=b()?8:function(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(w())>0?6:4}initialize(e,t){this.gs=e,this.indexManager=t,this.As=!0}getDocumentsMatchingQuery(e,t,n,i){const r={result:null};return this.ps(e,t).next(e=>{r.result=e}).next(()=>{if(!r.result)return this.ys(e,t,i,n).next(e=>{r.result=e})}).next(()=>{if(r.result)return;const n=new ko;return this.ws(e,t,n).next(i=>{if(r.result=i,this.Rs)return this.Ss(e,t,n,i.size)})}).next(()=>r.result)}Ss(e,t,n,i){return n.documentReadCount<this.Vs?(St()<=M.DEBUG&&Et("QueryEngine","SDK will not create cache indexes for query:",rr(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),bn.resolve()):(St()<=M.DEBUG&&Et("QueryEngine","Query:",rr(t),"scans",n.documentReadCount,"local documents and returns",i,"documents as results."),n.documentReadCount>this.fs*i?(St()<=M.DEBUG&&Et("QueryEngine","The SDK decides to create cache indexes for query:",rr(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Zi(t))):bn.resolve())}ps(e,t){if(Ji(t))return bn.resolve(null);let n=Zi(t);return this.indexManager.getIndexType(e,n).next(i=>0===i?null:(null!==t.limit&&1===i&&(t=tr(t,null,"F"),n=Zi(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(i=>{const r=wr(...i);return this.gs.getDocuments(e,r).next(i=>this.indexManager.getMinOffset(e,n).next(n=>{const s=this.bs(t,i);return this.Ds(t,s,r,n.readTime)?this.ps(e,tr(t,null,"F")):this.vs(e,s,t,n)}))})))}ys(e,t,n,i){return Ji(t)||i.isEqual(pn.min())?bn.resolve(null):this.gs.getDocuments(e,n).next(r=>{const s=this.bs(t,r);return this.Ds(t,s,n,i)?bn.resolve(null):(St()<=M.DEBUG&&Et("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),rr(t)),this.vs(e,s,t,function(e,t){const n=e.toTimestamp().seconds,i=e.toTimestamp().nanoseconds+1,r=pn.fromTimestamp(1e9===i?new fn(n+1,0):new fn(n,i));return new mn(r,tn.empty(),t)}(i,-1)).next(e=>e))})}bs(e,t){let n=new Ln(or(e));return t.forEach((t,i)=>{sr(e,i)&&(n=n.add(i))}),n}Ds(e,t,n,i){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const r="F"===e.limitType?t.last():t.first();return!!r&&(r.hasPendingWrites||r.version.compareTo(i)>0)}ws(e,t,n){return St()<=M.DEBUG&&Et("QueryEngine","Using full collection scan to execute query:",rr(t)),this.gs.getDocumentsMatchingQuery(e,t,mn.min(),n)}vs(e,t,n,i){return this.gs.getDocumentsMatchingQuery(e,n,i).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}
|
|
1414
1514
|
/**
|
|
1415
1515
|
* @license
|
|
1416
1516
|
* Copyright 2020 Google LLC
|
|
@@ -1426,7 +1526,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1426
1526
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1427
1527
|
* See the License for the specific language governing permissions and
|
|
1428
1528
|
* limitations under the License.
|
|
1429
|
-
*/class
|
|
1529
|
+
*/const Ro="LocalStore";class xo{constructor(e,t,n,i){this.persistence=e,this.Cs=t,this.serializer=i,this.Fs=new xn(qt),this.Ms=new cr(e=>qi(e),Gi),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 No(e,t){const n=xt(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let i;return n.mutationQueue.getAllMutationBatches(e).next(r=>(i=r,n.Ns(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const r=[],s=[];let o=wr();for(const e of i){r.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){s.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:r,addedBatchIds:s}))})})}function Oo(e){const t=xt(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.hi.getLastRemoteSnapshotVersion(e))}function Lo(e,t){const n=xt(e),i=t.snapshotVersion;let r=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{const s=n.Os.newChangeBuffer({trackRemovals:!0});r=n.Fs;const o=[];t.targetChanges.forEach((s,a)=>{const c=r.get(a);if(!c)return;o.push(n.hi.removeMatchingKeys(e,s.removedDocuments,a).next(()=>n.hi.addMatchingKeys(e,s.addedDocuments,a)));let l=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?l=l.withResumeToken(Fn.EMPTY_BYTE_STRING,pn.min()).withLastLimboFreeSnapshotVersion(pn.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,i)),r=r.insert(a,l),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,l,s)&&o.push(n.hi.updateTargetData(e,l))});let a=ur(),c=wr();if(t.documentUpdates.forEach(i=>{t.resolvedLimboDocuments.has(i)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,i))}),o.push(function(e,t,n){let i=wr(),r=wr();return n.forEach(e=>i=i.add(e)),t.getEntries(e,i).next(e=>{let i=ur();return n.forEach((n,s)=>{const o=e.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(r=r.add(n)),s.isNoDocument()&&s.version.isEqual(pn.min())?(t.removeEntry(n,s.readTime),i=i.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(s),i=i.insert(n,s)):Et(Ro,"Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)}),{Ls:i,ks:r}})}(e,s,t.documentUpdates).next(e=>{a=e.Ls,c=e.ks})),!i.isEqual(pn.min())){const t=n.hi.getLastRemoteSnapshotVersion(e).next(t=>n.hi.setTargetsMetadata(e,e.currentSequenceNumber,i));o.push(t)}return bn.waitFor(o).next(()=>s.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,a,c)).next(()=>a)}).then(e=>(n.Fs=r,e))}function Po(e,t){const n=xt(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}async function Do(e,t,n){const i=xt(e),r=i.Fs.get(t),s=n?"readwrite":"readwrite-primary";try{n||await i.persistence.runTransaction("Release target",s,e=>i.persistence.referenceDelegate.removeTarget(e,r))}catch(e){if(!_n(e))throw e;Et(Ro,`Failed to update sequence numbers for target ${t}: ${e}`)}i.Fs=i.Fs.remove(t),i.Ms.delete(r.target)}function Mo(e,t,n){const i=xt(e);let r=pn.min(),s=wr();return i.persistence.runTransaction("Execute query","readwrite",e=>function(e,t,n){const i=xt(e),r=i.Ms.get(n);return void 0!==r?bn.resolve(i.Fs.get(r)):i.hi.getTargetData(t,n)}(i,e,Zi(t)).next(t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,i.hi.getMatchingKeysForTargetId(e,t.targetId).next(e=>{s=e})}).next(()=>i.Cs.getDocumentsMatchingQuery(e,t,n?r:pn.min(),n?s:wr())).next(e=>(function(e,t,n){let i=e.xs.get(t)||pn.min();n.forEach((e,t)=>{t.readTime.compareTo(i)>0&&(i=t.readTime)}),e.xs.set(t,i)}(i,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:s})))}class Fo{constructor(){this.activeTargetIds=br}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 zo{constructor(){this.Fo=new Fo,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 Fo,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}
|
|
1430
1530
|
/**
|
|
1431
1531
|
* @license
|
|
1432
1532
|
* Copyright 2019 Google LLC
|
|
@@ -1442,7 +1542,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1442
1542
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1443
1543
|
* See the License for the specific language governing permissions and
|
|
1444
1544
|
* limitations under the License.
|
|
1445
|
-
*/class
|
|
1545
|
+
*/class Uo{xo(e){}shutdown(){}}
|
|
1446
1546
|
/**
|
|
1447
1547
|
* @license
|
|
1448
1548
|
* Copyright 2019 Google LLC
|
|
@@ -1458,10 +1558,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1458
1558
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1459
1559
|
* See the License for the specific language governing permissions and
|
|
1460
1560
|
* limitations under the License.
|
|
1461
|
-
*/class
|
|
1561
|
+
*/const Vo="ConnectivityMonitor";class Bo{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}}
|
|
1462
1562
|
/**
|
|
1463
1563
|
* @license
|
|
1464
|
-
* Copyright
|
|
1564
|
+
* Copyright 2023 Google LLC
|
|
1465
1565
|
*
|
|
1466
1566
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1467
1567
|
* you may not use this file except in compliance with the License.
|
|
@@ -1474,10 +1574,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1474
1574
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1475
1575
|
* See the License for the specific language governing permissions and
|
|
1476
1576
|
* limitations under the License.
|
|
1477
|
-
*/
|
|
1577
|
+
*/let jo=null;function Ho(){return null===jo?jo=268435456+Math.round(2147483648*Math.random()):jo++,"0x"+jo.toString(16)
|
|
1478
1578
|
/**
|
|
1479
1579
|
* @license
|
|
1480
|
-
* Copyright
|
|
1580
|
+
* Copyright 2020 Google LLC
|
|
1481
1581
|
*
|
|
1482
1582
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1483
1583
|
* you may not use this file except in compliance with the License.
|
|
@@ -1490,7 +1590,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1490
1590
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1491
1591
|
* See the License for the specific language governing permissions and
|
|
1492
1592
|
* limitations under the License.
|
|
1493
|
-
*/class
|
|
1593
|
+
*/}const $o="RestConnection",qo={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};class Go{get Qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),i=encodeURIComponent(this.databaseId.database);this.$o=t+"://"+e.host,this.Uo=`projects/${n}/databases/${i}`,this.Ko=this.databaseId.database===Jn?`project_id=${n}`:`project_id=${n}&database_id=${i}`}Wo(e,t,n,i,r){const s=Ho(),o=this.Go(e,t.toUriEncodedString());Et($o,`Sending RPC '${e}' ${s}:`,o,n);const a={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(a,i,r);const{host:c}=new URL(o),l=p(c);return this.jo(e,o,a,n,l).then(t=>(Et($o,`Received RPC '${e}' ${s}: `,t),t),t=>{throw It($o,`RPC '${e}' ${s} failed with error: `,t,"url: ",o,"request:",n),t})}Jo(e,t,n,i,r,s){return this.Wo(e,t,n,i,r)}zo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+bt,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=qo[e];return`${this.$o}/v1/${t}:${n}`}terminate(){}}
|
|
1494
1594
|
/**
|
|
1495
1595
|
* @license
|
|
1496
1596
|
* Copyright 2017 Google LLC
|
|
@@ -1506,10 +1606,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1506
1606
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1507
1607
|
* See the License for the specific language governing permissions and
|
|
1508
1608
|
* limitations under the License.
|
|
1509
|
-
*/class
|
|
1609
|
+
*/class Ko{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)}}
|
|
1510
1610
|
/**
|
|
1511
1611
|
* @license
|
|
1512
|
-
* Copyright
|
|
1612
|
+
* Copyright 2017 Google LLC
|
|
1513
1613
|
*
|
|
1514
1614
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1515
1615
|
* you may not use this file except in compliance with the License.
|
|
@@ -1522,10 +1622,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1522
1622
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1523
1623
|
* See the License for the specific language governing permissions and
|
|
1524
1624
|
* limitations under the License.
|
|
1525
|
-
*/
|
|
1625
|
+
*/const Wo="WebChannelConnection";class Qo extends Go{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,i,r){const s=Ho();return new Promise((r,o)=>{const a=new ct;a.setWithCredentials(!0),a.listenOnce(ut.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case ht.NO_ERROR:const t=a.getResponseJson();Et(Wo,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(t)),r(t);break;case ht.TIMEOUT:Et(Wo,`RPC '${e}' ${s} timed out`),o(new Ot(Nt.DEADLINE_EXCEEDED,"Request time out"));break;case ht.HTTP_ERROR:const n=a.getStatus();if(Et(Wo,`RPC '${e}' ${s} 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(Nt).indexOf(t)>=0?t:Nt.UNKNOWN}(t.status);o(new Ot(e,t.message))}else o(new Ot(Nt.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new Ot(Nt.UNAVAILABLE,"Connection failed."));break;default:kt(9055,{c_:e,streamId:s,l_:a.getLastErrorCode(),h_:a.getLastError()})}}finally{Et(Wo,`RPC '${e}' ${s} completed.`)}});const c=JSON.stringify(i);Et(Wo,`RPC '${e}' ${s} sending request:`,i),a.send(t,"POST",c,n,15)})}P_(e,t,n){const i=Ho(),r=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=gt(),o=pt(),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 l=r.join("");Et(Wo,`Creating RPC '${e}' stream ${i}: ${l}`,a);const u=s.createWebChannel(l,a);this.T_(u);let h=!1,d=!1;const f=new Ko({Ho:t=>{d?Et(Wo,`Not sending because RPC '${e}' stream ${i} is closed:`,t):(h||(Et(Wo,`Opening RPC '${e}' stream ${i} transport.`),u.open(),h=!0),Et(Wo,`RPC '${e}' stream ${i} sending:`,t),u.send(t))},Yo:()=>u.close()}),p=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return p(u,lt.EventType.OPEN,()=>{d||(Et(Wo,`RPC '${e}' stream ${i} transport opened.`),f.s_())}),p(u,lt.EventType.CLOSE,()=>{d||(d=!0,Et(Wo,`RPC '${e}' stream ${i} transport closed`),f.__(),this.I_(u))}),p(u,lt.EventType.ERROR,t=>{d||(d=!0,It(Wo,`RPC '${e}' stream ${i} transport errored. Name:`,t.name,"Message:",t.message),f.__(new Ot(Nt.UNAVAILABLE,"The operation could not be completed")))}),p(u,lt.EventType.MESSAGE,t=>{var n;if(!d){const r=t.data[0];Rt(!!r,16349);const s=r,o=(null==s?void 0:s.error)||(null===(n=s[0])||void 0===n?void 0:n.error);if(o){Et(Wo,`RPC '${e}' stream ${i} received error:`,o);const t=o.status;let n=function(e){const t=ns[e];if(void 0!==t)return rs(t)}(t),r=o.message;void 0===n&&(n=Nt.INTERNAL,r="Unknown error status: "+t+" with message "+o.message),d=!0,f.__(new Ot(n,r)),u.close()}else Et(Wo,`RPC '${e}' stream ${i} received:`,r),f.a_(r)}}),p(o,ft.STAT_EVENT,t=>{t.stat===dt.PROXY?Et(Wo,`RPC '${e}' stream ${i} detected buffering proxy`):t.stat===dt.NOPROXY&&Et(Wo,`RPC '${e}' stream ${i} 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 Jo(){return"undefined"!=typeof document?document:null}
|
|
1526
1626
|
/**
|
|
1527
1627
|
* @license
|
|
1528
|
-
* Copyright
|
|
1628
|
+
* Copyright 2020 Google LLC
|
|
1529
1629
|
*
|
|
1530
1630
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1531
1631
|
* you may not use this file except in compliance with the License.
|
|
@@ -1538,7 +1638,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1538
1638
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1539
1639
|
* See the License for the specific language governing permissions and
|
|
1540
1640
|
* limitations under the License.
|
|
1541
|
-
*/
|
|
1641
|
+
*/function Yo(e){return new Ss(e,!0)}
|
|
1542
1642
|
/**
|
|
1543
1643
|
* @license
|
|
1544
1644
|
* Copyright 2017 Google LLC
|
|
@@ -1554,7 +1654,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1554
1654
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1555
1655
|
* See the License for the specific language governing permissions and
|
|
1556
1656
|
* limitations under the License.
|
|
1557
|
-
*/class
|
|
1657
|
+
*/class Xo{constructor(e,t,n=1e3,i=1.5,r=6e4){this.Fi=e,this.timerId=t,this.d_=n,this.E_=i,this.A_=r,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_),i=Math.max(0,t-n);i>0&&Et("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.R_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.V_=this.Fi.enqueueAfterDelay(this.timerId,i,()=>(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_}}
|
|
1558
1658
|
/**
|
|
1559
1659
|
* @license
|
|
1560
1660
|
* Copyright 2017 Google LLC
|
|
@@ -1570,10 +1670,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1570
1670
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1571
1671
|
* See the License for the specific language governing permissions and
|
|
1572
1672
|
* limitations under the License.
|
|
1573
|
-
*/class
|
|
1673
|
+
*/const Zo="PersistentStream";class ea{constructor(e,t,n,i,r,s,o,a){this.Fi=e,this.w_=n,this.S_=i,this.connection=r,this.authCredentialsProvider=s,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 Xo(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===Nt.RESOURCE_EXHAUSTED?(Tt(t.toString()),Tt("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===Nt.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 Ot(Nt.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(Zo,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget(()=>this.b_===e?t():(Et(Zo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ta extends ea{constructor(e,t,n,i,r,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}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 i=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:kt(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),r=t.targetChange.targetIds||[],s=function(e,t){return e.useProto3Json?(Rt(void 0===t||"string"==typeof t,58123),Fn.fromBase64String(t||"")):(Rt(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),Fn.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Nt.UNKNOWN:rs(e.code);return new Ot(t,e.message||"")}(o);n=new ps(i,r,s,a||null)}else if("documentChange"in t){t.documentChange;const i=t.documentChange;i.document,i.document.name,i.document.updateTime;const r=Os(e,i.document.name),s=ks(i.document.updateTime),o=i.document.createTime?ks(i.document.createTime):pn.min(),a=new wi({mapValue:{fields:i.document.fields}}),c=_i.newFoundDocument(r,s,o,a),l=i.targetIds||[],u=i.removedTargetIds||[];n=new ds(l,u,c.key,c)}else if("documentDelete"in t){t.documentDelete;const i=t.documentDelete;i.document;const r=Os(e,i.document),s=i.readTime?ks(i.readTime):pn.min(),o=_i.newNoDocument(r,s),a=i.removedTargetIds||[];n=new ds([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const i=t.documentRemove;i.document;const r=Os(e,i.document),s=i.removedTargetIds||[];n=new ds([],s,r,null)}else{if(!("filter"in t))return kt(11601,{At:t});{t.filter;const e=t.filter;e.targetId;const{count:i=0,unchangedNames:r}=e,s=new ts(i,r),o=e.targetId;n=new fs(o,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return pn.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?pn.min():t.readTime?ks(t.readTime):pn.min()}(e);return this.listener.J_(t,n)}H_(e){const t={};t.database=Ps(this.serializer),t.addTarget=function(e,t){let n;const i=t.target;if(n=Ki(i)?{documents:Fs(e,i)}:{query:zs(e,i).Vt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Is(e,t.resumeToken);const i=Es(e,t.expectedCount);null!==i&&(n.expectedCount=i)}else if(t.snapshotVersion.compareTo(pn.min())>0){n.readTime=Ts(e,t.snapshotVersion.toTimestamp());const i=Es(e,t.expectedCount);null!==i&&(n.expectedCount=i)}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 kt(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=Ps(this.serializer),t.removeTarget=e,this.k_(t)}}class na extends ea{constructor(e,t,n,i,r,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,i,s),this.serializer=r}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 Rt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,Rt(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){Rt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();const t=function(e,t){return e&&e.length>0?(Rt(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?ks(e.updateTime):ks(t);return n.isEqual(pn.min())&&(n=ks(t)),new Mr(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=ks(e.commitTime);return this.listener.ta(n,t)}na(){const e={};e.database=Ps(this.serializer),this.k_(e)}X_(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof qr)n={update:Ms(e,t.key,t.value)};else if(t instanceof Jr)n={delete:Ns(e,t.key)};else if(t instanceof Gr)n={update:Ms(e,t.key,t.data),updateMask:Ks(t.fieldMask)};else{if(!(t instanceof Yr))return kt(16599,{Rt:t.type});n={verify:Ns(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof Ar)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Rr)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Nr)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Lr)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw kt(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:Cs(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:kt(27497)}(e,t.precondition)),n}(this.serializer,e))};this.k_(t)}}
|
|
1574
1674
|
/**
|
|
1575
1675
|
* @license
|
|
1576
|
-
* Copyright
|
|
1676
|
+
* Copyright 2017 Google LLC
|
|
1577
1677
|
*
|
|
1578
1678
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1579
1679
|
* you may not use this file except in compliance with the License.
|
|
@@ -1586,7 +1686,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1586
1686
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1587
1687
|
* See the License for the specific language governing permissions and
|
|
1588
1688
|
* limitations under the License.
|
|
1589
|
-
*/}(t.
|
|
1689
|
+
*/class ia{}class ra extends ia{constructor(e,t,n,i){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=i,this.ra=!1}ia(){if(this.ra)throw new Ot(Nt.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,t,n,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([r,s])=>this.connection.Wo(e,Rs(t,n),i,r,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Nt.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Ot(Nt.UNKNOWN,e.toString())})}Jo(e,t,n,i,r){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Jo(e,Rs(t,n),i,s,o,r)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Nt.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Ot(Nt.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?(Tt(t),this._a=!1):Et("OnlineStateTracker",t)}ha(){null!==this.oa&&(this.oa.cancel(),this.oa=null)}}
|
|
1590
1690
|
/**
|
|
1591
1691
|
* @license
|
|
1592
1692
|
* Copyright 2017 Google LLC
|
|
@@ -1602,10 +1702,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1602
1702
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1603
1703
|
* See the License for the specific language governing permissions and
|
|
1604
1704
|
* limitations under the License.
|
|
1605
|
-
*/
|
|
1705
|
+
*/const oa="RemoteStore";class aa{constructor(e,t,n,i,r){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=r,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{ma(this)&&(Et(oa,"Restarting streams for network reachability change."),await async function(e){const t=xt(e);t.Ia.add(4),await la(t),t.Aa.set("Unknown"),t.Ia.delete(4),await ca(t)}(this))})}),this.Aa=new sa(n,i)}}async function ca(e){if(ma(e))for(const t of e.da)await t(!0)}async function la(e){for(const t of e.da)await t(!1)}function ua(e,t){const n=xt(e);n.Ta.has(t.targetId)||(n.Ta.set(t.targetId,t),ga(n)?pa(n):Pa(n).x_()&&da(n,t))}function ha(e,t){const n=xt(e),i=Pa(n);n.Ta.delete(t),i.x_()&&fa(n,t),0===n.Ta.size&&(i.x_()?i.B_():ma(n)&&n.Aa.set("Unknown"))}function da(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(pn.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Pa(e).H_(t)}function fa(e,t){e.Ra.$e(t),Pa(e).Y_(t)}function pa(e){e.Ra=new ms({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 ga(e){return ma(e)&&!Pa(e).M_()&&e.Ta.size>0}function ma(e){return 0===xt(e).Ia.size}function va(e){e.Ra=void 0}async function ya(e){e.Aa.set("Online")}async function wa(e){e.Ta.forEach((t,n)=>{da(e,t)})}async function ba(e,t){va(e),ga(e)?(e.Aa.la(t),pa(e)):e.Aa.set("Unknown")}async function _a(e,t,n){if(e.Aa.set("Online"),t instanceof ps&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const i of t.targetIds)e.Ta.has(i)&&(await e.remoteSyncer.rejectListen(i,n),e.Ta.delete(i),e.Ra.removeTarget(i))}(e,t)}catch(n){Et(oa,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Sa(e,n)}else if(t instanceof ds?e.Ra.Ye(t):t instanceof fs?e.Ra.it(t):e.Ra.et(t),!n.isEqual(pn.min()))try{const t=await Oo(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Ra.Pt(t);return n.targetChanges.forEach((n,i)=>{if(n.resumeToken.approximateByteSize()>0){const r=e.Ta.get(i);r&&e.Ta.set(i,r.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{const i=e.Ta.get(t);if(!i)return;e.Ta.set(t,i.withResumeToken(Fn.EMPTY_BYTE_STRING,i.snapshotVersion)),fa(e,t);const r=new Qs(i.target,t,n,i.sequenceNumber);da(e,r)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Et(oa,"Failed to raise snapshot:",t),await Sa(e,t)}}async function Sa(e,t,n){if(!_n(t))throw t;e.Ia.add(1),await la(e),e.Aa.set("Offline"),n||(n=()=>Oo(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Et(oa,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await ca(e)})}function Ea(e,t){return t().catch(n=>Sa(e,n,t))}async function Ta(e){const t=xt(e),n=Da(t);let i=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:-1;for(;Ia(t);)try{const e=await Po(t.localStore,i);if(null===e){0===t.Pa.length&&n.B_();break}i=e.batchId,Ca(t,e)}catch(e){await Sa(t,e)}ka(t)&&Aa(t)}function Ia(e){return ma(e)&&e.Pa.length<10}function Ca(e,t){e.Pa.push(t);const n=Da(e);n.x_()&&n.Z_&&n.X_(t.mutations)}function ka(e){return ma(e)&&!Da(e).M_()&&e.Pa.length>0}function Aa(e){Da(e).start()}async function Ra(e){Da(e).na()}async function xa(e){const t=Da(e);for(const n of e.Pa)t.X_(n.mutations)}async function Na(e,t,n){const i=e.Pa.shift(),r=Zr.from(i,t,n);await Ea(e,()=>e.remoteSyncer.applySuccessfulWrite(r)),await Ta(e)}async function Oa(e,t){t&&Da(e).Z_&&await async function(e,t){if(function(e){return function(e){switch(e){case Nt.OK:return kt(64938);case Nt.CANCELLED:case Nt.UNKNOWN:case Nt.DEADLINE_EXCEEDED:case Nt.RESOURCE_EXHAUSTED:case Nt.INTERNAL:case Nt.UNAVAILABLE:case Nt.UNAUTHENTICATED:return!1;case Nt.INVALID_ARGUMENT:case Nt.NOT_FOUND:case Nt.ALREADY_EXISTS:case Nt.PERMISSION_DENIED:case Nt.FAILED_PRECONDITION:case Nt.ABORTED:case Nt.OUT_OF_RANGE:case Nt.UNIMPLEMENTED:case Nt.DATA_LOSS:return!0;default:return kt(15467,{code:e})}}(e)&&e!==Nt.ABORTED}(t.code)){const n=e.Pa.shift();Da(e).N_(),await Ea(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await Ta(e)}}(e,t),ka(e)&&Aa(e)}async function La(e,t){const n=xt(e);n.asyncQueue.verifyOperationInProgress(),Et(oa,"RemoteStore received new credentials");const i=ma(n);n.Ia.add(3),await la(n),i&&n.Aa.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ia.delete(3),await ca(n)}function Pa(e){return e.Va||(e.Va=function(e,t,n){const i=xt(e);return i.ia(),new ta(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)
|
|
1606
1706
|
/**
|
|
1607
1707
|
* @license
|
|
1608
|
-
* Copyright
|
|
1708
|
+
* Copyright 2018 Google LLC
|
|
1609
1709
|
*
|
|
1610
1710
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1611
1711
|
* you may not use this file except in compliance with the License.
|
|
@@ -1618,7 +1718,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1618
1718
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
1719
|
* See the License for the specific language governing permissions and
|
|
1620
1720
|
* limitations under the License.
|
|
1621
|
-
*/
|
|
1721
|
+
*/}(e.datastore,e.asyncQueue,{Zo:ya.bind(null,e),e_:wa.bind(null,e),n_:ba.bind(null,e),J_:_a.bind(null,e)}),e.da.push(async t=>{t?(e.Va.N_(),ga(e)?pa(e):e.Aa.set("Unknown")):(await e.Va.stop(),va(e))})),e.Va}function Da(e){return e.ma||(e.ma=function(e,t,n){const i=xt(e);return i.ia(),new na(t,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,n)}(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),e_:Ra.bind(null,e),n_:Oa.bind(null,e),ea:xa.bind(null,e),ta:Na.bind(null,e)}),e.da.push(async t=>{t?(e.ma.N_(),await Ta(e)):(await e.ma.stop(),e.Pa.length>0&&(Et(oa,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))})),e.ma
|
|
1622
1722
|
/**
|
|
1623
1723
|
* @license
|
|
1624
1724
|
* Copyright 2017 Google LLC
|
|
@@ -1634,7 +1734,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1634
1734
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1635
1735
|
* See the License for the specific language governing permissions and
|
|
1636
1736
|
* limitations under the License.
|
|
1637
|
-
*/class
|
|
1737
|
+
*/}class Ma{constructor(e,t,n,i,r){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=i,this.removalCallback=r,this.deferred=new Lt,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,i,r){const s=Date.now()+n,o=new Ma(e,t,s,i,r);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 Ot(Nt.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 Fa(e,t){if(Tt("AsyncQueue",`${t}: ${e}`),_n(e))return new Ot(Nt.UNAVAILABLE,`${t}: ${e}`);throw e}
|
|
1638
1738
|
/**
|
|
1639
1739
|
* @license
|
|
1640
1740
|
* Copyright 2017 Google LLC
|
|
@@ -1650,7 +1750,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1650
1750
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1651
1751
|
* See the License for the specific language governing permissions and
|
|
1652
1752
|
* limitations under the License.
|
|
1653
|
-
*/class
|
|
1753
|
+
*/class za{static emptySet(e){return new za(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||tn.comparator(t.key,n.key):(e,t)=>tn.comparator(e.key,t.key),this.keyedMap=dr(),this.sortedSet=new xn(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 za))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,i=n.getNext().key;if(!e.isEqual(i))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 za;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}
|
|
1654
1754
|
/**
|
|
1655
1755
|
* @license
|
|
1656
1756
|
* Copyright 2017 Google LLC
|
|
@@ -1666,10 +1766,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1666
1766
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1667
1767
|
* See the License for the specific language governing permissions and
|
|
1668
1768
|
* limitations under the License.
|
|
1669
|
-
*/class
|
|
1769
|
+
*/class Ua{constructor(){this.fa=new xn(tn.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}):kt(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,i,r,s,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=i,this.mutatedKeys=r,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,i,r){const s=[];return t.forEach(e=>{s.push({type:0,doc:e})}),new Va(e,t,za.emptySet(t),s,n,i,!0,!1,r)}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)&&nr(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}}
|
|
1670
1770
|
/**
|
|
1671
1771
|
* @license
|
|
1672
|
-
* Copyright
|
|
1772
|
+
* Copyright 2017 Google LLC
|
|
1673
1773
|
*
|
|
1674
1774
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1675
1775
|
* you may not use this file except in compliance with the License.
|
|
@@ -1682,7 +1782,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1682
1782
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
1783
|
* See the License for the specific language governing permissions and
|
|
1684
1784
|
* limitations under the License.
|
|
1685
|
-
*/(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const s=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==r.length||a?{snapshot:new ju(this.query,t.Qu,i,r,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:s}:{Xu:s}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hu,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=xc(),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 Zu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Xu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=xc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return ju.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class eh{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class nh{constructor(t){this.key=t,this.nc=!1}}class ih{constructor(t,e,n,i,r,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Sc((t=>Pa(t)),Da),this.rc=new Map,this.oc=new Set,this.uc=new ua(no.comparator),this.cc=new Map,this.ac=new xl,this.hc={},this.lc=new Map,this.fc=kl.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function rh(t,e){const n=function(t){const e=Ds(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ah.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=Sh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=lh.bind(null,e),e.sc.Wo=Gu.bind(null,e.eventManager),e.sc.wc=Qu.bind(null,e.eventManager),e}(t);let i,r;const s=n.ic.get(e);if(s)i=s.targetId,n.sharedClientState.addLocalQueryTarget(i),r=s.view.ec();else{const t=await function(t,e){const n=Ds(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let i;return n.Cs.getTargetData(t,e).next((r=>r?(i=r,lo.resolve(i)):n.Cs.allocateTargetId(t).next((r=>(i=new Sl(e,r,0,t.currentSequenceNumber),n.Cs.addTargetData(t,i).next((()=>i)))))))})).then((t=>{const i=n.qi.get(t.targetId);return(null===i||t.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Na(e));n.isPrimaryClient&&pu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);i=t.targetId,r=await async function(t,e,n,i,r){t._c=(e,n,i)=>async function(t,e,n,i){let r=e.view.Wu(n);r.$i&&(r=await Ql(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,r))));const s=i&&i.targetChanges.get(e.targetId),o=e.view.applyChanges(r,t.isPrimaryClient,s);return mh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,i);const s=await Ql(t.localStore,e,!0),o=new th(e,s.Hi),a=o.Wu(s.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==t.onlineState,r),l=o.applyChanges(a,t.isPrimaryClient,c);mh(t,n,l.Xu);const u=new eh(e,n,o);return t.ic.set(e,u),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),l.snapshot}(n,e,i,"current"===s,t.resumeToken)}return r}async function sh(t,e){const n=Ds(t),i=n.ic.get(e),r=n.rc.get(i.targetId);if(r.length>1)return n.rc.set(i.targetId,r.filter((t=>!Da(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(i.targetId),n.sharedClientState.isActiveQueryTarget(i.targetId)||await Gl(n.localStore,i.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(i.targetId),gu(n.remoteStore,i.targetId),ph(n,i.targetId)})).catch(co)):(ph(n,i.targetId),await Gl(n.localStore,i.targetId,!0))}async function oh(t,e,n){const i=function(t){const e=Ds(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=uh.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hh.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ds(t),i=Ys.now(),r=e.reduce(((t,e)=>t.add(e.key)),xc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=_c(),c=xc();return n.Gi.getEntries(t,r).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((r=>{s=r;const o=[];for(const t of e){const e=cc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ya(e.value.mapValue),nc.exists(!0)))}return n.mutationQueue.addMutationBatch(t,i,o,e)})).next((e=>{o=e;const i=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,i)}))})).then((()=>({batchId:o.batchId,changes:kc(s)})))}(i.localStore,e);i.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let i=t.hc[t.currentUser.toKey()];i||(i=new ua(Gs)),i=i.insert(e,n),t.hc[t.currentUser.toKey()]=i}(i,t.batchId,n),await wh(i,t.changes),await Cu(i.remoteStore)}catch(t){const e=Bu(t,"Failed to persist write");n.reject(e)}}async function ah(t,e){const n=Ds(t);try{const t=await Kl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const i=n.cc.get(e);i&&(Os(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?i.nc=!0:t.modifiedDocuments.size>0?Os(i.nc):t.removedDocuments.size>0&&(Os(i.nc),i.nc=!1))})),await wh(n,t,e)}catch(t){await co(t)}}function ch(t,e,n){const i=Ds(t);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const t=[];i.ic.forEach(((n,i)=>{const r=i.view.bu(e);r.snapshot&&t.push(r.snapshot)})),function(t,e){const n=Ds(t);n.onlineState=e;let i=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(i=!0)})),i&&Yu(n)}(i.eventManager,e),t.length&&i.sc.Wo(t),i.onlineState=e,i.isPrimaryClient&&i.sharedClientState.setOnlineState(e)}}async function lh(t,e,n){const i=Ds(t);i.sharedClientState.updateQueryState(e,"rejected",n);const r=i.cc.get(e),s=r&&r.key;if(s){let t=new ua(no.comparator);t=t.insert(s,va.newNoDocument(s,Js.min()));const n=xc().add(s),r=new Pc(Js.min(),new Map,new fa(Gs),t,n);await ah(i,r),i.uc=i.uc.remove(s),i.cc.delete(e),vh(i)}else await Gl(i.localStore,e,!1).then((()=>ph(i,e,n))).catch(co)}async function uh(t,e){const n=Ds(t),i=e.batch.batchId;try{const t=await function(t,e){const n=Ds(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const i=e.batch.keys(),r=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,i){const r=n.batch,s=r.keys();let o=lo.resolve();return s.forEach((t=>{o=o.next((()=>i.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Os(null!==s),e.version.compareTo(s)<0&&(r.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),i.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,r)))}(n,t,e,r).next((()=>r.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,i,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=xc();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,i)))}))}(n.localStore,e);fh(n,i,null),dh(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await wh(n,t)}catch(t){await co(t)}}async function hh(t,e,n){const i=Ds(t);try{const t=await function(t,e){const n=Ds(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let i;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Os(null!==e),i=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,i,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,i))).next((()=>n.localDocuments.getDocuments(t,i)))}))}(i.localStore,e);fh(i,e,n),dh(i,e),i.sharedClientState.updateMutationState(e,"rejected",n),await wh(i,t)}catch(n){await co(n)}}function dh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function fh(t,e,n){const i=Ds(t);let r=i.hc[i.currentUser.toKey()];if(r){const t=r.get(e);t&&(n?t.reject(n):t.resolve(),r=r.remove(e)),i.hc[i.currentUser.toKey()]=r}}function ph(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const i of t.rc.get(e))t.ic.delete(i),n&&t.sc.wc(i,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||gh(t,e)}))}function gh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(gu(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),vh(t))}function mh(t,e,n){for(const i of n)i instanceof Xu?(t.ac.addReference(i.key,e),yh(t,i)):i instanceof Zu?(As("SyncEngine","Document no longer in limbo: "+i.key),t.ac.removeReference(i.key,e),t.ac.containsKey(i.key)||gh(t,i.key)):xs()}function yh(t,e){const n=e.key,i=n.path.canonicalString();t.uc.get(n)||t.oc.has(i)||(As("SyncEngine","New document in limbo: "+n),t.oc.add(i),vh(t))}function vh(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 no(Zs.fromString(e)),i=t.fc.next();t.cc.set(i,new nh(n)),t.uc=t.uc.insert(n,i),pu(t.remoteStore,new Sl(Na(Ta(n.path)),i,2,ho.at))}}async function wh(t,e,n){const i=Ds(t),r=[],s=[],o=[];i.ic.isEmpty()||(i.ic.forEach(((t,a)=>{o.push(i._c(a,e,n).then((t=>{if((t||n)&&i.isPrimaryClient&&i.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){r.push(t);const e=Vl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),i.sc.Wo(r),await async function(t,e){const n=Ds(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>lo.forEach(e,(e=>lo.forEach(e.Si,(i=>n.persistence.referenceDelegate.addReference(t,e.targetId,i))).next((()=>lo.forEach(e.Di,(i=>n.persistence.referenceDelegate.removeReference(t,e.targetId,i)))))))))}catch(t){if(!uo(t))throw t;As("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),i=t.snapshotVersion,r=t.withLastLimboFreeSnapshotVersion(i);n.qi=n.qi.insert(e,r)}}}(i.localStore,s))}async function bh(t,e){const n=Ds(t);if(!n.currentUser.isEqual(e)){As("SyncEngine","User change. New user:",e.toKey());const t=await ql(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Ms(Ps.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await wh(n,t.ji)}}function Sh(t,e){const n=Ds(t),i=n.cc.get(e);if(i&&i.nc)return xc().add(i.key);{let t=xc();const i=n.rc.get(e);if(!i)return t;for(const e of i){const i=n.ic.get(e);t=t.unionWith(i.view.ju)}return t}}class Eh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=ru(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,i){return new jl(t,e,n,i)}(this.persistence,new Hl,t.initialUser,this.yt)}yc(t){return new Ul(Bl.Bs,this.yt)}gc(t){return new Jl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class _h{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=>ch(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=bh.bind(null,this.syncEngine),await async function(t,e){const n=Ds(t);e?(n._u.delete(2),await du(n)):e||(n._u.add(2),await fu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new $u}createDatastore(t){const e=ru(t.databaseInfo.databaseId),n=(i=t.databaseInfo,new nu(i));var i;return function(t,e,n,i){return new lu(t,e,n,i)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,i=t.asyncQueue,r=t=>ch(this.syncEngine,t,0),s=Zl.C()?new Zl:new Xl,new hu(e,n,i,r,s);var e,n,i,r,s}createSyncEngine(t,e){return function(t,e,n,i,r,s,o){const a=new ih(t,e,n,i,r,s);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=Ds(t);As("RemoteStore","RemoteStore shutting down."),e._u.add(5),await fu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1785
|
+
*/class Ba{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class ja{constructor(){this.queries=Ha(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=xt(e),i=n.queries;n.queries=Ha(),i.forEach((e,n)=>{for(const e of n.wa)e.onError(t)})}(this,new Ot(Nt.ABORTED,"Firestore shutting down"))}}function Ha(){return new cr(e=>ir(e),nr)}async function $a(e,t){const n=xt(e);let i=3;const r=t.query;let s=n.queries.get(r);s?!s.Sa()&&t.ba()&&(i=2):(s=new Ba,i=t.ba()?0:1);try{switch(i){case 0:s.ya=await n.onListen(r,!0);break;case 1:s.ya=await n.onListen(r,!1);break;case 2:await n.onFirstRemoteStoreListen(r)}}catch(e){const n=Fa(e,`Initialization of query '${rr(t.query)}' failed`);return void t.onError(n)}n.queries.set(r,s),s.wa.push(t),t.va(n.onlineState),s.ya&&t.Ca(s.ya)&&Wa(n)}async function qa(e,t){const n=xt(e),i=t.query;let r=3;const s=n.queries.get(i);if(s){const e=s.wa.indexOf(t);e>=0&&(s.wa.splice(e,1),0===s.wa.length?r=t.ba()?0:1:!s.Sa()&&t.ba()&&(r=2))}switch(r){case 0:return n.queries.delete(i),n.onUnlisten(i,!0);case 1:return n.queries.delete(i),n.onUnlisten(i,!1);case 2:return n.onLastRemoteStoreUnlisten(i);default:return}}function Ga(e,t){const n=xt(e);let i=!1;for(const e of t){const t=e.query,r=n.queries.get(t);if(r){for(const t of r.wa)t.Ca(e)&&(i=!0);r.ya=e}}i&&Wa(n)}function Ka(e,t,n){const i=xt(e),r=i.queries.get(t);if(r)for(const e of r.wa)e.onError(n);i.queries.delete(t)}function Wa(e){e.Da.forEach(e=>{e.next()})}var Qa,Ja;(Ja=Qa||(Qa={})).Fa="default",Ja.Cache="cache";class Ya{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!==Qa.Cache}}
|
|
1686
1786
|
/**
|
|
1687
1787
|
* @license
|
|
1688
1788
|
* Copyright 2017 Google LLC
|
|
@@ -1698,7 +1798,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1698
1798
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1699
1799
|
* See the License for the specific language governing permissions and
|
|
1700
1800
|
* limitations under the License.
|
|
1701
|
-
*/
|
|
1801
|
+
*/class Xa{constructor(e){this.key=e}}class Za{constructor(e){this.key=e}}class ec{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=wr(),this.mutatedKeys=wr(),this.Xa=or(e),this.eu=new za(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new Ua,i=t?t.eu:this.eu;let r=t?t.mutatedKeys:this.mutatedKeys,s=i,o=!1;const a="F"===this.query.limitType&&i.size===this.query.limit?i.last():null,c="L"===this.query.limitType&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((e,t)=>{const l=i.get(e),u=sr(this.query,t)?t:null,h=!!l&&this.mutatedKeys.has(l.key),d=!!u&&(u.hasLocalMutations||this.mutatedKeys.has(u.key)&&u.hasCommittedMutations);let f=!1;l&&u?l.data.isEqual(u.data)?h!==d&&(n.track({type:3,doc:u}),f=!0):this.iu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Xa(u,a)>0||c&&this.Xa(u,c)<0)&&(o=!0)):!l&&u?(n.track({type:0,doc:u}),f=!0):l&&!u&&(n.track({type:1,doc:l}),f=!0,(a||c)&&(o=!0)),f&&(u?(s=s.add(u),r=d?r.add(e):r.delete(e)):(s=s.delete(e),r=r.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){const e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),r=r.delete(e.key),n.track({type:1,doc:e})}return{eu:s,ru:n,Ds:o,mutatedKeys:r}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,i){const r=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const s=e.ru.pa();s.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return kt(20277,{At:e})}};return n(e)-n(t)}
|
|
1702
1802
|
/**
|
|
1703
1803
|
* @license
|
|
1704
1804
|
* Copyright 2020 Google LLC
|
|
@@ -1714,7 +1814,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1714
1814
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1715
1815
|
* See the License for the specific language governing permissions and
|
|
1716
1816
|
* limitations under the License.
|
|
1717
|
-
*/const Rh=new Map;class Lh{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Ms(Ps.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 Ms(Ps.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,i){if(!0===e&&!0===i)throw new Ms(Ps.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}}
|
|
1817
|
+
*/(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),i=null!=i&&i;const o=t&&!i?this.ou():[],a=0===this.Za.size&&this.current&&!i?1:0,c=a!==this.Ya;return this.Ya=a,0!==s.length||c?{snapshot:new Va(this.query,e.eu,r,s,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 Ua,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=wr(),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 Za(e))}),this.Za.forEach(n=>{e.has(n)||t.push(new Xa(n))}),t}uu(e){this.Ha=e.qs,this.Za=wr();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 tc="SyncEngine";class nc{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class ic{constructor(e){this.key=e,this.lu=!1}}class rc{constructor(e,t,n,i,r,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=i,this.currentUser=r,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new cr(e=>ir(e),nr),this.Tu=new Map,this.Iu=new Set,this.du=new xn(tn.comparator),this.Eu=new Map,this.Au=new mo,this.Ru={},this.Vu=new Map,this.mu=io.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function sc(e,t,n=!0){const i=Cc(e);let r;const s=i.Pu.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.cu()):r=await ac(i,t,n,!0),r}async function oc(e,t){const n=Cc(e);await ac(n,t,!0,!1)}async function ac(e,t,n,i){const r=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let i;return n.hi.getTargetData(e,t).next(r=>r?(i=r,bn.resolve(i)):n.hi.allocateTargetId(e).next(r=>(i=new Qs(t,r,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,i).next(()=>i))))}).then(e=>{const i=n.Fs.get(e.targetId);return(null===i||e.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e})}(e.localStore,Zi(t)),s=r.targetId,o=e.sharedClientState.addLocalQueryTarget(s,n);let a;return i&&(a=await async function(e,t,n,i,r){e.gu=(t,n,i)=>async function(e,t,n,i){let r=t.view.nu(n);r.Ds&&(r=await Mo(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,r)));const s=i&&i.targetChanges.get(t.targetId),o=i&&null!=i.targetMismatches.get(t.targetId),a=t.view.applyChanges(r,e.isPrimaryClient,s,o);return bc(e,t.targetId,a._u),a.snapshot}(e,t,n,i);const s=await Mo(e.localStore,t,!0),o=new ec(t,s.qs),a=o.nu(s.documents),c=hs.createSynthesizedTargetChangeForCurrentChange(n,i&&"Offline"!==e.onlineState,r),l=o.applyChanges(a,e.isPrimaryClient,c);bc(e,n,l._u);const u=new nc(t,n,o);return e.Pu.set(t,u),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),l.snapshot}(e,t,s,"current"===o,r.resumeToken)),e.isPrimaryClient&&n&&ua(e.remoteStore,r),a}async function cc(e,t,n){const i=xt(e),r=i.Pu.get(t),s=i.Tu.get(r.targetId);if(s.length>1)return i.Tu.set(r.targetId,s.filter(e=>!nr(e,t))),void i.Pu.delete(t);i.isPrimaryClient?(i.sharedClientState.removeLocalQueryTarget(r.targetId),i.sharedClientState.isActiveQueryTarget(r.targetId)||await Do(i.localStore,r.targetId,!1).then(()=>{i.sharedClientState.clearQueryState(r.targetId),n&&ha(i.remoteStore,r.targetId),yc(i,r.targetId)}).catch(wn)):(yc(i,r.targetId),await Do(i.localStore,r.targetId,!0))}async function lc(e,t){const n=xt(e),i=n.Pu.get(t),r=n.Tu.get(i.targetId);n.isPrimaryClient&&1===r.length&&(n.sharedClientState.removeLocalQueryTarget(i.targetId),ha(n.remoteStore,i.targetId))}async function uc(e,t,n){const i=function(e){const t=xt(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=pc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=gc.bind(null,t),t}(e);try{const e=await function(e,t){const n=xt(e),i=fn.now(),r=t.reduce((e,t)=>e.add(t.key),wr());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=ur(),c=wr();return n.Os.getEntries(e,r).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(r=>{s=r;const o=[];for(const e of t){const t=Hr(e,s.get(e.key).overlayedDocument);null!=t&&o.push(new Gr(e.key,t,bi(t.value.mapValue),Fr.exists(!0)))}return n.mutationQueue.addMutationBatch(e,i,o,t)}).next(t=>{o=t;const i=t.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,i)})}).then(()=>({batchId:o.batchId,changes:fr(s)}))}(i.localStore,t);i.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let i=e.Ru[e.currentUser.toKey()];i||(i=new xn(qt)),i=i.insert(t,n),e.Ru[e.currentUser.toKey()]=i}(i,e.batchId,n),await Ec(i,e.changes),await Ta(i.remoteStore)}catch(e){const t=Fa(e,"Failed to persist write");n.reject(t)}}async function hc(e,t){const n=xt(e);try{const e=await Lo(n.localStore,t);t.targetChanges.forEach((e,t)=>{const i=n.Eu.get(t);i&&(Rt(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?i.lu=!0:e.modifiedDocuments.size>0?Rt(i.lu,14607):e.removedDocuments.size>0&&(Rt(i.lu,42227),i.lu=!1))}),await Ec(n,e,t)}catch(e){await wn(e)}}function dc(e,t,n){const i=xt(e);if(i.isPrimaryClient&&0===n||!i.isPrimaryClient&&1===n){const e=[];i.Pu.forEach((n,i)=>{const r=i.view.va(t);r.snapshot&&e.push(r.snapshot)}),function(e,t){const n=xt(e);n.onlineState=t;let i=!1;n.queries.forEach((e,n)=>{for(const e of n.wa)e.va(t)&&(i=!0)}),i&&Wa(n)}(i.eventManager,t),e.length&&i.hu.J_(e),i.onlineState=t,i.isPrimaryClient&&i.sharedClientState.setOnlineState(t)}}async function fc(e,t,n){const i=xt(e);i.sharedClientState.updateQueryState(t,"rejected",n);const r=i.Eu.get(t),s=r&&r.key;if(s){let e=new xn(tn.comparator);e=e.insert(s,_i.newNoDocument(s,pn.min()));const n=wr().add(s),r=new us(pn.min(),new Map,new xn(qt),e,n);await hc(i,r),i.du=i.du.remove(s),i.Eu.delete(t),Sc(i)}else await Do(i.localStore,t,!1).then(()=>yc(i,t,n)).catch(wn)}async function pc(e,t){const n=xt(e),i=t.batch.batchId;try{const e=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const i=t.batch.keys(),r=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,i){const r=n.batch,s=r.keys();let o=bn.resolve();return s.forEach(e=>{o=o.next(()=>i.getEntry(t,e)).next(t=>{const s=n.docVersions.get(e);Rt(null!==s,48541),t.version.compareTo(s)<0&&(r.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),i.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,r))}(n,e,t,r).next(()=>r.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=wr();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,i))})}(n.localStore,t);vc(n,i,null),mc(n,i),n.sharedClientState.updateMutationState(i,"acknowledged"),await Ec(n,e)}catch(e){await wn(e)}}async function gc(e,t,n){const i=xt(e);try{const e=await function(e,t){const n=xt(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let i;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(Rt(null!==t,37113),i=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,i,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,i)).next(()=>n.localDocuments.getDocuments(e,i))})}(i.localStore,t);vc(i,t,n),mc(i,t),i.sharedClientState.updateMutationState(t,"rejected",n),await Ec(i,e)}catch(n){await wn(n)}}function mc(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function vc(e,t,n){const i=xt(e);let r=i.Ru[i.currentUser.toKey()];if(r){const e=r.get(t);e&&(n?e.reject(n):e.resolve(),r=r.remove(t)),i.Ru[i.currentUser.toKey()]=r}}function yc(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const i of e.Tu.get(t))e.Pu.delete(i),n&&e.hu.pu(i,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||wc(e,t)})}function wc(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),Sc(e))}function bc(e,t,n){for(const i of n)i instanceof Xa?(e.Au.addReference(i.key,t),_c(e,i)):i instanceof Za?(Et(tc,"Document no longer in limbo: "+i.key),e.Au.removeReference(i.key,t),e.Au.containsKey(i.key)||wc(e,i.key)):kt(19791,{yu:i})}function _c(e,t){const n=t.key,i=n.path.canonicalString();e.du.get(n)||e.Iu.has(i)||(Et(tc,"New document in limbo: "+n),e.Iu.add(i),Sc(e))}function Sc(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 tn(Xt.fromString(t)),i=e.mu.next();e.Eu.set(i,new ic(n)),e.du=e.du.insert(n,i),ua(e.remoteStore,new Qs(Zi(Qi(n.path)),i,"TargetPurposeLimboResolution",Sn.ue))}}async function Ec(e,t,n){const i=xt(e),r=[],s=[],o=[];i.Pu.isEmpty()||(i.Pu.forEach((e,a)=>{o.push(i.gu(a,t,n).then(e=>{var t;if((e||n)&&i.isPrimaryClient){const r=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;i.sharedClientState.updateQueryState(a.targetId,r?"current":"not-current")}if(e){r.push(e);const t=Co.Es(a.targetId,e);s.push(t)}}))}),await Promise.all(o),i.hu.J_(r),await async function(e,t){const n=xt(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>bn.forEach(t,t=>bn.forEach(t.Is,i=>n.persistence.referenceDelegate.addReference(e,t.targetId,i)).next(()=>bn.forEach(t.ds,i=>n.persistence.referenceDelegate.removeReference(e,t.targetId,i)))))}catch(e){if(!_n(e))throw e;Et(Ro,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Fs.get(t),i=e.snapshotVersion,r=e.withLastLimboFreeSnapshotVersion(i);n.Fs=n.Fs.insert(t,r)}}}(i.localStore,s))}async function Tc(e,t){const n=xt(e);if(!n.currentUser.isEqual(t)){Et(tc,"User change. New user:",t.toKey());const e=await No(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new Ot(Nt.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=xt(e),i=n.Eu.get(t);if(i&&i.lu)return wr().add(i.key);{let e=wr();const i=n.Tu.get(t);if(!i)return e;for(const t of i){const i=n.Pu.get(t);e=e.unionWith(i.view.tu)}return e}}function Cc(e){const t=xt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=hc.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ic.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=fc.bind(null,t),t.hu.J_=Ga.bind(null,t.eventManager),t.hu.pu=Ka.bind(null,t.eventManager),t}class kc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Yo(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,i){return new xo(e,t,n,i)}(this.persistence,new Ao,e.initialUser,this.serializer)}Du(e){return new So(To.Vi,this.serializer)}bu(e){return new zo}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()}}kc.provider={build:()=>new kc};class Ac extends kc{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){Rt(this.persistence.referenceDelegate instanceof Io,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new ao(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?no.withCacheSize(this.cacheSizeBytes):no.DEFAULT;return new So(e=>Io.Vi(e,t),this.serializer)}}class Rc{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=>dc(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Tc.bind(null,this.syncEngine),await async function(e,t){const n=xt(e);t?(n.Ia.delete(2),await ca(n)):t||(n.Ia.add(2),await la(n),n.Aa.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new ja}createDatastore(e){const t=Yo(e.databaseInfo.databaseId),n=function(e){return new Qo(e)}(e.databaseInfo);return function(e,t,n,i){return new ra(e,t,n,i)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,i,r){return new aa(e,t,n,i,r)}(this.localStore,this.datastore,e.asyncQueue,e=>dc(this.syncEngine,e,0),Bo.C()?new Bo:new Uo)}createSyncEngine(e,t){return function(e,t,n,i,r,s,o){const a=new rc(e,t,n,i,r,s);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=xt(e);Et(oa,"RemoteStore shutting down."),t.Ia.add(5),await la(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()}}Rc.provider={build:()=>new Rc};
|
|
1718
1818
|
/**
|
|
1719
1819
|
* @license
|
|
1720
1820
|
* Copyright 2020 Google LLC
|
|
@@ -1730,10 +1830,10 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1730
1830
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1731
1831
|
* See the License for the specific language governing permissions and
|
|
1732
1832
|
* limitations under the License.
|
|
1733
|
-
*/
|
|
1833
|
+
*/
|
|
1734
1834
|
/**
|
|
1735
1835
|
* @license
|
|
1736
|
-
* Copyright
|
|
1836
|
+
* Copyright 2017 Google LLC
|
|
1737
1837
|
*
|
|
1738
1838
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1739
1839
|
* you may not use this file except in compliance with the License.
|
|
@@ -1747,7 +1847,7 @@ class Sc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1747
1847
|
* See the License for the specific language governing permissions and
|
|
1748
1848
|
* limitations under the License.
|
|
1749
1849
|
*/
|
|
1750
|
-
|
|
1850
|
+
class xc{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):Tt("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}
|
|
1751
1851
|
/**
|
|
1752
1852
|
* @license
|
|
1753
1853
|
* Copyright 2017 Google LLC
|
|
@@ -1763,10 +1863,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1763
1863
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1764
1864
|
* See the License for the specific language governing permissions and
|
|
1765
1865
|
* limitations under the License.
|
|
1766
|
-
*/(i.
|
|
1866
|
+
*/const Nc="FirestoreClient";class Oc{constructor(e,t,n,i,r){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=i,this.user=wt.UNAUTHENTICATED,this.clientId=$t.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=r,this.authCredentials.start(n,async e=>{Et(Nc,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Et(Nc,"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 Lt;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=Fa(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Lc(e,t){e.asyncQueue.verifyOperationInProgress(),Et(Nc,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let i=n.initialUser;e.setCredentialChangeListener(async e=>{i.isEqual(e)||(await No(t.localStore,e),i=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(Nc,"Using user provided OfflineComponentProvider");try{await Lc(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===Nt.FAILED_PRECONDITION||e.code===Nt.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 Lc(e,new kc)}}else Et(Nc,"Using default OfflineComponentProvider"),await Lc(e,new Ac(void 0));return e._offlineComponents}(e);Et(Nc,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>La(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>La(t.remoteStore,n)),e._onlineComponents=t}async function Dc(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Et(Nc,"Using user provided OnlineComponentProvider"),await Pc(e,e._uninitializedComponentsProvider._online)):(Et(Nc,"Using default OnlineComponentProvider"),await Pc(e,new Rc))),e._onlineComponents}async function Mc(e){const t=await Dc(e),n=t.eventManager;return n.onListen=sc.bind(null,t.syncEngine),n.onUnlisten=cc.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=oc.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=lc.bind(null,t.syncEngine),n}
|
|
1767
1867
|
/**
|
|
1768
1868
|
* @license
|
|
1769
|
-
* Copyright
|
|
1869
|
+
* Copyright 2023 Google LLC
|
|
1770
1870
|
*
|
|
1771
1871
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1772
1872
|
* you may not use this file except in compliance with the License.
|
|
@@ -1779,7 +1879,8 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1779
1879
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1780
1880
|
* See the License for the specific language governing permissions and
|
|
1781
1881
|
* limitations under the License.
|
|
1782
|
-
*/
|
|
1882
|
+
*/
|
|
1883
|
+
function Fc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t
|
|
1783
1884
|
/**
|
|
1784
1885
|
* @license
|
|
1785
1886
|
* Copyright 2020 Google LLC
|
|
@@ -1795,10 +1896,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1795
1896
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1796
1897
|
* See the License for the specific language governing permissions and
|
|
1797
1898
|
* limitations under the License.
|
|
1798
|
-
*/
|
|
1899
|
+
*/}const zc=new Map,Uc="firestore.googleapis.com",Vc=!0;
|
|
1799
1900
|
/**
|
|
1800
1901
|
* @license
|
|
1801
|
-
* Copyright
|
|
1902
|
+
* Copyright 2020 Google LLC
|
|
1802
1903
|
*
|
|
1803
1904
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1804
1905
|
* you may not use this file except in compliance with the License.
|
|
@@ -1811,10 +1912,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1811
1912
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1812
1913
|
* See the License for the specific language governing permissions and
|
|
1813
1914
|
* limitations under the License.
|
|
1814
|
-
*/class
|
|
1915
|
+
*/class Bc{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new Ot(Nt.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Uc,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=to;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Ot(Nt.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,i){if(!0===t&&!0===i)throw new Ot(Nt.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=Fc(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Ot(Nt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}
|
|
1815
1916
|
/**
|
|
1816
1917
|
* @license
|
|
1817
|
-
* Copyright
|
|
1918
|
+
* Copyright 2020 Google LLC
|
|
1818
1919
|
*
|
|
1819
1920
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1820
1921
|
* you may not use this file except in compliance with the License.
|
|
@@ -1827,10 +1928,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1827
1928
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1828
1929
|
* See the License for the specific language governing permissions and
|
|
1829
1930
|
* limitations under the License.
|
|
1830
|
-
*/
|
|
1931
|
+
*/(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 jc{constructor(e,t,n,i){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Bc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Ot(Nt.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 Ot(Nt.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 Bc(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Dt;switch(e.type){case"firstParty":return new Ut(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Ot(Nt.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=zc.get(e);t&&(Et("ComponentProvider","Removing Datastore"),zc.delete(e),t.terminate())}(this),Promise.resolve()}}function Hc(e,t,n,i={}){var r;e=cn(e,jc);const s=p(t),a=e._getSettings(),c=Object.assign(Object.assign({},a),{emulatorOptions:e._getEmulatorOptions()}),l=`${t}:${n}`;s&&(g(`https://${l}`),y("Firestore",!0)),a.host!==Uc&&a.host!==l&&It("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u=Object.assign(Object.assign({},a),{host:l,ssl:s,emulatorOptions:i});if(!T(u,c)&&(e._setSettings(u),i.mockUserToken)){let t,n;if("string"==typeof i.mockUserToken)t=i.mockUserToken,n=wt.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",i=e.iat||0,r=e.sub||e.user_id;if(!r)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:i,exp:i+3600,auth_time:i,sub:r,user_id:r,firebase:{sign_in_provider:"custom",identities:{}}},e);return[o(JSON.stringify({alg:"none",type:"JWT"})),o(JSON.stringify(s)),""].join(".")}(i.mockUserToken,null===(r=e._app)||void 0===r?void 0:r.options.projectId);const s=i.mockUserToken.sub||i.mockUserToken.user_id;if(!s)throw new Ot(Nt.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new wt(s)}e._authCredentials=new Mt(new Pt(t,n))}}
|
|
1831
1932
|
/**
|
|
1832
1933
|
* @license
|
|
1833
|
-
* Copyright
|
|
1934
|
+
* Copyright 2020 Google LLC
|
|
1834
1935
|
*
|
|
1835
1936
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1836
1937
|
* you may not use this file except in compliance with the License.
|
|
@@ -1843,7 +1944,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1843
1944
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1844
1945
|
* See the License for the specific language governing permissions and
|
|
1845
1946
|
* limitations under the License.
|
|
1846
|
-
*/(t)
|
|
1947
|
+
*/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 qc{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 Gc(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new qc(this.firestore,e,this._key)}toJSON(){return{type:qc._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(un(t,qc._jsonSchema))return new qc(e,n||null,new tn(Xt.fromString(t.referencePath)))}}qc._jsonSchemaVersion="firestore/documentReference/1.0",qc._jsonSchema={type:ln("string",qc._jsonSchemaVersion),referencePath:ln("string")};class Gc extends $c{constructor(e,t,n){super(e,t,Qi(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 qc(this.firestore,null,new tn(e))}withConverter(e){return new Gc(this.firestore,e,this._path)}}function Kc(e,t,...n){if(e=N(e),nn("collection","path",t),e instanceof jc){const i=Xt.fromString(t,...n);return sn(i),new Gc(e,null,i)}{if(!(e instanceof qc||e instanceof Gc))throw new Ot(Nt.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=e._path.child(Xt.fromString(t,...n));return sn(i),new Gc(e.firestore,null,i)}}function Wc(e,t,...n){if(e=N(e),1===arguments.length&&(t=$t.newId()),nn("doc","path",t),e instanceof jc){const i=Xt.fromString(t,...n);return rn(i),new qc(e,null,new tn(i))}{if(!(e instanceof qc||e instanceof Gc))throw new Ot(Nt.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const i=e._path.child(Xt.fromString(t,...n));return rn(i),new qc(e.firestore,e instanceof Gc?e.converter:null,new tn(i))}}
|
|
1847
1948
|
/**
|
|
1848
1949
|
* @license
|
|
1849
1950
|
* Copyright 2020 Google LLC
|
|
@@ -1859,10 +1960,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1859
1960
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1860
1961
|
* See the License for the specific language governing permissions and
|
|
1861
1962
|
* limitations under the License.
|
|
1862
|
-
*/
|
|
1963
|
+
*/const Qc="AsyncQueue";class Jc{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 Xo(this,"async_queue_retry"),this.oc=()=>{const e=Jo();e&&Et(Qc,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this._c=e;const t=Jo();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=Jo();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});const t=new Lt;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(!_n(e))throw e;Et(Qc,"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,Tt("INTERNAL UNHANDLED ERROR: ",Yc(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 i=Ma.createAndSchedule(this,e,t,n,e=>this.lc(e));return this.ec.push(i),i}ac(){this.tc&&kt(47125,{hc:Yc(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 Yc(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t
|
|
1863
1964
|
/**
|
|
1864
1965
|
* @license
|
|
1865
|
-
* Copyright
|
|
1966
|
+
* Copyright 2017 Google LLC
|
|
1866
1967
|
*
|
|
1867
1968
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1868
1969
|
* you may not use this file except in compliance with the License.
|
|
@@ -1875,7 +1976,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1875
1976
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1876
1977
|
* See the License for the specific language governing permissions and
|
|
1877
1978
|
* limitations under the License.
|
|
1878
|
-
*/(t
|
|
1979
|
+
*/}function Xc(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}
|
|
1879
1980
|
/**
|
|
1880
1981
|
* @license
|
|
1881
1982
|
* Copyright 2020 Google LLC
|
|
@@ -1891,7 +1992,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1891
1992
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1892
1993
|
* See the License for the specific language governing permissions and
|
|
1893
1994
|
* limitations under the License.
|
|
1894
|
-
*/
|
|
1995
|
+
*/(e,["next","error","complete"])}class Zc extends jc{constructor(e,t,n,i){super(e,t,n,i),this.type="firestore",this._queue=new Jc,this._persistenceKey=(null==i?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Jc(e),this._firestoreClient=void 0,await e}}}function el(e,t){const n="object"==typeof e?e:Ke(),i="string"==typeof e?e:Jn,r=Be(n,"firestore").getImmediate({identifier:i});if(!r._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 i=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),i]:[t.substring(0,n),i]})("firestore");e&&Hc(r,...e)}return r}function tl(e){if(e._terminated)throw new Ot(Nt.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,i;const r=e._freezeSettings(),s=function(e,t,n,i){return new Qn(e,t,n,i.host,i.ssl,i.experimentalForceLongPolling,i.experimentalAutoDetectLongPolling,Fc(i.experimentalLongPollingOptions),i.useFetchStreams,i.isUsingEmulator)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,r);e._componentsProvider||(null===(n=r.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(i=r.localCache)||void 0===i?void 0:i._onlineComponentProvider)&&(e._componentsProvider={_offline:r.localCache._offlineComponentProvider,_online:r.localCache._onlineComponentProvider}),e._firestoreClient=new Oc(e._authCredentials,e._appCheckCredentials,e._queue,s,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))}
|
|
1895
1996
|
/**
|
|
1896
1997
|
* @license
|
|
1897
1998
|
* Copyright 2020 Google LLC
|
|
@@ -1907,7 +2008,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1907
2008
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1908
2009
|
* See the License for the specific language governing permissions and
|
|
1909
2010
|
* limitations under the License.
|
|
1910
|
-
*/class
|
|
2011
|
+
*/(e),e._firestoreClient}class nl{constructor(e){this._byteString=e}static fromBase64String(e){try{return new nl(Fn.fromBase64String(e))}catch(e){throw new Ot(Nt.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new nl(Fn.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:nl._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(un(e,nl._jsonSchema))return nl.fromBase64String(e.bytes)}}nl._jsonSchemaVersion="firestore/bytes/1.0",nl._jsonSchema={type:ln("string",nl._jsonSchemaVersion),bytes:ln("string")};
|
|
1911
2012
|
/**
|
|
1912
2013
|
* @license
|
|
1913
2014
|
* Copyright 2020 Google LLC
|
|
@@ -1923,7 +2024,8 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1923
2024
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1924
2025
|
* See the License for the specific language governing permissions and
|
|
1925
2026
|
* limitations under the License.
|
|
1926
|
-
*/
|
|
2027
|
+
*/
|
|
2028
|
+
class il{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new Ot(Nt.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new en(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function rl(){return new il(Jt)}
|
|
1927
2029
|
/**
|
|
1928
2030
|
* @license
|
|
1929
2031
|
* Copyright 2020 Google LLC
|
|
@@ -1939,7 +2041,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1939
2041
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1940
2042
|
* See the License for the specific language governing permissions and
|
|
1941
2043
|
* limitations under the License.
|
|
1942
|
-
*/class
|
|
2044
|
+
*/class sl{constructor(e){this._methodName=e}}
|
|
1943
2045
|
/**
|
|
1944
2046
|
* @license
|
|
1945
2047
|
* Copyright 2017 Google LLC
|
|
@@ -1955,10 +2057,10 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1955
2057
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1956
2058
|
* See the License for the specific language governing permissions and
|
|
1957
2059
|
* limitations under the License.
|
|
1958
|
-
*/class
|
|
2060
|
+
*/class ol{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new Ot(Nt.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new Ot(Nt.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 qt(this._lat,e._lat)||qt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:ol._jsonSchemaVersion}}static fromJSON(e){if(un(e,ol._jsonSchema))return new ol(e.latitude,e.longitude)}}ol._jsonSchemaVersion="firestore/geoPoint/1.0",ol._jsonSchema={type:ln("string",ol._jsonSchemaVersion),latitude:ln("number"),longitude:ln("number")};
|
|
1959
2061
|
/**
|
|
1960
2062
|
* @license
|
|
1961
|
-
* Copyright
|
|
2063
|
+
* Copyright 2024 Google LLC
|
|
1962
2064
|
*
|
|
1963
2065
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1964
2066
|
* you may not use this file except in compliance with the License.
|
|
@@ -1971,10 +2073,11 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1971
2073
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1972
2074
|
* See the License for the specific language governing permissions and
|
|
1973
2075
|
* limitations under the License.
|
|
1974
|
-
*/
|
|
2076
|
+
*/
|
|
2077
|
+
class al{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:al._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(un(e,al._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new al(e.vectorValues);throw new Ot(Nt.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}al._jsonSchemaVersion="firestore/vectorValue/1.0",al._jsonSchema={type:ln("string",al._jsonSchemaVersion),vectorValues:ln("object")};
|
|
1975
2078
|
/**
|
|
1976
2079
|
* @license
|
|
1977
|
-
* Copyright
|
|
2080
|
+
* Copyright 2017 Google LLC
|
|
1978
2081
|
*
|
|
1979
2082
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1980
2083
|
* you may not use this file except in compliance with the License.
|
|
@@ -1987,7 +2090,8 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
1987
2090
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1988
2091
|
* See the License for the specific language governing permissions and
|
|
1989
2092
|
* limitations under the License.
|
|
1990
|
-
*/
|
|
2093
|
+
*/
|
|
2094
|
+
const cl=/^__.*__$/;class ll{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new Gr(e,this.data,this.fieldMask,t,this.fieldTransforms):new qr(e,this.data,t,this.fieldTransforms)}}function ul(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw kt(40011,{Ec:e})}}class hl{constructor(e,t,n,i,r,s){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=i,void 0===r&&this.Ac(),this.fieldTransforms=r||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new hl(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),i=this.Rc({path:n,mc:!1});return i.fc(e),i}gc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),i=this.Rc({path:n,mc:!1});return i.Ac(),i}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Sl(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(ul(this.Ec)&&cl.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class dl{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Yo(e)}Dc(e,t,n,i=!1){return new hl({Ec:e,methodName:t,bc:n,path:en.emptyPath(),mc:!1,Sc:i},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function fl(e){const t=e._freezeSettings(),n=Yo(e._databaseId);return new dl(e._databaseId,!!t.ignoreUndefinedProperties,n)}function pl(e,t,n,i,r,s={}){const o=e.Dc(s.merge||s.mergeFields?2:0,t,n,r);yl("Data must be an object, but it was:",o,i);const a=ml(i,o);let c,l;if(s.merge)c=new Dn(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const e=[];for(const i of s.mergeFields){const r=wl(t,i,n);if(!o.contains(r))throw new Ot(Nt.INVALID_ARGUMENT,`Field '${r}' is specified in your field mask but missing from your input data.`);El(e,r)||e.push(r)}c=new Dn(e),l=o.fieldTransforms.filter(e=>c.covers(e.field))}else c=null,l=o.fieldTransforms;return new ll(new wi(a),c,l)}function gl(e,t){if(vl(e=N(e)))return yl("Unsupported field value:",t,e),ml(e,t);if(e instanceof sl)return function(e,t){if(!ul(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 i=0;for(const r of e){let e=gl(r,t.yc(i));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),i++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=N(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Er(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=fn.fromDate(e);return{timestampValue:Ts(t.serializer,n)}}if(e instanceof fn){const n=new fn(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Ts(t.serializer,n)}}if(e instanceof ol)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof nl)return{bytesValue:Is(t.serializer,e._byteString)};if(e instanceof qc){const n=t.databaseId,i=e.firestore._databaseId;if(!i.isEqual(n))throw t.wc(`Document reference is for database ${i.projectId}/${i.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:As(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof al)return function(e,t){return{mapValue:{fields:{[Xn]:{stringValue:ti},[ni]:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.wc("VectorValues must only contain numeric values.");return _r(t.serializer,e)})}}}}}}(e,t);throw t.wc(`Unsupported field value: ${an(e)}`)}(e,t)}function ml(e,t){const n={};return Rn(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):An(e,(e,i)=>{const r=gl(i,t.Vc(e));null!=r&&(n[e]=r)}),{mapValue:{fields:n}}}function vl(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof fn||e instanceof ol||e instanceof nl||e instanceof qc||e instanceof sl||e instanceof al)}function yl(e,t,n){if(!vl(n)||!on(n)){const i=an(n);throw"an object"===i?t.wc(e+" a custom object"):t.wc(e+" "+i)}}function wl(e,t,n){if((t=N(t))instanceof il)return t._internalPath;if("string"==typeof t)return _l(e,t);throw Sl("Field path arguments must be of type string or ",e,!1,void 0,n)}const bl=new RegExp("[~\\*/\\[\\]]");function _l(e,t,n){if(t.search(bl)>=0)throw Sl(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new il(...t.split("."))._internalPath}catch(i){throw Sl(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function Sl(e,t,n,i,r){const s=i&&!i.isEmpty(),o=void 0!==r;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${i}`),o&&(c+=` in document ${r}`),c+=")"),new Ot(Nt.INVALID_ARGUMENT,a+e+c)}function El(e,t){return e.some(e=>e.isEqual(t))}
|
|
1991
2095
|
/**
|
|
1992
2096
|
* @license
|
|
1993
2097
|
* Copyright 2020 Google LLC
|
|
@@ -2003,7 +2107,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
2003
2107
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2004
2108
|
* See the License for the specific language governing permissions and
|
|
2005
2109
|
* limitations under the License.
|
|
2006
|
-
*/
|
|
2110
|
+
*/class Tl{constructor(e,t,n,i,r){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=i,this._converter=r}get id(){return this._key.path.lastSegment()}get ref(){return new qc(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const e=new Il(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(Cl("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class Il extends Tl{data(){return super.data()}}function Cl(e,t){return"string"==typeof t?_l(e,t):t instanceof il?t._internalPath:t._delegate._internalPath}
|
|
2007
2111
|
/**
|
|
2008
2112
|
* @license
|
|
2009
2113
|
* Copyright 2020 Google LLC
|
|
@@ -2019,7 +2123,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
2019
2123
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2020
2124
|
* See the License for the specific language governing permissions and
|
|
2021
2125
|
* limitations under the License.
|
|
2022
|
-
*/
|
|
2126
|
+
*/function kl(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new Ot(Nt.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Al{}class Rl extends Al{}function xl(e,t,...n){let i=[];t instanceof Al&&i.push(t),i=i.concat(n),function(e){const t=e.filter(e=>e instanceof Ll).length,n=e.filter(e=>e instanceof Nl).length;if(t>1||t>0&&n>0)throw new Ot(Nt.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(...)))`.")}
|
|
2023
2127
|
/**
|
|
2024
2128
|
* @license
|
|
2025
2129
|
* Copyright 2020 Google LLC
|
|
@@ -2035,7 +2139,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
2035
2139
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2036
2140
|
* See the License for the specific language governing permissions and
|
|
2037
2141
|
* limitations under the License.
|
|
2038
|
-
*/
|
|
2142
|
+
*/(i);for(const t of i)e=t._apply(e);return e}class Nl extends Rl{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Nl(e,t,n)}_apply(e){const t=this._parse(e);return Ml(e._query,t),new $c(e.firestore,e.converter,er(e._query,t))}_parse(e){const t=fl(e.firestore),n=function(e,t,n,i,r,s,o){let a;if(r.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Dl(o,s);const t=[];for(const n of o)t.push(Pl(i,e,n));a={arrayValue:{values:t}}}else a=Pl(i,e,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Dl(o,s),a=function(e,t,n,i=!1){return gl(n,e.Dc(i?4:3,t))}(n,t,o,"in"===s||"not-in"===s);return Ai.create(r,s,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Ol(e,t,n){const i=t,r=Cl("where",e);return Nl._create(r,i,n)}class Ll extends Al{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Ll(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]:Ri.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const i=t.getFlattenedFilters();for(const e of i)Ml(n,e),n=er(n,e)}(e._query,t),new $c(e.firestore,e.converter,er(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Pl(e,t,n){if("string"==typeof(n=N(n))){if(""===n)throw new Ot(Nt.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Yi(t)&&-1!==n.indexOf("/"))throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const i=t.path.child(Xt.fromString(n));if(!tn.isDocumentKey(i))throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${i}' is not because it has an odd number of segments (${i.length}).`);return di(e,new tn(i))}if(n instanceof qc)return di(e,n._key);throw new Ot(Nt.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${an(n)}.`)}function Dl(e,t){if(!Array.isArray(e)||0===e.length)throw new Ot(Nt.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Ml(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 Ot(Nt.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Ot(Nt.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class Fl{convertValue(e,t="none"){switch(ii(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(Bn(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 kt(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return An(e,(e,i)=>{n[e]=this.convertValue(i,t)}),n}convertVectorValue(e){var t,n,i;const r=null===(i=null===(n=null===(t=e.fields)||void 0===t?void 0:t[ni].arrayValue)||void 0===n?void 0:n.values)||void 0===i?void 0:i.map(e=>Vn(e.doubleValue));return new al(r)}convertGeoPoint(e){return new ol(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=Kn(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Wn(e));default:return null}}convertTimestamp(e){const t=Un(e);return new fn(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=Xt.fromString(e);Rt(Ws(n),9688,{name:e});const i=new Yn(n.get(1),n.get(3)),r=new tn(n.popFirst(5));return i.isEqual(t)||Tt(`Document ${r} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),r}}
|
|
2039
2143
|
/**
|
|
2040
2144
|
* @license
|
|
2041
2145
|
* Copyright 2020 Google LLC
|
|
@@ -2051,8 +2155,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
|
|
|
2051
2155
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2052
2156
|
* See the License for the specific language governing permissions and
|
|
2053
2157
|
* limitations under the License.
|
|
2054
|
-
*/
|
|
2055
|
-
class Rd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Ld extends gd{constructor(t,e,n,i,r,s){super(t,e,n,i,s),this._firestore=t,this._firestoreImpl=t,this.metadata=r}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Nd(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(yd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Nd extends Ld{data(t={}){return super.data(t)}}class xd{constructor(t,e,n,i){this._firestore=t,this._userDataWriter=e,this._snapshot=i,this.metadata=new Rd(i.hasPendingWrites,i.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 Nd(this._firestore,this._userDataWriter,n.key,n,new Rd(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 Ms(Ps.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 i=new Nd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Rd(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const i=new Nd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Rd(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let r=-1,s=-1;return 0!==e.type&&(r=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),s=n.indexOf(e.doc.key)),{type:Od(e.type),doc:i,oldIndex:r,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Od(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return xs()}}
|
|
2158
|
+
*/class zl{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Ul extends Tl{constructor(e,t,n,i,r,s){super(e,t,n,i,s),this._firestore=e,this._firestoreImpl=e,this.metadata=r}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vl(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(Cl("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Nt.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=Ul._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}}Ul._jsonSchemaVersion="firestore/documentSnapshot/1.0",Ul._jsonSchema={type:ln("string",Ul._jsonSchemaVersion),bundleSource:ln("string","DocumentSnapshot"),bundleName:ln("string"),bundle:ln("string")};class Vl extends Ul{data(e={}){return super.data(e)}}class Bl{constructor(e,t,n,i){this._firestore=e,this._userDataWriter=t,this._snapshot=i,this.metadata=new zl(i.hasPendingWrites,i.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 Vl(this._firestore,this._userDataWriter,n.key,n,new zl(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 Ot(Nt.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 i=new Vl(e._firestore,e._userDataWriter,n.doc.key,n.doc,new zl(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:i,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const i=new Vl(e._firestore,e._userDataWriter,t.doc.key,t.doc,new zl(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let r=-1,s=-1;return 0!==t.type&&(r=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),s=n.indexOf(t.doc.key)),{type:jl(t.type),doc:i,oldIndex:r,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Nt.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=Bl._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=$t.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],i=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),i.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function jl(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return kt(61501,{type:e})}}
|
|
2056
2159
|
/**
|
|
2057
2160
|
* @license
|
|
2058
2161
|
* Copyright 2020 Google LLC
|
|
@@ -2068,7 +2171,7 @@ class Rd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2068
2171
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2069
2172
|
* See the License for the specific language governing permissions and
|
|
2070
2173
|
* limitations under the License.
|
|
2071
|
-
*/function
|
|
2174
|
+
*/function Hl(e){e=cn(e,qc);const t=cn(e.firestore,Zc);return function(e,t,n={}){const i=new Lt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,i,r){const s=new xc({next:a=>{s.Ou(),t.enqueueAndForget(()=>qa(e,o));const c=a.docs.has(n);!c&&a.fromCache?r.reject(new Ot(Nt.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&a.fromCache&&i&&"server"===i.source?r.reject(new Ot(Nt.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.)')):r.resolve(a)},error:e=>r.reject(e)}),o=new Ya(Qi(n.path),s,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,i)),i.promise}(tl(t),e._key).then(n=>Wl(t,e,n))}Bl._jsonSchemaVersion="firestore/querySnapshot/1.0",Bl._jsonSchema={type:ln("string",Bl._jsonSchemaVersion),bundleSource:ln("string","QuerySnapshot"),bundleName:ln("string"),bundle:ln("string")};class $l extends Fl{constructor(e){super(),this.firestore=e}convertBytes(e){return new nl(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new qc(this.firestore,null,t)}}function ql(e){e=cn(e,$c);const t=cn(e.firestore,Zc),n=tl(t),i=new $l(t);return kl(e._query),function(e,t,n={}){const i=new Lt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,i,r){const s=new xc({next:n=>{s.Ou(),t.enqueueAndForget(()=>qa(e,o)),n.fromCache&&"server"===i.source?r.reject(new Ot(Nt.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.)')):r.resolve(n)},error:e=>r.reject(e)}),o=new Ya(n,s,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,i)),i.promise}(n,e._query).then(n=>new Bl(t,i,e,n))}function Gl(e,t,n){e=cn(e,qc);const i=cn(e.firestore,Zc),r=function(e,t,n){let i;return i=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,i}(e.converter,t,n);return function(e,t){return function(e,t){const n=new Lt;return e.asyncQueue.enqueueAndForget(async()=>uc(await function(e){return Dc(e).then(e=>e.syncEngine)}(e),t,n)),n.promise}(tl(e),t)}(i,[pl(fl(i),"setDoc",e._key,r,null!==e.converter,n).toMutation(e._key,Fr.none())])}function Kl(e,...t){var n,i,r;e=N(e);let s={includeMetadataChanges:!1,source:"default"},o=0;"object"!=typeof t[o]||Xc(t[o])||(s=t[o++]);const a={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(Xc(t[o])){const e=t[o];t[o]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[o+1]=null===(i=e.error)||void 0===i?void 0:i.bind(e),t[o+2]=null===(r=e.complete)||void 0===r?void 0:r.bind(e)}let c,l,u;if(e instanceof qc)l=cn(e.firestore,Zc),u=Qi(e._key.path),c={next:n=>{t[o]&&t[o](Wl(l,e,n))},error:t[o+1],complete:t[o+2]};else{const n=cn(e,$c);l=cn(n.firestore,Zc),u=n._query;const i=new $l(l);c={next:e=>{t[o]&&t[o](new Bl(l,i,n,e))},error:t[o+1],complete:t[o+2]},kl(e._query)}return function(e,t,n,i){const r=new xc(i),s=new Ya(t,r,n);return e.asyncQueue.enqueueAndForget(async()=>$a(await Mc(e),s)),()=>{r.Ou(),e.asyncQueue.enqueueAndForget(async()=>qa(await Mc(e),s))}}(tl(l),u,a,c)}function Wl(e,t,n){const i=n.docs.get(t._key),r=new $l(e);return new Ul(e,r,t._key,i,new zl(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){bt=e}(qe),Ve(new O("firestore",(e,{instanceIdentifier:n,options:i})=>{const r=e.getProvider("app").getImmediate(),s=new Zc(new Ft(e.getProvider("auth-internal")),new Bt(r,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Ot(Nt.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Yn(e.options.projectId,t)}(r,n),r);return i=Object.assign({useFetchStreams:t},i),s._setSettings(i),s},"PUBLIC").setMultipleInstances(!0)),We(vt,yt,e),We(vt,yt,"esm2017")}();
|
|
2072
2175
|
/**
|
|
2073
2176
|
* @license
|
|
2074
2177
|
* Copyright 2020 Google LLC
|
|
@@ -2085,7 +2188,7 @@ class Rd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
|
|
|
2085
2188
|
* See the License for the specific language governing permissions and
|
|
2086
2189
|
* limitations under the License.
|
|
2087
2190
|
*/
|
|
2088
|
-
|
|
2191
|
+
We("firebase","11.10.0","app");class Ql{constructor(){}static getInstance(){return Ql.instance||(Ql.instance=new Ql),Ql.instance}setEnv(e){switch(e){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Yl.firebase:Jl.firebase}get api(){return"prod"===this.env?Yl.api:Jl.api}get config(){return"prod"===this.env?Yl.config:Jl.config}}const Jl={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)}},Yl={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 Xl=1e3,Zl=6e4,eu=36e5,tu="millisecond",nu="second",iu="minute",ru="hour",su="day",ou="week",au="month",cu="quarter",lu="year",uu="date",hu="Invalid Date",du=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,fu=/\[([^\]]+)]|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,pu={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])+"]"}},gu=function(e,t,n){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(n)+e},mu={s:gu,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),i=Math.floor(n/60),r=n%60;return(t<=0?"+":"-")+gu(i,2,"0")+":"+gu(r,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var i=12*(n.year()-t.year())+(n.month()-t.month()),r=t.clone().add(i,au),s=n-r<0,o=t.clone().add(i+(s?-1:1),au);return+(-(i+(n-r)/(s?r-o:o-r))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:au,y:lu,w:ou,d:su,D:uu,h:ru,m:iu,s:nu,ms:tu,Q:cu}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},vu="en",yu={};yu[vu]=pu;var wu="$isDayjsObject",bu=function(e){return e instanceof Tu||!(!e||!e[wu])},_u=function e(t,n,i){var r;if(!t)return vu;if("string"==typeof t){var s=t.toLowerCase();yu[s]&&(r=s),n&&(yu[s]=n,r=s);var o=t.split("-");if(!r&&o.length>1)return e(o[0])}else{var a=t.name;yu[a]=t,r=a}return!i&&r&&(vu=r),r||!i&&vu},Su=function(e,t){if(bu(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new Tu(n)},Eu=mu;Eu.l=_u,Eu.i=bu,Eu.w=function(e,t){return Su(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var Tu=function(){function e(e){this.$L=_u(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[wu]=!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(Eu.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var i=t.match(du);if(i){var r=i[2]-1||0,s=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}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 Eu},t.isValid=function(){return!(this.$d.toString()===hu)},t.isSame=function(e,t){var n=Su(e);return this.startOf(t)<=n&&n<=this.endOf(t)},t.isAfter=function(e,t){return Su(e)<this.startOf(t)},t.isBefore=function(e,t){return this.endOf(t)<Su(e)},t.$g=function(e,t,n){return Eu.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,i=!!Eu.u(t)||t,r=Eu.p(e),s=function(e,t){var r=Eu.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return i?r:r.endOf(su)},o=function(e,t){return Eu.w(n.toDate()[e].apply(n.toDate("s"),(i?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(r){case lu:return i?s(1,0):s(31,11);case au:return i?s(1,c):s(0,c+1);case ou:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(i?l-d:l+(6-d),c);case su:case uu:return o(u+"Hours",0);case ru:return o(u+"Minutes",1);case iu:return o(u+"Seconds",2);case nu:return o(u+"Milliseconds",3);default:return this.clone()}},t.endOf=function(e){return this.startOf(e,!1)},t.$set=function(e,t){var n,i=Eu.p(e),r="set"+(this.$u?"UTC":""),s=(n={},n[su]=r+"Date",n[uu]=r+"Date",n[au]=r+"Month",n[lu]=r+"FullYear",n[ru]=r+"Hours",n[iu]=r+"Minutes",n[nu]=r+"Seconds",n[tu]=r+"Milliseconds",n)[i],o=i===su?this.$D+(t-this.$W):t;if(i===au||i===lu){var a=this.clone().set(uu,1);a.$d[s](o),a.init(),this.$d=a.set(uu,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},t.set=function(e,t){return this.clone().$set(e,t)},t.get=function(e){return this[Eu.p(e)]()},t.add=function(e,t){var n,i=this;e=Number(e);var r=Eu.p(t),s=function(t){var n=Su(i);return Eu.w(n.date(n.date()+Math.round(t*e)),i)};if(r===au)return this.set(au,this.$M+e);if(r===lu)return this.set(lu,this.$y+e);if(r===su)return s(1);if(r===ou)return s(7);var o=(n={},n[iu]=Zl,n[ru]=eu,n[nu]=Xl,n)[r]||1,a=this.$d.getTime()+e*o;return Eu.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||hu;var i=e||"YYYY-MM-DDTHH:mm:ssZ",r=Eu.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(e,n,r,s){return e&&(e[n]||e(t,i))||r[n].slice(0,s)},d=function(e){return Eu.s(s%12||12,e,"0")},f=u||function(e,t,n){var i=e<12?"AM":"PM";return n?i.toLowerCase():i};return i.replace(fu,function(e,i){return i||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return Eu.s(t.$y,4,"0");case"M":return a+1;case"MM":return Eu.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return t.$D;case"DD":return Eu.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return h(n.weekdaysMin,t.$W,c,2);case"ddd":return h(n.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(s);case"HH":return Eu.s(s,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(s,o,!0);case"A":return f(s,o,!1);case"m":return String(o);case"mm":return Eu.s(o,2,"0");case"s":return String(t.$s);case"ss":return Eu.s(t.$s,2,"0");case"SSS":return Eu.s(t.$ms,3,"0");case"Z":return r}return null}(e)||r.replace(":","")})},t.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},t.diff=function(e,t,n){var i,r=this,s=Eu.p(t),o=Su(e),a=(o.utcOffset()-this.utcOffset())*Zl,c=this-o,l=function(){return Eu.m(r,o)};switch(s){case lu:i=l()/12;break;case au:i=l();break;case cu:i=l()/3;break;case ou:i=(c-a)/6048e5;break;case su:i=(c-a)/864e5;break;case ru:i=c/eu;break;case iu:i=c/Zl;break;case nu:i=c/Xl;break;default:i=c}return n?i:Eu.a(i)},t.daysInMonth=function(){return this.endOf(au).$D},t.$locale=function(){return yu[this.$L]},t.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),i=_u(e,t,!0);return i&&(n.$L=i),n},t.clone=function(){return Eu.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}(),Iu=Tu.prototype;function Cu(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function ku(){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."}}Su.prototype=Iu,[["$ms",tu],["$s",nu],["$m",iu],["$H",ru],["$W",su],["$M",au],["$y",lu],["$D",uu]].forEach(function(e){Iu[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),Su.extend=function(e,t){return e.$i||(e(t,Tu,Su),e.$i=!0),Su},Su.locale=_u,Su.isDayjs=bu,Su.unix=function(e){return Su(1e3*e)},Su.en=yu[vu],Su.Ls=yu,Su.p={},"function"==typeof SuppressedError&&SuppressedError;const Au=ku,Ru=new S("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."}),xu="auth/user-disabled",Nu=new B("@firebase/auth");function Ou(e,...t){Nu.logLevel<=M.ERROR&&Nu.error(`Auth (${qe}): ${e}`,...t)}
|
|
2089
2192
|
/**
|
|
2090
2193
|
* @license
|
|
2091
2194
|
* Copyright 2020 Google LLC
|
|
@@ -2101,7 +2204,7 @@ Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){retu
|
|
|
2101
2204
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2102
2205
|
* See the License for the specific language governing permissions and
|
|
2103
2206
|
* limitations under the License.
|
|
2104
|
-
*/function
|
|
2207
|
+
*/function Lu(e,...t){throw Fu(e,...t)}function Pu(e,...t){return Fu(e,...t)}function Du(e,t,n){const i=Object.assign(Object.assign({},Au()),{[t]:n});return new S("auth","Firebase",i).create(t,{appName:e.name})}function Mu(e){return Du(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Fu(e,...t){if("string"!=typeof e){const n=t[0],i=[...t.slice(1)];return i[0]&&(i[0].appName=e.name),e._errorFactory.create(n,...i)}return Ru.create(e,...t)}function zu(e,t,...n){if(!e)throw Fu(t,...n)}function Uu(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ou(t),new Error(t)}function Vu(e,t){e||Uu(t)}
|
|
2105
2208
|
/**
|
|
2106
2209
|
* @license
|
|
2107
2210
|
* Copyright 2020 Google LLC
|
|
@@ -2117,7 +2220,7 @@ Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){retu
|
|
|
2117
2220
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2118
2221
|
* See the License for the specific language governing permissions and
|
|
2119
2222
|
* limitations under the License.
|
|
2120
|
-
*/function
|
|
2223
|
+
*/function Bu(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function ju(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}
|
|
2121
2224
|
/**
|
|
2122
2225
|
* @license
|
|
2123
2226
|
* Copyright 2020 Google LLC
|
|
@@ -2133,7 +2236,7 @@ Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){retu
|
|
|
2133
2236
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2134
2237
|
* See the License for the specific language governing permissions and
|
|
2135
2238
|
* limitations under the License.
|
|
2136
|
-
*/function
|
|
2239
|
+
*/function Hu(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==ju()&&"https:"!==ju()&&!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}
|
|
2137
2240
|
/**
|
|
2138
2241
|
* @license
|
|
2139
2242
|
* Copyright 2020 Google LLC
|
|
@@ -2150,7 +2253,7 @@ Vt("firebase","10.13.0","app");class Bd{constructor(){}static getInstance(){retu
|
|
|
2150
2253
|
* See the License for the specific language governing permissions and
|
|
2151
2254
|
* limitations under the License.
|
|
2152
2255
|
*/
|
|
2153
|
-
class
|
|
2256
|
+
class $u{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vu(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(w())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Hu()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
|
|
2154
2257
|
/**
|
|
2155
2258
|
* @license
|
|
2156
2259
|
* Copyright 2020 Google LLC
|
|
@@ -2166,7 +2269,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2166
2269
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2167
2270
|
* See the License for the specific language governing permissions and
|
|
2168
2271
|
* limitations under the License.
|
|
2169
|
-
*/function
|
|
2272
|
+
*/function qu(e,t){Vu(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}
|
|
2170
2273
|
/**
|
|
2171
2274
|
* @license
|
|
2172
2275
|
* Copyright 2020 Google LLC
|
|
@@ -2182,7 +2285,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2182
2285
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2183
2286
|
* See the License for the specific language governing permissions and
|
|
2184
2287
|
* limitations under the License.
|
|
2185
|
-
*/class
|
|
2288
|
+
*/class Gu{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 Uu("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 Uu("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 Uu("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
|
|
2186
2289
|
/**
|
|
2187
2290
|
* @license
|
|
2188
2291
|
* Copyright 2020 Google LLC
|
|
@@ -2198,7 +2301,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2198
2301
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2199
2302
|
* See the License for the specific language governing permissions and
|
|
2200
2303
|
* limitations under the License.
|
|
2201
|
-
*/const
|
|
2304
|
+
*/const Ku={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"},Wu=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Qu=new $u(3e4,6e4);
|
|
2202
2305
|
/**
|
|
2203
2306
|
* @license
|
|
2204
2307
|
* Copyright 2020 Google LLC
|
|
@@ -2214,7 +2317,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2214
2317
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2215
2318
|
* See the License for the specific language governing permissions and
|
|
2216
2319
|
* limitations under the License.
|
|
2217
|
-
*/function
|
|
2320
|
+
*/function Ju(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Yu(e,t,n,i,r={}){return Xu(e,r,async()=>{let r={},s={};i&&("GET"===t?s=i:r={body:JSON.stringify(i)});const o=C(Object.assign({key:e.config.apiKey},s)).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},r);return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&p(e.emulatorConfig.host)&&(c.credentials="include"),Gu.fetch()(await eh(e,e.config.apiHost,n,o),c)})}async function Xu(e,t,n){e._canInitEmulator=!1;const i=Object.assign(Object.assign({},Ku),t);try{const t=new nh(e),r=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const s=await r.json();if("needConfirmation"in s)throw ih(e,"account-exists-with-different-credential",s);if(r.ok&&!("errorMessage"in s))return s;{const t=r.ok?s.errorMessage:s.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw ih(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw ih(e,"email-already-in-use",s);if("USER_DISABLED"===n)throw ih(e,"user-disabled",s);const a=i[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Du(e,a,o);Lu(e,a)}}catch(t){if(t instanceof _)throw t;Lu(e,"network-request-failed",{message:String(t)})}}async function Zu(e,t,n,i,r={}){const s=await Yu(e,t,n,i,r);return"mfaPendingCredential"in s&&Lu(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function eh(e,t,n,i){const r=`${t}${n}?${i}`,s=e,o=s.config.emulator?qu(e.config,r):`${e.config.apiScheme}://${r}`;if(Wu.includes(n)&&(await s._persistenceManagerAvailable,"COOKIE"===s._getPersistenceType())){return s._getPersistence()._getFinalTarget(o).toString()}return o}function th(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class nh{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(Pu(this.auth,"network-request-failed")),Qu.get())})}}function ih(e,t,n){const i={appName:e.name};n.email&&(i.email=n.email),n.phoneNumber&&(i.phoneNumber=n.phoneNumber);const r=Pu(e,t,i);return r.customData._tokenResponse=n,r}function rh(e){return void 0!==e&&void 0!==e.enterprise}class sh{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 th(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 oh(e,t){return Yu(e,"POST","/v1/accounts:lookup",t)}
|
|
2218
2321
|
/**
|
|
2219
2322
|
* @license
|
|
2220
2323
|
* Copyright 2020 Google LLC
|
|
@@ -2230,7 +2333,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2230
2333
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2231
2334
|
* See the License for the specific language governing permissions and
|
|
2232
2335
|
* limitations under the License.
|
|
2233
|
-
*/function
|
|
2336
|
+
*/function ah(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function ch(e){return 1e3*Number(e)}function lh(e){const[t,n,i]=e.split(".");if(void 0===t||void 0===n||void 0===i)return Ou("JWT malformed, contained fewer than 3 sections"),null;try{const e=a(n);return e?JSON.parse(e):(Ou("Failed to decode base64 JWT payload"),null)}catch(e){return Ou("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function uh(e){const t=lh(e);return zu(t,"internal-error"),zu(void 0!==t.exp,"internal-error"),zu(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}
|
|
2234
2337
|
/**
|
|
2235
2338
|
* @license
|
|
2236
2339
|
* Copyright 2020 Google LLC
|
|
@@ -2246,7 +2349,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2246
2349
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2247
2350
|
* See the License for the specific language governing permissions and
|
|
2248
2351
|
* limitations under the License.
|
|
2249
|
-
*/async function
|
|
2352
|
+
*/async function hh(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof _&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}
|
|
2250
2353
|
/**
|
|
2251
2354
|
* @license
|
|
2252
2355
|
* Copyright 2020 Google LLC
|
|
@@ -2262,7 +2365,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2262
2365
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2263
2366
|
* See the License for the specific language governing permissions and
|
|
2264
2367
|
* limitations under the License.
|
|
2265
|
-
*/(
|
|
2368
|
+
*/(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class dh{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()}}
|
|
2266
2369
|
/**
|
|
2267
2370
|
* @license
|
|
2268
2371
|
* Copyright 2020 Google LLC
|
|
@@ -2278,7 +2381,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2278
2381
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2279
2382
|
* See the License for the specific language governing permissions and
|
|
2280
2383
|
* limitations under the License.
|
|
2281
|
-
*/class
|
|
2384
|
+
*/class fh{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=ah(this.lastLoginAt),this.creationTime=ah(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
|
|
2282
2385
|
/**
|
|
2283
2386
|
* @license
|
|
2284
2387
|
* Copyright 2019 Google LLC
|
|
@@ -2294,7 +2397,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2294
2397
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2295
2398
|
* See the License for the specific language governing permissions and
|
|
2296
2399
|
* limitations under the License.
|
|
2297
|
-
*/async function
|
|
2400
|
+
*/async function ph(e){var t;const n=e.auth,i=await e.getIdToken(),r=await hh(e,oh(n,{idToken:i}));zu(null==r?void 0:r.users.length,n,"internal-error");const s=r.users[0];e._notifyReloadListener(s);const o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?gh(s.providerUserInfo):[],a=function(e,t){const n=e.filter(e=>!t.some(t=>t.providerId===e.providerId));return[...n,...t]}(e.providerData,o),c=e.isAnonymous,l=!(e.email&&s.passwordHash||(null==a?void 0:a.length)),u=!!c&&l,h={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new fh(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(e,h)}function gh(e){return e.map(e=>{var{providerId:t}=e,n=Cu(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}
|
|
2298
2401
|
/**
|
|
2299
2402
|
* @license
|
|
2300
2403
|
* Copyright 2020 Google LLC
|
|
@@ -2327,7 +2430,7 @@ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,xf(e>t,"Short delay
|
|
|
2327
2430
|
* See the License for the specific language governing permissions and
|
|
2328
2431
|
* limitations under the License.
|
|
2329
2432
|
*/
|
|
2330
|
-
class
|
|
2433
|
+
class mh{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){zu(e.idToken,"internal-error"),zu(void 0!==e.idToken,"internal-error"),zu(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):uh(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){zu(0!==e.length,"internal-error");const t=uh(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(zu(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:i,expiresIn:r}=await async function(e,t){const n=await Xu(e,{},async()=>{const n=C({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:i,apiKey:r}=e.config,s=await eh(e,i,"/v1/token",`key=${r}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";const a={method:"POST",headers:o,body:n};return e.emulatorConfig&&p(e.emulatorConfig.host)&&(a.credentials="include"),Gu.fetch()(s,a)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,i,Number(r))}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:i,expirationTime:r}=t,s=new mh;return n&&(zu("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),i&&(zu("string"==typeof i,"internal-error",{appName:e}),s.accessToken=i),r&&(zu("number"==typeof r,"internal-error",{appName:e}),s.expirationTime=r),s}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 mh,this.toJSON())}_performRefresh(){return Uu("not implemented")}}
|
|
2331
2434
|
/**
|
|
2332
2435
|
* @license
|
|
2333
2436
|
* Copyright 2020 Google LLC
|
|
@@ -2343,7 +2446,7 @@ class ap{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2343
2446
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2344
2447
|
* See the License for the specific language governing permissions and
|
|
2345
2448
|
* limitations under the License.
|
|
2346
|
-
*/function
|
|
2449
|
+
*/function vh(e,t){zu("string"==typeof e||void 0===e,"internal-error",{appName:t})}class yh{constructor(e){var{uid:t,auth:n,stsTokenManager:i}=e,r=Cu(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new dh(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new fh(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){const t=await hh(this,this.stsTokenManager.getToken(this.auth,e));return zu(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=N(e),i=await n.getIdToken(t),r=lh(i);zu(r&&r.exp&&r.auth_time&&r.iat,n.auth,"internal-error");const s="object"==typeof r.firebase?r.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:r,token:i,authTime:ah(ch(r.auth_time)),issuedAtTime:ah(ch(r.iat)),expirationTime:ah(ch(r.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=N(e);await ph(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(zu(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 yh(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){zu(!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 ph(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(je(this.auth.app))return Promise.reject(Mu(this.auth));const e=await this.getIdToken();return await hh(this,
|
|
2347
2450
|
/**
|
|
2348
2451
|
* @license
|
|
2349
2452
|
* Copyright 2020 Google LLC
|
|
@@ -2360,7 +2463,7 @@ class ap{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2360
2463
|
* See the License for the specific language governing permissions and
|
|
2361
2464
|
* limitations under the License.
|
|
2362
2465
|
*/
|
|
2363
|
-
async function(t
|
|
2466
|
+
async function(e,t){return Yu(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,i,r,s,o,a,c,l;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,h=null!==(i=t.email)&&void 0!==i?i:void 0,d=null!==(r=t.phoneNumber)&&void 0!==r?r:void 0,f=null!==(s=t.photoURL)&&void 0!==s?s: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,v=null!==(l=t.lastLoginAt)&&void 0!==l?l:void 0,{uid:y,emailVerified:w,isAnonymous:b,providerData:_,stsTokenManager:S}=t;zu(y&&S,e,"internal-error");const E=mh.fromJSON(this.name,S);zu("string"==typeof y,e,"internal-error"),vh(u,e.name),vh(h,e.name),zu("boolean"==typeof w,e,"internal-error"),zu("boolean"==typeof b,e,"internal-error"),vh(d,e.name),vh(f,e.name),vh(p,e.name),vh(g,e.name),vh(m,e.name),vh(v,e.name);const T=new yh({uid:y,auth:e,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:v});return _&&Array.isArray(_)&&(T.providerData=_.map(e=>Object.assign({},e))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(e,t,n=!1){const i=new mh;i.updateFromServerResponse(t);const r=new yh({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:n});return await ph(r),r}static async _fromGetAccountInfoResponse(e,t,n){const i=t.users[0];zu(void 0!==i.localId,"internal-error");const r=void 0!==i.providerUserInfo?gh(i.providerUserInfo):[],s=!(i.email&&i.passwordHash||(null==r?void 0:r.length)),o=new mh;o.updateFromIdToken(n);const a=new yh({uid:i.localId,auth:e,stsTokenManager:o,isAnonymous:s}),c={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:r,metadata:new fh(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash||(null==r?void 0:r.length))};return Object.assign(a,c),a}}
|
|
2364
2467
|
/**
|
|
2365
2468
|
* @license
|
|
2366
2469
|
* Copyright 2020 Google LLC
|
|
@@ -2376,7 +2479,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2376
2479
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2377
2480
|
* See the License for the specific language governing permissions and
|
|
2378
2481
|
* limitations under the License.
|
|
2379
|
-
*/const
|
|
2482
|
+
*/const wh=new Map;function bh(e){Vu(e instanceof Function,"Expected a class definition");let t=wh.get(e);return t?(Vu(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,wh.set(e,t),t)}
|
|
2380
2483
|
/**
|
|
2381
2484
|
* @license
|
|
2382
2485
|
* Copyright 2019 Google LLC
|
|
@@ -2392,7 +2495,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2392
2495
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2393
2496
|
* See the License for the specific language governing permissions and
|
|
2394
2497
|
* limitations under the License.
|
|
2395
|
-
*/class
|
|
2498
|
+
*/class _h{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){}}_h.type="NONE";const Sh=_h;
|
|
2396
2499
|
/**
|
|
2397
2500
|
* @license
|
|
2398
2501
|
* Copyright 2019 Google LLC
|
|
@@ -2408,7 +2511,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2408
2511
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2409
2512
|
* See the License for the specific language governing permissions and
|
|
2410
2513
|
* limitations under the License.
|
|
2411
|
-
*/function
|
|
2514
|
+
*/function Eh(e,t,n){return`firebase:${e}:${t}:${n}`}class Th{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:i,name:r}=this.auth;this.fullUserKey=Eh(this.userKey,i.apiKey,r),this.fullPersistenceKey=Eh("persistence",i.apiKey,r),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 oh(this.auth,{idToken:e}).catch(()=>{});return t?yh._fromGetAccountInfoResponse(this.auth,t,e):null}return yh._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 Th(bh(Sh),e,n);const i=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e);let r=i[0]||bh(Sh);const s=Eh(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(s);if(t){let i;if("string"==typeof t){const n=await oh(e,{idToken:t}).catch(()=>{});if(!n)break;i=await yh._fromGetAccountInfoResponse(e,n,t)}else i=yh._fromJSON(e,t);n!==r&&(o=i),r=n;break}}catch(e){}const a=i.filter(e=>e._shouldAllowMigration);return r._shouldAllowMigration&&a.length?(r=a[0],o&&await r._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==r)try{await e._remove(s)}catch(e){}})),new Th(r,e,n)):new Th(r,e,n)}}
|
|
2412
2515
|
/**
|
|
2413
2516
|
* @license
|
|
2414
2517
|
* Copyright 2020 Google LLC
|
|
@@ -2424,7 +2527,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2424
2527
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2425
2528
|
* See the License for the specific language governing permissions and
|
|
2426
2529
|
* limitations under the License.
|
|
2427
|
-
*/function
|
|
2530
|
+
*/function Ih(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(Rh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(Ch(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Nh(t))return"Blackberry";if(Oh(t))return"Webos";if(kh(t))return"Safari";if((t.includes("chrome/")||Ah(t))&&!t.includes("edge/"))return"Chrome";if(xh(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 Ch(e=w()){return/firefox\//i.test(e)}function kh(e=w()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Ah(e=w()){return/crios\//i.test(e)}function Rh(e=w()){return/iemobile/i.test(e)}function xh(e=w()){return/android/i.test(e)}function Nh(e=w()){return/blackberry/i.test(e)}function Oh(e=w()){return/webos/i.test(e)}function Lh(e=w()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Ph(){return function(){const e=w();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Dh(e=w()){return Lh(e)||xh(e)||Oh(e)||Nh(e)||/windows phone/i.test(e)||Rh(e)}
|
|
2428
2531
|
/**
|
|
2429
2532
|
* @license
|
|
2430
2533
|
* Copyright 2020 Google LLC
|
|
@@ -2440,7 +2543,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2440
2543
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2441
2544
|
* See the License for the specific language governing permissions and
|
|
2442
2545
|
* limitations under the License.
|
|
2443
|
-
*/function
|
|
2546
|
+
*/function Mh(e,t=[]){let n;switch(e){case"Browser":n=Ih(w());break;case"Worker":n=`${Ih(w())}-${e}`;break;default:n=e}const i=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${qe}/${i}`}
|
|
2444
2547
|
/**
|
|
2445
2548
|
* @license
|
|
2446
2549
|
* Copyright 2022 Google LLC
|
|
@@ -2456,7 +2559,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2456
2559
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2457
2560
|
* See the License for the specific language governing permissions and
|
|
2458
2561
|
* limitations under the License.
|
|
2459
|
-
*/class
|
|
2562
|
+
*/class Fh{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise((n,i)=>{try{n(e(t))}catch(e){i(e)}});n.onAbort=t,this.queue.push(n);const i=this.queue.length-1;return()=>{this.queue[i]=()=>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})}}}
|
|
2460
2563
|
/**
|
|
2461
2564
|
* @license
|
|
2462
2565
|
* Copyright 2023 Google LLC
|
|
@@ -2472,7 +2575,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2472
2575
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2473
2576
|
* See the License for the specific language governing permissions and
|
|
2474
2577
|
* limitations under the License.
|
|
2475
|
-
*/class
|
|
2578
|
+
*/class zh{constructor(e){var t,n,i,r;const s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(t=s.minPasswordLength)&&void 0!==t?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(i=null===(n=e.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==i?i:"",this.forceUpgradeOnSignin=null!==(r=e.forceUpgradeOnSignin)&&void 0!==r&&r,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,i,r,s,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===(i=a.containsLowercaseLetter)||void 0===i||i),a.isValid&&(a.isValid=null===(r=a.containsUppercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsNumericCharacter)||void 0===s||s),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(e,t){const n=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let i=0;i<e.length;i++)n=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,i,r){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=r))}}
|
|
2476
2579
|
/**
|
|
2477
2580
|
* @license
|
|
2478
2581
|
* Copyright 2020 Google LLC
|
|
@@ -2488,7 +2591,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2488
2591
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2489
2592
|
* See the License for the specific language governing permissions and
|
|
2490
2593
|
* limitations under the License.
|
|
2491
|
-
*/class
|
|
2594
|
+
*/class Uh{constructor(e,t,n,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Bh(this),this.idTokenSubscription=new Bh(this),this.beforeStateQueue=new Fh(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=Ru,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=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=bh(t)),this._initializationPromise=this.queue(async()=>{var n,i,r;if(!this._deleted&&(this.persistenceManager=await Th.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(i=this._popupRedirectResolver)||void 0===i?void 0:i._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await oh(this,{idToken:e}),n=await yh._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(je(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 i=n,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==s||!(null==o?void 0:o.user)||(i=o.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return zu(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}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 ph(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(je(this.app))return Promise.reject(Mu(this));const t=e?N(e):null;return t&&zu(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&&zu(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 je(this.app)?Promise.reject(Mu(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return je(this.app)?Promise.reject(Mu(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(bh(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 Yu(e,"GET","/v2/passwordPolicy",Ju(e,t))}
|
|
2492
2595
|
/**
|
|
2493
2596
|
* @license
|
|
2494
2597
|
* Copyright 2023 Google LLC
|
|
@@ -2504,7 +2607,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2504
2607
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2505
2608
|
* See the License for the specific language governing permissions and
|
|
2506
2609
|
* limitations under the License.
|
|
2507
|
-
*/(this),
|
|
2610
|
+
*/(this),t=new zh(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 S("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 Yu(e,"POST","/v2/accounts:revokeToken",Ju(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&&bh(e)||this._popupRedirectResolver;zu(t,this,"argument-error"),this.redirectPersistenceManager=await Th.create(this,[bh(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,i){if(this._deleted)return()=>{};const r="function"==typeof t?t:t.next.bind(t);let s=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(zu(o,this,"internal-error"),o.then(()=>{s||r(this.currentUser)}),"function"==typeof t){const r=e.addObserver(t,n,i);return()=>{s=!0,r()}}{const n=e.addObserver(t);return()=>{s=!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 zu(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Mh(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 i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;if(je(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){Nu.logLevel<=M.WARN&&Nu.warn(`Auth (${qe}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Vh(e){return N(e)}class Bh{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new R(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return zu(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
|
|
2508
2611
|
/**
|
|
2509
2612
|
* @license
|
|
2510
2613
|
* Copyright 2020 Google LLC
|
|
@@ -2520,7 +2623,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2520
2623
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2521
2624
|
* See the License for the specific language governing permissions and
|
|
2522
2625
|
* limitations under the License.
|
|
2523
|
-
*/let
|
|
2626
|
+
*/let jh={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Hh(e){return jh.loadJS(e)}class $h{constructor(){this.enterprise=new qh}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class qh{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const Gh="NO_RECAPTCHA";class Kh{constructor(e){this.type="recaptcha-enterprise",this.auth=Vh(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 Yu(e,"GET","/v2/recaptchaConfig",Ju(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(i=>{if(void 0!==i.recaptchaKey){const n=new sh(i);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 i(t,n,i){const r=window.grecaptcha;rh(r)?r.enterprise.ready(()=>{r.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(Gh)})}):i(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new $h).execute("siteKey",{action:"verify"})}return new Promise((e,r)=>{n(this.auth).then(n=>{if(!t&&rh(window.grecaptcha))i(n,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));let t=jh.recaptchaEnterpriseScript;0!==t.length&&(t+=n),Hh(t).then(()=>{i(n,e,r)}).catch(e=>{r(e)})}}).catch(e=>{r(e)})})}}async function Wh(e,t,n,i=!1,r=!1){const s=new Kh(e);let o;if(r)o=Gh;else try{o=await s.verify(n)}catch(e){o=await s.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 i?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 Qh(e,t,n,i,r){var s;if(null===(s=e._getRecaptchaConfig())||void 0===s?void 0:s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const r=await Wh(e,t,n,"getOobCode"===n);return i(e,r)}return i(e,t).catch(async r=>{if("auth/missing-recaptcha-token"===r.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const r=await Wh(e,t,n,"getOobCode"===n);return i(e,r)}return Promise.reject(r)})}
|
|
2524
2627
|
/**
|
|
2525
2628
|
* @license
|
|
2526
2629
|
* Copyright 2020 Google LLC
|
|
@@ -2536,7 +2639,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2536
2639
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2537
2640
|
* See the License for the specific language governing permissions and
|
|
2538
2641
|
* limitations under the License.
|
|
2539
|
-
*/function
|
|
2642
|
+
*/function Jh(e,t,n){const i=Vh(e);zu(/^https?:\/\//.test(t),i,"invalid-emulator-scheme");const r=Yh(t),{host:s,port:o}=function(e){const t=Yh(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const i=n[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){const e=r[1];return{host:e,port:Xh(i.substr(e.length+1))}}{const[e,t]=i.split(":");return{host:e,port:Xh(t)}}}(t),a=null===o?"":`:${o}`,c={url:`${r}//${s}${a}/`},l=Object.freeze({host:s,port:o,protocol:r.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!i._canInitEmulator)return zu(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),void zu(T(c,i.config.emulator)&&T(l,i.emulatorConfig),i,"emulator-config-failed");i.config.emulator=c,i.emulatorConfig=l,i.settings.appVerificationDisabledForTesting=!0,p(s)?(g(`${r}//${s}${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())}
|
|
2540
2643
|
/**
|
|
2541
2644
|
* @license
|
|
2542
2645
|
* Copyright 2020 Google LLC
|
|
@@ -2552,7 +2655,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2552
2655
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2553
2656
|
* See the License for the specific language governing permissions and
|
|
2554
2657
|
* limitations under the License.
|
|
2555
|
-
*/()}function
|
|
2658
|
+
*/()}function Yh(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function Xh(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Zh{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Uu("not implemented")}_getIdTokenResponse(e){return Uu("not implemented")}_linkToIdToken(e,t){return Uu("not implemented")}_getReauthenticationResolver(e){return Uu("not implemented")}}
|
|
2556
2659
|
/**
|
|
2557
2660
|
* @license
|
|
2558
2661
|
* Copyright 2020 Google LLC
|
|
@@ -2568,7 +2671,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2568
2671
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2569
2672
|
* See the License for the specific language governing permissions and
|
|
2570
2673
|
* limitations under the License.
|
|
2571
|
-
*/async function
|
|
2674
|
+
*/async function ed(e,t){return Yu(e,"POST","/v1/accounts:signUp",t)}
|
|
2572
2675
|
/**
|
|
2573
2676
|
* @license
|
|
2574
2677
|
* Copyright 2020 Google LLC
|
|
@@ -2584,7 +2687,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2584
2687
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2585
2688
|
* See the License for the specific language governing permissions and
|
|
2586
2689
|
* limitations under the License.
|
|
2587
|
-
*/async function
|
|
2690
|
+
*/async function td(e,t){return Zu(e,"POST","/v1/accounts:signInWithPassword",Ju(e,t))}async function nd(e,t){return async function(e,t){return Yu(e,"POST","/v1/accounts:sendOobCode",Ju(e,t))}(e,t)}
|
|
2588
2691
|
/**
|
|
2589
2692
|
* @license
|
|
2590
2693
|
* Copyright 2020 Google LLC
|
|
@@ -2617,7 +2720,7 @@ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
|
|
|
2617
2720
|
* See the License for the specific language governing permissions and
|
|
2618
2721
|
* limitations under the License.
|
|
2619
2722
|
*/
|
|
2620
|
-
class
|
|
2723
|
+
class id extends Zh{constructor(e,t,n,i=null){super("password",n),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new id(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new id(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 Qh(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",td);case"emailLink":return async function(e,t){return Zu(e,"POST","/v1/accounts:signInWithEmailLink",Ju(e,t))}(e,{email:this._email,oobCode:this._password});default:Lu(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return Qh(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",ed);case"emailLink":return async function(e,t){return Zu(e,"POST","/v1/accounts:signInWithEmailLink",Ju(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Lu(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}
|
|
2621
2724
|
/**
|
|
2622
2725
|
* @license
|
|
2623
2726
|
* Copyright 2020 Google LLC
|
|
@@ -2633,7 +2736,7 @@ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2633
2736
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2634
2737
|
* See the License for the specific language governing permissions and
|
|
2635
2738
|
* limitations under the License.
|
|
2636
|
-
*/async function
|
|
2739
|
+
*/async function rd(e,t){return Zu(e,"POST","/v1/accounts:signInWithIdp",Ju(e,t))}
|
|
2637
2740
|
/**
|
|
2638
2741
|
* @license
|
|
2639
2742
|
* Copyright 2020 Google LLC
|
|
@@ -2649,7 +2752,7 @@ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2649
2752
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2650
2753
|
* See the License for the specific language governing permissions and
|
|
2651
2754
|
* limitations under the License.
|
|
2652
|
-
*/class
|
|
2755
|
+
*/class sd extends Zh{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):Lu("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:i}=t,r=Cu(t,["providerId","signInMethod"]);if(!n||!i)return null;const s=new sd(n,i);return s.idToken=r.idToken||void 0,s.accessToken=r.accessToken||void 0,s.secret=r.secret,s.nonce=r.nonce,s.pendingToken=r.pendingToken||null,s}_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=C(t)}return e}}
|
|
2653
2756
|
/**
|
|
2654
2757
|
* @license
|
|
2655
2758
|
* Copyright 2020 Google LLC
|
|
@@ -2665,7 +2768,7 @@ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2665
2768
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2666
2769
|
* See the License for the specific language governing permissions and
|
|
2667
2770
|
* limitations under the License.
|
|
2668
|
-
*/class
|
|
2771
|
+
*/class od{constructor(e){var t,n,i,r,s,o;const a=k(A(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=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!==(i=a.mode)&&void 0!==i?i:null);zu(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(r=a.continueUrl)&&void 0!==r?r:null,this.languageCode=null!==(s=a.lang)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=k(A(e)).link,n=t?k(A(t)).deep_link_id:null,i=k(A(e)).deep_link_id;return(i?k(A(i)).link:null)||i||n||t||e}(e);try{return new od(t)}catch(e){return null}}}
|
|
2669
2772
|
/**
|
|
2670
2773
|
* @license
|
|
2671
2774
|
* Copyright 2020 Google LLC
|
|
@@ -2681,7 +2784,7 @@ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2681
2784
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2682
2785
|
* See the License for the specific language governing permissions and
|
|
2683
2786
|
* limitations under the License.
|
|
2684
|
-
*/class
|
|
2787
|
+
*/class ad{constructor(){this.providerId=ad.PROVIDER_ID}static credential(e,t){return id._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=od.parseLink(t);return zu(n,"argument-error"),id._fromEmailAndCode(e,n.code,n.tenantId)}}ad.PROVIDER_ID="password",ad.EMAIL_PASSWORD_SIGN_IN_METHOD="password",ad.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
|
|
2685
2788
|
/**
|
|
2686
2789
|
* @license
|
|
2687
2790
|
* Copyright 2020 Google LLC
|
|
@@ -2698,7 +2801,7 @@ class $p extends Vp{constructor(t,e,n,i=null){super("password",n),this._email=t,
|
|
|
2698
2801
|
* See the License for the specific language governing permissions and
|
|
2699
2802
|
* limitations under the License.
|
|
2700
2803
|
*/
|
|
2701
|
-
class
|
|
2804
|
+
class cd{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}}
|
|
2702
2805
|
/**
|
|
2703
2806
|
* @license
|
|
2704
2807
|
* Copyright 2019 Google LLC
|
|
@@ -2714,7 +2817,7 @@ class Yp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2714
2817
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2715
2818
|
* See the License for the specific language governing permissions and
|
|
2716
2819
|
* limitations under the License.
|
|
2717
|
-
*/class
|
|
2820
|
+
*/class ld extends cd{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}
|
|
2718
2821
|
/**
|
|
2719
2822
|
* @license
|
|
2720
2823
|
* Copyright 2020 Google LLC
|
|
@@ -2730,7 +2833,7 @@ class Yp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2730
2833
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2731
2834
|
* See the License for the specific language governing permissions and
|
|
2732
2835
|
* limitations under the License.
|
|
2733
|
-
*/class
|
|
2836
|
+
*/class ud extends ld{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";
|
|
2734
2837
|
/**
|
|
2735
2838
|
* @license
|
|
2736
2839
|
* Copyright 2020 Google LLC
|
|
@@ -2747,7 +2850,7 @@ class Yp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2747
2850
|
* See the License for the specific language governing permissions and
|
|
2748
2851
|
* limitations under the License.
|
|
2749
2852
|
*/
|
|
2750
|
-
class
|
|
2853
|
+
class hd extends ld{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";
|
|
2751
2854
|
/**
|
|
2752
2855
|
* @license
|
|
2753
2856
|
* Copyright 2020 Google LLC
|
|
@@ -2764,7 +2867,7 @@ class Zp extends Jp{constructor(){super("google.com"),this.addScope("profile")}s
|
|
|
2764
2867
|
* See the License for the specific language governing permissions and
|
|
2765
2868
|
* limitations under the License.
|
|
2766
2869
|
*/
|
|
2767
|
-
class
|
|
2870
|
+
class dd extends ld{constructor(){super("github.com")}static credential(e){return sd._fromParams({providerId:dd.PROVIDER_ID,signInMethod:dd.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return dd.credentialFromTaggedObject(e)}static credentialFromError(e){return dd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return dd.credential(e.oauthAccessToken)}catch(e){return null}}}dd.GITHUB_SIGN_IN_METHOD="github.com",dd.PROVIDER_ID="github.com";
|
|
2768
2871
|
/**
|
|
2769
2872
|
* @license
|
|
2770
2873
|
* Copyright 2020 Google LLC
|
|
@@ -2781,7 +2884,7 @@ class tg extends Jp{constructor(){super("github.com")}static credential(t){retur
|
|
|
2781
2884
|
* See the License for the specific language governing permissions and
|
|
2782
2885
|
* limitations under the License.
|
|
2783
2886
|
*/
|
|
2784
|
-
class
|
|
2887
|
+
class fd extends ld{constructor(){super("twitter.com")}static credential(e,t){return sd._fromParams({providerId:fd.PROVIDER_ID,signInMethod:fd.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return fd.credentialFromTaggedObject(e)}static credentialFromError(e){return fd.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return fd.credential(t,n)}catch(e){return null}}}fd.TWITTER_SIGN_IN_METHOD="twitter.com",fd.PROVIDER_ID="twitter.com";
|
|
2785
2888
|
/**
|
|
2786
2889
|
* @license
|
|
2787
2890
|
* Copyright 2020 Google LLC
|
|
@@ -2798,7 +2901,7 @@ class eg extends Jp{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2798
2901
|
* See the License for the specific language governing permissions and
|
|
2799
2902
|
* limitations under the License.
|
|
2800
2903
|
*/
|
|
2801
|
-
class
|
|
2904
|
+
class pd{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,i=!1){const r=await yh._fromIdTokenResponse(e,n,i),s=gd(n);return new pd({user:r,providerId:s,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const i=gd(n);return new pd({user:e,providerId:i,_tokenResponse:n,operationType:t})}}function gd(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}
|
|
2802
2905
|
/**
|
|
2803
2906
|
* @license
|
|
2804
2907
|
* Copyright 2020 Google LLC
|
|
@@ -2814,24 +2917,7 @@ class ng{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2814
2917
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2815
2918
|
* See the License for the specific language governing permissions and
|
|
2816
2919
|
* limitations under the License.
|
|
2817
|
-
*/class
|
|
2818
|
-
/**
|
|
2819
|
-
* @license
|
|
2820
|
-
* Copyright 2020 Google LLC
|
|
2821
|
-
*
|
|
2822
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2823
|
-
* you may not use this file except in compliance with the License.
|
|
2824
|
-
* You may obtain a copy of the License at
|
|
2825
|
-
*
|
|
2826
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2827
|
-
*
|
|
2828
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2829
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2830
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2831
|
-
* See the License for the specific language governing permissions and
|
|
2832
|
-
* limitations under the License.
|
|
2833
|
-
*/
|
|
2834
|
-
async function og(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const i="signIn",r=await sg(t,i,e),s=await ng._fromIdTokenResponse(t,i,r);return n||await t._updateCurrentUser(s.user),s}
|
|
2920
|
+
*/class md extends _{constructor(e,t,n,i){var r;super(t.code,t.message),this.operationType=n,this.user=i,Object.setPrototypeOf(this,md.prototype),this.customData={appName:e.name,tenantId:null!==(r=e.tenantId)&&void 0!==r?r:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,i){return new md(e,t,n,i)}}function vd(e,t,n,i){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw md._fromErrorAndOperation(e,n,t,i);throw n})}
|
|
2835
2921
|
/**
|
|
2836
2922
|
* @license
|
|
2837
2923
|
* Copyright 2020 Google LLC
|
|
@@ -2848,7 +2934,7 @@ async function og(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const i="s
|
|
|
2848
2934
|
* See the License for the specific language governing permissions and
|
|
2849
2935
|
* limitations under the License.
|
|
2850
2936
|
*/
|
|
2851
|
-
async function
|
|
2937
|
+
async function yd(e,t,n=!1){if(je(e.app))return Promise.reject(Mu(e));const i="signIn",r=await vd(e,i,t),s=await pd._fromIdTokenResponse(e,i,r);return n||await e._updateCurrentUser(s.user),s}
|
|
2852
2938
|
/**
|
|
2853
2939
|
* @license
|
|
2854
2940
|
* Copyright 2020 Google LLC
|
|
@@ -2865,7 +2951,7 @@ async function ag(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._upda
|
|
|
2865
2951
|
* See the License for the specific language governing permissions and
|
|
2866
2952
|
* limitations under the License.
|
|
2867
2953
|
*/
|
|
2868
|
-
function(
|
|
2954
|
+
async function wd(e){const t=Vh(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function bd(e,t,n){await async function(e,t){return Yu(e,"POST","/v1/accounts:resetPassword",Ju(e,t))}(N(e),{oobCode:t,newPassword:n}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&wd(e),t})}function _d(e,t,n){return je(e.app)?Promise.reject(Mu(e)):async function(e,t){return yd(Vh(e),t)}(N(e),ad.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&wd(e),t})}const Sd="__sak";
|
|
2869
2955
|
/**
|
|
2870
2956
|
* @license
|
|
2871
2957
|
* Copyright 2019 Google LLC
|
|
@@ -2881,7 +2967,7 @@ function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2881
2967
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2882
2968
|
* See the License for the specific language governing permissions and
|
|
2883
2969
|
* limitations under the License.
|
|
2884
|
-
*/class
|
|
2970
|
+
*/class Ed{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Sd,"1"),this.storage.removeItem(Sd),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()}}
|
|
2885
2971
|
/**
|
|
2886
2972
|
* @license
|
|
2887
2973
|
* Copyright 2020 Google LLC
|
|
@@ -2897,7 +2983,7 @@ function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2897
2983
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2898
2984
|
* See the License for the specific language governing permissions and
|
|
2899
2985
|
* limitations under the License.
|
|
2900
|
-
*/class
|
|
2986
|
+
*/class Td extends Ed{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Dh(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),i=this.localCache[t];n!==i&&e(t,i,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 i=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},r=this.storage.getItem(n);Ph()&&r!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,10):i()}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]}}Td.type="LOCAL";const Id=Td;
|
|
2901
2987
|
/**
|
|
2902
2988
|
* @license
|
|
2903
2989
|
* Copyright 2020 Google LLC
|
|
@@ -2913,7 +2999,7 @@ function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2913
2999
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2914
3000
|
* See the License for the specific language governing permissions and
|
|
2915
3001
|
* limitations under the License.
|
|
2916
|
-
*/class
|
|
3002
|
+
*/class Cd extends Ed{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Cd.type="SESSION";const kd=Cd;
|
|
2917
3003
|
/**
|
|
2918
3004
|
* @license
|
|
2919
3005
|
* Copyright 2019 Google LLC
|
|
@@ -2946,7 +3032,7 @@ function(t,e,n){var i;Lf((null===(i=n.url)||void 0===i?void 0:i.length)>0,t,"inv
|
|
|
2946
3032
|
* See the License for the specific language governing permissions and
|
|
2947
3033
|
* limitations under the License.
|
|
2948
3034
|
*/
|
|
2949
|
-
class
|
|
3035
|
+
class Ad{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 Ad(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:i,data:r}=t.data,s=this.handlersMap[i];if(!(null==s?void 0:s.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:i});const o=Array.from(s).map(async e=>e(t.origin,r)),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:i,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)}}
|
|
2950
3036
|
/**
|
|
2951
3037
|
* @license
|
|
2952
3038
|
* Copyright 2020 Google LLC
|
|
@@ -2963,7 +3049,7 @@ class yg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
|
|
|
2963
3049
|
* See the License for the specific language governing permissions and
|
|
2964
3050
|
* limitations under the License.
|
|
2965
3051
|
*/
|
|
2966
|
-
function
|
|
3052
|
+
function Rd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}
|
|
2967
3053
|
/**
|
|
2968
3054
|
* @license
|
|
2969
3055
|
* Copyright 2019 Google LLC
|
|
@@ -2979,7 +3065,7 @@ function vg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2979
3065
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2980
3066
|
* See the License for the specific language governing permissions and
|
|
2981
3067
|
* limitations under the License.
|
|
2982
|
-
*/
|
|
3068
|
+
*/Ad.receivers=[];class xd{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 i="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let r,s;return new Promise((o,a)=>{const c=Rd("",20);i.port1.start();const l=setTimeout(()=>{a(new Error("unsupported_event"))},n);s={messageChannel:i,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(l),r=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(r),o(t.data.response);break;default:clearTimeout(l),clearTimeout(r),a(new Error("invalid_response"))}}},this.handlers.add(s),i.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[i.port2])}).finally(()=>{s&&this.removeMessageHandler(s)})}}
|
|
2983
3069
|
/**
|
|
2984
3070
|
* @license
|
|
2985
3071
|
* Copyright 2020 Google LLC
|
|
@@ -2995,7 +3081,7 @@ function vg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2995
3081
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2996
3082
|
* See the License for the specific language governing permissions and
|
|
2997
3083
|
* limitations under the License.
|
|
2998
|
-
*/function
|
|
3084
|
+
*/function Nd(){return window}
|
|
2999
3085
|
/**
|
|
3000
3086
|
* @license
|
|
3001
3087
|
* Copyright 2020 Google LLC.
|
|
@@ -3012,7 +3098,7 @@ function vg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
3012
3098
|
* See the License for the specific language governing permissions and
|
|
3013
3099
|
* limitations under the License.
|
|
3014
3100
|
*/
|
|
3015
|
-
function
|
|
3101
|
+
function Od(){return void 0!==Nd().WorkerGlobalScope&&"function"==typeof Nd().importScripts}
|
|
3016
3102
|
/**
|
|
3017
3103
|
* @license
|
|
3018
3104
|
* Copyright 2019 Google LLC
|
|
@@ -3029,7 +3115,7 @@ function Sg(){return void 0!==bg().WorkerGlobalScope&&"function"==typeof bg().im
|
|
|
3029
3115
|
* See the License for the specific language governing permissions and
|
|
3030
3116
|
* limitations under the License.
|
|
3031
3117
|
*/
|
|
3032
|
-
const
|
|
3118
|
+
const Ld="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Dd="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 Fd(e,t){return e.transaction([Pd],t?"readwrite":"readonly").objectStore(Pd)}function zd(){const e=indexedDB.open(Ld,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Pd,{keyPath:Dd})}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(Ld);return new Md(e).toPromise()}(),t(await zd()))})})}async function Ud(e,t,n){const i=Fd(e,!0).put({[Dd]:t,value:n});return new Md(i).toPromise()}function Vd(e,t){const n=Fd(e,!0).delete(t);return new Md(n).toPromise()}class Bd{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 zd()),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 Od()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ad._getInstance(Od()?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 xd(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 zd();return await Ud(e,Sd,"1"),await Vd(e,Sd),!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=>Ud(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=Fd(e,!1).get(t),i=await new Md(n).toPromise();return void 0===i?null:i.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=Fd(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:i,value:r}of e)n.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(r)&&(this.notifyListeners(i,r),t.push(i));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()}}Bd.type="LOCAL";const jd=Bd;new $u(3e4,6e4);
|
|
3033
3119
|
/**
|
|
3034
3120
|
* @license
|
|
3035
3121
|
* Copyright 2019 Google LLC
|
|
@@ -3046,7 +3132,7 @@ const Eg="firebaseLocalStorageDb",_g="firebaseLocalStorage",Ig="fbase_key";class
|
|
|
3046
3132
|
* See the License for the specific language governing permissions and
|
|
3047
3133
|
* limitations under the License.
|
|
3048
3134
|
*/
|
|
3049
|
-
class
|
|
3135
|
+
class Hd extends Zh{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 qd(e){const{auth:t,user:n}=e;return zu(n,t,"internal-error"),
|
|
3050
3136
|
/**
|
|
3051
3137
|
* @license
|
|
3052
3138
|
* Copyright 2019 Google LLC
|
|
@@ -3063,7 +3149,7 @@ class xg extends Vp{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
3063
3149
|
* See the License for the specific language governing permissions and
|
|
3064
3150
|
* limitations under the License.
|
|
3065
3151
|
*/
|
|
3066
|
-
async function(t,
|
|
3152
|
+
async function(e,t,n=!1){const{auth:i}=e;if(je(i.app))return Promise.reject(Mu(i));const r="reauthenticate";try{const s=await hh(e,vd(i,r,t,e),n);zu(s.idToken,i,"internal-error");const o=lh(s.idToken);zu(o,i,"internal-error");const{sub:a}=o;return zu(e.uid===a,i,"user-mismatch"),pd._forOperation(e,r,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Lu(i,"user-mismatch"),e}}(n,new Hd(e),e.bypassAuthState)}async function Gd(e){const{auth:t,user:n}=e;return zu(n,t,"internal-error"),async function(e,t,n=!1){const i=await hh(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return pd._forOperation(e,"link",i)}(n,new Hd(e),e.bypassAuthState)}
|
|
3067
3153
|
/**
|
|
3068
3154
|
* @license
|
|
3069
3155
|
* Copyright 2020 Google LLC
|
|
@@ -3079,7 +3165,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i
|
|
|
3079
3165
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3080
3166
|
* See the License for the specific language governing permissions and
|
|
3081
3167
|
* limitations under the License.
|
|
3082
|
-
*/class
|
|
3168
|
+
*/class Kd{constructor(e,t,n,i,r=!1){this.auth=e,this.resolver=n,this.user=i,this.bypassAuthState=r,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:i,tenantId:r,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:r||void 0,postBody:i||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 Gd;case"reauthViaPopup":case"reauthViaRedirect":return qd;default:Lu(this.auth,"internal-error")}}resolve(e){Vu(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Vu(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()}}
|
|
3083
3169
|
/**
|
|
3084
3170
|
* @license
|
|
3085
3171
|
* Copyright 2020 Google LLC
|
|
@@ -3095,7 +3181,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i
|
|
|
3095
3181
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3096
3182
|
* See the License for the specific language governing permissions and
|
|
3097
3183
|
* limitations under the License.
|
|
3098
|
-
*/const
|
|
3184
|
+
*/const Wd=new $u(2e3,1e4);class Qd extends Kd{constructor(e,t,n,i,r){super(e,t,i,r),this.provider=n,this.authWindow=null,this.pollId=null,Qd.currentPopupAction&&Qd.currentPopupAction.cancel(),Qd.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return zu(e,this.auth,"internal-error"),e}async onExecution(){Vu(1===this.filter.length,"Popup operations only handle one event");const e=Rd();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(Pu(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(Pu(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Qd.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(Pu(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,Wd.get())};e()}}Qd.currentPopupAction=null;
|
|
3099
3185
|
/**
|
|
3100
3186
|
* @license
|
|
3101
3187
|
* Copyright 2020 Google LLC
|
|
@@ -3112,7 +3198,7 @@ async function(t,e,n=!1){const{auth:i}=t;if(Pt(i.app))return Promise.reject(Af(i
|
|
|
3112
3198
|
* See the License for the specific language governing permissions and
|
|
3113
3199
|
* limitations under the License.
|
|
3114
3200
|
*/
|
|
3115
|
-
const
|
|
3201
|
+
const Jd="pendingRedirect",Yd=new Map;class Xd extends Kd{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=Yd.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return Eh(Jd,e.config.apiKey,e.name)}(t),i=function(e){return bh(e._redirectPersistence)}(e);if(!await i._isAvailable())return!1;const r="true"===await i._get(n);return await i._remove(n),r}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}Yd.set(this.auth._key(),e)}return this.bypassAuthState||Yd.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 Zd(e,t){Yd.set(e._key(),t)}async function ef(e,t,n=!1){if(je(e.app))return Promise.reject(Mu(e));const i=Vh(e),r=
|
|
3116
3202
|
/**
|
|
3117
3203
|
* @license
|
|
3118
3204
|
* Copyright 2021 Google LLC
|
|
@@ -3129,7 +3215,7 @@ const zg="pendingRedirect",Bg=new Map;class Vg extends Mg{constructor(t,e,n=!1){
|
|
|
3129
3215
|
* See the License for the specific language governing permissions and
|
|
3130
3216
|
* limitations under the License.
|
|
3131
3217
|
*/
|
|
3132
|
-
function(t
|
|
3218
|
+
function(e,t){return t?bh(t):(zu(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(i,t),s=new Xd(i,r,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,t)),o}
|
|
3133
3219
|
/**
|
|
3134
3220
|
* @license
|
|
3135
3221
|
* Copyright 2020 Google LLC
|
|
@@ -3145,7 +3231,7 @@ function(t,e){return e?hp(e):(Lf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3145
3231
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3146
3232
|
* See the License for the specific language governing permissions and
|
|
3147
3233
|
* limitations under the License.
|
|
3148
|
-
*/class
|
|
3234
|
+
*/class tf{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 rf(e);default:return!1}}
|
|
3149
3235
|
/**
|
|
3150
3236
|
* @license
|
|
3151
3237
|
* Copyright 2020 Google LLC
|
|
@@ -3161,7 +3247,7 @@ function(t,e){return e?hp(e):(Lf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3161
3247
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3162
3248
|
* See the License for the specific language governing permissions and
|
|
3163
3249
|
* limitations under the License.
|
|
3164
|
-
*/(
|
|
3250
|
+
*/(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!rf(e)){const i=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Pu(this.auth,i))}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(nf(e))}saveEventToCache(e){this.cachedEventUids.add(nf(e)),this.lastProcessedEventTime=Date.now()}}function nf(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function rf({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}
|
|
3165
3251
|
/**
|
|
3166
3252
|
* @license
|
|
3167
3253
|
* Copyright 2020 Google LLC
|
|
@@ -3178,7 +3264,7 @@ function(t,e){return e?hp(e):(Lf(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3178
3264
|
* See the License for the specific language governing permissions and
|
|
3179
3265
|
* limitations under the License.
|
|
3180
3266
|
*/
|
|
3181
|
-
const
|
|
3267
|
+
const sf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,of=/^https?/;async function af(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return Yu(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(cf(e))return}catch(e){}Lu(e,"unauthorized-domain")}function cf(e){const t=Bu(),{protocol:n,hostname:i}=new URL(t);if(e.startsWith("chrome-extension://")){const r=new URL(e);return""===r.hostname&&""===i?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&r.hostname===i}if(!of.test(n))return!1;if(sf.test(e))return i===e;const r=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}
|
|
3182
3268
|
/**
|
|
3183
3269
|
* @license
|
|
3184
3270
|
* Copyright 2020 Google LLC.
|
|
@@ -3194,7 +3280,7 @@ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Gg=/^https?/;async function Qg(t
|
|
|
3194
3280
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3195
3281
|
* See the License for the specific language governing permissions and
|
|
3196
3282
|
* limitations under the License.
|
|
3197
|
-
*/const
|
|
3283
|
+
*/const lf=new $u(3e4,6e4);function uf(){const e=Nd().___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 i,r,s;function o(){uf(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{uf(),n(Pu(e,"network-request-failed"))},timeout:lf.get()})}if(null===(r=null===(i=Nd().gapi)||void 0===i?void 0:i.iframes)||void 0===r?void 0:r.Iframe)t(gapi.iframes.getContext());else{if(!(null===(s=Nd().gapi)||void 0===s?void 0:s.load)){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Nd()[t]=()=>{gapi.load?o():n(Pu(e,"network-request-failed"))},Hh(`${jh.gapiScript}?onload=${t}`).catch(e=>n(e))}o()}}).catch(e=>{throw df=null,e})}let df=null;
|
|
3198
3284
|
/**
|
|
3199
3285
|
* @license
|
|
3200
3286
|
* Copyright 2020 Google LLC.
|
|
@@ -3211,7 +3297,7 @@ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Gg=/^https?/;async function Qg(t
|
|
|
3211
3297
|
* See the License for the specific language governing permissions and
|
|
3212
3298
|
* limitations under the License.
|
|
3213
3299
|
*/
|
|
3214
|
-
const
|
|
3300
|
+
const ff=new $u(5e3,15e3),pf={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},gf=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function mf(e){const t=e.config;zu(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?qu(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,i={apiKey:t.apiKey,appName:e.name,v:qe},r=gf.get(e.config.apiHost);r&&(i.eid=r);const s=e._getFrameworks();return s.length&&(i.fw=s.join(",")),`${n}?${C(i).slice(1)}`}async function vf(e){const t=await function(e){return df=df||hf(e),df}(e),n=Nd().gapi;return zu(n,e,"internal-error"),t.open({where:document.body,url:mf(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:pf,dontclear:!0},t=>new Promise(async(n,i)=>{await t.restyle({setHideOnLeave:!1});const r=Pu(e,"network-request-failed"),s=Nd().setTimeout(()=>{i(r)},ff.get());function o(){Nd().clearTimeout(s),n(t)}t.ping(o).then(o,()=>{i(r)})}))}
|
|
3215
3301
|
/**
|
|
3216
3302
|
* @license
|
|
3217
3303
|
* Copyright 2020 Google LLC.
|
|
@@ -3227,7 +3313,7 @@ const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={styl
|
|
|
3227
3313
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3228
3314
|
* See the License for the specific language governing permissions and
|
|
3229
3315
|
* limitations under the License.
|
|
3230
|
-
*/const
|
|
3316
|
+
*/const yf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class wf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function bf(e,t,n,i=500,r=600){const s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString();let a="";const c=Object.assign(Object.assign({},yf),{width:i.toString(),height:r.toString(),top:s,left:o}),l=w().toLowerCase();n&&(a=Ah(l)?"_blank":n),Ch(l)&&(t=t||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=w()){var t;return Lh(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(l)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(i)}
|
|
3231
3317
|
/**
|
|
3232
3318
|
* @license
|
|
3233
3319
|
* Copyright 2021 Google LLC
|
|
@@ -3243,7 +3329,7 @@ const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={styl
|
|
|
3243
3329
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3244
3330
|
* See the License for the specific language governing permissions and
|
|
3245
3331
|
* limitations under the License.
|
|
3246
|
-
*/(
|
|
3332
|
+
*/(t||"",a),new wf(null);const h=window.open(t||"",a,u);zu(h,e,"popup-blocked");try{h.focus()}catch(e){}return new wf(h)}const _f="__/auth/handler",Sf="emulator/auth/handler",Ef=encodeURIComponent("fac");async function Tf(e,t,n,i,r,s){zu(e.config.authDomain,e,"auth-domain-config-required"),zu(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:i,v:qe,eventId:r};if(t instanceof cd){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 ld){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(),l=c?`#${Ef}=${encodeURIComponent(c)}`:"";return`${function({config:e}){if(!e.emulator)return`https://${e.authDomain}/${_f}`;return qu(e,Sf)}
|
|
3247
3333
|
/**
|
|
3248
3334
|
* @license
|
|
3249
3335
|
* Copyright 2020 Google LLC
|
|
@@ -3259,7 +3345,7 @@ const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={styl
|
|
|
3259
3345
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3260
3346
|
* See the License for the specific language governing permissions and
|
|
3261
3347
|
* limitations under the License.
|
|
3262
|
-
*/(
|
|
3348
|
+
*/(e)}?${C(a).slice(1)}${l}`}const If="webStorageSupport";const Cf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=kd,this._completeRedirectFn=ef,this._overrideRedirectResult=Zd}async _openPopup(e,t,n,i){var r;Vu(null===(r=this.eventManagers[e._key()])||void 0===r?void 0:r.manager,"_initialize() not called before _openPopup()");return bf(e,await Tf(e,t,n,Bu(),i),Rd())}async _openRedirect(e,t,n,i){await this._originValidation(e);return function(e){Nd().location.href=e}(await Tf(e,t,n,Bu(),i)),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):(Vu(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 vf(e),n=new tf(e);return t.register("authEvent",t=>{zu(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 i;const r=null===(i=null==n?void 0:n[0])||void 0===i?void 0:i[If];void 0!==r&&t(!!r),Lu(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=af(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Dh()||kh()||Lh()}};var kf="@firebase/auth",Af="1.10.8";
|
|
3263
3349
|
/**
|
|
3264
3350
|
* @license
|
|
3265
3351
|
* Copyright 2020 Google LLC
|
|
@@ -3276,7 +3362,7 @@ const em=new Mf(5e3,15e3),nm="__/auth/iframe",im="emulator/auth/iframe",rm={styl
|
|
|
3276
3362
|
* See the License for the specific language governing permissions and
|
|
3277
3363
|
* limitations under the License.
|
|
3278
3364
|
*/
|
|
3279
|
-
class
|
|
3365
|
+
class Rf{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(){zu(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
|
|
3280
3366
|
/**
|
|
3281
3367
|
* @license
|
|
3282
3368
|
* Copyright 2020 Google LLC
|
|
@@ -3309,4 +3395,5 @@ class wm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3309
3395
|
* See the License for the specific language governing permissions and
|
|
3310
3396
|
* limitations under the License.
|
|
3311
3397
|
*/
|
|
3312
|
-
const bm=h("authIdTokenMaxAge")||300;let Sm=null;function Em(t=Bt()){const e=Dt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Dt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;Tf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:mm,persistence:[Ng,pg,mg]}),i=h("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(i,location.origin);if(location.origin===t.origin){const e=(r=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>bm)return;const i=null==e?void 0:e.token;Sm!==i&&(Sm=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(t,e,n){I(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,i){I(t).onIdTokenChanged(e,n,i)}(n,(t=>e(t)))}}var r;const s=(t=>{var e,n;return null===(n=null===(e=l())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return s&&Up(n,`http://${s}`),n}var _m;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const i=document.createElement("script");i.setAttribute("src",t),i.onload=e,i.onerror=t=>{const e=kf("internal-error");e.customData=t,n(e)},i.type="text/javascript",i.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(i)})),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="}),_m="Browser",Ot(new T("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),r=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Lf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:_m,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Cp(_m)},c=new Lp(n,i,r,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],i=(Array.isArray(n)?n:[n]).map(hp);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(i,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Ot(new T("auth-internal",(t=>(t=>new wm(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Vt(ym,vm,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}}(_m)),Vt(ym,vm,"esm2017");class Im extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Tm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class km extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Cm extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Am extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Rm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Lm="avatar not created";class Nm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Em(e),this.auth.setPersistence(pg)}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,i,r,s,o;try{const a=Fh(this.firestore,"user_logging",e.uid),c=await Dd(a),l=new Date,u=c.exists?c.data():null,h=null===(i=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===i?void 0:i.last_login;if(h&&pf(l).diff(pf(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(r=null==u?void 0:u.brands)||void 0===r?void 0:r[t])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[t]:{brand_id:t,last_login:l,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Fd(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 Tm;return await this.user.getIdToken()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Tm;return(await Dd(Fh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=Sd(Mh(this.firestore,"users"),_d(Yh(),"==",this.id));return new Promise((i=>{e=Ud(n,(async n=>{await t(n)&&(e(),i(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 cg(this.auth,t)}async confirmPasswordReset(t,e){await lg(this.auth,t,e)}}class xm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((i=>{n=Ud(t,(t=>{i(t),e&&n()}))})),unsubscribe:()=>n()}};const t=zt(Bd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",i=Dt("object"==typeof t?t:Bt(),"firestore").getImmediate({identifier:n});if(!i._initialized){const t=oe("firestore");t&&xh(i,...t)}return i}(t),this.user=new Nm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const i=Sd(Mh(this.firestore,t),e);return this.promisefyOnSnapshot(i,n)}getDocs(t,e){return Md(Sd(Mh(this.firestore,t),...e))}async getDoc(t,e){const n=Fh(this.firestore,t,e),i=await Dd(n);return i.exists()?i.data():null}}const Om=t=>{if(t.code===Ef)throw new Error("account has been disabled");throw new Error(t.message)};class Dm{static get endpoint(){return Bd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:i,useToken:r=!0}){const s=this.getUrl(e,r),o={method:n,headers:await this.getHeaders(t,r),credentials:"omit"};i&&(o.body=JSON.stringify(i));const a=await fetch(s,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,i){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:i})}static Put(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:i})}static Patch(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:i})}static Delete(t,e,n,i){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:i})}}const Pm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Mm{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 Tm;try{const i=await Dm.Get(this.user,`/styles/${t}/recommendation`),r=await i.json();return(null===(e=null==r?void 0:r.fits)||void 0===e?void 0:e.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(t){if((null==t?void 0:t.error)===Lm)throw new Im;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Dm.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 km;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new km;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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(e.length?r.measurement_locations.female.filter((t=>e.includes(t))):r.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 i=[_d("brand_id","==",this.brandId)];i.push(_d("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",i)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Om(t)}}async getColorwaySizeAssets(t,e){const n=[_d("brand_id","==",this.brandId)];t&&n.push(_d("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(_d("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 Om(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Om(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 Tm;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Am))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,i,r;try{const s=[_d("brand_id","==",this.brandId)];s.push(_d("style_id","==",t)),s.push(_d("size_id","==",e));return null===(r=null===(i=null===(n=(await this.firebase.getDocs("colorway_size_assets",s)).docs)||void 0===n?void 0:n[0])||void 0===i?void 0:i.data())||void 0===r?void 0:r.sku}catch(t){return Om(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Om(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 Om(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(i=this.getColorwaySizeAssetFromSku(t),i.then((t=>[null,t])).catch((t=>[t])));var i;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)===Lm)throw new Im;throw new Rm}}async awaitColorwaySizeAssetFrames(t){var e,n,i,r;if(!this.isLoggedIn)throw new Tm;const s=await this.user.watchUserProfileForFrames((async e=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[t])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&Pm(o[0])}));if(!(null===(r=null===(i=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===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new Am;return s.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Tm;if(!this.user.brandUserId)throw new Cm;await Dm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(e=null==r?void 0:r.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new Am;if(!await Pm(s[0]))throw new Am;return s}}var Fm;!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"}(Fm||(Fm={}));const Um={[Fm.ACROSS_BACK]:"Across back",[Fm.ACROSS_FRONT]:"Across front",[Fm.ACROSS_SHOULDER]:"Across shoulder",[Fm.ANKLE]:"Ankle",[Fm.ARMEYE]:"Armeye",[Fm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Fm.BACK_CROTCH_LENGTH]:"Back crotch length",[Fm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Fm.BELOW_KNEE]:"Below knee",[Fm.BICEP]:"Bicep",[Fm.BUST]:"Chest/Bust",[Fm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Fm.CALF]:"Calf",[Fm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Fm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Fm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Fm.ELBOW]:"Elbow",[Fm.FOREARM]:"Forearm",[Fm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Fm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Fm.HIGH_HIP]:"High hip",[Fm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Fm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Fm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Fm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Fm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Fm.INSEAM]:"Inseam",[Fm.KNEE]:"Knee",[Fm.LOW_HIP]:"Low hip",[Fm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Fm.MID_NECK]:"Mid neck",[Fm.NECK_AT_BASE]:"Neck at base",[Fm.SHOULDER_DROP]:"Shoulder drop",[Fm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Fm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Fm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Fm.THIGH]:"Thigh",[Fm.TOTAL_RISE_LENGTH]:"Total rise length",[Fm.UNDER_BUST]:"Under bust",[Fm.VERTICAL_TRUNK]:"Vertical trunk",[Fm.WAIST]:"Waist",[Fm.WRIST]:"Wrist"};var zm;!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"}(zm||(zm={}));const Bm={[zm.BLOUSES]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.COATS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.DRESSES]:[Fm.LOW_HIP,Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST],[zm.JACKETS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.PANTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.PUFFERS_AND_PARKAS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.SHORTS]:[Fm.LOW_HIP,Fm.WAIST,Fm.THIGH,Fm.INSEAM],[zm.SKIRTS]:[Fm.LOW_HIP,Fm.WAIST],[zm.SWEATERS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP],[zm.T_SHIRTS_AND_TANKS]:[Fm.BUST,Fm.ACROSS_SHOULDER,Fm.WAIST,Fm.LOW_HIP,Fm.HIGH_HIP]},Vm={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"},Hm={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"},jm={activewear:{leggings:zm.PANTS,joggers:zm.PANTS,sweatshirts:zm.SWEATERS},dresses:{a_line:zm.DRESSES,bodycon:zm.DRESSES,fit_and_flare:zm.DRESSES,knit:zm.DRESSES,shirt:zm.DRESSES,slip:zm.DRESSES,straight:zm.DRESSES,wrap:zm.DRESSES},jackets_and_coats:{denim_jackets:zm.JACKETS,parkas:zm.PUFFERS_AND_PARKAS,peacoats:zm.COATS,puffer_jackets:zm.PUFFERS_AND_PARKAS,raincoats:zm.COATS,rompers:zm.COATS,shackets:zm.JACKETS,trench_coats:zm.COATS},jeans:{bootcut:zm.PANTS,flared:zm.PANTS,mom:zm.PANTS,relaxed:zm.PANTS,skinny:zm.PANTS,slim:zm.PANTS,straight:zm.PANTS,tapered:zm.PANTS,wide_leg:zm.PANTS},jumpsuits_and_rompers:{boiler_suits:zm.DRESSES,denim:zm.DRESSES,jumpsuits:zm.DRESSES,overalls:zm.DRESSES,rompers:zm.DRESSES,unitards:zm.DRESSES},pants_and_shorts:{cigarette:zm.PANTS,culottes:zm.SHORTS,denim_shorts:zm.SHORTS,flared:zm.PANTS,joggers:zm.PANTS,leggings:zm.PANTS,skinny:zm.PANTS,wide_leg:zm.PANTS},skirts:{a_line_flared:zm.SKIRTS,denim:zm.SKIRTS,knit:zm.SKIRTS,pencil:zm.SKIRTS,pleated:zm.SKIRTS,skater:zm.SKIRTS,slip:zm.SKIRTS,wrap:zm.SKIRTS},suits_and_tailoring:{blazers:zm.JACKETS,suit_jackets:zm.JACKETS,suit_skirts:zm.SKIRTS,suit_trousers:zm.PANTS,suit_vests:zm.SWEATERS,trousers:zm.PANTS},sweaters:{cardigans:zm.SWEATERS,crewnecks:zm.SWEATERS,hoodies_and_zipups:zm.SWEATERS,sweatshirts:zm.SWEATERS,turtlenecks:zm.SWEATERS,v_necks:zm.SWEATERS},tops:{bodysuits:zm.BLOUSES,corsets_and_bustiers:zm.BLOUSES,polos:zm.T_SHIRTS_AND_TANKS,shirts_and_blouses:zm.BLOUSES,t_shirts:zm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zm.T_SHIRTS_AND_TANKS}};var qm;!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"}(qm||(qm={}));const $m={[qm.TOO_TIGHT]:"Too Tight",[qm.TIGHT]:"Tight",[qm.SLIGHTLY_TIGHT]:"Slightly Tight",[qm.PERFECT_FIT]:"Perfect Fit",[qm.SLIGHTLY_LOOSE]:"Slightly Loose",[qm.LOOSE]:"Loose",[qm.OVERSIZED]:"Oversized",[qm.TOO_SHORT]:"Too Short",[qm.SHORT]:"Short",[qm.SLIGHTLY_SHORT]:"Slightly Short",[qm.SLIGHTLY_LONG]:"Slightly Long",[qm.LONG]:"Long",[qm.TOO_LONG]:"Too Long"};var Km;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Km||(Km={}));var Wm=Object.freeze({__proto__:null,get AvatarState(){return Km},get MeasurementLocation(){return Fm},MeasurementLocationName:Um,get Classification(){return zm},ClassificationLocations:Bm,CategoryNames:Vm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Hm,Taxonomy:jm,get Fit(){return qm},FitNames:$m});class Gm{constructor(t){this.vtoMainDivId=t,this.isInit=!1,this.currentSliderValue=0,this.slider=null}init(){if(this.isInit)return;const t=document.getElementById(this.vtoMainDivId);if(!t)throw new Error(`Element with id ${this.vtoMainDivId} not found`);t.innerHTML='\n <div class="tfr-slider-wrapper">\n <img id="tfr-tryon-image" src="" />\n <input type="range" id="tfr-slider" />\n </div>\n ';const e=document.getElementById("tfr-tryon-image");this.slider=n("tfr-slider",((t,n)=>{console.debug("slider change",t,n),e.src=n,this.currentSliderValue=parseInt(t.value)})),this.isInit=!0}onNewFramesReady(t){if(this.isInit||this.init(),Array.isArray(t)&&t.length>0){const e=Math.min(this.currentSliderValue,t.length-1),n=this.slider.Load(t,e);if(n instanceof Error)return void console.error(n);const i=document.getElementById("tfr-slider");if(i&&this.currentSliderValue<t.length){i.value=this.currentSliderValue.toString();document.getElementById("tfr-tryon-image").src=t[this.currentSliderValue]}}}}var Qm="Back to sign in",Ym="Click here to download the app",Jm="Don't have an account?",Xm="Whoops! Looks like you don't have an avatar yet.",Zm="Email address",ty="Please enter a valid email address.",ey="Enter your email address, we will send you a link to reset your password.",ny="Forgot password?",iy="Have an account? Sign in",ry="Your avatar is loading...",sy="Unfortunately, that size is not available for try on.",oy="or",ay="Password",cy="Please enter a valid password (at least 7 characters).",ly="Return to Catalog Page",uy="Return to Product Page",hy="Return to site",dy="Please return to The Fitting Room app to create your avatar.",fy="Scan to download the app",py="Send",gy="Sign back in",my="Sign in",yy="Something went wrong. Try again!",vy="You have successfully logged out!",wy="The Fitting Room",by="Username or password is empty.",Sy="Username or password is incorrect.",Ey="End size uncertainty with",_y="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var Iy=[],Ty=[];function ky(t,e){if(t&&"undefined"!=typeof document){var n,i=!0===e.prepend?"prepend":"append",r=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(r){var o=Iy.indexOf(s);-1===o&&(o=Iy.push(s)-1,Ty[o]={}),n=Ty[o]&&Ty[o][i]?Ty[o][i]:Ty[o][i]=a()}else n=a();65279===t.charCodeAt(0)&&(t=t.substring(1)),n.styleSheet?n.styleSheet.cssText+=t:n.appendChild(document.createTextNode(t))}function a(){var t=document.createElement("style");if(t.setAttribute("type","text/css"),e.attributes)for(var n=Object.keys(e.attributes),r=0;r<n.length;r++)t.setAttribute(n[r],e.attributes[n[r]]);var o="prepend"===i?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}ky(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});ky('#fit-title{margin-bottom:20px;margin-top:-30px}#fit-subtitle,#fit-title{color:#209da7;font-size:24px;font-weight:700}#fit-subtitle{position:absolute;right:17px;top:100px}#fit-subtitle-mobile{color:#7d7d7d;font-size:24px;font-weight:700;margin-top:20px}#fit-outline-container{display:flex;justify-content:center}#fit-outline-inner{position:relative}#fit-outline-inner,#tfr-fit-outline-img{width:184px}#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right,#tfr-fit-outline-img{height:701px}#fit-outline-inner-left,#fit-outline-inner-right{position:relative;width:260px}#fit-outline-container .fit-outline-line{display:block}.fit-outline-line{background:#000;height:1px;position:absolute}.fit-outline-line-text{border-bottom:1px solid #000;font-size:24px;position:absolute}.fit-outline-line-chest-text{left:-11px;text-align:right;top:163px;width:254px}.fit-outline-line-n-waist-text{left:-11px;text-align:right;top:208px;width:254px}.fit-outline-line-p-waist-text{right:-10px;text-align:left;top:233px;width:253px}.fit-outline-line-h-hip-text{left:-3px;text-align:right;top:255px;width:246px}.fit-outline-line-l-hip-text{left:-3px;text-align:right;top:302px;width:246px}.fit-outline-line-thigh-text{right:3px;text-align:left;top:341px;width:240px}.fit-outline-line-chest{left:42px;top:194px;width:99px}.fit-outline-line-n-waist{left:50px;top:239px;width:83px}.fit-outline-line-p-waist{left:45px;top:264px;width:93px}.fit-outline-line-h-hip{left:30px;top:286px;width:122px}.fit-outline-line-l-hip{left:21px;top:333px;width:141px}.fit-outline-line-thigh-l{left:27px;top:372px;width:60px}.fit-outline-line-thigh-r{left:95px;top:372px;width:61px}#fit-line-container{position:relative;width:100%}#fit-line-text-container{align-items:center;display:flex;justify-content:space-between}.fit-line-item{font-weight:700;width:110px}.fit-line-item .light-text{font-weight:500}.fit-line-item-green{color:#209da7}#fit-line{display:flex;justify-content:space-around;margin-bottom:4px;margin-top:30px}#fit-line-1,#fit-line-2,#fit-line-3,#fit-line-4,#fit-line-5,#fit-line-6,#fit-line-7{background:#000;height:2px;position:relative;width:110px}#fit-line-3,#fit-line-4,#fit-line-5{background:#209da7}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before,#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{background:#000;border-radius:50%;content:"";height:12px;position:absolute;top:-5px;width:12px}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before{left:0}#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{right:0}#fit-line-1:before,#fit-line-2:before,#fit-line-6:before,#fit-line-7:before{background:#000}#fit-line-3:before,#fit-line-5:before{background:#209da7}#fit-line-2:before,#fit-line-6:before{display:none}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after{border-left:2px dashed #000;content:"";display:block;height:20px;left:50%;position:absolute;top:-20px}#fit-line-3:after,#fit-line-4:after,#fit-line-5:after{border-left:2px dashed #209da7}#fit-line-texts{display:flex;justify-content:space-between;padding:0 70px}#fit-line-texts div:nth-of-type(2){color:#209da7}.margin-top-10{margin-top:10px}.desktop-hidden{display:none}#cta-link{cursor:pointer;font-size:20px;margin:auto;text-decoration:underline;width:150px}.powered-by{align-items:center;display:flex;justify-content:center;margin-top:10px}@media screen and (max-width:599px){#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right{height:400px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.7)}.fit-line-item{font-size:10px;font-weight:500}.fit-outline-line-text{font-size:16px;line-height:31px}.fit-outline-line-chest-text,.fit-outline-line-n-waist-text{left:-11px;width:auto}.fit-outline-line-p-waist-text{right:-10px;width:auto}.fit-outline-line-h-hip-text,.fit-outline-line-l-hip-text{left:-3px;width:auto}.fit-outline-line-thigh-text{right:3px;width:auto}#fit-line{margin-top:10px}#fit-line-texts{font-size:12px;padding:0 15px}#cta-section{margin-top:-30px}#fit-line-2:before,#fit-line-6:before,.desktop-hidden{display:block}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after,.mobile-hidden{display:none}}',{});ky(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}#tfr-close-container{padding-right:10px}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{display:flex;margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}.tfr-door-icon,.tfr-user-icon{color:#209da7}.tfr-logged-in,.tfr-toggle-closed{display:none}.tfr-flex{display:flex}.tfr-gap{gap:4px}.tfr-items-center{align-items:center}.tfr-mb-2{margin-bottom:8px}#tfr-logged-out-overlay-container{position:relative}#tfr-logged-out-overlay{align-items:center;background:hsla(0,0%,100%,.8);bottom:0;display:flex;font-size:16px;font-weight:700;justify-content:center;left:0;line-height:16px;position:absolute;right:0;text-align:center;top:0}.tfr-slider-wrapper{align-items:center;display:flex;flex-direction:column}#tfr-slider{accent-color:var(--tfr-brand-color)}",{});ky("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});ky(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});ky("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-small-text{font-size:12px}.tfr-mobile-hidden{display:none}.tfr-modal-content{overflow:hidden}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});ky('#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-info-icon{cursor:pointer}#tfr-size-rec-subtitle{border-bottom:2px solid #000;font-size:18px;font-weight:700;text-align:center;width:100%}#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;padding-right:8px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:1;padding-left:8px;padding-right:8px;text-align:left}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active):not(.tfr-disabled){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img,.tfr-powered-by-logo svg{height:24px;width:12px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}.tfr-disabled{cursor:default}#tfr-login-to-view{cursor:pointer}.tfr-try-on-button{align-items:center;background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);cursor:pointer;display:flex;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);height:var(--tfr-size-selector-button-height);justify-content:center;margin-bottom:10px;margin-top:20px;max-width:200px;position:relative;transition:all .15s ease-in;width:100%}.tfr-try-on-button.loading,.tfr-try-on-button:disabled{cursor:not-allowed;opacity:.7}.tfr-try-on-button.loading:after{animation:spin 1s linear infinite;border:2px solid var(--tfr-size-selector-text-color);border-radius:50%;border-top:2px solid transparent;content:"";height:16px;margin-left:8px;position:absolute;width:16px}@keyframes spin{to{transform:rotate(1turn)}}',{});ky(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});ky(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});ky(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});ky(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const Cy='\n<svg class="tfr-door-icon" width="68" height="124" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="currentColor">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n</path>\n</svg>',Ay='<svg class="tfr-user-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_82_11365)">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z"\n fill="currentColor" fill-opacity="0.7" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z"\n fill="currentColor" fill-opacity="0.7" />\n </g>\n <defs>\n <clipPath id="clip0_82_11365">\n <rect width="16" height="16" fill="white" />\n </clipPath>\n </defs>\n</svg>',Ry=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const i=t/200;e.style.width=n+"%";const r=setInterval((()=>{n>=100?clearInterval(r):(n+=.5,e.style.width=n+"%")}),i)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${ry} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),Ly=t=>{const e=document.getElementById(t),n=document.querySelector("body");if(!e)throw new Error(`element with id ${t} not found`);let i;const r=t=>t?`\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${Ey}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${wy}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),e.style.display="none"},o=t=>{"Escape"===t.key&&s()},a=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),s())},c=()=>{e.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=e.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(t))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",o),document.removeEventListener("click",a)};return{open:t=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),e.innerHTML=(s=t.Body(),o=t.useFullModalContent,console.log({useFullModalContent:o}),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n ${r(o)}\n ${s}\n </div>\n </div>\n </div>\n </div>\n `),c(),t.Hook(),e.style.display="block",i=t},close:s,Content:()=>i}},Ny=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},i=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},r=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var t,s,o;if(e||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),e){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.removeEventListener("click",i),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",r)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${_y}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${e?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${fy}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${iy}</div>\n </div>`}\n </div>\n\n ${e?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${Ym}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${iy}</div>\n `:""}\n `,useFullModalContent:!0}};class xy{constructor(t,e,n,i){this.signIn=e,this.forgotPassword=n,this.submitTel=i,this.manager=Ly(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${vy}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${gy}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${hy}</span>\n </div>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${Xm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${dy}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Ry({timeoutMS:1e4}))}toScan(){this.manager.open(Ny({onSignInNav:()=>this.toSignIn(),onTelSubmit:t=>this.submitTel(t)}))}toSignIn(){this.manager.open((t=>{const{email:e}=t,n=e=>{e.preventDefault();const n=document.getElementById("email-input").value,i=document.getElementById("password-input").value;s(),t.onSignIn(n,i,o)},i=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},r=()=>{t.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.remove("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.remove("tfr-c-red")}));const t=document.querySelector("#tfr-form-error");t.classList.remove("tfr-d-block"),t.innerHTML=""},o=t=>{document.querySelectorAll(".tfr-fieldset-element").forEach((t=>{t.classList.add("tfr-fieldset-err")})),document.querySelectorAll(".tfr-label-element").forEach((t=>{t.classList.add("tfr-c-red")}));const e=document.querySelector("#tfr-form-error");e.innerHTML=t||"Something went wrong",e.classList.add("tfr-d-block")};return{Hook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.addEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,e,s,o;null===(t=document.getElementById("tfr-sign-in-form"))||void 0===t||t.removeEventListener("submit",n),null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",r)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${my}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Zm}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${e||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${ay}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${ny}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${Jm}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${my}\n </button>\n </form>\n `,useFullModalContent:!0}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((t=>{const e=()=>{const e=document.getElementById("tfr-email").value;t.onNavSignIn(e)},n=()=>{const e=document.getElementById("tfr-email").value;t.onPasswordReset(e)};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",e)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.removeEventListener("click",e)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${ey}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${Zm}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${Qm}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${py}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const i=()=>{t.onNavBack()},r=()=>{t.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",((t,e)=>{console.debug("slider change",t,e),a.src=e}));if(Array.isArray(t.frames)&&t.frames.length>0){const n=c.Load(t.frames);if(n instanceof Error)return void console.error(n);e=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",i),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",r)},Body:()=>'\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n ',useFullModalContent:!0}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},i=()=>{t.onClose()};return{Hook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.addEventListener("click",i)},Unhook:()=>{var t,e;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",n),null===(e=document.getElementById("tfr-close"))||void 0===e||e.removeEventListener("click",i)},Body:()=>(e||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${e||yy}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ly}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${uy}</span>\n </div>\n `),useFullModalContent:!0}})({error:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(t,e){this.manager.open((t=>{const e=()=>{t.onNavBack()},n=()=>{t.onClose()};return{Hook:()=>{var t,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var t,i;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var e,n,i;return console.debug("rendering size error modal",t),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${sy} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${oy} ${null===(i=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===i?void 0:i.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${ly}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${uy}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((t=>{const e=()=>t.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",e)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",e)},Body:()=>`\n <div>\n <div id="fit-title">Fit Scale</div>\n\n <div id="fit-line-container">\n <div id="fit-line-text-container">\n <div class="fit-line-item mobile-hidden">Too Tight</div>\n\n <div class="fit-line-item">\n <div>Tight <span class="light-text">or</span><br /> More fitted</div>\n\n <div class="desktop-hidden margin-top-10">Too Tight</div>\n </div>\n\n <div class="fit-line-item fit-line-item-green">Slightly tight <br /><span class="light-text">or</span> Fitted</div>\n <div class="fit-line-item fit-line-item-green">Perfect Fit</div>\n <div class="fit-line-item fit-line-item-green">Slightly loose <br /><span class="light-text">or</span> Less fitted</div>\n\n <div class="fit-line-item">\n <div>Loose <span class="light-text">or</span><br /> Not fitted</div>\n\n <div class="desktop-hidden margin-top-10">Oversized</div>\n </div>\n\n <div class="fit-line-item mobile-hidden">Oversized</div>\n </div>\n\n <div id="fit-line">\n <div id="fit-line-1" class="mobile-hidden"> </div>\n <div id="fit-line-2"> </div>\n <div id="fit-line-3"> </div>\n <div id="fit-line-4"> </div>\n <div id="fit-line-5"> </div>\n <div id="fit-line-6"> </div>\n <div id="fit-line-7" class="mobile-hidden"> </div>\n </div>\n\n <div id="fit-line-texts">\n <div>Poor Fit</div>\n <div>Acceptable Fit</div>\n <div>Poor Fit</div>\n </div>\n </div>\n\n <div id="fit-subtitle-mobile" class="desktop-hidden">Measurement Points</div>\n\n <div id="fit-outline-container">\n <div id="fit-outline-inner-left">\n <div class="fit-outline-line-text fit-outline-line-p-waist-text">Pant Waist</div>\n <div class="fit-outline-line-text fit-outline-line-thigh-text">Thigh</div>\n </div>\n\n <div id="fit-outline-inner">\n <div class="fit-outline-line fit-outline-line-chest"></div>\n <div class="fit-outline-line fit-outline-line-n-waist"></div>\n <div class="fit-outline-line fit-outline-line-p-waist"></div>\n <div class="fit-outline-line fit-outline-line-h-hip"></div>\n <div class="fit-outline-line fit-outline-line-l-hip"></div>\n <div class="fit-outline-line fit-outline-line-thigh-l"></div>\n <div class="fit-outline-line fit-outline-line-thigh-r"></div>\n\n <img id="tfr-fit-outline-img" src="https://assets.dev.thefittingroom.xyz/images/fit-outline.png" />\n </div>\n\n <div id="fit-outline-inner-right">\n <div id="fit-subtitle" class="mobile-hidden">Measurement Points</div>\n\n <div class="fit-outline-line-text fit-outline-line-chest-text">Chest/Bust</div>\n <div class="fit-outline-line-text fit-outline-line-n-waist-text">Natural Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low Hip</div>\n </div>\n </div>\n </div>\n\n <div id="cta-section">\n <div id="cta-link">Sign Up or Login</div>\n\n <div class="powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${Cy}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n `,useFullModalContent:!1}})({onSignInNav:()=>this.toScan(),onClose:()=>this.close()}))}navBack(){window.history.back()}}class Oy{constructor(t,e,n,i,r){this.onSignInClick=e,this.onSignOutClick=n,this.onFitInfoClick=i,this.onTryOnClick=r,this._sku="",this._styleId=null,this.isLoggedIn=!1,this.tfrLoggedInElements=[],this.tfrLoggedOutElements=[],this.tfrToggleOpenElements=[],this.tfrToggleClosedElements=[],this.isCollapsed=!1,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}get styleId(){return this._styleId}setStyleId(t){this._styleId=t}setIsLoggedIn(t){this.isLoggedIn=t,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",t?(this.tfrSizeHowItFits.style.opacity="1",this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach((t=>t.style.display="block")),this.tfrLoggedOutElements.forEach((t=>t.style.display="none")),this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelectContainer.style.opacity="1"):(this.tfrSizeHowItFits.style.opacity="0.4",this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach((t=>t.style.display="none")),this.tfrLoggedOutElements.forEach((t=>t.style.display="block")),this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.renderSizeRecSelectLoggedOut())}setLoading(t){t?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(t){t&&t.length?this.renderGarmentLocations(t):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e)}setError(){this.tfrSizeRecTitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(t){const e=document.getElementById(t);if(!e)throw new Error("Size rec main div not found");this.render(e),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrInfoIcon=document.getElementById("tfr-info-icon"),this.tfrLoginToView=document.getElementById("tfr-login-to-view"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container"),this.tfrLoggedInElements=document.querySelectorAll(".tfr-logged-in"),this.tfrLoggedOutElements=document.querySelectorAll(".tfr-logged-out"),this.tfrToggleOpenElements=document.querySelectorAll(".tfr-toggle-open"),this.tfrToggleClosedElements=document.querySelectorAll(".tfr-toggle-closed")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this)),this.tfrInfoIcon.addEventListener("click",this.onFitInfoClick),this.tfrLoginToView.addEventListener("click",this.onSignInClick);const t=document.getElementById("tfr-try-on-button");t&&t.addEventListener("click",(async()=>{if(t.classList.contains("loading"))return;const e=document.querySelector(".tfr-size-rec-select-button.active");if(!e)return;const n=Number(e.getAttribute("data-size-id"));if(Number.isNaN(n))return;t.classList.add("loading");const i=t.textContent;t.textContent=" ",t.setAttribute("disabled","true");try{const t=Array.from(document.querySelectorAll(".tfr-size-rec-select-button")),i=t.indexOf(e);if(null!==this.styleId){try{await this.onTryOnClick(this.styleId,n,!0)}catch(t){console.error(`Error trying on active size ${n}:`,t)}if(i>0){const e=t[i-1];await this._preloadNeighborVTO(e)}if(i>=0&&i<t.length-1){const e=t[i+1];await this._preloadNeighborVTO(e)}}}catch(t){console.error("Error during sequential try-on process:",t)}finally{t.classList.remove("loading"),t.textContent=i,t.removeAttribute("disabled")}}))}async _preloadNeighborVTO(t){var e;const n=Number(t.getAttribute("data-size-id"));if(!Number.isNaN(n))try{await this.onTryOnClick(this.styleId,n,!1)}catch(i){const r=(null===(e=t.textContent)||void 0===e?void 0:e.trim())||"N/A";console.error(`Error pre-loading try-on for size ${n} (button: ${r}):`,i)}}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button")||e.classList.contains("tfr-disabled"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach((t=>t.classList.remove("active"))),i.item(n).classList.add("active"),this.redraw(n);const r=Number(e.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r,!0)}renderSizeRec(t,e){this.tfrSizeRecSize.innerHTML=` ${t}`;const n=e.findIndex((({size:e})=>e===t));this.redraw=t=>this.renderSizeRecTable(e,t),this.redraw(n),this.renderSizeRecSelect(e,n)}renderSizeRecTable(t,e){const{locations:n}=t[e],i=n.map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=i}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((n,i)=>`<div class="tfr-size-rec-select-button ${i===e?"active":""}" data-index="${i}" data-size-id="${t[i].size_id}">${n}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecSelectLoggedOut(){const t=['<div class="tfr-size-rec-select-button tfr-disabled">M</div>','<div class="tfr-size-rec-select-button tfr-disabled active">L</div>','<div class="tfr-size-rec-select-button tfr-disabled">XL</div>'].join("");this.tfrSizeRecSelect.innerHTML=t}renderSizeRecTableRow(t,e,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${t}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${e}\n </div>\n </div>`}renderGarmentLocations(t){const e=t.map(((t,e)=>this.renderSizeRecTableRow(t,this.randomFit(e),!0))).join(""),n=`<div id="tfr-logged-out-overlay-container">\n <div id="tfr-logged-out-overlay">\n Login to reveal how this item will fit specifically at each area of your body in different sizes\n </div>\n <div>\n ${e}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(t){const e=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return e[t%e.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="block")),this.tfrToggleClosedElements.forEach((t=>t.style.display="none"))):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach((t=>t.style.display="none")),this.tfrToggleClosedElements.forEach((t=>t.style.display="block")))}render(t){const e=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div class="tfr-logged-out">\n <div class="tfr-flex tfr-gap tfr-mb-2 tfr-mobile-small-text">\n <div>Uncertain of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${Cy}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${Ay} Login to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-logged-in">\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n ${Ay} Sign up to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-toggle-open" style="width: 100%">\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n\n <div id="tfr-size-rec-subtitle">\n How it fits\n <span id="tfr-info-icon"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<rect width="13" height="13" fill="url(#pattern0_641_1375)"/>\n<defs>\n<pattern id="pattern0_641_1375" patternContentUnits="objectBoundingBox" width="1" height="1">\n<use xlink:href="#image0_641_1375" transform="scale(0.00793651)"/>\n</pattern>\n<image id="image0_641_1375" width="126" height="126" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAB+CAYAAADiI6WIAAAAAXNSR0IArs4c6QAADKtJREFUeF7tnc2S2zYSgLuh9VwzeYJVniDjJ7Asb06p8mhqj6nKDFN7j/wEkp/A4/MeqMllj9L4umWJfgIrT2D5CaK9ZlfATlOkLWn0g8aPCJLSJakxSIL4uhvdjQaIULFfKx42AeCiIcRflYImgDpXAE0E+n8ASP+25YcwUwrmgDAXAHMFOEOE2ULK358AzP8dXU2rNFRY5pdpxcNzAGgJFM8Q1IVScAEA9Dcfv7lCmCLgVCr5AQCmSXQ18/GgY9yzdOD/Fg9bEsWlUqqFkIIu7KcApoiYSCXvk+gqKawjBg8uBfgcNih141GjDYZv7RLS/kSCuiuDEAQLnsz4w1zbBcTrnfOyLSp/189QYH8h5YdQp4PgwC+1O4XdCVi7OSIzkKBehyYAwYAn4AqxpxS0OKNaorZBCUDh4Cn8aiDGFQa+KZtBCEBh4LM5vA+Av5ZIa112tVABKAR8Ox7eAOCbiszhNsKQOoHvry/vbG5icu1RwdfQrOsyObr2Hw18Kx7eiJOW7xOEo2q/d/AFzeWUTJkCpvn2qQScK7n4LM7O/pB//vmfJLqarxJI+3h29k1jsUjz+FKl6d8mKnUhV/P8uvpr1Q5vJUgK/9b6aHXLLRd7BU+mXQBOIF8gcd377H556lQhJkouKGnidNBIMFA0nqFSrSOlimcS1HOfsb838GkiBnDoy4FTAIkQOFpISSlSp6APyWe2AthqAF4/9MNX3oHgR77Sv17At+NhN/PaD40h698VwEwBDgDk22PD3tXRXAgQsPdl6Zf1VvsbZ1m/vsNbprdyDr4dDyk277nsKGk3NER/8vNLWg4N9vf87t2lkLLr2gr4gO8UvGvoZQG+KYk//PbumVzIvksBcA3fGXiX0MsKfJsA/G8hB66mAJfwnYB3CH0uAftJdPk2WHtu0DHKYbjyAVzBtwbvCjppuVp6saUtZ9onE2loi9gDBVRMYvVzAd8KvCPoldTyPVFAVyydX8vaQPVqHF3dmkqQMfgsTqfkjPFvGZ75TVQYd87jhaT9CDixnfuzJI9RrZ8ReEcZuVGWoDhq8sUjT9atl6lsjB9Sy1RpZPqbS1BPTaZHNviswx9t0rCZA/fa9G2rdF07vu89FPvbJGgow0fwWQrEBt+Oh7c2xRMn6I/F1h4+3o6jy1cchWCBzwooyDwZ/U7Qdw+bLXyp8Cb5Rb+gQxu87bx+gn5YVyzhs+Z7bfDtwSg2jUFP0A9Dz1vYwKdcyCTqPNd5mhZ4GxNfJPTmP//VAgHskBPVWfPTP/7+WWcAfbSxgY8Cb3Rq+A6CtzTxo3HUufIxODr3LCt4erd2PKJaBpNQj0z+d4e8/IPgTU18lpxhhxk6QHXblBl8WvUD+NEsyXPYy98LPtP2T7oDvdKO5WgY3F/rkjKDpxfMxp9yJuz0bqb1O9c99oI31faH4sZuCCtsZQefwafcPu1BYP0OOXo7wVto+2AcdSJWLz01rgJ4GpoX8WhiUtSxL5e/E7yJtoe26FIV8KYmf5/WbwVvqu1S4E1SwHagXQajKuBtTP4urd8K3lTbJ1HnO09W2+i2VQJvYfK3Tr2PwJtqu2qIVmhVsFUDb1gDsTWufwTeJEt3yIM0UlcHF1UNvKnWS4H95PpybRl8C/gRxe3bz4LbASNEbaeuVhG8odbPxhvT8Bp4k5uGqu0ODEawtzAJ7zadvDXwRk6dEJ3J9cv7YEepgh0zUVBAvB3ffC3WWAcf88w8xe2hefIV5Lz1lZ7Ho0/MPP58HHW+zW/2BbyJFIUWt9cFOr1n++6+B5JXq7dq7r+Abw/u34BSXc7gHVoI4Nzr1JY3AlnR6x+sq1bM/RfwL+LRR8U4G/bk1LGG3EtjrpNHB0hMos5T6kwK3iRpUwYzn4ZzDWAXh6I8axVZgaMrJS/u7n9VUrF200hQ31KRRgr+RTzsqOXpFdq/Mpj5Ksbxq4BMzL3KorAUPHd+XzUZ2pJSQMOqg88yeawpOg/rlho/GE1YR4puxIQFMNV6ZB3AGyhtWom71Ph4RN6hdnlPbi60Rr/ARnUAbzBNp/E8tuLhhQCkui7tX+4gaF9QUMM6gDeZ5+HsSRO5iZsyZevqAH7po40+cT7mQBYbuSFBmeL3GoEfZh920LKtKLCLXOdgM9mv9aSCGtUHPDPriniL7cGILS3vr8txOFFtwC+PgeckqgbIDeVCLbrYZlTqAp7r2dN0jewcfYC1dbtmkrqAN4jMZmTqWR4hhQLjn34sbCcpx12oEXg6JZyz1W2G7XikOINZlhie3qlG4OkgJdYSLRv8OOoc3GHLESSfbesCPsu+shT4BH6L5BV9MIKJMnAt9wn8CbyenJ1Mvd44HbuVd40/OXfHRnr4eSYLNadwrgKm3qB0jh/HZ8dnTg/LYfEt6uLVG6ywTvkp2xLtnDmB3658acqWu21K9xy14vW9Pgkc7tI6AIxOy7IVmONNltbZhRgkLUUeWsixJHUx9dwV1rQQg7ukBwCP9lpzYByzbV3At7mbXRuiRcWW3JUdKEssXwfwJjE8RWan8uqSz/EGFntZXk3vzd18V5a6uzpoPNexy4tlT1uoSq/xvF3O61uozDZNprsuj+mscZ9VdY038c/WNk2aOAgUEoRebVt18CZH0+W7nCt9MELVwXPj90cHI6SlO2ZHoQRt7qsM3sTMrzrltocfPToxkTsP+2xfZfAmZn51T8TmcWes7dKhZ/GqDd7uaLqNAw6Ze7AAKIv3PImujD5s61Pbq1xebZC0oeFYO8W60keaVlXjuU4dUd/c+vb4EGPuzpqAtb6K4LnVNin0LSeQPgZvcGJiqHvmqwjeRNu3HU237UMFtB2H9mFpn4lDUhXiXF818CbanrGhDxCufYrM5adJtL9r6tupy+9fNfDcdfdsHPQ+TUKNTSULQL0aR1eskxZ9CkGVwJvE7bu0nf6+cwMke6l2STCIL0xWTeMtvu+78xuAO8Gban1Ijl5VNJ5bCZ0L/r5jZ/dueTbUegoggjD5VQDfjoddMPjE6GbCZnNK3QveaCEgIJNfdvCmX5jcN7fnAnDwkIN2fP8GgPcBg+zms2y7VWHFGmUGn9VI0ImjrC+C7fPkV7X+IPisA+y4PntIoTX4ZQbfjkd0jHyHG/Xoft/3IHh6cCse3gjeOWpf+itBvU6iqz73BVy0Lyv4djzsA2DPZAx0PyChBZ46YO7opVm9QuCXEbwN9EMOHcvU541tHI3M2Tg6/LKBt4Gua+K1nbtVKbEx+UXBNzGXRVxjAz0dW+Yn3LVNfT4YFl5+eouizH4RMHWfaQsdAG/H0devSOo8lw2evHwE/Mj8yuFaX07wvw6HLfTMxD/l7nFgg8+8fNpoSTEma+l2QxJHElTE7bCONJehTRYm04nT7JAtfz/uvG7k3G0Opmkuf+M+lOShmr21teIygLPpo8Wiy9pjbU4SN9L4FU+/K8zyyKsvMAdQr0NazrWBeujaLPdOMbqNtQQJ2E+iy9eHnrfr363A003b8X3voarLRYJmkM39ldR+0vIGYsz6zNsOarbQ6bbW4B3Dn6HA/vvryztTSQ7xOldavoyK7DQ9Hx8n4B3Dp9vR3E+OX5D1+rrCRX6QQuy50HKX0J1pfD4QDs1+ekuFkCiVpntLJQCugbuG7hy8B81fFYC3SXQ10tW2Itr5AO4DuhfwvuBnIFMfYCHlh1BCwGU8DlQlc224dr5XRiVgN4ncf/XL2Ry/2XuS/gVgbJPh2zciNA0IxEERQkCwG0Jcg1IdV/P3lnedq4boTH5++cGH9fIGnjpLIQwCTnzBzweENvwjYiKVpEFKXGcDCTS9jkDxTCnVQoALHzBW3memPCe2vILP4J8LEBTrd30O1sa9ZwphhoBTRJgtpPw9nyqoBHxTMDKw508Azv8L0BSUXEHxPYJqKoKsjMqfDF8XbyVIcmi9lqx5B5+/PS3pImDPt/YbjnYIl82lwm7yy3FyGEcDn5t+gdgDBTchjHQofaC9CGqZtzha1vKo4E/a/0jU5lJgNykgU1kI+JP2p5H0UebyXVatMPAr2t+sk/kvwqxvg184+LoIAAGHhuj7isu5/kow4CsqABSSjVRDDEIBno9zcOBXBYCSJiUNAWcScAAgaX3BazzO1fTgwa++0A+/vXu2kPKG0qMB5wHmgDhQAkehaXfQc7yu5C6FgHLk/lOnh/qUp4rLAnv1fYI19YcGPQ8JUTS+RxICpS7S9KplLdue584z0FOFmCi5oBXCIM24ztiVGvy2F2zFw4snjcY3kgSBcuxKNRHgXAKc03/3LJ2mWTMEmFHZMiDOKc8vAWf4l8Z0/NOPn3UGtCxt/g+79EmQczmdsgAAAABJRU5ErkJggg=="/>\n</defs>\n</svg>\n</span>\n </div>\n\n <div id="tfr-size-rec-table"></div>\n\n <div id="tfr-try-on-button" class="tfr-try-on-button">Try On</div>\n </div>\n </div>\n\n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-toggle-open">\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${Cy}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Dy{constructor(t,e,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[Wm.Fit.PERFECT_FIT,Wm.Fit.SLIGHTLY_LOOSE,Wm.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Oy(t,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(t)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(t){this.sizeRecComponent.setStyleId(t)}setIsLoggedIn(t){this.sizeRecComponent.setIsLoggedIn(t)}async setGarmentLocations(t=[]){this.sizeRecComponent.setLoading(!0);const e=await this.getGarmentLocations(t);console.debug("locations",e),console.debug("filledLocations",t),this.sizeRecComponent.setGarmentLocations(e||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const t=await this.getRecommenedSize();if(!t)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(t),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(t){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,t)}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(e.id,t)}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku),e=await this.getRecommendedSizes(String(t.style_id));return this.setStyleId(t.style_id),e}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku),e=await this.getRecommendedSizes(String(t.id));return this.setStyleId(t.id),e}catch(t){return console.error(t),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(t){const e=await this.tfrShop.getRecommendedSizes(t);return e?{recommended:e.recommended_size.size_value.name,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).size_value.name,size_id:t.size_id,locations:t.measurement_location_fits.map((t=>({fit:"string"==typeof t.fit_label&&t.fit_label?t.fit_label:Wm.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:this.tfrShop.getMeasurementLocationName(t.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(t.measurement_location)}))).sort(((t,e)=>t.sortOrder<e.sortOrder?-1:1))})))}:null}setCssVariables(t){const e=document.querySelector(":root");t.brandColor&&e.style.setProperty("--tfr-brand-color",t.brandColor),t.black&&e.style.setProperty("--tfr-black",t.black),t.red&&e.style.setProperty("--tfr-red",t.red),t.white&&e.style.setProperty("--tfr-white",t.white),t.muted&&e.style.setProperty("--tfr-muted",t.muted),t.dark&&e.style.setProperty("--tfr-dark",t.dark),t.grey&&e.style.setProperty("--tfr-grey",t.grey),t.lightGrey&&e.style.setProperty("--tfr-light-grey",t.lightGrey),t.mainBorderColor&&e.style.setProperty("--tfr-main-border-color",t.mainBorderColor),t.mainBorderRadius&&e.style.setProperty("--tfr-main-border-radius",t.mainBorderRadius),t.mainBorderWidth&&e.style.setProperty("--tfr-main-border-width",t.mainBorderWidth),t.mainBgColor&&e.style.setProperty("--tfr-main-bg-color",t.mainBgColor),t.mainWidth&&e.style.setProperty("--tfr-main-width",t.mainWidth),t.mainVPadding&&e.style.setProperty("--tfr-main-v-padding",t.mainVPadding),t.mainHPadding&&e.style.setProperty("--tfr-main-h-padding",t.mainHPadding),t.mainFont&&e.style.setProperty("--tfr-main-font",t.mainFont),t.titleFont&&e.style.setProperty("--tfr-title-font",t.titleFont),t.subtitleFont&&e.style.setProperty("--tfr-subtitle-font",t.subtitleFont),t.rowFont&&e.style.setProperty("--tfr-row-font",t.rowFont),t.ctaFont&&e.style.setProperty("--tfr-cta-font",t.ctaFont),t.sizeSelectorTextColor&&e.style.setProperty("--tfr-size-selector-text-color",t.sizeSelectorTextColor),t.sizeSelectorFontSize&&e.style.setProperty("--tfr-size-selector-font-size",t.sizeSelectorFontSize),t.sizeSelectorFontWeight&&e.style.setProperty("--tfr-size-selector-font-weight",t.sizeSelectorFontWeight),t.sizeSelectorBgColor&&e.style.setProperty("--tfr-size-selector-bg-color",t.sizeSelectorBgColor),t.sizeSelectorBorderColor&&e.style.setProperty("--tfr-size-selector-border-color",t.sizeSelectorBorderColor),t.sizeSelectorBorderWidth&&e.style.setProperty("--tfr-size-selector-border-width",t.sizeSelectorBorderWidth),t.sizeSelectorBgColorHover&&e.style.setProperty("--tfr-size-selector-bg-color-hover",t.sizeSelectorBgColorHover),t.sizeSelectorBgColorActive&&e.style.setProperty("--tfr-size-selector-bg-color-active",t.sizeSelectorBgColorActive),t.sizeSelectorButtonHeight&&e.style.setProperty("--tfr-size-selector-button-height",t.sizeSelectorButtonHeight),t.sizeSelectorButtonActiveHeight&&e.style.setProperty("--tfr-size-selector-button-active-height",t.sizeSelectorButtonActiveHeight),t.sizeSelectorButtonActiveBorderColor&&e.style.setProperty("--tfr-size-selector-button-active-border-color",t.sizeSelectorButtonActiveBorderColor),t.sizeSelectorButtonActiveBorderWidth&&e.style.setProperty("--tfr-size-selector-button-active-border-width",t.sizeSelectorButtonActiveBorderWidth),t.sizeSelectorButtonRadius&&e.style.setProperty("--tfr-size-selector-button-radius",t.sizeSelectorButtonRadius),t.sizeSelectorButtonShadow&&e.style.setProperty("--tfr-size-selector-button-shadow",t.sizeSelectorButtonShadow)}}var Py;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Py||(Py={}));class My{constructor(t,e,n,i,r={},s,o){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const a=o||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",a),this.tfrModal=new xy(e,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Bd.getInstance().setEnv(e),new Mm(t,new xm)))(Number(this.shopId),a),this.tfrSizeRec=new Dy(n,s,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.bind(this)),i&&(this.vtoComponent=new Gm(i))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(t){const e=await this.getStyle(t);return Boolean(null==e?void 0:e.is_published)}setSku(t){this.tfrSizeRec.setSku(t),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var t,e;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(t=this.hooks)||void 0===t?void 0:t.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var t;await this.tfrShop.user.logout(),(null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(t,e,n){var i;if(0==t.length||0==e.length)return n(by);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(ty);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(cy);try{await this.tfrShop.user.login(t,e),(null===(i=this.hooks)||void 0===i?void 0:i.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(Sy)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(yy)}}async forgotPassword(t){await this.tfrShop.user.sendPasswordResetEmail(t),this.tfrModal.toSignIn()}async passwordReset(t,e){await this.tfrShop.user.confirmPasswordReset(t,e),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(t){return this.tfrShop.getMeasurementLocationsFromSku(t)}onSignInClick(){this.tfrModal.toScan()}onFitInfoClick(){this.tfrModal.toFitInfo()}async onTryOnClick(t,e,n=!0){if(!this.vtoComponent)return console.error("VtoComponent is not initialized. Please check if the vtoMainDivId is correct.");const i=await this.shop.tryOn(t,e);if(n)try{this.vtoComponent.init(),this.vtoComponent.onNewFramesReady(i)}catch(t){console.error("Error initializing VTO:",t),this.tfrModal.onError(yy)}}onUserProfileChange(t){var e,n,i,r;switch(t.avatar_status){case Py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Xm),this.tfrModal.onNotCreated();break;case Py.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Py.CREATED:(null===(i=this.hooks)||void 0===i?void 0:i.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(r=this.hooks)||void 0===r?void 0:r.onError)&&this.hooks.onError(yy),this.tfrModal.onError(yy)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges((t=>this.onUserProfileChange(t))))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var t,e;const n=await this.getStyle(this.sku),i=(null===(e=null===(t=null==n?void 0:n.sizes)||void 0===t?void 0:t[0])||void 0===e?void 0:e.garment_measurements.map((t=>t.measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(i)}async getStyle(t){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(t);return await this.tfrShop.getStyle(e.style_id)}catch(e){try{return await this.tfrShop.getStyleByBrandStyleId(t)}catch(t){return null}}}}const Fy=async({shopId:t,modalDivId:e,sizeRecMainDivId:n,vtoMainDivId:i,hooks:r={},cssVariables:s={},env:o="dev"})=>{const a=new My(t,e,n,i,r,s,o);return await a.onInit(),a};export{n as InitImageSlider,Fy as initFittingRoom};
|
|
3398
|
+
const xf=d("authIdTokenMaxAge")||300;let Nf=null;function Of(e=Ke()){const t=Be(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=Be(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(T(n.getOptions(),null!=t?t:{}))return e;Lu(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:Cf,persistence:[jd,Id,kd]}),i=d("authTokenSyncURL");if(i&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(i,location.origin);if(location.origin===e.origin){const t=(r=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>xf)return;const i=null==t?void 0:t.token;Nf!==i&&(Nf=i,await fetch(r,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});!function(e,t,n){N(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,i){N(e).onIdTokenChanged(t,n,i)}(n,e=>t(e))}}var r;const s=u("auth");return s&&Jh(n,`http://${s}`),n}var Lf,Pf;Lf={loadJS:e=>new Promise((t,n)=>{const i=document.createElement("script");var r,s;i.setAttribute("src",e),i.onload=t,i.onerror=e=>{const t=Pu("internal-error");t.customData=e,n(t)},i.type="text/javascript",i.charset="UTF-8",(null!==(s=null===(r=document.getElementsByTagName("head"))||void 0===r?void 0:r[0])&&void 0!==s?s:document).appendChild(i)}),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="},jh=Lf,Pf="Browser",Ve(new O("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),r=e.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;zu(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:Pf,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Mh(Pf)},c=new Uh(n,i,r,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],i=(Array.isArray(n)?n:[n]).map(bh);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(i,null==t?void 0:t.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Ve(new O("auth-internal",e=>(e=>new Rf(e))(Vh(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),We(kf,Af,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}}(Pf)),We(kf,Af,"esm2017");class Df extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Mf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Ff extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class zf 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 Vf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Bf="avatar not created";class jf{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Of(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,i,r,s,o;try{const a=Wc(this.firestore,"user_logging",t.uid),c=await Hl(a),l=new Date,u=c.exists?c.data():null,h=null===(i=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[e])||void 0===i?void 0:i.last_login;if(h&&Su(l).diff(Su(1e3*h.seconds),"seconds")<=10080)return;const d=null!==(o=null===(s=null===(r=null==u?void 0:u.brands)||void 0===r?void 0:r[e])||void 0===s?void 0:s.logins)&&void 0!==o?o:[];d.push(l);const f={brands:{[e]:{brand_id:e,last_login:l,logins:d}},last_brand_id:e,created_at:c.exists()?c.data().created_at:l,updated_at:l};await Gl(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 Mf;return await this.user.getIdToken()}get userId(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Mf;return this.user.uid}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Mf;return(await Hl(Wc(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(e){let t;const n=xl(Kc(this.firestore,"users"),Ol(rl(),"==",this.id));return t=Kl(n,t=>e(t.docs[0].data())),()=>t()}watchUserProfileForFrames(e){let t;const n=xl(Kc(this.firestore,"users"),Ol(rl(),"==",this.id));return new Promise(i=>{t=Kl(n,async n=>{await e(n)&&(t(),i(n.docs[0].data()))})})}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await _d(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=Vh(e),i={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Qh(n,i,"getOobCode",nd)}(this.auth,e)}async confirmPasswordReset(e,t){await bd(this.auth,e,t)}}class Hf{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise(i=>{n=Kl(e,e=>{i(e),t&&n()})}),unsubscribe:()=>n()}};const e=Ge(Ql.getInstance().firebase);this.firestore=el(e),this.user=new jf(this.firestore,e)}onInit(e){return this.user.onInit(e)}query(e,t,n=!0){const i=xl(Kc(this.firestore,e),t);return this.promisefyOnSnapshot(i,n)}getDocs(e,t){return ql(xl(Kc(this.firestore,e),...t))}async getDoc(e,t){const n=Wc(this.firestore,e,t),i=await Hl(n);return i.exists()?i.data():null}}const $f=e=>{if(e.code===xu)throw new Error("account has been disabled");throw new Error(e.message)};class qf{static get endpoint(){return Ql.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:i,useToken:r=!0}){const s=this.getUrl(t,r),o={method:n,headers:await this.getHeaders(e,r),credentials:"omit"};i&&(o.body=JSON.stringify(i));const a=await fetch(s,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,i){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:i})}static Put(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:i})}static Patch(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:i})}static Delete(e,t,n,i){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:i})}}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 Mf;try{const i=await qf.Get(this.user,`/styles/${e}/recommendation`),r=await i.json();return(null===(t=null==r?void 0:r.fits)||void 0===t?void 0:t.length)&&(null===(n=null==r?void 0:r.recommended_size)||void 0===n?void 0:n.id)?r:null}catch(e){if((null==e?void 0:e.error)===Bf)throw new Df;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 Ff;return Array.from(t.values())[0]}async getColorwaySizeAssetFromBrandStyleId(e){const t=await this.getColorwaySizeAssets(e);if(!(null==t?void 0:t.size))throw new Ff;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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(t.length?r.measurement_locations.female.filter(e=>t.includes(e)):r.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 i=await this.getStyle(n.style_id);if(!i)throw new Error("Style category not found for style id");const r=await this.getGetTaxonomy(i.style_garment_category_id);if(!r)throw new Error("Taxonomy not found for style garment category id");return(t.length?r.measurement_locations.female.filter(e=>t.includes(e)):r.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 i=[Ol("brand_id","==",this.brandId)];i.push(Ol("brand_style_id","==",e));return null===(n=null===(t=(await this.firebase.getDocs("styles",i)).docs)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data()}catch(e){return $f(e)}}async getColorwaySizeAssets(e,t){const n=[Ol("brand_id","==",this.brandId)];e&&n.push(Ol("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(Ol("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 $f(e)}}async getStyle(e){try{return await this.firebase.getDoc("styles",String(e))}catch(e){return $f(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 Mf;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,i,r;try{const s=[Ol("brand_id","==",this.brandId)];s.push(Ol("style_id","==",e)),s.push(Ol("size_id","==",t));return null===(r=null===(i=null===(n=(await this.firebase.getDocs("colorway_size_assets",s)).docs)||void 0===n?void 0:n[0])||void 0===i?void 0:i.data())||void 0===r?void 0:r.sku}catch(e){return $f(e)}}async getGetTaxonomy(e){try{return await this.firebase.getDoc("style_garment_categories",String(e))}catch(e){return $f(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 $f(e)}}async requestThenGetColorwaySizeAssetFrames(e){const[t,n]=await(i=this.getColorwaySizeAssetFromSku(e),i.then(e=>[null,e]).catch(e=>[e]));var i;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)===Bf)throw new Df;throw new Vf}}async awaitColorwaySizeAssetFrames(e){var t,n,i,r;if(!this.isLoggedIn)throw new Mf;const s=await this.user.watchUserProfileForFrames(async t=>{var n,i,r,s;const o=null===(s=null===(r=null===(i=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===i?void 0:i[this.brandId])||void 0===r?void 0:r[e])||void 0===s?void 0:s.frames;return!!(null==o?void 0:o.length)&&Gf(o[0])});if(!(null===(r=null===(i=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===i?void 0:i.frames)||void 0===r?void 0:r.length))throw new Uf;return s.vto[this.brandId][e].frames}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Mf;if(!this.user.brandUserId)throw new zf;await qf.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,i;const r=await this.user.getUserProfile(),s=(null===(i=null===(n=null===(t=null==r?void 0:r.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===i?void 0:i.frames)||[];if(!s.length)throw new Uf;if(!await Gf(s[0]))throw new Uf;return s}}var Wf;!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"}(Wf||(Wf={}));const Qf={[Wf.ACROSS_BACK]:"Across back",[Wf.ACROSS_FRONT]:"Across front",[Wf.ACROSS_SHOULDER]:"Across shoulder",[Wf.ANKLE]:"Ankle",[Wf.ARMEYE]:"Armeye",[Wf.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Wf.BACK_CROTCH_LENGTH]:"Back crotch length",[Wf.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Wf.BELOW_KNEE]:"Below knee",[Wf.BICEP]:"Bicep",[Wf.BUST]:"Chest/Bust",[Wf.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Wf.CALF]:"Calf",[Wf.CB_NECK_TO_WAIST]:"Cb neck to waist",[Wf.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Wf.CF_NECK_TO_WAIST]:"Cf neck to waist",[Wf.ELBOW]:"Elbow",[Wf.FOREARM]:"Forearm",[Wf.FRONT_CROTCH_LENGTH]:"Front crotch length",[Wf.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Wf.HIGH_HIP]:"High hip",[Wf.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Wf.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Wf.HSP_TO_BUST_POINT]:"Hsp to bust point",[Wf.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Wf.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Wf.INSEAM]:"Inseam",[Wf.KNEE]:"Knee",[Wf.LOW_HIP]:"Low hip",[Wf.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Wf.MID_NECK]:"Mid neck",[Wf.NECK_AT_BASE]:"Neck at base",[Wf.SHOULDER_DROP]:"Shoulder drop",[Wf.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Wf.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Wf.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Wf.THIGH]:"Thigh",[Wf.TOTAL_RISE_LENGTH]:"Total rise length",[Wf.UNDER_BUST]:"Under bust",[Wf.VERTICAL_TRUNK]:"Vertical trunk",[Wf.WAIST]:"Waist",[Wf.WRIST]:"Wrist"};var Jf;!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"}(Jf||(Jf={}));const Yf={[Jf.BLOUSES]:[Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST,Wf.LOW_HIP,Wf.HIGH_HIP],[Jf.COATS]:[Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST,Wf.LOW_HIP,Wf.HIGH_HIP],[Jf.DRESSES]:[Wf.LOW_HIP,Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST],[Jf.JACKETS]:[Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST,Wf.LOW_HIP,Wf.HIGH_HIP],[Jf.PANTS]:[Wf.LOW_HIP,Wf.WAIST,Wf.THIGH,Wf.INSEAM],[Jf.PUFFERS_AND_PARKAS]:[Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST,Wf.LOW_HIP,Wf.HIGH_HIP],[Jf.SHORTS]:[Wf.LOW_HIP,Wf.WAIST,Wf.THIGH,Wf.INSEAM],[Jf.SKIRTS]:[Wf.LOW_HIP,Wf.WAIST],[Jf.SWEATERS]:[Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST,Wf.LOW_HIP,Wf.HIGH_HIP],[Jf.T_SHIRTS_AND_TANKS]:[Wf.BUST,Wf.ACROSS_SHOULDER,Wf.WAIST,Wf.LOW_HIP,Wf.HIGH_HIP]},Xf={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"},Zf={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"},ep={activewear:{leggings:Jf.PANTS,joggers:Jf.PANTS,sweatshirts:Jf.SWEATERS},dresses:{a_line:Jf.DRESSES,bodycon:Jf.DRESSES,fit_and_flare:Jf.DRESSES,knit:Jf.DRESSES,shirt:Jf.DRESSES,slip:Jf.DRESSES,straight:Jf.DRESSES,wrap:Jf.DRESSES},jackets_and_coats:{denim_jackets:Jf.JACKETS,parkas:Jf.PUFFERS_AND_PARKAS,peacoats:Jf.COATS,puffer_jackets:Jf.PUFFERS_AND_PARKAS,raincoats:Jf.COATS,rompers:Jf.COATS,shackets:Jf.JACKETS,trench_coats:Jf.COATS},jeans:{bootcut:Jf.PANTS,flared:Jf.PANTS,mom:Jf.PANTS,relaxed:Jf.PANTS,skinny:Jf.PANTS,slim:Jf.PANTS,straight:Jf.PANTS,tapered:Jf.PANTS,wide_leg:Jf.PANTS},jumpsuits_and_rompers:{boiler_suits:Jf.DRESSES,denim:Jf.DRESSES,jumpsuits:Jf.DRESSES,overalls:Jf.DRESSES,rompers:Jf.DRESSES,unitards:Jf.DRESSES},pants_and_shorts:{cigarette:Jf.PANTS,culottes:Jf.SHORTS,denim_shorts:Jf.SHORTS,flared:Jf.PANTS,joggers:Jf.PANTS,leggings:Jf.PANTS,skinny:Jf.PANTS,wide_leg:Jf.PANTS},skirts:{a_line_flared:Jf.SKIRTS,denim:Jf.SKIRTS,knit:Jf.SKIRTS,pencil:Jf.SKIRTS,pleated:Jf.SKIRTS,skater:Jf.SKIRTS,slip:Jf.SKIRTS,wrap:Jf.SKIRTS},suits_and_tailoring:{blazers:Jf.JACKETS,suit_jackets:Jf.JACKETS,suit_skirts:Jf.SKIRTS,suit_trousers:Jf.PANTS,suit_vests:Jf.SWEATERS,trousers:Jf.PANTS},sweaters:{cardigans:Jf.SWEATERS,crewnecks:Jf.SWEATERS,hoodies_and_zipups:Jf.SWEATERS,sweatshirts:Jf.SWEATERS,turtlenecks:Jf.SWEATERS,v_necks:Jf.SWEATERS},tops:{bodysuits:Jf.BLOUSES,corsets_and_bustiers:Jf.BLOUSES,polos:Jf.T_SHIRTS_AND_TANKS,shirts_and_blouses:Jf.BLOUSES,t_shirts:Jf.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Jf.T_SHIRTS_AND_TANKS}};var tp;!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"}(tp||(tp={}));const np={[tp.TOO_TIGHT]:"Too Tight",[tp.TIGHT]:"Tight",[tp.SLIGHTLY_TIGHT]:"Slightly Tight",[tp.PERFECT_FIT]:"Perfect Fit",[tp.SLIGHTLY_LOOSE]:"Slightly Loose",[tp.LOOSE]:"Loose",[tp.OVERSIZED]:"Oversized",[tp.TOO_SHORT]:"Too Short",[tp.SHORT]:"Short",[tp.SLIGHTLY_SHORT]:"Slightly Short",[tp.SLIGHTLY_LONG]:"Slightly Long",[tp.LONG]:"Long",[tp.TOO_LONG]:"Too Long"};var ip;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(ip||(ip={}));var rp=Object.freeze({__proto__:null,get AvatarState(){return ip},Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],CategoryNames:Xf,get Classification(){return Jf},ClassificationLocations:Yf,get Fit(){return tp},FitNames:np,get MeasurementLocation(){return Wf},MeasurementLocationName:Qf,SubcategoryNames:Zf,Taxonomy:ep});class sp{constructor(e){this.vtoMainDivId=e,this.isInit=!1,this.currentSliderValue=0,this.slider=null}init(){if(this.isInit)return;const e=document.getElementById(this.vtoMainDivId);if(!e)throw new Error(`Element with id ${this.vtoMainDivId} not found`);e.innerHTML='\n <div class="tfr-slider-wrapper">\n <img id="tfr-tryon-image" src="" />\n <input type="range" id="tfr-slider" />\n </div>\n ';const t=document.getElementById("tfr-tryon-image");this.slider=n("tfr-slider",(e,n)=>{console.debug("slider change",e,n),t.src=n,this.currentSliderValue=parseInt(e.value)}),this.isInit=!0}onNewFramesReady(e){if(this.isInit||this.init(),Array.isArray(e)&&e.length>0){const t=Math.min(this.currentSliderValue,e.length-1),n=this.slider.Load(e,t);if(n instanceof Error)return void console.error(n);const i=document.getElementById("tfr-slider");if(i&&this.currentSliderValue<e.length){i.value=this.currentSliderValue.toString();document.getElementById("tfr-tryon-image").src=e[this.currentSliderValue]}}}}var op="Back to sign in",ap="Click here to download the app",cp="Don't have an account?",lp="Whoops! Looks like you don't have an avatar yet.",up="Email address",hp="Please enter a valid email address.",dp="Enter your email address, we will send you a link to reset your password.",fp="Forgot password?",pp="Have an account? Sign in",gp="Your avatar is loading...",mp="Unfortunately, that size is not available for try on.",vp="or",yp="Password",wp="Please enter a valid password (at least 7 characters).",bp="Return to Catalog Page",_p="Return to Product Page",Sp="Return to site",Ep="Please return to The Fitting Room app to create your avatar.",Tp="Scan to download the app",Ip="Send",Cp="Sign back in",kp="Sign in",Ap="Something went wrong. Try again!",Rp="You have successfully logged out!",xp="The Fitting Room",Np="Username or password is empty.",Op="Username or password is incorrect.",Lp="End size uncertainty with",Pp="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique to find your perfect fit every time.";var Dp=[],Mp=[];function Fp(e,t){if(e&&"undefined"!=typeof document){var n,i=!0===t.prepend?"prepend":"append",r=!0===t.singleTag,s="string"==typeof t.container?document.querySelector(t.container):document.getElementsByTagName("head")[0];if(r){var o=Dp.indexOf(s);-1===o&&(o=Dp.push(s)-1,Mp[o]={}),n=Mp[o]&&Mp[o][i]?Mp[o][i]:Mp[o][i]=a()}else n=a();65279===e.charCodeAt(0)&&(e=e.substring(1)),n.styleSheet?n.styleSheet.cssText+=e:n.appendChild(document.createTextNode(e))}function a(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),t.attributes)for(var n=Object.keys(t.attributes),r=0;r<n.length;r++)e.setAttribute(n[r],t.attributes[n[r]]);var o="prepend"===i?"afterbegin":"beforeend";return s.insertAdjacentElement(o,e),e}}Fp(".tfr-c-white{color:var(--tfr-white)}.tfr-c-brand{color:var(--tfr-brand-color)}.tfr-c-brand-bg{background-color:var(--tfr-brand-color)}.tfr-c-black{color:var(--tfr-black)}.tfr-c-black-o5{color:rgba(0,0,0,.5)}.tfr-c-red{color:var(--tfr-red)}",{});Fp('#fit-title{margin-bottom:20px;margin-top:-30px}#fit-subtitle,#fit-title{color:#209da7;font-size:24px;font-weight:700}#fit-subtitle{position:absolute;right:17px;top:100px}#fit-subtitle-mobile{color:#7d7d7d;font-size:24px;font-weight:700;margin-top:20px}#fit-outline-container{display:flex;justify-content:center}#fit-outline-inner{position:relative}#fit-outline-inner,#tfr-fit-outline-img{width:184px}#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right,#tfr-fit-outline-img{height:701px}#fit-outline-inner-left,#fit-outline-inner-right{position:relative;width:260px}#fit-outline-container .fit-outline-line{display:block}.fit-outline-line{background:#000;height:1px;position:absolute}.fit-outline-line-text{border-bottom:1px solid #000;font-size:24px;position:absolute}.fit-outline-line-chest-text{left:-11px;text-align:right;top:163px;width:254px}.fit-outline-line-n-waist-text{left:-11px;text-align:right;top:208px;width:254px}.fit-outline-line-p-waist-text{right:-10px;text-align:left;top:233px;width:253px}.fit-outline-line-h-hip-text{left:-3px;text-align:right;top:255px;width:246px}.fit-outline-line-l-hip-text{left:-3px;text-align:right;top:302px;width:246px}.fit-outline-line-thigh-text{right:3px;text-align:left;top:341px;width:240px}.fit-outline-line-chest{left:42px;top:194px;width:99px}.fit-outline-line-n-waist{left:50px;top:239px;width:83px}.fit-outline-line-p-waist{left:45px;top:264px;width:93px}.fit-outline-line-h-hip{left:30px;top:286px;width:122px}.fit-outline-line-l-hip{left:21px;top:333px;width:141px}.fit-outline-line-thigh-l{left:27px;top:372px;width:60px}.fit-outline-line-thigh-r{left:95px;top:372px;width:61px}#fit-line-container{position:relative;width:100%}#fit-line-text-container{align-items:center;display:flex;justify-content:space-between}.fit-line-item{font-weight:700;width:110px}.fit-line-item .light-text{font-weight:500}.fit-line-item-green{color:#209da7}#fit-line{display:flex;justify-content:space-around;margin-bottom:4px;margin-top:30px}#fit-line-1,#fit-line-2,#fit-line-3,#fit-line-4,#fit-line-5,#fit-line-6,#fit-line-7{background:#000;height:2px;position:relative;width:110px}#fit-line-3,#fit-line-4,#fit-line-5{background:#209da7}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before,#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{background:#000;border-radius:50%;content:"";height:12px;position:absolute;top:-5px;width:12px}#fit-line-1:before,#fit-line-2:before,#fit-line-3:before{left:0}#fit-line-5:before,#fit-line-6:before,#fit-line-7:before{right:0}#fit-line-1:before,#fit-line-2:before,#fit-line-6:before,#fit-line-7:before{background:#000}#fit-line-3:before,#fit-line-5:before{background:#209da7}#fit-line-2:before,#fit-line-6:before{display:none}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after{border-left:2px dashed #000;content:"";display:block;height:20px;left:50%;position:absolute;top:-20px}#fit-line-3:after,#fit-line-4:after,#fit-line-5:after{border-left:2px dashed #209da7}#fit-line-texts{display:flex;justify-content:space-between;padding:0 70px}#fit-line-texts div:nth-of-type(2){color:#209da7}.margin-top-10{margin-top:10px}.desktop-hidden{display:none}#cta-link{cursor:pointer;font-size:20px;margin:auto;text-decoration:underline;width:150px}.powered-by{align-items:center;display:flex;justify-content:center;margin-top:10px}@media screen and (max-width:599px){#fit-outline-inner,#fit-outline-inner-left,#fit-outline-inner-right{height:400px}#fit-outline-inner{flex-shrink:0;overflow:hidden}#fit-title{margin-top:0}#fit-outline-container{margin-top:-50px;transform:scale(.7)}.fit-line-item{font-size:10px;font-weight:500}.fit-outline-line-text{font-size:16px;line-height:31px}.fit-outline-line-chest-text,.fit-outline-line-n-waist-text{left:-11px;width:auto}.fit-outline-line-p-waist-text{right:-10px;width:auto}.fit-outline-line-h-hip-text,.fit-outline-line-l-hip-text{left:-3px;width:auto}.fit-outline-line-thigh-text{right:3px;width:auto}#fit-line{margin-top:10px}#fit-line-texts{font-size:12px;padding:0 15px}#cta-section{margin-top:-30px}#fit-line-2:before,#fit-line-6:before,.desktop-hidden{display:block}#fit-line-1:after,#fit-line-2:after,#fit-line-3:after,#fit-line-4:after,#fit-line-5:after,#fit-line-6:after,#fit-line-7:after,.mobile-hidden{display:none}}',{});Fp(".tfr-home-button-container{display:flex;flex-wrap:wrap;margin:20px}.tfr-home-button-container>button{border:0;cursor:pointer;height:60px;margin:20px;width:200px}.tfr-home-button-container>button:hover{background-color:#e6e6e6}[data-tfr=hidden]{display:none}.tfr-modal{background-color:rgba(0,0,0,.53);display:flex;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10000}.tfr-modal-content{margin:0 auto;text-align:center;width:90%}.tfr-modal-content-flex{align-items:center;display:flex}.tfr-modal-content-container{background-color:#fff;border:1px solid #434343;border-radius:0;box-shadow:0 6px 6px #00000029;line-height:normal;max-height:100vh;max-width:850px;overflow:auto;width:100%}#tfr-close-container{padding-right:10px}.tfr-close-container{text-align:end}.tfr-close{color:#aaa;font-size:28px;font-weight:700;height:50px;width:50px}.tfr-close:focus,.tfr-close:hover{color:#000;text-decoration:none}.tfr-cursor:hover{cursor:pointer}.tfr-underline{text-decoration:underline}.tfr-standard-button{border:0;border-radius:3px;color:#fff;height:43px;width:138px}.tfr-logo-container{align-items:center;display:flex}.tfr-modal-title-logo-container{align-items:center;display:flex;justify-content:center}.tfr-girl-clothes{display:inline-block;height:316px;width:253px}.tfr-t-a-center{text-align:center}.tfr-w-70-p{width:70%}.tfr-w-80-p{width:80%}.tfr-w-85-p{width:85%}.tfr-w-150{width:150px}.tfr-h-150{height:150px}.tfr-d-none{display:none}.tfr-d-block{display:block}.tfr-d-flex{display:flex}.tfr-how-it-works-item{align-items:center;display:flex;justify-items:center}.tfr-try-on-content{margin-left:60px}#tfr-tryon-image{max-width:30vw}.progress-bar{background-color:#fff;border:1px solid #bdbdbd;height:10px;margin:15px auto 0;width:55%}.progress-bar-fill{animation-duration:120s;animation-name:progress;background-color:#209da7;color:#fff;display:block;font-size:16px;height:100%;text-align:center;transition:width .6s linear}#tfr-video{height:100%;max-height:350px;max-width:350px}.tfr-logo-box{display:flex;margin:auto;max-height:400px;max-width:860px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;justify-content:center}.tfr-qr-code{width:200px}.tfr-space-above{margin-top:10px}.tfr-max-w-600{margin:auto;max-width:600px}#tfr-qr-border-box{align-items:center;border:2px solid var(--tfr-brand-color);border-radius:16px;display:flex;flex-direction:column;height:350px;justify-content:center;margin-left:20px;padding:0 30px;width:300px}.tfr-mobile-logo{height:60px}#email-input,#password-input{font-size:16px}.tfr-door-icon,.tfr-user-icon{color:#209da7}.tfr-logged-in,.tfr-toggle-closed{display:none}.tfr-flex{display:flex}.tfr-gap{gap:4px}.tfr-items-center{align-items:center}.tfr-mb-2{margin-bottom:8px}#tfr-logged-out-overlay-container{position:relative}#tfr-logged-out-overlay{align-items:center;background:hsla(0,0%,100%,.8);bottom:0;display:flex;font-size:16px;font-weight:700;justify-content:center;left:0;line-height:16px;position:absolute;right:0;text-align:center;top:0}.tfr-slider-wrapper{align-items:center;display:flex;flex-direction:column}#tfr-slider{accent-color:var(--tfr-brand-color)}",{});Fp("input{border:none;box-shadow:none!important;width:100%}input:focus,select:focus,textarea:focus{border:none;outline:none}.tfr-fieldset{margin-left:auto;margin-right:auto;width:65%}.tfr-fieldset,.tfr-fieldset-inline{border-color:rgba(0,0,0,.5);border-radius:10px;border-width:1px;padding:5px 10px 10px;text-align:left}.tfr-fieldset-inline{margin-right:10px;width:250px}.tfr-fieldset-err{border-color:red}",{});Fp(".lds-ellipsis{display:inline-block;height:80px;position:relative;width:80px}.lds-ellipsis div{animation-timing-function:cubic-bezier(0,1,1,0);background:var(--tfr-brand-color);border-radius:50%;display:block;height:13px;position:absolute;top:33px;width:13px}.lds-ellipsis div:first-child{animation:lds-ellipsis1 .6s infinite;left:8px}.lds-ellipsis div:nth-child(2){animation:lds-ellipsis2 .6s infinite;left:8px}.lds-ellipsis div:nth-child(3){animation:lds-ellipsis2 .6s infinite;left:32px}.lds-ellipsis div:nth-child(4){animation:lds-ellipsis3 .6s infinite;left:56px}@keyframes lds-ellipsis1{0%{transform:scale(0)}to{transform:scale(1)}}@keyframes lds-ellipsis3{0%{transform:scale(1)}to{transform:scale(0)}}@keyframes lds-ellipsis2{0%{transform:translate(0)}to{transform:translate(24px)}}",{});Fp("@media screen and (max-width:702px){.tfr-modal-title-logo-container{display:flex;flex-direction:column}}@media screen and (min-width:600px){.tfr-modal-content-container{border-radius:10px;height:auto;margin:auto;width:100%}}@media screen and (max-width:599px){#tfr-size-recommendations{width:calc(100vw - 30px)!important}.tfr-mobile-small-text{font-size:12px}.tfr-mobile-hidden{display:none}.tfr-modal-content{overflow:hidden}.tfr-modal-content-container{max-height:none;max-width:100vw;min-height:100vh;min-width:100vw}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{overflow:auto}}@media screen and (max-width:500px){.tfr-fieldset{width:90%}.tfr-how-it-works-item{flex-direction:column}.tfr-try-on-content{margin-left:0;margin-top:20px}}@media screen and (max-height:800px){.tfr-video-responsive{height:280px!important}}",{});Fp('#tfr-size-recommendations{align-items:center;background-color:var(--tfr-main-bg-color);border:var(--tfr-main-border-width) solid var(--tfr-main-border-color);border-radius:var(--tfr-main-border-radius);color:var(--tfr-dark);display:flex;flex-direction:column;font-family:var(--tfr-main-font);justify-content:center;padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations-container{align-items:center;display:none;flex-direction:column;justify-content:center;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column;font-size:13px;width:100%}#tfr-size-rec-title{align-items:center;display:flex;font-family:var(--tfr-title-font);margin-bottom:8px}#tfr-size-rec-title-toggle{color:var(--tfr-grey);cursor:pointer;position:absolute;right:0;top:0;transition:all .3s ease}.tfr-chevron-up{transform:rotate(180deg) scaleY(.6)}.tfr-chevron-down{transform:rotate(0deg) scaleY(.6)}#tfr-info-icon{cursor:pointer}#tfr-size-rec-subtitle{border-bottom:2px solid #000;font-size:18px;font-weight:700;text-align:center;width:100%}#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;padding:0 10px;width:100%}.tfr-size-rec-table-row:first-of-type{border-top-width:0}.tfr-size-rec-table-row{align-items:center;border-top:var(--tfr-main-border-width) solid var(--tfr-main-border-color);display:flex;font-family:var(--tfr-row-font);justify-content:center;min-height:40px}.tfr-size-rec-table-cell-left,.tfr-size-rec-table-cell-right{flex:1 1 0px}.tfr-size-rec-table-cell-left{flex-grow:1;padding-left:8px;padding-right:8px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:1;padding-left:8px;padding-right:8px;text-align:left}.tfr-size-rec-table-cell-right.perfect{color:var(--tfr-brand-color)}#tfr-size-rec-size{display:inline-block}#tfr-size-rec-size>.tfr-size-rec-login-cta{font-weight:500;margin-left:10px}.tfr-size-rec-login-cta,.tfr-size-rec-table-cell-right{font-size:12px}.tfr-size-rec-login-cta{color:var(--tfr-muted);display:flex;width:150px}#tfr-size-rec-action-login,#tfr-size-rec-action-logout{display:none;font-family:var(--tfr-cta-font)}#tfr-size-rec-action{cursor:pointer;font-size:16px;text-decoration:underline}#tfr-size-rec-select{background-color:var(--tfr-size-selector-bg-color);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);display:none;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);margin-bottom:20px;margin-top:10px}#tfr-size-rec-select,.tfr-size-rec-select-button{align-items:center;height:var(--tfr-size-selector-button-height);justify-content:center}.tfr-size-rec-select-button{cursor:pointer;display:flex;transition:all .15s ease-in;width:80px}.tfr-size-rec-select-button:hover:not(.active):not(.tfr-disabled){background-color:var(--tfr-size-selector-bg-color-hover);opacity:.7}.tfr-size-rec-select-button.active{background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-button-active-border-color);border-style:solid;border-width:var(--tfr-size-selector-button-active-border-width);height:var(--tfr-size-selector-button-active-height)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:first-of-type{border-bottom-left-radius:var(--tfr-size-selector-button-radius);border-top-left-radius:var(--tfr-size-selector-button-radius)}.tfr-size-rec-select-button.active,.tfr-size-rec-select-button:last-of-type{border-bottom-right-radius:var(--tfr-size-selector-button-radius);border-top-right-radius:var(--tfr-size-selector-button-radius)}.tfr-powered-by{align-items:center;display:flex;font-size:10px;margin-top:10px}.tfr-powered-by-logo{margin:0 4px}.tfr-powered-by-logo,.tfr-powered-by-logo img,.tfr-powered-by-logo svg{height:24px;width:12px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}#tfr-sign-in-nav{margin-bottom:80px}.tfr-disabled{cursor:default}#tfr-login-to-view{cursor:pointer}.tfr-try-on-button{align-items:center;background-color:var(--tfr-size-selector-bg-color-active);border-color:var(--tfr-size-selector-border-color);border-radius:var(--tfr-size-selector-button-radius);border-style:solid;border-width:var(--tfr-size-selector-border-width);box-shadow:var(--tfr-size-selector-button-shadow);color:var(--tfr-size-selector-text-color);cursor:pointer;display:flex;font-size:var(--tfr-size-selector-font-size);font-weight:var(--tfr-size-selector-font-weight);height:var(--tfr-size-selector-button-height);justify-content:center;margin-bottom:10px;margin-top:20px;max-width:200px;position:relative;transition:all .15s ease-in;width:100%}.tfr-try-on-button.loading,.tfr-try-on-button:disabled{cursor:not-allowed;opacity:.7}.tfr-try-on-button.loading:after{animation:spin 1s linear infinite;border:2px solid var(--tfr-size-selector-text-color);border-radius:50%;border-top:2px solid transparent;content:"";height:16px;margin-left:8px;position:absolute;width:16px}@keyframes spin{to{transform:rotate(1turn)}}',{});Fp(".tfr-mt-10{margin-top:10px}.tfr-mt-20{margin-top:20px}.tfr-mt-15{margin-top:15px}.tfr-mt-30{margin-top:30px}.mt-40{margin-top:40px}.tfr-mb-40{margin-bottom:40px}.tfr-mb-20{margin-bottom:20px}.tfr-mr-10{margin-right:10px}.tfr-mr-15{margin-right:15px}.tfr-mt-50{margin-top:50px}.tfr-mt-60{margin-top:60px}.tfr-mb-60{margin-bottom:60px}.tfr-mr-20{margin-right:20px}.tfr-mt-15-p{margin-top:15%}.tfr-mb-13-p{margin-bottom:13%}.tfr-m-h-auto{margin-left:auto;margin-right:auto}.tfr-pt-20{padding-top:20px}.tfr-pb-50{padding-bottom:50px}.tfr-p-20{padding:20px 10px}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});Fp(".flag-container{bottom:0;left:0;padding:1px;right:0;right:auto;top:0}.flag-container:hover{cursor:pointer}.selected-flag{align-items:center;display:flex;height:100%;padding:0 6px 0 8px;position:relative;z-index:1}.flag.bd{background-position:-418px 0;height:12px}.arrow{border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid #555;height:0;margin-left:6px;width:0}.arrow-up{border-bottom:6px solid #555;border-top:none}.country-list{-webkit-overflow-scrolling:touch;background-color:#fff;border-radius:5px;box-shadow:0 8px 10px 1px rgba(57,64,78,.7),0 3px 14px 2px rgba(57,64,78,.7),0 5px 5px -3px rgba(57,64,78,.7);cursor:pointer;display:none;font-size:16px;line-height:18px;list-style:none;margin:0 0 0 -1px;max-height:500px;overflow:auto;padding:0;position:absolute;text-align:left;top:50%;transform:translateY(-50%);white-space:nowrap;width:100%;width:auto;z-index:2}.country-list.active{display:inline-block}.country{outline:0;padding:5px 26px 5px 15px}.country-list .divider{border-bottom:1px solid rgba(0,0,0,.12);margin-bottom:5px;padding-bottom:5px}.country.highlight{background-color:#c7cace}.flag-box{display:inline-block;width:20px}.country-name,.flag-box{margin-right:6px}.country-name,.dial-code,.flag-box{vertical-align:middle}",{});Fp(".tfr-title-font{font-family:Poppins,sans-serif}.tfr-body-font{font-family:Roboto,sans-serif}.tfr-light-24-300{font-size:24px;font-weight:300}.tfr-light-24-500{font-size:24px;font-weight:500}.tfr-light-22-300{font-size:22px;font-weight:300}.tfr-light-16-300{font-size:16px;font-weight:300}.tfr-medium-16-default{font-size:16px}.tfr-12-default{font-size:12px}.tfr-14-default{font-size:14px}.tfr-16-default{font-size:16px}.tfr-24-bold{font-size:24px;font-weight:700}",{});Fp(":root{--tfr-brand-color:#209da7;--tfr-black:#000;--tfr-red:red;--tfr-white:#fff;--tfr-muted:#a7a7a7;--tfr-dark:#121212;--tfr-grey:#878787;--tfr-light-grey:#dbdcdc;--tfr-dark-grey:#3f3f3f;--tfr-main-border-color:hsla(0,0%,7%,.55);--tfr-main-border-radius:0;--tfr-main-border-width:1px;--tfr-main-bg-color:inherit;--tfr-main-width:440px;--tfr-main-v-padding:14px;--tfr-main-h-padding:20px;--tfr-main-font:inherit;--tfr-title-font:var(--tfr-main-font);--tfr-subtitle-font:var(--tfr-main-font);--tfr-row-font:var(--tfr-main-font);--tfr-cta-font:var(--tfr-main-font);--tfr-size-selector-text-color:var(--tfr-white);--tfr-size-selector-font-size:14px;--tfr-size-selector-font-weight:400;--tfr-size-selector-border-color:transparent;--tfr-size-selector-border-width:0;--tfr-size-selector-bg-color:var(--tfr-grey);--tfr-size-selector-bg-color-hover:var(--tfr-dark-grey);--tfr-size-selector-bg-color-active:var(--tfr-dark);--tfr-size-selector-button-height:35px;--tfr-size-selector-button-active-height:45px;--tfr-size-selector-button-active-border-color:transparent;--tfr-size-selector-button-active-border-width:0;--tfr-size-selector-button-radius:8px;--tfr-size-selector-button-shadow:0 4px 4px 0 rgba(0,0,0,.3)}",{});const zp='\n<svg class="tfr-door-icon" width="68" height="124" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="currentColor">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n</path>\n</svg>',Up='<svg class="tfr-user-icon" width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n <g clip-path="url(#clip0_82_11365)">\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M4.3125 4.78125C4.3125 3.02084 5.73959 1.59375 7.5 1.59375C9.26041 1.59375 10.6875 3.02084 10.6875 4.78125C10.6875 6.54166 9.26041 7.96875 7.5 7.96875C5.73959 7.96875 4.3125 6.54166 4.3125 4.78125ZM9.625 4.78125C9.625 3.60764 8.6736 2.65625 7.5 2.65625C6.32639 2.65625 5.375 3.60764 5.375 4.78125C5.375 5.95485 6.32639 6.90625 7.5 6.90625C8.6736 6.90625 9.625 5.95485 9.625 4.78125Z"\n fill="currentColor" fill-opacity="0.7" />\n <path fill-rule="evenodd" clip-rule="evenodd"\n d="M2.1875 13.1634C2.1875 10.5693 4.58181 8.5 7.5 8.5C10.4182 8.5 12.8125 10.5693 12.8125 13.1634C12.8125 16.1539 2.1875 16.1539 2.1875 13.1634ZM11.75 13.1634C11.75 11.1933 9.86303 9.5625 7.5 9.5625C5.13697 9.5625 3.25 11.1933 3.25 13.1634C3.25 13.7564 4.45689 14.126 5.96113 14.2721L6.31312 14.3019C7.08543 14.3577 7.91457 14.3577 8.68688 14.3019L9.03887 14.2721C10.5431 14.126 11.75 13.7564 11.75 13.1634Z"\n fill="currentColor" fill-opacity="0.7" />\n </g>\n <defs>\n <clipPath id="clip0_82_11365">\n <rect width="16" height="16" fill="white" />\n </clipPath>\n </defs>\n</svg>',Vp=e=>({Hook:()=>{const t=document.querySelector(".progress-bar-fill");!function(e,t){let n=0;const i=e/200;t.style.width=n+"%";const r=setInterval(()=>{n>=100?clearInterval(r):(n+=.5,t.style.width=n+"%")},i)}(e.timeoutMS,t)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${gp} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `,useFullModalContent:!0}),Bp=e=>{const t=document.getElementById(e),n=document.querySelector("body");if(!t)throw new Error(`element with id ${e} not found`);let i;const r=e=>e?`\n <div class="tfr-modal-title-logo-container">\n <div tfr-element="true" class="trf-logo-title tfr-title-font tfr-light-24-300 tfr-c-black tfr-mr-10">${Lp}</div>\n <div tfr-element="true" class="tfr-logo-container">\n <div class="tfr-mr-15">\n <svg width="26" height="47" viewBox="0 0 68 124" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path d="M0.911938 0L67.4819 17.09V106.49L0.911938 123.51V0Z" fill="#209DA7">\n </path>\n <path d="M52.8019 64.44C54.7791 64.44 56.3819 62.4387 56.3819 59.97C56.3819 57.5013 54.7791 55.5 52.8019 55.5C50.8248 55.5 49.2219 57.5013 49.2219 59.97C49.2219 62.4387 50.8248 64.44 52.8019 64.44Z" fill="white">\n </path>\n </svg>\n </div>\n <div tfr-element="true" class="tfr-title-font tfr-light-24-500 tfr-c-black tfr-mr-10">${xp}</div>\n </div>\n </div>\n `:"",s=()=>{n.style.overflow="auto",i&&(i.Unhook(),l()),t.style.display="none"},o=e=>{"Escape"===e.key&&s()},a=e=>{const n=t.querySelector("#tfr-modal-background");e.target===n&&(console.debug("container close"),s())},c=()=>{t.querySelector("#tfr-close-container").addEventListener("click",s),document.addEventListener("keydown",o),document.addEventListener("click",a)},l=()=>{var n;const i=t.querySelector("#tfr-close-container");i?i.removeEventListener("click",s):(console.error("#tfr-close-container not found on unhook"),console.debug(null===(n=document.getElementById(e))||void 0===n?void 0:n.innerHTML)),document.removeEventListener("keydown",o),document.removeEventListener("click",a)};return{open:e=>{var s,o;n.style.overflow="hidden",i&&i.Unhook(),t.innerHTML=(s=e.Body(),o=e.useFullModalContent,console.log({useFullModalContent:o}),`\n <div class="tfr-modal" id="tfr-modal-background">\n <div class="tfr-modal-content-container tfr-p-20">\n <div class="tfr-close-container">\n <span id="tfr-close-container" class="tfr-close tfr-cursor">×</span>\n </div>\n\n <div class="tfr-modal-content-flex">\n <div class="tfr-modal-content">\n ${r(o)}\n ${s}\n </div>\n </div>\n </div>\n </div>\n `),c(),e.Hook(),t.style.display="block",i=e},close:s,Content:()=>i}},jp=e=>{const t=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{e.onSignInNav()},i=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},r=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")},s="https://assets.dev.thefittingroom.xyz/images/";return{Hook:()=>{var e,s,o;if(t||(document.getElementById("tfr-sign-in-nav").style.marginBottom="0"),t){document.getElementById("tfr-video").classList.add("tfr-video-responsive")}null===(e=document.getElementById("tfr-sign-in-nav"))||void 0===e||e.addEventListener("click",n),null===(s=document.getElementById("tfr-app-store"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-google-play"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var e,t,s;null===(e=document.getElementById("tfr-sign-in-nav"))||void 0===e||e.removeEventListener("click",n),null===(t=document.getElementById("tfr-app-store"))||void 0===t||t.removeEventListener("click",i),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",r)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Pp}</div>\n \n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls loop autoplay playsinline>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n\n ${t?"":`<div id="tfr-qr-border-box">\n <div tfr-element="true" class="tfr-title-font tfr-24-bold">${Tp}</div>\n \n <img src="${s}qr.png" class="tfr-qr-code" />\n\n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${pp}</div>\n </div>`}\n </div>\n\n ${t?`<div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10 tfr-max-w-600">${ap}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n <img class="tfr-mobile-logo" src="${s}apple.png" id="tfr-app-store" />\n <img class="tfr-mobile-logo" src="${s}google.png" id="tfr-google-play" />\n </div>\n \n <div id="tfr-sign-in-nav" tfr-element="true" class="tfr-body-font tfr-mt-20 tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${pp}</div>\n `:""}\n `,useFullModalContent:!0}};class Hp{constructor(e,t,n,i){this.signIn=t,this.forgotPassword=n,this.submitTel=i,this.manager=Bp(e)}close(){this.manager.close()}onSignOut(){this.manager.open((e=>{const t=()=>{e.onNavSignIn("")},n=()=>{e.onClose()};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.addEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-sign-in"))||void 0===e||e.removeEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-mt-15-p tfr-mb-13-p">${Rp}</div>\n <div class="tfr-t-a-center">\n <span id="tfr-sign-in" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${Cp}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${Sp}</span>\n </div>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onClose:()=>this.close()}))}onNotCreated(){this.manager.open({Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60">${lp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Ep}</div>\n `,Hook:()=>{},Unhook:()=>{},useFullModalContent:!0})}onLoading(){this.manager.open(Vp({timeoutMS:1e4}))}toScan(){this.manager.open(jp({onSignInNav:()=>this.toSignIn(),onTelSubmit:e=>this.submitTel(e)}))}toSignIn(){this.manager.open((e=>{const{email:t}=e,n=t=>{t.preventDefault();const n=document.getElementById("email-input").value,i=document.getElementById("password-input").value;s(),e.onSignIn(n,i,o)},i=()=>{const t=document.getElementById("email-input").value;e.onNavForgotPassword(t)},r=()=>{e.onNavScanCode()},s=()=>{document.querySelectorAll(".tfr-fieldset-element").forEach(e=>{e.classList.remove("tfr-fieldset-err")}),document.querySelectorAll(".tfr-label-element").forEach(e=>{e.classList.remove("tfr-c-red")});const e=document.querySelector("#tfr-form-error");e.classList.remove("tfr-d-block"),e.innerHTML=""},o=e=>{document.querySelectorAll(".tfr-fieldset-element").forEach(e=>{e.classList.add("tfr-fieldset-err")}),document.querySelectorAll(".tfr-label-element").forEach(e=>{e.classList.add("tfr-c-red")});const t=document.querySelector("#tfr-form-error");t.innerHTML=e||"Something went wrong",t.classList.add("tfr-d-block")};return{Hook:()=>{var e,t,s,o;null===(e=document.getElementById("tfr-sign-in-form"))||void 0===e||e.addEventListener("submit",n),null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var e,t,s,o;null===(e=document.getElementById("tfr-sign-in-form"))||void 0===e||e.removeEventListener("submit",n),null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",n),null===(s=document.getElementById("tfr-forgot-password"))||void 0===s||s.removeEventListener("click",i),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",r)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${kp}</div>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${up}</legend>\n <input tfr-element="true" type="email" id="email-input" value="${t||""}" />\n </fieldset>\n\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-20">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${yp}</legend>\n <input tfr-element="true" type="password" id="password-input" />\n </fieldset>\n\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="tfr-form-error"></div>\n\n <div class="tfr-mt-20">\n <span id="tfr-forgot-password" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-15">${fp}</span>\n <span id="tfr-scan-code" tfr-element="true" class="tfr-body-font tfr-14-default tfr-c-black-o5 tfr-underline tfr-cursor">${cp}</span>\n </div>\n\n <button id="tfr-sign-in" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30" id="sign-in-button" type="submit">\n ${kp}\n </button>\n </form>\n `,useFullModalContent:!0}})({onSignIn:this.signIn,onNavForgotPassword:()=>this.toForgotPassword(),onNavScanCode:()=>this.toScan()}))}toForgotPassword(){this.manager.open((e=>{const t=()=>{const t=document.getElementById("tfr-email").value;e.onNavSignIn(t)},n=()=>{const t=document.getElementById("tfr-email").value;e.onPasswordReset(t)};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-send-password-reset"))||void 0===e||e.addEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.addEventListener("click",t)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-send-password-reset"))||void 0===e||e.removeEventListener("click",n),null===(i=document.getElementById("tfr-back-to-signin"))||void 0===i||i.removeEventListener("click",t)},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-20 tfr-w-70-p tfr-m-h-auto">${dp}</div>\n <fieldset class="tfr-fieldset-element tfr-fieldset tfr-mt-30">\n <legend tfr-element="true" class="tfr-label-element tfr-body-font tfr-14-default tfr-c-black-o5">${up}</legend>\n <input tfr-element="true" type="email" id="tfr-email" />\n </fieldset>\n <div tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-red tfr-mt-10 tfr-d-none" id="error-msg"></div>\n <div id="tfr-back-to-signin" tfr-element="true" class="tfr-body-font tfr-12-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mt-30">${op}</div>\n <button id="tfr-send-password-reset" tfr-element="true" class="tfr-standard-button tfr-c-brand-bg tfr-c-whitetfr-title-font tfr-medium-16-default tfr-cursor tfr-mt-30">\n ${Ip}\n </button>\n `,useFullModalContent:!0}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(e){this.manager.open((e=>{let t=()=>{};const i=()=>{e.onNavBack()},r=()=>{e.onClose()};return{Hook:()=>{var s,o;const a=document.getElementById("tfr-tryon-image"),c=n("tfr-slider",(e,t)=>{console.debug("slider change",e,t),a.src=t});if(Array.isArray(e.frames)&&e.frames.length>0){const n=c.Load(e.frames);if(n instanceof Error)return void console.error(n);t=n}null===(s=document.getElementById("tfr-back"))||void 0===s||s.addEventListener("click",i),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",r)},Unhook:()=>{var e,n;t(),null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",i),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",r)},Body:()=>'\n <div class="tfr-slider-wrapper">\n\t\t\t\t<img id="tfr-tryon-image" src="" />\n\t\t\t\t<input type="range" id="tfr-slider" />\n\t\t\t\t</div>\n ',useFullModalContent:!0}})({frames:e,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(e){this.manager.open((e=>{const{error:t}=e,n=()=>{e.onNavBack()},i=()=>{e.onClose()};return{Hook:()=>{var e,t;null===(e=document.getElementById("tfr-back"))||void 0===e||e.addEventListener("click",n),null===(t=document.getElementById("tfr-close"))||void 0===t||t.addEventListener("click",i)},Unhook:()=>{var e,t;null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",n),null===(t=document.getElementById("tfr-close"))||void 0===t||t.removeEventListener("click",i)},Body:()=>(t||console.error("ErrorModal: No error provided"),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">${t||Ap}</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${bp}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" id="returnToSite">${_p}</span>\n </div>\n `),useFullModalContent:!0}})({error:e,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onSizeError(e,t){this.manager.open((e=>{const t=()=>{e.onNavBack()},n=()=>{e.onClose()};return{Hook:()=>{var e,i;null===(e=document.getElementById("tfr-back"))||void 0===e||e.addEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.addEventListener("click",n)},Unhook:()=>{var e,i;null===(e=document.getElementById("tfr-back"))||void 0===e||e.removeEventListener("click",t),null===(i=document.getElementById("tfr-close"))||void 0===i||i.removeEventListener("click",n)},Body:()=>{var t,n,i;return console.debug("rendering size error modal",e),`\n <div class="tfr-mt-15-p tfr-mb-13-p">\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black">\n\t\t\t\t\t\t\t${mp} ${null===(t=e.sizes)||void 0===t?void 0:t.recommended} ${vp} ${null===(i=null===(n=e.sizes)||void 0===n?void 0:n.available)||void 0===i?void 0:i.join(" or ")}\n\t\t\t\t\t\t</div>\n </div>\n\n <div class="tfr-t-a-center">\n <span id="tfr-back" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor tfr-mr-20">${bp}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${_p}</span>\n </div>\n `},useFullModalContent:!0}})({sizes:{recommended:e,available:t},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}toFitInfo(){this.manager.open((e=>{const t=()=>e.onSignInNav();return{Hook:()=>{document.getElementById("cta-link").addEventListener("click",t)},Unhook:()=>{document.getElementById("cta-link").removeEventListener("click",t)},Body:()=>`\n <div>\n <div id="fit-title">Fit Scale</div>\n\n <div id="fit-line-container">\n <div id="fit-line-text-container">\n <div class="fit-line-item mobile-hidden">Too Tight</div>\n\n <div class="fit-line-item">\n <div>Tight <span class="light-text">or</span><br /> More fitted</div>\n\n <div class="desktop-hidden margin-top-10">Too Tight</div>\n </div>\n\n <div class="fit-line-item fit-line-item-green">Slightly tight <br /><span class="light-text">or</span> Fitted</div>\n <div class="fit-line-item fit-line-item-green">Perfect Fit</div>\n <div class="fit-line-item fit-line-item-green">Slightly loose <br /><span class="light-text">or</span> Less fitted</div>\n\n <div class="fit-line-item">\n <div>Loose <span class="light-text">or</span><br /> Not fitted</div>\n\n <div class="desktop-hidden margin-top-10">Oversized</div>\n </div>\n\n <div class="fit-line-item mobile-hidden">Oversized</div>\n </div>\n\n <div id="fit-line">\n <div id="fit-line-1" class="mobile-hidden"> </div>\n <div id="fit-line-2"> </div>\n <div id="fit-line-3"> </div>\n <div id="fit-line-4"> </div>\n <div id="fit-line-5"> </div>\n <div id="fit-line-6"> </div>\n <div id="fit-line-7" class="mobile-hidden"> </div>\n </div>\n\n <div id="fit-line-texts">\n <div>Poor Fit</div>\n <div>Acceptable Fit</div>\n <div>Poor Fit</div>\n </div>\n </div>\n\n <div id="fit-subtitle-mobile" class="desktop-hidden">Measurement Points</div>\n\n <div id="fit-outline-container">\n <div id="fit-outline-inner-left">\n <div class="fit-outline-line-text fit-outline-line-p-waist-text">Pant Waist</div>\n <div class="fit-outline-line-text fit-outline-line-thigh-text">Thigh</div>\n </div>\n\n <div id="fit-outline-inner">\n <div class="fit-outline-line fit-outline-line-chest"></div>\n <div class="fit-outline-line fit-outline-line-n-waist"></div>\n <div class="fit-outline-line fit-outline-line-p-waist"></div>\n <div class="fit-outline-line fit-outline-line-h-hip"></div>\n <div class="fit-outline-line fit-outline-line-l-hip"></div>\n <div class="fit-outline-line fit-outline-line-thigh-l"></div>\n <div class="fit-outline-line fit-outline-line-thigh-r"></div>\n\n <img id="tfr-fit-outline-img" src="https://assets.dev.thefittingroom.xyz/images/fit-outline.png" />\n </div>\n\n <div id="fit-outline-inner-right">\n <div id="fit-subtitle" class="mobile-hidden">Measurement Points</div>\n\n <div class="fit-outline-line-text fit-outline-line-chest-text">Chest/Bust</div>\n <div class="fit-outline-line-text fit-outline-line-n-waist-text">Natural Waist</div>\n <div class="fit-outline-line-text fit-outline-line-h-hip-text">High Hip</div>\n <div class="fit-outline-line-text fit-outline-line-l-hip-text">Low Hip</div>\n </div>\n </div>\n </div>\n\n <div id="cta-section">\n <div id="cta-link">Sign Up or Login</div>\n\n <div class="powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${zp}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n `,useFullModalContent:!1}})({onSignInNav:()=>this.toScan(),onClose:()=>this.close()}))}navBack(){window.history.back()}}class $p{constructor(e,t,n,i,r){this.onSignInClick=t,this.onSignOutClick=n,this.onFitInfoClick=i,this.onTryOnClick=r,this._sku="",this._styleId=null,this.isLoggedIn=!1,this.tfrLoggedInElements=[],this.tfrLoggedOutElements=[],this.tfrToggleOpenElements=[],this.tfrToggleClosedElements=[],this.isCollapsed=!1,this.redraw=null,this.init(e)}get sku(){return this._sku}setSku(e){this._sku=e}get styleId(){return this._styleId}setStyleId(e){this._styleId=e}setIsLoggedIn(e){this.isLoggedIn=e,this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelect.style.display="flex",this.tfrSizeHowItFits.style.display="block",e?(this.tfrSizeHowItFits.style.opacity="1",this.tfrSizeRecSelect.style.opacity="1",this.tfrLoggedInElements.forEach(e=>e.style.display="block"),this.tfrLoggedOutElements.forEach(e=>e.style.display="none"),this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex",this.tfrSizeRecSelectContainer.style.opacity="1"):(this.tfrSizeHowItFits.style.opacity="0.4",this.tfrSizeRecSelect.style.opacity="0.4",this.tfrLoggedInElements.forEach(e=>e.style.display="none"),this.tfrLoggedOutElements.forEach(e=>e.style.display="block"),this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="",this.renderSizeRecSelectLoggedOut())}setLoading(e){e?(this.tfrSizeRecLoading.style.display="block",this.tfrSizeRecommendationsContainer.style.display="none"):(this.tfrSizeRecLoading.style.display="none",this.tfrSizeRecommendationsContainer.style.display="flex")}setGarmentLocations(e){e&&e.length?this.renderGarmentLocations(e):this.tfrSizeRecTitle.style.display="none"}setRecommendedSize({recommended:e,sizes:t}){this.renderSizeRec(e,t)}setError(){this.tfrSizeRecTitle.style.display="none",this.isLoggedIn&&(this.tfrSizeRecommendationError.style.display="block",this.tfrSizeRecommendationError.innerHTML="No recommended size found.")}init(e){const t=document.getElementById(e);if(!t)throw new Error("Size rec main div not found");this.render(t),this.setElements(),this.bindEvents()}setElements(){this.tfrSizeHowItFits=document.getElementById("tfr-size-how-it-fits"),this.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrInfoIcon=document.getElementById("tfr-info-icon"),this.tfrLoginToView=document.getElementById("tfr-login-to-view"),this.tfrSizeRecActionLogin=document.getElementById("tfr-size-rec-action-login"),this.tfrSizeRecActionLogout=document.getElementById("tfr-size-rec-action-logout"),this.tfrSizeRecTable=document.getElementById("tfr-size-rec-table"),this.tfrSizeRecommendationError=document.getElementById("tfr-size-recommendation-error"),this.tfrSizeRecSize=document.getElementById("tfr-size-rec-size"),this.tfrSizeRecSelect=document.getElementById("tfr-size-rec-select"),this.tfrSizeRecLoading=document.getElementById("tfr-size-rec-loading"),this.tfrSizeRecTitleToggle=document.getElementById("tfr-size-rec-title-toggle"),this.tfrSizeRecSelectContainer=document.getElementById("tfr-size-rec-select-container"),this.tfrSizeRecommendationsContainer=document.getElementById("tfr-size-recommendations-container"),this.tfrLoggedInElements=document.querySelectorAll(".tfr-logged-in"),this.tfrLoggedOutElements=document.querySelectorAll(".tfr-logged-out"),this.tfrToggleOpenElements=document.querySelectorAll(".tfr-toggle-open"),this.tfrToggleClosedElements=document.querySelectorAll(".tfr-toggle-closed")}bindEvents(){this.tfrSizeRecActionLogin.addEventListener("click",this.onSignInClick),this.tfrSizeRecActionLogout.addEventListener("click",this.onSignOutClick),this.tfrSizeRecSelect.addEventListener("click",this.onSizeRecSelectClick.bind(this)),this.tfrSizeRecTitleToggle.addEventListener("click",this.toggletSizeRecSelectContainer.bind(this)),this.tfrInfoIcon.addEventListener("click",this.onFitInfoClick),this.tfrLoginToView.addEventListener("click",this.onSignInClick);const e=document.getElementById("tfr-try-on-button");e&&e.addEventListener("click",async()=>{if(e.classList.contains("loading"))return;const t=document.querySelector(".tfr-size-rec-select-button.active");if(!t)return;const n=Number(t.getAttribute("data-size-id"));if(Number.isNaN(n))return;e.classList.add("loading");const i=e.textContent;e.textContent=" ",e.setAttribute("disabled","true");try{const e=Array.from(document.querySelectorAll(".tfr-size-rec-select-button")),i=e.indexOf(t);if(null!==this.styleId){try{await this.onTryOnClick(this.styleId,n,!0)}catch(e){console.error(`Error trying on active size ${n}:`,e)}if(i>0){const t=e[i-1];await this._preloadNeighborVTO(t)}if(i>=0&&i<e.length-1){const t=e[i+1];await this._preloadNeighborVTO(t)}}}catch(e){console.error("Error during sequential try-on process:",e)}finally{e.classList.remove("loading"),e.textContent=i,e.removeAttribute("disabled")}})}async _preloadNeighborVTO(e){var t;const n=Number(e.getAttribute("data-size-id"));if(!Number.isNaN(n))try{await this.onTryOnClick(this.styleId,n,!1)}catch(i){const r=(null===(t=e.textContent)||void 0===t?void 0:t.trim())||"N/A";console.error(`Error pre-loading try-on for size ${n} (button: ${r}):`,i)}}onSizeRecSelectClick(e){const t=e.target;if(!t.classList.contains("tfr-size-rec-select-button")||t.classList.contains("tfr-disabled"))return;e.preventDefault();const n=Number(t.getAttribute("data-index"));if(Number.isNaN(n))return;const i=document.querySelectorAll(".tfr-size-rec-select-button");i.forEach(e=>e.classList.remove("active")),i.item(n).classList.add("active"),this.redraw(n);const r=Number(t.getAttribute("data-size-id"));Number.isNaN(r)||this.onTryOnClick(this.styleId,r,!0)}renderSizeRec(e,t){this.tfrSizeRecSize.innerHTML=` ${e}`;const n=t.findIndex(({size:t})=>t===e);this.redraw=e=>this.renderSizeRecTable(t,e),this.redraw(n),this.renderSizeRecSelect(t,n)}renderSizeRecTable(e,t){const{locations:n}=e[t],i=n.map(({location:e,fit:t,isPerfect:n})=>this.renderSizeRecTableRow(e,t,n)).join("");this.tfrSizeRecTable.innerHTML=i}renderSizeRecSelect(e,t){const n=e.map(({size:e})=>e).map((n,i)=>`<div class="tfr-size-rec-select-button ${i===t?"active":""}" data-index="${i}" data-size-id="${e[i].size_id}">${n}</div>`).join("");this.tfrSizeRecSelect.innerHTML=n}renderSizeRecSelectLoggedOut(){const e=['<div class="tfr-size-rec-select-button tfr-disabled">M</div>','<div class="tfr-size-rec-select-button tfr-disabled active">L</div>','<div class="tfr-size-rec-select-button tfr-disabled">XL</div>'].join("");this.tfrSizeRecSelect.innerHTML=e}renderSizeRecTableRow(e,t,n=!1){return`<div class="tfr-size-rec-table-row">\n <div class="tfr-size-rec-table-cell-left">${e}</div>\n <div class="tfr-size-rec-table-cell-right ${n?"perfect":""}">\n ${t}\n </div>\n </div>`}renderGarmentLocations(e){const t=e.map((e,t)=>this.renderSizeRecTableRow(e,this.randomFit(t),!0)).join(""),n=`<div id="tfr-logged-out-overlay-container">\n <div id="tfr-logged-out-overlay">\n Login to reveal how this item will fit specifically at each area of your body in different sizes\n </div>\n <div>\n ${t}\n </div>\n </div>`;this.tfrSizeRecTable.innerHTML=n}randomFit(e){const t=["Slightly Tight","Perfect Fit","Perfect Fit","Slightly Loose","Perfect Fit"];return t[e%t.length]}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrToggleOpenElements.forEach(e=>e.style.display="block"),this.tfrToggleClosedElements.forEach(e=>e.style.display="none")):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrToggleOpenElements.forEach(e=>e.style.display="none"),this.tfrToggleClosedElements.forEach(e=>e.style.display="block"))}render(e){const t=`<div id="tfr-size-recommendations">\n <div id="tfr-size-rec-loading">\n <div class="lds-ellipsis">\n <div></div>\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n <div id="tfr-size-recommendations-container">\n <div id="tfr-size-rec-title-toggle" class="tfr-chevron-up">v</div>\n\n <div class="tfr-logged-out">\n <div class="tfr-flex tfr-gap tfr-mb-2 tfr-mobile-small-text">\n <div>Uncertain of your size?</div>\n \n <div class="tfr-toggle-closed">\n <div class="tfr-flex tfr-items-center">\n <div>Try</div>\n <div class="tfr-powered-by-logo">${zp}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n\n <div class="tfr-toggle-open">\n <div id="tfr-login-to-view" class="tfr-flex tfr-items-center">\n ${Up} Login to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-logged-in">\n <div id="tfr-size-rec-title">\n Recommended Size:\n <div id="tfr-size-rec-size">\n <div class="tfr-size-rec-login-cta">\n ${Up} Sign up to view\n </div>\n </div>\n </div>\n </div>\n\n <div class="tfr-toggle-open" style="width: 100%">\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-how-it-fits">Select size to see how it fits:</div>\n\n <div id="tfr-size-rec-select"></div>\n\n <div id="tfr-size-rec-subtitle">\n How it fits\n <span id="tfr-info-icon"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n<rect width="13" height="13" fill="url(#pattern0_641_1375)"/>\n<defs>\n<pattern id="pattern0_641_1375" patternContentUnits="objectBoundingBox" width="1" height="1">\n<use xlink:href="#image0_641_1375" transform="scale(0.00793651)"/>\n</pattern>\n<image id="image0_641_1375" width="126" height="126" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAH4AAAB+CAYAAADiI6WIAAAAAXNSR0IArs4c6QAADKtJREFUeF7tnc2S2zYSgLuh9VwzeYJVniDjJ7Asb06p8mhqj6nKDFN7j/wEkp/A4/MeqMllj9L4umWJfgIrT2D5CaK9ZlfATlOkLWn0g8aPCJLSJakxSIL4uhvdjQaIULFfKx42AeCiIcRflYImgDpXAE0E+n8ASP+25YcwUwrmgDAXAHMFOEOE2ULK358AzP8dXU2rNFRY5pdpxcNzAGgJFM8Q1IVScAEA9Dcfv7lCmCLgVCr5AQCmSXQ18/GgY9yzdOD/Fg9bEsWlUqqFkIIu7KcApoiYSCXvk+gqKawjBg8uBfgcNih141GjDYZv7RLS/kSCuiuDEAQLnsz4w1zbBcTrnfOyLSp/189QYH8h5YdQp4PgwC+1O4XdCVi7OSIzkKBehyYAwYAn4AqxpxS0OKNaorZBCUDh4Cn8aiDGFQa+KZtBCEBh4LM5vA+Av5ZIa112tVABKAR8Ox7eAOCbiszhNsKQOoHvry/vbG5icu1RwdfQrOsyObr2Hw18Kx7eiJOW7xOEo2q/d/AFzeWUTJkCpvn2qQScK7n4LM7O/pB//vmfJLqarxJI+3h29k1jsUjz+FKl6d8mKnUhV/P8uvpr1Q5vJUgK/9b6aHXLLRd7BU+mXQBOIF8gcd377H556lQhJkouKGnidNBIMFA0nqFSrSOlimcS1HOfsb838GkiBnDoy4FTAIkQOFpISSlSp6APyWe2AthqAF4/9MNX3oHgR77Sv17At+NhN/PaD40h698VwEwBDgDk22PD3tXRXAgQsPdl6Zf1VvsbZ1m/vsNbprdyDr4dDyk277nsKGk3NER/8vNLWg4N9vf87t2lkLLr2gr4gO8UvGvoZQG+KYk//PbumVzIvksBcA3fGXiX0MsKfJsA/G8hB66mAJfwnYB3CH0uAftJdPk2WHtu0DHKYbjyAVzBtwbvCjppuVp6saUtZ9onE2loi9gDBVRMYvVzAd8KvCPoldTyPVFAVyydX8vaQPVqHF3dmkqQMfgsTqfkjPFvGZ75TVQYd87jhaT9CDixnfuzJI9RrZ8ReEcZuVGWoDhq8sUjT9atl6lsjB9Sy1RpZPqbS1BPTaZHNviswx9t0rCZA/fa9G2rdF07vu89FPvbJGgow0fwWQrEBt+Oh7c2xRMn6I/F1h4+3o6jy1cchWCBzwooyDwZ/U7Qdw+bLXyp8Cb5Rb+gQxu87bx+gn5YVyzhs+Z7bfDtwSg2jUFP0A9Dz1vYwKdcyCTqPNd5mhZ4GxNfJPTmP//VAgHskBPVWfPTP/7+WWcAfbSxgY8Cb3Rq+A6CtzTxo3HUufIxODr3LCt4erd2PKJaBpNQj0z+d4e8/IPgTU18lpxhhxk6QHXblBl8WvUD+NEsyXPYy98LPtP2T7oDvdKO5WgY3F/rkjKDpxfMxp9yJuz0bqb1O9c99oI31faH4sZuCCtsZQefwafcPu1BYP0OOXo7wVto+2AcdSJWLz01rgJ4GpoX8WhiUtSxL5e/E7yJtoe26FIV8KYmf5/WbwVvqu1S4E1SwHagXQajKuBtTP4urd8K3lTbJ1HnO09W2+i2VQJvYfK3Tr2PwJtqu2qIVmhVsFUDb1gDsTWufwTeJEt3yIM0UlcHF1UNvKnWS4H95PpybRl8C/gRxe3bz4LbASNEbaeuVhG8odbPxhvT8Bp4k5uGqu0ODEawtzAJ7zadvDXwRk6dEJ3J9cv7YEepgh0zUVBAvB3ffC3WWAcf88w8xe2hefIV5Lz1lZ7Ho0/MPP58HHW+zW/2BbyJFIUWt9cFOr1n++6+B5JXq7dq7r+Abw/u34BSXc7gHVoI4Nzr1JY3AlnR6x+sq1bM/RfwL+LRR8U4G/bk1LGG3EtjrpNHB0hMos5T6kwK3iRpUwYzn4ZzDWAXh6I8axVZgaMrJS/u7n9VUrF200hQ31KRRgr+RTzsqOXpFdq/Mpj5Ksbxq4BMzL3KorAUPHd+XzUZ2pJSQMOqg88yeawpOg/rlho/GE1YR4puxIQFMNV6ZB3AGyhtWom71Ph4RN6hdnlPbi60Rr/ARnUAbzBNp/E8tuLhhQCkui7tX+4gaF9QUMM6gDeZ5+HsSRO5iZsyZevqAH7po40+cT7mQBYbuSFBmeL3GoEfZh920LKtKLCLXOdgM9mv9aSCGtUHPDPriniL7cGILS3vr8txOFFtwC+PgeckqgbIDeVCLbrYZlTqAp7r2dN0jewcfYC1dbtmkrqAN4jMZmTqWR4hhQLjn34sbCcpx12oEXg6JZyz1W2G7XikOINZlhie3qlG4OkgJdYSLRv8OOoc3GHLESSfbesCPsu+shT4BH6L5BV9MIKJMnAt9wn8CbyenJ1Mvd44HbuVd40/OXfHRnr4eSYLNadwrgKm3qB0jh/HZ8dnTg/LYfEt6uLVG6ywTvkp2xLtnDmB3658acqWu21K9xy14vW9Pgkc7tI6AIxOy7IVmONNltbZhRgkLUUeWsixJHUx9dwV1rQQg7ukBwCP9lpzYByzbV3At7mbXRuiRcWW3JUdKEssXwfwJjE8RWan8uqSz/EGFntZXk3vzd18V5a6uzpoPNexy4tlT1uoSq/xvF3O61uozDZNprsuj+mscZ9VdY038c/WNk2aOAgUEoRebVt18CZH0+W7nCt9MELVwXPj90cHI6SlO2ZHoQRt7qsM3sTMrzrltocfPToxkTsP+2xfZfAmZn51T8TmcWes7dKhZ/GqDd7uaLqNAw6Ze7AAKIv3PImujD5s61Pbq1xebZC0oeFYO8W60keaVlXjuU4dUd/c+vb4EGPuzpqAtb6K4LnVNin0LSeQPgZvcGJiqHvmqwjeRNu3HU237UMFtB2H9mFpn4lDUhXiXF818CbanrGhDxCufYrM5adJtL9r6tupy+9fNfDcdfdsHPQ+TUKNTSULQL0aR1eskxZ9CkGVwJvE7bu0nf6+cwMke6l2STCIL0xWTeMtvu+78xuAO8Gban1Ijl5VNJ5bCZ0L/r5jZ/dueTbUegoggjD5VQDfjoddMPjE6GbCZnNK3QveaCEgIJNfdvCmX5jcN7fnAnDwkIN2fP8GgPcBg+zms2y7VWHFGmUGn9VI0ImjrC+C7fPkV7X+IPisA+y4PntIoTX4ZQbfjkd0jHyHG/Xoft/3IHh6cCse3gjeOWpf+itBvU6iqz73BVy0Lyv4djzsA2DPZAx0PyChBZ46YO7opVm9QuCXEbwN9EMOHcvU541tHI3M2Tg6/LKBt4Gua+K1nbtVKbEx+UXBNzGXRVxjAz0dW+Yn3LVNfT4YFl5+eouizH4RMHWfaQsdAG/H0devSOo8lw2evHwE/Mj8yuFaX07wvw6HLfTMxD/l7nFgg8+8fNpoSTEma+l2QxJHElTE7bCONJehTRYm04nT7JAtfz/uvG7k3G0Opmkuf+M+lOShmr21teIygLPpo8Wiy9pjbU4SN9L4FU+/K8zyyKsvMAdQr0NazrWBeujaLPdOMbqNtQQJ2E+iy9eHnrfr363A003b8X3voarLRYJmkM39ldR+0vIGYsz6zNsOarbQ6bbW4B3Dn6HA/vvryztTSQ7xOldavoyK7DQ9Hx8n4B3Dp9vR3E+OX5D1+rrCRX6QQuy50HKX0J1pfD4QDs1+ekuFkCiVpntLJQCugbuG7hy8B81fFYC3SXQ10tW2Itr5AO4DuhfwvuBnIFMfYCHlh1BCwGU8DlQlc224dr5XRiVgN4ncf/XL2Ry/2XuS/gVgbJPh2zciNA0IxEERQkCwG0Jcg1IdV/P3lnedq4boTH5++cGH9fIGnjpLIQwCTnzBzweENvwjYiKVpEFKXGcDCTS9jkDxTCnVQoALHzBW3memPCe2vILP4J8LEBTrd30O1sa9ZwphhoBTRJgtpPw9nyqoBHxTMDKw508Azv8L0BSUXEHxPYJqKoKsjMqfDF8XbyVIcmi9lqx5B5+/PS3pImDPt/YbjnYIl82lwm7yy3FyGEcDn5t+gdgDBTchjHQofaC9CGqZtzha1vKo4E/a/0jU5lJgNykgU1kI+JP2p5H0UebyXVatMPAr2t+sk/kvwqxvg184+LoIAAGHhuj7isu5/kow4CsqABSSjVRDDEIBno9zcOBXBYCSJiUNAWcScAAgaX3BazzO1fTgwa++0A+/vXu2kPKG0qMB5wHmgDhQAkehaXfQc7yu5C6FgHLk/lOnh/qUp4rLAnv1fYI19YcGPQ8JUTS+RxICpS7S9KplLdue584z0FOFmCi5oBXCIM24ztiVGvy2F2zFw4snjcY3kgSBcuxKNRHgXAKc03/3LJ2mWTMEmFHZMiDOKc8vAWf4l8Z0/NOPn3UGtCxt/g+79EmQczmdsgAAAABJRU5ErkJggg=="/>\n</defs>\n</svg>\n</span>\n </div>\n\n <div id="tfr-size-rec-table"></div>\n\n <div id="tfr-try-on-button" class="tfr-try-on-button">Try On</div>\n </div>\n </div>\n\n <div id="tfr-size-rec-action">\n <div id="tfr-size-rec-action-login">Sign up or login</div>\n <div id="tfr-size-rec-action-logout">Log out</div>\n </div>\n\n <div class="tfr-toggle-open">\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo">${zp}</div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;e.innerHTML=t}}class qp{constructor(e,t,n,i,r,s,o){this.tfrShop=n,this.onSignInClick=i,this.onSignOutClick=r,this.onFitInfoClick=s,this.onTryOnClick=o,this.perfectFits=[rp.Fit.PERFECT_FIT,rp.Fit.SLIGHTLY_LOOSE,rp.Fit.SLIGHTLY_TIGHT],this.setCssVariables(t),this.sizeRecComponent=new $p(e,this.onSignInClick,this.onSignOutClick,this.onFitInfoClick,this.onTryOnClick)}get sku(){return this.sizeRecComponent.sku}setSku(e){this.sizeRecComponent.setSku(e)}get styleId(){return this.sizeRecComponent.styleId}setStyleId(e){this.sizeRecComponent.setStyleId(e)}setIsLoggedIn(e){this.sizeRecComponent.setIsLoggedIn(e)}async setGarmentLocations(e=[]){this.sizeRecComponent.setLoading(!0);const t=await this.getGarmentLocations(e);console.debug("locations",t),console.debug("filledLocations",e),this.sizeRecComponent.setGarmentLocations(t||[]),this.sizeRecComponent.setLoading(!1)}async setRecommendedSize(){this.sizeRecComponent.setLoading(!0);const e=await this.getRecommenedSize();if(!e)return console.error("No sizes found for sku"),this.sizeRecComponent.setLoading(!1),void this.sizeRecComponent.setError();this.sizeRecComponent.setRecommendedSize(e),this.sizeRecComponent.setLoading(!1)}async getGarmentLocations(e){try{return await this.tfrShop.getMeasurementLocationsFromSku(this.sku,e)}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.tfrShop.getMeasurementLocationsFromBrandStyleId(t.id,e)}catch(e){return console.error(e),this.sizeRecComponent.setError(),null}}}async getRecommenedSize(){try{const e=await this.tfrShop.getColorwaySizeAssetFromSku(this.sku),t=await this.getRecommendedSizes(String(e.style_id));return this.setStyleId(e.style_id),t}catch(e){try{const e=await this.tfrShop.getStyleByBrandStyleId(this.sku),t=await this.getRecommendedSizes(String(e.id));return this.setStyleId(e.id),t}catch(e){return console.error(e),this.sizeRecComponent.setError(),null}}}async getRecommendedSizes(e){const t=await this.tfrShop.getRecommendedSizes(e);return t?{recommended:t.recommended_size.size_value.size,sizes:t.fits.map(e=>({size:t.available_sizes.find(t=>t.id===e.size_id).size_value.size,size_id:e.size_id,locations:e.measurement_location_fits.map(e=>({fit:"string"==typeof e.fit_label&&e.fit_label?e.fit_label:rp.FitNames[e.fit],isPerfect:this.perfectFits.includes(e.fit),location:this.tfrShop.getMeasurementLocationName(e.measurement_location),sortOrder:this.tfrShop.getMeasurementLocationSortOrder(e.measurement_location)})).sort((e,t)=>e.sortOrder<t.sortOrder?-1:1)}))}:null}setCssVariables(e){const t=document.querySelector(":root");e.brandColor&&t.style.setProperty("--tfr-brand-color",e.brandColor),e.black&&t.style.setProperty("--tfr-black",e.black),e.red&&t.style.setProperty("--tfr-red",e.red),e.white&&t.style.setProperty("--tfr-white",e.white),e.muted&&t.style.setProperty("--tfr-muted",e.muted),e.dark&&t.style.setProperty("--tfr-dark",e.dark),e.grey&&t.style.setProperty("--tfr-grey",e.grey),e.lightGrey&&t.style.setProperty("--tfr-light-grey",e.lightGrey),e.mainBorderColor&&t.style.setProperty("--tfr-main-border-color",e.mainBorderColor),e.mainBorderRadius&&t.style.setProperty("--tfr-main-border-radius",e.mainBorderRadius),e.mainBorderWidth&&t.style.setProperty("--tfr-main-border-width",e.mainBorderWidth),e.mainBgColor&&t.style.setProperty("--tfr-main-bg-color",e.mainBgColor),e.mainWidth&&t.style.setProperty("--tfr-main-width",e.mainWidth),e.mainVPadding&&t.style.setProperty("--tfr-main-v-padding",e.mainVPadding),e.mainHPadding&&t.style.setProperty("--tfr-main-h-padding",e.mainHPadding),e.mainFont&&t.style.setProperty("--tfr-main-font",e.mainFont),e.titleFont&&t.style.setProperty("--tfr-title-font",e.titleFont),e.subtitleFont&&t.style.setProperty("--tfr-subtitle-font",e.subtitleFont),e.rowFont&&t.style.setProperty("--tfr-row-font",e.rowFont),e.ctaFont&&t.style.setProperty("--tfr-cta-font",e.ctaFont),e.sizeSelectorTextColor&&t.style.setProperty("--tfr-size-selector-text-color",e.sizeSelectorTextColor),e.sizeSelectorFontSize&&t.style.setProperty("--tfr-size-selector-font-size",e.sizeSelectorFontSize),e.sizeSelectorFontWeight&&t.style.setProperty("--tfr-size-selector-font-weight",e.sizeSelectorFontWeight),e.sizeSelectorBgColor&&t.style.setProperty("--tfr-size-selector-bg-color",e.sizeSelectorBgColor),e.sizeSelectorBorderColor&&t.style.setProperty("--tfr-size-selector-border-color",e.sizeSelectorBorderColor),e.sizeSelectorBorderWidth&&t.style.setProperty("--tfr-size-selector-border-width",e.sizeSelectorBorderWidth),e.sizeSelectorBgColorHover&&t.style.setProperty("--tfr-size-selector-bg-color-hover",e.sizeSelectorBgColorHover),e.sizeSelectorBgColorActive&&t.style.setProperty("--tfr-size-selector-bg-color-active",e.sizeSelectorBgColorActive),e.sizeSelectorButtonHeight&&t.style.setProperty("--tfr-size-selector-button-height",e.sizeSelectorButtonHeight),e.sizeSelectorButtonActiveHeight&&t.style.setProperty("--tfr-size-selector-button-active-height",e.sizeSelectorButtonActiveHeight),e.sizeSelectorButtonActiveBorderColor&&t.style.setProperty("--tfr-size-selector-button-active-border-color",e.sizeSelectorButtonActiveBorderColor),e.sizeSelectorButtonActiveBorderWidth&&t.style.setProperty("--tfr-size-selector-button-active-border-width",e.sizeSelectorButtonActiveBorderWidth),e.sizeSelectorButtonRadius&&t.style.setProperty("--tfr-size-selector-button-radius",e.sizeSelectorButtonRadius),e.sizeSelectorButtonShadow&&t.style.setProperty("--tfr-size-selector-button-shadow",e.sizeSelectorButtonShadow)}}var Gp;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(Gp||(Gp={}));class Kp{constructor(e,t,n,i,r={},s,o){this.shopId=e,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const a=o||("undefined"!=typeof process?process.env.NODE_ENV:"dev");console.log("tfr-env",a),this.tfrModal=new Hp(t,this.signIn.bind(this),this.forgotPassword.bind(this),this.submitTel.bind(this)),this.tfrShop=((e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),Ql.getInstance().setEnv(t),new Kf(e,new Hf)))(Number(this.shopId),a),this.tfrSizeRec=new qp(n,s,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this),this.onFitInfoClick.bind(this),this.onTryOnClick.bind(this)),i&&(this.vtoComponent=new sp(i))}get shop(){return this.tfrShop}get sku(){return this.tfrSizeRec.sku}async checkIfPublished(e){const t=await this.getStyle(e);return Boolean(null==t?void 0:t.is_published)}setSku(e){this.tfrSizeRec.setSku(e),this.isLoggedIn?this.tfrSizeRec.setRecommendedSize():this.setGarmentLocations()}async onInit(){var e,t;return this.isLoggedIn=await this.tfrShop.onInit(),this.tfrSizeRec.setIsLoggedIn(this.isLoggedIn),this.isLoggedIn?((null===(e=this.hooks)||void 0===e?void 0:e.onLogin)&&this.hooks.onLogin(),this.subscribeToProfileChanges()):((null===(t=this.hooks)||void 0===t?void 0:t.onLogout)&&this.hooks.onLogout(),this.unsubscribeFromProfileChanges()),this.isLoggedIn}close(){this.tfrModal.close()}async signOut(){var e;await this.tfrShop.user.logout(),(null===(e=this.hooks)||void 0===e?void 0:e.onLogout)&&this.hooks.onLogout(),this.isLoggedIn=!1,this.tfrSizeRec.setIsLoggedIn(!1),this.setGarmentLocations(),this.unsubscribeFromProfileChanges()}async signIn(e,t,n){var i;if(0==e.length||0==t.length)return n(Np);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(e))return n(hp);if(!(e=>!!e.match(/^.{7,}$/))(t))return n(wp);try{await this.tfrShop.user.login(e,t),(null===(i=this.hooks)||void 0===i?void 0:i.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(e){return n(Op)}}setBrandUserId(e){this.tfrShop.user.setBrandUserId(e)}async submitTel(e){try{await this.tfrShop.submitTelephoneNumber(e),this.tfrModal.toSignIn()}catch(e){this.tfrModal.onError(Ap)}}async forgotPassword(e){await this.tfrShop.user.sendPasswordResetEmail(e),this.tfrModal.toSignIn()}async passwordReset(e,t){await this.tfrShop.user.confirmPasswordReset(e,t),this.tfrModal.toPasswordReset()}async getMeasurementLocationsFromSku(e){return this.tfrShop.getMeasurementLocationsFromSku(e)}onSignInClick(){this.tfrModal.toScan()}onFitInfoClick(){this.tfrModal.toFitInfo()}async onTryOnClick(e,t,n=!0){if(!this.vtoComponent)return console.error("VtoComponent is not initialized. Please check if the vtoMainDivId is correct.");const i=await this.shop.tryOn(e,t);if(n)try{this.vtoComponent.init(),this.vtoComponent.onNewFramesReady(i)}catch(e){console.error("Error initializing VTO:",e),this.tfrModal.onError(Ap)}}onUserProfileChange(e){var t,n,i,r;switch(e.avatar_status){case Gp.NOT_CREATED:(null===(t=this.hooks)||void 0===t?void 0:t.onError)&&this.hooks.onError(lp),this.tfrModal.onNotCreated();break;case Gp.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Gp.CREATED:(null===(i=this.hooks)||void 0===i?void 0:i.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(r=this.hooks)||void 0===r?void 0:r.onError)&&this.hooks.onError(Ap),this.tfrModal.onError(Ap)}}subscribeToProfileChanges(){this.unsub||(this.unsub=this.tfrShop.user.watchUserProfileForChanges(e=>this.onUserProfileChange(e)))}unsubscribeFromProfileChanges(){this.unsub&&(this.unsub(),this.unsub=null)}async setGarmentLocations(){var e,t;const n=await this.getStyle(this.sku),i=(null===(t=null===(e=null==n?void 0:n.sizes)||void 0===e?void 0:e[0])||void 0===t?void 0:t.garment_measurements.map(e=>e.measurement_location))||[];this.tfrSizeRec.setGarmentLocations(i)}async getStyle(e){try{const t=await this.tfrShop.getColorwaySizeAssetFromSku(e);return await this.tfrShop.getStyle(t.style_id)}catch(t){try{return await this.tfrShop.getStyleByBrandStyleId(e)}catch(e){return null}}}}const Wp=async({shopId:e,modalDivId:t,sizeRecMainDivId:n,vtoMainDivId:i,hooks:r={},cssVariables:s={},env:o="dev"})=>{const a=new Kp(e,t,n,i,r,s,o);return await a.onInit(),a};export{n as InitImageSlider,Wp as initFittingRoom};
|
|
3399
|
+
//# sourceMappingURL=index.min.js.map
|