@thefittingroom/shop-ui 1.3.14 → 1.4.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/dist/esm/index.js +3582 -1137
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +326 -212
- package/package.json +2 -2
package/dist/esm/index.min.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v1.
|
|
2
|
+
* thefittingroom v1.4.0 (2024-07-10T23:28:21.007Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
|
-
function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],
|
|
5
|
+
function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var i=new Image;i.onload=r,i.onerror=r,i.src=e}function e(e){t(e.slice(-1),e.slice(0,-1))}const n=(t,n)=>{const r=document.getElementById(t);if(!r)throw new Error(`Slider with id ${t} not found`);return{Load(t){if(!Array.isArray(t)||!t.length)return console.debug("slider has no images to load"),new Error("slider has no images to load");e(t);const i=(null==t?void 0:t.length)-2;r.value=i.toString(),r.max=(t.length-1).toString();const s=()=>{const e=parseInt(r.value);n(r,t[e])};return n(r,t[i]),r.removeEventListener("input",s),r.addEventListener("input",s),()=>{r.removeEventListener("input",s)}}}},r=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(r(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],o=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==o||null==a||null==c)throw new s;const l=i<<2|o>>4;if(r.push(l),64!==a){const t=o<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};
|
|
6
6
|
/*!
|
|
7
|
-
* thefittingroom v1.
|
|
7
|
+
* thefittingroom v1.3.0 (2024-07-10T23:25:53.913Z)
|
|
8
8
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
@@ -38,10 +38,10 @@ function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var
|
|
|
38
38
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
39
39
|
* See the License for the specific language governing permissions and
|
|
40
40
|
* limitations under the License.
|
|
41
|
-
*/
|
|
41
|
+
*/class s extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const o=function(t){return function(t){const e=r(t);return i.encodeByteArray(e,!0)}(t).replace(/\./g,"")},a=function(t){try{return i.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
42
42
|
/**
|
|
43
43
|
* @license
|
|
44
|
-
* Copyright
|
|
44
|
+
* Copyright 2022 Google LLC
|
|
45
45
|
*
|
|
46
46
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
47
47
|
* you may not use this file except in compliance with the License.
|
|
@@ -55,7 +55,7 @@ function t(e,n){let r=function(){0!==n.length&&t(n.slice(-1),n.slice(0,-1))};var
|
|
|
55
55
|
* See the License for the specific language governing permissions and
|
|
56
56
|
* limitations under the License.
|
|
57
57
|
*/
|
|
58
|
-
|
|
58
|
+
const c=()=>
|
|
59
59
|
/**
|
|
60
60
|
* @license
|
|
61
61
|
* Copyright 2022 Google LLC
|
|
@@ -72,7 +72,7 @@ function a(){return"undefined"!=typeof navigator&&"string"==typeof navigator.use
|
|
|
72
72
|
* See the License for the specific language governing permissions and
|
|
73
73
|
* limitations under the License.
|
|
74
74
|
*/
|
|
75
|
-
|
|
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
76
|
/**
|
|
77
77
|
* @license
|
|
78
78
|
* Copyright 2017 Google LLC
|
|
@@ -89,10 +89,10 @@ const c=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=t
|
|
|
89
89
|
* See the License for the specific language governing permissions and
|
|
90
90
|
* limitations under the License.
|
|
91
91
|
*/
|
|
92
|
-
class
|
|
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))}}}
|
|
93
93
|
/**
|
|
94
94
|
* @license
|
|
95
|
-
* Copyright
|
|
95
|
+
* Copyright 2017 Google LLC
|
|
96
96
|
*
|
|
97
97
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
98
98
|
* you may not use this file except in compliance with the License.
|
|
@@ -105,7 +105,7 @@ class f{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
|
-
*/class p extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,g.prototype.create)}}class g{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(m,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new p(r,o,n)}}const m=/\{\$([^}]+)}/g;function y(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const n=t[i],s=e[i];if(v(n)&&v(s)){if(!y(n,s))return!1}else if(n!==s)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function v(t){return null!==t&&"object"==typeof t}
|
|
108
|
+
*/function f(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class p extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,g.prototype.create)}}class g{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(m,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new p(r,o,n)}}const m=/\{\$([^}]+)}/g;function y(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const n=t[i],s=e[i];if(v(n)&&v(s)){if(!y(n,s))return!1}else if(n!==s)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function v(t){return null!==t&&"object"==typeof t}
|
|
109
109
|
/**
|
|
110
110
|
* @license
|
|
111
111
|
* Copyright 2017 Google LLC
|
|
@@ -121,7 +121,7 @@ class f{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 w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function
|
|
124
|
+
*/function w(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach((t=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(t))})):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function b(t){const e={};return t.replace(/^\?/,"").split("&").forEach((t=>{if(t){const[n,r]=t.split("=");e[decodeURIComponent(n)]=decodeURIComponent(r)}})),e}function _(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}class S{constructor(t,e){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then((()=>{t(this)})).catch((t=>{this.error(t)}))}next(t){this.forEachObserver((e=>{e.next(t)}))}error(t){this.forEachObserver((e=>{e.error(t)})),this.close(t)}complete(){this.forEachObserver((t=>{t.complete()})),this.close()}subscribe(t,e,n){let r;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=function(t,e){if("object"!=typeof t||null===t)return!1;for(const n of e)if(n in t&&"function"==typeof t[n])return!0;return!1}(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=E),void 0===r.error&&(r.error=E),void 0===r.complete&&(r.complete=E);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(t){}})),this.observers.push(r),i}unsubscribeOne(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(t,e){this.task.then((()=>{if(void 0!==this.observers&&void 0!==this.observers[t])try{e(this.observers[t])}catch(t){"undefined"!=typeof console&&console.error&&console.error(t)}}))}close(t){this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then((()=>{this.observers=void 0,this.onNoObservers=void 0})))}}function E(){}
|
|
125
125
|
/**
|
|
126
126
|
* @license
|
|
127
127
|
* Copyright 2021 Google LLC
|
|
@@ -137,7 +137,7 @@ class f{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 T(t){return t&&t._delegate?t._delegate:t}class I{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
|
|
141
141
|
/**
|
|
142
142
|
* @license
|
|
143
143
|
* Copyright 2019 Google LLC
|
|
@@ -169,7 +169,7 @@ class f{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 C{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new
|
|
172
|
+
*/class C{constructor(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(t){const e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){const t=new d;if(this.instancesDeferred.set(e,t),this.isInitialized(e)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:e});n&&t.resolve(n)}catch(t){}}return this.instancesDeferred.get(e).promise}getImmediate(t){var e;const n=this.normalizeInstanceIdentifier(null==t?void 0:t.identifier),r=null!==(e=null==t?void 0:t.optional)&&void 0!==e&&e;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(t){if(r)return null;throw t}}getComponent(){return this.component}setComponent(t){if(t.name!==this.name)throw Error(`Mismatching Component ${t.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=t,this.shouldAutoInitialize()){if(function(t){return"EAGER"===t.instantiationMode}
|
|
173
173
|
/**
|
|
174
174
|
* @license
|
|
175
175
|
* Copyright 2019 Google LLC
|
|
@@ -201,7 +201,7 @@ class f{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 R;!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"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,
|
|
204
|
+
*/var R;!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"}(R||(R={}));const N={debug:R.DEBUG,verbose:R.VERBOSE,info:R.INFO,warn:R.WARN,error:R.ERROR,silent:R.SILENT},L=R.INFO,D={[R.DEBUG]:"log",[R.VERBOSE]:"log",[R.INFO]:"info",[R.WARN]:"warn",[R.ERROR]:"error"},O=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=D[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class x{constructor(t){this.name=t,this._logLevel=L,this._logHandler=O,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in R))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,R.DEBUG,...t),this._logHandler(this,R.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,R.VERBOSE,...t),this._logHandler(this,R.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,R.INFO,...t),this._logHandler(this,R.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,R.WARN,...t),this._logHandler(this,R.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,R.ERROR,...t),this._logHandler(this,R.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,U;const F=new WeakMap,z=new WeakMap,B=new WeakMap,V=new WeakMap,H=new WeakMap;let $={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return z.get(t);if("objectStoreNames"===e)return t.objectStoreNames||B.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return W(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function j(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(U||(U=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(K(this),e),W(F.get(this))}:function(...e){return W(t.apply(K(this),e))}:function(e,...n){const r=t.call(K(this),e,...n);return B.set(r,e.sort?e.sort():[e]),W(r)}}function q(t){return"function"==typeof t?j(t):(t instanceof IDBTransaction&&function(t){if(z.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",s),t.removeEventListener("abort",s)},i=()=>{e(),r()},s=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",s),t.addEventListener("abort",s)}));z.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,$):t)}function W(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",s)},i=()=>{e(W(t.result)),r()},s=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",s)}));return e.then((e=>{e instanceof IDBCursor&&F.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(V.has(t))return V.get(t);const e=q(t);return e!==t&&(V.set(t,e),H.set(e,t)),e}const K=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],Q=["put","add","delete","clear"],Y=new Map;function J(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Y.get(e))return Y.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=Q.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!G.includes(n))return;const s=async function(t,...e){const s=this.transaction(t,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),i&&s.done]))[0]};return Y.set(e,s),s}$=(t=>({...t,get:(e,n,r)=>J(e,n)||t.get(e,n,r),has:(e,n)=>!!J(e,n)||t.has(e,n)}))($);
|
|
205
205
|
/**
|
|
206
206
|
* @license
|
|
207
207
|
* Copyright 2019 Google LLC
|
|
@@ -218,7 +218,7 @@ class f{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 X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9.
|
|
221
|
+
class X{constructor(t){this.container=t}getPlatformInfoString(){return this.container.getProviders().map((t=>{if(function(t){const e=t.getComponent();return"VERSION"===(null==e?void 0:e.type)}(t)){const e=t.getImmediate();return`${e.library}/${e.version}`}return null})).filter((t=>t)).join(" ")}}const Z="@firebase/app",tt="0.9.13",et=new x("@firebase/app"),nt="@firebase/app-compat",rt="@firebase/analytics-compat",it="@firebase/analytics",st="@firebase/app-check-compat",ot="@firebase/app-check",at="@firebase/auth",ct="@firebase/auth-compat",lt="@firebase/database",ut="@firebase/database-compat",ht="@firebase/functions",dt="@firebase/functions-compat",ft="@firebase/installations",pt="@firebase/installations-compat",gt="@firebase/messaging",mt="@firebase/messaging-compat",yt="@firebase/performance",vt="@firebase/performance-compat",wt="@firebase/remote-config",bt="@firebase/remote-config-compat",_t="@firebase/storage",St="@firebase/storage-compat",Et="@firebase/firestore",Tt="@firebase/firestore-compat",It="firebase",kt="[DEFAULT]",Ct={[Z]:"fire-core",[nt]:"fire-core-compat",[it]:"fire-analytics",[rt]:"fire-analytics-compat",[ot]:"fire-app-check",[st]:"fire-app-check-compat",[at]:"fire-auth",[ct]:"fire-auth-compat",[lt]:"fire-rtdb",[ut]:"fire-rtdb-compat",[ht]:"fire-fn",[dt]:"fire-fn-compat",[ft]:"fire-iid",[pt]:"fire-iid-compat",[gt]:"fire-fcm",[mt]:"fire-fcm-compat",[yt]:"fire-perf",[vt]:"fire-perf-compat",[wt]:"fire-rc",[bt]:"fire-rc-compat",[_t]:"fire-gcs",[St]:"fire-gcs-compat",[Et]:"fire-fst",[Tt]:"fire-fst-compat","fire-js":"fire-js",[It]:"fire-js-all"},At=new Map,Rt=new Map;function Nt(t,e){try{t.container.addComponent(e)}catch(n){et.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Lt(t){const e=t.name;if(Rt.has(e))return et.debug(`There were multiple attempts to register component ${e}.`),!1;Rt.set(e,t);for(const e of At.values())Nt(e,t);return!0}function Dt(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}
|
|
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 Ot=new g("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","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}."});
|
|
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 xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw
|
|
254
|
+
class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t),this._config=Object.assign({},e),this._name=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new I("app",(()=>this),"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(t){this.checkDestroyed(),this._automaticDataCollectionEnabled=t}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(t){this._isDeleted=t}checkDestroyed(){if(this.isDeleted)throw Ot.create("app-deleted",{appName:this._name})}}
|
|
255
255
|
/**
|
|
256
256
|
* @license
|
|
257
257
|
* Copyright 2019 Google LLC
|
|
@@ -267,7 +267,7 @@ class xt{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 Pt="9.
|
|
270
|
+
*/const Pt="9.23.0";function Mt(t,e={}){let n=t;if("object"!=typeof e){e={name:e}}const r=Object.assign({name:kt,automaticDataCollectionEnabled:!1},e),i=r.name;if("string"!=typeof i||!i)throw Ot.create("bad-app-name",{appName:String(i)});if(n||(n=u()),!n)throw Ot.create("no-options");const s=At.get(i);if(s){if(y(n,s.options)&&y(r,s.config))return s;throw Ot.create("duplicate-app",{appName:i})}const o=new A(i);for(const t of Rt.values())o.addComponent(t);const a=new xt(n,r,o);return At.set(i,a),a}function Ut(t=kt){const e=At.get(t);if(!e&&t===kt&&u())return Mt();if(!e)throw Ot.create("no-app",{appName:t});return e}function Ft(t,e,n){var r;let i=null!==(r=Ct[t])&&void 0!==r?r:t;n&&(i+=`-${n}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const t=[`Unable to register library "${i}" with version "${e}":`];return s&&t.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&t.push("and"),o&&t.push(`version name "${e}" contains illegal characters (whitespace or "/")`),void et.warn(t.join(" "))}Lt(new I(`${i}-version`,(()=>({library:i,version:e})),"VERSION"))}
|
|
271
271
|
/**
|
|
272
272
|
* @license
|
|
273
273
|
* Copyright 2021 Google LLC
|
|
@@ -283,7 +283,7 @@ class xt{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 zt="firebase-heartbeat-database",Bt=1,Vt="firebase-heartbeat-store";let Ht=null;function $t(){return Ht||(Ht=function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(t,e),a=W(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(W(o.result),t.oldVersion,t.newVersion,W(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{s&&t.addEventListener("close",(()=>s())),i&&t.addEventListener("versionchange",(t=>i(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(zt,Bt,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(Vt)}}).catch((t=>{throw Ot.create("idb-open",{originalErrorMessage:t.message})}))),Ht}async function jt(t,e){try{const n=(await $t()).transaction(Vt,"readwrite"),r=n.objectStore(Vt);await r.put(e,qt(t)),await n.done}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Ot.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}function qt(t){return`${t.name}!${t.options.appId}`}
|
|
287
287
|
/**
|
|
288
288
|
* @license
|
|
289
289
|
* Copyright 2021 Google LLC
|
|
@@ -299,7 +299,7 @@ class xt{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 Wt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Gt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),e=Kt();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==e&&!this._heartbeatsCache.heartbeats.some((t=>t.date===e)))return this._heartbeatsCache.heartbeats.push({date:e,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const t=Kt(),{heartbeatsToSend:e,unsentEntries:n}=function(t,e=1024){const n=[];let r=t.slice();for(const i of t){const t=n.find((t=>t.agent===i.agent));if(t){if(t.dates.push(i.date),Qt(n)>e){t.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Qt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=o(JSON.stringify({version:2,heartbeats:e}));return this._heartbeatsCache.lastSentHeartbeatDate=t,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function Kt(){return(new Date).toISOString().substring(0,10)}class Gt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=await $t();return await e.transaction(Vt).objectStore(Vt).get(qt(t))}catch(t){if(t instanceof p)et.warn(t.message);else{const e=Ot.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});et.warn(e.message)}}}(this.app);return t||{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return jt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return jt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Qt(t){return o(JSON.stringify({version:2,heartbeats:t})).length}
|
|
303
303
|
/**
|
|
304
304
|
* @license
|
|
305
305
|
* Copyright 2019 Google LLC
|
|
@@ -315,7 +315,89 @@ class xt{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 Yt;Yt="",Lt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Lt(new I("heartbeat",(t=>new Kt(t)),"PRIVATE")),zt(Z,tt,Yt),zt(Z,tt,"esm2017"),zt("fire-js","");var Jt=function(t,e){return Jt=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])},Jt(t,e)};function Xt(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zt(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var te,ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},ne=ne||{},re=ee||self;function ie(){}function se(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 oe(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var ae="closure_uid_"+(1e9*Math.random()>>>0),ce=0;function le(t,e,n){return t.call.apply(t.bind,arguments)}function ue(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function he(t,e,n){return(he=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?le:ue).apply(null,arguments)}function de(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 fe(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function pe(){this.s=this.s,this.o=this.o}pe.prototype.s=!1,pe.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,ae)&&t[ae]||(t[ae]=++ce))},pe.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var ge=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function ye(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function ve(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}ve.prototype.h=function(){this.defaultPrevented=!0};var we=function(){if(!re.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{re.addEventListener("test",ie,e),re.removeEventListener("test",ie,e)}catch(t){}return t}();function be(t){return/^[\s\xa0]*$/.test(t)}var Se=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function _e(t,e){return t<e?-1:t>e?1:0}function Te(){var t=re.navigator;return t&&(t=t.userAgent)?t:""}function Ee(t){return-1!=Te().indexOf(t)}function Ie(t){return Ie[" "](t),t}Ie[" "]=ie;var ke,Ce,Ae=Ee("Opera"),Re=Ee("Trident")||Ee("MSIE"),Ne=Ee("Edge"),Le=Ne||Re,Oe=Ee("Gecko")&&!(-1!=Te().toLowerCase().indexOf("webkit")&&!Ee("Edge"))&&!(Ee("Trident")||Ee("MSIE"))&&!Ee("Edge"),De=-1!=Te().toLowerCase().indexOf("webkit")&&!Ee("Edge");function xe(){var t=re.document;return t?t.documentMode:void 0}t:{var Pe="",Me=(Ce=Te(),Oe?/rv:([^\);]+)(\)|;)/.exec(Ce):Ne?/Edge\/([\d\.]+)/.exec(Ce):Re?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Ce):De?/WebKit\/(\S+)/.exec(Ce):Ae?/(?:Version)[ \/]?(\S+)/.exec(Ce):void 0);if(Me&&(Pe=Me?Me[1]:""),Re){var Ue=xe();if(null!=Ue&&Ue>parseFloat(Pe)){ke=String(Ue);break t}}ke=Pe}var ze,Fe={};function Be(){return function(t){var e=Fe;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Se(String(ke)).split("."),n=Se("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=_e(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||_e(0==s[2].length,0==o[2].length)||_e(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(re.document&&Re){var Ve=xe();ze=Ve||(parseInt(ke,10)||void 0)}else ze=void 0;var He=ze;function je(t,e){if(ve.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Oe){t:{try{Ie(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:qe[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&je.X.h.call(this)}}fe(je,ve);var qe={2:"touch",3:"pen",4:"mouse"};je.prototype.h=function(){je.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var $e="closure_listenable_"+(1e6*Math.random()|0),Ke=0;function Ge(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++Ke,this.ba=this.ea=!1}function We(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function Qe(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Ye(t){var e={};for(var n in t)e[n]=t[n];return e}var Je="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Xe(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<Je.length;s++)n=Je[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Ze(t){this.src=t,this.g={},this.h=0}function tn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=ge(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(We(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function en(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}Ze.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=en(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new Ge(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var nn="closure_lm_"+(1e6*Math.random()|0),rn={};function sn(t,e,n,r,i){if(r&&r.once)return an(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)sn(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.N(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!1,r,i)}function on(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=oe(i)?!!i.capture:!!i,a=dn(t);if(a||(t[nn]=a=new Ze(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=hn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)we||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(un(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function an(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)an(t,e[s],n,r,i);return null}return n=pn(n),t&&t[$e]?t.O(e,n,oe(r)?!!r.capture:!!r,i):on(t,e,n,!0,r,i)}function cn(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)cn(t,e[s],n,r,i);else r=oe(r)?!!r.capture:!!r,n=pn(n),t&&t[$e]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=en(s=t.g[e],n,r,i))&&(We(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=dn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=en(e,n,r,i)),(n=-1<t?e[t]:null)&&ln(n))}function ln(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[$e])tn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(un(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=dn(e))?(tn(n,t),0==n.h&&(n.src=null,e[nn]=null)):We(t)}}}function un(t){return t in rn?rn[t]:rn[t]="on"+t}function hn(t,e){if(t.ba)t=!0;else{e=new je(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&ln(t),t=n.call(r,e)}return t}function dn(t){return(t=t[nn])instanceof Ze?t:null}var fn="__closure_events_fn_"+(1e9*Math.random()>>>0);function pn(t){return"function"==typeof t?t:(t[fn]||(t[fn]=function(e){return t.handleEvent(e)}),t[fn])}function gn(){pe.call(this),this.i=new Ze(this),this.P=this,this.I=null}function mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new ve(e,t);else if(e instanceof ve)e.target=e.target||t;else{var i=e;Xe(e=new ve(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=yn(o,r,!0,e)&&i}if(i=yn(o=e.g=t,r,!0,e)&&i,i=yn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=yn(o=e.g=n[s],r,!1,e)&&i}function yn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!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&&tn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}fe(gn,pe),gn.prototype[$e]=!0,gn.prototype.removeEventListener=function(t,e,n,r){cn(this,t,e,n,r)},gn.prototype.M=function(){if(gn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)We(n[r]);delete e.g[t],e.h--}}this.I=null},gn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},gn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var vn=re.JSON.stringify;function wn(){var t=Cn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var bn,Sn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=_n.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),_n=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 Tn}),(function(t){return t.reset()})),Tn=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 En(t){re.setTimeout((function(){throw t}),0)}function In(t,e){bn||function(){var t=re.Promise.resolve(void 0);bn=function(){t.then(An)}}(),kn||(bn(),kn=!0),Cn.add(t,e)}var kn=!1,Cn=new Sn;function An(){for(var t;t=wn();){try{t.h.call(t.g)}catch(t){En(t)}var e=_n;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}kn=!1}function Rn(t,e){gn.call(this),this.h=t||1,this.g=e||re,this.j=he(this.lb,this),this.l=Date.now()}function Nn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Ln(t,e,n){if("function"==typeof t)n&&(t=he(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=he(t.handleEvent,t)}return 2147483647<Number(e)?-1:re.setTimeout(t,e||0)}function On(t){t.g=Ln((function(){t.g=null,t.i&&(t.i=!1,On(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}fe(Rn,gn),(te=Rn.prototype).ca=!1,te.R=null,te.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&&(Nn(this),this.start()))}},te.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},te.M=function(){Rn.X.M.call(this),Nn(this),delete this.g};var Dn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Jt(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:On(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(re.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(pe);function xn(t){pe.call(this),this.h=t,this.g={}}fe(xn,pe);var Pn=[];function Mn(t,e,n,r){Array.isArray(n)||(n&&(Pn[0]=n.toString()),n=Pn);for(var i=0;i<n.length;i++){var s=sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function Un(t){Qe(t.g,(function(t,e){this.g.hasOwnProperty(e)&&ln(t)}),t),t.g={}}function zn(){this.g=!0}function Fn(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return vn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}xn.prototype.M=function(){xn.X.M.call(this),Un(this)},xn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},zn.prototype.Aa=function(){this.g=!1},zn.prototype.info=function(){};var Bn={},Vn=null;function Hn(){return Vn=Vn||new gn}function jn(t){ve.call(this,Bn.Pa,t)}function qn(t){var e=Hn();mn(e,new jn(e))}function $n(t,e){ve.call(this,Bn.STAT_EVENT,t),this.stat=e}function Kn(t){var e=Hn();mn(e,new $n(e,t))}function Gn(t,e){ve.call(this,Bn.Qa,t),this.size=e}function Wn(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return re.setTimeout((function(){t()}),e)}Bn.Pa="serverreachability",fe(jn,ve),Bn.STAT_EVENT="statevent",fe($n,ve),Bn.Qa="timingevent",fe(Gn,ve);var Qn={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},Yn={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function Jn(){}function Xn(t){return t.h||(t.h=t.i())}function Zn(){}Jn.prototype.h=null;var tr,er={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function nr(){ve.call(this,"d")}function rr(){ve.call(this,"c")}function ir(){}function sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new xn(this),this.O=ar,t=Le?125:void 0,this.T=new Rn(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 or}function or(){this.i=null,this.g="",this.h=!1}fe(nr,ve),fe(rr,ve),fe(ir,Jn),ir.prototype.g=function(){return new XMLHttpRequest},ir.prototype.i=function(){return{}},tr=new ir;var ar=45e3,cr={},lr={};function ur(t,e,n){t.K=1,t.v=Rr(Er(e)),t.s=n,t.P=!0,hr(t,null)}function hr(t,e){t.F=Date.now(),gr(t),t.A=Er(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),Hr(n.i,"t",r),t.C=0,n=t.l.H,t.h=new or,t.g=Hi(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Dn(he(t.La,t,t.g),t.N)),Mn(t.S,t.g,"readystatechange",t.ib),e=t.H?Ye(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)),qn(),function(t,e,n,r,i,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 ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function dr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function fr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=pr(t,n))==lr){4==e&&(t.o=4,Kn(14),i=!1),Fn(t.j,t.m,null,"[Incomplete Response]");break}if(r==cr){t.o=4,Kn(15),Fn(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}Fn(t.j,t.m,r,null),br(t,r)}dr(t)&&r!=lr&&r!=cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,Kn(16),i=!1),t.i=t.i&&i,i?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),xi(e),e.K=!0,Kn(11))):(Fn(t.j,t.m,n,"[Invalid Chunked Response]"),wr(t),vr(t))}function pr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?lr:(n=Number(e.substring(n,r)),isNaN(n)?cr:(r+=1)+n>e.length?lr:(e=e.substr(r,n),t.C=r+n,e))}function gr(t){t.V=Date.now()+t.O,mr(t,t.O)}function mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=Wn(he(t.gb,t),e)}function yr(t){t.B&&(re.clearTimeout(t.B),t.B=null)}function vr(t){0==t.l.G||t.I||Ui(t.l,t)}function wr(t){yr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Nn(t.T),Un(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function br(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||Qr(n.h,t)))if(!t.J&&Qr(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Mi(n),ki(n)}Di(n),Kn(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=Wn(he(n.cb,n),6e3));if(1>=Wr(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else Fi(n,11)}else if((t.J||n.g==t)&&Mi(n),!be(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[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&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.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&&(Yr(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Ar(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=Vi(r,r.H?r.ka:null,r.V),f.J){Jr(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(yr(p),gr(p)),r.g=f}else Oi(r);0<n.i.length&&Ai(n)}else"stop"!=s[0]&&"close"!=s[0]||Fi(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?Fi(n,7):Ii(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}qn()}catch(s){}}function Sr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(se(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(se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(te=sr.prototype).setTimeout=function(t){this.O=t},te.ib=function(t){t=t.target;var e=this.L;e&&3==wi(t)?e.l():this.La(t)},te.La=function(t){try{if(t==this.g)t:{var e=wi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Le||this.g&&(this.h.h||this.g.fa()||bi(this.g)))){this.I||4!=e||7==n||qn(),yr(this);var r=this.g.aa();this.Y=r;e:if(dr(this)){var i=bi(this.g);t="";var s=i.length,o=4==wi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){wr(this),vr(this);var a="";break e}this.h.i=new re.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,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(!(r=u)){this.i=!1,this.o=3,Kn(12),wr(this),vr(this);break t}Fn(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,br(this,r)}this.P?(fr(this,e,a),Le&&this.i&&3==e&&(Mn(this.S,this.T,"tick",this.hb),this.T.start())):(Fn(this.j,this.m,a,null),br(this,a)),4==e&&wr(this),this.i&&!this.I&&(4==e?Ui(this.l,this):(this.i=!1,gr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,Kn(12)):(this.o=0,Kn(13)),wr(this),vr(this)}}}catch(e){}},te.hb=function(){if(this.g){var t=wi(this.g),e=this.g.fa();this.C<e.length&&(yr(this),fr(this,t,e),this.i&&4!=t&&gr(this))}},te.cancel=function(){this.I=!0,wr(this)},te.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&&(qn(),Kn(17)),wr(this),this.o=2,vr(this)):mr(this,this.V-t)};var _r=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Tr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Tr){this.h=void 0!==e?e:t.h,Ir(this,t.j),this.s=t.s,this.g=t.g,kr(this,t.m),this.l=t.l,e=t.i;var n=new zr;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Cr(this,n),this.o=t.o}else t&&(n=String(t).match(_r))?(this.h=!!e,Ir(this,n[1]||"",!0),this.s=Nr(n[2]||""),this.g=Nr(n[3]||"",!0),kr(this,n[4]),this.l=Nr(n[5]||"",!0),Cr(this,n[6]||"",!0),this.o=Nr(n[7]||"")):(this.h=!!e,this.i=new zr(null,this.h))}function Er(t){return new Tr(t)}function Ir(t,e,n){t.j=n?Nr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Cr(t,e,n){e instanceof zr?(t.i=e,function(t,e){e&&!t.j&&(Fr(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(Br(this,e),Hr(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Lr(e,Mr)),t.i=new zr(e,t.h))}function Ar(t,e,n){t.i.set(e,n)}function Rr(t){return Ar(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Nr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Lr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Or),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Or(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Tr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Lr(e,Dr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Lr(e,Dr,!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(Lr(n,"/"==n.charAt(0)?Pr:xr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Lr(n,Ur)),t.join("")};var Dr=/[#\/\?@]/g,xr=/[#\?:]/g,Pr=/[#\?]/g,Mr=/[#\?@]/g,Ur=/#/g;function zr(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function Fr(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function Br(t,e){Fr(t),e=jr(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function Vr(t,e){return Fr(t),e=jr(t,e),t.g.has(e)}function Hr(t,e,n){Br(t,e),0<n.length&&(t.i=null,t.g.set(jr(t,e),me(n)),t.h+=n.length)}function jr(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(te=zr.prototype).add=function(t,e){Fr(this),this.i=null,t=jr(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},te.forEach=function(t,e){Fr(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},te.oa=function(){Fr(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},te.W=function(t){Fr(this);var e=[];if("string"==typeof t)Vr(this,t)&&(e=e.concat(this.g.get(jr(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},te.set=function(t,e){return Fr(this),this.i=null,Vr(this,t=jr(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},te.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},te.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var qr=function(t,e){this.h=t,this.g=e};function $r(t){this.l=t||Kr,re.PerformanceNavigationTiming?t=0<(t=re.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(re.g&&re.g.Ga&&re.g.Ga()&&re.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 Kr=10;function Gr(t){return!!t.h||!!t.g&&t.g.size>=t.j}function Wr(t){return t.h?1:t.g?t.g.size:0}function Qr(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function Yr(t,e){t.g?t.g.add(e):t.h=e}function Jr(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function Xr(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=Xt(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return me(t.i)}function Zr(){}function ti(){this.g=new Zr}function ei(t,e,n){var r=n||"";try{Sr(t,(function(t,n){var i=t;oe(t)&&(i=vn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function ni(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function ri(t){this.l=t.ac||null,this.j=t.jb||!1}function ii(t,e){gn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=si,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}$r.prototype.cancel=function(){var t,e;if(this.i=Xr(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=Xt(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},Zr.prototype.stringify=function(t){return re.JSON.stringify(t,void 0)},Zr.prototype.parse=function(t){return re.JSON.parse(t,void 0)},fe(ri,Jn),ri.prototype.g=function(){return new ii(this.l,this.j)},ri.prototype.i=function(t){return function(){return t}}({}),fe(ii,gn);var si=0;function oi(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function ai(t){t.readyState=4,t.l=null,t.j=null,t.A=null,ci(t)}function ci(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(te=ii.prototype).open=function(t,e){if(this.readyState!=si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,ci(this)},te.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||re).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},te.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,ai(this)),this.readyState=si},te.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,ci(this)),this.g&&(this.readyState=3,ci(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==re.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;oi(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},te.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?ai(this):ci(this),3==this.readyState&&oi(this)}},te.Va=function(t){this.g&&(this.response=this.responseText=t,ai(this))},te.Ua=function(t){this.g&&(this.response=t,ai(this))},te.ga=function(){this.g&&ai(this)},te.setRequestHeader=function(t,e){this.v.append(t,e)},te.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},te.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(ii.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var li=re.JSON.parse;function ui(t){gn.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=hi,this.K=this.L=!1}fe(ui,gn);var hi="",di=/^https?$/i,fi=["POST","PUT"];function pi(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,gi(t),yi(t)}function gi(t){t.D||(t.D=!0,mn(t,"complete"),mn(t,"error"))}function mi(t){if(t.h&&void 0!==ne&&(!t.C[1]||4!=wi(t)||2!=t.aa()))if(t.v&&4==wi(t))Ln(t.Ha,0,t);else if(mn(t,"readystatechange"),4==wi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(_r)[1]||null;if(!s&&re.self&&re.self.location){var o=re.self.location.protocol;s=o.substr(0,o.length-1)}i=!di.test(s?s.toLowerCase():"")}e=i}if(e)mn(t,"complete"),mn(t,"success");else{t.m=6;try{var a=2<wi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",gi(t)}}finally{yi(t)}}}function yi(t,e){if(t.g){vi(t);var n=t.g,r=t.C[0]?ie:null;t.g=null,t.C=null,e||mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function vi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(re.clearTimeout(t.A),t.A=null)}function wi(t){return t.g?t.g.readyState:0}function bi(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case hi:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Si(t){var e="";return Qe(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function _i(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Si(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Ar(t,e,n))}function Ti(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Ei(t){this.Ca=0,this.i=[],this.j=new zn,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=Ti("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=Ti("baseRetryDelayMs",5e3,t),this.bb=Ti("retryDelaySeedMs",1e4,t),this.$a=Ti("forwardChannelMaxRetries",2,t),this.ta=Ti("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 $r(t&&t.concurrentRequestLimit),this.Fa=new ti,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 Ii(t){if(Ci(t),3==t.G){var e=t.U++,n=Er(t.F);Ar(n,"SID",t.I),Ar(n,"RID",e),Ar(n,"TYPE","terminate"),Ni(t,n),(e=new sr(t,t.j,e,void 0)).K=2,e.v=Rr(Er(n)),n=!1,re.navigator&&re.navigator.sendBeacon&&(n=re.navigator.sendBeacon(e.v.toString(),"")),!n&&re.Image&&((new Image).src=e.v,n=!0),n||(e.g=Hi(e.l,null),e.g.da(e.v)),e.F=Date.now(),gr(e)}Bi(t)}function ki(t){t.g&&(xi(t),t.g.cancel(),t.g=null)}function Ci(t){ki(t),t.u&&(re.clearTimeout(t.u),t.u=null),Mi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&re.clearTimeout(t.m),t.m=null)}function Ai(t){Gr(t.h)||t.m||(t.m=!0,In(t.Ja,t),t.C=0)}function Ri(t,e){var n;n=e?e.m:t.U++;var r=Er(t.F);Ar(r,"SID",t.I),Ar(r,"RID",n),Ar(r,"AID",t.T),Ni(t,r),t.o&&t.s&&_i(r,t.o,t.s),n=new sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Li(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),Yr(t.h,n),ur(n,r,e)}function Ni(t,e){t.ia&&Qe(t.ia,(function(t,n){Ar(e,n,t)})),t.l&&Sr({},(function(t,n){Ar(e,n,t)}))}function Li(t,e,n){n=Math.min(t.i.length,n);var r=t.l?he(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{ei(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Oi(t){t.g||t.u||(t.Z=1,In(t.Ia,t),t.A=0)}function Di(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=Wn(he(t.Ia,t),zi(t,t.A)),t.A++,!0)}function xi(t){null!=t.B&&(re.clearTimeout(t.B),t.B=null)}function Pi(t){t.g=new sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Er(t.sa);Ar(e,"RID","rpc"),Ar(e,"SID",t.I),Ar(e,"CI",t.L?"0":"1"),Ar(e,"AID",t.T),Ar(e,"TYPE","xmlhttp"),Ni(t,e),t.o&&t.s&&_i(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Rr(Er(e)),n.s=null,n.P=!0,hr(n,t)}function Mi(t){null!=t.v&&(re.clearTimeout(t.v),t.v=null)}function Ui(t,e){var n=null;if(t.g==e){Mi(t),xi(t),t.g=null;var r=2}else{if(!Qr(t.h,e))return;n=e.D,Jr(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;mn(r=Hn(),new Gn(r,n)),Ai(t)}else Oi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(Wr(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=Wn(he(t.Ja,t,e),zi(t,t.C)),t.C++,0)))}(t,e)||2==r&&Di(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:Fi(t,5);break;case 4:Fi(t,10);break;case 3:Fi(t,6);break;default:Fi(t,2)}}function zi(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function Fi(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=he(t.kb,t);n||(n=new Tr("//www.google.com/images/cleardot.gif"),re.location&&"http"==re.location.protocol||Ir(n,"https"),Rr(n)),function(t,e){var n=new zn;if(re.Image){var r=new Image;r.onload=de(ni,n,r,"TestLoadImage: loaded",!0,e),r.onerror=de(ni,n,r,"TestLoadImage: error",!1,e),r.onabort=de(ni,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=de(ni,n,r,"TestLoadImage: timeout",!1,e),re.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else Kn(2);t.G=0,t.l&&t.l.va(e),Bi(t),Ci(t)}function Bi(t){if(t.G=0,t.la=[],t.l){var e=Xr(t.h);0==e.length&&0==t.i.length||(ye(t.la,e),ye(t.la,t.i),t.h.i.length=0,me(t.i),t.i.length=0),t.l.ua()}}function Vi(t,e,n){var r=n instanceof Tr?Er(n):new Tr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),kr(r,r.m);else{var i=re.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Tr(null,void 0);r&&Ir(s,r),e&&(s.g=e),i&&kr(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&Ar(r,n,e),Ar(r,"VER",t.ma),Ni(t,r),r}function Hi(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 ui(new ri({jb:!0})):new ui(t.ra)).Ka(t.H),e}function ji(){}function qi(){if(Re&&!(10<=Number(He)))throw Error("Environmental error: no available transport.")}function $i(t,e){gn.call(this),this.g=new Ei(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 Wi(this)}function Ki(t){nr.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 Gi(){rr.call(this),this.status=1}function Wi(t){this.g=t}(te=ui.prototype).Ka=function(t){this.L=t},te.da=function(t,e,n,r){var i,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():tr.g(),this.C=this.u?Xn(this.u):Xn(tr),this.g.onreadystatechange=he(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void pi(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=Xt(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=re.FormData&&t instanceof re.FormData,!(0<=ge(fi,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=Xt(n),f=d.next();!f.done;f=d.next()){var p=Zt(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{vi(this),0<this.B&&((this.K=function(t){return Re&&Be()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=he(this.qa,this)):this.A=Ln(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){pi(this,h)}},te.qa=function(){void 0!==ne&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,mn(this,"timeout"),this.abort(8))},te.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"),yi(this))},te.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),yi(this,!0)),ui.X.M.call(this)},te.Ha=function(){this.s||(this.F||this.v||this.l?mi(this):this.fb())},te.fb=function(){mi(this)},te.aa=function(){try{return 2<wi(this)?this.g.status:-1}catch(t){return-1}},te.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},te.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),li(e)}},te.Ea=function(){return this.m},te.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(te=Ei.prototype).ma=8,te.G=1,te.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 sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?Xe(n=Ye(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Li(this,e,r),Ar(i=Er(this.F),"RID",t),Ar(i,"CVER",22),this.D&&Ar(i,"X-HTTP-Session-Id",this.D),Ni(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Si(n)))+"&"+r:this.o&&_i(i,this.o,n)),Yr(this.h,e),this.Ya&&Ar(i,"TYPE","init"),this.O?(Ar(i,"$req",r),Ar(i,"SID","null"),e.Z=!0,ur(e,i,null)):ur(e,i,r),this.G=2}}else 3==this.G&&(t?Ri(this,t):0==this.i.length||Gr(this.h)||Ri(this))},te.Ia=function(){if(this.u=null,Pi(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=Wn(he(this.eb,this),t)}},te.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,Kn(10),ki(this),Pi(this))},te.cb=function(){null!=this.v&&(this.v=null,ki(this),Di(this),Kn(19))},te.kb=function(t){t?(this.j.info("Successfully pinged google.com"),Kn(2)):(this.j.info("Failed to ping google.com"),Kn(1))},(te=ji.prototype).xa=function(){},te.wa=function(){},te.va=function(){},te.ua=function(){},te.Ra=function(){},qi.prototype.g=function(t,e){return new $i(t,e)},fe($i,gn),$i.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;Kn(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=Vi(t,null,t.V),Ai(t)},$i.prototype.close=function(){Ii(this.g)},$i.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=vn(t),t=n);e.i.push(new qr(e.ab++,t)),3==e.G&&Ai(e)},$i.prototype.M=function(){this.g.l=null,delete this.j,Ii(this.g),delete this.g,$i.X.M.call(this)},fe(Ki,nr),fe(Gi,rr),fe(Wi,ji),Wi.prototype.xa=function(){mn(this.g,"a")},Wi.prototype.wa=function(t){mn(this.g,new Ki(t))},Wi.prototype.va=function(t){mn(this.g,new Gi)},Wi.prototype.ua=function(){mn(this.g,"b")},qi.prototype.createWebChannel=qi.prototype.g,$i.prototype.send=$i.prototype.u,$i.prototype.open=$i.prototype.m,$i.prototype.close=$i.prototype.close,Qn.NO_ERROR=0,Qn.TIMEOUT=8,Qn.HTTP_ERROR=6,Yn.COMPLETE="complete",Zn.EventType=er,er.OPEN="a",er.CLOSE="b",er.ERROR="c",er.MESSAGE="d",gn.prototype.listen=gn.prototype.N,ui.prototype.listenOnce=ui.prototype.O,ui.prototype.getLastError=ui.prototype.Oa,ui.prototype.getLastErrorCode=ui.prototype.Ea,ui.prototype.getStatus=ui.prototype.aa,ui.prototype.getResponseJson=ui.prototype.Sa,ui.prototype.getResponseText=ui.prototype.fa,ui.prototype.send=ui.prototype.da,ui.prototype.setWithCredentials=ui.prototype.Ka;var Qi=Qn,Yi=Yn,Ji=Bn,Xi=10,Zi=11,ts=ri,es=Zn,ns=ui;const rs="@firebase/firestore";
|
|
318
|
+
*/var Yt;Yt="",Lt(new I("platform-logger",(t=>new X(t)),"PRIVATE")),Lt(new I("heartbeat",(t=>new Wt(t)),"PRIVATE")),Ft(Z,tt,Yt),Ft(Z,tt,"esm2017"),Ft("fire-js","");
|
|
319
|
+
/**
|
|
320
|
+
* @license
|
|
321
|
+
* Copyright 2017 Google LLC
|
|
322
|
+
*
|
|
323
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
324
|
+
* you may not use this file except in compliance with the License.
|
|
325
|
+
* You may obtain a copy of the License at
|
|
326
|
+
*
|
|
327
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
328
|
+
*
|
|
329
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
330
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
331
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
332
|
+
* See the License for the specific language governing permissions and
|
|
333
|
+
* limitations under the License.
|
|
334
|
+
*/
|
|
335
|
+
/**
|
|
336
|
+
* @license
|
|
337
|
+
* Copyright 2017 Google LLC
|
|
338
|
+
*
|
|
339
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
340
|
+
* you may not use this file except in compliance with the License.
|
|
341
|
+
* You may obtain a copy of the License at
|
|
342
|
+
*
|
|
343
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
344
|
+
*
|
|
345
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
346
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
347
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
348
|
+
* See the License for the specific language governing permissions and
|
|
349
|
+
* limitations under the License.
|
|
350
|
+
*/
|
|
351
|
+
const Jt=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},Xt={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const i=t[e],s=e+1<t.length,o=s?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let h=(15&o)<<2|c>>6,d=63&c;a||(d=64,s||(h=64)),r.push(n[l],n[u],n[h],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Jt(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(s>>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{const s=t[n++],o=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const i=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;const o=e<t.length?n[t.charAt(e)]:64;++e;const a=e<t.length?n[t.charAt(e)]:64;if(++e,null==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(r.push(c),64!==o){const t=s<<4&240|o>>2;if(r.push(t),64!==a){const t=o<<6&192|a;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},Zt=function(t){return function(t){const e=Jt(t);return Xt.encodeByteArray(e,!0)}(t).replace(/\./g,"")};
|
|
352
|
+
/**
|
|
353
|
+
* @license
|
|
354
|
+
* Copyright 2022 Google LLC
|
|
355
|
+
*
|
|
356
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
357
|
+
* you may not use this file except in compliance with the License.
|
|
358
|
+
* You may obtain a copy of the License at
|
|
359
|
+
*
|
|
360
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
361
|
+
*
|
|
362
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
363
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
364
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
365
|
+
* See the License for the specific language governing permissions and
|
|
366
|
+
* limitations under the License.
|
|
367
|
+
*/
|
|
368
|
+
const te=()=>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__,ee=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return Xt.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},ne=()=>{try{return te()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||ee()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},re=t=>{const e=(t=>{var e,n;return null===(n=null===(e=ne())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]};class ie extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,ie.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,se.prototype.create)}}class se{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(oe,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new ie(r,o,n)}}const oe=/\{\$([^}]+)}/g;
|
|
369
|
+
/**
|
|
370
|
+
* @license
|
|
371
|
+
* Copyright 2021 Google LLC
|
|
372
|
+
*
|
|
373
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
374
|
+
* you may not use this file except in compliance with the License.
|
|
375
|
+
* You may obtain a copy of the License at
|
|
376
|
+
*
|
|
377
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
378
|
+
*
|
|
379
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
380
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
381
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
382
|
+
* See the License for the specific language governing permissions and
|
|
383
|
+
* limitations under the License.
|
|
384
|
+
*/function ae(t){return t&&t._delegate?t._delegate:t}class ce{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}
|
|
385
|
+
/**
|
|
386
|
+
* @license
|
|
387
|
+
* Copyright 2017 Google LLC
|
|
388
|
+
*
|
|
389
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
390
|
+
* you may not use this file except in compliance with the License.
|
|
391
|
+
* You may obtain a copy of the License at
|
|
392
|
+
*
|
|
393
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
394
|
+
*
|
|
395
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
396
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
397
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
398
|
+
* See the License for the specific language governing permissions and
|
|
399
|
+
* limitations under the License.
|
|
400
|
+
*/var le;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(le||(le={}));const ue={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},he=le.INFO,de={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},fe=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=de[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};var pe=function(t,e){return pe=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])},pe(t,e)};function ge(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function me(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}var ye,ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},we=we||{},be=ve||self;function _e(){}function Se(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 Ee(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Te="closure_uid_"+(1e9*Math.random()>>>0),Ie=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ce(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Ae(t,e,n){return(Ae=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ce).apply(null,arguments)}function Re(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 Ne(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return e.prototype[n].apply(t,i)}}function Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Te)&&t[Te]||(t[Te]=++Ie))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var De=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 Oe(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Se(r)){var i=t.length||0,s=r.length||0;t.length=i+s;for(var o=0;o<s;o++)t[i+o]=r[o]}else t.push(r)}}function Pe(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Pe.prototype.h=function(){this.defaultPrevented=!0};var Me=function(){if(!be.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{be.addEventListener("test",_e,e),be.removeEventListener("test",_e,e)}catch(t){}return t}();function Ue(t){return/^[\s\xa0]*$/.test(t)}var Fe=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function ze(t,e){return t<e?-1:t>e?1:0}function Be(){var t=be.navigator;return t&&(t=t.userAgent)?t:""}function Ve(t){return-1!=Be().indexOf(t)}function He(t){return He[" "](t),t}He[" "]=_e;var $e,je,qe=Ve("Opera"),We=Ve("Trident")||Ve("MSIE"),Ke=Ve("Edge"),Ge=Ke||We,Qe=Ve("Gecko")&&!(-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge"))&&!(Ve("Trident")||Ve("MSIE"))&&!Ve("Edge"),Ye=-1!=Be().toLowerCase().indexOf("webkit")&&!Ve("Edge");function Je(){var t=be.document;return t?t.documentMode:void 0}t:{var Xe="",Ze=(je=Be(),Qe?/rv:([^\);]+)(\)|;)/.exec(je):Ke?/Edge\/([\d\.]+)/.exec(je):We?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(je):Ye?/WebKit\/(\S+)/.exec(je):qe?/(?:Version)[ \/]?(\S+)/.exec(je):void 0);if(Ze&&(Xe=Ze?Ze[1]:""),We){var tn=Je();if(null!=tn&&tn>parseFloat(Xe)){$e=String(tn);break t}}$e=Xe}var en,nn={};function rn(){return function(t){var e=nn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Fe(String($e)).split("."),n=Fe("9").split("."),r=Math.max(e.length,n.length),i=0;0==t&&i<r;i++){var s=e[i]||"",o=n[i]||"";do{if(s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==s[0].length&&0==o[0].length)break;t=ze(0==s[1].length?0:parseInt(s[1],10),0==o[1].length?0:parseInt(o[1],10))||ze(0==s[2].length,0==o[2].length)||ze(s[2],o[2]),s=s[3],o=o[3]}while(0==t)}return 0<=t}))}if(be.document&&We){var sn=Je();en=sn||(parseInt($e,10)||void 0)}else en=void 0;var on=en;function an(t,e){if(Pe.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Qe){t:{try{He(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:cn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&an.X.h.call(this)}}Ne(an,Pe);var cn={2:"touch",3:"pen",4:"mouse"};an.prototype.h=function(){an.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),un=0;function hn(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=i,this.key=++un,this.ba=this.ea=!1}function dn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function fn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function pn(t){var e={};for(var n in t)e[n]=t[n];return e}var gn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function mn(t,e){for(var n,r,i=1;i<arguments.length;i++){for(n in r=arguments[i])t[n]=r[n];for(var s=0;s<gn.length;s++)n=gn[s],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function yn(t){this.src=t,this.g={},this.h=0}function vn(t,e){var n=e.type;if(n in t.g){var r,i=t.g[n],s=De(i,e);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(dn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function wn(t,e,n,r){for(var i=0;i<t.length;++i){var s=t[i];if(!s.ba&&s.listener==e&&s.capture==!!n&&s.ha==r)return i}return-1}yn.prototype.add=function(t,e,n,r,i){var s=t.toString();(t=this.g[s])||(t=this.g[s]=[],this.h++);var o=wn(t,e,r,i);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new hn(e,this.src,s,!!r,i)).ea=n,t.push(e)),e};var bn="closure_lm_"+(1e6*Math.random()|0),_n={};function Sn(t,e,n,r,i){if(r&&r.once)return Tn(t,e,n,r,i);if(Array.isArray(e)){for(var s=0;s<e.length;s++)Sn(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!1,r,i)}function En(t,e,n,r,i,s){if(!e)throw Error("Invalid event type");var o=Ee(i)?!!i.capture:!!i,a=Rn(t);if(a||(t[bn]=a=new yn(t)),(n=a.add(e,n,r,o,s)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=An;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Me||(i=o),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Cn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function Tn(t,e,n,r,i){if(Array.isArray(e)){for(var s=0;s<e.length;s++)Tn(t,e[s],n,r,i);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,Ee(r)?!!r.capture:!!r,i):En(t,e,n,!0,r,i)}function In(t,e,n,r,i){if(Array.isArray(e))for(var s=0;s<e.length;s++)In(t,e[s],n,r,i);else r=Ee(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=wn(s=t.g[e],n,r,i))&&(dn(s[n]),Array.prototype.splice.call(s,n,1),0==s.length&&(delete t.g[e],t.h--)))):t&&(t=Rn(t))&&(e=t.g[e.toString()],t=-1,e&&(t=wn(e,n,r,i)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])vn(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Cn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=Rn(e))?(vn(n,t),0==n.h&&(n.src=null,e[bn]=null)):dn(t)}}}function Cn(t){return t in _n?_n[t]:_n[t]="on"+t}function An(t,e){if(t.ba)t=!0;else{e=new an(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function Rn(t){return(t=t[bn])instanceof yn?t:null}var Nn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Nn]||(t[Nn]=function(e){return t.handleEvent(e)}),t[Nn])}function Dn(){Le.call(this),this.i=new yn(this),this.P=this,this.I=null}function On(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Pe(e,t);else if(e instanceof Pe)e.target=e.target||t;else{var i=e;mn(e=new Pe(r,t),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=e.g=n[s];i=xn(o,r,!0,e)&&i}if(i=xn(o=e.g=t,r,!0,e)&&i,i=xn(o,r,!1,e)&&i,n)for(s=0;s<n.length;s++)i=xn(o=e.g=n[s],r,!1,e)&&i}function xn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var i=!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&&vn(t.i,o),i=!1!==a.call(c,r)&&i}}return i&&!r.defaultPrevented}Ne(Dn,Le),Dn.prototype[ln]=!0,Dn.prototype.removeEventListener=function(t,e,n,r){In(this,t,e,n,r)},Dn.prototype.M=function(){if(Dn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)dn(n[r]);delete e.g[t],e.h--}}this.I=null},Dn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Dn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Pn=be.JSON.stringify;function Mn(){var t=jn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Un,Fn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=zn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),zn=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 Bn}),(function(t){return t.reset()})),Bn=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 Vn(t){be.setTimeout((function(){throw t}),0)}function Hn(t,e){Un||function(){var t=be.Promise.resolve(void 0);Un=function(){t.then(qn)}}(),$n||(Un(),$n=!0),jn.add(t,e)}var $n=!1,jn=new Fn;function qn(){for(var t;t=Mn();){try{t.h.call(t.g)}catch(t){Vn(t)}var e=zn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}$n=!1}function Wn(t,e){Dn.call(this),this.h=t||1,this.g=e||be,this.j=Ae(this.lb,this),this.l=Date.now()}function Kn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Gn(t,e,n){if("function"==typeof t)n&&(t=Ae(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Ae(t.handleEvent,t)}return 2147483647<Number(e)?-1:be.setTimeout(t,e||0)}function Qn(t){t.g=Gn((function(){t.g=null,t.i&&(t.i=!1,Qn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}Ne(Wn,Dn),(ye=Wn.prototype).ca=!1,ye.R=null,ye.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),On(this,"tick"),this.ca&&(Kn(this),this.start()))}},ye.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},ye.M=function(){Wn.X.M.call(this),Kn(this),delete this.g};var Yn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}pe(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:Qn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(be.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Jn(t){Le.call(this),this.h=t,this.g={}}Ne(Jn,Le);var Xn=[];function Zn(t,e,n,r){Array.isArray(n)||(n&&(Xn[0]=n.toString()),n=Xn);for(var i=0;i<n.length;i++){var s=Sn(e,n[i],r||t.handleEvent,!1,t.h||t);if(!s)break;t.g[s.key]=s}}function tr(t){fn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function er(){this.g=!0}function nr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}return Pn(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Jn.prototype.M=function(){Jn.X.M.call(this),tr(this)},Jn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},er.prototype.Aa=function(){this.g=!1},er.prototype.info=function(){};var rr={},ir=null;function sr(){return ir=ir||new Dn}function or(t){Pe.call(this,rr.Pa,t)}function ar(t){var e=sr();On(e,new or(e))}function cr(t,e){Pe.call(this,rr.STAT_EVENT,t),this.stat=e}function lr(t){var e=sr();On(e,new cr(e,t))}function ur(t,e){Pe.call(this,rr.Qa,t),this.size=e}function hr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return be.setTimeout((function(){t()}),e)}rr.Pa="serverreachability",Ne(or,Pe),rr.STAT_EVENT="statevent",Ne(cr,Pe),rr.Qa="timingevent",Ne(ur,Pe);var dr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},fr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function pr(){}function gr(t){return t.h||(t.h=t.i())}function mr(){}pr.prototype.h=null;var yr,vr={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function wr(){Pe.call(this,"d")}function br(){Pe.call(this,"c")}function _r(){}function Sr(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Jn(this),this.O=Tr,t=Ge?125:void 0,this.T=new Wn(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 Er}function Er(){this.i=null,this.g="",this.h=!1}Ne(wr,Pe),Ne(br,Pe),Ne(_r,pr),_r.prototype.g=function(){return new XMLHttpRequest},_r.prototype.i=function(){return{}},yr=new _r;var Tr=45e3,Ir={},kr={};function Cr(t,e,n){t.K=1,t.v=Wr(Vr(e)),t.s=n,t.P=!0,Ar(t,null)}function Ar(t,e){t.F=Date.now(),Dr(t),t.A=Vr(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),si(n.i,"t",r),t.C=0,n=t.l.H,t.h=new Er,t.g=ss(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Yn(Ae(t.La,t,t.g),t.N)),Zn(t.S,t.g,"readystatechange",t.ib),e=t.H?pn(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)),ar(),function(t,e,n,r,i,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 ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Rr(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Nr(t,e,n){for(var r,i=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),i=!1),nr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Ir){t.o=4,lr(15),nr(t.j,t.m,n,"[Invalid Chunk]"),i=!1;break}nr(t.j,t.m,r,null),Ur(t,r)}Rr(t)&&r!=kr&&r!=Ir&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(16),i=!1),t.i=t.i&&i,i?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),Ji(e),e.K=!0,lr(11))):(nr(t.j,t.m,n,"[Invalid Chunked Response]"),Mr(t),Pr(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Ir:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Dr(t){t.V=Date.now()+t.O,Or(t,t.O)}function Or(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=hr(Ae(t.gb,t),e)}function xr(t){t.B&&(be.clearTimeout(t.B),t.B=null)}function Pr(t){0==t.l.G||t.I||ts(t.l,t)}function Mr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Kn(t.T),tr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Ur(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||di(n.h,t)))if(!t.J&&di(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(s){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;Zi(n),$i(n)}Yi(n),lr(18)}}else n.Ba=i[1],0<n.Ba-n.T&&37500>i[2]&&n.L&&0==n.A&&!n.v&&(n.v=hr(Ae(n.cb,n),6e3));if(1>=hi(n.h)&&n.ja){try{n.ja()}catch(s){}n.ja=void 0}}else ns(n,11)}else if((t.J||n.g==t)&&Zi(n),!Ue(e))for(i=n.Fa.g.parse(e),e=0;e<i.length;e++){var s=i[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&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var l=t.g;if(l){var u=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(u){var h=r.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&&(fi(h,h.h),h.h=null))}if(r.D){var d=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,qr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=is(r,r.H?r.ka:null,r.V),f.J){pi(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Dr(p)),r.g=f}else Qi(r);0<n.i.length&&qi(n)}else"stop"!=s[0]&&"close"!=s[0]||ns(n,7);else 3==n.G&&("stop"==s[0]||"close"==s[0]?"stop"==s[0]?ns(n,7):Hi(n):"noop"!=s[0]&&n.l&&n.l.wa(s),n.A=0)}ar()}catch(s){}}function Fr(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Se(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(Se(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Se(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),i=r.length,s=0;s<i;s++)e.call(void 0,r[s],n&&n[s],t)}(ye=Sr.prototype).setTimeout=function(t){this.O=t},ye.ib=function(t){t=t.target;var e=this.L;e&&3==Mi(t)?e.l():this.La(t)},ye.La=function(t){try{if(t==this.g)t:{var e=Mi(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ge||this.g&&(this.h.h||this.g.fa()||Ui(this.g)))){this.I||4!=e||7==n||ar(),xr(this);var r=this.g.aa();this.Y=r;e:if(Rr(this)){var i=Ui(this.g);t="";var s=i.length,o=4==Mi(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Mr(this),Pr(this);var a="";break e}this.h.i=new be.TextDecoder}for(n=0;n<s;n++)this.h.h=!0,t+=this.h.i.decode(i[n],{stream:o&&n==s-1});i.splice(0,s),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,i,s,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+s+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,l=this.g;if((c=l.g?l.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Ue(c)){var u=c;break e}}u=null}if(!(r=u)){this.i=!1,this.o=3,lr(12),Mr(this),Pr(this);break t}nr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Ur(this,r)}this.P?(Nr(this,e,a),Ge&&this.i&&3==e&&(Zn(this.S,this.T,"tick",this.hb),this.T.start())):(nr(this.j,this.m,a,null),Ur(this,a)),4==e&&Mr(this),this.i&&!this.I&&(4==e?ts(this.l,this):(this.i=!1,Dr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Mr(this),Pr(this)}}}catch(e){}},ye.hb=function(){if(this.g){var t=Mi(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Nr(this,t,e),this.i&&4!=t&&Dr(this))}},ye.cancel=function(){this.I=!0,Mr(this)},ye.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&&(ar(),lr(17)),Mr(this),this.o=2,Pr(this)):Or(this,this.V-t)};var zr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Br(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof Br){this.h=void 0!==e?e:t.h,Hr(this,t.j),this.s=t.s,this.g=t.g,$r(this,t.m),this.l=t.l,e=t.i;var n=new ei;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),jr(this,n),this.o=t.o}else t&&(n=String(t).match(zr))?(this.h=!!e,Hr(this,n[1]||"",!0),this.s=Kr(n[2]||""),this.g=Kr(n[3]||"",!0),$r(this,n[4]),this.l=Kr(n[5]||"",!0),jr(this,n[6]||"",!0),this.o=Kr(n[7]||"")):(this.h=!!e,this.i=new ei(null,this.h))}function Vr(t){return new Br(t)}function Hr(t,e,n){t.j=n?Kr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function $r(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 jr(t,e,n){e instanceof ei?(t.i=e,function(t,e){e&&!t.j&&(ni(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(ri(this,e),si(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Gr(e,Zr)),t.i=new ei(e,t.h))}function qr(t,e,n){t.i.set(e,n)}function Wr(t){return qr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Kr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Gr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Qr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Qr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Br.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Gr(e,Yr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Gr(e,Yr,!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(Gr(n,"/"==n.charAt(0)?Xr:Jr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Gr(n,ti)),t.join("")};var Yr=/[#\/\?@]/g,Jr=/[#\?:]/g,Xr=/[#\?]/g,Zr=/[#\?@]/g,ti=/#/g;function ei(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ni(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var s=t[n].substring(0,r);i=t[n].substring(r+1)}else s=t[n];e(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function ri(t,e){ni(t),e=oi(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function ii(t,e){return ni(t),e=oi(t,e),t.g.has(e)}function si(t,e,n){ri(t,e),0<n.length&&(t.i=null,t.g.set(oi(t,e),Oe(n)),t.h+=n.length)}function oi(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(ye=ei.prototype).add=function(t,e){ni(this),this.i=null,t=oi(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},ye.forEach=function(t,e){ni(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},ye.oa=function(){ni(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var i=t[r],s=0;s<i.length;s++)n.push(e[r]);return n},ye.W=function(t){ni(this);var e=[];if("string"==typeof t)ii(this,t)&&(e=e.concat(this.g.get(oi(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},ye.set=function(t,e){return ni(this),this.i=null,ii(this,t=oi(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},ye.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},ye.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r)),s=this.W(r);for(r=0;r<s.length;r++){var o=i;""!==s[r]&&(o+="="+encodeURIComponent(String(s[r]))),t.push(o)}}return this.i=t.join("&")};var ai=function(t,e){this.h=t,this.g=e};function ci(t){this.l=t||li,be.PerformanceNavigationTiming?t=0<(t=be.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(be.g&&be.g.Ga&&be.g.Ga()&&be.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 li=10;function ui(t){return!!t.h||!!t.g&&t.g.size>=t.j}function hi(t){return t.h?1:t.g?t.g.size:0}function di(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function fi(t,e){t.g?t.g.add(e):t.h=e}function pi(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function gi(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var i=ge(t.g.values()),s=i.next();!s.done;s=i.next()){var o=s.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}return Oe(t.i)}function mi(){}function yi(){this.g=new mi}function vi(t,e,n){var r=n||"";try{Fr(t,(function(t,n){var i=t;Ee(t)&&(i=Pn(t)),e.push(r+n+"="+encodeURIComponent(i))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function wi(t,e,n,r,i){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(t){}}function bi(t){this.l=t.ac||null,this.j=t.jb||!1}function _i(t,e){Dn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Si,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}ci.prototype.cancel=function(){var t,e;if(this.i=gi(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ge(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},mi.prototype.stringify=function(t){return be.JSON.stringify(t,void 0)},mi.prototype.parse=function(t){return be.JSON.parse(t,void 0)},Ne(bi,pr),bi.prototype.g=function(){return new _i(this.l,this.j)},bi.prototype.i=function(t){return function(){return t}}({}),Ne(_i,Dn);var Si=0;function Ei(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function Ti(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Ii(t)}function Ii(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(ye=_i.prototype).open=function(t,e){if(this.readyState!=Si)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Ii(this)},ye.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||be).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},ye.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,Ti(this)),this.readyState=Si},ye.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,Ii(this)),this.g&&(this.readyState=3,Ii(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==be.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;Ei(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},ye.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?Ti(this):Ii(this),3==this.readyState&&Ei(this)}},ye.Va=function(t){this.g&&(this.response=this.responseText=t,Ti(this))},ye.Ua=function(t){this.g&&(this.response=t,Ti(this))},ye.ga=function(){this.g&&Ti(this)},ye.setRequestHeader=function(t,e){this.v.append(t,e)},ye.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},ye.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(_i.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ki=be.JSON.parse;function Ci(t){Dn.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=Ai,this.K=this.L=!1}Ne(Ci,Dn);var Ai="",Ri=/^https?$/i,Ni=["POST","PUT"];function Li(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Di(t),xi(t)}function Di(t){t.D||(t.D=!0,On(t,"complete"),On(t,"error"))}function Oi(t){if(t.h&&void 0!==we&&(!t.C[1]||4!=Mi(t)||2!=t.aa()))if(t.v&&4==Mi(t))Gn(t.Ha,0,t);else if(On(t,"readystatechange"),4==Mi(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var i;if(i=0===n){var s=String(t.H).match(zr)[1]||null;if(!s&&be.self&&be.self.location){var o=be.self.location.protocol;s=o.substr(0,o.length-1)}i=!Ri.test(s?s.toLowerCase():"")}e=i}if(e)On(t,"complete"),On(t,"success");else{t.m=6;try{var a=2<Mi(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Di(t)}}finally{xi(t)}}}function xi(t,e){if(t.g){Pi(t);var n=t.g,r=t.C[0]?_e:null;t.g=null,t.C=null,e||On(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Pi(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(be.clearTimeout(t.A),t.A=null)}function Mi(t){return t.g?t.g.readyState:0}function Ui(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Ai:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Fi(t){var e="";return fn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function zi(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Fi(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):qr(t,e,n))}function Bi(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function Vi(t){this.Ca=0,this.i=[],this.j=new er,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=Bi("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=Bi("baseRetryDelayMs",5e3,t),this.bb=Bi("retryDelaySeedMs",1e4,t),this.$a=Bi("forwardChannelMaxRetries",2,t),this.ta=Bi("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 ci(t&&t.concurrentRequestLimit),this.Fa=new yi,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 Hi(t){if(ji(t),3==t.G){var e=t.U++,n=Vr(t.F);qr(n,"SID",t.I),qr(n,"RID",e),qr(n,"TYPE","terminate"),Ki(t,n),(e=new Sr(t,t.j,e,void 0)).K=2,e.v=Wr(Vr(n)),n=!1,be.navigator&&be.navigator.sendBeacon&&(n=be.navigator.sendBeacon(e.v.toString(),"")),!n&&be.Image&&((new Image).src=e.v,n=!0),n||(e.g=ss(e.l,null),e.g.da(e.v)),e.F=Date.now(),Dr(e)}rs(t)}function $i(t){t.g&&(Ji(t),t.g.cancel(),t.g=null)}function ji(t){$i(t),t.u&&(be.clearTimeout(t.u),t.u=null),Zi(t),t.h.cancel(),t.m&&("number"==typeof t.m&&be.clearTimeout(t.m),t.m=null)}function qi(t){ui(t.h)||t.m||(t.m=!0,Hn(t.Ja,t),t.C=0)}function Wi(t,e){var n;n=e?e.m:t.U++;var r=Vr(t.F);qr(r,"SID",t.I),qr(r,"RID",n),qr(r,"AID",t.T),Ki(t,r),t.o&&t.s&&zi(r,t.o,t.s),n=new Sr(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Gi(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),fi(t.h,n),Cr(n,r,e)}function Ki(t,e){t.ia&&fn(t.ia,(function(t,n){qr(e,n,t)})),t.l&&Fr({},(function(t,n){qr(e,n,t)}))}function Gi(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Ae(t.l.Ra,t.l,t):null;t:for(var i=t.i,s=-1;;){var o=["count="+n];-1==s?0<n?(s=i[0].h,o.push("ofs="+s)):s=0:o.push("ofs="+s);for(var a=!0,c=0;c<n;c++){var l=i[c].h,u=i[c].g;if(0>(l-=s))s=Math.max(0,i[c].h-100),a=!1;else try{vi(u,o,"req"+l+"_")}catch(t){r&&r(u)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Qi(t){t.g||t.u||(t.Z=1,Hn(t.Ia,t),t.A=0)}function Yi(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=hr(Ae(t.Ia,t),es(t,t.A)),t.A++,!0)}function Ji(t){null!=t.B&&(be.clearTimeout(t.B),t.B=null)}function Xi(t){t.g=new Sr(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=Vr(t.sa);qr(e,"RID","rpc"),qr(e,"SID",t.I),qr(e,"CI",t.L?"0":"1"),qr(e,"AID",t.T),qr(e,"TYPE","xmlhttp"),Ki(t,e),t.o&&t.s&&zi(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Wr(Vr(e)),n.s=null,n.P=!0,Ar(n,t)}function Zi(t){null!=t.v&&(be.clearTimeout(t.v),t.v=null)}function ts(t,e){var n=null;if(t.g==e){Zi(t),Ji(t),t.g=null;var r=2}else{if(!di(t.h,e))return;n=e.D,pi(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var i=t.C;On(r=sr(),new ur(r,n)),qi(t)}else Qi(t);else if(3==(i=e.o)||0==i&&0<t.pa||!(1==r&&function(t,e){return!(hi(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=hr(Ae(t.Ja,t,e),es(t,t.C)),t.C++,0)))}(t,e)||2==r&&Yi(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),i){case 1:ns(t,5);break;case 4:ns(t,10);break;case 3:ns(t,6);break;default:ns(t,2)}}function es(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function ns(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Ae(t.kb,t);n||(n=new Br("//www.google.com/images/cleardot.gif"),be.location&&"http"==be.location.protocol||Hr(n,"https"),Wr(n)),function(t,e){var n=new er;if(be.Image){var r=new Image;r.onload=Re(wi,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Re(wi,n,r,"TestLoadImage: error",!1,e),r.onabort=Re(wi,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Re(wi,n,r,"TestLoadImage: timeout",!1,e),be.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),rs(t),ji(t)}function rs(t){if(t.G=0,t.la=[],t.l){var e=gi(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Oe(t.i),t.i.length=0),t.l.ua()}}function is(t,e,n){var r=n instanceof Br?Vr(n):new Br(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),$r(r,r.m);else{var i=be.location;r=i.protocol,e=e?e+"."+i.hostname:i.hostname,i=+i.port;var s=new Br(null,void 0);r&&Hr(s,r),e&&(s.g=e),i&&$r(s,i),n&&(s.l=n),r=s}return n=t.D,e=t.za,n&&e&&qr(r,n,e),qr(r,"VER",t.ma),Ki(t,r),r}function ss(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 Ci(new bi({jb:!0})):new Ci(t.ra)).Ka(t.H),e}function os(){}function as(){if(We&&!(10<=Number(on)))throw Error("Environmental error: no available transport.")}function cs(t,e){Dn.call(this),this.g=new Vi(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)&&!Ue(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ue(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new hs(this)}function ls(t){wr.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 us(){br.call(this),this.status=1}function hs(t){this.g=t}(ye=Ci.prototype).Ka=function(t){this.L=t},ye.da=function(t,e,n,r){var i,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():yr.g(),this.C=this.u?gr(this.u):gr(yr),this.g.onreadystatechange=Ae(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(h){return void Li(this,h)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var l=ge(r.keys()),u=l.next();!u.done;u=l.next()){var h=u.value;n.set(h,r.get(h))}}catch(t){i={error:t}}finally{try{u&&!u.done&&(s=l.return)&&s.call(l)}finally{if(i)throw i.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=be.FormData&&t instanceof be.FormData,!(0<=De(Ni,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ge(n),f=d.next();!f.done;f=d.next()){var p=me(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{Pi(this),0<this.B&&((this.K=function(t){return We&&rn()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Ae(this.qa,this)):this.A=Gn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(h){Li(this,h)}},ye.qa=function(){void 0!==we&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,On(this,"timeout"),this.abort(8))},ye.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,On(this,"complete"),On(this,"abort"),xi(this))},ye.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xi(this,!0)),Ci.X.M.call(this)},ye.Ha=function(){this.s||(this.F||this.v||this.l?Oi(this):this.fb())},ye.fb=function(){Oi(this)},ye.aa=function(){try{return 2<Mi(this)?this.g.status:-1}catch(t){return-1}},ye.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},ye.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ki(e)}},ye.Ea=function(){return this.m},ye.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(ye=Vi.prototype).ma=8,ye.G=1,ye.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 Sr(this,this.j,t,void 0),n=this.s;if(this.S&&(n?mn(n=pn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,i=0;i<this.i.length;i++){var s=this.i[i];if(void 0===(s="__data__"in s.g&&"string"==typeof(s=s.g.__data__)?s.length:void 0))break;if(4096<(r+=s)){r=i;break t}if(4096===r||i===this.i.length-1){r=i+1;break t}}r=1e3}else r=1e3;r=Gi(this,e,r),qr(i=Vr(this.F),"RID",t),qr(i,"CVER",22),this.D&&qr(i,"X-HTTP-Session-Id",this.D),Ki(this,i),n&&(this.N?r="headers="+encodeURIComponent(String(Fi(n)))+"&"+r:this.o&&zi(i,this.o,n)),fi(this.h,e),this.Ya&&qr(i,"TYPE","init"),this.O?(qr(i,"$req",r),qr(i,"SID","null"),e.Z=!0,Cr(e,i,null)):Cr(e,i,r),this.G=2}}else 3==this.G&&(t?Wi(this,t):0==this.i.length||ui(this.h)||Wi(this))},ye.Ia=function(){if(this.u=null,Xi(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=hr(Ae(this.eb,this),t)}},ye.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,lr(10),$i(this),Xi(this))},ye.cb=function(){null!=this.v&&(this.v=null,$i(this),Yi(this),lr(19))},ye.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(ye=os.prototype).xa=function(){},ye.wa=function(){},ye.va=function(){},ye.ua=function(){},ye.Ra=function(){},as.prototype.g=function(t,e){return new cs(t,e)},Ne(cs,Dn),cs.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=is(t,null,t.V),qi(t)},cs.prototype.close=function(){Hi(this.g)},cs.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Pn(t),t=n);e.i.push(new ai(e.ab++,t)),3==e.G&&qi(e)},cs.prototype.M=function(){this.g.l=null,delete this.j,Hi(this.g),delete this.g,cs.X.M.call(this)},Ne(ls,wr),Ne(us,br),Ne(hs,os),hs.prototype.xa=function(){On(this.g,"a")},hs.prototype.wa=function(t){On(this.g,new ls(t))},hs.prototype.va=function(t){On(this.g,new us)},hs.prototype.ua=function(){On(this.g,"b")},as.prototype.createWebChannel=as.prototype.g,cs.prototype.send=cs.prototype.u,cs.prototype.open=cs.prototype.m,cs.prototype.close=cs.prototype.close,dr.NO_ERROR=0,dr.TIMEOUT=8,dr.HTTP_ERROR=6,fr.COMPLETE="complete",mr.EventType=vr,vr.OPEN="a",vr.CLOSE="b",vr.ERROR="c",vr.MESSAGE="d",Dn.prototype.listen=Dn.prototype.N,Ci.prototype.listenOnce=Ci.prototype.O,Ci.prototype.getLastError=Ci.prototype.Oa,Ci.prototype.getLastErrorCode=Ci.prototype.Ea,Ci.prototype.getStatus=Ci.prototype.aa,Ci.prototype.getResponseJson=Ci.prototype.Sa,Ci.prototype.getResponseText=Ci.prototype.fa,Ci.prototype.send=Ci.prototype.da,Ci.prototype.setWithCredentials=Ci.prototype.Ka;var ds=dr,fs=fr,ps=rr,gs=10,ms=11,ys=bi,vs=mr,ws=Ci;const bs="@firebase/firestore";
|
|
319
401
|
/**
|
|
320
402
|
* @license
|
|
321
403
|
* Copyright 2017 Google LLC
|
|
@@ -331,7 +413,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
331
413
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
332
414
|
* See the License for the specific language governing permissions and
|
|
333
415
|
* limitations under the License.
|
|
334
|
-
*/class
|
|
416
|
+
*/class _s{constructor(t){this.uid=t}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(t){return t.uid===this.uid}}_s.UNAUTHENTICATED=new _s(null),_s.GOOGLE_CREDENTIALS=new _s("google-credentials-uid"),_s.FIRST_PARTY=new _s("first-party-uid"),_s.MOCK_USER=new _s("mock-user");
|
|
335
417
|
/**
|
|
336
418
|
* @license
|
|
337
419
|
* Copyright 2017 Google LLC
|
|
@@ -348,7 +430,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
|
|
|
348
430
|
* See the License for the specific language governing permissions and
|
|
349
431
|
* limitations under the License.
|
|
350
432
|
*/
|
|
351
|
-
let
|
|
433
|
+
let Ss="9.15.0";
|
|
352
434
|
/**
|
|
353
435
|
* @license
|
|
354
436
|
* Copyright 2017 Google LLC
|
|
@@ -364,7 +446,7 @@ let ss="9.15.0";
|
|
|
364
446
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
365
447
|
* See the License for the specific language governing permissions and
|
|
366
448
|
* limitations under the License.
|
|
367
|
-
*/const
|
|
449
|
+
*/const Es=new class{constructor(t){this.name=t,this._logLevel=he,this._logHandler=fe,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in le))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?ue[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,le.DEBUG,...t),this._logHandler(this,le.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,le.VERBOSE,...t),this._logHandler(this,le.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,le.INFO,...t),this._logHandler(this,le.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,le.WARN,...t),this._logHandler(this,le.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,le.ERROR,...t),this._logHandler(this,le.ERROR,...t)}}("@firebase/firestore");function Ts(){return Es.logLevel}function Is(t,...e){if(Es.logLevel<=le.DEBUG){const n=e.map(As);Es.debug(`Firestore (${Ss}): ${t}`,...n)}}function ks(t,...e){if(Es.logLevel<=le.ERROR){const n=e.map(As);Es.error(`Firestore (${Ss}): ${t}`,...n)}}function Cs(t,...e){if(Es.logLevel<=le.WARN){const n=e.map(As);Es.warn(`Firestore (${Ss}): ${t}`,...n)}}function As(t){if("string"==typeof t)return t;try{return e=t,JSON.stringify(e)}catch(e){return t}
|
|
368
450
|
/**
|
|
369
451
|
* @license
|
|
370
452
|
* Copyright 2020 Google LLC
|
|
@@ -396,7 +478,7 @@ let ss="9.15.0";
|
|
|
396
478
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
397
479
|
* See the License for the specific language governing permissions and
|
|
398
480
|
* limitations under the License.
|
|
399
|
-
*/function
|
|
481
|
+
*/function Rs(t="Unexpected state"){const e=`FIRESTORE (${Ss}) INTERNAL ASSERTION FAILED: `+t;throw ks(e),new Error(e)}function Ns(t,e){t||Rs()}function Ls(t,e){return t}
|
|
400
482
|
/**
|
|
401
483
|
* @license
|
|
402
484
|
* Copyright 2017 Google LLC
|
|
@@ -412,7 +494,7 @@ let ss="9.15.0";
|
|
|
412
494
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
413
495
|
* See the License for the specific language governing permissions and
|
|
414
496
|
* limitations under the License.
|
|
415
|
-
*/const
|
|
497
|
+
*/const Ds={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 Os extends ie{constructor(t,e){super(t,e),this.code=t,this.message=e,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
416
498
|
/**
|
|
417
499
|
* @license
|
|
418
500
|
* Copyright 2017 Google LLC
|
|
@@ -428,7 +510,7 @@ let ss="9.15.0";
|
|
|
428
510
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
429
511
|
* See the License for the specific language governing permissions and
|
|
430
512
|
* limitations under the License.
|
|
431
|
-
*/class
|
|
513
|
+
*/class xs{constructor(){this.promise=new Promise(((t,e)=>{this.resolve=t,this.reject=e}))}}
|
|
432
514
|
/**
|
|
433
515
|
* @license
|
|
434
516
|
* Copyright 2017 Google LLC
|
|
@@ -444,7 +526,7 @@ let ss="9.15.0";
|
|
|
444
526
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
445
527
|
* See the License for the specific language governing permissions and
|
|
446
528
|
* limitations under the License.
|
|
447
|
-
*/class
|
|
529
|
+
*/class Ps{constructor(t,e){this.user=e,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${t}`)}}class Ms{getToken(){return Promise.resolve(null)}invalidateToken(){}start(t,e){t.enqueueRetryable((()=>e(_s.UNAUTHENTICATED)))}shutdown(){}}class Us{constructor(t){this.token=t,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(t,e){this.changeListener=e,t.enqueueRetryable((()=>e(this.token.user)))}shutdown(){this.changeListener=null}}class Fs{constructor(t){this.t=t,this.currentUser=_s.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(t,e){let n=this.i;const r=t=>this.i!==n?(n=this.i,e(t)):Promise.resolve();let i=new xs;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new xs,t.enqueueRetryable((()=>r(this.currentUser)))};const s=()=>{const e=i;t.enqueueRetryable((async()=>{await e.promise,await r(this.currentUser)}))},o=t=>{Is("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=t,this.auth.addAuthTokenListener(this.o),s()};this.t.onInit((t=>o(t))),setTimeout((()=>{if(!this.auth){const t=this.t.getImmediate({optional:!0});t?o(t):(Is("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new xs)}}),0),s()}getToken(){const t=this.i,e=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(e).then((e=>this.i!==t?(Is("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):e?(Ns("string"==typeof e.accessToken),new Ps(e.accessToken,this.currentUser)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.auth.removeAuthTokenListener(this.o)}u(){const t=this.auth&&this.auth.getUid();return Ns(null===t||"string"==typeof t),new _s(t)}}class zs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r,this.type="FirstParty",this.user=_s.FIRST_PARTY,this.p=new Map}I(){return this.g?this.g():(Ns(!("object"!=typeof this.h||null===this.h||!this.h.auth||!this.h.auth.getAuthHeaderValueForFirstParty)),this.h.auth.getAuthHeaderValueForFirstParty([]))}get headers(){this.p.set("X-Goog-AuthUser",this.l);const t=this.I();return t&&this.p.set("Authorization",t),this.m&&this.p.set("X-Goog-Iam-Authorization-Token",this.m),this.p}}class Bs{constructor(t,e,n,r){this.h=t,this.l=e,this.m=n,this.g=r}getToken(){return Promise.resolve(new zs(this.h,this.l,this.m,this.g))}start(t,e){t.enqueueRetryable((()=>e(_s.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Vs{constructor(t){this.value=t,this.type="AppCheck",this.headers=new Map,t&&t.length>0&&this.headers.set("x-firebase-appcheck",this.value)}}class Hs{constructor(t){this.T=t,this.forceRefresh=!1,this.appCheck=null,this.A=null}start(t,e){const n=t=>{null!=t.error&&Is("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${t.error.message}`);const n=t.token!==this.A;return this.A=t.token,Is("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?e(t.token):Promise.resolve()};this.o=e=>{t.enqueueRetryable((()=>n(e)))};const r=t=>{Is("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=t,this.appCheck.addTokenListener(this.o)};this.T.onInit((t=>r(t))),setTimeout((()=>{if(!this.appCheck){const t=this.T.getImmediate({optional:!0});t?r(t):Is("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){const t=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(t).then((t=>t?(Ns("string"==typeof t.token),this.A=t.token,new Vs(t.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.appCheck.removeTokenListener(this.o)}}
|
|
448
530
|
/**
|
|
449
531
|
* @license
|
|
450
532
|
* Copyright 2020 Google LLC
|
|
@@ -460,7 +542,7 @@ let ss="9.15.0";
|
|
|
460
542
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
461
543
|
* See the License for the specific language governing permissions and
|
|
462
544
|
* limitations under the License.
|
|
463
|
-
*/function
|
|
545
|
+
*/function $s(t){const e="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(n);else for(let e=0;e<t;e++)n[e]=Math.floor(256*Math.random());return n}
|
|
464
546
|
/**
|
|
465
547
|
* @license
|
|
466
548
|
* Copyright 2017 Google LLC
|
|
@@ -476,7 +558,7 @@ let ss="9.15.0";
|
|
|
476
558
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
477
559
|
* See the License for the specific language governing permissions and
|
|
478
560
|
* limitations under the License.
|
|
479
|
-
*/class
|
|
561
|
+
*/class js{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=$s(40);for(let i=0;i<r.length;++i)n.length<20&&r[i]<e&&(n+=t.charAt(r[i]%62))}return n}}function qs(t,e){return t<e?-1:t>e?1:0}function Ws(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
|
|
480
562
|
/**
|
|
481
563
|
* @license
|
|
482
564
|
* Copyright 2017 Google LLC
|
|
@@ -492,7 +574,7 @@ let ss="9.15.0";
|
|
|
492
574
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
493
575
|
* See the License for the specific language governing permissions and
|
|
494
576
|
* limitations under the License.
|
|
495
|
-
*/class
|
|
577
|
+
*/class Ks{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Os(Ds.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Os(Ds.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Os(Ds.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Os(Ds.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Ks.fromMillis(Date.now())}static fromDate(t){return Ks.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Ks(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?qs(this.nanoseconds,t.nanoseconds):qs(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
|
|
496
578
|
/**
|
|
497
579
|
* @license
|
|
498
580
|
* Copyright 2017 Google LLC
|
|
@@ -508,7 +590,7 @@ let ss="9.15.0";
|
|
|
508
590
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
509
591
|
* See the License for the specific language governing permissions and
|
|
510
592
|
* limitations under the License.
|
|
511
|
-
*/class
|
|
593
|
+
*/class Gs{constructor(t){this.timestamp=t}static fromTimestamp(t){return new Gs(t)}static min(){return new Gs(new Ks(0,0))}static max(){return new Gs(new Ks(253402300799,999999999))}compareTo(t){return this.timestamp._compareTo(t.timestamp)}isEqual(t){return this.timestamp.isEqual(t.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}
|
|
512
594
|
/**
|
|
513
595
|
* @license
|
|
514
596
|
* Copyright 2017 Google LLC
|
|
@@ -524,7 +606,7 @@ let ss="9.15.0";
|
|
|
524
606
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
525
607
|
* See the License for the specific language governing permissions and
|
|
526
608
|
* limitations under the License.
|
|
527
|
-
*/class
|
|
609
|
+
*/class Qs{constructor(t,e,n){void 0===e?e=0:e>t.length&&Rs(),void 0===n?n=t.length-e:n>t.length-e&&Rs(),this.segments=t,this.offset=e,this.len=n}get length(){return this.len}isEqual(t){return 0===Qs.comparator(this,t)}child(t){const e=this.segments.slice(this.offset,this.limit());return t instanceof Qs?t.forEach((t=>{e.push(t)})):e.push(t),this.construct(e)}limit(){return this.offset+this.length}popFirst(t){return t=void 0===t?1:t,this.construct(this.segments,this.offset+t,this.length-t)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(t){return this.segments[this.offset+t]}isEmpty(){return 0===this.length}isPrefixOf(t){if(t.length<this.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}isImmediateParentOf(t){if(this.length+1!==t.length)return!1;for(let e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0}forEach(t){for(let e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const n=t.get(r),i=e.get(r);if(n<i)return-1;if(n>i)return 1}return t.length<e.length?-1:t.length>e.length?1:0}}class Ys extends Qs{construct(t,e,n){return new Ys(t,e,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}static fromString(...t){const e=[];for(const n of t){if(n.indexOf("//")>=0)throw new Os(Ds.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);e.push(...n.split("/").filter((t=>t.length>0)))}return new Ys(e)}static emptyPath(){return new Ys([])}}const Js=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Xs extends Qs{construct(t,e,n){return new Xs(t,e,n)}static isValidIdentifier(t){return Js.test(t)}canonicalString(){return this.toArray().map((t=>(t=t.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Xs.isValidIdentifier(t)||(t="`"+t+"`"),t))).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&"__name__"===this.get(0)}static keyField(){return new Xs(["__name__"])}static fromServerFormat(t){const e=[];let n="",r=0;const i=()=>{if(0===n.length)throw new Os(Ds.INVALID_ARGUMENT,`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);e.push(n),n=""};let s=!1;for(;r<t.length;){const e=t[r];if("\\"===e){if(r+1===t.length)throw new Os(Ds.INVALID_ARGUMENT,"Path has trailing escape character: "+t);const e=t[r+1];if("\\"!==e&&"."!==e&&"`"!==e)throw new Os(Ds.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);n+=e,r+=2}else"`"===e?(s=!s,r++):"."!==e||s?(n+=e,r++):(i(),r++)}if(i(),s)throw new Os(Ds.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new Xs(e)}static emptyPath(){return new Xs([])}}
|
|
528
610
|
/**
|
|
529
611
|
* @license
|
|
530
612
|
* Copyright 2017 Google LLC
|
|
@@ -540,7 +622,7 @@ let ss="9.15.0";
|
|
|
540
622
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
541
623
|
* See the License for the specific language governing permissions and
|
|
542
624
|
* limitations under the License.
|
|
543
|
-
*/class
|
|
625
|
+
*/class Zs{constructor(t){this.path=t}static fromPath(t){return new Zs(Ys.fromString(t))}static fromName(t){return new Zs(Ys.fromString(t).popFirst(5))}static empty(){return new Zs(Ys.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Ys.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Ys.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new Zs(new Ys(t.slice()))}}function to(t){return new eo(t.readTime,t.key,-1)}class eo{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new eo(Gs.min(),Zs.empty(),-1)}static max(){return new eo(Gs.max(),Zs.empty(),-1)}}function no(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=Zs.comparator(t.documentKey,e.documentKey),0!==n?n:qs(t.largestBatchId,e.largestBatchId)
|
|
544
626
|
/**
|
|
545
627
|
* @license
|
|
546
628
|
* Copyright 2020 Google LLC
|
|
@@ -556,7 +638,7 @@ let ss="9.15.0";
|
|
|
556
638
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
557
639
|
* See the License for the specific language governing permissions and
|
|
558
640
|
* limitations under the License.
|
|
559
|
-
*/)}const
|
|
641
|
+
*/)}const ro="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class io{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(t){this.onCommittedListeners.push(t)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((t=>t()))}}
|
|
560
642
|
/**
|
|
561
643
|
* @license
|
|
562
644
|
* Copyright 2017 Google LLC
|
|
@@ -572,7 +654,7 @@ let ss="9.15.0";
|
|
|
572
654
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
573
655
|
* See the License for the specific language governing permissions and
|
|
574
656
|
* limitations under the License.
|
|
575
|
-
*/async function
|
|
657
|
+
*/async function so(t){if(t.code!==Ds.FAILED_PRECONDITION||t.message!==ro)throw t;Is("LocalStore","Unexpectedly lost primary lease")}
|
|
576
658
|
/**
|
|
577
659
|
* @license
|
|
578
660
|
* Copyright 2017 Google LLC
|
|
@@ -588,7 +670,7 @@ let ss="9.15.0";
|
|
|
588
670
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
589
671
|
* See the License for the specific language governing permissions and
|
|
590
672
|
* limitations under the License.
|
|
591
|
-
*/class
|
|
673
|
+
*/class oo{constructor(t){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t((t=>{this.isDone=!0,this.result=t,this.nextCallback&&this.nextCallback(t)}),(t=>{this.isDone=!0,this.error=t,this.catchCallback&&this.catchCallback(t)}))}catch(t){return this.next(void 0,t)}next(t,e){return this.callbackAttached&&Rs(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(e,this.error):this.wrapSuccess(t,this.result):new oo(((n,r)=>{this.nextCallback=e=>{this.wrapSuccess(t,e).next(n,r)},this.catchCallback=t=>{this.wrapFailure(e,t).next(n,r)}}))}toPromise(){return new Promise(((t,e)=>{this.next(t,e)}))}wrapUserFunction(t){try{const e=t();return e instanceof oo?e:oo.resolve(e)}catch(t){return oo.reject(t)}}wrapSuccess(t,e){return t?this.wrapUserFunction((()=>t(e))):oo.resolve(e)}wrapFailure(t,e){return t?this.wrapUserFunction((()=>t(e))):oo.reject(e)}static resolve(t){return new oo(((e,n)=>{e(t)}))}static reject(t){return new oo(((e,n)=>{n(t)}))}static waitFor(t){return new oo(((e,n)=>{let r=0,i=0,s=!1;t.forEach((t=>{++r,t.next((()=>{++i,s&&i===r&&e()}),(t=>n(t)))})),s=!0,i===r&&e()}))}static or(t){let e=oo.resolve(!1);for(const n of t)e=e.next((t=>t?oo.resolve(t):n()));return e}static forEach(t,e){const n=[];return t.forEach(((t,r)=>{n.push(e.call(this,t,r))})),this.waitFor(n)}static mapArray(t,e){return new oo(((n,r)=>{const i=t.length,s=new Array(i);let o=0;for(let a=0;a<i;a++){const c=a;e(t[c]).next((t=>{s[c]=t,++o,o===i&&n(s)}),(t=>r(t)))}}))}static doWhile(t,e){return new oo(((n,r)=>{const i=()=>{!0===t()?e().next((()=>{i()}),r):n()};i()}))}}function ao(t){return"IndexedDbTransactionError"===t.name}
|
|
592
674
|
/**
|
|
593
675
|
* @license
|
|
594
676
|
* Copyright 2018 Google LLC
|
|
@@ -604,7 +686,7 @@ let ss="9.15.0";
|
|
|
604
686
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
605
687
|
* See the License for the specific language governing permissions and
|
|
606
688
|
* limitations under the License.
|
|
607
|
-
*/class
|
|
689
|
+
*/class co{constructor(t,e){this.previousValue=t,e&&(e.sequenceNumberHandler=t=>this.ut(t),this.ct=t=>e.writeSequenceNumber(t))}ut(t){return this.previousValue=Math.max(t,this.previousValue),this.previousValue}next(){const t=++this.previousValue;return this.ct&&this.ct(t),t}}co.at=-1;
|
|
608
690
|
/**
|
|
609
691
|
* @license
|
|
610
692
|
* Copyright 2017 Google LLC
|
|
@@ -621,7 +703,7 @@ let ss="9.15.0";
|
|
|
621
703
|
* See the License for the specific language governing permissions and
|
|
622
704
|
* limitations under the License.
|
|
623
705
|
*/
|
|
624
|
-
class
|
|
706
|
+
class lo{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.useFetchStreams=a}}class uo{constructor(t,e){this.projectId=t,this.database=e||"(default)"}static empty(){return new uo("","")}get isDefaultDatabase(){return"(default)"===this.database}isEqual(t){return t instanceof uo&&t.projectId===this.projectId&&t.database===this.database}}
|
|
625
707
|
/**
|
|
626
708
|
* @license
|
|
627
709
|
* Copyright 2017 Google LLC
|
|
@@ -637,7 +719,7 @@ class Ks{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
637
719
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
638
720
|
* See the License for the specific language governing permissions and
|
|
639
721
|
* limitations under the License.
|
|
640
|
-
*/function
|
|
722
|
+
*/function ho(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function fo(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function po(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}
|
|
641
723
|
/**
|
|
642
724
|
* @license
|
|
643
725
|
* Copyright 2017 Google LLC
|
|
@@ -653,7 +735,7 @@ class Ks{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
653
735
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
654
736
|
* See the License for the specific language governing permissions and
|
|
655
737
|
* limitations under the License.
|
|
656
|
-
*/function
|
|
738
|
+
*/function go(t){return null==t}function mo(t){return 0===t&&1/t==-1/0}
|
|
657
739
|
/**
|
|
658
740
|
* @license
|
|
659
741
|
* Copyright 2020 Google LLC
|
|
@@ -670,7 +752,7 @@ class Ks{constructor(t,e,n,r,i,s,o,a){this.databaseId=t,this.appId=e,this.persis
|
|
|
670
752
|
* See the License for the specific language governing permissions and
|
|
671
753
|
* limitations under the License.
|
|
672
754
|
*/
|
|
673
|
-
class
|
|
755
|
+
class yo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=atob(t);return new yo(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 yo(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}
|
|
674
756
|
/**
|
|
675
757
|
* @license
|
|
676
758
|
* Copyright 2020 Google LLC
|
|
@@ -686,7 +768,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
686
768
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
687
769
|
* See the License for the specific language governing permissions and
|
|
688
770
|
* limitations under the License.
|
|
689
|
-
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return
|
|
771
|
+
*/(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return qs(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}yo.EMPTY_BYTE_STRING=new yo("");const vo=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function wo(t){if(Ns(!!t),"string"==typeof t){let e=0;const n=vo.exec(t);if(Ns(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:bo(t.seconds),nanos:bo(t.nanos)}}function bo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function _o(t){return"string"==typeof t?yo.fromBase64String(t):yo.fromUint8Array(t)}
|
|
690
772
|
/**
|
|
691
773
|
* @license
|
|
692
774
|
* Copyright 2020 Google LLC
|
|
@@ -702,7 +784,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
702
784
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
703
785
|
* See the License for the specific language governing permissions and
|
|
704
786
|
* limitations under the License.
|
|
705
|
-
*/function
|
|
787
|
+
*/function So(t){var e,n;return"server_timestamp"===(null===(n=((null===(e=null==t?void 0:t.mapValue)||void 0===e?void 0:e.fields)||{}).__type__)||void 0===n?void 0:n.stringValue)}function Eo(t){const e=t.mapValue.fields.__previous_value__;return So(e)?Eo(e):e}function To(t){const e=wo(t.mapValue.fields.__local_write_time__.timestampValue);return new Ks(e.seconds,e.nanos)}
|
|
706
788
|
/**
|
|
707
789
|
* @license
|
|
708
790
|
* Copyright 2020 Google LLC
|
|
@@ -718,7 +800,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
718
800
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
719
801
|
* See the License for the specific language governing permissions and
|
|
720
802
|
* limitations under the License.
|
|
721
|
-
*/const
|
|
803
|
+
*/const Io={mapValue:{fields:{__type__:{stringValue:"__max__"}}}};function ko(t){return"nullValue"in t?0:"booleanValue"in t?1:"integerValue"in t||"doubleValue"in t?2:"timestampValue"in t?3:"stringValue"in t?5:"bytesValue"in t?6:"referenceValue"in t?7:"geoPointValue"in t?8:"arrayValue"in t?9:"mapValue"in t?So(t)?4:function(t){return"__max__"===(((t.mapValue||{}).fields||{}).__type__||{}).stringValue}
|
|
722
804
|
/**
|
|
723
805
|
* @license
|
|
724
806
|
* Copyright 2022 Google LLC
|
|
@@ -734,7 +816,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
734
816
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
735
817
|
* See the License for the specific language governing permissions and
|
|
736
818
|
* limitations under the License.
|
|
737
|
-
*/(t)?9007199254740991:10:
|
|
819
|
+
*/(t)?9007199254740991:10:Rs()}function Co(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return To(t).isEqual(To(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=wo(t.timestampValue),r=wo(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return _o(t.bytesValue).isEqual(_o(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return bo(t.geoPointValue.latitude)===bo(e.geoPointValue.latitude)&&bo(t.geoPointValue.longitude)===bo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return bo(t.integerValue)===bo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=bo(t.doubleValue),r=bo(e.doubleValue);return n===r?mo(n)===mo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Ws(t.arrayValue.values||[],e.arrayValue.values||[],Co);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(ho(n)!==ho(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!Co(n[t],r[t])))return!1;return!0}(t,e);default:return Rs()}}function Ao(t,e){return void 0!==(t.values||[]).find((t=>Co(t,e)))}function Ro(t,e){if(t===e)return 0;const n=ko(t),r=ko(e);if(n!==r)return qs(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return qs(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=bo(t.integerValue||t.doubleValue),r=bo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return No(t.timestampValue,e.timestampValue);case 4:return No(To(t),To(e));case 5:return qs(t.stringValue,e.stringValue);case 6:return function(t,e){const n=_o(t),r=_o(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=qs(n[t],r[t]);if(0!==e)return e}return qs(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=qs(bo(t.latitude),bo(e.latitude));return 0!==n?n:qs(bo(t.longitude),bo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Ro(n[t],r[t]);if(e)return e}return qs(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Io.mapValue&&e===Io.mapValue)return 0;if(t===Io.mapValue)return 1;if(e===Io.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),i=e.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let t=0;t<r.length&&t<s.length;++t){const e=qs(r[t],s[t]);if(0!==e)return e;const o=Ro(n[r[t]],i[s[t]]);if(0!==o)return o}return qs(r.length,s.length)}(t.mapValue,e.mapValue);default:throw Rs()}}function No(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return qs(t,e);const n=wo(t),r=wo(e),i=qs(n.seconds,r.seconds);return 0!==i?i:qs(n.nanos,r.nanos)}function Lo(t){return Do(t)}function Do(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=wo(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?_o(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,Zs.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Do(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const i of e)r?r=!1:n+=",",n+=`${i}:${Do(t.fields[i])}`;return n+"}"}(t.mapValue):Rs();var e,n}function Oo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function xo(t){return!!t&&"integerValue"in t}function Po(t){return!!t&&"arrayValue"in t}function Mo(t){return!!t&&"nullValue"in t}function Uo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Fo(t){return!!t&&"mapValue"in t}function zo(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return fo(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=zo(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=zo(t.arrayValue.values[n]);return e}return Object.assign({},t)}class Bo{constructor(t,e){this.position=t,this.inclusive=e}}function Vo(t,e,n){let r=0;for(let i=0;i<t.position.length;i++){const s=e[i],o=t.position[i];if(r=s.field.isKeyField()?Zs.comparator(Zs.fromName(o.referenceValue),n.key):Ro(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function Ho(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!Co(t.position[n],e.position[n]))return!1;return!0}
|
|
738
820
|
/**
|
|
739
821
|
* @license
|
|
740
822
|
* Copyright 2022 Google LLC
|
|
@@ -750,7 +832,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
750
832
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
751
833
|
* See the License for the specific language governing permissions and
|
|
752
834
|
* limitations under the License.
|
|
753
|
-
*/class
|
|
835
|
+
*/class $o{}class jo extends $o{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Jo(t,e,n):"array-contains"===e?new ea(t,n):"in"===e?new na(t,n):"not-in"===e?new ra(t,n):"array-contains-any"===e?new ia(t,n):new jo(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new Xo(t,n):new Zo(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Ro(e,this.value)):null!==e&&ko(this.value)===ko(e)&&this.matchesComparison(Ro(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Rs()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class qo extends $o{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new qo(t,e)}matches(t){return Wo(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Wo(t){return"and"===t.op}function Ko(t){return function(t){for(const e of t.filters)if(e instanceof qo)return!1;return!0}(t)&&Wo(t)}function Go(t){if(t instanceof jo)return t.field.canonicalString()+t.op.toString()+Lo(t.value);{const e=t.filters.map((t=>Go(t))).join(",");return`${t.op}(${e})`}}function Qo(t,e){return t instanceof jo?function(t,e){return e instanceof jo&&t.op===e.op&&t.field.isEqual(e.field)&&Co(t.value,e.value)}(t,e):t instanceof qo?function(t,e){return e instanceof qo&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Qo(n,e.filters[r])),!0)}(t,e):void Rs()}function Yo(t){return t instanceof jo?function(t){return`${t.field.canonicalString()} ${t.op} ${Lo(t.value)}`}(t):t instanceof qo?function(t){return t.op.toString()+" {"+t.getFilters().map(Yo).join(" ,")+"}"}(t):"Filter"}class Jo extends jo{constructor(t,e,n){super(t,e,n),this.key=Zs.fromName(n.referenceValue)}matches(t){const e=Zs.comparator(t.key,this.key);return this.matchesComparison(e)}}class Xo extends jo{constructor(t,e){super(t,"in",e),this.keys=ta("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class Zo extends jo{constructor(t,e){super(t,"not-in",e),this.keys=ta("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function ta(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>Zs.fromName(t.referenceValue)))}class ea extends jo{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Po(e)&&Ao(e.arrayValue,this.value)}}class na extends jo{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Ao(this.value.arrayValue,e)}}class ra extends jo{constructor(t,e){super(t,"not-in",e)}matches(t){if(Ao(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Ao(this.value.arrayValue,e)}}class ia extends jo{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Po(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Ao(this.value.arrayValue,t)))}}
|
|
754
836
|
/**
|
|
755
837
|
* @license
|
|
756
838
|
* Copyright 2022 Google LLC
|
|
@@ -766,7 +848,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
766
848
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
767
849
|
* See the License for the specific language governing permissions and
|
|
768
850
|
* limitations under the License.
|
|
769
|
-
*/class
|
|
851
|
+
*/class sa{constructor(t,e="asc"){this.field=t,this.dir=e}}function oa(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}
|
|
770
852
|
/**
|
|
771
853
|
* @license
|
|
772
854
|
* Copyright 2017 Google LLC
|
|
@@ -782,7 +864,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
782
864
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
783
865
|
* See the License for the specific language governing permissions and
|
|
784
866
|
* limitations under the License.
|
|
785
|
-
*/class
|
|
867
|
+
*/class aa{constructor(t,e){this.comparator=t,this.root=e||la.EMPTY}insert(t,e){return new aa(this.comparator,this.root.insert(t,e,this.comparator).copy(null,null,la.BLACK,null,null))}remove(t){return new aa(this.comparator,this.root.remove(t,this.comparator).copy(null,null,la.BLACK,null,null))}get(t){let e=this.root;for(;!e.isEmpty();){const n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null}indexOf(t){let e=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(t){return this.root.inorderTraversal(t)}forEach(t){this.inorderTraversal(((e,n)=>(t(e,n),!1)))}toString(){const t=[];return this.inorderTraversal(((e,n)=>(t.push(`${e}:${n}`),!1))),`{${t.join(", ")}}`}reverseTraversal(t){return this.root.reverseTraversal(t)}getIterator(){return new ca(this.root,null,this.comparator,!1)}getIteratorFrom(t){return new ca(this.root,t,this.comparator,!1)}getReverseIterator(){return new ca(this.root,null,this.comparator,!0)}getReverseIteratorFrom(t){return new ca(this.root,t,this.comparator,!0)}}class ca{constructor(t,e,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!t.isEmpty();)if(i=e?n(t.key,e):1,e&&r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}getNext(){let t=this.nodeStack.pop();const e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}}}class la{constructor(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:la.RED,this.left=null!=r?r:la.EMPTY,this.right=null!=i?i:la.EMPTY,this.size=this.left.size+1+this.right.size}copy(t,e,n,r,i){return new la(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)}reverseTraversal(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(t,e,n){let r=this;const i=n(t,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return la.EMPTY;let t=this;return t.left.isRed()||t.left.left.isRed()||(t=t.moveRedLeft()),t=t.copy(null,null,null,t.left.removeMin(),null),t.fixUp()}remove(t,e){let n,r=this;if(e(t,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===e(t,r.key)){if(r.right.isEmpty())return la.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp()}isRed(){return this.color}fixUp(){let t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t}moveRedLeft(){let t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t}moveRedRight(){let t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t}rotateLeft(){const t=this.copy(null,null,la.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)}rotateRight(){const t=this.copy(null,null,la.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)}colorFlip(){const t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)}checkMaxDepth(){const t=this.check();return Math.pow(2,t)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Rs();if(this.right.isRed())throw Rs();const t=this.left.check();if(t!==this.right.check())throw Rs();return t+(this.isRed()?0:1)}}la.EMPTY=null,la.RED=!0,la.BLACK=!1,la.EMPTY=new class{constructor(){this.size=0}get key(){throw Rs()}get value(){throw Rs()}get color(){throw Rs()}get left(){throw Rs()}get right(){throw Rs()}copy(t,e,n,r,i){return this}insert(t,e,n){return new la(t,e)}remove(t,e){return this}isEmpty(){return!0}inorderTraversal(t){return!1}reverseTraversal(t){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
|
|
786
868
|
/**
|
|
787
869
|
* @license
|
|
788
870
|
* Copyright 2017 Google LLC
|
|
@@ -799,7 +881,7 @@ class Zs{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
|
|
|
799
881
|
* See the License for the specific language governing permissions and
|
|
800
882
|
* limitations under the License.
|
|
801
883
|
*/
|
|
802
|
-
class
|
|
884
|
+
class ua{constructor(t){this.comparator=t,this.data=new aa(this.comparator)}has(t){return null!==this.data.get(t)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(t){return this.data.indexOf(t)}forEach(t){this.data.inorderTraversal(((e,n)=>(t(e),!1)))}forEachInRange(t,e){const n=this.data.getIteratorFrom(t[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}}forEachWhile(t,e){let n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();)if(!t(n.getNext().key))return}firstAfterOrEqual(t){const e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null}getIterator(){return new ha(this.data.getIterator())}getIteratorFrom(t){return new ha(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 ua))return!1;if(this.size!==t.size)return!1;const e=this.data.getIterator(),n=t.data.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(0!==this.comparator(t,r))return!1}return!0}toArray(){const t=[];return this.forEach((e=>{t.push(e)})),t}toString(){const t=[];return this.forEach((e=>t.push(e))),"SortedSet("+t.toString()+")"}copy(t){const e=new ua(this.comparator);return e.data=t,e}}class ha{constructor(t){this.iter=t}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
|
|
803
885
|
/**
|
|
804
886
|
* @license
|
|
805
887
|
* Copyright 2020 Google LLC
|
|
@@ -815,7 +897,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
815
897
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
816
898
|
* See the License for the specific language governing permissions and
|
|
817
899
|
* limitations under the License.
|
|
818
|
-
*/class
|
|
900
|
+
*/class da{constructor(t){this.fields=t,t.sort(Xs.comparator)}static empty(){return new da([])}unionWith(t){let e=new ua(Xs.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new da(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Ws(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
|
|
819
901
|
/**
|
|
820
902
|
* @license
|
|
821
903
|
* Copyright 2017 Google LLC
|
|
@@ -831,7 +913,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
831
913
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
832
914
|
* See the License for the specific language governing permissions and
|
|
833
915
|
* limitations under the License.
|
|
834
|
-
*/class
|
|
916
|
+
*/class fa{constructor(t){this.value=t}static empty(){return new fa({mapValue:{}})}field(t){if(t.isEmpty())return this.value;{let e=this.value;for(let n=0;n<t.length-1;++n)if(e=(e.mapValue.fields||{})[t.get(n)],!Fo(e))return null;return e=(e.mapValue.fields||{})[t.lastSegment()],e||null}}set(t,e){this.getFieldsMap(t.popLast())[t.lastSegment()]=zo(e)}setAll(t){let e=Xs.emptyPath(),n={},r=[];t.forEach(((t,i)=>{if(!e.isImmediateParentOf(i)){const t=this.getFieldsMap(e);this.applyChanges(t,n,r),n={},r=[],e=i.popLast()}t?n[i.lastSegment()]=zo(t):r.push(i.lastSegment())}));const i=this.getFieldsMap(e);this.applyChanges(i,n,r)}delete(t){const e=this.field(t.popLast());Fo(e)&&e.mapValue.fields&&delete e.mapValue.fields[t.lastSegment()]}isEqual(t){return Co(this.value,t.value)}getFieldsMap(t){let e=this.value;e.mapValue.fields||(e.mapValue={fields:{}});for(let n=0;n<t.length;++n){let r=e.mapValue.fields[t.get(n)];Fo(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},e.mapValue.fields[t.get(n)]=r),e=r}return e.mapValue.fields}applyChanges(t,e,n){fo(e,((e,n)=>t[e]=n));for(const e of n)delete t[e]}clone(){return new fa(zo(this.value))}}function pa(t){const e=[];return fo(t.fields,((t,n)=>{const r=new Xs([t]);if(Fo(n)){const t=pa(n.mapValue).fields;if(0===t.length)e.push(r);else for(const n of t)e.push(r.child(n))}else e.push(r)})),new da(e)
|
|
835
917
|
/**
|
|
836
918
|
* @license
|
|
837
919
|
* Copyright 2017 Google LLC
|
|
@@ -847,7 +929,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
847
929
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
848
930
|
* See the License for the specific language governing permissions and
|
|
849
931
|
* limitations under the License.
|
|
850
|
-
*/class
|
|
932
|
+
*/}class ga{constructor(t,e,n,r,i,s,o){this.key=t,this.documentType=e,this.version=n,this.readTime=r,this.createTime=i,this.data=s,this.documentState=o}static newInvalidDocument(t){return new ga(t,0,Gs.min(),Gs.min(),Gs.min(),fa.empty(),0)}static newFoundDocument(t,e,n,r){return new ga(t,1,e,Gs.min(),n,r,0)}static newNoDocument(t,e){return new ga(t,2,e,Gs.min(),Gs.min(),fa.empty(),0)}static newUnknownDocument(t,e){return new ga(t,3,e,Gs.min(),Gs.min(),fa.empty(),2)}convertToFoundDocument(t,e){return!this.createTime.isEqual(Gs.min())||2!==this.documentType&&0!==this.documentType||(this.createTime=t),this.version=t,this.documentType=1,this.data=e,this.documentState=0,this}convertToNoDocument(t){return this.version=t,this.documentType=2,this.data=fa.empty(),this.documentState=0,this}convertToUnknownDocument(t){return this.version=t,this.documentType=3,this.data=fa.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Gs.min(),this}setReadTime(t){return this.readTime=t,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(t){return t instanceof ga&&this.key.isEqual(t.key)&&this.version.isEqual(t.version)&&this.documentType===t.documentType&&this.documentState===t.documentState&&this.data.isEqual(t.data)}mutableCopy(){return new ga(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}})`}}
|
|
851
933
|
/**
|
|
852
934
|
* @license
|
|
853
935
|
* Copyright 2019 Google LLC
|
|
@@ -863,7 +945,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
863
945
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
864
946
|
* See the License for the specific language governing permissions and
|
|
865
947
|
* limitations under the License.
|
|
866
|
-
*/class
|
|
948
|
+
*/class ma{constructor(t,e=null,n=[],r=[],i=null,s=null,o=null){this.path=t,this.collectionGroup=e,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=o,this.ft=null}}function ya(t,e=null,n=[],r=[],i=null,s=null,o=null){return new ma(t,e,n,r,i,s,o)}function va(t){const e=Ls(t);if(null===e.ft){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map((t=>Go(t))).join(","),t+="|ob:",t+=e.orderBy.map((t=>function(t){return t.field.canonicalString()+t.dir}(t))).join(","),go(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map((t=>Lo(t))).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map((t=>Lo(t))).join(",")),e.ft=t}return e.ft}function wa(t,e){if(t.limit!==e.limit)return!1;if(t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n<t.orderBy.length;n++)if(!oa(t.orderBy[n],e.orderBy[n]))return!1;if(t.filters.length!==e.filters.length)return!1;for(let n=0;n<t.filters.length;n++)if(!Qo(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!Ho(t.startAt,e.startAt)&&Ho(t.endAt,e.endAt)}function ba(t){return Zs.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}
|
|
867
949
|
/**
|
|
868
950
|
* @license
|
|
869
951
|
* Copyright 2017 Google LLC
|
|
@@ -879,7 +961,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
879
961
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
880
962
|
* See the License for the specific language governing permissions and
|
|
881
963
|
* limitations under the License.
|
|
882
|
-
*/class
|
|
964
|
+
*/class _a{constructor(t,e=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=t,this.collectionGroup=e,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.dt=null,this._t=null,this.startAt,this.endAt}}function Sa(t){return new _a(t)}function Ea(t){return 0===t.filters.length&&null===t.limit&&null==t.startAt&&null==t.endAt&&(0===t.explicitOrderBy.length||1===t.explicitOrderBy.length&&t.explicitOrderBy[0].field.isKeyField())}function Ta(t){return t.explicitOrderBy.length>0?t.explicitOrderBy[0].field:null}function Ia(t){for(const e of t.filters){const t=e.getFirstInequalityField();if(null!==t)return t}return null}function ka(t){return null!==t.collectionGroup}function Ca(t){const e=Ls(t);if(null===e.dt){e.dt=[];const t=Ia(e),n=Ta(e);if(null!==t&&null===n)t.isKeyField()||e.dt.push(new sa(t)),e.dt.push(new sa(Xs.keyField(),"asc"));else{let t=!1;for(const n of e.explicitOrderBy)e.dt.push(n),n.field.isKeyField()&&(t=!0);if(!t){const t=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";e.dt.push(new sa(Xs.keyField(),t))}}}return e.dt}function Aa(t){const e=Ls(t);if(!e._t)if("F"===e.limitType)e._t=ya(e.path,e.collectionGroup,Ca(e),e.filters,e.limit,e.startAt,e.endAt);else{const t=[];for(const n of Ca(e)){const e="desc"===n.dir?"asc":"desc";t.push(new sa(n.field,e))}const n=e.endAt?new Bo(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Bo(e.startAt.position,e.startAt.inclusive):null;e._t=ya(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}return e._t}function Ra(t,e){e.getFirstInequalityField(),Ia(t);const n=t.filters.concat([e]);return new _a(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function Na(t,e,n){return new _a(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function La(t,e){return wa(Aa(t),Aa(e))&&t.limitType===e.limitType}function Da(t){return`${va(Aa(t))}|lt:${t.limitType}`}function Oa(t){return`Query(target=${function(t){let e=t.path.canonicalString();return null!==t.collectionGroup&&(e+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(e+=`, filters: [${t.filters.map((t=>Yo(t))).join(", ")}]`),go(t.limit)||(e+=", limit: "+t.limit),t.orderBy.length>0&&(e+=`, orderBy: [${t.orderBy.map((t=>function(t){return`${t.field.canonicalString()} (${t.dir})`}(t))).join(", ")}]`),t.startAt&&(e+=", startAt: ",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map((t=>Lo(t))).join(",")),t.endAt&&(e+=", endAt: ",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map((t=>Lo(t))).join(",")),`Target(${e})`}(Aa(t))}; limitType=${t.limitType})`}function xa(t,e){return e.isFoundDocument()&&function(t,e){const n=e.key.path;return null!==t.collectionGroup?e.key.hasCollectionId(t.collectionGroup)&&t.path.isPrefixOf(n):Zs.isDocumentKey(t.path)?t.path.isEqual(n):t.path.isImmediateParentOf(n)}(t,e)&&function(t,e){for(const n of Ca(t))if(!n.field.isKeyField()&&null===e.data.field(n.field))return!1;return!0}(t,e)&&function(t,e){for(const n of t.filters)if(!n.matches(e))return!1;return!0}(t,e)&&function(t,e){return!(t.startAt&&!function(t,e,n){const r=Vo(t,e,n);return t.inclusive?r<=0:r<0}(t.startAt,Ca(t),e))&&!(t.endAt&&!function(t,e,n){const r=Vo(t,e,n);return t.inclusive?r>=0:r>0}(t.endAt,Ca(t),e))}(t,e)}function Pa(t){return(e,n)=>{let r=!1;for(const i of Ca(t)){const t=Ma(i,e,n);if(0!==t)return t;r=r||i.field.isKeyField()}return 0}}function Ma(t,e,n){const r=t.field.isKeyField()?Zs.comparator(e.key,n.key):function(t,e,n){const r=e.data.field(t),i=n.data.field(t);return null!==r&&null!==i?Ro(r,i):Rs()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return Rs()}}
|
|
883
965
|
/**
|
|
884
966
|
* @license
|
|
885
967
|
* Copyright 2020 Google LLC
|
|
@@ -895,7 +977,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
895
977
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
896
978
|
* See the License for the specific language governing permissions and
|
|
897
979
|
* limitations under the License.
|
|
898
|
-
*/function
|
|
980
|
+
*/function Ua(t,e){if(t.wt){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:mo(e)?"-0":e}}function Fa(t){return{integerValue:""+t}}function za(t,e){return function(t){return"number"==typeof t&&Number.isInteger(t)&&!mo(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}(e)?Fa(e):Ua(t,e)}
|
|
899
981
|
/**
|
|
900
982
|
* @license
|
|
901
983
|
* Copyright 2018 Google LLC
|
|
@@ -911,7 +993,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
911
993
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
912
994
|
* See the License for the specific language governing permissions and
|
|
913
995
|
* limitations under the License.
|
|
914
|
-
*/class
|
|
996
|
+
*/class Ba{constructor(){this._=void 0}}function Va(t,e,n){return t instanceof ja?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof qa?Wa(t,e):t instanceof Ka?Ga(t,e):function(t,e){const n=$a(t,e),r=Ya(n)+Ya(t.gt);return xo(n)&&xo(t.gt)?Fa(r):Ua(t.yt,r)}(t,e)}function Ha(t,e,n){return t instanceof qa?Wa(t,e):t instanceof Ka?Ga(t,e):n}function $a(t,e){return t instanceof Qa?xo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class ja extends Ba{}class qa extends Ba{constructor(t){super(),this.elements=t}}function Wa(t,e){const n=Ja(e);for(const e of t.elements)n.some((t=>Co(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Ka extends Ba{constructor(t){super(),this.elements=t}}function Ga(t,e){let n=Ja(e);for(const e of t.elements)n=n.filter((t=>!Co(t,e)));return{arrayValue:{values:n}}}class Qa extends Ba{constructor(t,e){super(),this.yt=t,this.gt=e}}function Ya(t){return bo(t.integerValue||t.doubleValue)}function Ja(t){return Po(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class Xa{constructor(t,e){this.version=t,this.transformResults=e}}class Za{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new Za}static exists(t){return new Za(void 0,t)}static updateTime(t){return new Za(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function tc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class ec{}function nc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new dc(t.key,Za.none()):new ac(t.key,t.data,Za.none());{const n=t.data,r=fa.empty();let i=new ua(Xs.comparator);for(let t of e.fields)if(!i.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),i=i.add(t)}return new cc(t.key,r,new da(i.toArray()),Za.none())}}function rc(t,e,n){t instanceof ac?function(t,e,n){const r=t.value.clone(),i=uc(t.fieldTransforms,e,n.transformResults);r.setAll(i),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof cc?function(t,e,n){if(!tc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=uc(t.fieldTransforms,e,n.transformResults),i=e.data;i.setAll(lc(t)),i.setAll(r),e.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function ic(t,e,n,r){return t instanceof ac?function(t,e,n,r){if(!tc(t.precondition,e))return n;const i=t.value.clone(),s=hc(t.fieldTransforms,r,e);return i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null}(t,e,n,r):t instanceof cc?function(t,e,n,r){if(!tc(t.precondition,e))return n;const i=hc(t.fieldTransforms,r,e),s=e.data;return s.setAll(lc(t)),s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return tc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function sc(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),i=$a(r.transform,t||null);null!=i&&(null===n&&(n=fa.empty()),n.set(r.field,i))}return n||null}function oc(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Ws(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof qa&&e instanceof qa||t instanceof Ka&&e instanceof Ka?Ws(t.elements,e.elements,Co):t instanceof Qa&&e instanceof Qa?Co(t.gt,e.gt):t instanceof ja&&e instanceof ja}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class ac extends ec{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class cc extends ec{constructor(t,e,n,r,i=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function lc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function uc(t,e,n){const r=new Map;Ns(t.length===n.length);for(let i=0;i<n.length;i++){const s=t[i],o=s.transform,a=e.data.field(s.field);r.set(s.field,Ha(o,a,n[i]))}return r}function hc(t,e,n){const r=new Map;for(const i of t){const t=i.transform,s=n.data.field(i.field);r.set(i.field,Va(t,s,e))}return r}class dc extends ec{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class fc extends ec{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
915
997
|
/**
|
|
916
998
|
* @license
|
|
917
999
|
* Copyright 2017 Google LLC
|
|
@@ -927,7 +1009,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
927
1009
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
928
1010
|
* See the License for the specific language governing permissions and
|
|
929
1011
|
* limitations under the License.
|
|
930
|
-
*/class
|
|
1012
|
+
*/class pc{constructor(t){this.count=t}}
|
|
931
1013
|
/**
|
|
932
1014
|
* @license
|
|
933
1015
|
* Copyright 2017 Google LLC
|
|
@@ -943,7 +1025,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
943
1025
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
944
1026
|
* See the License for the specific language governing permissions and
|
|
945
1027
|
* limitations under the License.
|
|
946
|
-
*/var
|
|
1028
|
+
*/var gc,mc;function yc(t){if(void 0===t)return ks("GRPC error has no .code"),Ds.UNKNOWN;switch(t){case gc.OK:return Ds.OK;case gc.CANCELLED:return Ds.CANCELLED;case gc.UNKNOWN:return Ds.UNKNOWN;case gc.DEADLINE_EXCEEDED:return Ds.DEADLINE_EXCEEDED;case gc.RESOURCE_EXHAUSTED:return Ds.RESOURCE_EXHAUSTED;case gc.INTERNAL:return Ds.INTERNAL;case gc.UNAVAILABLE:return Ds.UNAVAILABLE;case gc.UNAUTHENTICATED:return Ds.UNAUTHENTICATED;case gc.INVALID_ARGUMENT:return Ds.INVALID_ARGUMENT;case gc.NOT_FOUND:return Ds.NOT_FOUND;case gc.ALREADY_EXISTS:return Ds.ALREADY_EXISTS;case gc.PERMISSION_DENIED:return Ds.PERMISSION_DENIED;case gc.FAILED_PRECONDITION:return Ds.FAILED_PRECONDITION;case gc.ABORTED:return Ds.ABORTED;case gc.OUT_OF_RANGE:return Ds.OUT_OF_RANGE;case gc.UNIMPLEMENTED:return Ds.UNIMPLEMENTED;case gc.DATA_LOSS:return Ds.DATA_LOSS;default:return Rs()}}(mc=gc||(gc={}))[mc.OK=0]="OK",mc[mc.CANCELLED=1]="CANCELLED",mc[mc.UNKNOWN=2]="UNKNOWN",mc[mc.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",mc[mc.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",mc[mc.NOT_FOUND=5]="NOT_FOUND",mc[mc.ALREADY_EXISTS=6]="ALREADY_EXISTS",mc[mc.PERMISSION_DENIED=7]="PERMISSION_DENIED",mc[mc.UNAUTHENTICATED=16]="UNAUTHENTICATED",mc[mc.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",mc[mc.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",mc[mc.ABORTED=10]="ABORTED",mc[mc.OUT_OF_RANGE=11]="OUT_OF_RANGE",mc[mc.UNIMPLEMENTED=12]="UNIMPLEMENTED",mc[mc.INTERNAL=13]="INTERNAL",mc[mc.UNAVAILABLE=14]="UNAVAILABLE",mc[mc.DATA_LOSS=15]="DATA_LOSS";
|
|
947
1029
|
/**
|
|
948
1030
|
* @license
|
|
949
1031
|
* Copyright 2017 Google LLC
|
|
@@ -960,7 +1042,7 @@ class Go{constructor(t){this.comparator=t,this.data=new qo(this.comparator)}has(
|
|
|
960
1042
|
* See the License for the specific language governing permissions and
|
|
961
1043
|
* limitations under the License.
|
|
962
1044
|
*/
|
|
963
|
-
class
|
|
1045
|
+
class vc{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.innerSize=0}get(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(const[e,r]of n)if(this.equalsFn(e,t))return r}has(t){return void 0!==this.get(t)}set(t,e){const n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return this.inner[n]=[[t,e]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],t))return void(r[n]=[t,e]);r.push([t,e]),this.innerSize++}delete(t){const e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],t))return 1===n.length?delete this.inner[e]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(t){fo(this.inner,((e,n)=>{for(const[e,r]of n)t(e,r)}))}isEmpty(){return po(this.inner)}size(){return this.innerSize}}
|
|
964
1046
|
/**
|
|
965
1047
|
* @license
|
|
966
1048
|
* Copyright 2017 Google LLC
|
|
@@ -976,7 +1058,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
976
1058
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
977
1059
|
* See the License for the specific language governing permissions and
|
|
978
1060
|
* limitations under the License.
|
|
979
|
-
*/const
|
|
1061
|
+
*/const wc=new aa(Zs.comparator);function bc(){return wc}const _c=new aa(Zs.comparator);function Sc(...t){let e=_c;for(const n of t)e=e.insert(n.key,n);return e}function Ec(t){let e=_c;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Tc(){return kc()}function Ic(){return kc()}function kc(){return new vc((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Cc=new aa(Zs.comparator),Ac=new ua(Zs.comparator);function Rc(...t){let e=Ac;for(const n of t)e=e.add(n);return e}const Nc=new ua(qs);function Lc(){return Nc}
|
|
980
1062
|
/**
|
|
981
1063
|
* @license
|
|
982
1064
|
* Copyright 2017 Google LLC
|
|
@@ -992,7 +1074,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
992
1074
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
993
1075
|
* See the License for the specific language governing permissions and
|
|
994
1076
|
* limitations under the License.
|
|
995
|
-
*/class
|
|
1077
|
+
*/class Dc{constructor(t,e,n,r,i){this.snapshotVersion=t,this.targetChanges=e,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(t,e,n){const r=new Map;return r.set(t,Oc.createSynthesizedTargetChangeForCurrentChange(t,e,n)),new Dc(Gs.min(),r,Lc(),bc(),Rc())}}class Oc{constructor(t,e,n,r,i){this.resumeToken=t,this.current=e,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(t,e,n){return new Oc(n,e,Rc(),Rc(),Rc())}}
|
|
996
1078
|
/**
|
|
997
1079
|
* @license
|
|
998
1080
|
* Copyright 2017 Google LLC
|
|
@@ -1008,7 +1090,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1008
1090
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1009
1091
|
* See the License for the specific language governing permissions and
|
|
1010
1092
|
* limitations under the License.
|
|
1011
|
-
*/class
|
|
1093
|
+
*/class xc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Pc{constructor(t,e){this.targetId=t,this.Et=e}}class Mc{constructor(t,e,n=yo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Uc{constructor(){this.At=0,this.Rt=Bc(),this.bt=yo.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=Rc(),e=Rc(),n=Rc();return this.Rt.forEach(((r,i)=>{switch(i){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Rs()}})),new Oc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=Bc()}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 Fc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=bc(),this.qt=zc(),this.Ut=new ua(qs)}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:Rs()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(ba(t))if(0===n){const n=new Zs(t.path);this.Qt(e,n,ga.newNoDocument(n,Gs.min()))}else Ns(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const i=this.Yt(r);if(i){if(n.current&&ba(i.target)){const e=new Zs(i.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,ga.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Rc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new Dc(t,e,this.Ut,this.Lt,n);return this.Lt=bc(),this.qt=zc(),this.Ut=new ua(qs),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Uc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new ua(qs),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Is("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 Uc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function zc(){return new aa(Zs.comparator)}function Bc(){return new aa(Zs.comparator)}
|
|
1012
1094
|
/**
|
|
1013
1095
|
* @license
|
|
1014
1096
|
* Copyright 2017 Google LLC
|
|
@@ -1024,7 +1106,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1024
1106
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1025
1107
|
* See the License for the specific language governing permissions and
|
|
1026
1108
|
* limitations under the License.
|
|
1027
|
-
*/const
|
|
1109
|
+
*/const Vc={asc:"ASCENDING",desc:"DESCENDING"},Hc={"<":"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"},$c={and:"AND",or:"OR"};class jc{constructor(t,e){this.databaseId=t,this.wt=e}}function qc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Wc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Kc(t,e){return qc(t,e.toTimestamp())}function Gc(t){return Ns(!!t),Gs.fromTimestamp(function(t){const e=wo(t);return new Ks(e.seconds,e.nanos)}(t))}function Qc(t,e){return function(t){return new Ys(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Yc(t){const e=Ys.fromString(t);return Ns(pl(e)),e}function Jc(t,e){return Qc(t.databaseId,e.path)}function Xc(t,e){const n=Yc(e);if(n.get(1)!==t.databaseId.projectId)throw new Os(Ds.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Os(Ds.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Zs(el(n))}function Zc(t,e){return Qc(t.databaseId,e)}function tl(t){return new Ys(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function el(t){return Ns(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function nl(t,e,n){return{name:Jc(t,e),fields:n.value.mapValue.fields}}function rl(t,e){return{documents:[Zc(t,e.path)]}}function il(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=Zc(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=Zc(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const i=function(t){if(0!==t.length)return dl(qo.create(t,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const s=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:ul(t.field),direction:al(t.dir)}}(t)))}(e.orderBy);s&&(n.structuredQuery.orderBy=s);const o=function(t,e){return t.wt||go(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function sl(t){let e=function(t){const e=Yc(t);return 4===e.length?Ys.emptyPath():el(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Ns(1===r);const t=n.from[0];t.allDescendants?i=t.collectionId:e=e.child(t.collectionId)}let s=[];n.where&&(s=function(t){const e=ol(t);return e instanceof qo&&Ko(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new sa(hl(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,go(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new Bo(n,e)}(n.startAt));let l=null;return n.endAt&&(l=function(t){const e=!t.before,n=t.values||[];return new Bo(n,e)}(n.endAt)),function(t,e,n,r,i,s,o,a){return new _a(t,e,n,r,i,s,o,a)}(e,i,o,s,a,"F",c,l)}function ol(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=hl(t.unaryFilter.field);return jo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=hl(t.unaryFilter.field);return jo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=hl(t.unaryFilter.field);return jo.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const i=hl(t.unaryFilter.field);return jo.create(i,"!=",{nullValue:"NULL_VALUE"});default:return Rs()}}(t):void 0!==t.fieldFilter?function(t){return jo.create(hl(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Rs()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return qo.create(t.compositeFilter.filters.map((t=>ol(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Rs()}}(t.compositeFilter.op))}(t):Rs()}function al(t){return Vc[t]}function cl(t){return Hc[t]}function ll(t){return $c[t]}function ul(t){return{fieldPath:t.canonicalString()}}function hl(t){return Xs.fromServerFormat(t.fieldPath)}function dl(t){return t instanceof jo?function(t){if("=="===t.op){if(Uo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NAN"}};if(Mo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Uo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NOT_NAN"}};if(Mo(t.value))return{unaryFilter:{field:ul(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ul(t.field),op:cl(t.op),value:t.value}}}(t):t instanceof qo?function(t){const e=t.getFilters().map((t=>dl(t)));return 1===e.length?e[0]:{compositeFilter:{op:ll(t.op),filters:e}}}(t):Rs()}function fl(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function pl(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
|
|
1028
1110
|
/**
|
|
1029
1111
|
* @license
|
|
1030
1112
|
* Copyright 2017 Google LLC
|
|
@@ -1040,7 +1122,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1040
1122
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1041
1123
|
* See the License for the specific language governing permissions and
|
|
1042
1124
|
* limitations under the License.
|
|
1043
|
-
*/class
|
|
1125
|
+
*/class gl{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&rc(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=ic(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=ic(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Ic();return this.mutations.forEach((r=>{const i=t.get(r.key),s=i.overlayedDocument;let o=this.applyToLocalView(s,i.mutatedFields);o=e.has(r.key)?null:o;const a=nc(s,o);null!==a&&n.set(r.key,a),s.isValidDocument()||s.convertToNoDocument(Gs.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Rc())}isEqual(t){return this.batchId===t.batchId&&Ws(this.mutations,t.mutations,((t,e)=>oc(t,e)))&&Ws(this.baseMutations,t.baseMutations,((t,e)=>oc(t,e)))}}class ml{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Ns(t.mutations.length===n.length);let r=Cc;const i=t.mutations;for(let t=0;t<i.length;t++)r=r.insert(i[t].key,n[t].version);return new ml(t,e,n,r)}}
|
|
1044
1126
|
/**
|
|
1045
1127
|
* @license
|
|
1046
1128
|
* Copyright 2022 Google LLC
|
|
@@ -1056,7 +1138,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1056
1138
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1057
1139
|
* See the License for the specific language governing permissions and
|
|
1058
1140
|
* limitations under the License.
|
|
1059
|
-
*/class
|
|
1141
|
+
*/class yl{constructor(t,e){this.largestBatchId=t,this.mutation=e}getKey(){return this.mutation.key}isEqual(t){return null!==t&&this.mutation===t.mutation}toString(){return`Overlay{\n largestBatchId: ${this.largestBatchId},\n mutation: ${this.mutation.toString()}\n }`}}
|
|
1060
1142
|
/**
|
|
1061
1143
|
* @license
|
|
1062
1144
|
* Copyright 2017 Google LLC
|
|
@@ -1072,7 +1154,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1072
1154
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1073
1155
|
* See the License for the specific language governing permissions and
|
|
1074
1156
|
* limitations under the License.
|
|
1075
|
-
*/class
|
|
1157
|
+
*/class vl{constructor(t,e,n,r,i=Gs.min(),s=Gs.min(),o=yo.EMPTY_BYTE_STRING){this.target=t,this.targetId=e,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o}withSequenceNumber(t){return new vl(this.target,this.targetId,this.purpose,t,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken)}withResumeToken(t,e){return new vl(this.target,this.targetId,this.purpose,this.sequenceNumber,e,this.lastLimboFreeSnapshotVersion,t)}withLastLimboFreeSnapshotVersion(t){return new vl(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,t,this.resumeToken)}}
|
|
1076
1158
|
/**
|
|
1077
1159
|
* @license
|
|
1078
1160
|
* Copyright 2017 Google LLC
|
|
@@ -1088,7 +1170,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1088
1170
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1089
1171
|
* See the License for the specific language governing permissions and
|
|
1090
1172
|
* limitations under the License.
|
|
1091
|
-
*/class
|
|
1173
|
+
*/class wl{constructor(t){this.ie=t}}function bl(t){const e=sl({parent:t.parent,structuredQuery:t.structuredQuery});return"LAST"===t.limitType?Na(e,e.limit,"L"):e}
|
|
1092
1174
|
/**
|
|
1093
1175
|
* @license
|
|
1094
1176
|
* Copyright 2019 Google LLC
|
|
@@ -1104,7 +1186,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1104
1186
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1105
1187
|
* See the License for the specific language governing permissions and
|
|
1106
1188
|
* limitations under the License.
|
|
1107
|
-
*/class
|
|
1189
|
+
*/class _l{constructor(){this.Je=new Sl}addToCollectionParentIndex(t,e){return this.Je.add(e),oo.resolve()}getCollectionParents(t,e){return oo.resolve(this.Je.getEntries(e))}addFieldIndex(t,e){return oo.resolve()}deleteFieldIndex(t,e){return oo.resolve()}getDocumentsMatchingTarget(t,e){return oo.resolve(null)}getIndexType(t,e){return oo.resolve(0)}getFieldIndexes(t,e){return oo.resolve([])}getNextCollectionGroupToUpdate(t){return oo.resolve(null)}getMinOffset(t,e){return oo.resolve(eo.min())}getMinOffsetFromCollectionGroup(t,e){return oo.resolve(eo.min())}updateCollectionGroup(t,e,n){return oo.resolve()}updateIndexEntries(t,e){return oo.resolve()}}class Sl{constructor(){this.index={}}add(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e]||new ua(Ys.comparator),i=!r.has(n);return this.index[e]=r.add(n),i}has(t){const e=t.lastSegment(),n=t.popLast(),r=this.index[e];return r&&r.has(n)}getEntries(t){return(this.index[t]||new ua(Ys.comparator)).toArray()}}
|
|
1108
1190
|
/**
|
|
1109
1191
|
* @license
|
|
1110
1192
|
* Copyright 2017 Google LLC
|
|
@@ -1120,7 +1202,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1120
1202
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1121
1203
|
* See the License for the specific language governing permissions and
|
|
1122
1204
|
* limitations under the License.
|
|
1123
|
-
*/class
|
|
1205
|
+
*/class El{constructor(t){this.bn=t}next(){return this.bn+=2,this.bn}static Pn(){return new El(0)}static vn(){return new El(-1)}}
|
|
1124
1206
|
/**
|
|
1125
1207
|
* @license
|
|
1126
1208
|
* Copyright 2017 Google LLC
|
|
@@ -1136,7 +1218,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1136
1218
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1137
1219
|
* See the License for the specific language governing permissions and
|
|
1138
1220
|
* limitations under the License.
|
|
1139
|
-
*/class
|
|
1221
|
+
*/class Tl{constructor(){this.changes=new vc((t=>t.toString()),((t,e)=>t.isEqual(e))),this.changesApplied=!1}addEntry(t){this.assertNotApplied(),this.changes.set(t.key,t)}removeEntry(t,e){this.assertNotApplied(),this.changes.set(t,ga.newInvalidDocument(t).setReadTime(e))}getEntry(t,e){this.assertNotApplied();const n=this.changes.get(e);return void 0!==n?oo.resolve(n):this.getFromCache(t,e)}getEntries(t,e){return this.getAllFromCache(t,e)}apply(t){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(t)}assertNotApplied(){}}
|
|
1140
1222
|
/**
|
|
1141
1223
|
* @license
|
|
1142
1224
|
* Copyright 2017 Google LLC
|
|
@@ -1168,7 +1250,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1168
1250
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1169
1251
|
* See the License for the specific language governing permissions and
|
|
1170
1252
|
* limitations under the License.
|
|
1171
|
-
*/class
|
|
1253
|
+
*/class Il{constructor(t,e){this.overlayedDocument=t,this.mutatedFields=e}}
|
|
1172
1254
|
/**
|
|
1173
1255
|
* @license
|
|
1174
1256
|
* Copyright 2017 Google LLC
|
|
@@ -1184,7 +1266,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1184
1266
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1185
1267
|
* See the License for the specific language governing permissions and
|
|
1186
1268
|
* limitations under the License.
|
|
1187
|
-
*/class
|
|
1269
|
+
*/class kl{constructor(t,e,n,r){this.remoteDocumentCache=t,this.mutationQueue=e,this.documentOverlayCache=n,this.indexManager=r}getDocument(t,e){let n=null;return this.documentOverlayCache.getOverlay(t,e).next((r=>(n=r,this.remoteDocumentCache.getEntry(t,e)))).next((t=>(null!==n&&ic(n.mutation,t,da.empty(),Ks.now()),t)))}getDocuments(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.getLocalViewOfDocuments(t,e,Rc()).next((()=>e))))}getLocalViewOfDocuments(t,e,n=Rc()){const r=Tc();return this.populateOverlays(t,r,e).next((()=>this.computeViews(t,e,r,n).next((t=>{let e=Sc();return t.forEach(((t,n)=>{e=e.insert(t,n.overlayedDocument)})),e}))))}getOverlayedDocuments(t,e){const n=Tc();return this.populateOverlays(t,n,e).next((()=>this.computeViews(t,e,n,Rc())))}populateOverlays(t,e,n){const r=[];return n.forEach((t=>{e.has(t)||r.push(t)})),this.documentOverlayCache.getOverlays(t,r).next((t=>{t.forEach(((t,n)=>{e.set(t,n)}))}))}computeViews(t,e,n,r){let i=bc();const s=kc(),o=kc();return e.forEach(((t,e)=>{const o=n.get(e.key);r.has(e.key)&&(void 0===o||o.mutation instanceof cc)?i=i.insert(e.key,e):void 0!==o&&(s.set(e.key,o.mutation.getFieldMask()),ic(o.mutation,e,o.mutation.getFieldMask(),Ks.now()))})),this.recalculateAndSaveOverlays(t,i).next((t=>(t.forEach(((t,e)=>s.set(t,e))),e.forEach(((t,e)=>{var n;return o.set(t,new Il(e,null!==(n=s.get(t))&&void 0!==n?n:null))})),o)))}recalculateAndSaveOverlays(t,e){const n=kc();let r=new aa(((t,e)=>t-e)),i=Rc();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(t,e).next((t=>{for(const i of t)i.keys().forEach((t=>{const s=e.get(t);if(null===s)return;let o=n.get(t)||da.empty();o=i.applyToLocalView(s,o),n.set(t,o);const a=(r.get(i.batchId)||Rc()).add(t);r=r.insert(i.batchId,a)}))})).next((()=>{const s=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,l=Ic();c.forEach((t=>{if(!i.has(t)){const r=nc(e.get(t),n.get(t));null!==r&&l.set(t,r),i=i.add(t)}})),s.push(this.documentOverlayCache.saveOverlays(t,a,l))}return oo.waitFor(s)})).next((()=>n))}recalculateAndSaveOverlaysForDocumentKeys(t,e){return this.remoteDocumentCache.getEntries(t,e).next((e=>this.recalculateAndSaveOverlays(t,e)))}getDocumentsMatchingQuery(t,e,n){return function(t){return Zs.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length}(e)?this.getDocumentsMatchingDocumentQuery(t,e.path):ka(e)?this.getDocumentsMatchingCollectionGroupQuery(t,e,n):this.getDocumentsMatchingCollectionQuery(t,e,n)}getNextDocuments(t,e,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(t,e,n,r).next((i=>{const s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(t,e,n.largestBatchId,r-i.size):oo.resolve(Tc());let o=-1,a=i;return s.next((e=>oo.forEach(e,((e,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(e)?oo.resolve():this.remoteDocumentCache.getEntry(t,e).next((t=>{a=a.insert(e,t)}))))).next((()=>this.populateOverlays(t,e,i))).next((()=>this.computeViews(t,a,e,Rc()))).next((t=>({batchId:o,changes:Ec(t)})))))}))}getDocumentsMatchingDocumentQuery(t,e){return this.getDocument(t,new Zs(e)).next((t=>{let e=Sc();return t.isFoundDocument()&&(e=e.insert(t.key,t)),e}))}getDocumentsMatchingCollectionGroupQuery(t,e,n){const r=e.collectionGroup;let i=Sc();return this.indexManager.getCollectionParents(t,r).next((s=>oo.forEach(s,(s=>{const o=function(t,e){return new _a(e,null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}(e,s.child(r));return this.getDocumentsMatchingCollectionQuery(t,o,n).next((t=>{t.forEach(((t,e)=>{i=i.insert(t,e)}))}))})).next((()=>i))))}getDocumentsMatchingCollectionQuery(t,e,n){let r;return this.remoteDocumentCache.getAllFromCollection(t,e.path,n).next((i=>(r=i,this.documentOverlayCache.getOverlaysForCollection(t,e.path,n.largestBatchId)))).next((t=>{t.forEach(((t,e)=>{const n=e.getKey();null===r.get(n)&&(r=r.insert(n,ga.newInvalidDocument(n)))}));let n=Sc();return r.forEach(((r,i)=>{const s=t.get(r);void 0!==s&&ic(s.mutation,i,da.empty(),Ks.now()),xa(e,i)&&(n=n.insert(r,i))})),n}))}}
|
|
1188
1270
|
/**
|
|
1189
1271
|
* @license
|
|
1190
1272
|
* Copyright 2020 Google LLC
|
|
@@ -1200,7 +1282,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1200
1282
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1201
1283
|
* See the License for the specific language governing permissions and
|
|
1202
1284
|
* limitations under the License.
|
|
1203
|
-
*/class
|
|
1285
|
+
*/class Cl{constructor(t){this.yt=t,this.Zn=new Map,this.ts=new Map}getBundleMetadata(t,e){return oo.resolve(this.Zn.get(e))}saveBundleMetadata(t,e){var n;return this.Zn.set(e.id,{id:(n=e).id,version:n.version,createTime:Gc(n.createTime)}),oo.resolve()}getNamedQuery(t,e){return oo.resolve(this.ts.get(e))}saveNamedQuery(t,e){return this.ts.set(e.name,function(t){return{name:t.name,query:bl(t.bundledQuery),readTime:Gc(t.readTime)}}(e)),oo.resolve()}}
|
|
1204
1286
|
/**
|
|
1205
1287
|
* @license
|
|
1206
1288
|
* Copyright 2022 Google LLC
|
|
@@ -1216,7 +1298,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1216
1298
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1217
1299
|
* See the License for the specific language governing permissions and
|
|
1218
1300
|
* limitations under the License.
|
|
1219
|
-
*/class
|
|
1301
|
+
*/class Al{constructor(){this.overlays=new aa(Zs.comparator),this.es=new Map}getOverlay(t,e){return oo.resolve(this.overlays.get(e))}getOverlays(t,e){const n=Tc();return oo.forEach(e,(e=>this.getOverlay(t,e).next((t=>{null!==t&&n.set(e,t)})))).next((()=>n))}saveOverlays(t,e,n){return n.forEach(((n,r)=>{this.oe(t,e,r)})),oo.resolve()}removeOverlaysForBatchId(t,e,n){const r=this.es.get(n);return void 0!==r&&(r.forEach((t=>this.overlays=this.overlays.remove(t))),this.es.delete(n)),oo.resolve()}getOverlaysForCollection(t,e,n){const r=Tc(),i=e.length+1,s=new Zs(e.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){const t=o.getNext().value,s=t.getKey();if(!e.isPrefixOf(s.path))break;s.path.length===i&&t.largestBatchId>n&&r.set(t.getKey(),t)}return oo.resolve(r)}getOverlaysForCollectionGroup(t,e,n,r){let i=new aa(((t,e)=>t-e));const s=this.overlays.getIterator();for(;s.hasNext();){const t=s.getNext().value;if(t.getKey().getCollectionGroup()===e&&t.largestBatchId>n){let e=i.get(t.largestBatchId);null===e&&(e=Tc(),i=i.insert(t.largestBatchId,e)),e.set(t.getKey(),t)}}const o=Tc(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach(((t,e)=>o.set(t,e))),!(o.size()>=r)););return oo.resolve(o)}oe(t,e,n){const r=this.overlays.get(n.key);if(null!==r){const t=this.es.get(r.largestBatchId).delete(n.key);this.es.set(r.largestBatchId,t)}this.overlays=this.overlays.insert(n.key,new yl(e,n));let i=this.es.get(e);void 0===i&&(i=Rc(),this.es.set(e,i)),this.es.set(e,i.add(n.key))}}
|
|
1220
1302
|
/**
|
|
1221
1303
|
* @license
|
|
1222
1304
|
* Copyright 2017 Google LLC
|
|
@@ -1232,7 +1314,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1232
1314
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1233
1315
|
* See the License for the specific language governing permissions and
|
|
1234
1316
|
* limitations under the License.
|
|
1235
|
-
*/class
|
|
1317
|
+
*/class Rl{constructor(){this.ns=new ua(Nl.ss),this.rs=new ua(Nl.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Nl(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Nl(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new Zs(new Ys([])),n=new Nl(e,t),r=new Nl(e,t+1),i=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),i.push(t.key)})),i}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new Zs(new Ys([])),n=new Nl(e,t),r=new Nl(e,t+1);let i=Rc();return this.rs.forEachInRange([n,r],(t=>{i=i.add(t.key)})),i}containsKey(t){const e=new Nl(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Nl{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return Zs.comparator(t.key,e.key)||qs(t._s,e._s)}static os(t,e){return qs(t._s,e._s)||Zs.comparator(t.key,e.key)}}
|
|
1236
1318
|
/**
|
|
1237
1319
|
* @license
|
|
1238
1320
|
* Copyright 2017 Google LLC
|
|
@@ -1248,7 +1330,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1248
1330
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1249
1331
|
* See the License for the specific language governing permissions and
|
|
1250
1332
|
* limitations under the License.
|
|
1251
|
-
*/class
|
|
1333
|
+
*/class Ll{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new ua(Nl.ss)}checkEmpty(t){return oo.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const i=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const s=new gl(i,e,n,r);this.mutationQueue.push(s);for(const e of r)this.gs=this.gs.add(new Nl(e.key,i)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return oo.resolve(s)}lookupMutationBatch(t,e){return oo.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),i=r<0?0:r;return oo.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return oo.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return oo.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Nl(e,0),r=new Nl(e,Number.POSITIVE_INFINITY),i=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);i.push(e)})),oo.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new ua(qs);return e.forEach((t=>{const e=new Nl(t,0),r=new Nl(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),oo.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let i=n;Zs.isDocumentKey(i)||(i=i.child(""));const s=new Nl(new Zs(i),0);let o=new ua(qs);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),s),oo.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Ns(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return oo.forEach(e.mutations,(r=>{const i=new Nl(r.key,e.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Nl(e,0),r=this.gs.firstAfterOrEqual(n);return oo.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,oo.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
|
|
1252
1334
|
/**
|
|
1253
1335
|
* @license
|
|
1254
1336
|
* Copyright 2017 Google LLC
|
|
@@ -1264,7 +1346,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1264
1346
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1265
1347
|
* See the License for the specific language governing permissions and
|
|
1266
1348
|
* limitations under the License.
|
|
1267
|
-
*/class
|
|
1349
|
+
*/class Dl{constructor(t){this.Es=t,this.docs=new aa(Zs.comparator),this.size=0}setIndexManager(t){this.indexManager=t}addEntry(t,e){const n=e.key,r=this.docs.get(n),i=r?r.size:0,s=this.Es(e);return this.docs=this.docs.insert(n,{document:e.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(t,n.path.popLast())}removeEntry(t){const e=this.docs.get(t);e&&(this.docs=this.docs.remove(t),this.size-=e.size)}getEntry(t,e){const n=this.docs.get(e);return oo.resolve(n?n.document.mutableCopy():ga.newInvalidDocument(e))}getEntries(t,e){let n=bc();return e.forEach((t=>{const e=this.docs.get(t);n=n.insert(t,e?e.document.mutableCopy():ga.newInvalidDocument(t))})),oo.resolve(n)}getAllFromCollection(t,e,n){let r=bc();const i=new Zs(e.child("")),s=this.docs.getIteratorFrom(i);for(;s.hasNext();){const{key:t,value:{document:i}}=s.getNext();if(!e.isPrefixOf(t.path))break;t.path.length>e.length+1||no(to(i),n)<=0||(r=r.insert(i.key,i.mutableCopy()))}return oo.resolve(r)}getAllFromCollectionGroup(t,e,n,r){Rs()}As(t,e){return oo.forEach(this.docs,(t=>e(t)))}newChangeBuffer(t){return new Ol(this)}getSize(t){return oo.resolve(this.size)}}class Ol extends Tl{constructor(t){super(),this.Yn=t}applyChanges(t){const e=[];return this.changes.forEach(((n,r)=>{r.isValidDocument()?e.push(this.Yn.addEntry(t,r)):this.Yn.removeEntry(n)})),oo.waitFor(e)}getFromCache(t,e){return this.Yn.getEntry(t,e)}getAllFromCache(t,e){return this.Yn.getEntries(t,e)}}
|
|
1268
1350
|
/**
|
|
1269
1351
|
* @license
|
|
1270
1352
|
* Copyright 2017 Google LLC
|
|
@@ -1280,7 +1362,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1280
1362
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1281
1363
|
* See the License for the specific language governing permissions and
|
|
1282
1364
|
* limitations under the License.
|
|
1283
|
-
*/class
|
|
1365
|
+
*/class xl{constructor(t){this.persistence=t,this.Rs=new vc((t=>va(t)),wa),this.lastRemoteSnapshotVersion=Gs.min(),this.highestTargetId=0,this.bs=0,this.Ps=new Rl,this.targetCount=0,this.vs=El.Pn()}forEachTarget(t,e){return this.Rs.forEach(((t,n)=>e(n))),oo.resolve()}getLastRemoteSnapshotVersion(t){return oo.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(t){return oo.resolve(this.bs)}allocateTargetId(t){return this.highestTargetId=this.vs.next(),oo.resolve(this.highestTargetId)}setTargetsMetadata(t,e,n){return n&&(this.lastRemoteSnapshotVersion=n),e>this.bs&&(this.bs=e),oo.resolve()}Dn(t){this.Rs.set(t.target,t);const e=t.targetId;e>this.highestTargetId&&(this.vs=new El(e),this.highestTargetId=e),t.sequenceNumber>this.bs&&(this.bs=t.sequenceNumber)}addTargetData(t,e){return this.Dn(e),this.targetCount+=1,oo.resolve()}updateTargetData(t,e){return this.Dn(e),oo.resolve()}removeTargetData(t,e){return this.Rs.delete(e.target),this.Ps.ls(e.targetId),this.targetCount-=1,oo.resolve()}removeTargets(t,e,n){let r=0;const i=[];return this.Rs.forEach(((s,o)=>{o.sequenceNumber<=e&&null===n.get(o.targetId)&&(this.Rs.delete(s),i.push(this.removeMatchingKeysForTargetId(t,o.targetId)),r++)})),oo.waitFor(i).next((()=>r))}getTargetCount(t){return oo.resolve(this.targetCount)}getTargetData(t,e){const n=this.Rs.get(e)||null;return oo.resolve(n)}addMatchingKeys(t,e,n){return this.Ps.us(e,n),oo.resolve()}removeMatchingKeys(t,e,n){this.Ps.hs(e,n);const r=this.persistence.referenceDelegate,i=[];return r&&e.forEach((e=>{i.push(r.markPotentiallyOrphaned(t,e))})),oo.waitFor(i)}removeMatchingKeysForTargetId(t,e){return this.Ps.ls(e),oo.resolve()}getMatchingKeysForTargetId(t,e){const n=this.Ps.ds(e);return oo.resolve(n)}containsKey(t,e){return oo.resolve(this.Ps.containsKey(e))}}
|
|
1284
1366
|
/**
|
|
1285
1367
|
* @license
|
|
1286
1368
|
* Copyright 2017 Google LLC
|
|
@@ -1296,7 +1378,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1296
1378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1297
1379
|
* See the License for the specific language governing permissions and
|
|
1298
1380
|
* limitations under the License.
|
|
1299
|
-
*/class
|
|
1381
|
+
*/class Pl{constructor(t,e){this.Vs={},this.overlays={},this.Ss=new co(0),this.Ds=!1,this.Ds=!0,this.referenceDelegate=t(this),this.Cs=new xl(this),this.indexManager=new _l,this.remoteDocumentCache=function(t){return new Dl(t)}((t=>this.referenceDelegate.xs(t))),this.yt=new wl(e),this.Ns=new Cl(this.yt)}start(){return Promise.resolve()}shutdown(){return this.Ds=!1,Promise.resolve()}get started(){return this.Ds}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(t){return this.indexManager}getDocumentOverlayCache(t){let e=this.overlays[t.toKey()];return e||(e=new Al,this.overlays[t.toKey()]=e),e}getMutationQueue(t,e){let n=this.Vs[t.toKey()];return n||(n=new Ll(e,this.referenceDelegate),this.Vs[t.toKey()]=n),n}getTargetCache(){return this.Cs}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ns}runTransaction(t,e,n){Is("MemoryPersistence","Starting transaction:",t);const r=new Ml(this.Ss.next());return this.referenceDelegate.ks(),n(r).next((t=>this.referenceDelegate.Os(r).next((()=>t)))).toPromise().then((t=>(r.raiseOnCommittedEvent(),t)))}Ms(t,e){return oo.or(Object.values(this.Vs).map((n=>()=>n.containsKey(t,e))))}}class Ml extends io{constructor(t){super(),this.currentSequenceNumber=t}}class Ul{constructor(t){this.persistence=t,this.Fs=new Rl,this.$s=null}static Bs(t){return new Ul(t)}get Ls(){if(this.$s)return this.$s;throw Rs()}addReference(t,e,n){return this.Fs.addReference(n,e),this.Ls.delete(n.toString()),oo.resolve()}removeReference(t,e,n){return this.Fs.removeReference(n,e),this.Ls.add(n.toString()),oo.resolve()}markPotentiallyOrphaned(t,e){return this.Ls.add(e.toString()),oo.resolve()}removeTarget(t,e){this.Fs.ls(e.targetId).forEach((t=>this.Ls.add(t.toString())));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(t,e.targetId).next((t=>{t.forEach((t=>this.Ls.add(t.toString())))})).next((()=>n.removeTargetData(t,e)))}ks(){this.$s=new Set}Os(t){const e=this.persistence.getRemoteDocumentCache().newChangeBuffer();return oo.forEach(this.Ls,(n=>{const r=Zs.fromPath(n);return this.qs(t,r).next((t=>{t||e.removeEntry(r,Gs.min())}))})).next((()=>(this.$s=null,e.apply(t))))}updateLimboDocument(t,e){return this.qs(t,e).next((t=>{t?this.Ls.delete(e.toString()):this.Ls.add(e.toString())}))}xs(t){return 0}qs(t,e){return oo.or([()=>oo.resolve(this.Fs.containsKey(e)),()=>this.persistence.getTargetCache().containsKey(t,e),()=>this.persistence.Ms(t,e)])}}
|
|
1300
1382
|
/**
|
|
1301
1383
|
* @license
|
|
1302
1384
|
* Copyright 2017 Google LLC
|
|
@@ -1312,7 +1394,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1312
1394
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1313
1395
|
* See the License for the specific language governing permissions and
|
|
1314
1396
|
* limitations under the License.
|
|
1315
|
-
*/class
|
|
1397
|
+
*/class Fl{constructor(t,e,n,r){this.targetId=t,this.fromCache=e,this.Si=n,this.Di=r}static Ci(t,e){let n=Rc(),r=Rc();for(const t of e.docChanges)switch(t.type){case 0:n=n.add(t.doc.key);break;case 1:r=r.add(t.doc.key)}return new Fl(t,e.fromCache,n,r)}}
|
|
1316
1398
|
/**
|
|
1317
1399
|
* @license
|
|
1318
1400
|
* Copyright 2019 Google LLC
|
|
@@ -1328,7 +1410,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1328
1410
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1329
1411
|
* See the License for the specific language governing permissions and
|
|
1330
1412
|
* limitations under the License.
|
|
1331
|
-
*/class
|
|
1413
|
+
*/class zl{constructor(){this.xi=!1}initialize(t,e){this.Ni=t,this.indexManager=e,this.xi=!0}getDocumentsMatchingQuery(t,e,n,r){return this.ki(t,e).next((i=>i||this.Oi(t,e,r,n))).next((n=>n||this.Mi(t,e)))}ki(t,e){if(Ea(e))return oo.resolve(null);let n=Aa(e);return this.indexManager.getIndexType(t,n).next((r=>0===r?null:(null!==e.limit&&1===r&&(e=Na(e,null,"F"),n=Aa(e)),this.indexManager.getDocumentsMatchingTarget(t,n).next((r=>{const i=Rc(...r);return this.Ni.getDocuments(t,i).next((r=>this.indexManager.getMinOffset(t,n).next((n=>{const s=this.Fi(e,r);return this.$i(e,s,i,n.readTime)?this.ki(t,Na(e,null,"F")):this.Bi(t,s,e,n)}))))})))))}Oi(t,e,n,r){return Ea(e)||r.isEqual(Gs.min())?this.Mi(t,e):this.Ni.getDocuments(t,n).next((i=>{const s=this.Fi(e,i);return this.$i(e,s,n,r)?this.Mi(t,e):(Ts()<=le.DEBUG&&Is("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),Oa(e)),this.Bi(t,s,e,function(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=Gs.fromTimestamp(1e9===r?new Ks(n+1,0):new Ks(n,r));return new eo(i,Zs.empty(),e)}(r,-1)))}))}Fi(t,e){let n=new ua(Pa(t));return e.forEach(((e,r)=>{xa(t,r)&&(n=n.add(r))})),n}$i(t,e,n,r){if(null===t.limit)return!1;if(n.size!==e.size)return!0;const i="F"===t.limitType?e.last():e.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}Mi(t,e){return Ts()<=le.DEBUG&&Is("QueryEngine","Using full collection scan to execute query:",Oa(e)),this.Ni.getDocumentsMatchingQuery(t,e,eo.min())}Bi(t,e,n,r){return this.Ni.getDocumentsMatchingQuery(t,n,r).next((t=>(e.forEach((e=>{t=t.insert(e.key,e)})),t)))}}
|
|
1332
1414
|
/**
|
|
1333
1415
|
* @license
|
|
1334
1416
|
* Copyright 2020 Google LLC
|
|
@@ -1344,7 +1426,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1344
1426
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1345
1427
|
* See the License for the specific language governing permissions and
|
|
1346
1428
|
* limitations under the License.
|
|
1347
|
-
*/class
|
|
1429
|
+
*/class Bl{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new aa(qs),this.Ui=new vc((t=>va(t)),wa),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new kl(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function Vl(t,e){const n=Ls(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((i=>(r=i,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const i=[],s=[];let o=Rc();for(const t of r){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:i,addedBatchIds:s})))}))}))}function Hl(t){const e=Ls(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function $l(t,e){const n=Ls(t),r=e.snapshotVersion;let i=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const s=n.Gi.newChangeBuffer({trackRemovals:!0});i=n.qi;const o=[];e.targetChanges.forEach(((s,a)=>{const c=i.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,s.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,s.addedDocuments,a))));let l=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?l=l.withResumeToken(yo.EMPTY_BYTE_STRING,Gs.min()).withLastLimboFreeSnapshotVersion(Gs.min()):s.resumeToken.approximateByteSize()>0&&(l=l.withResumeToken(s.resumeToken,r)),i=i.insert(a,l),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,l,s)&&o.push(n.Cs.updateTargetData(t,l))}));let a=bc(),c=Rc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Rc(),i=Rc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=bc();return n.forEach(((n,s)=>{const o=t.get(n);s.isFoundDocument()!==o.isFoundDocument()&&(i=i.add(n)),s.isNoDocument()&&s.version.isEqual(Gs.min())?(e.removeEntry(n,s.readTime),r=r.insert(n,s)):!o.isValidDocument()||s.version.compareTo(o.version)>0||0===s.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(s),r=r.insert(n,s)):Is("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",s.version)})),{Wi:r,zi:i}}))}(t,s,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Gs.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return oo.waitFor(o).next((()=>s.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=i,t)))}function jl(t,e){const n=Ls(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function ql(t,e,n){const r=Ls(t),i=r.qi.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,(t=>r.persistence.referenceDelegate.removeTarget(t,i)))}catch(t){if(!ao(t))throw t;Is("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(i.target)}function Wl(t,e,n){const r=Ls(t);let i=Gs.min(),s=Rc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Ls(t),i=r.Ui.get(n);return void 0!==i?oo.resolve(r.qi.get(i)):r.Cs.getTargetData(e,n)}(r,t,Aa(e)).next((e=>{if(e)return i=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{s=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?i:Gs.min(),n?s:Rc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Gs.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:s})))))}class Kl{constructor(){this.activeTargetIds=Lc()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class Gl{constructor(){this.Lr=new Kl,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Kl,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
|
|
1348
1430
|
/**
|
|
1349
1431
|
* @license
|
|
1350
1432
|
* Copyright 2019 Google LLC
|
|
@@ -1360,7 +1442,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1360
1442
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1361
1443
|
* See the License for the specific language governing permissions and
|
|
1362
1444
|
* limitations under the License.
|
|
1363
|
-
*/class
|
|
1445
|
+
*/class Ql{Ur(t){}shutdown(){}}
|
|
1364
1446
|
/**
|
|
1365
1447
|
* @license
|
|
1366
1448
|
* Copyright 2019 Google LLC
|
|
@@ -1376,7 +1458,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1376
1458
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1377
1459
|
* See the License for the specific language governing permissions and
|
|
1378
1460
|
* limitations under the License.
|
|
1379
|
-
*/class
|
|
1461
|
+
*/class Yl{constructor(){this.Kr=()=>this.Gr(),this.Qr=()=>this.jr(),this.Wr=[],this.zr()}Ur(t){this.Wr.push(t)}shutdown(){window.removeEventListener("online",this.Kr),window.removeEventListener("offline",this.Qr)}zr(){window.addEventListener("online",this.Kr),window.addEventListener("offline",this.Qr)}Gr(){Is("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const t of this.Wr)t(0)}jr(){Is("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const t of this.Wr)t(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}
|
|
1380
1462
|
/**
|
|
1381
1463
|
* @license
|
|
1382
1464
|
* Copyright 2020 Google LLC
|
|
@@ -1392,7 +1474,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1392
1474
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1393
1475
|
* See the License for the specific language governing permissions and
|
|
1394
1476
|
* limitations under the License.
|
|
1395
|
-
*/const
|
|
1477
|
+
*/const Jl={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};
|
|
1396
1478
|
/**
|
|
1397
1479
|
* @license
|
|
1398
1480
|
* Copyright 2017 Google LLC
|
|
@@ -1408,7 +1490,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1408
1490
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1409
1491
|
* See the License for the specific language governing permissions and
|
|
1410
1492
|
* limitations under the License.
|
|
1411
|
-
*/class
|
|
1493
|
+
*/class Xl{constructor(t){this.Hr=t.Hr,this.Jr=t.Jr}Yr(t){this.Xr=t}Zr(t){this.eo=t}onMessage(t){this.no=t}close(){this.Jr()}send(t){this.Hr(t)}so(){this.Xr()}io(t){this.eo(t)}ro(t){this.no(t)}}
|
|
1412
1494
|
/**
|
|
1413
1495
|
* @license
|
|
1414
1496
|
* Copyright 2017 Google LLC
|
|
@@ -1424,7 +1506,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1424
1506
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1425
1507
|
* See the License for the specific language governing permissions and
|
|
1426
1508
|
* limitations under the License.
|
|
1427
|
-
*/class
|
|
1509
|
+
*/class Zl extends class{constructor(t){this.databaseInfo=t,this.databaseId=t.databaseId;const e=t.ssl?"https":"http";this.oo=e+"://"+t.host,this.uo="projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database+"/documents"}get co(){return!1}ao(t,e,n,r,i){const s=this.ho(t,e);Is("RestConnection","Sending: ",s,n);const o={};return this.lo(o,r,i),this.fo(t,s,o,n).then((t=>(Is("RestConnection","Received: ",t),t)),(e=>{throw Cs("RestConnection",`${t} failed with error: `,e,"url: ",s,"request:",n),e}))}_o(t,e,n,r,i,s){return this.ao(t,e,n,r,i)}lo(t,e,n){t["X-Goog-Api-Client"]="gl-js/ fire/"+Ss,t["Content-Type"]="text/plain",this.databaseInfo.appId&&(t["X-Firebase-GMPID"]=this.databaseInfo.appId),e&&e.headers.forEach(((e,n)=>t[n]=e)),n&&n.headers.forEach(((e,n)=>t[n]=e))}ho(t,e){const n=Jl[t];return`${this.oo}/v1/${e}:${n}`}}{constructor(t){super(t),this.forceLongPolling=t.forceLongPolling,this.autoDetectLongPolling=t.autoDetectLongPolling,this.useFetchStreams=t.useFetchStreams}fo(t,e,n,r){return new Promise(((i,s)=>{const o=new ws;o.setWithCredentials(!0),o.listenOnce(fs.COMPLETE,(()=>{try{switch(o.getLastErrorCode()){case ds.NO_ERROR:const e=o.getResponseJson();Is("Connection","XHR received:",JSON.stringify(e)),i(e);break;case ds.TIMEOUT:Is("Connection",'RPC "'+t+'" timed out'),s(new Os(Ds.DEADLINE_EXCEEDED,"Request time out"));break;case ds.HTTP_ERROR:const n=o.getStatus();if(Is("Connection",'RPC "'+t+'" failed with status:',n,"response text:",o.getResponseText()),n>0){let t=o.getResponseJson();Array.isArray(t)&&(t=t[0]);const e=null==t?void 0:t.error;if(e&&e.status&&e.message){const t=function(t){const e=t.toLowerCase().replace(/_/g,"-");return Object.values(Ds).indexOf(e)>=0?e:Ds.UNKNOWN}(e.status);s(new Os(t,e.message))}else s(new Os(Ds.UNKNOWN,"Server responded with status "+o.getStatus()))}else s(new Os(Ds.UNAVAILABLE,"Connection failed."));break;default:Rs()}}finally{Is("Connection",'RPC "'+t+'" completed.')}}));const a=JSON.stringify(r);o.send(e,"POST",a,n,15)}))}wo(t,e,n){const r=[this.oo,"/","google.firestore.v1.Firestore","/",t,"/channel"],i=new as,s=sr(),o={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling};this.useFetchStreams&&(o.xmlHttpFactory=new ys({})),this.lo(o.initMessageHeaders,e,n),o.encodeInitMessageHeaders=!0;const a=r.join("");Is("Connection","Creating WebChannel: "+a,o);const c=i.createWebChannel(a,o);let l=!1,u=!1;const h=new Xl({Hr:t=>{u?Is("Connection","Not sending because WebChannel is closed:",t):(l||(Is("Connection","Opening WebChannel transport."),c.open(),l=!0),Is("Connection","WebChannel sending:",t),c.send(t))},Jr:()=>c.close()}),d=(t,e,n)=>{t.listen(e,(t=>{try{n(t)}catch(t){setTimeout((()=>{throw t}),0)}}))};return d(c,vs.EventType.OPEN,(()=>{u||Is("Connection","WebChannel transport opened.")})),d(c,vs.EventType.CLOSE,(()=>{u||(u=!0,Is("Connection","WebChannel transport closed"),h.io())})),d(c,vs.EventType.ERROR,(t=>{u||(u=!0,Cs("Connection","WebChannel transport errored:",t),h.io(new Os(Ds.UNAVAILABLE,"The operation could not be completed")))})),d(c,vs.EventType.MESSAGE,(t=>{var e;if(!u){const n=t.data[0];Ns(!!n);const r=n,i=r.error||(null===(e=r[0])||void 0===e?void 0:e.error);if(i){Is("Connection","WebChannel received error:",i);const t=i.status;let e=function(t){const e=gc[t];if(void 0!==e)return yc(e)}(t),n=i.message;void 0===e&&(e=Ds.INTERNAL,n="Unknown error status: "+t+" with message "+i.message),u=!0,h.io(new Os(e,n)),c.close()}else Is("Connection","WebChannel received:",n),h.ro(n)}})),d(s,ps.STAT_EVENT,(t=>{t.stat===gs?Is("Connection","Detected buffering proxy"):t.stat===ms&&Is("Connection","Detected no buffering proxy")})),setTimeout((()=>{h.so()}),0),h}}function tu(){return"undefined"!=typeof document?document:null}
|
|
1428
1510
|
/**
|
|
1429
1511
|
* @license
|
|
1430
1512
|
* Copyright 2020 Google LLC
|
|
@@ -1440,7 +1522,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1440
1522
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1441
1523
|
* See the License for the specific language governing permissions and
|
|
1442
1524
|
* limitations under the License.
|
|
1443
|
-
*/function
|
|
1525
|
+
*/function eu(t){return new jc(t,!0)}class nu{constructor(t,e,n=1e3,r=1.5,i=6e4){this.Hs=t,this.timerId=e,this.mo=n,this.yo=r,this.po=i,this.Io=0,this.To=null,this.Eo=Date.now(),this.reset()}reset(){this.Io=0}Ao(){this.Io=this.po}Ro(t){this.cancel();const e=Math.floor(this.Io+this.bo()),n=Math.max(0,Date.now()-this.Eo),r=Math.max(0,e-n);r>0&&Is("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.Io} ms, delay with jitter: ${e} ms, last attempt: ${n} ms ago)`),this.To=this.Hs.enqueueAfterDelay(this.timerId,r,(()=>(this.Eo=Date.now(),t()))),this.Io*=this.yo,this.Io<this.mo&&(this.Io=this.mo),this.Io>this.po&&(this.Io=this.po)}Po(){null!==this.To&&(this.To.skipDelay(),this.To=null)}cancel(){null!==this.To&&(this.To.cancel(),this.To=null)}bo(){return(Math.random()-.5)*this.Io}}
|
|
1444
1526
|
/**
|
|
1445
1527
|
* @license
|
|
1446
1528
|
* Copyright 2017 Google LLC
|
|
@@ -1456,7 +1538,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1456
1538
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1457
1539
|
* See the License for the specific language governing permissions and
|
|
1458
1540
|
* limitations under the License.
|
|
1459
|
-
*/class
|
|
1541
|
+
*/class ru{constructor(t,e,n,r,i,s,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new nu(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Ds.RESOURCE_EXHAUSTED?(ks(e.toString()),ks("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Ds.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Os(Ds.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Is("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Is("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class iu extends ru{constructor(t,e,n,r,i,s){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,s),this.yt=i}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Rs()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(t,e){return t.wt?(Ns(void 0===e||"string"==typeof e),yo.fromBase64String(e||"")):(Ns(void 0===e||e instanceof Uint8Array),yo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Ds.UNKNOWN:yc(t.code);return new Os(e,t.message||"")}(o);n=new Mc(r,i,s,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=Xc(t,r.document.name),s=Gc(r.document.updateTime),o=r.document.createTime?Gc(r.document.createTime):Gs.min(),a=new fa({mapValue:{fields:r.document.fields}}),c=ga.newFoundDocument(i,s,o,a),l=r.targetIds||[],u=r.removedTargetIds||[];n=new xc(l,u,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=Xc(t,r.document),s=r.readTime?Gc(r.readTime):Gs.min(),o=ga.newNoDocument(i,s),a=r.removedTargetIds||[];n=new xc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=Xc(t,r.document),s=r.removedTargetIds||[];n=new xc([],s,i,null)}else{if(!("filter"in e))return Rs();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,i=new pc(r),s=t.targetId;n=new Pc(s,i)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Gs.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Gs.min():e.readTime?Gc(e.readTime):Gs.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=tl(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=ba(r)?{documents:rl(t,r)}:{query:il(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Wc(t,e.resumeToken):e.snapshotVersion.compareTo(Gs.min())>0&&(n.readTime=qc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Rs()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=tl(this.yt),e.removeTarget=t,this.Bo(e)}}class su extends ru{constructor(t,e,n,r,i,s){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,s),this.yt=i,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Ns(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Ns(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Gc(t.updateTime):Gc(e);return n.isEqual(Gs.min())&&(n=Gc(e)),new Xa(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Gc(t.commitTime);return this.listener.Zo(n,e)}return Ns(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=tl(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof ac)n={update:nl(t,e.key,e.value)};else if(e instanceof dc)n={delete:Jc(t,e.key)};else if(e instanceof cc)n={update:nl(t,e.key,e.data),updateMask:fl(e.fieldMask)};else{if(!(e instanceof fc))return Rs();n={verify:Jc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof ja)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof qa)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Ka)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Qa)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Rs()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Kc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Rs()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
|
|
1460
1542
|
/**
|
|
1461
1543
|
* @license
|
|
1462
1544
|
* Copyright 2017 Google LLC
|
|
@@ -1472,7 +1554,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1472
1554
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1473
1555
|
* See the License for the specific language governing permissions and
|
|
1474
1556
|
* limitations under the License.
|
|
1475
|
-
*/class
|
|
1557
|
+
*/class ou extends class{}{constructor(t,e,n,r){super(),this.authCredentials=t,this.appCheckCredentials=e,this.connection=n,this.yt=r,this.nu=!1}su(){if(this.nu)throw new Os(Ds.FAILED_PRECONDITION,"The client has already been terminated.")}ao(t,e,n){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([r,i])=>this.connection.ao(t,e,n,r,i))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Ds.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Os(Ds.UNKNOWN,t.toString())}))}_o(t,e,n,r){return this.su(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([i,s])=>this.connection._o(t,e,n,i,s,r))).catch((t=>{throw"FirebaseError"===t.name?(t.code===Ds.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),t):new Os(Ds.UNKNOWN,t.toString())}))}terminate(){this.nu=!0}}class au{constructor(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state="Unknown",this.iu=0,this.ru=null,this.ou=!0}uu(){0===this.iu&&(this.cu("Unknown"),this.ru=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,(()=>(this.ru=null,this.au("Backend didn't respond within 10 seconds."),this.cu("Offline"),Promise.resolve()))))}hu(t){"Online"===this.state?this.cu("Unknown"):(this.iu++,this.iu>=1&&(this.lu(),this.au(`Connection failed 1 times. Most recent error: ${t.toString()}`),this.cu("Offline")))}set(t){this.lu(),this.iu=0,"Online"===t&&(this.ou=!1),this.cu(t)}cu(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))}au(t){const e=`Could not reach Cloud Firestore backend. ${t}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.ou?(ks(e),this.ou=!1):Is("OnlineStateTracker",e)}lu(){null!==this.ru&&(this.ru.cancel(),this.ru=null)}}
|
|
1476
1558
|
/**
|
|
1477
1559
|
* @license
|
|
1478
1560
|
* Copyright 2017 Google LLC
|
|
@@ -1488,7 +1570,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1488
1570
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1489
1571
|
* See the License for the specific language governing permissions and
|
|
1490
1572
|
* limitations under the License.
|
|
1491
|
-
*/class
|
|
1573
|
+
*/class cu{constructor(t,e,n,r,i){this.localStore=t,this.datastore=e,this.asyncQueue=n,this.remoteSyncer={},this.fu=[],this.du=new Map,this._u=new Set,this.wu=[],this.mu=i,this.mu.Ur((t=>{n.enqueueAndForget((async()=>{yu(this)&&(Is("RemoteStore","Restarting streams for network reachability change."),await async function(t){const e=Ls(t);e._u.add(4),await uu(e),e.gu.set("Unknown"),e._u.delete(4),await lu(e)}(this))}))})),this.gu=new au(n,r)}}async function lu(t){if(yu(t))for(const e of t.wu)await e(!0)}async function uu(t){for(const e of t.wu)await e(!1)}function hu(t,e){const n=Ls(t);n.du.has(e.targetId)||(n.du.set(e.targetId,e),mu(n)?gu(n):xu(n).ko()&&fu(n,e))}function du(t,e){const n=Ls(t),r=xu(n);n.du.delete(e),r.ko()&&pu(n,e),0===n.du.size&&(r.ko()?r.Fo():yu(n)&&n.gu.set("Unknown"))}function fu(t,e){t.yu.Ot(e.targetId),xu(t).zo(e)}function pu(t,e){t.yu.Ot(e),xu(t).Ho(e)}function gu(t){t.yu=new Fc({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ne:e=>t.du.get(e)||null}),xu(t).start(),t.gu.uu()}function mu(t){return yu(t)&&!xu(t).No()&&t.du.size>0}function yu(t){return 0===Ls(t)._u.size}function vu(t){t.yu=void 0}async function wu(t){t.du.forEach(((e,n)=>{fu(t,e)}))}async function bu(t,e){vu(t),mu(t)?(t.gu.hu(e),gu(t)):t.gu.set("Unknown")}async function _u(t,e,n){if(t.gu.set("Online"),e instanceof Mc&&2===e.state&&e.cause)try{await async function(t,e){const n=e.cause;for(const r of e.targetIds)t.du.has(r)&&(await t.remoteSyncer.rejectListen(r,n),t.du.delete(r),t.yu.removeTarget(r))}(t,e)}catch(n){Is("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),n),await Su(t,n)}else if(e instanceof xc?t.yu.Kt(e):e instanceof Pc?t.yu.Jt(e):t.yu.jt(e),!n.isEqual(Gs.min()))try{const e=await Hl(t.localStore);n.compareTo(e)>=0&&await function(t,e){const n=t.yu.Zt(e);return n.targetChanges.forEach(((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const i=t.du.get(r);i&&t.du.set(r,i.withResumeToken(n.resumeToken,e))}})),n.targetMismatches.forEach((e=>{const n=t.du.get(e);if(!n)return;t.du.set(e,n.withResumeToken(yo.EMPTY_BYTE_STRING,n.snapshotVersion)),pu(t,e);const r=new vl(n.target,e,1,n.sequenceNumber);fu(t,r)})),t.remoteSyncer.applyRemoteEvent(n)}(t,n)}catch(e){Is("RemoteStore","Failed to raise snapshot:",e),await Su(t,e)}}async function Su(t,e,n){if(!ao(e))throw e;t._u.add(1),await uu(t),t.gu.set("Offline"),n||(n=()=>Hl(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Is("RemoteStore","Retrying IndexedDB access"),await n(),t._u.delete(1),await lu(t)}))}function Eu(t,e){return e().catch((n=>Su(t,n,e)))}async function Tu(t){const e=Ls(t),n=Pu(e);let r=e.fu.length>0?e.fu[e.fu.length-1].batchId:-1;for(;Iu(e);)try{const t=await jl(e.localStore,r);if(null===t){0===e.fu.length&&n.Fo();break}r=t.batchId,ku(e,t)}catch(t){await Su(e,t)}Cu(e)&&Au(e)}function Iu(t){return yu(t)&&t.fu.length<10}function ku(t,e){t.fu.push(e);const n=Pu(t);n.ko()&&n.Yo&&n.Xo(e.mutations)}function Cu(t){return yu(t)&&!Pu(t).No()&&t.fu.length>0}function Au(t){Pu(t).start()}async function Ru(t){Pu(t).eu()}async function Nu(t){const e=Pu(t);for(const n of t.fu)e.Xo(n.mutations)}async function Lu(t,e,n){const r=t.fu.shift(),i=ml.from(r,e,n);await Eu(t,(()=>t.remoteSyncer.applySuccessfulWrite(i))),await Tu(t)}async function Du(t,e){e&&Pu(t).Yo&&await async function(t,e){if(function(t){switch(t){default:return Rs();case Ds.CANCELLED:case Ds.UNKNOWN:case Ds.DEADLINE_EXCEEDED:case Ds.RESOURCE_EXHAUSTED:case Ds.INTERNAL:case Ds.UNAVAILABLE:case Ds.UNAUTHENTICATED:return!1;case Ds.INVALID_ARGUMENT:case Ds.NOT_FOUND:case Ds.ALREADY_EXISTS:case Ds.PERMISSION_DENIED:case Ds.FAILED_PRECONDITION:case Ds.ABORTED:case Ds.OUT_OF_RANGE:case Ds.UNIMPLEMENTED:case Ds.DATA_LOSS:return!0}}(n=e.code)&&n!==Ds.ABORTED){const n=t.fu.shift();Pu(t).Mo(),await Eu(t,(()=>t.remoteSyncer.rejectFailedWrite(n.batchId,e))),await Tu(t)}var n}(t,e),Cu(t)&&Au(t)}async function Ou(t,e){const n=Ls(t);n.asyncQueue.verifyOperationInProgress(),Is("RemoteStore","RemoteStore received new credentials");const r=yu(n);n._u.add(3),await uu(n),r&&n.gu.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n._u.delete(3),await lu(n)}function xu(t){return t.pu||(t.pu=function(t,e,n){const r=Ls(t);return r.su(),new iu(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)
|
|
1492
1574
|
/**
|
|
1493
1575
|
* @license
|
|
1494
1576
|
* Copyright 2018 Google LLC
|
|
@@ -1504,7 +1586,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1504
1586
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1505
1587
|
* See the License for the specific language governing permissions and
|
|
1506
1588
|
* limitations under the License.
|
|
1507
|
-
*/}(t.datastore,t.asyncQueue,{Yr:
|
|
1589
|
+
*/}(t.datastore,t.asyncQueue,{Yr:wu.bind(null,t),Zr:bu.bind(null,t),Wo:_u.bind(null,t)}),t.wu.push((async e=>{e?(t.pu.Mo(),mu(t)?gu(t):t.gu.set("Unknown")):(await t.pu.stop(),vu(t))}))),t.pu}function Pu(t){return t.Iu||(t.Iu=function(t,e,n){const r=Ls(t);return r.su(),new su(e,r.connection,r.authCredentials,r.appCheckCredentials,r.yt,n)}(t.datastore,t.asyncQueue,{Yr:Ru.bind(null,t),Zr:Du.bind(null,t),tu:Nu.bind(null,t),Zo:Lu.bind(null,t)}),t.wu.push((async e=>{e?(t.Iu.Mo(),await Tu(t)):(await t.Iu.stop(),t.fu.length>0&&(Is("RemoteStore",`Stopping write stream with ${t.fu.length} pending writes`),t.fu=[]))}))),t.Iu
|
|
1508
1590
|
/**
|
|
1509
1591
|
* @license
|
|
1510
1592
|
* Copyright 2017 Google LLC
|
|
@@ -1520,7 +1602,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1520
1602
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1521
1603
|
* See the License for the specific language governing permissions and
|
|
1522
1604
|
* limitations under the License.
|
|
1523
|
-
*/}class
|
|
1605
|
+
*/}class Mu{constructor(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new xs,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((t=>{}))}static createAndSchedule(t,e,n,r,i){const s=Date.now()+n,o=new Mu(t,e,s,r,i);return o.start(n),o}start(t){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),t)}skipDelay(){return this.handleDelayElapsed()}cancel(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Os(Ds.CANCELLED,"Operation cancelled"+(t?": "+t:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget((()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then((t=>this.deferred.resolve(t)))):Promise.resolve()))}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function Uu(t,e){if(ks("AsyncQueue",`${e}: ${t}`),ao(t))return new Os(Ds.UNAVAILABLE,`${e}: ${t}`);throw t}
|
|
1524
1606
|
/**
|
|
1525
1607
|
* @license
|
|
1526
1608
|
* Copyright 2017 Google LLC
|
|
@@ -1536,7 +1618,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1536
1618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1537
1619
|
* See the License for the specific language governing permissions and
|
|
1538
1620
|
* limitations under the License.
|
|
1539
|
-
*/class
|
|
1621
|
+
*/class Fu{constructor(t){this.comparator=t?(e,n)=>t(e,n)||Zs.comparator(e.key,n.key):(t,e)=>Zs.comparator(t.key,e.key),this.keyedMap=Sc(),this.sortedSet=new aa(this.comparator)}static emptySet(t){return new Fu(t.comparator)}has(t){return null!=this.keyedMap.get(t)}get(t){return this.keyedMap.get(t)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(t){const e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1}get size(){return this.sortedSet.size}forEach(t){this.sortedSet.inorderTraversal(((e,n)=>(t(e),!1)))}add(t){const e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))}delete(t){const e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this}isEqual(t){if(!(t instanceof Fu))return!1;if(this.size!==t.size)return!1;const e=this.sortedSet.getIterator(),n=t.sortedSet.getIterator();for(;e.hasNext();){const t=e.getNext().key,r=n.getNext().key;if(!t.isEqual(r))return!1}return!0}toString(){const t=[];return this.forEach((e=>{t.push(e.toString())})),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"}copy(t,e){const n=new Fu;return n.comparator=this.comparator,n.keyedMap=t,n.sortedSet=e,n}}
|
|
1540
1622
|
/**
|
|
1541
1623
|
* @license
|
|
1542
1624
|
* Copyright 2017 Google LLC
|
|
@@ -1552,7 +1634,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1552
1634
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1553
1635
|
* See the License for the specific language governing permissions and
|
|
1554
1636
|
* limitations under the License.
|
|
1555
|
-
*/class
|
|
1637
|
+
*/class zu{constructor(){this.Tu=new aa(Zs.comparator)}track(t){const e=t.doc.key,n=this.Tu.get(e);n?0!==t.type&&3===n.type?this.Tu=this.Tu.insert(e,t):3===t.type&&1!==n.type?this.Tu=this.Tu.insert(e,{type:n.type,doc:t.doc}):2===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):2===t.type&&0===n.type?this.Tu=this.Tu.insert(e,{type:0,doc:t.doc}):1===t.type&&0===n.type?this.Tu=this.Tu.remove(e):1===t.type&&2===n.type?this.Tu=this.Tu.insert(e,{type:1,doc:n.doc}):0===t.type&&1===n.type?this.Tu=this.Tu.insert(e,{type:2,doc:t.doc}):Rs():this.Tu=this.Tu.insert(e,t)}Eu(){const t=[];return this.Tu.inorderTraversal(((e,n)=>{t.push(n)})),t}}class Bu{constructor(t,e,n,r,i,s,o,a,c){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(t,e,n,r,i){const s=[];return e.forEach((t=>{s.push({type:0,doc:t})})),new Bu(t,e,Fu.emptySet(e),s,n,r,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(t){if(!(this.fromCache===t.fromCache&&this.hasCachedResults===t.hasCachedResults&&this.syncStateChanged===t.syncStateChanged&&this.mutatedKeys.isEqual(t.mutatedKeys)&&La(this.query,t.query)&&this.docs.isEqual(t.docs)&&this.oldDocs.isEqual(t.oldDocs)))return!1;const e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].type!==n[t].type||!e[t].doc.isEqual(n[t].doc))return!1;return!0}}
|
|
1556
1638
|
/**
|
|
1557
1639
|
* @license
|
|
1558
1640
|
* Copyright 2017 Google LLC
|
|
@@ -1568,7 +1650,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1568
1650
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1569
1651
|
* See the License for the specific language governing permissions and
|
|
1570
1652
|
* limitations under the License.
|
|
1571
|
-
*/class
|
|
1653
|
+
*/class Vu{constructor(){this.Au=void 0,this.listeners=[]}}class Hu{constructor(){this.queries=new vc((t=>Da(t)),La),this.onlineState="Unknown",this.Ru=new Set}}async function $u(t,e){const n=Ls(t),r=e.query;let i=!1,s=n.queries.get(r);if(s||(i=!0,s=new Vu),i)try{s.Au=await n.onListen(r)}catch(t){const n=Uu(t,`Initialization of query '${Oa(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,s),s.listeners.push(e),e.bu(n.onlineState),s.Au&&e.Pu(s.Au)&&Ku(n)}async function ju(t,e){const n=Ls(t),r=e.query;let i=!1;const s=n.queries.get(r);if(s){const t=s.listeners.indexOf(e);t>=0&&(s.listeners.splice(t,1),i=0===s.listeners.length)}if(i)return n.queries.delete(r),n.onUnlisten(r)}function qu(t,e){const n=Ls(t);let r=!1;for(const t of e){const e=t.query,i=n.queries.get(e);if(i){for(const e of i.listeners)e.Pu(t)&&(r=!0);i.Au=t}}r&&Ku(n)}function Wu(t,e,n){const r=Ls(t),i=r.queries.get(e);if(i)for(const t of i.listeners)t.onError(n);r.queries.delete(e)}function Ku(t){t.Ru.forEach((t=>{t.next()}))}class Gu{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new Bu(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=Bu.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
|
|
1572
1654
|
/**
|
|
1573
1655
|
* @license
|
|
1574
1656
|
* Copyright 2017 Google LLC
|
|
@@ -1584,7 +1666,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1584
1666
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1585
1667
|
* See the License for the specific language governing permissions and
|
|
1586
1668
|
* limitations under the License.
|
|
1587
|
-
*/class
|
|
1669
|
+
*/class Qu{constructor(t){this.key=t}}class Yu{constructor(t){this.key=t}}class Ju{constructor(t,e){this.query=t,this.qu=e,this.Uu=null,this.hasCachedResults=!1,this.current=!1,this.Ku=Rc(),this.mutatedKeys=Rc(),this.Gu=Pa(t),this.Qu=new Fu(this.Gu)}get ju(){return this.qu}Wu(t,e){const n=e?e.zu:new zu,r=e?e.Qu:this.Qu;let i=e?e.mutatedKeys:this.mutatedKeys,s=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(t.inorderTraversal(((t,e)=>{const l=r.get(t),u=xa(this.query,e)?e: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.Hu(l,u)||(n.track({type:2,doc:u}),f=!0,(a&&this.Gu(u,a)>0||c&&this.Gu(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),i=d?i.add(t):i.delete(t)):(s=s.delete(t),i=i.delete(t)))})),null!==this.query.limit)for(;s.size>this.query.limit;){const t="F"===this.query.limitType?s.last():s.first();s=s.delete(t.key),i=i.delete(t.key),n.track({type:1,doc:t})}return{Qu:s,zu:n,$i:o,mutatedKeys:i}}Hu(t,e){return t.hasLocalMutations&&e.hasCommittedMutations&&!e.hasLocalMutations}applyChanges(t,e,n){const r=this.Qu;this.Qu=t.Qu,this.mutatedKeys=t.mutatedKeys;const i=t.zu.Eu();i.sort(((t,e)=>function(t,e){const n=t=>{switch(t){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Rs()}};return n(t)-n(e)}
|
|
1588
1670
|
/**
|
|
1589
1671
|
* @license
|
|
1590
1672
|
* Copyright 2020 Google LLC
|
|
@@ -1600,7 +1682,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1600
1682
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1601
1683
|
* See the License for the specific language governing permissions and
|
|
1602
1684
|
* limitations under the License.
|
|
1603
|
-
*/(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!==i.length||a?{snapshot:new Zl(this.query,t.Qu,r,i,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 Xl,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new lu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new cu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Zl.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class hu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class du{constructor(t){this.key=t,this.nc=!1}}class fu{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new Ya((t=>pa(t)),fa),this.rc=new Map,this.oc=new Set,this.uc=new qo(Ms.comparator),this.cc=new Map,this.ac=new el,this.hc={},this.lc=new Map,this.fc=Qc.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function pu(t,e){const n=function(t){const e=ps(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=mu.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=ku.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=vu.bind(null,e),e.sc.Wo=iu.bind(null,e.eventManager),e.sc.wc=su.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=ps(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,js.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new qc(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,ua(e));n.isPrimaryClient&&Pl(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await yl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return Su(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await yl(t.localStore,e,!0),o=new uu(e,s.Hi),a=o.Wu(s.documents),c=uc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);Su(t,n,l.Xu);const u=new hu(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,r,"current"===s,t.resumeToken)}return i}async function gu(t,e){const n=ps(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!fa(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ml(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),Ml(n.remoteStore,r.targetId),wu(n,r.targetId)})).catch(Hs)):(wu(n,r.targetId),await ml(n.localStore,r.targetId,!0))}async function mu(t,e){const n=ps(t);try{const t=await gl(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(fs(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?fs(r.nc):t.removedDocuments.size>0&&(fs(r.nc),r.nc=!1))})),await Eu(n,t,e)}catch(t){await Hs(t)}}function yu(t,e,n){const r=ps(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=ps(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&ou(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function vu(t,e,n){const r=ps(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new qo(Ms.comparator);t=t.insert(s,Jo.newNoDocument(s,Ls.min()));const n=oc().add(s),i=new lc(Ls.min(),new Map,new Go(As),t,n);await mu(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),Tu(r)}else await ml(r.localStore,e,!1).then((()=>wu(r,e,n))).catch(Hs)}function wu(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||bu(t,e)}))}function bu(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(Ml(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),Tu(t))}function Su(t,e,n){for(const r of n)r instanceof cu?(t.ac.addReference(r.key,e),_u(t,r)):r instanceof lu?(cs("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||bu(t,r.key)):ds()}function _u(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(cs("SyncEngine","New document in limbo: "+n),t.oc.add(r),Tu(t))}function Tu(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 Ms(Ds.fromString(e)),r=t.fc.next();t.cc.set(r,new du(n)),t.uc=t.uc.insert(n,r),Pl(t.remoteStore,new qc(ua(ia(n.path)),r,2,$s.at))}}async function Eu(t,e,n){const r=ps(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=ul.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=ps(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>js.forEach(e,(e=>js.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>js.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!qs(t))throw t;cs("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function Iu(t,e){const n=ps(t);if(!n.currentUser.isEqual(e)){cs("SyncEngine","User change. New user:",e.toKey());const t=await fl(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new ms(gs.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await Eu(n,t.ji)}}function ku(t,e){const n=ps(t),r=n.cc.get(e);if(r&&r.nc)return oc().add(r.key);{let t=oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Cu{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=kl(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new dl(t,e,n,r)}(this.persistence,new hl,t.initialUser,this.yt)}yc(t){return new al(ll.Bs,this.yt)}gc(t){return new wl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class Au{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=>yu(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=Iu.bind(null,this.syncEngine),await async function(t,e){const n=ps(t);e?(n._u.delete(2),await Dl(n)):e||(n._u.add(2),await xl(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new eu}createDatastore(t){const e=kl(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new El(r));var r;return function(t,e,n,r){return new Nl(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>yu(this.syncEngine,t,0),s=Sl.C()?new Sl:new bl,new Ol(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new fu(t,e,n,r,i,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=ps(t);cs("RemoteStore","RemoteStore shutting down."),e._u.add(5),await xl(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
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!==i.length||a?{snapshot:new Bu(this.query,t.Qu,r,i,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 zu,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=Rc(),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 Yu(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Qu(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Rc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return Bu.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class Xu{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class Zu{constructor(t){this.key=t,this.nc=!1}}class th{constructor(t,e,n,r,i,s){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.sc={},this.ic=new vc((t=>Da(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new aa(Zs.comparator),this.cc=new Map,this.ac=new Rl,this.hc={},this.lc=new Map,this.fc=El.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function eh(t,e){const n=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ih.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=vh.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=oh.bind(null,e),e.sc.Wo=qu.bind(null,e.eventManager),e.sc.wc=Wu.bind(null,e.eventManager),e}(t);let r,i;const s=n.ic.get(e);if(s)r=s.targetId,n.sharedClientState.addLocalQueryTarget(r),i=s.view.ec();else{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((i=>i?(r=i,oo.resolve(r)):n.Cs.allocateTargetId(t).next((i=>(r=new vl(e,i,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Aa(e));n.isPrimaryClient&&hu(n.remoteStore,t);const s=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,i=await async function(t,e,n,r,i){t._c=(e,n,r)=>async function(t,e,n,r){let i=e.view.Wu(n);i.$i&&(i=await Wl(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,i))));const s=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(i,t.isPrimaryClient,s);return fh(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const s=await Wl(t.localStore,e,!0),o=new Ju(e,s.Hi),a=o.Wu(s.documents),c=Oc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,i),l=o.applyChanges(a,t.isPrimaryClient,c);fh(t,n,l.Xu);const u=new Xu(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,r,"current"===s,t.resumeToken)}return i}async function nh(t,e){const n=Ls(t),r=n.ic.get(e),i=n.rc.get(r.targetId);if(i.length>1)return n.rc.set(r.targetId,i.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await ql(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),du(n.remoteStore,r.targetId),hh(n,r.targetId)})).catch(so)):(hh(n,r.targetId),await ql(n.localStore,r.targetId,!0))}async function rh(t,e,n){const r=function(t){const e=Ls(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ah.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=ch.bind(null,e),e}(t);try{const t=await function(t,e){const n=Ls(t),r=Ks.now(),i=e.reduce(((t,e)=>t.add(e.key)),Rc());let s,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=bc(),c=Rc();return n.Gi.getEntries(t,i).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((i=>{s=i;const o=[];for(const t of e){const e=sc(t,s.get(t.key).overlayedDocument);null!=e&&o.push(new cc(t.key,e,pa(e.value.mapValue),Za.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(s,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:Ec(s)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new aa(qs)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await mh(r,t.changes),await Tu(r.remoteStore)}catch(t){const e=Uu(t,"Failed to persist write");n.reject(e)}}async function ih(t,e){const n=Ls(t);try{const t=await $l(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Ns(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Ns(r.nc):t.removedDocuments.size>0&&(Ns(r.nc),r.nc=!1))})),await mh(n,t,e)}catch(t){await so(t)}}function sh(t,e,n){const r=Ls(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const i=r.view.bu(e);i.snapshot&&t.push(i.snapshot)})),function(t,e){const n=Ls(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Ku(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function oh(t,e,n){const r=Ls(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.cc.get(e),s=i&&i.key;if(s){let t=new aa(Zs.comparator);t=t.insert(s,ga.newNoDocument(s,Gs.min()));const n=Rc().add(s),i=new Dc(Gs.min(),new Map,new ua(qs),t,n);await ih(r,i),r.uc=r.uc.remove(s),r.cc.delete(e),gh(r)}else await ql(r.localStore,e,!1).then((()=>hh(r,e,n))).catch(so)}async function ah(t,e){const n=Ls(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),i=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const i=n.batch,s=i.keys();let o=oo.resolve();return s.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const s=n.docVersions.get(t);Ns(null!==s),e.version.compareTo(s)<0&&(i.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,i)))}(n,t,e,i).next((()=>i.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Rc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);uh(n,r,null),lh(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await mh(n,t)}catch(t){await so(t)}}async function ch(t,e,n){const r=Ls(t);try{const t=await function(t,e){const n=Ls(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Ns(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);uh(r,e,n),lh(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await mh(r,t)}catch(n){await so(n)}}function lh(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function uh(t,e,n){const r=Ls(t);let i=r.hc[r.currentUser.toKey()];if(i){const t=i.get(e);t&&(n?t.reject(n):t.resolve(),i=i.remove(e)),r.hc[r.currentUser.toKey()]=i}}function hh(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||dh(t,e)}))}function dh(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(du(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),gh(t))}function fh(t,e,n){for(const r of n)r instanceof Qu?(t.ac.addReference(r.key,e),ph(t,r)):r instanceof Yu?(Is("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||dh(t,r.key)):Rs()}function ph(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Is("SyncEngine","New document in limbo: "+n),t.oc.add(r),gh(t))}function gh(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 Zs(Ys.fromString(e)),r=t.fc.next();t.cc.set(r,new Zu(n)),t.uc=t.uc.insert(n,r),hu(t.remoteStore,new vl(Aa(Sa(n.path)),r,2,co.at))}}async function mh(t,e,n){const r=Ls(t),i=[],s=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){i.push(t);const e=Fl.Ci(a.targetId,t);s.push(e)}})))})),await Promise.all(o),r.sc.Wo(i),await async function(t,e){const n=Ls(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>oo.forEach(e,(e=>oo.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>oo.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!ao(t))throw t;Is("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,i=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,i)}}}(r.localStore,s))}async function yh(t,e){const n=Ls(t);if(!n.currentUser.isEqual(e)){Is("SyncEngine","User change. New user:",e.toKey());const t=await Vl(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Os(Ds.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await mh(n,t.ji)}}function vh(t,e){const n=Ls(t),r=n.cc.get(e);if(r&&r.nc)return Rc().add(r.key);{let t=Rc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class wh{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=eu(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new Bl(t,e,n,r)}(this.persistence,new zl,t.initialUser,this.yt)}yc(t){return new Pl(Ul.Bs,this.yt)}gc(t){return new Gl}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class bh{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=>sh(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=yh.bind(null,this.syncEngine),await async function(t,e){const n=Ls(t);e?(n._u.delete(2),await lu(n)):e||(n._u.add(2),await uu(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new Hu}createDatastore(t){const e=eu(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new Zl(r));var r;return function(t,e,n,r){return new ou(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,i=t=>sh(this.syncEngine,t,0),s=Yl.C()?new Yl:new Ql,new cu(e,n,r,i,s);var e,n,r,i,s}createSyncEngine(t,e){return function(t,e,n,r,i,s,o){const a=new th(t,e,n,r,i,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=Ls(t);Is("RemoteStore","RemoteStore shutting down."),e._u.add(5),await uu(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
|
|
1604
1686
|
/**
|
|
1605
1687
|
* @license
|
|
1606
1688
|
* Copyright 2017 Google LLC
|
|
@@ -1616,7 +1698,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1616
1698
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1617
1699
|
* See the License for the specific language governing permissions and
|
|
1618
1700
|
* limitations under the License.
|
|
1619
|
-
*/function
|
|
1701
|
+
*/function _h(t,e,n){if(!n)throw new Os(Ds.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function Sh(t){if(!Zs.isDocumentKey(t))throw new Os(Ds.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Eh(t){if(Zs.isDocumentKey(t))throw new Os(Ds.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Th(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"==typeof t)return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if("number"==typeof t||"boolean"==typeof t)return""+t;if("object"==typeof t){if(t instanceof Array)return"an array";{const e=function(t){return t.constructor?t.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return"function"==typeof t?"a function":Rs()}function Ih(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Os(Ds.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Th(t);throw new Os(Ds.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}
|
|
1620
1702
|
/**
|
|
1621
1703
|
* @license
|
|
1622
1704
|
* Copyright 2020 Google LLC
|
|
@@ -1632,7 +1714,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1632
1714
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1633
1715
|
* See the License for the specific language governing permissions and
|
|
1634
1716
|
* limitations under the License.
|
|
1635
|
-
*/const
|
|
1717
|
+
*/const kh=new Map;class Ch{constructor(t){var e;if(void 0===t.host){if(void 0!==t.ssl)throw new Os(Ds.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 Os(Ds.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=t.cacheSizeBytes}this.experimentalForceLongPolling=!!t.experimentalForceLongPolling,this.experimentalAutoDetectLongPolling=!!t.experimentalAutoDetectLongPolling,this.useFetchStreams=!!t.useFetchStreams,function(t,e,n,r){if(!0===e&&!0===r)throw new Os(Ds.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}}
|
|
1636
1718
|
/**
|
|
1637
1719
|
* @license
|
|
1638
1720
|
* Copyright 2020 Google LLC
|
|
@@ -1648,7 +1730,24 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1648
1730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1649
1731
|
* See the License for the specific language governing permissions and
|
|
1650
1732
|
* limitations under the License.
|
|
1651
|
-
*/class
|
|
1733
|
+
*/class Ah{constructor(t,e,n,r){this._authCredentials=t,this._appCheckCredentials=e,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Ch({}),this._settingsFrozen=!1}get app(){if(!this._app)throw new Os(Ds.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return void 0!==this._terminateTask}_setSettings(t){if(this._settingsFrozen)throw new Os(Ds.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 Ch(t),void 0!==t.credentials&&(this._authCredentials=function(t){if(!t)return new Ms;switch(t.type){case"gapi":const e=t.client;return new Bs(e,t.sessionIndex||"0",t.iamToken||null,t.authTokenFactory||null);case"provider":return t.client;default:throw new Os(Ds.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(t.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask||(this._terminateTask=this._terminate()),this._terminateTask}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(t){const e=kh.get(t);e&&(Is("ComponentProvider","Removing Datastore"),kh.delete(t),e.terminate())}(this),Promise.resolve()}}function Rh(t,e,n,r={}){var i;const s=(t=Ih(t,Ah))._getSettings();if("firestore.googleapis.com"!==s.host&&s.host!==e&&Cs("Host has been set in both settings() and useEmulator(), emulator host will be used"),t._setSettings(Object.assign(Object.assign({},s),{host:`${e}:${n}`,ssl:!1})),r.mockUserToken){let e,n;if("string"==typeof r.mockUserToken)e=r.mockUserToken,n=_s.MOCK_USER;else{e=
|
|
1734
|
+
/**
|
|
1735
|
+
* @license
|
|
1736
|
+
* Copyright 2021 Google LLC
|
|
1737
|
+
*
|
|
1738
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1739
|
+
* you may not use this file except in compliance with the License.
|
|
1740
|
+
* You may obtain a copy of the License at
|
|
1741
|
+
*
|
|
1742
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1743
|
+
*
|
|
1744
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1745
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1746
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1747
|
+
* See the License for the specific language governing permissions and
|
|
1748
|
+
* limitations under the License.
|
|
1749
|
+
*/
|
|
1750
|
+
function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=e||"demo-project",r=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},t);return[Zt(JSON.stringify({alg:"none",type:"JWT"})),Zt(JSON.stringify(s)),""].join(".")}
|
|
1652
1751
|
/**
|
|
1653
1752
|
* @license
|
|
1654
1753
|
* Copyright 2017 Google LLC
|
|
@@ -1664,7 +1763,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1664
1763
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1665
1764
|
* See the License for the specific language governing permissions and
|
|
1666
1765
|
* limitations under the License.
|
|
1667
|
-
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const
|
|
1766
|
+
*/(r.mockUserToken,null===(i=t._app)||void 0===i?void 0:i.options.projectId);const s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new Os(Ds.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new _s(s)}t._authCredentials=new Us(new Ps(e,n))}}
|
|
1668
1767
|
/**
|
|
1669
1768
|
* @license
|
|
1670
1769
|
* Copyright 2020 Google LLC
|
|
@@ -1680,7 +1779,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1680
1779
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1681
1780
|
* See the License for the specific language governing permissions and
|
|
1682
1781
|
* limitations under the License.
|
|
1683
|
-
*/class
|
|
1782
|
+
*/class Nh{constructor(t,e,n){this.converter=e,this._key=n,this.type="document",this.firestore=t}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Dh(this.firestore,this.converter,this._key.path.popLast())}withConverter(t){return new Nh(this.firestore,t,this._key)}}class Lh{constructor(t,e,n){this.converter=e,this._query=n,this.type="query",this.firestore=t}withConverter(t){return new Lh(this.firestore,t,this._query)}}class Dh extends Lh{constructor(t,e,n){super(t,e,Sa(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const t=this._path.popLast();return t.isEmpty()?null:new Nh(this.firestore,null,new Zs(t))}withConverter(t){return new Dh(this.firestore,t,this._path)}}function Oh(t,e,...n){if(t=ae(t),_h("collection","path",e),t instanceof Ah){const r=Ys.fromString(e,...n);return Eh(r),new Dh(t,null,r)}{if(!(t instanceof Nh||t instanceof Dh))throw new Os(Ds.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ys.fromString(e,...n));return Eh(r),new Dh(t.firestore,null,r)}}function xh(t,e,...n){if(t=ae(t),1===arguments.length&&(e=js.R()),_h("doc","path",e),t instanceof Ah){const r=Ys.fromString(e,...n);return Sh(r),new Nh(t,null,new Zs(r))}{if(!(t instanceof Nh||t instanceof Dh))throw new Os(Ds.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Ys.fromString(e,...n));return Sh(r),new Nh(t.firestore,t instanceof Dh?t.converter:null,new Zs(r))}}
|
|
1684
1783
|
/**
|
|
1685
1784
|
* @license
|
|
1686
1785
|
* Copyright 2020 Google LLC
|
|
@@ -1712,7 +1811,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1712
1811
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1713
1812
|
* See the License for the specific language governing permissions and
|
|
1714
1813
|
* limitations under the License.
|
|
1715
|
-
*/class
|
|
1814
|
+
*/class Ph{constructor(t){this.observer=t,this.muted=!1}next(t){this.observer.next&&this.Rc(this.observer.next,t)}error(t){this.observer.error?this.Rc(this.observer.error,t):ks("Uncaught Error in snapshot listener:",t.toString())}bc(){this.muted=!0}Rc(t,e){this.muted||setTimeout((()=>{this.muted||t(e)}),0)}}
|
|
1716
1815
|
/**
|
|
1717
1816
|
* @license
|
|
1718
1817
|
* Copyright 2017 Google LLC
|
|
@@ -1728,7 +1827,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1728
1827
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1729
1828
|
* See the License for the specific language governing permissions and
|
|
1730
1829
|
* limitations under the License.
|
|
1731
|
-
*/class
|
|
1830
|
+
*/class Mh{constructor(t,e,n,r){this.authCredentials=t,this.appCheckCredentials=e,this.asyncQueue=n,this.databaseInfo=r,this.user=_s.UNAUTHENTICATED,this.clientId=js.R(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this.authCredentials.start(n,(async t=>{Is("FirestoreClient","Received user=",t.uid),await this.authCredentialListener(t),this.user=t})),this.appCheckCredentials.start(n,(t=>(Is("FirestoreClient","Received new app check token=",t),this.appCheckCredentialListener(t,this.user))))}async getConfiguration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(t){this.authCredentialListener=t}setAppCheckTokenChangeListener(t){this.appCheckCredentialListener=t}verifyNotTerminated(){if(this.asyncQueue.isShuttingDown)throw new Os(Ds.FAILED_PRECONDITION,"The client has already been terminated.")}terminate(){this.asyncQueue.enterRestrictedMode();const t=new xs;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted((async()=>{try{this.onlineComponents&&await this.onlineComponents.terminate(),this.offlineComponents&&await this.offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),t.resolve()}catch(e){const n=Uu(e,"Failed to shutdown persistence");t.reject(n)}})),t.promise}}async function Uh(t,e){t.asyncQueue.verifyOperationInProgress();const n=await async function(t){return t.offlineComponents||(Is("FirestoreClient","Using default OfflineComponentProvider"),await async function(t,e){t.asyncQueue.verifyOperationInProgress(),Is("FirestoreClient","Initializing OfflineComponentProvider");const n=await t.getConfiguration();await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener((async t=>{r.isEqual(t)||(await Vl(e.localStore,t),r=t)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t.offlineComponents=e}(t,new wh)),t.offlineComponents}(t);Is("FirestoreClient","Initializing OnlineComponentProvider");const r=await t.getConfiguration();await e.initialize(n,r),t.setCredentialChangeListener((t=>Ou(e.remoteStore,t))),t.setAppCheckTokenChangeListener(((t,n)=>Ou(e.remoteStore,n))),t.onlineComponents=e}async function Fh(t){return t.onlineComponents||(Is("FirestoreClient","Using default OnlineComponentProvider"),await Uh(t,new bh)),t.onlineComponents}async function zh(t){const e=await Fh(t),n=e.eventManager;return n.onListen=eh.bind(null,e.syncEngine),n.onUnlisten=nh.bind(null,e.syncEngine),n}class Bh{constructor(){this.Bc=Promise.resolve(),this.Lc=[],this.qc=!1,this.Uc=[],this.Kc=null,this.Gc=!1,this.Qc=!1,this.jc=[],this.xo=new nu(this,"async_queue_retry"),this.Wc=()=>{const t=tu();t&&Is("AsyncQueue","Visibility state changed to "+t.visibilityState),this.xo.Po()};const t=tu();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.Wc)}get isShuttingDown(){return this.qc}enqueueAndForget(t){this.enqueue(t)}enqueueAndForgetEvenWhileRestricted(t){this.zc(),this.Hc(t)}enterRestrictedMode(t){if(!this.qc){this.qc=!0,this.Qc=t||!1;const e=tu();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("visibilitychange",this.Wc)}}enqueue(t){if(this.zc(),this.qc)return new Promise((()=>{}));const e=new xs;return this.Hc((()=>this.qc&&this.Qc?Promise.resolve():(t().then(e.resolve,e.reject),e.promise))).then((()=>e.promise))}enqueueRetryable(t){this.enqueueAndForget((()=>(this.Lc.push(t),this.Jc())))}async Jc(){if(0!==this.Lc.length){try{await this.Lc[0](),this.Lc.shift(),this.xo.reset()}catch(t){if(!ao(t))throw t;Is("AsyncQueue","Operation failed with retryable error: "+t)}this.Lc.length>0&&this.xo.Ro((()=>this.Jc()))}}Hc(t){const e=this.Bc.then((()=>(this.Gc=!0,t().catch((t=>{this.Kc=t,this.Gc=!1;const e=function(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+"\n"+t.stack),e}
|
|
1732
1831
|
/**
|
|
1733
1832
|
* @license
|
|
1734
1833
|
* Copyright 2017 Google LLC
|
|
@@ -1744,7 +1843,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1744
1843
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1745
1844
|
* See the License for the specific language governing permissions and
|
|
1746
1845
|
* limitations under the License.
|
|
1747
|
-
*/(t);throw
|
|
1846
|
+
*/(t);throw ks("INTERNAL UNHANDLED ERROR: ",e),t})).then((t=>(this.Gc=!1,t))))));return this.Bc=e,e}enqueueAfterDelay(t,e,n){this.zc(),this.jc.indexOf(t)>-1&&(e=0);const r=Mu.createAndSchedule(this,t,e,n,(t=>this.Yc(t)));return this.Uc.push(r),r}zc(){this.Kc&&Rs()}verifyOperationInProgress(){}async Xc(){let t;do{t=this.Bc,await t}while(t!==this.Bc)}Zc(t){for(const e of this.Uc)if(e.timerId===t)return!0;return!1}ta(t){return this.Xc().then((()=>{this.Uc.sort(((t,e)=>t.targetTimeMs-e.targetTimeMs));for(const e of this.Uc)if(e.skipDelay(),"all"!==t&&e.timerId===t)break;return this.Xc()}))}ea(t){this.jc.push(t)}Yc(t){const e=this.Uc.indexOf(t);this.Uc.splice(e,1)}}function Vh(t){return function(t,e){if("object"!=typeof t||null===t)return!1;const n=t;for(const t of["next","error","complete"])if(t in n&&"function"==typeof n[t])return!0;return!1}
|
|
1748
1847
|
/**
|
|
1749
1848
|
* @license
|
|
1750
1849
|
* Copyright 2020 Google LLC
|
|
@@ -1760,7 +1859,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1760
1859
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1761
1860
|
* See the License for the specific language governing permissions and
|
|
1762
1861
|
* limitations under the License.
|
|
1763
|
-
*/(t)}class
|
|
1862
|
+
*/(t)}class Hh extends Ah{constructor(t,e,n,r){super(t,e,n,r),this.type="firestore",this._queue=new Bh,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}_terminate(){return this._firestoreClient||jh(this),this._firestoreClient.terminate()}}function $h(t){return t._firestoreClient||jh(t),t._firestoreClient.verifyNotTerminated(),t._firestoreClient}function jh(t){var e;const n=t._freezeSettings(),r=function(t,e,n,r){return new lo(t,e,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,r.useFetchStreams)}
|
|
1764
1863
|
/**
|
|
1765
1864
|
* @license
|
|
1766
1865
|
* Copyright 2020 Google LLC
|
|
@@ -1776,7 +1875,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1776
1875
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1777
1876
|
* See the License for the specific language governing permissions and
|
|
1778
1877
|
* limitations under the License.
|
|
1779
|
-
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new
|
|
1878
|
+
*/(t._databaseId,(null===(e=t._app)||void 0===e?void 0:e.options.appId)||"",t._persistenceKey,n);t._firestoreClient=new Mh(t._authCredentials,t._appCheckCredentials,t._queue,r)}
|
|
1780
1879
|
/**
|
|
1781
1880
|
* @license
|
|
1782
1881
|
* Copyright 2020 Google LLC
|
|
@@ -1808,7 +1907,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1808
1907
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1809
1908
|
* See the License for the specific language governing permissions and
|
|
1810
1909
|
* limitations under the License.
|
|
1811
|
-
*/class
|
|
1910
|
+
*/class qh{constructor(t){this._byteString=t}static fromBase64String(t){try{return new qh(yo.fromBase64String(t))}catch(t){throw new Os(Ds.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new qh(yo.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
|
|
1812
1911
|
/**
|
|
1813
1912
|
* @license
|
|
1814
1913
|
* Copyright 2020 Google LLC
|
|
@@ -1824,7 +1923,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1824
1923
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1825
1924
|
* See the License for the specific language governing permissions and
|
|
1826
1925
|
* limitations under the License.
|
|
1827
|
-
*/class
|
|
1926
|
+
*/class Wh{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Os(Ds.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Xs(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
|
|
1828
1927
|
/**
|
|
1829
1928
|
* @license
|
|
1830
1929
|
* Copyright 2020 Google LLC
|
|
@@ -1841,7 +1940,7 @@ class Ya{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
|
|
|
1841
1940
|
* See the License for the specific language governing permissions and
|
|
1842
1941
|
* limitations under the License.
|
|
1843
1942
|
*/
|
|
1844
|
-
class
|
|
1943
|
+
class Kh{constructor(t){this._methodName=t}}
|
|
1845
1944
|
/**
|
|
1846
1945
|
* @license
|
|
1847
1946
|
* Copyright 2017 Google LLC
|
|
@@ -1857,7 +1956,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1857
1956
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1858
1957
|
* See the License for the specific language governing permissions and
|
|
1859
1958
|
* limitations under the License.
|
|
1860
|
-
*/class
|
|
1959
|
+
*/class Gh{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Os(Ds.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Os(Ds.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return qs(this._lat,t._lat)||qs(this._long,t._long)}}
|
|
1861
1960
|
/**
|
|
1862
1961
|
* @license
|
|
1863
1962
|
* Copyright 2017 Google LLC
|
|
@@ -1873,7 +1972,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1873
1972
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1874
1973
|
* See the License for the specific language governing permissions and
|
|
1875
1974
|
* limitations under the License.
|
|
1876
|
-
*/const
|
|
1975
|
+
*/const Qh=/^__.*__$/;class Yh{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new cc(t,this.data,this.fieldMask,e,this.fieldTransforms):new ac(t,this.data,e,this.fieldTransforms)}}function Jh(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Rs()}}class Xh{constructor(t,e,n,r,i,s){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===i&&this.na(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new Xh(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return ld(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(Jh(this.sa)&&Qh.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class Zh{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||eu(t)}da(t,e,n,r=!1){return new Xh({sa:t,methodName:e,fa:n,path:Xs.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function td(t){const e=t._freezeSettings(),n=eu(t._databaseId);return new Zh(t._databaseId,!!e.ignoreUndefinedProperties,n)}function ed(t,e,n,r,i,s={}){const o=t.da(s.merge||s.mergeFields?2:0,e,n,i);sd("Data must be an object, but it was:",o,r);const a=rd(r,o);let c,l;if(s.merge)c=new da(o.fieldMask),l=o.fieldTransforms;else if(s.mergeFields){const t=[];for(const r of s.mergeFields){const i=od(e,r,n);if(!o.contains(i))throw new Os(Ds.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);ud(t,i)||t.push(i)}c=new da(t),l=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,l=o.fieldTransforms;return new Yh(new fa(a),c,l)}function nd(t,e){if(id(t=ae(t)))return sd("Unsupported field value:",e,t),rd(t,e);if(t instanceof Kh)return function(t,e){if(!Jh(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const i of t){let t=nd(i,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ae(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return za(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Ks.fromDate(t);return{timestampValue:qc(e.yt,n)}}if(t instanceof Ks){const n=new Ks(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:qc(e.yt,n)}}if(t instanceof Gh)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof qh)return{bytesValue:Wc(e.yt,t._byteString)};if(t instanceof Nh){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Qc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Th(t)}`)}(t,e)}function rd(t,e){const n={};return po(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):fo(t,((t,r)=>{const i=nd(r,e.ra(t));null!=i&&(n[t]=i)})),{mapValue:{fields:n}}}function id(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Ks||t instanceof Gh||t instanceof qh||t instanceof Nh||t instanceof Kh)}function sd(t,e,n){if(!id(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Th(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function od(t,e,n){if((e=ae(e))instanceof Wh)return e._internalPath;if("string"==typeof e)return cd(t,e);throw ld("Field path arguments must be of type string or ",t,!1,void 0,n)}const ad=new RegExp("[~\\*/\\[\\]]");function cd(t,e,n){if(e.search(ad)>=0)throw ld(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Wh(...e.split("."))._internalPath}catch(r){throw ld(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function ld(t,e,n,r,i){const s=r&&!r.isEmpty(),o=void 0!==i;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(s||o)&&(c+=" (found",s&&(c+=` in field ${r}`),o&&(c+=` in document ${i}`),c+=")"),new Os(Ds.INVALID_ARGUMENT,a+t+c)}function ud(t,e){return t.some((t=>t.isEqual(e)))}
|
|
1877
1976
|
/**
|
|
1878
1977
|
* @license
|
|
1879
1978
|
* Copyright 2020 Google LLC
|
|
@@ -1889,7 +1988,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1889
1988
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1890
1989
|
* See the License for the specific language governing permissions and
|
|
1891
1990
|
* limitations under the License.
|
|
1892
|
-
*/
|
|
1991
|
+
*/class hd{constructor(t,e,n,r,i){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new Nh(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new dd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(fd("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class dd extends hd{data(){return super.data()}}function fd(t,e){return"string"==typeof e?cd(t,e):e instanceof Wh?e._internalPath:e._delegate._internalPath}
|
|
1893
1992
|
/**
|
|
1894
1993
|
* @license
|
|
1895
1994
|
* Copyright 2020 Google LLC
|
|
@@ -1905,7 +2004,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1905
2004
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1906
2005
|
* See the License for the specific language governing permissions and
|
|
1907
2006
|
* limitations under the License.
|
|
1908
|
-
*/function
|
|
2007
|
+
*/function pd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Os(Ds.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class gd{}class md extends gd{}function yd(t,e,...n){let r=[];e instanceof gd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof bd)).length,n=t.filter((t=>t instanceof vd)).length;if(e>1||e>0&&n>0)throw new Os(Ds.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(...)))`.")}
|
|
1909
2008
|
/**
|
|
1910
2009
|
* @license
|
|
1911
2010
|
* Copyright 2020 Google LLC
|
|
@@ -1921,7 +2020,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1921
2020
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1922
2021
|
* See the License for the specific language governing permissions and
|
|
1923
2022
|
* limitations under the License.
|
|
1924
|
-
*/(r);for(const e of r)t=e._apply(t);return t}class
|
|
2023
|
+
*/(r);for(const e of r)t=e._apply(t);return t}class vd extends md{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new vd(t,e,n)}_apply(t){const e=this._parse(t);return Ed(t._query,e),new Lh(t.firestore,t.converter,Ra(t._query,e))}_parse(t){const e=td(t.firestore),n=function(t,e,n,r,i,s,o){let a;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new Os(Ds.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){Sd(o,s);const e=[];for(const n of o)e.push(_d(r,t,n));a={arrayValue:{values:e}}}else a=_d(r,t,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||Sd(o,s),a=function(t,e,n,r=!1){return nd(n,t.da(r?4:3,e))}(n,"where",o,"in"===s||"not-in"===s);return jo.create(i,s,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function wd(t,e,n){const r=e,i=fd("where",t);return vd._create(i,r,n)}class bd extends gd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new bd(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:qo.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Ed(n,t),n=Ra(n,t)}(t._query,e),new Lh(t.firestore,t.converter,Ra(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function _d(t,e,n){if("string"==typeof(n=ae(n))){if(""===n)throw new Os(Ds.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ka(e)&&-1!==n.indexOf("/"))throw new Os(Ds.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Ys.fromString(n));if(!Zs.isDocumentKey(r))throw new Os(Ds.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Oo(t,new Zs(r))}if(n instanceof Nh)return Oo(t,n._key);throw new Os(Ds.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Th(n)}.`)}function Sd(t,e){if(!Array.isArray(t)||0===t.length)throw new Os(Ds.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Os(Ds.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Ed(t,e){if(e.isInequality()){const n=Ia(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Os(Ds.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const i=Ta(t);null!==i&&function(t,e,n){if(!n.isEqual(e))throw new Os(Ds.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,i)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Os(Ds.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Os(Ds.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Td{convertValue(t,e="none"){switch(ko(t)){case 0:return null;case 1:return t.booleanValue;case 2:return bo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(_o(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Rs()}}convertObject(t,e){const n={};return fo(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Gh(bo(t.latitude),bo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=Eo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(To(t));default:return null}}convertTimestamp(t){const e=wo(t);return new Ks(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Ys.fromString(t);Ns(pl(n));const r=new uo(n.get(1),n.get(3)),i=new Zs(n.popFirst(5));return r.isEqual(e)||ks(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),i}}
|
|
1925
2024
|
/**
|
|
1926
2025
|
* @license
|
|
1927
2026
|
* Copyright 2020 Google LLC
|
|
@@ -1937,7 +2036,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1937
2036
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1938
2037
|
* See the License for the specific language governing permissions and
|
|
1939
2038
|
* limitations under the License.
|
|
1940
|
-
*/
|
|
2039
|
+
*/
|
|
1941
2040
|
/**
|
|
1942
2041
|
* @license
|
|
1943
2042
|
* Copyright 2020 Google LLC
|
|
@@ -1953,7 +2052,8 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1953
2052
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1954
2053
|
* See the License for the specific language governing permissions and
|
|
1955
2054
|
* limitations under the License.
|
|
1956
|
-
*/
|
|
2055
|
+
*/
|
|
2056
|
+
class Id{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class kd extends hd{constructor(t,e,n,r,i,s){super(t,e,n,r,s),this._firestore=t,this._firestoreImpl=t,this.metadata=i}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Cd(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(fd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Cd extends kd{data(t={}){return super.data(t)}}class Ad{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Id(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Cd(this._firestore,this._userDataWriter,n.key,n,new Id(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 Os(Ds.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Cd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Id(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Cd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Id(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let i=-1,s=-1;return 0!==e.type&&(i=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:Rd(e.type),doc:r,oldIndex:i,newIndex:s}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Rd(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Rs()}}
|
|
1957
2057
|
/**
|
|
1958
2058
|
* @license
|
|
1959
2059
|
* Copyright 2020 Google LLC
|
|
@@ -1969,8 +2069,7 @@ class eh{constructor(t){this._methodName=t}}
|
|
|
1969
2069
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1970
2070
|
* See the License for the specific language governing permissions and
|
|
1971
2071
|
* limitations under the License.
|
|
1972
|
-
*/
|
|
1973
|
-
zt("firebase","9.15.0","app");class Ph{constructor(){}static getInstance(){return Ph.instance||(Ph.instance=new Ph),Ph.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Uh.firebase:Mh.firebase}get api(){return"prod"===this.env?Uh.api:Mh.api}get config(){return"prod"===this.env?Uh.config:Mh.config}}const Mh={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Uh={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};function zh(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function Fh(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}const Bh=Fh,Vh=new g("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."}),Hh="auth/user-disabled",jh=new x("@firebase/auth");function qh(t,...e){jh.logLevel<=R.ERROR&&jh.error(`Auth (${Pt}): ${t}`,...e)}
|
|
2072
|
+
*/function Nd(t){t=Ih(t,Nh);const e=Ih(t.firestore,Hh);return function(t,e,n={}){const r=new xs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Ph({next:s=>{e.enqueueAndForget((()=>ju(t,o)));const a=s.docs.has(n);!a&&s.fromCache?i.reject(new Os(Ds.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&s.fromCache&&r&&"server"===r.source?i.reject(new Os(Ds.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.)')):i.resolve(s)},error:t=>i.reject(t)}),o=new Gu(Sa(n.path),s,{includeMetadataChanges:!0,Nu:!0});return $u(t,o)}(await zh(t),t.asyncQueue,e,n,r))),r.promise}($h(e),t._key).then((n=>Pd(e,t,n)))}class Ld extends Td{constructor(t){super(),this.firestore=t}convertBytes(t){return new qh(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Nh(this.firestore,null,e)}}function Dd(t){t=Ih(t,Lh);const e=Ih(t.firestore,Hh),n=$h(e),r=new Ld(e);return pd(t._query),function(t,e,n={}){const r=new xs;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,i){const s=new Ph({next:n=>{e.enqueueAndForget((()=>ju(t,o))),n.fromCache&&"server"===r.source?i.reject(new Os(Ds.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.)')):i.resolve(n)},error:t=>i.reject(t)}),o=new Gu(n,s,{includeMetadataChanges:!0,Nu:!0});return $u(t,o)}(await zh(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Ad(e,r,t,n)))}function Od(t,e,n){t=Ih(t,Nh);const r=Ih(t.firestore,Hh),i=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new xs;return t.asyncQueue.enqueueAndForget((async()=>rh(await function(t){return Fh(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}($h(t),e)}(r,[ed(td(r),"setDoc",t._key,i,null!==t.converter,n).toMutation(t._key,Za.none())])}function xd(t,...e){var n,r,i;t=ae(t);let s={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||Vh(e[o])||(s=e[o],o++);const a={includeMetadataChanges:s.includeMetadataChanges};if(Vh(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(i=t.complete)||void 0===i?void 0:i.bind(t)}let c,l,u;if(t instanceof Nh)l=Ih(t.firestore,Hh),u=Sa(t._key.path),c={next:n=>{e[o]&&e[o](Pd(l,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Ih(t,Lh);l=Ih(n.firestore,Hh),u=n._query;const r=new Ld(l);c={next:t=>{e[o]&&e[o](new Ad(l,r,n,t))},error:e[o+1],complete:e[o+2]},pd(t._query)}return function(t,e,n,r){const i=new Ph(r),s=new Gu(e,i,n);return t.asyncQueue.enqueueAndForget((async()=>$u(await zh(t),s))),()=>{i.bc(),t.asyncQueue.enqueueAndForget((async()=>ju(await zh(t),s)))}}($h(l),u,a,c)}function Pd(t,e,n){const r=n.docs.get(e._key),i=new Ld(t);return new kd(t,i,e._key,r,new Id(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ss=Pt,Lt(new ce("firestore",((t,{instanceIdentifier:n,options:r})=>{const i=t.getProvider("app").getImmediate(),s=new Hh(new Fs(t.getProvider("auth-internal")),new Hs(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Os(Ds.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new uo(t.options.projectId,e)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s}),"PUBLIC").setMultipleInstances(!0)),Ft(bs,"3.8.0",t),Ft(bs,"3.8.0","esm2017")}();
|
|
1974
2073
|
/**
|
|
1975
2074
|
* @license
|
|
1976
2075
|
* Copyright 2020 Google LLC
|
|
@@ -1986,7 +2085,8 @@ zt("firebase","9.15.0","app");class Ph{constructor(){}static getInstance(){retur
|
|
|
1986
2085
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1987
2086
|
* See the License for the specific language governing permissions and
|
|
1988
2087
|
* limitations under the License.
|
|
1989
|
-
*/
|
|
2088
|
+
*/
|
|
2089
|
+
Ft("firebase","9.23.0","app");class Md{constructor(){}static getInstance(){return Md.instance||(Md.instance=new Md),Md.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Fd.firebase:Ud.firebase}get api(){return"prod"===this.env?Fd.api:Ud.api}get config(){return"prod"===this.env?Fd.config:Ud.config}}const Ud={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Fd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var zd=1e3,Bd=6e4,Vd=36e5,Hd="millisecond",$d="second",jd="minute",qd="hour",Wd="day",Kd="week",Gd="month",Qd="quarter",Yd="year",Jd="date",Xd="Invalid Date",Zd=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,tf=/\[([^\]]+)]|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,ef={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},nf=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},rf={s:nf,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+nf(r,2,"0")+":"+nf(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,Gd),s=n-i<0,o=e.clone().add(r+(s?-1:1),Gd);return+(-(r+(n-i)/(s?i-o:o-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Gd,y:Yd,w:Kd,d:Wd,D:Jd,h:qd,m:jd,s:$d,ms:Hd,Q:Qd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},sf="en",of={};of[sf]=ef;var af="$isDayjsObject",cf=function(t){return t instanceof df||!(!t||!t[af])},lf=function t(e,n,r){var i;if(!e)return sf;if("string"==typeof e){var s=e.toLowerCase();of[s]&&(i=s),n&&(of[s]=n,i=s);var o=e.split("-");if(!i&&o.length>1)return t(o[0])}else{var a=e.name;of[a]=e,i=a}return!r&&i&&(sf=i),i||!r&&sf},uf=function(t,e){if(cf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new df(n)},hf=rf;hf.l=lf,hf.i=cf,hf.w=function(t,e){return uf(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var df=function(){function t(t){this.$L=lf(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[af]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(hf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(Zd);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return hf},e.isValid=function(){return!(this.$d.toString()===Xd)},e.isSame=function(t,e){var n=uf(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return uf(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<uf(t)},e.$g=function(t,e,n){return hf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!hf.u(e)||e,i=hf.p(t),s=function(t,e){var i=hf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(Wd)},o=function(t,e){return hf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,l=this.$D,u="set"+(this.$u?"UTC":"");switch(i){case Yd:return r?s(1,0):s(31,11);case Gd:return r?s(1,c):s(0,c+1);case Kd:var h=this.$locale().weekStart||0,d=(a<h?a+7:a)-h;return s(r?l-d:l+(6-d),c);case Wd:case Jd:return o(u+"Hours",0);case qd:return o(u+"Minutes",1);case jd:return o(u+"Seconds",2);case $d:return o(u+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=hf.p(t),i="set"+(this.$u?"UTC":""),s=(n={},n[Wd]=i+"Date",n[Jd]=i+"Date",n[Gd]=i+"Month",n[Yd]=i+"FullYear",n[qd]=i+"Hours",n[jd]=i+"Minutes",n[$d]=i+"Seconds",n[Hd]=i+"Milliseconds",n)[r],o=r===Wd?this.$D+(e-this.$W):e;if(r===Gd||r===Yd){var a=this.clone().set(Jd,1);a.$d[s](o),a.init(),this.$d=a.set(Jd,Math.min(this.$D,a.daysInMonth())).$d}else s&&this.$d[s](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[hf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var i=hf.p(e),s=function(e){var n=uf(r);return hf.w(n.date(n.date()+Math.round(e*t)),r)};if(i===Gd)return this.set(Gd,this.$M+t);if(i===Yd)return this.set(Yd,this.$y+t);if(i===Wd)return s(1);if(i===Kd)return s(7);var o=(n={},n[jd]=Bd,n[qd]=Vd,n[$d]=zd,n)[i]||1,a=this.$d.getTime()+t*o;return hf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||Xd;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=hf.z(this),s=this.$H,o=this.$m,a=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].slice(0,s)},d=function(t){return hf.s(s%12||12,t,"0")},f=u||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(tf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return hf.s(e.$y,4,"0");case"M":return a+1;case"MM":return hf.s(a+1,2,"0");case"MMM":return h(n.monthsShort,a,l,3);case"MMMM":return h(l,a);case"D":return e.$D;case"DD":return hf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return h(n.weekdaysMin,e.$W,c,2);case"ddd":return h(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(s);case"HH":return hf.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 hf.s(o,2,"0");case"s":return String(e.$s);case"ss":return hf.s(e.$s,2,"0");case"SSS":return hf.s(e.$ms,3,"0");case"Z":return i}return null}(t)||i.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,i=this,s=hf.p(e),o=uf(t),a=(o.utcOffset()-this.utcOffset())*Bd,c=this-o,l=function(){return hf.m(i,o)};switch(s){case Yd:r=l()/12;break;case Gd:r=l();break;case Qd:r=l()/3;break;case Kd:r=(c-a)/6048e5;break;case Wd:r=(c-a)/864e5;break;case qd:r=c/Vd;break;case jd:r=c/Bd;break;case $d:r=c/zd;break;default:r=c}return n?r:hf.a(r)},e.daysInMonth=function(){return this.endOf(Gd).$D},e.$locale=function(){return of[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=lf(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return hf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),ff=df.prototype;function pf(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n}function gf(){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."}}uf.prototype=ff,[["$ms",Hd],["$s",$d],["$m",jd],["$H",qd],["$W",Wd],["$M",Gd],["$y",Yd],["$D",Jd]].forEach((function(t){ff[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),uf.extend=function(t,e){return t.$i||(t(e,df,uf),t.$i=!0),uf},uf.locale=lf,uf.isDayjs=cf,uf.unix=function(t){return uf(1e3*t)},uf.en=of[sf],uf.Ls=of,uf.p={},"function"==typeof SuppressedError&&SuppressedError;const mf=gf,yf=new g("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."}),vf="auth/user-disabled",wf=new x("@firebase/auth");function bf(t,...e){wf.logLevel<=R.ERROR&&wf.error(`Auth (${Pt}): ${t}`,...e)}
|
|
1990
2090
|
/**
|
|
1991
2091
|
* @license
|
|
1992
2092
|
* Copyright 2020 Google LLC
|
|
@@ -2002,7 +2102,7 @@ zt("firebase","9.15.0","app");class Ph{constructor(){}static getInstance(){retur
|
|
|
2002
2102
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2003
2103
|
* See the License for the specific language governing permissions and
|
|
2004
2104
|
* limitations under the License.
|
|
2005
|
-
*/
|
|
2105
|
+
*/function _f(t,...e){throw Ef(t,...e)}function Sf(t,...e){return Ef(t,...e)}function Ef(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return yf.create(t,...e)}function Tf(t,e,...n){if(!t)throw Ef(e,...n)}function If(t){const e="INTERNAL ASSERTION FAILED: "+t;throw bf(e),new Error(e)}function kf(t,e){t||If(e)}
|
|
2006
2106
|
/**
|
|
2007
2107
|
* @license
|
|
2008
2108
|
* Copyright 2020 Google LLC
|
|
@@ -2018,7 +2118,7 @@ zt("firebase","9.15.0","app");class Ph{constructor(){}static getInstance(){retur
|
|
|
2018
2118
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2019
2119
|
* See the License for the specific language governing permissions and
|
|
2020
2120
|
* limitations under the License.
|
|
2021
|
-
*/
|
|
2121
|
+
*/function Cf(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Af(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
|
|
2022
2122
|
/**
|
|
2023
2123
|
* @license
|
|
2024
2124
|
* Copyright 2020 Google LLC
|
|
@@ -2034,8 +2134,7 @@ zt("firebase","9.15.0","app");class Ph{constructor(){}static getInstance(){retur
|
|
|
2034
2134
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2035
2135
|
* See the License for the specific language governing permissions and
|
|
2036
2136
|
* limitations under the License.
|
|
2037
|
-
*/
|
|
2038
|
-
function Zh(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function td(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
|
|
2137
|
+
*/function Rf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Af()&&"https:"!==Af()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
|
|
2039
2138
|
/**
|
|
2040
2139
|
* @license
|
|
2041
2140
|
* Copyright 2020 Google LLC
|
|
@@ -2051,7 +2150,8 @@ function Zh(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||v
|
|
|
2051
2150
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2052
2151
|
* See the License for the specific language governing permissions and
|
|
2053
2152
|
* limitations under the License.
|
|
2054
|
-
*/
|
|
2153
|
+
*/
|
|
2154
|
+
class Nf{constructor(t,e){this.shortDelay=t,this.longDelay=e,kf(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Rf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
|
|
2055
2155
|
/**
|
|
2056
2156
|
* @license
|
|
2057
2157
|
* Copyright 2020 Google LLC
|
|
@@ -2067,8 +2167,7 @@ function Zh(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||v
|
|
|
2067
2167
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2068
2168
|
* See the License for the specific language governing permissions and
|
|
2069
2169
|
* limitations under the License.
|
|
2070
|
-
*/
|
|
2071
|
-
class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(a())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return ed()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
|
|
2170
|
+
*/function Lf(t,e){kf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
|
|
2072
2171
|
/**
|
|
2073
2172
|
* @license
|
|
2074
2173
|
* Copyright 2020 Google LLC
|
|
@@ -2084,7 +2183,7 @@ class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay
|
|
|
2084
2183
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2085
2184
|
* See the License for the specific language governing permissions and
|
|
2086
2185
|
* limitations under the License.
|
|
2087
|
-
*/
|
|
2186
|
+
*/class Df{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void If("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void If("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void If("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
|
|
2088
2187
|
/**
|
|
2089
2188
|
* @license
|
|
2090
2189
|
* Copyright 2020 Google LLC
|
|
@@ -2100,7 +2199,7 @@ class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay
|
|
|
2100
2199
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2101
2200
|
* See the License for the specific language governing permissions and
|
|
2102
2201
|
* limitations under the License.
|
|
2103
|
-
*/
|
|
2202
|
+
*/const Of={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",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"},xf=new Nf(3e4,6e4);
|
|
2104
2203
|
/**
|
|
2105
2204
|
* @license
|
|
2106
2205
|
* Copyright 2020 Google LLC
|
|
@@ -2116,7 +2215,7 @@ class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay
|
|
|
2116
2215
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2117
2216
|
* See the License for the specific language governing permissions and
|
|
2118
2217
|
* limitations under the License.
|
|
2119
|
-
*/const
|
|
2218
|
+
*/function Pf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Mf(t,e,n,r,i={}){return Uf(t,i,(async()=>{let i={},s={};r&&("GET"===e?s=r:i={body:JSON.stringify(r)});const o=w(Object.assign({key:t.config.apiKey},s)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Df.fetch()(zf(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Uf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Of),e);try{const e=new Bf(t),i=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Vf(t,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const e=i.ok?s.errorMessage:s.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Vf(t,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Vf(t,"email-already-in-use",s);if("USER_DISABLED"===n)throw Vf(t,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(t,e,n){const r=Object.assign(Object.assign({},mf()),{[e]:n});return new g("auth","Firebase",r).create(e,{appName:t.name})}(t,a,o);_f(t,a)}}catch(e){if(e instanceof p)throw e;_f(t,"network-request-failed",{message:String(e)})}}async function Ff(t,e,n,r,i={}){const s=await Mf(t,e,n,r,i);return"mfaPendingCredential"in s&&_f(t,"multi-factor-auth-required",{_serverResponse:s}),s}function zf(t,e,n,r){const i=`${e}${n}?${r}`;return t.config.emulator?Lf(t.config,i):`${t.config.apiScheme}://${i}`}class Bf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(Sf(this.auth,"network-request-failed"))),xf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Vf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Sf(t,e,r);return i.customData._tokenResponse=n,i}
|
|
2120
2219
|
/**
|
|
2121
2220
|
* @license
|
|
2122
2221
|
* Copyright 2020 Google LLC
|
|
@@ -2132,7 +2231,7 @@ class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay
|
|
|
2132
2231
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2133
2232
|
* See the License for the specific language governing permissions and
|
|
2134
2233
|
* limitations under the License.
|
|
2135
|
-
*/
|
|
2234
|
+
*/
|
|
2136
2235
|
/**
|
|
2137
2236
|
* @license
|
|
2138
2237
|
* Copyright 2020 Google LLC
|
|
@@ -2149,6 +2248,7 @@ class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay
|
|
|
2149
2248
|
* See the License for the specific language governing permissions and
|
|
2150
2249
|
* limitations under the License.
|
|
2151
2250
|
*/
|
|
2251
|
+
function Hf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function $f(t){return 1e3*Number(t)}function jf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return bf("JWT malformed, contained fewer than 3 sections"),null;try{const t=a(n);return t?JSON.parse(t):(bf("Failed to decode base64 JWT payload"),null)}catch(t){return bf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}
|
|
2152
2252
|
/**
|
|
2153
2253
|
* @license
|
|
2154
2254
|
* Copyright 2020 Google LLC
|
|
@@ -2165,7 +2265,7 @@ class nd{constructor(t,e){this.shortDelay=t,this.longDelay=e,Yh(e>t,"Short delay
|
|
|
2165
2265
|
* See the License for the specific language governing permissions and
|
|
2166
2266
|
* limitations under the License.
|
|
2167
2267
|
*/
|
|
2168
|
-
function
|
|
2268
|
+
async function qf(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof p&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2169
2269
|
/**
|
|
2170
2270
|
* @license
|
|
2171
2271
|
* Copyright 2020 Google LLC
|
|
@@ -2181,8 +2281,7 @@ function pd(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))retur
|
|
|
2181
2281
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2182
2282
|
* See the License for the specific language governing permissions and
|
|
2183
2283
|
* limitations under the License.
|
|
2184
|
-
*/
|
|
2185
|
-
async function yd(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof p&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
|
|
2284
|
+
*/(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class Wf{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
|
|
2186
2285
|
/**
|
|
2187
2286
|
* @license
|
|
2188
2287
|
* Copyright 2020 Google LLC
|
|
@@ -2198,10 +2297,10 @@ async function yd(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2198
2297
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2199
2298
|
* See the License for the specific language governing permissions and
|
|
2200
2299
|
* limitations under the License.
|
|
2201
|
-
*/
|
|
2300
|
+
*/class Kf{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Hf(this.lastLoginAt),this.creationTime=Hf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
|
|
2202
2301
|
/**
|
|
2203
2302
|
* @license
|
|
2204
|
-
* Copyright
|
|
2303
|
+
* Copyright 2019 Google LLC
|
|
2205
2304
|
*
|
|
2206
2305
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2207
2306
|
* you may not use this file except in compliance with the License.
|
|
@@ -2214,10 +2313,10 @@ async function yd(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2214
2313
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2215
2314
|
* See the License for the specific language governing permissions and
|
|
2216
2315
|
* limitations under the License.
|
|
2217
|
-
*/
|
|
2316
|
+
*/async function Gf(t){var e;const n=t.auth,r=await t.getIdToken(),i=await qf(t,async function(t,e){return Mf(t,"POST","/v1/accounts:lookup",e)}(n,{idToken:r}));Tf(null==i?void 0:i.users.length,n,"internal-error");const s=i.users[0];t._notifyReloadListener(s);const o=(null===(e=s.providerUserInfo)||void 0===e?void 0:e.length)?s.providerUserInfo.map((t=>{var{providerId:e}=t,n=pf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})):[];const a=function(t,e){const n=t.filter((t=>!e.some((e=>e.providerId===t.providerId))));return[...n,...e]}(t.providerData,o),c=t.isAnonymous,l=!(t.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 Kf(s.createdAt,s.lastLoginAt),isAnonymous:u};Object.assign(t,h)}
|
|
2218
2317
|
/**
|
|
2219
2318
|
* @license
|
|
2220
|
-
* Copyright
|
|
2319
|
+
* Copyright 2020 Google LLC
|
|
2221
2320
|
*
|
|
2222
2321
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2223
2322
|
* you may not use this file except in compliance with the License.
|
|
@@ -2230,7 +2329,8 @@ async function yd(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2230
2329
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2231
2330
|
* See the License for the specific language governing permissions and
|
|
2232
2331
|
* limitations under the License.
|
|
2233
|
-
*/
|
|
2332
|
+
*/
|
|
2333
|
+
class Qf{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Tf(t.idToken,"internal-error"),Tf(void 0!==t.idToken,"internal-error"),Tf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=jf(t);return Tf(e,"internal-error"),Tf(void 0!==e.exp,"internal-error"),Tf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return Tf(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:i}=
|
|
2234
2334
|
/**
|
|
2235
2335
|
* @license
|
|
2236
2336
|
* Copyright 2020 Google LLC
|
|
@@ -2246,8 +2346,7 @@ async function yd(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e in
|
|
|
2246
2346
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2247
2347
|
* See the License for the specific language governing permissions and
|
|
2248
2348
|
* limitations under the License.
|
|
2249
|
-
*/
|
|
2250
|
-
class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Wh(t.idToken,"internal-error"),Wh(void 0!==t.idToken,"internal-error"),Wh(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):function(t){const e=md(t);return Wh(e,"internal-error"),Wh(void 0!==e.exp,"internal-error"),Wh(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}async getToken(t,e=!1){return Wh(!this.accessToken||this.refreshToken,t,"user-token-expired"),e||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:i}=
|
|
2349
|
+
*/await async function(t,e){const n=await Uf(t,{},(async()=>{const n=w({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:i}=t.config,s=zf(t,r,"/v1/token",`key=${i}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Df.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:i}=e,s=new Qf;return n&&(Tf("string"==typeof n,"internal-error",{appName:t}),s.refreshToken=n),r&&(Tf("string"==typeof r,"internal-error",{appName:t}),s.accessToken=r),i&&(Tf("number"==typeof i,"internal-error",{appName:t}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new Qf,this.toJSON())}_performRefresh(){return If("not implemented")}}
|
|
2251
2350
|
/**
|
|
2252
2351
|
* @license
|
|
2253
2352
|
* Copyright 2020 Google LLC
|
|
@@ -2263,7 +2362,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2263
2362
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2264
2363
|
* See the License for the specific language governing permissions and
|
|
2265
2364
|
* limitations under the License.
|
|
2266
|
-
*/
|
|
2365
|
+
*/function Yf(t,e){Tf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class Jf{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,i=pf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Wf(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Kf(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(t){const e=await qf(this,this.stsTokenManager.getToken(this.auth,t));return Tf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=T(t),r=await n.getIdToken(e),i=jf(r);Tf(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:Hf($f(i.auth_time)),issuedAtTime:Hf($f(i.iat)),expirationTime:Hf($f(i.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=T(t);await Gf(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Tf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new Jf(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Tf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await Gf(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const t=await this.getIdToken();return await qf(this,async function(t,e){return Mf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,i,s,o,a,c,l;const u=null!==(n=e.displayName)&&void 0!==n?n:void 0,h=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(i=e.phoneNumber)&&void 0!==i?i:void 0,f=null!==(s=e.photoURL)&&void 0!==s?s:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(l=e.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:w,isAnonymous:b,providerData:_,stsTokenManager:S}=e;Tf(v&&S,t,"internal-error");const E=Qf.fromJSON(this.name,S);Tf("string"==typeof v,t,"internal-error"),Yf(u,t.name),Yf(h,t.name),Tf("boolean"==typeof w,t,"internal-error"),Tf("boolean"==typeof b,t,"internal-error"),Yf(d,t.name),Yf(f,t.name),Yf(p,t.name),Yf(g,t.name),Yf(m,t.name),Yf(y,t.name);const T=new Jf({uid:v,auth:t,email:h,emailVerified:w,displayName:u,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:E,createdAt:m,lastLoginAt:y});return _&&Array.isArray(_)&&(T.providerData=_.map((t=>Object.assign({},t)))),g&&(T._redirectEventId=g),T}static async _fromIdTokenResponse(t,e,n=!1){const r=new Qf;r.updateFromServerResponse(e);const i=new Jf({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await Gf(i),i}}
|
|
2267
2366
|
/**
|
|
2268
2367
|
* @license
|
|
2269
2368
|
* Copyright 2020 Google LLC
|
|
@@ -2279,7 +2378,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2279
2378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2280
2379
|
* See the License for the specific language governing permissions and
|
|
2281
2380
|
* limitations under the License.
|
|
2282
|
-
*/
|
|
2381
|
+
*/const Xf=new Map;function Zf(t){kf(t instanceof Function,"Expected a class definition");let e=Xf.get(t);return e?(kf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,Xf.set(t,e),e)}
|
|
2283
2382
|
/**
|
|
2284
2383
|
* @license
|
|
2285
2384
|
* Copyright 2019 Google LLC
|
|
@@ -2295,7 +2394,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2295
2394
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2296
2395
|
* See the License for the specific language governing permissions and
|
|
2297
2396
|
* limitations under the License.
|
|
2298
|
-
*/class
|
|
2397
|
+
*/class tp{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}tp.type="NONE";const ep=tp;
|
|
2299
2398
|
/**
|
|
2300
2399
|
* @license
|
|
2301
2400
|
* Copyright 2019 Google LLC
|
|
@@ -2311,7 +2410,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2311
2410
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2312
2411
|
* See the License for the specific language governing permissions and
|
|
2313
2412
|
* limitations under the License.
|
|
2314
|
-
*/function
|
|
2413
|
+
*/function np(t,e,n){return`firebase:${t}:${e}:${n}`}class rp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=np(this.userKey,r.apiKey,i),this.fullPersistenceKey=np("persistence",r.apiKey,i),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?Jf._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new rp(Zf(ep),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let i=r[0]||Zf(ep);const s=np(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(s);if(e){const r=Jf._fromJSON(t,e);n!==i&&(o=r),i=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==i)try{await t._remove(s)}catch(t){}}))),new rp(i,t,n)):new rp(i,t,n)}}
|
|
2315
2414
|
/**
|
|
2316
2415
|
* @license
|
|
2317
2416
|
* Copyright 2020 Google LLC
|
|
@@ -2327,7 +2426,7 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2327
2426
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2328
2427
|
* See the License for the specific language governing permissions and
|
|
2329
2428
|
* limitations under the License.
|
|
2330
|
-
*/function
|
|
2429
|
+
*/function ip(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(cp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(sp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(up(e))return"Blackberry";if(hp(e))return"Webos";if(op(e))return"Safari";if((e.includes("chrome/")||ap(e))&&!e.includes("edge/"))return"Chrome";if(lp(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function sp(t=f()){return/firefox\//i.test(t)}function op(t=f()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ap(t=f()){return/crios\//i.test(t)}function cp(t=f()){return/iemobile/i.test(t)}function lp(t=f()){return/android/i.test(t)}function up(t=f()){return/blackberry/i.test(t)}function hp(t=f()){return/webos/i.test(t)}function dp(t=f()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function fp(){return function(){const t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function pp(t=f()){return dp(t)||lp(t)||hp(t)||up(t)||/windows phone/i.test(t)||cp(t)}
|
|
2331
2430
|
/**
|
|
2332
2431
|
* @license
|
|
2333
2432
|
* Copyright 2020 Google LLC
|
|
@@ -2344,7 +2443,23 @@ class Sd{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2344
2443
|
* See the License for the specific language governing permissions and
|
|
2345
2444
|
* limitations under the License.
|
|
2346
2445
|
*/
|
|
2347
|
-
function
|
|
2446
|
+
function gp(t,e=[]){let n;switch(t){case"Browser":n=ip(f());break;case"Worker":n=`${ip(f())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Pt}/${r}`}async function mp(t,e){return Mf(t,"GET","/v2/recaptchaConfig",Pf(t,e))}function yp(t){return void 0!==t&&void 0!==t.enterprise}class vp{constructor(t){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.emailPasswordEnabled=t.recaptchaEnforcementState.some((t=>"EMAIL_PASSWORD_PROVIDER"===t.provider&&"OFF"!==t.enforcementState))}}
|
|
2447
|
+
/**
|
|
2448
|
+
* @license
|
|
2449
|
+
* Copyright 2020 Google LLC
|
|
2450
|
+
*
|
|
2451
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2452
|
+
* you may not use this file except in compliance with the License.
|
|
2453
|
+
* You may obtain a copy of the License at
|
|
2454
|
+
*
|
|
2455
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2456
|
+
*
|
|
2457
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2458
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2459
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2460
|
+
* See the License for the specific language governing permissions and
|
|
2461
|
+
* limitations under the License.
|
|
2462
|
+
*/function wp(t){return new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=Sf("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)}))}class bp{constructor(t){this.type="recaptcha-enterprise",this.auth=Tp(t)}async verify(t="verify",e=!1){function n(e,n,r){const i=window.grecaptcha;yp(i)?i.enterprise.ready((()=>{i.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,r)=>{(async function(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{mp(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new vp(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))})(this.auth).then((i=>{if(!e&&yp(window.grecaptcha))n(i,t,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));wp("https://www.google.com/recaptcha/enterprise.js?render="+i).then((()=>{n(i,t,r)})).catch((t=>{r(t)}))}})).catch((t=>{r(t)}))}))}}async function _p(t,e,n,r=!1){const i=new bp(t);let s;try{s=await i.verify(n)}catch(t){s=await i.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}
|
|
2348
2463
|
/**
|
|
2349
2464
|
* @license
|
|
2350
2465
|
* Copyright 2022 Google LLC
|
|
@@ -2360,7 +2475,7 @@ function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2360
2475
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2361
2476
|
* See the License for the specific language governing permissions and
|
|
2362
2477
|
* limitations under the License.
|
|
2363
|
-
*/class
|
|
2478
|
+
*/class Sp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
|
|
2364
2479
|
/**
|
|
2365
2480
|
* @license
|
|
2366
2481
|
* Copyright 2020 Google LLC
|
|
@@ -2376,7 +2491,7 @@ function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2376
2491
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2377
2492
|
* See the License for the specific language governing permissions and
|
|
2378
2493
|
* limitations under the License.
|
|
2379
|
-
*/class
|
|
2494
|
+
*/class Ep{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Ip(this),this.idTokenSubscription=new Ip(this),this.beforeStateQueue=new Sp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=yf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=Zf(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await rp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUser(t){var e;const n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Tf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await Gf(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){const e=t?T(t):null;return e&&Tf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Tf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(t){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Zf(t))}))}async initializeRecaptchaConfig(){const t=await mp(this,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),e=new vp(t);if(null==this.tenantId?this._agentRecaptchaConfig=e:this._tenantRecaptchaConfigs[this.tenantId]=e,e.emailPasswordEnabled){new bp(this).verify()}}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new g("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&Zf(t)||this._popupRedirectResolver;Tf(e,this,"argument-error"),this.redirectPersistenceManager=await rp.create(this,[Zf(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const i="function"==typeof e?e:e.next.bind(e),s=this._isInitialized?Promise.resolve():this._initializationPromise;return Tf(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof e?t.addObserver(e,n,r):t.addObserver(e)}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Tf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=gp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){wf.logLevel<=R.WARN&&wf.warn(`Auth (${Pt}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Tp(t){return T(t)}class Ip{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new S(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Tf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
|
|
2380
2495
|
/**
|
|
2381
2496
|
* @license
|
|
2382
2497
|
* Copyright 2020 Google LLC
|
|
@@ -2392,7 +2507,7 @@ function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2392
2507
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2393
2508
|
* See the License for the specific language governing permissions and
|
|
2394
2509
|
* limitations under the License.
|
|
2395
|
-
*/
|
|
2510
|
+
*/function kp(t,e,n){const r=Tp(t);Tf(r._canInitEmulator,r,"emulator-config-failed"),Tf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),s=Cp(e),{host:o,port:a}=function(t){const e=Cp(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const t=i[1];return{host:t,port:Ap(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Ap(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
|
|
2396
2511
|
/**
|
|
2397
2512
|
* @license
|
|
2398
2513
|
* Copyright 2020 Google LLC
|
|
@@ -2408,7 +2523,7 @@ function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2408
2523
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2409
2524
|
* See the License for the specific language governing permissions and
|
|
2410
2525
|
* limitations under the License.
|
|
2411
|
-
*/
|
|
2526
|
+
*/()}function Cp(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Ap(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Rp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return If("not implemented")}_getIdTokenResponse(t){return If("not implemented")}_linkToIdToken(t,e){return If("not implemented")}_getReauthenticationResolver(t){return If("not implemented")}}
|
|
2412
2527
|
/**
|
|
2413
2528
|
* @license
|
|
2414
2529
|
* Copyright 2020 Google LLC
|
|
@@ -2441,7 +2556,7 @@ function Fd(t,e=[]){let n;switch(t){case"Browser":n=Ad(a());break;case"Worker":n
|
|
|
2441
2556
|
* See the License for the specific language governing permissions and
|
|
2442
2557
|
* limitations under the License.
|
|
2443
2558
|
*/
|
|
2444
|
-
|
|
2559
|
+
async function Np(t,e){return Ff(t,"POST","/v1/accounts:signInWithPassword",Pf(t,e))}async function Lp(t,e){return async function(t,e){return Mf(t,"POST","/v1/accounts:sendOobCode",Pf(t,e))}(t,e)}
|
|
2445
2560
|
/**
|
|
2446
2561
|
* @license
|
|
2447
2562
|
* Copyright 2020 Google LLC
|
|
@@ -2458,7 +2573,6 @@ class Qd extends Gd{constructor(t,e,n,r=null){super("password",n),this._email=t,
|
|
|
2458
2573
|
* See the License for the specific language governing permissions and
|
|
2459
2574
|
* limitations under the License.
|
|
2460
2575
|
*/
|
|
2461
|
-
return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",ad(t,e))}(t,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithEmailLink",ad(t,e))}(t,{email:this._email,oobCode:this._password});default:$h(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return cd(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithEmailLink",ad(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:$h(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
|
|
2462
2576
|
/**
|
|
2463
2577
|
* @license
|
|
2464
2578
|
* Copyright 2020 Google LLC
|
|
@@ -2474,7 +2588,8 @@ return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2474
2588
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2475
2589
|
* See the License for the specific language governing permissions and
|
|
2476
2590
|
* limitations under the License.
|
|
2477
|
-
*/
|
|
2591
|
+
*/
|
|
2592
|
+
class Dp extends Rp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new Dp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new Dp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){var e;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(e=t._getRecaptchaConfig())||void 0===e?void 0:e.emailPasswordEnabled){const e=await _p(t,n,"signInWithPassword");return Np(t,e)}return Np(t,n).catch((async e=>{if("auth/missing-recaptcha-token"===e.code){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const e=await _p(t,n,"signInWithPassword");return Np(t,e)}return Promise.reject(e)}));case"emailLink":return async function(t,e){return Ff(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{email:this._email,oobCode:this._password});default:_f(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return async function(t,e){return Mf(t,"POST","/v1/accounts:update",e)}(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(t,e){return Ff(t,"POST","/v1/accounts:signInWithEmailLink",Pf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:_f(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
|
|
2478
2593
|
/**
|
|
2479
2594
|
* @license
|
|
2480
2595
|
* Copyright 2020 Google LLC
|
|
@@ -2490,7 +2605,7 @@ return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2490
2605
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2491
2606
|
* See the License for the specific language governing permissions and
|
|
2492
2607
|
* limitations under the License.
|
|
2493
|
-
*/
|
|
2608
|
+
*/async function Op(t,e){return Ff(t,"POST","/v1/accounts:signInWithIdp",Pf(t,e))}
|
|
2494
2609
|
/**
|
|
2495
2610
|
* @license
|
|
2496
2611
|
* Copyright 2020 Google LLC
|
|
@@ -2506,7 +2621,7 @@ return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2506
2621
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2507
2622
|
* See the License for the specific language governing permissions and
|
|
2508
2623
|
* limitations under the License.
|
|
2509
|
-
*/class
|
|
2624
|
+
*/class xp extends Rp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new xp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):_f("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,i=pf(e,["providerId","signInMethod"]);if(!n||!r)return null;const s=new xp(n,r);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(t){return Op(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Op(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Op(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=w(e)}return t}}
|
|
2510
2625
|
/**
|
|
2511
2626
|
* @license
|
|
2512
2627
|
* Copyright 2020 Google LLC
|
|
@@ -2522,7 +2637,7 @@ return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2522
2637
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2523
2638
|
* See the License for the specific language governing permissions and
|
|
2524
2639
|
* limitations under the License.
|
|
2525
|
-
*/class
|
|
2640
|
+
*/class Pp{constructor(t){var e,n,r,i,s,o;const a=b(_(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,l=null!==(n=a.oobCode)&&void 0!==n?n:null,u=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Tf(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=b(_(t)).link,n=e?b(_(e)).deep_link_id:null,r=b(_(t)).deep_link_id;return(r?b(_(r)).link:null)||r||n||e||t}(t);try{return new Pp(e)}catch(t){return null}}}
|
|
2526
2641
|
/**
|
|
2527
2642
|
* @license
|
|
2528
2643
|
* Copyright 2020 Google LLC
|
|
@@ -2538,11 +2653,10 @@ return async function(t,e){return ud(t,"POST","/v1/accounts:signInWithPassword",
|
|
|
2538
2653
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2539
2654
|
* See the License for the specific language governing permissions and
|
|
2540
2655
|
* limitations under the License.
|
|
2541
|
-
*/
|
|
2542
|
-
class tf{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
|
|
2656
|
+
*/class Mp{constructor(){this.providerId=Mp.PROVIDER_ID}static credential(t,e){return Dp._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Pp.parseLink(e);return Tf(n,"argument-error"),Dp._fromEmailAndCode(t,n.code,n.tenantId)}}Mp.PROVIDER_ID="password",Mp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Mp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
|
|
2543
2657
|
/**
|
|
2544
2658
|
* @license
|
|
2545
|
-
* Copyright
|
|
2659
|
+
* Copyright 2020 Google LLC
|
|
2546
2660
|
*
|
|
2547
2661
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2548
2662
|
* you may not use this file except in compliance with the License.
|
|
@@ -2555,10 +2669,11 @@ class tf{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2555
2669
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2556
2670
|
* See the License for the specific language governing permissions and
|
|
2557
2671
|
* limitations under the License.
|
|
2558
|
-
*/
|
|
2672
|
+
*/
|
|
2673
|
+
class Up{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
|
|
2559
2674
|
/**
|
|
2560
2675
|
* @license
|
|
2561
|
-
* Copyright
|
|
2676
|
+
* Copyright 2019 Google LLC
|
|
2562
2677
|
*
|
|
2563
2678
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2564
2679
|
* you may not use this file except in compliance with the License.
|
|
@@ -2571,7 +2686,7 @@ class tf{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2571
2686
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2572
2687
|
* See the License for the specific language governing permissions and
|
|
2573
2688
|
* limitations under the License.
|
|
2574
|
-
*/class
|
|
2689
|
+
*/class Fp extends Up{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
|
|
2575
2690
|
/**
|
|
2576
2691
|
* @license
|
|
2577
2692
|
* Copyright 2020 Google LLC
|
|
@@ -2587,8 +2702,7 @@ class tf{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
|
|
|
2587
2702
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2588
2703
|
* See the License for the specific language governing permissions and
|
|
2589
2704
|
* limitations under the License.
|
|
2590
|
-
*/
|
|
2591
|
-
class rf extends ef{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Jd._fromParams({providerId:rf.PROVIDER_ID,signInMethod:rf.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return rf.credentialFromTaggedObject(t)}static credentialFromError(t){return rf.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return rf.credential(e,n)}catch(t){return null}}}rf.GOOGLE_SIGN_IN_METHOD="google.com",rf.PROVIDER_ID="google.com";
|
|
2705
|
+
*/class zp extends Fp{constructor(){super("facebook.com")}static credential(t){return xp._fromParams({providerId:zp.PROVIDER_ID,signInMethod:zp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return zp.credentialFromTaggedObject(t)}static credentialFromError(t){return zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return zp.credential(t.oauthAccessToken)}catch(t){return null}}}zp.FACEBOOK_SIGN_IN_METHOD="facebook.com",zp.PROVIDER_ID="facebook.com";
|
|
2592
2706
|
/**
|
|
2593
2707
|
* @license
|
|
2594
2708
|
* Copyright 2020 Google LLC
|
|
@@ -2605,7 +2719,7 @@ class rf extends ef{constructor(){super("google.com"),this.addScope("profile")}s
|
|
|
2605
2719
|
* See the License for the specific language governing permissions and
|
|
2606
2720
|
* limitations under the License.
|
|
2607
2721
|
*/
|
|
2608
|
-
class
|
|
2722
|
+
class Bp extends Fp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return xp._fromParams({providerId:Bp.PROVIDER_ID,signInMethod:Bp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Bp.credentialFromTaggedObject(t)}static credentialFromError(t){return Bp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Bp.credential(e,n)}catch(t){return null}}}Bp.GOOGLE_SIGN_IN_METHOD="google.com",Bp.PROVIDER_ID="google.com";
|
|
2609
2723
|
/**
|
|
2610
2724
|
* @license
|
|
2611
2725
|
* Copyright 2020 Google LLC
|
|
@@ -2622,7 +2736,7 @@ class sf extends ef{constructor(){super("github.com")}static credential(t){retur
|
|
|
2622
2736
|
* See the License for the specific language governing permissions and
|
|
2623
2737
|
* limitations under the License.
|
|
2624
2738
|
*/
|
|
2625
|
-
class
|
|
2739
|
+
class Vp extends Fp{constructor(){super("github.com")}static credential(t){return xp._fromParams({providerId:Vp.PROVIDER_ID,signInMethod:Vp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Vp.credentialFromTaggedObject(t)}static credentialFromError(t){return Vp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Vp.credential(t.oauthAccessToken)}catch(t){return null}}}Vp.GITHUB_SIGN_IN_METHOD="github.com",Vp.PROVIDER_ID="github.com";
|
|
2626
2740
|
/**
|
|
2627
2741
|
* @license
|
|
2628
2742
|
* Copyright 2020 Google LLC
|
|
@@ -2639,7 +2753,7 @@ class of extends ef{constructor(){super("twitter.com")}static credential(t,e){re
|
|
|
2639
2753
|
* See the License for the specific language governing permissions and
|
|
2640
2754
|
* limitations under the License.
|
|
2641
2755
|
*/
|
|
2642
|
-
class
|
|
2756
|
+
class Hp extends Fp{constructor(){super("twitter.com")}static credential(t,e){return xp._fromParams({providerId:Hp.PROVIDER_ID,signInMethod:Hp.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Hp.credentialFromTaggedObject(t)}static credentialFromError(t){return Hp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Hp.credential(e,n)}catch(t){return null}}}Hp.TWITTER_SIGN_IN_METHOD="twitter.com",Hp.PROVIDER_ID="twitter.com";
|
|
2643
2757
|
/**
|
|
2644
2758
|
* @license
|
|
2645
2759
|
* Copyright 2020 Google LLC
|
|
@@ -2655,7 +2769,8 @@ class af{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2655
2769
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2656
2770
|
* See the License for the specific language governing permissions and
|
|
2657
2771
|
* limitations under the License.
|
|
2658
|
-
*/
|
|
2772
|
+
*/
|
|
2773
|
+
class $p{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const i=await Jf._fromIdTokenResponse(t,n,r),s=jp(n);return new $p({user:i,providerId:s,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=jp(n);return new $p({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function jp(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
|
|
2659
2774
|
/**
|
|
2660
2775
|
* @license
|
|
2661
2776
|
* Copyright 2020 Google LLC
|
|
@@ -2671,8 +2786,7 @@ class af{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
|
|
|
2671
2786
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2672
2787
|
* See the License for the specific language governing permissions and
|
|
2673
2788
|
* limitations under the License.
|
|
2674
|
-
*/
|
|
2675
|
-
async function hf(t,e,n=!1){const r="signIn",i=await uf(t,r,e),s=await af._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}
|
|
2789
|
+
*/class qp extends p{constructor(t,e,n,r){var i;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,qp.prototype),this.customData={appName:t.name,tenantId:null!==(i=t.tenantId)&&void 0!==i?i:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new qp(t,e,n,r)}}function Wp(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw qp._fromErrorAndOperation(t,n,e,r);throw n}))}
|
|
2676
2790
|
/**
|
|
2677
2791
|
* @license
|
|
2678
2792
|
* Copyright 2020 Google LLC
|
|
@@ -2689,7 +2803,7 @@ async function hf(t,e,n=!1){const r="signIn",i=await uf(t,r,e),s=await af._fromI
|
|
|
2689
2803
|
* See the License for the specific language governing permissions and
|
|
2690
2804
|
* limitations under the License.
|
|
2691
2805
|
*/
|
|
2692
|
-
async function
|
|
2806
|
+
async function Kp(t,e,n=!1){const r="signIn",i=await Wp(t,r,e),s=await $p._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}
|
|
2693
2807
|
/**
|
|
2694
2808
|
* @license
|
|
2695
2809
|
* Copyright 2020 Google LLC
|
|
@@ -2706,10 +2820,10 @@ async function df(t,e,n){const r=E(t),i={requestType:"PASSWORD_RESET",email:e};n
|
|
|
2706
2820
|
* See the License for the specific language governing permissions and
|
|
2707
2821
|
* limitations under the License.
|
|
2708
2822
|
*/
|
|
2709
|
-
function(t,e,n){var r;
|
|
2823
|
+
function Gp(t,e,n){var r;Tf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Tf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Tf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Tf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}
|
|
2710
2824
|
/**
|
|
2711
2825
|
* @license
|
|
2712
|
-
* Copyright
|
|
2826
|
+
* Copyright 2020 Google LLC
|
|
2713
2827
|
*
|
|
2714
2828
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2715
2829
|
* you may not use this file except in compliance with the License.
|
|
@@ -2722,10 +2836,10 @@ function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2722
2836
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2723
2837
|
* See the License for the specific language governing permissions and
|
|
2724
2838
|
* limitations under the License.
|
|
2725
|
-
*/
|
|
2839
|
+
*/async function Qp(t,e,n){await async function(t,e){return Mf(t,"POST","/v1/accounts:resetPassword",Pf(t,e))}(T(t),{oobCode:e,newPassword:n})}function Yp(t,e,n){return async function(t,e){return Kp(Tp(t),e)}(T(t),Mp.credential(e,n))}const Jp="__sak";
|
|
2726
2840
|
/**
|
|
2727
2841
|
* @license
|
|
2728
|
-
* Copyright
|
|
2842
|
+
* Copyright 2019 Google LLC
|
|
2729
2843
|
*
|
|
2730
2844
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2731
2845
|
* you may not use this file except in compliance with the License.
|
|
@@ -2738,7 +2852,7 @@ function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2738
2852
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2739
2853
|
* See the License for the specific language governing permissions and
|
|
2740
2854
|
* limitations under the License.
|
|
2741
|
-
*/class
|
|
2855
|
+
*/class Xp{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(Jp,"1"),this.storage.removeItem(Jp),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
|
|
2742
2856
|
/**
|
|
2743
2857
|
* @license
|
|
2744
2858
|
* Copyright 2020 Google LLC
|
|
@@ -2754,10 +2868,10 @@ function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2754
2868
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2755
2869
|
* See the License for the specific language governing permissions and
|
|
2756
2870
|
* limitations under the License.
|
|
2757
|
-
*/class
|
|
2871
|
+
*/class Zp extends Xp{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const t=f();return op(t)||dp(t)}()&&function(){try{return!(!window||window===window.top)}catch(t){return!1}}(),this.fallbackToPolling=pp(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;if(e?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(t.newValue!==r)null!==t.newValue?this.storage.setItem(n,t.newValue):this.storage.removeItem(n);else if(this.localCache[n]===t.newValue&&!e)return}const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},i=this.storage.getItem(n);fp()&&i!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}Zp.type="LOCAL";const tg=Zp;
|
|
2758
2872
|
/**
|
|
2759
2873
|
* @license
|
|
2760
|
-
* Copyright
|
|
2874
|
+
* Copyright 2020 Google LLC
|
|
2761
2875
|
*
|
|
2762
2876
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2763
2877
|
* you may not use this file except in compliance with the License.
|
|
@@ -2770,7 +2884,7 @@ function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2770
2884
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2771
2885
|
* See the License for the specific language governing permissions and
|
|
2772
2886
|
* limitations under the License.
|
|
2773
|
-
*/
|
|
2887
|
+
*/class eg extends Xp{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}eg.type="SESSION";const ng=eg;
|
|
2774
2888
|
/**
|
|
2775
2889
|
* @license
|
|
2776
2890
|
* Copyright 2019 Google LLC
|
|
@@ -2787,10 +2901,9 @@ function(t,e,n){var r;Wh((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
|
|
|
2787
2901
|
* See the License for the specific language governing permissions and
|
|
2788
2902
|
* limitations under the License.
|
|
2789
2903
|
*/
|
|
2790
|
-
class Sf{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new Sf(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:i}=e.data,s=this.handlersMap[r];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(s).map((async t=>t(e.origin,i))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
|
|
2791
2904
|
/**
|
|
2792
2905
|
* @license
|
|
2793
|
-
* Copyright
|
|
2906
|
+
* Copyright 2019 Google LLC
|
|
2794
2907
|
*
|
|
2795
2908
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2796
2909
|
* you may not use this file except in compliance with the License.
|
|
@@ -2804,10 +2917,10 @@ class Sf{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
|
|
|
2804
2917
|
* See the License for the specific language governing permissions and
|
|
2805
2918
|
* limitations under the License.
|
|
2806
2919
|
*/
|
|
2807
|
-
|
|
2920
|
+
class rg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new rg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:i}=e.data,s=this.handlersMap[r];if(!(null==s?void 0:s.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(s).map((async t=>t(e.origin,i))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
|
|
2808
2921
|
/**
|
|
2809
2922
|
* @license
|
|
2810
|
-
* Copyright
|
|
2923
|
+
* Copyright 2020 Google LLC
|
|
2811
2924
|
*
|
|
2812
2925
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2813
2926
|
* you may not use this file except in compliance with the License.
|
|
@@ -2820,10 +2933,11 @@ function _f(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2820
2933
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2821
2934
|
* See the License for the specific language governing permissions and
|
|
2822
2935
|
* limitations under the License.
|
|
2823
|
-
*/
|
|
2936
|
+
*/
|
|
2937
|
+
function ig(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
|
|
2824
2938
|
/**
|
|
2825
2939
|
* @license
|
|
2826
|
-
* Copyright
|
|
2940
|
+
* Copyright 2019 Google LLC
|
|
2827
2941
|
*
|
|
2828
2942
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2829
2943
|
* you may not use this file except in compliance with the License.
|
|
@@ -2836,10 +2950,10 @@ function _f(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2836
2950
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2837
2951
|
* See the License for the specific language governing permissions and
|
|
2838
2952
|
* limitations under the License.
|
|
2839
|
-
*/
|
|
2953
|
+
*/rg.receivers=[];class sg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=ig("",20);r.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(l),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),o(e.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),r.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}
|
|
2840
2954
|
/**
|
|
2841
2955
|
* @license
|
|
2842
|
-
* Copyright 2020 Google LLC
|
|
2956
|
+
* Copyright 2020 Google LLC
|
|
2843
2957
|
*
|
|
2844
2958
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2845
2959
|
* you may not use this file except in compliance with the License.
|
|
@@ -2852,11 +2966,10 @@ function _f(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
|
|
|
2852
2966
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2853
2967
|
* See the License for the specific language governing permissions and
|
|
2854
2968
|
* limitations under the License.
|
|
2855
|
-
*/
|
|
2856
|
-
function If(){return void 0!==Ef().WorkerGlobalScope&&"function"==typeof Ef().importScripts}
|
|
2969
|
+
*/function og(){return window}
|
|
2857
2970
|
/**
|
|
2858
2971
|
* @license
|
|
2859
|
-
* Copyright
|
|
2972
|
+
* Copyright 2020 Google LLC.
|
|
2860
2973
|
*
|
|
2861
2974
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2862
2975
|
* you may not use this file except in compliance with the License.
|
|
@@ -2870,10 +2983,10 @@ function If(){return void 0!==Ef().WorkerGlobalScope&&"function"==typeof Ef().im
|
|
|
2870
2983
|
* See the License for the specific language governing permissions and
|
|
2871
2984
|
* limitations under the License.
|
|
2872
2985
|
*/
|
|
2873
|
-
|
|
2986
|
+
function ag(){return void 0!==og().WorkerGlobalScope&&"function"==typeof og().importScripts}
|
|
2874
2987
|
/**
|
|
2875
2988
|
* @license
|
|
2876
|
-
* Copyright
|
|
2989
|
+
* Copyright 2019 Google LLC
|
|
2877
2990
|
*
|
|
2878
2991
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2879
2992
|
* you may not use this file except in compliance with the License.
|
|
@@ -2886,7 +2999,8 @@ const kf="firebaseLocalStorageDb",Cf="firebaseLocalStorage",Af="fbase_key";class
|
|
|
2886
2999
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2887
3000
|
* See the License for the specific language governing permissions and
|
|
2888
3001
|
* limitations under the License.
|
|
2889
|
-
*/
|
|
3002
|
+
*/
|
|
3003
|
+
const cg="firebaseLocalStorageDb",lg="firebaseLocalStorage",ug="fbase_key";class hg{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function dg(t,e){return t.transaction([lg],e?"readwrite":"readonly").objectStore(lg)}function fg(){const t=indexedDB.open(cg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(lg,{keyPath:ug})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(lg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(cg);return new hg(t).toPromise()}(),e(await fg()))}))}))}async function pg(t,e,n){const r=dg(t,!0).put({[ug]:e,value:n});return new hg(r).toPromise()}function gg(t,e){const n=dg(t,!0).delete(e);return new hg(n).toPromise()}class mg{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 fg()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return ag()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=rg._getInstance(ag()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new sg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await fg();return await pg(t,Jp,"1"),await gg(t,Jp),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>pg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=dg(t,!1).get(e),r=await new hg(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>gg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=dg(t,!1).getAll();return new hg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;for(const{fbase_key:r,value:i}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}mg.type="LOCAL";const yg=mg;new Nf(3e4,6e4);
|
|
2890
3004
|
/**
|
|
2891
3005
|
* @license
|
|
2892
3006
|
* Copyright 2019 Google LLC
|
|
@@ -2903,7 +3017,7 @@ const kf="firebaseLocalStorageDb",Cf="firebaseLocalStorage",Af="fbase_key";class
|
|
|
2903
3017
|
* See the License for the specific language governing permissions and
|
|
2904
3018
|
* limitations under the License.
|
|
2905
3019
|
*/
|
|
2906
|
-
class
|
|
3020
|
+
class vg extends Rp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Op(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Op(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Op(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function wg(t){return Kp(t.auth,new vg(t),t.bypassAuthState)}function bg(t){const{auth:e,user:n}=t;return Tf(n,e,"internal-error"),
|
|
2907
3021
|
/**
|
|
2908
3022
|
* @license
|
|
2909
3023
|
* Copyright 2019 Google LLC
|
|
@@ -2920,7 +3034,7 @@ class Uf extends Gd{constructor(t){super("custom","custom"),this.params=t}_getId
|
|
|
2920
3034
|
* See the License for the specific language governing permissions and
|
|
2921
3035
|
* limitations under the License.
|
|
2922
3036
|
*/
|
|
2923
|
-
async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await
|
|
3037
|
+
async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await qf(t,Wp(r,i,e,t),n);Tf(s.idToken,r,"internal-error");const o=jf(s.idToken);Tf(o,r,"internal-error");const{sub:a}=o;return Tf(t.uid===a,r,"user-mismatch"),$p._forOperation(t,i,s)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&_f(r,"user-mismatch"),t}}(n,new vg(t),t.bypassAuthState)}async function _g(t){const{auth:e,user:n}=t;return Tf(n,e,"internal-error"),async function(t,e,n=!1){const r=await qf(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return $p._forOperation(t,"link",r)}(n,new vg(t),t.bypassAuthState)}
|
|
2924
3038
|
/**
|
|
2925
3039
|
* @license
|
|
2926
3040
|
* Copyright 2020 Google LLC
|
|
@@ -2936,7 +3050,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await yd
|
|
|
2936
3050
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2937
3051
|
* See the License for the specific language governing permissions and
|
|
2938
3052
|
* limitations under the License.
|
|
2939
|
-
*/class
|
|
3053
|
+
*/class Sg{constructor(t,e,n,r,i=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:i,error:s,type:o}=t;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return wg;case"linkViaPopup":case"linkViaRedirect":return _g;case"reauthViaPopup":case"reauthViaRedirect":return bg;default:_f(this.auth,"internal-error")}}resolve(t){kf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){kf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
|
|
2940
3054
|
/**
|
|
2941
3055
|
* @license
|
|
2942
3056
|
* Copyright 2020 Google LLC
|
|
@@ -2952,7 +3066,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await yd
|
|
|
2952
3066
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2953
3067
|
* See the License for the specific language governing permissions and
|
|
2954
3068
|
* limitations under the License.
|
|
2955
|
-
*/const
|
|
3069
|
+
*/const Eg=new Nf(2e3,1e4);class Tg extends Sg{constructor(t,e,n,r,i){super(t,e,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Tg.currentPopupAction&&Tg.currentPopupAction.cancel(),Tg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Tf(t,this.auth,"internal-error"),t}async onExecution(){kf(1===this.filter.length,"Popup operations only handle one event");const t=ig();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(Sf(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(Sf(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Tg.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(Sf(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Eg.get())};t()}}Tg.currentPopupAction=null;
|
|
2956
3070
|
/**
|
|
2957
3071
|
* @license
|
|
2958
3072
|
* Copyright 2020 Google LLC
|
|
@@ -2969,7 +3083,7 @@ async function(t,e,n=!1){const{auth:r}=t,i="reauthenticate";try{const s=await yd
|
|
|
2969
3083
|
* See the License for the specific language governing permissions and
|
|
2970
3084
|
* limitations under the License.
|
|
2971
3085
|
*/
|
|
2972
|
-
const
|
|
3086
|
+
const Ig="pendingRedirect",kg=new Map;class Cg extends Sg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=kg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return np(Ig,t.config.apiKey,t.name)}(e),r=function(t){return Zf(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}kg.set(this.auth._key(),t)}return this.bypassAuthState||kg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Ag(t,e){kg.set(t._key(),e)}async function Rg(t,e,n=!1){const r=Tp(t),i=
|
|
2973
3087
|
/**
|
|
2974
3088
|
* @license
|
|
2975
3089
|
* Copyright 2021 Google LLC
|
|
@@ -2986,7 +3100,7 @@ const qf="pendingRedirect",$f=new Map;class Kf extends Vf{constructor(t,e,n=!1){
|
|
|
2986
3100
|
* See the License for the specific language governing permissions and
|
|
2987
3101
|
* limitations under the License.
|
|
2988
3102
|
*/
|
|
2989
|
-
function(t,e){return e?
|
|
3103
|
+
function(t,e){return e?Zf(e):(Tf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),s=new Cg(r,i,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
|
|
2990
3104
|
/**
|
|
2991
3105
|
* @license
|
|
2992
3106
|
* Copyright 2020 Google LLC
|
|
@@ -3002,7 +3116,7 @@ function(t,e){return e?Xh(e):(Wh(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3002
3116
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3003
3117
|
* See the License for the specific language governing permissions and
|
|
3004
3118
|
* limitations under the License.
|
|
3005
|
-
*/class
|
|
3119
|
+
*/class Ng{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Dg(t);default:return!1}}
|
|
3006
3120
|
/**
|
|
3007
3121
|
* @license
|
|
3008
3122
|
* Copyright 2020 Google LLC
|
|
@@ -3018,7 +3132,7 @@ function(t,e){return e?Xh(e):(Wh(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3018
3132
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3019
3133
|
* See the License for the specific language governing permissions and
|
|
3020
3134
|
* limitations under the License.
|
|
3021
|
-
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!
|
|
3135
|
+
*/(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Dg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(Sf(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Lg(t))}saveEventToCache(t){this.cachedEventUids.add(Lg(t)),this.lastProcessedEventTime=Date.now()}}function Lg(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Dg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
|
|
3022
3136
|
/**
|
|
3023
3137
|
* @license
|
|
3024
3138
|
* Copyright 2020 Google LLC
|
|
@@ -3035,7 +3149,7 @@ function(t,e){return e?Xh(e):(Wh(t._popupRedirectResolver,t,"argument-error"),t.
|
|
|
3035
3149
|
* See the License for the specific language governing permissions and
|
|
3036
3150
|
* limitations under the License.
|
|
3037
3151
|
*/
|
|
3038
|
-
const
|
|
3152
|
+
const Og=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,xg=/^https?/;async function Pg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Mf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Mg(t))return}catch(t){}_f(t,"unauthorized-domain")}function Mg(t){const e=Cf(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const i=new URL(t);return""===i.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!xg.test(n))return!1;if(Og.test(t))return r===t;const i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}
|
|
3039
3153
|
/**
|
|
3040
3154
|
* @license
|
|
3041
3155
|
* Copyright 2020 Google LLC.
|
|
@@ -3051,7 +3165,7 @@ const Xf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Zf=/^https?/;async function tp(t
|
|
|
3051
3165
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3052
3166
|
* See the License for the specific language governing permissions and
|
|
3053
3167
|
* limitations under the License.
|
|
3054
|
-
*/const
|
|
3168
|
+
*/const Ug=new Nf(3e4,6e4);function Fg(){const t=og().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function zg(t){return new Promise(((e,n)=>{var r,i,s;function o(){Fg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Fg(),n(Sf(t,"network-request-failed"))},timeout:Ug.get()})}if(null===(i=null===(r=og().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)e(gapi.iframes.getContext());else{if(!(null===(s=og().gapi)||void 0===s?void 0:s.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return og()[e]=()=>{gapi.load?o():n(Sf(t,"network-request-failed"))},wp(`https://apis.google.com/js/api.js?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Bg=null,t}))}let Bg=null;
|
|
3055
3169
|
/**
|
|
3056
3170
|
* @license
|
|
3057
3171
|
* Copyright 2020 Google LLC.
|
|
@@ -3068,7 +3182,7 @@ const Xf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Zf=/^https?/;async function tp(t
|
|
|
3068
3182
|
* See the License for the specific language governing permissions and
|
|
3069
3183
|
* limitations under the License.
|
|
3070
3184
|
*/
|
|
3071
|
-
const
|
|
3185
|
+
const Vg=new Nf(5e3,15e3),Hg="__/auth/iframe",$g="emulator/auth/iframe",jg={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},qg=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Wg(t){const e=t.config;Tf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Lf(e,$g):`https://${t.config.authDomain}/${Hg}`,r={apiKey:e.apiKey,appName:t.name,v:Pt},i=qg.get(t.config.apiHost);i&&(r.eid=i);const s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${w(r).slice(1)}`}async function Kg(t){const e=await function(t){return Bg=Bg||zg(t),Bg}(t),n=og().gapi;return Tf(n,t,"internal-error"),e.open({where:document.body,url:Wg(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:jg,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const i=Sf(t,"network-request-failed"),s=og().setTimeout((()=>{r(i)}),Vg.get());function o(){og().clearTimeout(s),n(e)}e.ping(o).then(o,(()=>{r(i)}))}))))}
|
|
3072
3186
|
/**
|
|
3073
3187
|
* @license
|
|
3074
3188
|
* Copyright 2020 Google LLC.
|
|
@@ -3084,7 +3198,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3084
3198
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3085
3199
|
* See the License for the specific language governing permissions and
|
|
3086
3200
|
* limitations under the License.
|
|
3087
|
-
*/const
|
|
3201
|
+
*/const Gg={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Qg{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function Yg(t,e,n,r=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},Gg),{width:r.toString(),height:i.toString(),top:s,left:o}),l=f().toLowerCase();n&&(a=ap(l)?"_blank":n),sp(l)&&(e=e||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=f()){var e;return dp(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(l)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
|
|
3088
3202
|
/**
|
|
3089
3203
|
* @license
|
|
3090
3204
|
* Copyright 2021 Google LLC
|
|
@@ -3100,7 +3214,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3100
3214
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3101
3215
|
* See the License for the specific language governing permissions and
|
|
3102
3216
|
* limitations under the License.
|
|
3103
|
-
*/(e||"",
|
|
3217
|
+
*/(e||"",a),new Qg(null);const h=window.open(e||"",a,u);Tf(h,t,"popup-blocked");try{h.focus()}catch(t){}return new Qg(h)}const Jg="__/auth/handler",Xg="emulator/auth/handler",Zg=encodeURIComponent("fac");async function tm(t,e,n,r,i,s){Tf(t.config.authDomain,t,"auth-domain-config-required"),Tf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Pt,eventId:i};if(e instanceof Up){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(s||{}))o[t]=e}if(e instanceof Fp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),l=c?`#${Zg}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${Jg}`;return Lf(t,Xg)}
|
|
3104
3218
|
/**
|
|
3105
3219
|
* @license
|
|
3106
3220
|
* Copyright 2020 Google LLC
|
|
@@ -3116,7 +3230,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3116
3230
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3117
3231
|
* See the License for the specific language governing permissions and
|
|
3118
3232
|
* limitations under the License.
|
|
3119
|
-
*/(t)}?${w(a).slice(1)}`}const
|
|
3233
|
+
*/(t)}?${w(a).slice(1)}${l}`}const em="webStorageSupport";const nm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ng,this._completeRedirectFn=Rg,this._overrideRedirectResult=Ag}async _openPopup(t,e,n,r){var i;kf(null===(i=this.eventManagers[t._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()");return Yg(t,await tm(t,e,n,Cf(),r),ig())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){og().location.href=t}(await tm(t,e,n,Cf(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(kf(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await Kg(t),n=new Ng(t);return e.register("authEvent",(e=>{Tf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(em,{type:em},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[em];void 0!==i&&e(!!i),_f(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Pg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return pp()||op()||dp()}};var rm="@firebase/auth",im="0.23.2";
|
|
3120
3234
|
/**
|
|
3121
3235
|
* @license
|
|
3122
3236
|
* Copyright 2020 Google LLC
|
|
@@ -3133,7 +3247,7 @@ const op=new nd(5e3,15e3),ap="__/auth/iframe",cp="emulator/auth/iframe",lp={styl
|
|
|
3133
3247
|
* See the License for the specific language governing permissions and
|
|
3134
3248
|
* limitations under the License.
|
|
3135
3249
|
*/
|
|
3136
|
-
class
|
|
3250
|
+
class sm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Tf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
|
|
3137
3251
|
/**
|
|
3138
3252
|
* @license
|
|
3139
3253
|
* Copyright 2020 Google LLC
|
|
@@ -3166,4 +3280,4 @@ class Tp{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
|
|
|
3166
3280
|
* See the License for the specific language governing permissions and
|
|
3167
3281
|
* limitations under the License.
|
|
3168
3282
|
*/
|
|
3169
|
-
const Ep=d("authIdTokenMaxAge")||300;let Ip=null;function kp(t=Ut()){const e=Ot(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Ot(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(y(n.getOptions(),null!=e?e:{}))return t;$h(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:bp,persistence:[Pf,vf,bf]}),r=d("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>Ep)return;const r=null==e?void 0:e.token;Ip!==r&&(Ip=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){E(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){E(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;const s=u("auth");return s&&qd(n,`http://${s}`),n}var Cp;Cp="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),{apiKey:i,authDomain:s}=n.options;return((t,n)=>{Wh(i&&!i.includes(":"),"invalid-api-key",{appName:t.name}),Wh(!(null==s?void 0:s.includes(":")),"argument-error",{appName:t.name});const r={apiKey:i,authDomain:s,clientPlatform:Cp,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Fd(Cp)},o=new Vd(t,n,r);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Xh);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(o,e),o})(n,r)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new Tp(t))(Hd(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),zt(Sp,_p,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(Cp)),zt(Sp,_p,"esm2017");class Ap extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Rp extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Np extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Lp{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=kp(e),this.auth.setPersistence(vf)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(){return new Promise((t=>{const e=this.auth.onAuthStateChanged((n=>{this.setUser(n),t(Boolean(n)),e()}))}))}setUser(t){this.user=t}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Rp;return(await Nh(Hu(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yh(Vu(this.firestore,"users"),wh(new th("__name__"),"==",this.id));return e=Dh(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await pf(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await df(this.auth,t)}async confirmPasswordReset(t,e){await ff(this.auth,t,e)}}class Op{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Dh(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Ph.getInstance().firebase);this.firestore=Yu(t),this.user=new Lp(this.firestore,t)}onInit(){return this.user.onInit()}query(t,e,n=!0){const r=yh(Vu(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Oh(yh(Vu(this.firestore,t),...e))}async getDoc(t,e){const n=Hu(this.firestore,t,e),r=await Nh(n);return r.exists()?r.data():null}}const Dp=t=>{if(t.code===Hh)throw new Error("account has been disabled");throw new Error(t.message)};class xp{static get endpoint(){return Ph.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"include"};r&&(o.body=JSON.stringify(r));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,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Pp{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()}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Rp;try{const r=await xp.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new Ap;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await xp.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 Np;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Np;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wh("brand_id","==",this.brandId)];r.push(wh("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Dp(t)}}async getColorwaySizeAssets(t,e){const n=[wh("brand_id","==",this.brandId)];t&&n.push(wh("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wh("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 Dp(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Dp(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Dp(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Dp(t)}}}var Mp;!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"}(Mp||(Mp={}));const Up={[Mp.ACROSS_BACK]:"Across back",[Mp.ACROSS_FRONT]:"Across front",[Mp.ACROSS_SHOULDER]:"Across shoulder",[Mp.ANKLE]:"Ankle",[Mp.ARMEYE]:"Armeye",[Mp.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Mp.BACK_CROTCH_LENGTH]:"Back crotch length",[Mp.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Mp.BELOW_KNEE]:"Below knee",[Mp.BICEP]:"Bicep",[Mp.BUST]:"Chest/Bust",[Mp.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Mp.CALF]:"Calf",[Mp.CB_NECK_TO_WAIST]:"Cb neck to waist",[Mp.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Mp.CF_NECK_TO_WAIST]:"Cf neck to waist",[Mp.ELBOW]:"Elbow",[Mp.FOREARM]:"Forearm",[Mp.FRONT_CROTCH_LENGTH]:"Front crotch length",[Mp.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Mp.HIGH_HIP]:"High hip",[Mp.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Mp.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Mp.HSP_TO_BUST_POINT]:"Hsp to bust point",[Mp.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Mp.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Mp.INSEAM]:"Inseam",[Mp.KNEE]:"Knee",[Mp.LOW_HIP]:"Low hip",[Mp.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Mp.MID_NECK]:"Mid neck",[Mp.NECK_AT_BASE]:"Neck at base",[Mp.SHOULDER_DROP]:"Shoulder drop",[Mp.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Mp.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Mp.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Mp.THIGH]:"Thigh",[Mp.TOTAL_RISE_LENGTH]:"Total rise length",[Mp.UNDER_BUST]:"Under bust",[Mp.VERTICAL_TRUNK]:"Vertical trunk",[Mp.WAIST]:"Waist",[Mp.WRIST]:"Wrist"};var zp;!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"}(zp||(zp={}));const Fp={[zp.BLOUSES]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.COATS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.DRESSES]:[Mp.LOW_HIP,Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST],[zp.JACKETS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.PANTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.PUFFERS_AND_PARKAS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.SHORTS]:[Mp.LOW_HIP,Mp.WAIST,Mp.THIGH,Mp.INSEAM],[zp.SKIRTS]:[Mp.LOW_HIP,Mp.WAIST],[zp.SWEATERS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP],[zp.T_SHIRTS_AND_TANKS]:[Mp.BUST,Mp.ACROSS_SHOULDER,Mp.WAIST,Mp.LOW_HIP,Mp.HIGH_HIP]},Bp={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"},Vp={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"},Hp={activewear:{leggings:zp.PANTS,joggers:zp.PANTS,sweatshirts:zp.SWEATERS},dresses:{a_line:zp.DRESSES,bodycon:zp.DRESSES,fit_and_flare:zp.DRESSES,knit:zp.DRESSES,shirt:zp.DRESSES,slip:zp.DRESSES,straight:zp.DRESSES,wrap:zp.DRESSES},jackets_and_coats:{denim_jackets:zp.JACKETS,parkas:zp.PUFFERS_AND_PARKAS,peacoats:zp.COATS,puffer_jackets:zp.PUFFERS_AND_PARKAS,raincoats:zp.COATS,rompers:zp.COATS,shackets:zp.JACKETS,trench_coats:zp.COATS},jeans:{bootcut:zp.PANTS,flared:zp.PANTS,mom:zp.PANTS,relaxed:zp.PANTS,skinny:zp.PANTS,slim:zp.PANTS,straight:zp.PANTS,tapered:zp.PANTS,wide_leg:zp.PANTS},jumpsuits_and_rompers:{boiler_suits:zp.DRESSES,denim:zp.DRESSES,jumpsuits:zp.DRESSES,overalls:zp.DRESSES,rompers:zp.DRESSES,unitards:zp.DRESSES},pants_and_shorts:{cigarette:zp.PANTS,culottes:zp.SHORTS,denim_shorts:zp.SHORTS,flared:zp.PANTS,joggers:zp.PANTS,leggings:zp.PANTS,skinny:zp.PANTS,wide_leg:zp.PANTS},skirts:{a_line_flared:zp.SKIRTS,denim:zp.SKIRTS,knit:zp.SKIRTS,pencil:zp.SKIRTS,pleated:zp.SKIRTS,skater:zp.SKIRTS,slip:zp.SKIRTS,wrap:zp.SKIRTS},suits_and_tailoring:{blazers:zp.JACKETS,suit_jackets:zp.JACKETS,suit_skirts:zp.SKIRTS,suit_trousers:zp.PANTS,suit_vests:zp.SWEATERS,trousers:zp.PANTS},sweaters:{cardigans:zp.SWEATERS,crewnecks:zp.SWEATERS,hoodies_and_zipups:zp.SWEATERS,sweatshirts:zp.SWEATERS,turtlenecks:zp.SWEATERS,v_necks:zp.SWEATERS},tops:{bodysuits:zp.BLOUSES,corsets_and_bustiers:zp.BLOUSES,polos:zp.T_SHIRTS_AND_TANKS,shirts_and_blouses:zp.BLOUSES,t_shirts:zp.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:zp.T_SHIRTS_AND_TANKS}};var jp;!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"}(jp||(jp={}));const qp={[jp.TOO_TIGHT]:"Too Tight",[jp.TIGHT]:"Tight",[jp.SLIGHTLY_TIGHT]:"Slightly Tight",[jp.PERFECT_FIT]:"Perfect Fit",[jp.SLIGHTLY_LOOSE]:"Slightly Loose",[jp.LOOSE]:"Loose",[jp.OVERSIZED]:"Oversized",[jp.TOO_SHORT]:"Too Short",[jp.SHORT]:"Short",[jp.SLIGHTLY_SHORT]:"Slightly Short",[jp.SLIGHTLY_LONG]:"Slightly Long",[jp.LONG]:"Long",[jp.TOO_LONG]:"Too Long"};var $p;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}($p||($p={}));var Kp=Object.freeze({__proto__:null,get AvatarState(){return $p},get MeasurementLocation(){return Mp},MeasurementLocationName:Up,get Classification(){return zp},ClassificationLocations:Fp,CategoryNames:Bp,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Vp,Taxonomy:Hp,get Fit(){return jp},FitNames:qp}),Gp="Back to sign in",Wp="Click here to download the app",Qp="Don't have an account?",Yp="Whoops! Looks like you don't have an avatar yet.",Jp="Email address",Xp="Please enter a valid email address.",Zp="Enter your email address, we will send you a link to reset your password.",tg="Forgot password?",eg="Have an account? Sign in",ng="Your avatar is loading...",rg="Unfortunately, that size is not available for try on.",ig="or",sg="Password",og="Please enter a valid password (at least 7 characters).",ag="Return to Catalog Page",cg="Return to Product Page",lg="Return to site",ug="Please return to The Fitting Room app to create your avatar.",hg="Scan the QR code to download the app",dg="Send",fg="Sign back in",pg="Sign in",gg="Something went wrong. Try again!",mg="You have successfully logged out!",yg="The Fitting Room",vg="Username or password is empty.",wg="Username or password is incorrect.",bg="End size uncertainty with",Sg="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var _g=[],Tg=[];function Eg(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=_g.indexOf(s);-1===o&&(o=_g.push(s)-1,Tg[o]={}),n=Tg[o]&&Tg[o][r]?Tg[o][r]:Tg[o][r]=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),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}Eg(".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)}",{});Eg(".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: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;margin:auto;max-height:100vh;max-width:709px;overflow:auto;width:100%}.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:390px;max-width:390px}.tfr-logo-box{aspect-ratio:1;margin:auto;max-height:430px;max-width:430px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:50%}.tfr-space-above{margin-top:10px}",{});Eg("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}",{});Eg(".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)}}",{});Eg("@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}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@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}}",{});Eg("#tfr-size-recommendations{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;font-family:var(--tfr-main-font);padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column}#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-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:370px}.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);height:40px;justify-content:center}.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;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:2;margin-left:16px}.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}#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){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{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}",{});Eg(".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}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});Eg(".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}",{});Eg(".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}",{});Eg(":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 Ig=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${ng} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),kg=t=>{const e=document.getElementById(t);if(!e)throw new Error(`element with id ${t} not found`);let n;const r=()=>{n&&(n.Unhook(),a()),e.style.display="none"},i=t=>{"Escape"===t.key&&r()},s=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),r())},o=()=>{e.querySelector("#tfr-close-container").addEventListener("click",r),document.addEventListener("keydown",i),document.addEventListener("click",s)},a=()=>{var n;const o=e.querySelector("#tfr-close-container");o?o.removeEventListener("click",r):(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",i),document.removeEventListener("click",s)};return{open:t=>{var r;n&&n.Unhook(),e.innerHTML=(r=t.Body(),`\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 tfr-pt-20 tfr-pb-50">\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">${bg}</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">${yg}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},Cg=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};return{Hook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.addEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.addEventListener("click",i)},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",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${Sg}</div>\n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls autoplay loop>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n </div>\n\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${e?Wp:hg}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n ${(()=>{const t="https://assets.dev.thefittingroom.xyz/images/";return e?`\n <img src="${t}apple.png" id="tfr-app-store" />\n <img src="${t}google.png" id="tfr-google-play" />\n `:`<img src="${t}qr.png" class="tfr-qr-code" />`})()}\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">${eg}</div>\n `}};class Ag{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=kg(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.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">${mg}</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">${fg}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${lg}</span>\n </div>\n `}})({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">${Yp}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${ug}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(Ig({timeoutMS:1e4}))}toScan(){this.manager.open(Cg({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,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{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",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},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",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${pg}</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">${Jp}</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">${sg}</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">${tg}</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">${Qp}</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 ${pg}\n </button>\n </form>\n `}})({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,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.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">${Zp}</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">${Jp}</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">${Gp}</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 ${dg}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{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",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},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\t\t\t\t<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">${ag}</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">${cg}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{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",r)},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",r)},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||gg}</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">${ag}</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">${cg}</span>\n </div>\n `)}})({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,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;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${rg} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${ig} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.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">${ag}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${cg}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const Rg="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class Ng{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!0,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecSelectContainer.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="")}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){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.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.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),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")}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))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}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],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}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>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${Rg}" /> Signup or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}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-down">v</div>\n\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 <img src="${Rg}" /> Signup or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></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">Sign out of the Fitting Room</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class Lg{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Kp.Fit.PERFECT_FIT,Kp.Fit.SLIGHTLY_LOOSE,Kp.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new Ng(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(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);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}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.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Kp.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:Kp.MeasurementLocationName[t.measurement_location]})))})))}: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 Og;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Og||(Og={}));class Dg{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new Ag(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"),Ph.getInstance().setEnv(e),new Pp(t,new Op)))(Number(this.shopId),o),this.tfrSizeRec=new Lg(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}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 r;if(0==t.length||0==e.length)return n(vg);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(Xp);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(og);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(wg)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(gg)}}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()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case Og.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Yp),this.tfrModal.onNotCreated();break;case Og.PENDING:(null===(n=this.hooks)||void 0===n?void 0:n.onLoading)&&this.hooks.onLoading();break;case Og.CREATED:(null===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(gg),this.tfrModal.onError(gg)}}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),r=(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.garment_measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}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 xg=async(t,e,n,r={},i={},s="dev")=>{const o=new Dg(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,xg as initFittingRoom};
|
|
3283
|
+
const om=h("authIdTokenMaxAge")||300;let am=null;function cm(t=Ut()){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;_f(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:nm,persistence:[yg,tg,ng]}),r=h("authTokenSyncURL");if(r){const t=(i=r,async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>om)return;const r=null==e?void 0:e.token;am!==r&&(am=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){T(t).beforeAuthStateChanged(e,n)}(n,t,(()=>t(n.currentUser))),function(t,e,n,r){T(t).onIdTokenChanged(e,n,r)}(n,(e=>t(e)))}var i;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&&kp(n,`http://${s}`),n}var lm;lm="Browser",Lt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),i=t.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Tf(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:lm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:gp(lm)},c=new Ep(n,r,i,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Zf);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Lt(new I("auth-internal",(t=>(t=>new sm(t))(Tp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Ft(rm,im,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(lm)),Ft(rm,im,"esm2017");class um extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class hm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class dm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class fm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=cm(e),this.auth.setPersistence(tg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}onInit(t){return new Promise((e=>{const n=this.auth.onAuthStateChanged((r=>{this.setUser(r),e(Boolean(r)),n(),r&&this.logUserLogin(t,r)}))}))}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,i,s,o;try{const a=xh(this.firestore,"user_logging",e.uid),c=await Nd(a),l=new Date,u=c.exists?c.data():null,h=null===(r=null===(n=null==u?void 0:u.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(h&&uf(l).diff(uf(1e3*h.seconds),"days")<=7)return;const d=null!==(o=null===(s=null===(i=null==u?void 0:u.brands)||void 0===i?void 0:i[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 Od(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 hm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new hm;return(await Nd(xh(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=yd(Oh(this.firestore,"users"),wd(new Wh("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await Yp(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await async function(t,e,n){var r;const i=Tp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}else n&&Gp(i,s,n),await Lp(i,s).catch((async t=>{if("auth/missing-recaptcha-token"!==t.code)return Promise.reject(t);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const t=await _p(i,s,"getOobCode",!0);n&&Gp(i,t,n),await Lp(i,t)}}))}(this.auth,t)}async confirmPasswordReset(t,e){await Qp(this.auth,t,e)}}class pm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Mt(Md.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Dt("object"==typeof t?t:Ut(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=re("firestore");t&&Rh(r,...t)}return r}(t),this.user=new fm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=yd(Oh(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Dd(yd(Oh(this.firestore,t),...e))}async getDoc(t,e){const n=xh(this.firestore,t,e),r=await Nd(n);return r.exists()?r.data():null}}const gm=t=>{if(t.code===vf)throw new Error("account has been disabled");throw new Error(t.message)};class mm{static get endpoint(){return Md.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:i=!0}){const s=this.getUrl(e,i),o={method:n,headers:await this.getHeaders(t,i),credentials:"include"};r&&(o.body=JSON.stringify(r));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,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class ym{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 hm;try{const r=await mm.Get(this.user,`/styles/${t}/recommendation`),i=await r.json();return(null===(e=null==i?void 0:i.fits)||void 0===e?void 0:e.length)&&(null===(n=null==i?void 0:i.recommended_size)||void 0===n?void 0:n.id)?i:null}catch(t){if("avatar not created"===(null==t?void 0:t.error))throw new um;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new dm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const i=await this.getGetTaxonomy(r.style_garment_category_id);if(!i)throw new Error("Taxonomy not found for style garment category id");return(e.length?i.garment_measurement_locations.female.filter((t=>e.includes(t))):i.garment_measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):t))}async getStyleByBrandStyleId(t){var e,n;try{const r=[wd("brand_id","==",this.brandId)];r.push(wd("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return gm(t)}}async getColorwaySizeAssets(t,e){const n=[wd("brand_id","==",this.brandId)];t&&n.push(wd("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(wd("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 gm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return gm(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return gm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,t.label)}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("garment_measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return gm(t)}}}var vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(vm||(vm={}));const wm={[vm.ACROSS_BACK]:"Across back",[vm.ACROSS_FRONT]:"Across front",[vm.ACROSS_SHOULDER]:"Across shoulder",[vm.ANKLE]:"Ankle",[vm.ARMEYE]:"Armeye",[vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[vm.BACK_CROTCH_LENGTH]:"Back crotch length",[vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[vm.BELOW_KNEE]:"Below knee",[vm.BICEP]:"Bicep",[vm.BUST]:"Chest/Bust",[vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[vm.CALF]:"Calf",[vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[vm.ELBOW]:"Elbow",[vm.FOREARM]:"Forearm",[vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[vm.HIGH_HIP]:"High hip",[vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[vm.INSEAM]:"Inseam",[vm.KNEE]:"Knee",[vm.LOW_HIP]:"Low hip",[vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[vm.MID_NECK]:"Mid neck",[vm.NECK_AT_BASE]:"Neck at base",[vm.SHOULDER_DROP]:"Shoulder drop",[vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[vm.THIGH]:"Thigh",[vm.TOTAL_RISE_LENGTH]:"Total rise length",[vm.UNDER_BUST]:"Under bust",[vm.VERTICAL_TRUNK]:"Vertical trunk",[vm.WAIST]:"Waist",[vm.WRIST]:"Wrist"};var bm;!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"}(bm||(bm={}));const _m={[bm.BLOUSES]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.COATS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.DRESSES]:[vm.LOW_HIP,vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST],[bm.JACKETS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.PANTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.PUFFERS_AND_PARKAS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.SHORTS]:[vm.LOW_HIP,vm.WAIST,vm.THIGH,vm.INSEAM],[bm.SKIRTS]:[vm.LOW_HIP,vm.WAIST],[bm.SWEATERS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP],[bm.T_SHIRTS_AND_TANKS]:[vm.BUST,vm.ACROSS_SHOULDER,vm.WAIST,vm.LOW_HIP,vm.HIGH_HIP]},Sm={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"},Em={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"},Tm={activewear:{leggings:bm.PANTS,joggers:bm.PANTS,sweatshirts:bm.SWEATERS},dresses:{a_line:bm.DRESSES,bodycon:bm.DRESSES,fit_and_flare:bm.DRESSES,knit:bm.DRESSES,shirt:bm.DRESSES,slip:bm.DRESSES,straight:bm.DRESSES,wrap:bm.DRESSES},jackets_and_coats:{denim_jackets:bm.JACKETS,parkas:bm.PUFFERS_AND_PARKAS,peacoats:bm.COATS,puffer_jackets:bm.PUFFERS_AND_PARKAS,raincoats:bm.COATS,rompers:bm.COATS,shackets:bm.JACKETS,trench_coats:bm.COATS},jeans:{bootcut:bm.PANTS,flared:bm.PANTS,mom:bm.PANTS,relaxed:bm.PANTS,skinny:bm.PANTS,slim:bm.PANTS,straight:bm.PANTS,tapered:bm.PANTS,wide_leg:bm.PANTS},jumpsuits_and_rompers:{boiler_suits:bm.DRESSES,denim:bm.DRESSES,jumpsuits:bm.DRESSES,overalls:bm.DRESSES,rompers:bm.DRESSES,unitards:bm.DRESSES},pants_and_shorts:{cigarette:bm.PANTS,culottes:bm.SHORTS,denim_shorts:bm.SHORTS,flared:bm.PANTS,joggers:bm.PANTS,leggings:bm.PANTS,skinny:bm.PANTS,wide_leg:bm.PANTS},skirts:{a_line_flared:bm.SKIRTS,denim:bm.SKIRTS,knit:bm.SKIRTS,pencil:bm.SKIRTS,pleated:bm.SKIRTS,skater:bm.SKIRTS,slip:bm.SKIRTS,wrap:bm.SKIRTS},suits_and_tailoring:{blazers:bm.JACKETS,suit_jackets:bm.JACKETS,suit_skirts:bm.SKIRTS,suit_trousers:bm.PANTS,suit_vests:bm.SWEATERS,trousers:bm.PANTS},sweaters:{cardigans:bm.SWEATERS,crewnecks:bm.SWEATERS,hoodies_and_zipups:bm.SWEATERS,sweatshirts:bm.SWEATERS,turtlenecks:bm.SWEATERS,v_necks:bm.SWEATERS},tops:{bodysuits:bm.BLOUSES,corsets_and_bustiers:bm.BLOUSES,polos:bm.T_SHIRTS_AND_TANKS,shirts_and_blouses:bm.BLOUSES,t_shirts:bm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:bm.T_SHIRTS_AND_TANKS}};var Im;!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"}(Im||(Im={}));const km={[Im.TOO_TIGHT]:"Too Tight",[Im.TIGHT]:"Tight",[Im.SLIGHTLY_TIGHT]:"Slightly Tight",[Im.PERFECT_FIT]:"Perfect Fit",[Im.SLIGHTLY_LOOSE]:"Slightly Loose",[Im.LOOSE]:"Loose",[Im.OVERSIZED]:"Oversized",[Im.TOO_SHORT]:"Too Short",[Im.SHORT]:"Short",[Im.SLIGHTLY_SHORT]:"Slightly Short",[Im.SLIGHTLY_LONG]:"Slightly Long",[Im.LONG]:"Long",[Im.TOO_LONG]:"Too Long"};var Cm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Cm||(Cm={}));var Am=Object.freeze({__proto__:null,get AvatarState(){return Cm},get MeasurementLocation(){return vm},MeasurementLocationName:wm,get Classification(){return bm},ClassificationLocations:_m,CategoryNames:Sm,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Em,Taxonomy:Tm,get Fit(){return Im},FitNames:km}),Rm="Back to sign in",Nm="Click here to download the app",Lm="Don't have an account?",Dm="Whoops! Looks like you don't have an avatar yet.",Om="Email address",xm="Please enter a valid email address.",Pm="Enter your email address, we will send you a link to reset your password.",Mm="Forgot password?",Um="Have an account? Sign in",Fm="Your avatar is loading...",zm="Unfortunately, that size is not available for try on.",Bm="or",Vm="Password",Hm="Please enter a valid password (at least 7 characters).",$m="Return to Catalog Page",jm="Return to Product Page",qm="Return to site",Wm="Please return to The Fitting Room app to create your avatar.",Km="Scan the QR code to download the app",Gm="Send",Qm="Sign back in",Ym="Sign in",Jm="Something went wrong. Try again!",Xm="You have successfully logged out!",Zm="The Fitting Room",ty="Username or password is empty.",ey="Username or password is incorrect.",ny="End size uncertainty with",ry="Our technology captures your precise measurements, and considers things like fabric stretch and your individual physique for the perfect fit every time.";var iy=[],sy=[];function oy(t,e){if(t&&"undefined"!=typeof document){var n,r=!0===e.prepend?"prepend":"append",i=!0===e.singleTag,s="string"==typeof e.container?document.querySelector(e.container):document.getElementsByTagName("head")[0];if(i){var o=iy.indexOf(s);-1===o&&(o=iy.push(s)-1,sy[o]={}),n=sy[o]&&sy[o][r]?sy[o][r]:sy[o][r]=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),i=0;i<n.length;i++)t.setAttribute(n[i],e.attributes[n[i]]);var o="prepend"===r?"afterbegin":"beforeend";return s.insertAdjacentElement(o,t),t}}oy(".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)}",{});oy(".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: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;margin:auto;max-height:100vh;max-width:709px;overflow:auto;width:100%}.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:390px;max-width:390px}.tfr-logo-box{aspect-ratio:1;margin:auto;max-height:430px;max-width:430px;padding:20px}.tfr-flex,.tfr-logo-box{align-items:center;display:flex;justify-content:center}.tfr-qr-code{width:50%}.tfr-space-above{margin-top:10px}",{});oy("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}",{});oy(".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)}}",{});oy("@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}}@media screen and (max-width:599px){.tfr-mobile-hidden{display:none}.tfr-modal-content-container{min-height:100vh}.trf-logo-title{margin-bottom:10px}.tfr-modal-content-flex{height:calc(100vh - 76px)}}@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}}",{});oy("#tfr-size-recommendations{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;font-family:var(--tfr-main-font);padding:var(--tfr-main-v-padding) var(--tfr-main-h-padding);width:var(--tfr-main-width)}#tfr-size-recommendations,#tfr-size-recommendations-container{align-items:center;flex-direction:column;justify-content:center}#tfr-size-recommendations-container{display:none;position:relative;width:100%}#tfr-size-rec-select-container{align-items:center;display:none;flex-direction:column}#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-size-rec-subtitle{background-color:var(--tfr-grey);border-radius:4px;color:var(--tfr-white);font-family:var(--tfr-subtitle-font);padding:8px;text-align:center;width:100%}#tfr-size-rec-subtitle,#tfr-size-rec-title{font-size:14px}#tfr-size-rec-table{display:flex;flex-direction:column;font-size:12px;width:370px}.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);height:40px;justify-content:center}.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;margin-right:70px;text-align:right}.tfr-size-rec-table-cell-right{flex-grow:2;margin-left:16px}.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}#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){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{height:24px}.tfr-powered-by-text-bold{font-weight:700}#tfr-size-recommendation-error{color:#8d0000;display:none}",{});oy(".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}.tfr-pr-20{padding-right:20px}.tfr-pl-20{padding-left:20px}.tfr-pb-7-p{padding-bottom:7%}",{});oy(".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}",{});oy(".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}",{});oy(":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 ay=t=>({Hook:()=>{const e=document.querySelector(".progress-bar-fill");!function(t,e){let n=0;const r=t/200;e.style.width=n+"%";const i=setInterval((()=>{n>=100?clearInterval(i):(n+=.5,e.style.width=n+"%")}),r)}(t.timeoutMS,e)},Unhook:()=>{},Body:()=>`\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mt-60" > ${Fm} </div>\n <div class="progress-bar">\n <span class="progress-bar-fill"></span>\n </div>\n `}),cy=t=>{const e=document.getElementById(t);if(!e)throw new Error(`element with id ${t} not found`);let n;const r=()=>{n&&(n.Unhook(),a()),e.style.display="none"},i=t=>{"Escape"===t.key&&r()},s=t=>{const n=e.querySelector("#tfr-modal-background");t.target===n&&(console.debug("container close"),r())},o=()=>{e.querySelector("#tfr-close-container").addEventListener("click",r),document.addEventListener("keydown",i),document.addEventListener("click",s)},a=()=>{var n;const o=e.querySelector("#tfr-close-container");o?o.removeEventListener("click",r):(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",i),document.removeEventListener("click",s)};return{open:t=>{var r;n&&n.Unhook(),e.innerHTML=(r=t.Body(),`\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 tfr-pt-20 tfr-pb-50">\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">${ny}</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">${Zm}</div>\n </div>\n </div>\n ${r}\n </div>\n </div>\n </div>\n </div>\n `),o(),t.Hook(),e.style.display="block",n=t},close:r,Content:()=>n}},ly=t=>{const e=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n=()=>{t.onSignInNav()},r=()=>{window.open("https://apps.apple.com/us/app/the-fitting-room-3d-body-scan/id1577417373","_blank")},i=()=>{window.open("https://play.google.com/store/apps/details?id=com.thefittingroom.marketplace","_blank")};return{Hook:()=>{var t,e,s;null===(t=document.getElementById("tfr-sign-in-nav"))||void 0===t||t.addEventListener("click",n),null===(e=document.getElementById("tfr-app-store"))||void 0===e||e.addEventListener("click",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.addEventListener("click",i)},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",r),null===(s=document.getElementById("tfr-google-play"))||void 0===s||s.removeEventListener("click",i)},Body:()=>`\n <div tfr-element="true">\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${ry}</div>\n </div>\n <div tfr-element="true" class="tfr-logo-box">\n <video id="tfr-video" controls autoplay loop>\n <source src="https://assets.dev.thefittingroom.xyz/videos/the-fitting-room.mp4" />\n </video>\n </div>\n\n <div tfr-element="true" class="tfr-title-font tfr-light-16-300 tfr-mt-10">${e?Nm:Km}</div>\n\n <div tfr-element="true" class="tfr-flex tfr-space-above">\n ${(()=>{const t="https://assets.dev.thefittingroom.xyz/images/";return e?`\n <img src="${t}apple.png" id="tfr-app-store" />\n <img src="${t}google.png" id="tfr-google-play" />\n `:`<img src="${t}qr.png" class="tfr-qr-code" />`})()}\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">${Um}</div>\n `}};class uy{constructor(t,e,n,r){this.signIn=e,this.forgotPassword=n,this.submitTel=r,this.manager=cy(t)}close(){this.manager.close()}onSignOut(){this.manager.open((t=>{const e=()=>{t.onNavSignIn("")},n=()=>{t.onClose()};return{Hook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-sign-in"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.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">${Xm}</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">${Qm}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor" >${qm}</span>\n </div>\n `}})({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">${Dm}</div>\n <div tfr-element="true" class="tfr-title-font tfr-light-22-300 tfr-c-black tfr-mb-60">${Wm}</div>\n `,Hook:()=>{},Unhook:()=>{}})}onLoading(){this.manager.open(ay({timeoutMS:1e4}))}toScan(){this.manager.open(ly({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,r=document.getElementById("password-input").value;s(),t.onSignIn(n,r,o)},r=()=>{const e=document.getElementById("email-input").value;t.onNavForgotPassword(e)},i=()=>{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",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.addEventListener("click",i)},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",r),null===(o=document.getElementById("tfr-scan-code"))||void 0===o||o.removeEventListener("click",i)},Body:()=>`\n <form id="tfr-sign-in-form">\n <div class="tfr-title-font tfr-light-22-300 tfr-mt-10">${Ym}</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">${Om}</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">${Vm}</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">${Mm}</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">${Lm}</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 ${Ym}\n </button>\n </form>\n `}})({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,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.addEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.addEventListener("click",e)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-send-password-reset"))||void 0===t||t.removeEventListener("click",n),null===(r=document.getElementById("tfr-back-to-signin"))||void 0===r||r.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">${Pm}</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">${Om}</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">${Rm}</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 ${Gm}\n </button>\n `}})({onNavSignIn:()=>this.toSignIn(),onPasswordReset:this.forgotPassword}))}toPasswordReset(){}onTryOn(t){this.manager.open((t=>{let e=()=>{};const r=()=>{t.onNavBack()},i=()=>{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",r),null===(o=document.getElementById("tfr-close"))||void 0===o||o.addEventListener("click",i)},Unhook:()=>{var t,n;e(),null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",r),null===(n=document.getElementById("tfr-close"))||void 0===n||n.removeEventListener("click",i)},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\t\t\t\t<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">${$m}</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">${jm}</span>\n </div>\n `}})({frames:t,onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}onError(t){this.manager.open((t=>{const{error:e}=t,n=()=>{t.onNavBack()},r=()=>{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",r)},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",r)},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||Jm}</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">${$m}</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">${jm}</span>\n </div>\n `)}})({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,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.addEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.addEventListener("click",n)},Unhook:()=>{var t,r;null===(t=document.getElementById("tfr-back"))||void 0===t||t.removeEventListener("click",e),null===(r=document.getElementById("tfr-close"))||void 0===r||r.removeEventListener("click",n)},Body:()=>{var e,n,r;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${zm} ${null===(e=t.sizes)||void 0===e?void 0:e.recommended} ${Bm} ${null===(r=null===(n=t.sizes)||void 0===n?void 0:n.available)||void 0===r?void 0:r.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">${$m}</span>\n <span id="tfr-close" tfr-element="true" class="tfr-body-font tfr-16-default tfr-c-black-o5 tfr-underline tfr-cursor">${jm}</span>\n </div>\n `}}})({sizes:{recommended:t,available:e},onClose:()=>this.close(),onNavBack:()=>this.navBack()}))}navBack(){window.history.back()}}const hy="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/login-icon.svg";class dy{constructor(t,e,n){this.onSignInClick=e,this.onSignOutClick=n,this._sku="",this.isLoggedIn=!1,this.isCollapsed=!0,this.redraw=null,this.init(t)}get sku(){return this._sku}setSku(t){this._sku=t}setIsLoggedIn(t){this.isLoggedIn=t,t?(this.tfrSizeRecActionLogin.style.display="none",this.tfrSizeRecActionLogout.style.display="block",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecSelectContainer.style.display="flex",this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down")):(this.tfrSizeRecActionLogin.style.display="block",this.tfrSizeRecActionLogout.style.display="none",this.tfrSizeRecTitle.style.display="flex",this.tfrSizeRecSubtitle.style.display="block",this.tfrSizeRecommendationError.style.display="none",this.tfrSizeRecommendationError.innerHTML="")}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){if(!t||!t.length)return this.tfrSizeRecTitle.style.display="none",void(this.tfrSizeRecSubtitle.style.display="none");this.renderGarmentLocations(t),this.tfrSizeRecSelect.style.display="none"}setRecommendedSize({recommended:t,sizes:e}){this.renderSizeRec(t,e),this.tfrSizeRecSelect.style.display="flex"}setError(){this.tfrSizeRecTitle.style.display="none",this.tfrSizeRecSubtitle.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.tfrSizeRecTitle=document.getElementById("tfr-size-rec-title"),this.tfrSizeRecSubtitle=document.getElementById("tfr-size-rec-subtitle"),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")}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))}onSizeRecSelectClick(t){const e=t.target;if(!e.classList.contains("tfr-size-rec-select-button"))return;t.preventDefault();const n=Number(e.getAttribute("data-index"));if(Number.isNaN(n))return;const r=document.querySelectorAll(".tfr-size-rec-select-button");r.forEach((t=>t.classList.remove("active"))),r.item(n).classList.add("active"),this.redraw(n)}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],r=n.sort((({location:t},{location:e})=>t<e?-1:1)).map((({location:t,fit:e,isPerfect:n})=>this.renderSizeRecTableRow(t,e,n))).join("");this.tfrSizeRecTable.innerHTML=r}renderSizeRecSelect(t,e){const n=t.map((({size:t})=>t)).map(((t,n)=>`<div class="tfr-size-rec-select-button ${n===e?"active":""}" data-index="${n}">${t}</div>`)).join("");this.tfrSizeRecSelect.innerHTML=n}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>`}renderLoginCta(){return`<div class="tfr-size-rec-login-cta"><img src="${hy}" /> Signup or login to view</div>`}renderGarmentLocations(t){const e=t.sort().map((t=>this.renderSizeRecTableRow(t,this.renderLoginCta()))).join("");this.tfrSizeRecTable.innerHTML=e,this.tfrSizeRecSize.innerHTML=this.renderLoginCta()}toggletSizeRecSelectContainer(){this.isCollapsed?(this.isCollapsed=!1,this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="flex"):(this.isCollapsed=!0,this.tfrSizeRecTitleToggle.classList.remove("tfr-chevron-up"),this.tfrSizeRecTitleToggle.classList.add("tfr-chevron-down"),this.tfrSizeRecSelectContainer.style.display="none")}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-down">v</div>\n\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 <img src="${hy}" /> Signup or login to view\n </div>\n </div>\n </div>\n\n <div id="tfr-size-rec-select-container">\n <div id="tfr-size-rec-select"></div>\n \n <div id="tfr-size-rec-subtitle">How it fits</div>\n \n <div id="tfr-size-rec-table"></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">Sign out of the Fitting Room</div>\n </div>\n\n <div class="tfr-powered-by">\n <div>Powered by</div>\n <div class="tfr-powered-by-logo"><img src="https://assets.dev.thefittingroom.xyz/shop-sdk/assets/tfr-door-brand.svg" /></div>\n <div class="tfr-powered-by-text-bold">The Fitting Room</div>\n </div>\n </div>\n </div>\n <div id="tfr-size-recommendation-error"></div>`;t.innerHTML=e}}class fy{constructor(t,e,n,r,i){this.tfrShop=n,this.onSignInClick=r,this.onSignOutClick=i,this.perfectFits=[Am.Fit.PERFECT_FIT,Am.Fit.SLIGHTLY_LOOSE,Am.Fit.SLIGHTLY_TIGHT],this.setCssVariables(e),this.sizeRecComponent=new dy(t,this.onSignInClick,this.onSignOutClick)}get sku(){return this.sizeRecComponent.sku}setSku(t){this.sizeRecComponent.setSku(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);return await this.getRecommendedSizes(String(t.style_id))}catch(t){try{const t=await this.tfrShop.getStyleByBrandStyleId(this.sku);return await this.getRecommendedSizes(String(t.id))}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.label,sizes:e.fits.map((t=>({size:e.available_sizes.find((e=>e.id===t.size_id)).label,locations:t.measurement_location_fits.map((t=>({fit:Am.FitNames[t.fit],isPerfect:this.perfectFits.includes(t.fit),location:Am.MeasurementLocationName[t.measurement_location]})))})))}: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 gy{constructor(t,e,n,r={},i,s){this.shopId=t,this.hooks=r,this.isLoggedIn=!1,this.unsub=null;const o=s||("undefined"!=typeof process?process.env.NODE_ENV:"dev");this.tfrModal=new uy(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"),Md.getInstance().setEnv(e),new ym(t,new pm)))(Number(this.shopId),o),this.tfrSizeRec=new fy(n,i,this.tfrShop,this.onSignInClick.bind(this),this.signOut.bind(this))}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 r;if(0==t.length||0==e.length)return n(ty);if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,})+$/.test(t))return n(xm);if(!(t=>!!t.match(/^.{7,}$/))(e))return n(Hm);try{await this.tfrShop.user.login(t,e),(null===(r=this.hooks)||void 0===r?void 0:r.onLogin)&&this.hooks.onLogin(),this.tfrModal.close(),this.isLoggedIn=!0,this.tfrSizeRec.setIsLoggedIn(!0),this.tfrSizeRec.setRecommendedSize(),this.subscribeToProfileChanges()}catch(t){return n(ey)}}setBrandUserId(t){this.tfrShop.user.setBrandUserId(t)}async submitTel(t){try{await this.tfrShop.submitTelephoneNumber(t),this.tfrModal.toSignIn()}catch(t){this.tfrModal.onError(Jm)}}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()}onUserProfileChange(t){var e,n,r,i;switch(t.avatar_status){case py.NOT_CREATED:(null===(e=this.hooks)||void 0===e?void 0:e.onError)&&this.hooks.onError(Dm),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===(r=this.hooks)||void 0===r?void 0:r.onLoadingComplete)&&this.hooks.onLoadingComplete();break;default:(null===(i=this.hooks)||void 0===i?void 0:i.onError)&&this.hooks.onError(Jm),this.tfrModal.onError(Jm)}}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),r=(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.garment_measurement_location)))||[];this.tfrSizeRec.setGarmentLocations(r)}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 my=async(t,e,n,r={},i={},s="dev")=>{const o=new gy(t,e,n,r,i,s);return await o.onInit(),o};export{n as InitImageSlider,my as initFittingRoom};
|