@thefittingroom/sdk 2.0.1 → 2.0.2
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 +19 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +94 -94
- package/dist/esm/index.min.js.map +1 -1
- package/firebase-service-account/firebase-adminsdk-privatekey.json +12 -0
- package/go.mod +7 -0
- package/package.json +2 -1
- package/tygo.yaml +15 -0
- package/.env.tmp +0 -25
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/fetcher.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/fetcher.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/fetcher.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/requests.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/requests.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/requests.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/responses.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/responses.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/responses.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/shop.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/shop.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/shop.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/utils.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/utils.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/api/utils.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase-error.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase-error.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase-error.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase-user.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase-user.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase-user.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/firebase/firebase.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/async.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/async.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/async.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/config.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/config.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/config.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/date.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/date.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/date.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/errors.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/errors.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/helpers/errors.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/index.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/index.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/index.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/types/index.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/types/index.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/types/index.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/types/measurement.d.ts +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/types/measurement.js +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/esm/types/measurement.js.map +0 -0
- /package/.rollup.cache/home/{runner/work/shop-sdk → codeliger/code/thefittingroom}/shop-sdk/dist/tsconfig.tsbuildinfo +0 -0
package/dist/esm/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* thefittingroom v2.0.1 (2025-
|
|
2
|
+
* thefittingroom v2.0.1 (2025-08-01T01:06:15.578Z)
|
|
3
3
|
* Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
var e=Object.freeze({__proto__:null}),t=Object.freeze({__proto__:null});const n=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let s=e.charCodeAt(r);s<128?t[n++]=s:s<2048?(t[n++]=s>>6|192,t[n++]=63&s|128):55296==(64512&s)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(s=65536+((1023&s)<<10)+(1023&e.charCodeAt(++r)),t[n++]=s>>18|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128,t[n++]=63&s|128):(t[n++]=s>>12|224,t[n++]=s>>6&63|128,t[n++]=63&s|128)}return t},r={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){const s=e[t],i=t+1<e.length,o=i?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,u=s>>2,h=(3&s)<<4|o>>4;let l=(15&o)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n++];if(s<128)t[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=e[n++];t[r++]=String.fromCharCode((31&s)<<6|63&i)}else if(s>239&&s<365){const i=((7&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(i>>10)),t[r++]=String.fromCharCode(56320+(1023&i))}else{const i=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&s)<<12|(63&i)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const i=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==o||null==a||null==c)throw new s;const u=i<<2|o>>4;if(r.push(u),64!==a){const e=o<<4&240|a>>2;if(r.push(e),64!==c){const e=a<<6&192|c;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};
|
|
@@ -133,7 +133,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
133
133
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
134
134
|
* See the License for the specific language governing permissions and
|
|
135
135
|
* limitations under the License.
|
|
136
|
-
*/function b(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function
|
|
136
|
+
*/function b(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function C(e){const t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function A(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class k{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=function(e,t){if("object"!=typeof e||null===e)return!1;for(const n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n},void 0===r.next&&(r.next=N),void 0===r.error&&(r.error=N),void 0===r.complete&&(r.complete=N);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),s}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function N(){}
|
|
137
137
|
/**
|
|
138
138
|
* @license
|
|
139
139
|
* Copyright 2021 Google LLC
|
|
@@ -149,7 +149,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
149
149
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
150
150
|
* See the License for the specific language governing permissions and
|
|
151
151
|
* limitations under the License.
|
|
152
|
-
*/function
|
|
152
|
+
*/function R(e){return e&&e._delegate?e._delegate:e}class O{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}
|
|
153
153
|
/**
|
|
154
154
|
* @license
|
|
155
155
|
* Copyright 2019 Google LLC
|
|
@@ -213,7 +213,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
213
213
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
214
214
|
* See the License for the specific language governing permissions and
|
|
215
215
|
* limitations under the License.
|
|
216
|
-
*/var M;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(M||(M={}));const x={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},U=M.INFO,F={[M.DEBUG]:"log",[M.VERBOSE]:"log",[M.INFO]:"info",[M.WARN]:"warn",[M.ERROR]:"error"},V=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=F[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}] ${e.name}:`,...n)};class j{constructor(e){this.name=e,this._logLevel=U,this._logHandler=V,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in M))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?x[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,M.DEBUG,...e),this._logHandler(this,M.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,M.VERBOSE,...e),this._logHandler(this,M.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,M.INFO,...e),this._logHandler(this,M.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,M.WARN,...e),this._logHandler(this,M.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,M.ERROR,...e),this._logHandler(this,M.ERROR,...e)}}let B,H;const $=new WeakMap,z=new WeakMap,q=new WeakMap,
|
|
216
|
+
*/var M;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(M||(M={}));const x={debug:M.DEBUG,verbose:M.VERBOSE,info:M.INFO,warn:M.WARN,error:M.ERROR,silent:M.SILENT},U=M.INFO,F={[M.DEBUG]:"log",[M.VERBOSE]:"log",[M.INFO]:"info",[M.WARN]:"warn",[M.ERROR]:"error"},V=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),s=F[t];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[s](`[${r}] ${e.name}:`,...n)};class j{constructor(e){this.name=e,this._logLevel=U,this._logHandler=V,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in M))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?x[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,M.DEBUG,...e),this._logHandler(this,M.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,M.VERBOSE,...e),this._logHandler(this,M.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,M.INFO,...e),this._logHandler(this,M.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,M.WARN,...e),this._logHandler(this,M.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,M.ERROR,...e),this._logHandler(this,M.ERROR,...e)}}let B,H;const $=new WeakMap,z=new WeakMap,q=new WeakMap,K=new WeakMap,G=new WeakMap;let W={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return z.get(e);if("objectStoreNames"===t)return e.objectStoreNames||q.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function Q(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(H||(H=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(X(this),t),Y($.get(this))}:function(...t){return Y(e.apply(X(this),t))}:function(t,...n){const r=e.call(X(this),t,...n);return q.set(r,t.sort?t.sort():[t]),Y(r)}}function J(e){return"function"==typeof e?Q(e):(e instanceof IDBTransaction&&function(e){if(z.has(e))return;const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("complete",s),e.removeEventListener("error",i),e.removeEventListener("abort",i)},s=()=>{t(),r()},i=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",s),e.addEventListener("error",i),e.addEventListener("abort",i)});z.set(e,t)}(e),t=e,(B||(B=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,W):e);var t}function Y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,n)=>{const r=()=>{e.removeEventListener("success",s),e.removeEventListener("error",i)},s=()=>{t(Y(e.result)),r()},i=()=>{n(e.error),r()};e.addEventListener("success",s),e.addEventListener("error",i)});return t.then(t=>{t instanceof IDBCursor&&$.set(t,e)}).catch(()=>{}),G.set(t,e),t}(e);if(K.has(e))return K.get(e);const t=J(e);return t!==e&&(K.set(e,t),G.set(t,e)),t}const X=e=>G.get(e);const Z=["get","getKey","getAll","getAllKeys","count"],ee=["put","add","delete","clear"],te=new Map;function ne(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(te.get(t))return te.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,s=ee.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!Z.includes(n))return;const i=async function(e,...t){const i=this.transaction(e,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),s&&i.done]))[0]};return te.set(t,i),i}W=(e=>({...e,get:(t,n,r)=>ne(t,n)||e.get(t,n,r),has:(t,n)=>!!ne(t,n)||e.has(t,n)}))(W);
|
|
217
217
|
/**
|
|
218
218
|
* @license
|
|
219
219
|
* Copyright 2019 Google LLC
|
|
@@ -230,7 +230,7 @@ class d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
230
230
|
* See the License for the specific language governing permissions and
|
|
231
231
|
* limitations under the License.
|
|
232
232
|
*/
|
|
233
|
-
class re{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const se="@firebase/app",ie="0.13.2",oe=new j("@firebase/app"),ae="@firebase/app-compat",ce="@firebase/analytics-compat",ue="@firebase/analytics",he="@firebase/app-check-compat",le="@firebase/app-check",de="@firebase/auth",fe="@firebase/auth-compat",pe="@firebase/database",ge="@firebase/data-connect",me="@firebase/database-compat",ye="@firebase/functions",ve="@firebase/functions-compat",_e="@firebase/installations",we="@firebase/installations-compat",Te="@firebase/messaging",Ee="@firebase/messaging-compat",Se="@firebase/performance",Ie="@firebase/performance-compat",be="@firebase/remote-config",
|
|
233
|
+
class re{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const se="@firebase/app",ie="0.13.2",oe=new j("@firebase/app"),ae="@firebase/app-compat",ce="@firebase/analytics-compat",ue="@firebase/analytics",he="@firebase/app-check-compat",le="@firebase/app-check",de="@firebase/auth",fe="@firebase/auth-compat",pe="@firebase/database",ge="@firebase/data-connect",me="@firebase/database-compat",ye="@firebase/functions",ve="@firebase/functions-compat",_e="@firebase/installations",we="@firebase/installations-compat",Te="@firebase/messaging",Ee="@firebase/messaging-compat",Se="@firebase/performance",Ie="@firebase/performance-compat",be="@firebase/remote-config",Ce="@firebase/remote-config-compat",Ae="@firebase/storage",ke="@firebase/storage-compat",Ne="@firebase/firestore",Re="@firebase/ai",Oe="@firebase/firestore-compat",De="firebase",Pe="[DEFAULT]",Le={[se]:"fire-core",[ae]:"fire-core-compat",[ue]:"fire-analytics",[ce]:"fire-analytics-compat",[le]:"fire-app-check",[he]:"fire-app-check-compat",[de]:"fire-auth",[fe]:"fire-auth-compat",[pe]:"fire-rtdb",[ge]:"fire-data-connect",[me]:"fire-rtdb-compat",[ye]:"fire-fn",[ve]:"fire-fn-compat",[_e]:"fire-iid",[we]:"fire-iid-compat",[Te]:"fire-fcm",[Ee]:"fire-fcm-compat",[Se]:"fire-perf",[Ie]:"fire-perf-compat",[be]:"fire-rc",[Ce]:"fire-rc-compat",[Ae]:"fire-gcs",[ke]:"fire-gcs-compat",[Ne]:"fire-fst",[Oe]:"fire-fst-compat",[Re]:"fire-vertex","fire-js":"fire-js",[De]:"fire-js-all"},Me=new Map,xe=new Map,Ue=new Map;function Fe(e,t){try{e.container.addComponent(t)}catch(n){oe.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function Ve(e){const t=e.name;if(Ue.has(t))return oe.debug(`There were multiple attempts to register component ${t}.`),!1;Ue.set(t,e);for(const t of Me.values())Fe(t,e);for(const t of xe.values())Fe(t,e);return!0}function je(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function Be(e){return null!=e&&void 0!==e.settings}
|
|
234
234
|
/**
|
|
235
235
|
* @license
|
|
236
236
|
* Copyright 2019 Google LLC
|
|
@@ -263,7 +263,7 @@ class re{constructor(e){this.container=e}getPlatformInfoString(){return this.con
|
|
|
263
263
|
* See the License for the specific language governing permissions and
|
|
264
264
|
* limitations under the License.
|
|
265
265
|
*/
|
|
266
|
-
class $e{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new
|
|
266
|
+
class $e{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new O("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw He.create("app-deleted",{appName:this._name})}}
|
|
267
267
|
/**
|
|
268
268
|
* @license
|
|
269
269
|
* Copyright 2019 Google LLC
|
|
@@ -279,7 +279,7 @@ class $e{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
|
|
|
279
279
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
280
280
|
* See the License for the specific language governing permissions and
|
|
281
281
|
* limitations under the License.
|
|
282
|
-
*/const ze="11.10.0";function qe(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),s=r.name;if("string"!=typeof s||!s)throw He.create("bad-app-name",{appName:String(s)});if(n||(n=h()),!n)throw He.create("no-options");const i=Me.get(s);if(i){if(S(n,i.options)&&S(r,i.config))return i;throw He.create("duplicate-app",{appName:s})}const o=new L(s);for(const e of Ue.values())o.addComponent(e);const a=new $e(n,r,o);return Me.set(s,a),a}function
|
|
282
|
+
*/const ze="11.10.0";function qe(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),s=r.name;if("string"!=typeof s||!s)throw He.create("bad-app-name",{appName:String(s)});if(n||(n=h()),!n)throw He.create("no-options");const i=Me.get(s);if(i){if(S(n,i.options)&&S(r,i.config))return i;throw He.create("duplicate-app",{appName:s})}const o=new L(s);for(const e of Ue.values())o.addComponent(e);const a=new $e(n,r,o);return Me.set(s,a),a}function Ke(e=Pe){const t=Me.get(e);if(!t&&e===Pe&&h())return qe();if(!t)throw He.create("no-app",{appName:e});return t}function Ge(e,t,n){var r;let s=null!==(r=Le[e])&&void 0!==r?r:e;n&&(s+=`-${n}`);const i=s.match(/\s|\//),o=t.match(/\s|\//);if(i||o){const e=[`Unable to register library "${s}" with version "${t}":`];return i&&e.push(`library name "${s}" contains illegal characters (whitespace or "/")`),i&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void oe.warn(e.join(" "))}Ve(new O(`${s}-version`,()=>({library:s,version:t}),"VERSION"))}
|
|
283
283
|
/**
|
|
284
284
|
* @license
|
|
285
285
|
* Copyright 2021 Google LLC
|
|
@@ -327,7 +327,7 @@ class $e{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
|
|
|
327
327
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
328
328
|
* See the License for the specific language governing permissions and
|
|
329
329
|
* limitations under the License.
|
|
330
|
-
*/(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){oe.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=et(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),nt(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),nt(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return oe.warn(e),""}}}function et(){return(new Date).toISOString().substring(0,10)}class tt{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Je()).transaction(We),n=await t.objectStore(We).get(Xe(e));return await t.done,n}catch(e){if(e instanceof w)oe.warn(e.message);else{const t=He.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});oe.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Ye(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Ye(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function nt(e){return i(JSON.stringify({version:2,heartbeats:e})).length}var rt;rt="",Ve(new
|
|
330
|
+
*/(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){oe.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=et(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){const n=[];let r=e.slice();for(const s of e){const e=n.find(e=>e.agent===s.agent);if(e){if(e.dates.push(s.date),nt(n)>t){e.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),nt(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(e){return oe.warn(e),""}}}function et(){return(new Date).toISOString().substring(0,10)}class tt{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var e;t((null===(e=s.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}).then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Je()).transaction(We),n=await t.objectStore(We).get(Xe(e));return await t.done,n}catch(e){if(e instanceof w)oe.warn(e.message);else{const t=He.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});oe.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Ye(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return Ye(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function nt(e){return i(JSON.stringify({version:2,heartbeats:e})).length}var rt;rt="",Ve(new O("platform-logger",e=>new re(e),"PRIVATE")),Ve(new O("heartbeat",e=>new Ze(e),"PRIVATE")),Ge(se,ie,rt),Ge(se,ie,"esm2017"),Ge("fire-js","");var st,it,ot="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};
|
|
331
331
|
/** @license
|
|
332
332
|
Copyright The Closure Library Authors.
|
|
333
333
|
SPDX-License-Identifier: Apache-2.0
|
|
@@ -346,7 +346,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
346
346
|
Copyright The Closure Library Authors.
|
|
347
347
|
SPDX-License-Identifier: Apache-2.0
|
|
348
348
|
*/
|
|
349
|
-
var r=r||{},s=this||self;function i(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function u(e,t,n){return(u=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}function h(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function l(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}function d(e){const t=e.length;if(0<t){const n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function f(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(i(n)){const t=e.length||0,r=n.length||0;e.length=t+r;for(let s=0;s<r;s++)e[t+s]=n[s]}else e.push(n)}}function p(e){return/^[\s\xa0]*$/.test(e)}function g(){var e=s.navigator;return e&&(e=e.userAgent)?e:""}function m(e){return m[" "](e),e}m[" "]=function(){};var y=!(-1==g().indexOf("Gecko")||-1!=g().toLowerCase().indexOf("webkit")&&-1==g().indexOf("Edge")||-1!=g().indexOf("Trident")||-1!=g().indexOf("MSIE")||-1!=g().indexOf("Edge"));function v(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function _(e){const t={};for(const n in e)t[n]=e[n];return t}const w="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<w.length;t++)n=w[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function E(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function S(e){s.setTimeout(()=>{throw e},0)}function I(){var e=R;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var b=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new A,e=>e.reset());class A{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let C,k=!1,R=new class{constructor(){this.h=this.g=null}add(e,t){const n=b.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},O=()=>{const e=s.Promise.resolve(void 0);C=()=>{e.then(N)}};var N=()=>{for(var e;e=I();){try{e.h.call(e.g)}catch(e){S(e)}var t=b;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}k=!1};function D(){this.s=this.s,this.C=this.C}function P(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}D.prototype.s=!1,D.prototype.ma=function(){this.s||(this.s=!0,this.N())},D.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},P.prototype.h=function(){this.defaultPrevented=!0};var L=function(){if(!s.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};s.addEventListener("test",e,t),s.removeEventListener("test",e,t)}catch(e){}return e}();function M(e,t){if(P.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(y){e:{try{m(t.nodeName);var s=!0;break e}catch(e){}s=!1}s||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:x[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&M.aa.h.call(this)}}l(M,P);var x={2:"touch",3:"pen",4:"mouse"};M.prototype.h=function(){M.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var U="closure_listenable_"+(1e6*Math.random()|0),F=0;function V(e,t,n,r,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=s,this.key=++F,this.da=this.fa=!1}function j(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function B(e){this.src=e,this.g={},this.h=0}function H(e,t){var n=t.type;if(n in e.g){var r,s=e.g[n],i=Array.prototype.indexOf.call(s,t,void 0);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(j(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function $(e,t,n,r){for(var s=0;s<e.length;++s){var i=e[s];if(!i.da&&i.listener==t&&i.capture==!!n&&i.ha==r)return s}return-1}B.prototype.add=function(e,t,n,r,s){var i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);var o=$(e,t,r,s);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new V(t,this.src,i,!!r,s)).fa=n,e.push(t)),t};var z="closure_lm_"+(1e6*Math.random()|0),q={};function G(e,t,n,r,s){if(Array.isArray(t)){for(var i=0;i<t.length;i++)G(e,t[i],n,r,s);return null}return n=Z(n),e&&e[U]?e.K(t,n,!!o(r)&&!!r.capture,s):function(e,t,n,r,s,i){if(!t)throw Error("Invalid event type");var a=o(s)?!!s.capture:!!s,c=Y(e);if(c||(e[z]=c=new B(e)),n=c.add(t,n,r,a,i),n.proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)L||(s=a),void 0===s&&(s=!1),e.addEventListener(t.toString(),r,s);else if(e.attachEvent)e.attachEvent(Q(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}(e,t,n,!1,r,s)}function K(e,t,n,r,s){if(Array.isArray(t))for(var i=0;i<t.length;i++)K(e,t[i],n,r,s);else r=o(r)?!!r.capture:!!r,n=Z(n),e&&e[U]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=$(i=e.g[t],n,r,s))&&(j(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete e.g[t],e.h--)))):e&&(e=Y(e))&&(t=e.g[t.toString()],e=-1,t&&(e=$(t,n,r,s)),(n=-1<e?t[e]:null)&&W(n))}function W(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[U])H(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Q(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Y(t))?(H(n,e),0==n.h&&(n.src=null,t[z]=null)):j(e)}}}function Q(e){return e in q?q[e]:q[e]="on"+e}function J(e,t){if(e.da)e=!0;else{t=new M(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&W(e),e=n.call(r,t)}return e}function Y(e){return(e=e[z])instanceof B?e:null}var X="__closure_events_fn_"+(1e9*Math.random()>>>0);function Z(e){return"function"==typeof e?e:(e[X]||(e[X]=function(t){return e.handleEvent(t)}),e[X])}function ee(){D.call(this),this.i=new B(this),this.M=this,this.F=null}function te(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new P(t,e);else if(t instanceof P)t.target=t.target||e;else{var s=t;T(t=new P(r,e),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=t.g=n[i];s=ne(o,r,!0,t)&&s}if(s=ne(o=t.g=e,r,!0,t)&&s,s=ne(o,r,!1,t)&&s,n)for(i=0;i<n.length;i++)s=ne(o=t.g=n[i],r,!1,t)&&s}function ne(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var s=!0,i=0;i<t.length;++i){var o=t[i];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&H(e.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}function re(e,t,n){if("function"==typeof e)n&&(e=u(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=u(e.handleEvent,e)}return 2147483647<Number(t)?-1:s.setTimeout(e,t||0)}function se(e){e.g=re(()=>{e.g=null,e.i&&(e.i=!1,se(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}l(ee,D),ee.prototype[U]=!0,ee.prototype.removeEventListener=function(e,t,n,r){K(this,e,t,n,r)},ee.prototype.N=function(){if(ee.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)j(n[r]);delete t.g[e],t.h--}}this.F=null},ee.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},ee.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class ie extends D{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:se(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function oe(e){D.call(this),this.h=e,this.g={}}l(oe,D);var ae=[];function ce(e){v(e.g,function(e,t){this.g.hasOwnProperty(t)&&W(e)},e),e.g={}}oe.prototype.N=function(){oe.aa.N.call(this),ce(this)},oe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ue=s.JSON.stringify,he=s.JSON.parse,le=class{stringify(e){return s.JSON.stringify(e,void 0)}parse(e){return s.JSON.parse(e,void 0)}};function de(){}function fe(e){return e.h||(e.h=e.i())}function pe(){}de.prototype.h=null;var ge={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function me(){P.call(this,"d")}function ye(){P.call(this,"c")}l(me,P),l(ye,P);var ve={},_e=null;function we(){return _e=_e||new ee}function Te(e){P.call(this,ve.La,e)}function Ee(e){const t=we();te(t,new Te(t))}function Se(e,t){P.call(this,ve.STAT_EVENT,e),this.stat=t}function Ie(e){const t=we();te(t,new Se(t,e))}function be(e,t){P.call(this,ve.Ma,e),this.size=t}function Ae(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){e()},t)}function Ce(){this.g=!0}function ke(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return ue(n)}catch(e){return t}}(e,n)+(r?" "+r:"")})}ve.La="serverreachability",l(Te,P),ve.STAT_EVENT="statevent",l(Se,P),ve.Ma="timingevent",l(be,P),Ce.prototype.xa=function(){this.g=!1},Ce.prototype.info=function(){};var Re,Oe={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Ne={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function De(){}function Pe(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new oe(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Le}function Le(){this.i=null,this.g="",this.h=!1}l(De,de),De.prototype.g=function(){return new XMLHttpRequest},De.prototype.i=function(){return{}},Re=new De;var Me={},xe={};function Ue(e,t,n){e.L=1,e.v=vt(st(t)),e.m=n,e.P=!0,Fe(e,null)}function Fe(e,t){e.F=Date.now(),Be(e),e.A=st(e.v);var n=e.A,r=e.R;Array.isArray(r)||(r=[String(r)]),Dt(n.i,"t",r),e.C=0,n=e.j.J,e.h=new Le,e.g=wn(e.j,n?t:null,!e.m),0<e.O&&(e.M=new ie(u(e.Y,e,e.g),e.O)),t=e.U,n=e.g,r=e.ca;var s="readystatechange";Array.isArray(s)||(s&&(ae[0]=s.toString()),s=ae);for(var i=0;i<s.length;i++){var o=G(n,s[i],r||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?_(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Ee(),function(e,t,n,r,s,i){e.info(function(){if(e.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Ve(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function je(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?xe:(n=Number(t.substring(n,r)),isNaN(n)?Me:(r+=1)+n>t.length?xe:(t=t.slice(r,r+n),e.C=r+n,t))}function Be(e){e.S=Date.now()+e.I,He(e,e.I)}function He(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ae(u(e.ba,e),t)}function $e(e){e.B&&(s.clearTimeout(e.B),e.B=null)}function ze(e){0==e.j.G||e.J||gn(e.j,e)}function qe(e){$e(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ce(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function Ge(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||Ye(n.h,e)))if(!e.K&&Ye(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;pn(n),rn(n)}ln(n),Ie(18)}}else n.za=s[1],0<n.za-n.T&&37500>s[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ae(u(n.Za,n),6e3));if(1>=Je(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else yn(n,11)}else if((e.K||n.g==e)&&pn(n),!p(t))for(s=n.Da.g.parse(t),t=0;t<s.length;t++){let u=s[t];if(n.T=u[0],u=u[1],2==n.G)if("c"==u[0]){n.K=u[1],n.ia=u[2];const t=u[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const s=u[4];null!=s&&(n.Aa=s,n.j.info("SVER="+n.Aa));const h=u[5];null!=h&&"number"==typeof h&&0<h&&(r=1.5*h,n.L=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;const l=e.g;if(l){const e=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var i=r.h;i.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(Xe(i,i.h),i.h=null))}if(r.D){const e=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.ya=e,yt(r.I,r.D,e))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var o=e;if((r=n).qa=_n(r,r.J?r.ia:null,r.W),o.K){Ze(r.h,o);var a=o,c=r.L;c&&(a.I=c),a.B&&($e(a),Be(a)),r.g=o}else hn(r);0<n.i.length&&on(n)}else"stop"!=u[0]&&"close"!=u[0]||yn(n,7);else 3==n.G&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?yn(n,7):nn(n):"noop"!=u[0]&&n.l&&n.l.ta(u),n.v=0)}Ee()}catch(e){}}Pe.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==Xt(e)?t.j():this.Y(e)},Pe.prototype.Y=function(e){try{if(e==this.g)e:{const d=Xt(this.g);var t=this.g.Ba();this.g.Z();if(!(3>d)&&(3!=d||this.g&&(this.h.h||this.g.oa()||Zt(this.g)))){this.J||4!=d||7==t||Ee(),$e(this);var n=this.g.Z();this.X=n;t:if(Ve(this)){var r=Zt(this.g);e="";var i=r.length,o=4==Xt(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){qe(this),ze(this);var a="";break t}this.h.i=new s.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(r[t],{stream:!(o&&t==i-1)});r.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,function(e,t,n,r,s,i,o){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+i+" "+o})}(this.i,this.u,this.A,this.l,this.R,d,n),this.o){if(this.T&&!this.K){t:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!p(c)){var h=c;break t}}h=null}if(!(n=h)){this.o=!1,this.s=3,Ie(12),qe(this),ze(this);break e}ke(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ge(this,n)}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;){if(e=je(this,a),e==xe){4==d&&(this.s=4,Ie(14),n=!1),ke(this.i,this.l,null,"[Incomplete Response]");break}if(e==Me){this.s=4,Ie(15),ke(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}ke(this.i,this.l,e,null),Ge(this,e)}if(Ve(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=a.length||this.h.h||(this.s=1,Ie(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var l=this.j;l.g==this&&l.ba&&!l.M&&(l.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),dn(l),l.M=!0,Ie(11))}}else ke(this.i,this.l,a,"[Invalid Chunked Response]"),qe(this),ze(this)}else ke(this.i,this.l,a,null),Ge(this,a);4==d&&qe(this),this.o&&!this.J&&(4==d?gn(this.j,this):(this.o=!1,Be(this)))}else(function(e){const t={};e=(e.g&&2<=Xt(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(p(e[r]))continue;var n=E(e[r]);const s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=t[s]||[];t[s]=i,i.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,Ie(12)):(this.s=0,Ie(13)),qe(this),ze(this)}}}catch(e){}},Pe.prototype.cancel=function(){this.J=!0,qe(this)},Pe.prototype.ba=function(){this.B=null;const e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Ee(),Ie(17)),qe(this),this.s=2,ze(this)):He(this,this.S-e)};var Ke=class{constructor(e,t){this.g=e,this.map=t}};function We(e){this.l=e||10,s.PerformanceNavigationTiming?e=0<(e=s.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(s.chrome&&s.chrome.loadTimes&&s.chrome.loadTimes()&&s.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Qe(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Je(e){return e.h?1:e.g?e.g.size:0}function Ye(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xe(e,t){e.g?e.g.add(t):e.h=t}function Ze(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function et(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.D);return t}return d(e.i)}function tt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(i(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(i(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const r in e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(i(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),s=r.length,o=0;o<s;o++)t.call(void 0,r[o],n&&n[o],e)}We.prototype.cancel=function(){if(this.i=et(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var nt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function rt(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof rt){this.h=e.h,it(this,e.j),this.o=e.o,this.g=e.g,ot(this,e.s),this.l=e.l;var t=e.i,n=new kt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),mt(this,n),this.m=e.m}else e&&(t=String(e).match(nt))?(this.h=!1,it(this,t[1]||"",!0),this.o=_t(t[2]||""),this.g=_t(t[3]||"",!0),ot(this,t[4]),this.l=_t(t[5]||"",!0),mt(this,t[6]||"",!0),this.m=_t(t[7]||"")):(this.h=!1,this.i=new kt(null,this.h))}function st(e){return new rt(e)}function it(e,t,n){e.j=n?_t(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function ot(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function mt(e,t,n){t instanceof kt?(e.i=t,function(e,t){t&&!e.j&&(Rt(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(Ot(this,t),Dt(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=wt(t,At)),e.i=new kt(t,e.h))}function yt(e,t,n){e.i.set(t,n)}function vt(e){return yt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function _t(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function wt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Tt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Tt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}rt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(wt(t,St,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(wt(t,St,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(wt(n,"/"==n.charAt(0)?bt:It,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",wt(n,Ct)),e.join("")};var Et,St=/[#\/\?@]/g,It=/[#\?:]/g,bt=/[#\?]/g,At=/[#\?@]/g,Ct=/#/g;function kt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Rt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),s=null;if(0<=r){var i=e[n].substring(0,r);s=e[n].substring(r+1)}else i=e[n];t(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function Ot(e,t){Rt(e),t=Pt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Nt(e,t){return Rt(e),t=Pt(e,t),e.g.has(t)}function Dt(e,t,n){Ot(e,t),0<n.length&&(e.i=null,e.g.set(Pt(e,t),d(n)),e.h+=n.length)}function Pt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Lt(e,t,n,r,s){try{s&&(s.onload=null,s.onerror=null,s.onabort=null,s.ontimeout=null),r(n)}catch(e){}}function Mt(){this.g=new le}function xt(e,t,n){const r=n||"";try{tt(e,function(e,n){let s=e;o(e)&&(s=ue(e)),t.push(r+n+"="+encodeURIComponent(s))})}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}function Ut(e){this.l=e.Ub||null,this.j=e.eb||!1}function Ft(e,t){ee.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function Vt(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function jt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,Bt(e)}function Bt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ht(e){let t="";return v(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function $t(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ht(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):yt(e,t,n))}function zt(e){ee.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=kt.prototype).add=function(e,t){Rt(this),this.i=null,e=Pt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Rt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.na=function(){Rt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let r=0;r<t.length;r++){const s=e[r];for(let e=0;e<s.length;e++)n.push(t[r])}return n},e.V=function(e){Rt(this);let t=[];if("string"==typeof e)Nt(this,e)&&(t=t.concat(this.g.get(Pt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Rt(this),this.i=null,Nt(this,e=Pt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var r=t[n];const i=encodeURIComponent(String(r)),o=this.V(r);for(r=0;r<o.length;r++){var s=i;""!==o[r]&&(s+="="+encodeURIComponent(String(o[r]))),e.push(s)}}return this.i=e.join("&")},l(Ut,de),Ut.prototype.g=function(){return new Ft(this.l,this.j)},Ut.prototype.i=(Et={},function(){return Et}),l(Ft,ee),(e=Ft.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,Bt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||s).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,jt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Bt(this)),this.g&&(this.readyState=3,Bt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==s.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Vt(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?jt(this):Bt(this),3==this.readyState&&Vt(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,jt(this))},e.Qa=function(e){this.g&&(this.response=e,jt(this))},e.ga=function(){this.g&&jt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Ft.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),l(zt,ee);var qt=/^https?$/i,Gt=["POST","PUT"];function Kt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Wt(e),Jt(e)}function Wt(e){e.A||(e.A=!0,te(e,"complete"),te(e,"error"))}function Qt(e){if(e.h&&void 0!==r&&(!e.v[1]||4!=Xt(e)||2!=e.Z()))if(e.u&&4==Xt(e))re(e.Ea,0,e);else if(te(e,"readystatechange"),4==Xt(e)){e.h=!1;try{const r=e.Z();e:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var i;if(i=0===r){var o=String(e.D).match(nt)[1]||null;!o&&s.self&&s.self.location&&(o=s.self.location.protocol.slice(0,-1)),i=!qt.test(o?o.toLowerCase():"")}n=i}if(n)te(e,"complete"),te(e,"success");else{e.m=6;try{var a=2<Xt(e)?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.Z()+"]",Wt(e)}}finally{Jt(e)}}}function Jt(e,t){if(e.g){Yt(e);const n=e.g,r=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||te(e,"ready");try{n.onreadystatechange=r}catch(e){}}}function Yt(e){e.I&&(s.clearTimeout(e.I),e.I=null)}function Xt(e){return e.g?e.g.readyState:0}function Zt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function en(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tn(e){this.Aa=0,this.i=[],this.j=new Ce,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=en("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=en("baseRetryDelayMs",5e3,e),this.cb=en("retryDelaySeedMs",1e4,e),this.Wa=en("forwardChannelMaxRetries",2,e),this.wa=en("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new We(e&&e.concurrentRequestLimit),this.Da=new Mt,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function nn(e){if(sn(e),3==e.G){var t=e.U++,n=st(e.I);if(yt(n,"SID",e.K),yt(n,"RID",t),yt(n,"TYPE","terminate"),cn(e,n),(t=new Pe(e,e.j,t)).L=2,t.v=vt(st(n)),n=!1,s.navigator&&s.navigator.sendBeacon)try{n=s.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&s.Image&&((new Image).src=t.v,n=!0),n||(t.g=wn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Be(t)}vn(e)}function rn(e){e.g&&(dn(e),e.g.cancel(),e.g=null)}function sn(e){rn(e),e.u&&(s.clearTimeout(e.u),e.u=null),pn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&s.clearTimeout(e.s),e.s=null)}function on(e){if(!Qe(e.h)&&!e.s){e.s=!0;var t=e.Ga;C||O(),k||(C(),k=!0),R.add(t,e),e.B=0}}function an(e,t){var n;n=t?t.l:e.U++;const r=st(e.I);yt(r,"SID",e.K),yt(r,"RID",n),yt(r,"AID",e.T),cn(e,r),e.m&&e.o&&$t(r,e.m,e.o),n=new Pe(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=un(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),Xe(e.h,n),Ue(n,r,t)}function cn(e,t){e.H&&v(e.H,function(e,n){yt(t,n,e)}),e.l&&tt({},function(e,n){yt(t,n,e)})}function un(e,t,n){n=Math.min(e.i.length,n);var r=e.l?u(e.l.Na,e.l,e):null;e:{var s=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=s[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let i=!0;for(let o=0;o<n;o++){let n=s[o].g;const a=s[o].map;if(n-=t,0>n)t=Math.max(0,s[o].g-100),i=!1;else try{xt(a,e,"req"+n+"_")}catch(e){r&&r(a)}}if(i){r=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,r}function hn(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;C||O(),k||(C(),k=!0),R.add(t,e),e.v=0}}function ln(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ae(u(e.Fa,e),mn(e,e.v)),e.v++,!0)}function dn(e){null!=e.A&&(s.clearTimeout(e.A),e.A=null)}function fn(e){e.g=new Pe(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=st(e.qa);yt(t,"RID","rpc"),yt(t,"SID",e.K),yt(t,"AID",e.T),yt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&yt(t,"TO",e.ja),yt(t,"TYPE","xmlhttp"),cn(e,t),e.m&&e.o&&$t(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=vt(st(t)),n.m=null,n.P=!0,Fe(n,e)}function pn(e){null!=e.C&&(s.clearTimeout(e.C),e.C=null)}function gn(e,t){var n=null;if(e.g==t){pn(e),dn(e),e.g=null;var r=2}else{if(!Ye(e.h,t))return;n=t.D,Ze(e.h,t),r=1}if(0!=e.G)if(t.o)if(1==r){n=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;te(r=we(),new be(r,n)),on(e)}else hn(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==r&&function(e,t){return!(Je(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ae(u(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==r&&ln(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),s){case 1:yn(e,5);break;case 4:yn(e,10);break;case 3:yn(e,6);break;default:yn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function yn(e,t){if(e.j.info("Error code "+t),2==t){var n=u(e.fb,e),r=e.Xa;const t=!r;r=new rt(r||"//www.google.com/images/cleardot.gif"),s.location&&"http"==s.location.protocol||it(r,"https"),vt(r),t?function(e,t){const n=new Ce;if(s.Image){const r=new Image;r.onload=h(Lt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=h(Lt,n,"TestLoadImage: error",!1,t,r),r.onabort=h(Lt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=h(Lt,n,"TestLoadImage: timeout",!1,t,r),s.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new Ce;const n=new AbortController,r=setTimeout(()=>{n.abort(),Lt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(r),e.ok?Lt(0,0,!0,t):Lt(0,0,!1,t)}).catch(()=>{clearTimeout(r),Lt(0,0,!1,t)})}(r.toString(),n)}else Ie(2);e.G=0,e.l&&e.l.sa(t),vn(e),sn(e)}function vn(e){if(e.G=0,e.ka=[],e.l){const t=et(e.h);0==t.length&&0==e.i.length||(f(e.ka,t),f(e.ka,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.ra()}}function _n(e,t,n){var r=n instanceof rt?st(n):new rt(n);if(""!=r.g)t&&(r.g=t+"."+r.g),ot(r,r.s);else{var i=s.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var o=new rt(null);r&&it(o,r),t&&(o.g=t),i&&ot(o,i),n&&(o.l=n),r=o}return n=e.D,t=e.ya,n&&t&&yt(r,n,t),yt(r,"VER",e.la),cn(e,r),r}function wn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new zt(new Ut({eb:n})):new zt(e.pa)).Ha(e.J),t}function Tn(){}function En(){}function Sn(e,t){ee.call(this),this.g=new tn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!p(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!p(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new An(this)}function In(e){me.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function bn(){ye.call(this),this.status=1}function An(e){this.g=e}(e=zt.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Re.g(),this.v=this.o?fe(this.o):fe(Re),this.g.onreadystatechange=u(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Kt(this,e)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),i=s.FormData&&e instanceof s.FormData,!(0<=Array.prototype.indexOf.call(Gt,t,void 0))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Yt(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){Kt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,te(this,"complete"),te(this,"abort"),Jt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Jt(this,!0)),zt.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Qt(this):this.bb())},e.bb=function(){Qt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<Xt(this)?this.g.status:-1}catch(e){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),he(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=tn.prototype).la=8,e.G=1,e.connect=function(e,t,n,r){Ie(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=_n(this,null,this.W),on(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;const s=new Pe(this,this.j,e);let i=this.o;if(this.S&&(i?(i=_(i),T(i,this.S)):i=this.S),null!==this.m||this.O||(s.H=i,i=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var r=this.i[n];if(void 0===(r="__data__"in r.map&&"string"==typeof(r=r.map.__data__)?r.length:void 0))break;if(4096<(t+=r)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=un(this,s,t),yt(n=st(this.I),"RID",e),yt(n,"CVER",22),this.D&&yt(n,"X-HTTP-Session-Id",this.D),cn(this,n),i&&(this.O?t="headers="+encodeURIComponent(String(Ht(i)))+"&"+t:this.m&&$t(n,this.m,i)),Xe(this.h,s),this.Ua&&yt(n,"TYPE","init"),this.P?(yt(n,"$req",t),yt(n,"SID","null"),s.T=!0,Ue(s,n,null)):Ue(s,n,t),this.G=2}}else 3==this.G&&(e?an(this,e):0==this.i.length||Qe(this.h)||an(this))},e.Fa=function(){if(this.u=null,fn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ae(u(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Ie(10),rn(this),fn(this))},e.Za=function(){null!=this.C&&(this.C=null,rn(this),ln(this),Ie(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Ie(2)):(this.j.info("Failed to ping google.com"),Ie(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=Tn.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},En.prototype.g=function(e,t){return new Sn(e,t)},l(Sn,ee),Sn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Sn.prototype.close=function(){nn(this.g)},Sn.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=ue(e),e=n);t.i.push(new Ke(t.Ya++,e)),3==t.G&&on(t)},Sn.prototype.N=function(){this.g.l=null,delete this.j,nn(this.g),delete this.g,Sn.aa.N.call(this)},l(In,me),l(bn,ye),l(An,Tn),An.prototype.ua=function(){te(this.g,"a")},An.prototype.ta=function(e){te(this.g,new In(e))},An.prototype.sa=function(e){te(this.g,new bn)},An.prototype.ra=function(){te(this.g,"b")},En.prototype.createWebChannel=En.prototype.g,Sn.prototype.send=Sn.prototype.o,Sn.prototype.open=Sn.prototype.m,Sn.prototype.close=Sn.prototype.close,pt=function(){return new En},ft=function(){return we()},dt=ve,lt={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Oe.NO_ERROR=0,Oe.TIMEOUT=8,Oe.HTTP_ERROR=6,ht=Oe,Ne.COMPLETE="complete",ut=Ne,pe.EventType=ge,ge.OPEN="a",ge.CLOSE="b",ge.ERROR="c",ge.MESSAGE="d",ee.prototype.listen=ee.prototype.K,ct=pe,zt.prototype.listenOnce=zt.prototype.L,zt.prototype.getLastError=zt.prototype.Ka,zt.prototype.getLastErrorCode=zt.prototype.Ba,zt.prototype.getStatus=zt.prototype.Z,zt.prototype.getResponseJson=zt.prototype.Oa,zt.prototype.getResponseText=zt.prototype.oa,zt.prototype.send=zt.prototype.ea,zt.prototype.setWithCredentials=zt.prototype.Ha,at=zt}).apply(void 0!==gt?gt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const mt="@firebase/firestore",yt="4.8.0";
|
|
349
|
+
var r=r||{},s=this||self;function i(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function o(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function a(e,t,n){return e.call.apply(e.bind,arguments)}function c(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function u(e,t,n){return(u=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?a:c).apply(null,arguments)}function h(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function l(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return t.prototype[n].apply(e,s)}}function d(e){const t=e.length;if(0<t){const n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function f(e,t){for(let t=1;t<arguments.length;t++){const n=arguments[t];if(i(n)){const t=e.length||0,r=n.length||0;e.length=t+r;for(let s=0;s<r;s++)e[t+s]=n[s]}else e.push(n)}}function p(e){return/^[\s\xa0]*$/.test(e)}function g(){var e=s.navigator;return e&&(e=e.userAgent)?e:""}function m(e){return m[" "](e),e}m[" "]=function(){};var y=!(-1==g().indexOf("Gecko")||-1!=g().toLowerCase().indexOf("webkit")&&-1==g().indexOf("Edge")||-1!=g().indexOf("Trident")||-1!=g().indexOf("MSIE")||-1!=g().indexOf("Edge"));function v(e,t,n){for(const r in e)t.call(n,e[r],r,e)}function _(e){const t={};for(const n in e)t[n]=e[n];return t}const w="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function T(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t],r)e[n]=r[n];for(let t=0;t<w.length;t++)n=w[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}function E(e){var t=1;e=e.split(":");const n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}function S(e){s.setTimeout(()=>{throw e},0)}function I(){var e=N;let t=null;return e.g&&(t=e.g,e.g=e.g.next,e.g||(e.h=null),t.next=null),t}var b=new class{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}(()=>new C,e=>e.reset());class C{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let A,k=!1,N=new class{constructor(){this.h=this.g=null}add(e,t){const n=b.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}},R=()=>{const e=s.Promise.resolve(void 0);A=()=>{e.then(O)}};var O=()=>{for(var e;e=I();){try{e.h.call(e.g)}catch(e){S(e)}var t=b;t.j(e),100>t.h&&(t.h++,e.next=t.g,t.g=e)}k=!1};function D(){this.s=this.s,this.C=this.C}function P(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}D.prototype.s=!1,D.prototype.ma=function(){this.s||(this.s=!0,this.N())},D.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},P.prototype.h=function(){this.defaultPrevented=!0};var L=function(){if(!s.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{const e=()=>{};s.addEventListener("test",e,t),s.removeEventListener("test",e,t)}catch(e){}return e}();function M(e,t){if(P.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(y){e:{try{m(t.nodeName);var s=!0;break e}catch(e){}s=!1}s||(t=null)}}else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:x[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&M.aa.h.call(this)}}l(M,P);var x={2:"touch",3:"pen",4:"mouse"};M.prototype.h=function(){M.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var U="closure_listenable_"+(1e6*Math.random()|0),F=0;function V(e,t,n,r,s){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=s,this.key=++F,this.da=this.fa=!1}function j(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function B(e){this.src=e,this.g={},this.h=0}function H(e,t){var n=t.type;if(n in e.g){var r,s=e.g[n],i=Array.prototype.indexOf.call(s,t,void 0);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(j(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function $(e,t,n,r){for(var s=0;s<e.length;++s){var i=e[s];if(!i.da&&i.listener==t&&i.capture==!!n&&i.ha==r)return s}return-1}B.prototype.add=function(e,t,n,r,s){var i=e.toString();(e=this.g[i])||(e=this.g[i]=[],this.h++);var o=$(e,t,r,s);return-1<o?(t=e[o],n||(t.fa=!1)):((t=new V(t,this.src,i,!!r,s)).fa=n,e.push(t)),t};var z="closure_lm_"+(1e6*Math.random()|0),q={};function K(e,t,n,r,s){if(Array.isArray(t)){for(var i=0;i<t.length;i++)K(e,t[i],n,r,s);return null}return n=Z(n),e&&e[U]?e.K(t,n,!!o(r)&&!!r.capture,s):function(e,t,n,r,s,i){if(!t)throw Error("Invalid event type");var a=o(s)?!!s.capture:!!s,c=Y(e);if(c||(e[z]=c=new B(e)),n=c.add(t,n,r,a,i),n.proxy)return n;if(r=function(){function e(n){return t.call(e.src,e.listener,n)}const t=J;return e}(),n.proxy=r,r.src=e,r.listener=n,e.addEventListener)L||(s=a),void 0===s&&(s=!1),e.addEventListener(t.toString(),r,s);else if(e.attachEvent)e.attachEvent(Q(t.toString()),r);else{if(!e.addListener||!e.removeListener)throw Error("addEventListener and attachEvent are unavailable.");e.addListener(r)}return n}(e,t,n,!1,r,s)}function G(e,t,n,r,s){if(Array.isArray(t))for(var i=0;i<t.length;i++)G(e,t[i],n,r,s);else r=o(r)?!!r.capture:!!r,n=Z(n),e&&e[U]?(e=e.i,(t=String(t).toString())in e.g&&(-1<(n=$(i=e.g[t],n,r,s))&&(j(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete e.g[t],e.h--)))):e&&(e=Y(e))&&(t=e.g[t.toString()],e=-1,t&&(e=$(t,n,r,s)),(n=-1<e?t[e]:null)&&W(n))}function W(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[U])H(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(Q(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=Y(t))?(H(n,e),0==n.h&&(n.src=null,t[z]=null)):j(e)}}}function Q(e){return e in q?q[e]:q[e]="on"+e}function J(e,t){if(e.da)e=!0;else{t=new M(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&W(e),e=n.call(r,t)}return e}function Y(e){return(e=e[z])instanceof B?e:null}var X="__closure_events_fn_"+(1e9*Math.random()>>>0);function Z(e){return"function"==typeof e?e:(e[X]||(e[X]=function(t){return e.handleEvent(t)}),e[X])}function ee(){D.call(this),this.i=new B(this),this.M=this,this.F=null}function te(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new P(t,e);else if(t instanceof P)t.target=t.target||e;else{var s=t;T(t=new P(r,e),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=t.g=n[i];s=ne(o,r,!0,t)&&s}if(s=ne(o=t.g=e,r,!0,t)&&s,s=ne(o,r,!1,t)&&s,n)for(i=0;i<n.length;i++)s=ne(o=t.g=n[i],r,!1,t)&&s}function ne(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var s=!0,i=0;i<t.length;++i){var o=t[i];if(o&&!o.da&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.fa&&H(e.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}function re(e,t,n){if("function"==typeof e)n&&(e=u(e,n));else{if(!e||"function"!=typeof e.handleEvent)throw Error("Invalid listener argument");e=u(e.handleEvent,e)}return 2147483647<Number(t)?-1:s.setTimeout(e,t||0)}function se(e){e.g=re(()=>{e.g=null,e.i&&(e.i=!1,se(e))},e.l);const t=e.h;e.h=null,e.m.apply(null,t)}l(ee,D),ee.prototype[U]=!0,ee.prototype.removeEventListener=function(e,t,n,r){G(this,e,t,n,r)},ee.prototype.N=function(){if(ee.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)j(n[r]);delete t.g[e],t.h--}}this.F=null},ee.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},ee.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class ie extends D{constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:se(this)}N(){super.N(),this.g&&(s.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function oe(e){D.call(this),this.h=e,this.g={}}l(oe,D);var ae=[];function ce(e){v(e.g,function(e,t){this.g.hasOwnProperty(t)&&W(e)},e),e.g={}}oe.prototype.N=function(){oe.aa.N.call(this),ce(this)},oe.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ue=s.JSON.stringify,he=s.JSON.parse,le=class{stringify(e){return s.JSON.stringify(e,void 0)}parse(e){return s.JSON.parse(e,void 0)}};function de(){}function fe(e){return e.h||(e.h=e.i())}function pe(){}de.prototype.h=null;var ge={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function me(){P.call(this,"d")}function ye(){P.call(this,"c")}l(me,P),l(ye,P);var ve={},_e=null;function we(){return _e=_e||new ee}function Te(e){P.call(this,ve.La,e)}function Ee(e){const t=we();te(t,new Te(t))}function Se(e,t){P.call(this,ve.STAT_EVENT,e),this.stat=t}function Ie(e){const t=we();te(t,new Se(t,e))}function be(e,t){P.call(this,ve.Ma,e),this.size=t}function Ce(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return s.setTimeout(function(){e()},t)}function Ae(){this.g=!0}function ke(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n)for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return ue(n)}catch(e){return t}}(e,n)+(r?" "+r:"")})}ve.La="serverreachability",l(Te,P),ve.STAT_EVENT="statevent",l(Se,P),ve.Ma="timingevent",l(be,P),Ae.prototype.xa=function(){this.g=!1},Ae.prototype.info=function(){};var Ne,Re={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},Oe={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function De(){}function Pe(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new oe(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new Le}function Le(){this.i=null,this.g="",this.h=!1}l(De,de),De.prototype.g=function(){return new XMLHttpRequest},De.prototype.i=function(){return{}},Ne=new De;var Me={},xe={};function Ue(e,t,n){e.L=1,e.v=vt(st(t)),e.m=n,e.P=!0,Fe(e,null)}function Fe(e,t){e.F=Date.now(),Be(e),e.A=st(e.v);var n=e.A,r=e.R;Array.isArray(r)||(r=[String(r)]),Dt(n.i,"t",r),e.C=0,n=e.j.J,e.h=new Le,e.g=wn(e.j,n?t:null,!e.m),0<e.O&&(e.M=new ie(u(e.Y,e,e.g),e.O)),t=e.U,n=e.g,r=e.ca;var s="readystatechange";Array.isArray(s)||(s&&(ae[0]=s.toString()),s=ae);for(var i=0;i<s.length;i++){var o=K(n,s[i],r||t.handleEvent,!1,t.h||t);if(!o)break;t.g[o.key]=o}t=e.H?_(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),Ee(),function(e,t,n,r,s,i){e.info(function(){if(e.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+t+"\n"+n+"\n"+o})}(e.i,e.u,e.A,e.l,e.R,e.m)}function Ve(e){return!!e.g&&("GET"==e.u&&2!=e.L&&e.j.Ca)}function je(e,t){var n=e.C,r=t.indexOf("\n",n);return-1==r?xe:(n=Number(t.substring(n,r)),isNaN(n)?Me:(r+=1)+n>t.length?xe:(t=t.slice(r,r+n),e.C=r+n,t))}function Be(e){e.S=Date.now()+e.I,He(e,e.I)}function He(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=Ce(u(e.ba,e),t)}function $e(e){e.B&&(s.clearTimeout(e.B),e.B=null)}function ze(e){0==e.j.G||e.J||gn(e.j,e)}function qe(e){$e(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ce(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function Ke(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||Ye(n.h,e)))if(!e.K&&Ye(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){e:if(!n.u){if(n.g){if(!(n.g.F+3e3<e.F))break e;pn(n),rn(n)}ln(n),Ie(18)}}else n.za=s[1],0<n.za-n.T&&37500>s[2]&&n.F&&0==n.v&&!n.C&&(n.C=Ce(u(n.Za,n),6e3));if(1>=Je(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else yn(n,11)}else if((e.K||n.g==e)&&pn(n),!p(t))for(s=n.Da.g.parse(t),t=0;t<s.length;t++){let u=s[t];if(n.T=u[0],u=u[1],2==n.G)if("c"==u[0]){n.K=u[1],n.ia=u[2];const t=u[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));const s=u[4];null!=s&&(n.Aa=s,n.j.info("SVER="+n.Aa));const h=u[5];null!=h&&"number"==typeof h&&0<h&&(r=1.5*h,n.L=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;const l=e.g;if(l){const e=l.g?l.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var i=r.h;i.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(i.j=i.l,i.g=new Set,i.h&&(Xe(i,i.h),i.h=null))}if(r.D){const e=l.g?l.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.ya=e,yt(r.I,r.D,e))}}n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms"));var o=e;if((r=n).qa=_n(r,r.J?r.ia:null,r.W),o.K){Ze(r.h,o);var a=o,c=r.L;c&&(a.I=c),a.B&&($e(a),Be(a)),r.g=o}else hn(r);0<n.i.length&&on(n)}else"stop"!=u[0]&&"close"!=u[0]||yn(n,7);else 3==n.G&&("stop"==u[0]||"close"==u[0]?"stop"==u[0]?yn(n,7):nn(n):"noop"!=u[0]&&n.l&&n.l.ta(u),n.v=0)}Ee()}catch(e){}}Pe.prototype.ca=function(e){e=e.target;const t=this.M;t&&3==Xt(e)?t.j():this.Y(e)},Pe.prototype.Y=function(e){try{if(e==this.g)e:{const d=Xt(this.g);var t=this.g.Ba();this.g.Z();if(!(3>d)&&(3!=d||this.g&&(this.h.h||this.g.oa()||Zt(this.g)))){this.J||4!=d||7==t||Ee(),$e(this);var n=this.g.Z();this.X=n;t:if(Ve(this)){var r=Zt(this.g);e="";var i=r.length,o=4==Xt(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){qe(this),ze(this);var a="";break t}this.h.i=new s.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(r[t],{stream:!(o&&t==i-1)});r.length=0,this.h.g+=e,this.C=0,a=this.h.g}else a=this.g.oa();if(this.o=200==n,function(e,t,n,r,s,i,o){e.info(function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+t+"\n"+n+"\n"+i+" "+o})}(this.i,this.u,this.A,this.l,this.R,d,n),this.o){if(this.T&&!this.K){t:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!p(c)){var h=c;break t}}h=null}if(!(n=h)){this.o=!1,this.s=3,Ie(12),qe(this),ze(this);break e}ke(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,Ke(this,n)}if(this.P){let e;for(n=!0;!this.J&&this.C<a.length;){if(e=je(this,a),e==xe){4==d&&(this.s=4,Ie(14),n=!1),ke(this.i,this.l,null,"[Incomplete Response]");break}if(e==Me){this.s=4,Ie(15),ke(this.i,this.l,a,"[Invalid Chunk]"),n=!1;break}ke(this.i,this.l,e,null),Ke(this,e)}if(Ve(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=a.length||this.h.h||(this.s=1,Ie(16),n=!1),this.o=this.o&&n,n){if(0<a.length&&!this.W){this.W=!0;var l=this.j;l.g==this&&l.ba&&!l.M&&(l.j.info("Great, no buffering proxy detected. Bytes received: "+a.length),dn(l),l.M=!0,Ie(11))}}else ke(this.i,this.l,a,"[Invalid Chunked Response]"),qe(this),ze(this)}else ke(this.i,this.l,a,null),Ke(this,a);4==d&&qe(this),this.o&&!this.J&&(4==d?gn(this.j,this):(this.o=!1,Be(this)))}else(function(e){const t={};e=(e.g&&2<=Xt(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(p(e[r]))continue;var n=E(e[r]);const s=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();const i=t[s]||[];t[s]=i,i.push(n)}!function(e,t){for(const n in e)t.call(void 0,e[n],n,e)}(t,function(e){return e.join(", ")})})(this.g),400==n&&0<a.indexOf("Unknown SID")?(this.s=3,Ie(12)):(this.s=0,Ie(13)),qe(this),ze(this)}}}catch(e){}},Pe.prototype.cancel=function(){this.J=!0,qe(this)},Pe.prototype.ba=function(){this.B=null;const e=Date.now();0<=e-this.S?(function(e,t){e.info(function(){return"TIMEOUT: "+t})}(this.i,this.A),2!=this.L&&(Ee(),Ie(17)),qe(this),this.s=2,ze(this)):He(this,this.S-e)};var Ge=class{constructor(e,t){this.g=e,this.map=t}};function We(e){this.l=e||10,s.PerformanceNavigationTiming?e=0<(e=s.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):e=!!(s.chrome&&s.chrome.loadTimes&&s.chrome.loadTimes()&&s.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function Qe(e){return!!e.h||!!e.g&&e.g.size>=e.j}function Je(e){return e.h?1:e.g?e.g.size:0}function Ye(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function Xe(e,t){e.g?e.g.add(t):e.h=t}function Ze(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function et(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(const n of e.g.values())t=t.concat(n.D);return t}return d(e.i)}function tt(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(i(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(i(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}t=[],n=0;for(const r in e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(i(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),s=r.length,o=0;o<s;o++)t.call(void 0,r[o],n&&n[o],e)}We.prototype.cancel=function(){if(this.i=et(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(const e of this.g.values())e.cancel();this.g.clear()}};var nt=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function rt(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof rt){this.h=e.h,it(this,e.j),this.o=e.o,this.g=e.g,ot(this,e.s),this.l=e.l;var t=e.i,n=new kt;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),mt(this,n),this.m=e.m}else e&&(t=String(e).match(nt))?(this.h=!1,it(this,t[1]||"",!0),this.o=_t(t[2]||""),this.g=_t(t[3]||"",!0),ot(this,t[4]),this.l=_t(t[5]||"",!0),mt(this,t[6]||"",!0),this.m=_t(t[7]||"")):(this.h=!1,this.i=new kt(null,this.h))}function st(e){return new rt(e)}function it(e,t,n){e.j=n?_t(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function ot(e,t){if(t){if(t=Number(t),isNaN(t)||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function mt(e,t,n){t instanceof kt?(e.i=t,function(e,t){t&&!e.j&&(Nt(e),e.i=null,e.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(Rt(this,t),Dt(this,n,e))},e)),e.j=t}(e.i,e.h)):(n||(t=wt(t,Ct)),e.i=new kt(t,e.h))}function yt(e,t,n){e.i.set(t,n)}function vt(e){return yt(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),e}function _t(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function wt(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,Tt),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function Tt(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}rt.prototype.toString=function(){var e=[],t=this.j;t&&e.push(wt(t,St,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(wt(t,St,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(wt(n,"/"==n.charAt(0)?bt:It,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",wt(n,At)),e.join("")};var Et,St=/[#\/\?@]/g,It=/[#\?:]/g,bt=/[#\?]/g,Ct=/[#\?@]/g,At=/#/g;function kt(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function Nt(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),s=null;if(0<=r){var i=e[n].substring(0,r);s=e[n].substring(r+1)}else i=e[n];t(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function Rt(e,t){Nt(e),t=Pt(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function Ot(e,t){return Nt(e),t=Pt(e,t),e.g.has(t)}function Dt(e,t,n){Rt(e,t),0<n.length&&(e.i=null,e.g.set(Pt(e,t),d(n)),e.h+=n.length)}function Pt(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function Lt(e,t,n,r,s){try{s&&(s.onload=null,s.onerror=null,s.onabort=null,s.ontimeout=null),r(n)}catch(e){}}function Mt(){this.g=new le}function xt(e,t,n){const r=n||"";try{tt(e,function(e,n){let s=e;o(e)&&(s=ue(e)),t.push(r+n+"="+encodeURIComponent(s))})}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}function Ut(e){this.l=e.Ub||null,this.j=e.eb||!1}function Ft(e,t){ee.call(this),this.D=e,this.o=t,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}function Vt(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function jt(e){e.readyState=4,e.l=null,e.j=null,e.v=null,Bt(e)}function Bt(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function Ht(e){let t="";return v(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}function $t(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=Ht(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):yt(e,t,n))}function zt(e){ee.call(this),this.headers=new Map,this.o=e||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}(e=kt.prototype).add=function(e,t){Nt(this),this.i=null,e=Pt(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},e.forEach=function(e,t){Nt(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},e.na=function(){Nt(this);const e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let r=0;r<t.length;r++){const s=e[r];for(let e=0;e<s.length;e++)n.push(t[r])}return n},e.V=function(e){Nt(this);let t=[];if("string"==typeof e)Ot(this,e)&&(t=t.concat(this.g.get(Pt(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},e.set=function(e,t){return Nt(this),this.i=null,Ot(this,e=Pt(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},e.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},e.toString=function(){if(this.i)return this.i;if(!this.g)return"";const e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var r=t[n];const i=encodeURIComponent(String(r)),o=this.V(r);for(r=0;r<o.length;r++){var s=i;""!==o[r]&&(s+="="+encodeURIComponent(String(o[r]))),e.push(s)}}return this.i=e.join("&")},l(Ut,de),Ut.prototype.g=function(){return new Ft(this.l,this.j)},Ut.prototype.i=(Et={},function(){return Et}),l(Ft,ee),(e=Ft.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,Bt(this)},e.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;const t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||s).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},e.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,jt(this)),this.readyState=0},e.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,Bt(this)),this.g&&(this.readyState=3,Bt(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==s.ReadableStream&&"body"in e){if(this.j=e.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;Vt(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},e.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?jt(this):Bt(this),3==this.readyState&&Vt(this)}},e.Ra=function(e){this.g&&(this.response=this.responseText=e,jt(this))},e.Qa=function(e){this.g&&(this.response=e,jt(this))},e.ga=function(){this.g&&jt(this)},e.setRequestHeader=function(e,t){this.u.append(e,t)},e.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},e.getAllResponseHeaders=function(){if(!this.h)return"";const e=[],t=this.h.entries();for(var n=t.next();!n.done;)n=n.value,e.push(n[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(Ft.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),l(zt,ee);var qt=/^https?$/i,Kt=["POST","PUT"];function Gt(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,Wt(e),Jt(e)}function Wt(e){e.A||(e.A=!0,te(e,"complete"),te(e,"error"))}function Qt(e){if(e.h&&void 0!==r&&(!e.v[1]||4!=Xt(e)||2!=e.Z()))if(e.u&&4==Xt(e))re(e.Ea,0,e);else if(te(e,"readystatechange"),4==Xt(e)){e.h=!1;try{const r=e.Z();e:switch(r){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t=!0;break e;default:t=!1}var n;if(!(n=t)){var i;if(i=0===r){var o=String(e.D).match(nt)[1]||null;!o&&s.self&&s.self.location&&(o=s.self.location.protocol.slice(0,-1)),i=!qt.test(o?o.toLowerCase():"")}n=i}if(n)te(e,"complete"),te(e,"success");else{e.m=6;try{var a=2<Xt(e)?e.g.statusText:""}catch(e){a=""}e.l=a+" ["+e.Z()+"]",Wt(e)}}finally{Jt(e)}}}function Jt(e,t){if(e.g){Yt(e);const n=e.g,r=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||te(e,"ready");try{n.onreadystatechange=r}catch(e){}}}function Yt(e){e.I&&(s.clearTimeout(e.I),e.I=null)}function Xt(e){return e.g?e.g.readyState:0}function Zt(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function en(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tn(e){this.Aa=0,this.i=[],this.j=new Ae,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=en("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=en("baseRetryDelayMs",5e3,e),this.cb=en("retryDelaySeedMs",1e4,e),this.Wa=en("forwardChannelMaxRetries",2,e),this.wa=en("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new We(e&&e.concurrentRequestLimit),this.Da=new Mt,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function nn(e){if(sn(e),3==e.G){var t=e.U++,n=st(e.I);if(yt(n,"SID",e.K),yt(n,"RID",t),yt(n,"TYPE","terminate"),cn(e,n),(t=new Pe(e,e.j,t)).L=2,t.v=vt(st(n)),n=!1,s.navigator&&s.navigator.sendBeacon)try{n=s.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&s.Image&&((new Image).src=t.v,n=!0),n||(t.g=wn(t.j,null),t.g.ea(t.v)),t.F=Date.now(),Be(t)}vn(e)}function rn(e){e.g&&(dn(e),e.g.cancel(),e.g=null)}function sn(e){rn(e),e.u&&(s.clearTimeout(e.u),e.u=null),pn(e),e.h.cancel(),e.s&&("number"==typeof e.s&&s.clearTimeout(e.s),e.s=null)}function on(e){if(!Qe(e.h)&&!e.s){e.s=!0;var t=e.Ga;A||R(),k||(A(),k=!0),N.add(t,e),e.B=0}}function an(e,t){var n;n=t?t.l:e.U++;const r=st(e.I);yt(r,"SID",e.K),yt(r,"RID",n),yt(r,"AID",e.T),cn(e,r),e.m&&e.o&&$t(r,e.m,e.o),n=new Pe(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=un(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),Xe(e.h,n),Ue(n,r,t)}function cn(e,t){e.H&&v(e.H,function(e,n){yt(t,n,e)}),e.l&&tt({},function(e,n){yt(t,n,e)})}function un(e,t,n){n=Math.min(e.i.length,n);var r=e.l?u(e.l.Na,e.l,e):null;e:{var s=e.i;let t=-1;for(;;){const e=["count="+n];-1==t?0<n?(t=s[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let i=!0;for(let o=0;o<n;o++){let n=s[o].g;const a=s[o].map;if(n-=t,0>n)t=Math.max(0,s[o].g-100),i=!1;else try{xt(a,e,"req"+n+"_")}catch(e){r&&r(a)}}if(i){r=e.join("&");break e}}}return e=e.i.splice(0,n),t.D=e,r}function hn(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;A||R(),k||(A(),k=!0),N.add(t,e),e.v=0}}function ln(e){return!(e.g||e.u||3<=e.v)&&(e.Y++,e.u=Ce(u(e.Fa,e),mn(e,e.v)),e.v++,!0)}function dn(e){null!=e.A&&(s.clearTimeout(e.A),e.A=null)}function fn(e){e.g=new Pe(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=st(e.qa);yt(t,"RID","rpc"),yt(t,"SID",e.K),yt(t,"AID",e.T),yt(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&yt(t,"TO",e.ja),yt(t,"TYPE","xmlhttp"),cn(e,t),e.m&&e.o&&$t(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=vt(st(t)),n.m=null,n.P=!0,Fe(n,e)}function pn(e){null!=e.C&&(s.clearTimeout(e.C),e.C=null)}function gn(e,t){var n=null;if(e.g==t){pn(e),dn(e),e.g=null;var r=2}else{if(!Ye(e.h,t))return;n=t.D,Ze(e.h,t),r=1}if(0!=e.G)if(t.o)if(1==r){n=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;te(r=we(),new be(r,n)),on(e)}else hn(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==r&&function(e,t){return!(Je(e.h)>=e.h.j-(e.s?1:0)||(e.s?(e.i=t.D.concat(e.i),0):1==e.G||2==e.G||e.B>=(e.Va?0:e.Wa)||(e.s=Ce(u(e.Ga,e,t),mn(e,e.B)),e.B++,0)))}(e,t)||2==r&&ln(e)))switch(n&&0<n.length&&(t=e.h,t.i=t.i.concat(n)),s){case 1:yn(e,5);break;case 4:yn(e,10);break;case 3:yn(e,6);break;default:yn(e,2)}}function mn(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function yn(e,t){if(e.j.info("Error code "+t),2==t){var n=u(e.fb,e),r=e.Xa;const t=!r;r=new rt(r||"//www.google.com/images/cleardot.gif"),s.location&&"http"==s.location.protocol||it(r,"https"),vt(r),t?function(e,t){const n=new Ae;if(s.Image){const r=new Image;r.onload=h(Lt,n,"TestLoadImage: loaded",!0,t,r),r.onerror=h(Lt,n,"TestLoadImage: error",!1,t,r),r.onabort=h(Lt,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=h(Lt,n,"TestLoadImage: timeout",!1,t,r),s.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){new Ae;const n=new AbortController,r=setTimeout(()=>{n.abort(),Lt(0,0,!1,t)},1e4);fetch(e,{signal:n.signal}).then(e=>{clearTimeout(r),e.ok?Lt(0,0,!0,t):Lt(0,0,!1,t)}).catch(()=>{clearTimeout(r),Lt(0,0,!1,t)})}(r.toString(),n)}else Ie(2);e.G=0,e.l&&e.l.sa(t),vn(e),sn(e)}function vn(e){if(e.G=0,e.ka=[],e.l){const t=et(e.h);0==t.length&&0==e.i.length||(f(e.ka,t),f(e.ka,e.i),e.h.i.length=0,d(e.i),e.i.length=0),e.l.ra()}}function _n(e,t,n){var r=n instanceof rt?st(n):new rt(n);if(""!=r.g)t&&(r.g=t+"."+r.g),ot(r,r.s);else{var i=s.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var o=new rt(null);r&&it(o,r),t&&(o.g=t),i&&ot(o,i),n&&(o.l=n),r=o}return n=e.D,t=e.ya,n&&t&&yt(r,n,t),yt(r,"VER",e.la),cn(e,r),r}function wn(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=e.Ca&&!e.pa?new zt(new Ut({eb:n})):new zt(e.pa)).Ha(e.J),t}function Tn(){}function En(){}function Sn(e,t){ee.call(this),this.g=new tn(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!p(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!p(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&(t in(e=this.h)&&delete e[t])),this.j=new Cn(this)}function In(e){me.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(const n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function bn(){ye.call(this),this.status=1}function Cn(e){this.g=e}(e=zt.prototype).Ha=function(e){this.J=e},e.ea=function(e,t,n,r){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);t=t?t.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():Ne.g(),this.v=this.o?fe(this.o):fe(Ne),this.g.onreadystatechange=u(this.Ea,this);try{this.B=!0,this.g.open(t,String(e),!0),this.B=!1}catch(e){return void Gt(this,e)}if(e=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var i in r)n.set(i,r[i]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));for(const e of r.keys())n.set(e,r.get(e))}r=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),i=s.FormData&&e instanceof s.FormData,!(0<=Array.prototype.indexOf.call(Kt,t,void 0))||r||i||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[e,t]of n)this.g.setRequestHeader(e,t);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Yt(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){Gt(this,e)}},e.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,te(this,"complete"),te(this,"abort"),Jt(this))},e.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),Jt(this,!0)),zt.aa.N.call(this)},e.Ea=function(){this.s||(this.B||this.u||this.j?Qt(this):this.bb())},e.bb=function(){Qt(this)},e.isActive=function(){return!!this.g},e.Z=function(){try{return 2<Xt(this)?this.g.status:-1}catch(e){return-1}},e.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},e.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),he(t)}},e.Ba=function(){return this.m},e.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(e=tn.prototype).la=8,e.G=1,e.connect=function(e,t,n,r){Ie(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=_n(this,null,this.W),on(this)},e.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;const s=new Pe(this,this.j,e);let i=this.o;if(this.S&&(i?(i=_(i),T(i,this.S)):i=this.S),null!==this.m||this.O||(s.H=i,i=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){var r=this.i[n];if(void 0===(r="__data__"in r.map&&"string"==typeof(r=r.map.__data__)?r.length:void 0))break;if(4096<(t+=r)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=un(this,s,t),yt(n=st(this.I),"RID",e),yt(n,"CVER",22),this.D&&yt(n,"X-HTTP-Session-Id",this.D),cn(this,n),i&&(this.O?t="headers="+encodeURIComponent(String(Ht(i)))+"&"+t:this.m&&$t(n,this.m,i)),Xe(this.h,s),this.Ua&&yt(n,"TYPE","init"),this.P?(yt(n,"$req",t),yt(n,"SID","null"),s.T=!0,Ue(s,n,null)):Ue(s,n,t),this.G=2}}else 3==this.G&&(e?an(this,e):0==this.i.length||Qe(this.h)||an(this))},e.Fa=function(){if(this.u=null,fn(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=Ce(u(this.ab,this),e)}},e.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Ie(10),rn(this),fn(this))},e.Za=function(){null!=this.C&&(this.C=null,rn(this),ln(this),Ie(19))},e.fb=function(e){e?(this.j.info("Successfully pinged google.com"),Ie(2)):(this.j.info("Failed to ping google.com"),Ie(1))},e.isActive=function(){return!!this.l&&this.l.isActive(this)},(e=Tn.prototype).ua=function(){},e.ta=function(){},e.sa=function(){},e.ra=function(){},e.isActive=function(){return!0},e.Na=function(){},En.prototype.g=function(e,t){return new Sn(e,t)},l(Sn,ee),Sn.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},Sn.prototype.close=function(){nn(this.g)},Sn.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=ue(e),e=n);t.i.push(new Ge(t.Ya++,e)),3==t.G&&on(t)},Sn.prototype.N=function(){this.g.l=null,delete this.j,nn(this.g),delete this.g,Sn.aa.N.call(this)},l(In,me),l(bn,ye),l(Cn,Tn),Cn.prototype.ua=function(){te(this.g,"a")},Cn.prototype.ta=function(e){te(this.g,new In(e))},Cn.prototype.sa=function(e){te(this.g,new bn)},Cn.prototype.ra=function(){te(this.g,"b")},En.prototype.createWebChannel=En.prototype.g,Sn.prototype.send=Sn.prototype.o,Sn.prototype.open=Sn.prototype.m,Sn.prototype.close=Sn.prototype.close,pt=function(){return new En},ft=function(){return we()},dt=ve,lt={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},Re.NO_ERROR=0,Re.TIMEOUT=8,Re.HTTP_ERROR=6,ht=Re,Oe.COMPLETE="complete",ut=Oe,pe.EventType=ge,ge.OPEN="a",ge.CLOSE="b",ge.ERROR="c",ge.MESSAGE="d",ee.prototype.listen=ee.prototype.K,ct=pe,zt.prototype.listenOnce=zt.prototype.L,zt.prototype.getLastError=zt.prototype.Ka,zt.prototype.getLastErrorCode=zt.prototype.Ba,zt.prototype.getStatus=zt.prototype.Z,zt.prototype.getResponseJson=zt.prototype.Oa,zt.prototype.getResponseText=zt.prototype.oa,zt.prototype.send=zt.prototype.ea,zt.prototype.setWithCredentials=zt.prototype.Ha,at=zt}).apply(void 0!==gt?gt:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});const mt="@firebase/firestore",yt="4.8.0";
|
|
350
350
|
/**
|
|
351
351
|
* @license
|
|
352
352
|
* Copyright 2017 Google LLC
|
|
@@ -428,7 +428,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
428
428
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
429
429
|
* See the License for the specific language governing permissions and
|
|
430
430
|
* limitations under the License.
|
|
431
|
-
*/function
|
|
431
|
+
*/function Ct(e,t,n){let r="Unexpected state";"string"==typeof t?r=t:n=t,At(e,r,n)}function At(e,t,n){let r=`FIRESTORE (${_t}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{r+=" CONTEXT: "+JSON.stringify(n)}catch(e){r+=" CONTEXT: "+n}throw St(r),new Error(r)}function kt(e,t,n,r){let s="Unexpected state";"string"==typeof n?s=n:r=n,e||At(t,s,r)}function Nt(e,t){return e}
|
|
432
432
|
/**
|
|
433
433
|
* @license
|
|
434
434
|
* Copyright 2017 Google LLC
|
|
@@ -444,7 +444,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
444
444
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
445
445
|
* See the License for the specific language governing permissions and
|
|
446
446
|
* limitations under the License.
|
|
447
|
-
*/const
|
|
447
|
+
*/const Rt={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class Ot extends w{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}
|
|
448
448
|
/**
|
|
449
449
|
* @license
|
|
450
450
|
* Copyright 2017 Google LLC
|
|
@@ -524,7 +524,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
524
524
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
525
525
|
* See the License for the specific language governing permissions and
|
|
526
526
|
* limitations under the License.
|
|
527
|
-
*/class $t{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=Bt(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function zt(e,t){return e<t?-1:e>t?1:0}function qt(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=e.codePointAt(n),s=t.codePointAt(n);if(r!==s){if(r<128&&s<128)return zt(r,s);{const i=Ht(),o=
|
|
527
|
+
*/class $t{static newId(){const e=62*Math.floor(256/62);let t="";for(;t.length<20;){const n=Bt(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function zt(e,t){return e<t?-1:e>t?1:0}function qt(e,t){let n=0;for(;n<e.length&&n<t.length;){const r=e.codePointAt(n),s=t.codePointAt(n);if(r!==s){if(r<128&&s<128)return zt(r,s);{const i=Ht(),o=Gt(i.encode(Kt(e,n)),i.encode(Kt(t,n)));return 0!==o?o:zt(r,s)}}n+=r>65535?2:1}return zt(e.length,t.length)}function Kt(e,t){return e.codePointAt(t)>65535?e.substring(t,t+2):e.substring(t,t+1)}function Gt(e,t){for(let n=0;n<e.length&&n<t.length;++n)if(e[n]!==t[n])return zt(e[n],t[n]);return zt(e.length,t.length)}function Wt(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}
|
|
528
528
|
/**
|
|
529
529
|
* @license
|
|
530
530
|
* Copyright 2017 Google LLC
|
|
@@ -540,7 +540,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
540
540
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
541
541
|
* See the License for the specific language governing permissions and
|
|
542
542
|
* limitations under the License.
|
|
543
|
-
*/const Qt="__name__";class Jt{constructor(e,t,n){void 0===t?t=0:t>e.length&&
|
|
543
|
+
*/const Qt="__name__";class Jt{constructor(e,t,n){void 0===t?t=0:t>e.length&&Ct(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&Ct(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===Jt.comparator(this,e)}child(e){const t=this.segments.slice(this.offset,this.limit());return e instanceof Jt?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){const n=Math.min(e.length,t.length);for(let r=0;r<n;r++){const n=Jt.compareSegments(e.get(r),t.get(r));if(0!==n)return n}return zt(e.length,t.length)}static compareSegments(e,t){const n=Jt.isNumericId(e),r=Jt.isNumericId(t);return n&&!r?-1:!n&&r?1:n&&r?Jt.extractNumericId(e).compare(Jt.extractNumericId(t)):qt(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return st.fromString(e.substring(4,e.length-2))}}class Yt extends Jt{construct(e,t,n){return new Yt(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const t=[];for(const n of e){if(n.indexOf("//")>=0)throw new Ot(Rt.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new Yt(t)}static emptyPath(){return new Yt([])}}const Xt=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Zt extends Jt{construct(e,t,n){return new Zt(e,t,n)}static isValidIdentifier(e){return Xt.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Zt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Qt}static keyField(){return new Zt([Qt])}static fromServerFormat(e){const t=[];let n="",r=0;const s=()=>{if(0===n.length)throw new Ot(Rt.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""};let i=!1;for(;r<e.length;){const t=e[r];if("\\"===t){if(r+1===e.length)throw new Ot(Rt.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new Ot(Rt.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?(i=!i,r++):"."!==t||i?(n+=t,r++):(s(),r++)}if(s(),i)throw new Ot(Rt.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Zt(t)}static emptyPath(){return new Zt([])}}
|
|
544
544
|
/**
|
|
545
545
|
* @license
|
|
546
546
|
* Copyright 2017 Google LLC
|
|
@@ -572,7 +572,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
572
572
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
573
573
|
* See the License for the specific language governing permissions and
|
|
574
574
|
* limitations under the License.
|
|
575
|
-
*/function tn(e,t,n){if(!n)throw new
|
|
575
|
+
*/function tn(e,t,n){if(!n)throw new Ot(Rt.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function nn(e){if(!en.isDocumentKey(e))throw new Ot(Rt.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function rn(e){if(en.isDocumentKey(e))throw new Ot(Rt.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function sn(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function on(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{const t=function(e){return e.constructor?e.constructor.name:null}(e);return t?`a custom ${t} object`:"an object"}}return"function"==typeof e?"a function":Ct(12329,{type:typeof e})}function an(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new Ot(Rt.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=on(e);throw new Ot(Rt.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}
|
|
576
576
|
/**
|
|
577
577
|
* @license
|
|
578
578
|
* Copyright 2025 Google LLC
|
|
@@ -588,7 +588,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
588
588
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
589
589
|
* See the License for the specific language governing permissions and
|
|
590
590
|
* limitations under the License.
|
|
591
|
-
*/function cn(e,t){const n={typeString:e};return t&&(n.value=t),n}function un(e,t){if(!sn(e))throw new
|
|
591
|
+
*/function cn(e,t){const n={typeString:e};return t&&(n.value=t),n}function un(e,t){if(!sn(e))throw new Ot(Rt.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in t)if(t[r]){const s=t[r].typeString,i="value"in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}const o=e[r];if(s&&typeof o!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(void 0!==i&&o!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new Ot(Rt.INVALID_ARGUMENT,n);return!0}
|
|
592
592
|
/**
|
|
593
593
|
* @license
|
|
594
594
|
* Copyright 2017 Google LLC
|
|
@@ -604,7 +604,7 @@ return function(e){return JSON.stringify(e)}(e)}catch(t){return e}}
|
|
|
604
604
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
605
605
|
* See the License for the specific language governing permissions and
|
|
606
606
|
* limitations under the License.
|
|
607
|
-
*/const hn=-62135596800,ln=1e6;class dn{static now(){return dn.fromMillis(Date.now())}static fromDate(e){return dn.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*ln);return new dn(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new
|
|
607
|
+
*/const hn=-62135596800,ln=1e6;class dn{static now(){return dn.fromMillis(Date.now())}static fromDate(e){return dn.fromMillis(e.getTime())}static fromMillis(e){const t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*ln);return new dn(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0)throw new Ot(Rt.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(t>=1e9)throw new Ot(Rt.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<hn)throw new Ot(Rt.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Ot(Rt.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/ln}_compareTo(e){return this.seconds===e.seconds?zt(this.nanoseconds,e.nanoseconds):zt(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:dn._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(un(e,dn._jsonSchema))return new dn(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-hn;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}dn._jsonSchemaVersion="firestore/timestamp/1.0",dn._jsonSchema={type:cn("string",dn._jsonSchemaVersion),seconds:cn("number"),nanoseconds:cn("number")};
|
|
608
608
|
/**
|
|
609
609
|
* @license
|
|
610
610
|
* Copyright 2017 Google LLC
|
|
@@ -669,7 +669,7 @@ class fn{static fromTimestamp(e){return new fn(e)}static min(){return new fn(new
|
|
|
669
669
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
670
670
|
* See the License for the specific language governing permissions and
|
|
671
671
|
* limitations under the License.
|
|
672
|
-
*/async function vn(e){if(e.code!==
|
|
672
|
+
*/async function vn(e){if(e.code!==Rt.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;Et("LocalStore","Unexpectedly lost primary lease")}
|
|
673
673
|
/**
|
|
674
674
|
* @license
|
|
675
675
|
* Copyright 2017 Google LLC
|
|
@@ -685,7 +685,7 @@ class fn{static fromTimestamp(e){return new fn(e)}static min(){return new fn(new
|
|
|
685
685
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
686
686
|
* See the License for the specific language governing permissions and
|
|
687
687
|
* limitations under the License.
|
|
688
|
-
*/class _n{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&
|
|
688
|
+
*/class _n{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&Ct(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new _n((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{const t=e();return t instanceof _n?t:_n.resolve(t)}catch(e){return _n.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):_n.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):_n.reject(t)}static resolve(e){return new _n((t,n)=>{t(e)})}static reject(e){return new _n((t,n)=>{n(e)})}static waitFor(e){return new _n((t,n)=>{let r=0,s=0,i=!1;e.forEach(e=>{++r,e.next(()=>{++s,i&&s===r&&t()},e=>n(e))}),i=!0,s===r&&t()})}static or(e){let t=_n.resolve(!1);for(const n of e)t=t.next(e=>e?_n.resolve(e):n());return t}static forEach(e,t){const n=[];return e.forEach((e,r)=>{n.push(t.call(this,e,r))}),this.waitFor(n)}static mapArray(e,t){return new _n((n,r)=>{const s=e.length,i=new Array(s);let o=0;for(let a=0;a<s;a++){const c=a;t(e[c]).next(e=>{i[c]=e,++o,o===s&&n(i)},e=>r(e))}})}static doWhile(e,t){return new _n((n,r)=>{const s=()=>{!0===e()?t().next(()=>{s()},r):n()};s()})}}function wn(e){return"IndexedDbTransactionError"===e.name}
|
|
689
689
|
/**
|
|
690
690
|
* @license
|
|
691
691
|
* Copyright 2018 Google LLC
|
|
@@ -717,7 +717,7 @@ class fn{static fromTimestamp(e){return new fn(e)}static min(){return new fn(new
|
|
|
717
717
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
718
718
|
* See the License for the specific language governing permissions and
|
|
719
719
|
* limitations under the License.
|
|
720
|
-
*/function
|
|
720
|
+
*/function Cn(e){let t=0;for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function An(e,t){for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function kn(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}
|
|
721
721
|
/**
|
|
722
722
|
* @license
|
|
723
723
|
* Copyright 2017 Google LLC
|
|
@@ -733,7 +733,7 @@ class fn{static fromTimestamp(e){return new fn(e)}static min(){return new fn(new
|
|
|
733
733
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
734
734
|
* See the License for the specific language governing permissions and
|
|
735
735
|
* limitations under the License.
|
|
736
|
-
*/class
|
|
736
|
+
*/class Nn{constructor(e,t){this.comparator=e,this.root=t||On.EMPTY}insert(e,t){return new Nn(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,On.BLACK,null,null))}remove(e){return new Nn(this.comparator,this.root.remove(e,this.comparator).copy(null,null,On.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){const n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,n)=>(e(t,n),!1))}toString(){const e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new Rn(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Rn(this.root,e,this.comparator,!1)}getReverseIterator(){return new Rn(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Rn(this.root,e,this.comparator,!0)}}class Rn{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,t&&r&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(0===s){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const t={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class On{constructor(e,t,n,r,s){this.key=e,this.value=t,this.color=null!=n?n:On.RED,this.left=null!=r?r:On.EMPTY,this.right=null!=s?s:On.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,s){return new On(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=s?s:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this;const s=n(e,r.key);return r=s<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===s?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n)),r.fixUp()}removeMin(){if(this.left.isEmpty())return On.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,t){let n,r=this;if(t(e,r.key)<0)r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return On.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,On.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,On.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw Ct(43730,{key:this.key,value:this.value});if(this.right.isRed())throw Ct(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw Ct(27949);return e+(this.isRed()?0:1)}}On.EMPTY=null,On.RED=!0,On.BLACK=!1,On.EMPTY=new class{constructor(){this.size=0}get key(){throw Ct(57766)}get value(){throw Ct(16141)}get color(){throw Ct(16727)}get left(){throw Ct(29726)}get right(){throw Ct(36894)}copy(e,t,n,r,s){return this}insert(e,t,n){return new On(e,t)}remove(e,t){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};
|
|
737
737
|
/**
|
|
738
738
|
* @license
|
|
739
739
|
* Copyright 2017 Google LLC
|
|
@@ -750,7 +750,7 @@ class fn{static fromTimestamp(e){return new fn(e)}static min(){return new fn(new
|
|
|
750
750
|
* See the License for the specific language governing permissions and
|
|
751
751
|
* limitations under the License.
|
|
752
752
|
*/
|
|
753
|
-
class Dn{constructor(e){this.comparator=e,this.data=new
|
|
753
|
+
class Dn{constructor(e){this.comparator=e,this.data=new Nn(this.comparator)}has(e){return null!==this.data.get(e)}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((t,n)=>(e(t),!1))}forEachInRange(e,t){const n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){const r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){const t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new Pn(this.data.getIterator())}getIteratorFrom(e){return new Pn(this.data.getIteratorFrom(e))}add(e){return this.copy(this.data.remove(e).insert(e,!0))}delete(e){return this.has(e)?this.copy(this.data.remove(e)):this}isEmpty(){return this.data.isEmpty()}unionWith(e){let t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof Dn))return!1;if(this.size!==e.size)return!1;const t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){const e=[];return this.forEach(t=>{e.push(t)}),e}toString(){const e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){const t=new Dn(this.comparator);return t.data=e,t}}class Pn{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}
|
|
754
754
|
/**
|
|
755
755
|
* @license
|
|
756
756
|
* Copyright 2020 Google LLC
|
|
@@ -830,7 +830,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
830
830
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
831
831
|
* See the License for the specific language governing permissions and
|
|
832
832
|
* limitations under the License.
|
|
833
|
-
*/const Bn="server_timestamp",Hn="__type__",$n="__previous_value__",zn="__local_write_time__";function qn(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Hn])||void 0===n?void 0:n.stringValue)===Bn}function
|
|
833
|
+
*/const Bn="server_timestamp",Hn="__type__",$n="__previous_value__",zn="__local_write_time__";function qn(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Hn])||void 0===n?void 0:n.stringValue)===Bn}function Kn(e){const t=e.mapValue.fields[$n];return qn(t)?Kn(t):t}function Gn(e){const t=Fn(e.mapValue.fields[zn].timestampValue);return new dn(t.seconds,t.nanos)}
|
|
834
834
|
/**
|
|
835
835
|
* @license
|
|
836
836
|
* Copyright 2017 Google LLC
|
|
@@ -878,7 +878,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
878
878
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
879
879
|
* See the License for the specific language governing permissions and
|
|
880
880
|
* limitations under the License.
|
|
881
|
-
*/(e)?9007199254740991:function(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Yn])||void 0===n?void 0:n.stringValue)===er}(e)?10:11:
|
|
881
|
+
*/(e)?9007199254740991:function(e){var t,n;return(null===(n=((null===(t=null==e?void 0:e.mapValue)||void 0===t?void 0:t.fields)||{})[Yn])||void 0===n?void 0:n.stringValue)===er}(e)?10:11:Ct(28295,{value:e})}function rr(e,t){if(e===t)return!0;const n=nr(e);if(n!==nr(t))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return Gn(e).isEqual(Gn(t));case 3:return function(e,t){if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;const n=Fn(e.timestampValue),r=Fn(t.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(e,t);case 5:return e.stringValue===t.stringValue;case 6:return function(e,t){return jn(e.bytesValue).isEqual(jn(t.bytesValue))}(e,t);case 7:return e.referenceValue===t.referenceValue;case 8:return function(e,t){return Vn(e.geoPointValue.latitude)===Vn(t.geoPointValue.latitude)&&Vn(e.geoPointValue.longitude)===Vn(t.geoPointValue.longitude)}(e,t);case 2:return function(e,t){if("integerValue"in e&&"integerValue"in t)return Vn(e.integerValue)===Vn(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){const n=Vn(e.doubleValue),r=Vn(t.doubleValue);return n===r?Sn(n)===Sn(r):isNaN(n)&&isNaN(r)}return!1}(e,t);case 9:return Wt(e.arrayValue.values||[],t.arrayValue.values||[],rr);case 10:case 11:return function(e,t){const n=e.mapValue.fields||{},r=t.mapValue.fields||{};if(Cn(n)!==Cn(r))return!1;for(const e in n)if(n.hasOwnProperty(e)&&(void 0===r[e]||!rr(n[e],r[e])))return!1;return!0}(e,t);default:return Ct(52216,{left:e})}}function sr(e,t){return void 0!==(e.values||[]).find(e=>rr(e,t))}function ir(e,t){if(e===t)return 0;const n=nr(e),r=nr(t);if(n!==r)return zt(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return zt(e.booleanValue,t.booleanValue);case 2:return function(e,t){const n=Vn(e.integerValue||e.doubleValue),r=Vn(t.integerValue||t.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(e,t);case 3:return or(e.timestampValue,t.timestampValue);case 4:return or(Gn(e),Gn(t));case 5:return qt(e.stringValue,t.stringValue);case 6:return function(e,t){const n=jn(e),r=jn(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){const n=e.split("/"),r=t.split("/");for(let e=0;e<n.length&&e<r.length;e++){const t=zt(n[e],r[e]);if(0!==t)return t}return zt(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){const n=zt(Vn(e.latitude),Vn(t.latitude));return 0!==n?n:zt(Vn(e.longitude),Vn(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return ar(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,r,s,i;const o=e.fields||{},a=t.fields||{},c=null===(n=o[tr])||void 0===n?void 0:n.arrayValue,u=null===(r=a[tr])||void 0===r?void 0:r.arrayValue,h=zt((null===(s=null==c?void 0:c.values)||void 0===s?void 0:s.length)||0,(null===(i=null==u?void 0:u.values)||void 0===i?void 0:i.length)||0);return 0!==h?h:ar(c,u)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===Zn&&t===Zn)return 0;if(e===Zn)return 1;if(t===Zn)return-1;const n=e.fields||{},r=Object.keys(n),s=t.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let e=0;e<r.length&&e<i.length;++e){const t=qt(r[e],i[e]);if(0!==t)return t;const o=ir(n[r[e]],s[i[e]]);if(0!==o)return o}return zt(r.length,i.length)}(e.mapValue,t.mapValue);default:throw Ct(23264,{le:n})}}function or(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return zt(e,t);const n=Fn(e),r=Fn(t),s=zt(n.seconds,r.seconds);return 0!==s?s:zt(n.nanos,r.nanos)}function ar(e,t){const n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){const t=ir(n[e],r[e]);if(t)return t}return zt(n.length,r.length)}function cr(e){return ur(e)}function ur(e){return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){const t=Fn(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?function(e){return jn(e).toBase64()}(e.bytesValue):"referenceValue"in e?function(e){return en.fromName(e).toString()}(e.referenceValue):"geoPointValue"in e?function(e){return`geo(${e.latitude},${e.longitude})`}(e.geoPointValue):"arrayValue"in e?function(e){let t="[",n=!0;for(const r of e.values||[])n?n=!1:t+=",",t+=ur(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){const t=Object.keys(e.fields||{}).sort();let n="{",r=!0;for(const s of t)r?r=!1:n+=",",n+=`${s}:${ur(e.fields[s])}`;return n+"}"}(e.mapValue):Ct(61005,{value:e})}function hr(e){switch(nr(e)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const t=Kn(e);return t?16+hr(t):16;case 5:return 2*e.stringValue.length;case 6:return jn(e.bytesValue).approximateByteSize();case 7:return e.referenceValue.length;case 9:return function(e){return(e.values||[]).reduce((e,t)=>e+hr(t),0)}(e.arrayValue);case 10:case 11:return function(e){let t=0;return An(e.fields,(e,n)=>{t+=e.length+hr(n)}),t}(e.mapValue);default:throw Ct(13486,{value:e})}}function lr(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function dr(e){return!!e&&"integerValue"in e}function fr(e){return!!e&&"arrayValue"in e}function pr(e){return!!e&&"nullValue"in e}function gr(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function mr(e){return!!e&&"mapValue"in e}function yr(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){const t={mapValue:{fields:{}}};return An(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=yr(n)),t}if(e.arrayValue){const t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=yr(e.arrayValue.values[n]);return t}return Object.assign({},e)}class vr{constructor(e){this.value=e}static empty(){return new vr({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(t=(t.mapValue.fields||{})[e.get(n)],!mr(t))return null;return t=(t.mapValue.fields||{})[e.lastSegment()],t||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=yr(t)}setAll(e){let t=Zt.emptyPath(),n={},r=[];e.forEach((e,s)=>{if(!t.isImmediateParentOf(s)){const e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=s.popLast()}e?n[s.lastSegment()]=yr(e):r.push(s.lastSegment())});const s=this.getFieldsMap(t);this.applyChanges(s,n,r)}delete(e){const t=this.field(e.popLast());mr(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return rr(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];mr(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}applyChanges(e,t,n){An(t,(t,n)=>e[t]=n);for(const t of n)delete e[t]}clone(){return new vr(yr(this.value))}}function _r(e){const t=[];return An(e.fields,(e,n)=>{const r=new Zt([e]);if(mr(n)){const e=_r(n.mapValue).fields;if(0===e.length)t.push(r);else for(const n of e)t.push(r.child(n))}else t.push(r)}),new Ln(t)
|
|
882
882
|
/**
|
|
883
883
|
* @license
|
|
884
884
|
* Copyright 2017 Google LLC
|
|
@@ -942,7 +942,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
942
942
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
943
943
|
* See the License for the specific language governing permissions and
|
|
944
944
|
* limitations under the License.
|
|
945
|
-
*/class
|
|
945
|
+
*/class Cr{}class Ar extends Cr{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new Lr(e,t,n):"array-contains"===t?new Fr(e,n):"in"===t?new Vr(e,n):"not-in"===t?new jr(e,n):"array-contains-any"===t?new Br(e,n):new Ar(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new Mr(e,n):new xr(e,n)}matches(e){const t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(ir(t,this.value)):null!==t&&nr(this.value)===nr(t)&&this.matchesComparison(ir(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return Ct(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class kr extends Cr{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new kr(e,t)}matches(e){return Nr(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.he||(this.he=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}}function Nr(e){return"and"===e.op}function Rr(e){return function(e){for(const t of e.filters)if(t instanceof kr)return!1;return!0}(e)&&Nr(e)}function Or(e){if(e instanceof Ar)return e.field.canonicalString()+e.op.toString()+cr(e.value);if(Rr(e))return e.filters.map(e=>Or(e)).join(",");{const t=e.filters.map(e=>Or(e)).join(",");return`${e.op}(${t})`}}function Dr(e,t){return e instanceof Ar?function(e,t){return t instanceof Ar&&e.op===t.op&&e.field.isEqual(t.field)&&rr(e.value,t.value)}(e,t):e instanceof kr?function(e,t){return t instanceof kr&&e.op===t.op&&e.filters.length===t.filters.length&&e.filters.reduce((e,n,r)=>e&&Dr(n,t.filters[r]),!0)}(e,t):void Ct(19439)}function Pr(e){return e instanceof Ar?function(e){return`${e.field.canonicalString()} ${e.op} ${cr(e.value)}`}(e):e instanceof kr?function(e){return e.op.toString()+" {"+e.getFilters().map(Pr).join(" ,")+"}"}(e):"Filter"}class Lr extends Ar{constructor(e,t,n){super(e,t,n),this.key=en.fromName(n.referenceValue)}matches(e){const t=en.comparator(e.key,this.key);return this.matchesComparison(t)}}class Mr extends Ar{constructor(e,t){super(e,"in",t),this.keys=Ur("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class xr extends Ar{constructor(e,t){super(e,"not-in",t),this.keys=Ur("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function Ur(e,t){var n;return((null===(n=t.arrayValue)||void 0===n?void 0:n.values)||[]).map(e=>en.fromName(e.referenceValue))}class Fr extends Ar{constructor(e,t){super(e,"array-contains",t)}matches(e){const t=e.data.field(this.field);return fr(t)&&sr(t.arrayValue,this.value)}}class Vr extends Ar{constructor(e,t){super(e,"in",t)}matches(e){const t=e.data.field(this.field);return null!==t&&sr(this.value.arrayValue,t)}}class jr extends Ar{constructor(e,t){super(e,"not-in",t)}matches(e){if(sr(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!sr(this.value.arrayValue,t)}}class Br extends Ar{constructor(e,t){super(e,"array-contains-any",t)}matches(e){const t=e.data.field(this.field);return!(!fr(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>sr(this.value.arrayValue,e))}}
|
|
946
946
|
/**
|
|
947
947
|
* @license
|
|
948
948
|
* Copyright 2019 Google LLC
|
|
@@ -958,7 +958,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
958
958
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
959
959
|
* See the License for the specific language governing permissions and
|
|
960
960
|
* limitations under the License.
|
|
961
|
-
*/class Hr{constructor(e,t=null,n=[],r=[],s=null,i=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.Pe=null}}function $r(e,t=null,n=[],r=[],s=null,i=null,o=null){return new Hr(e,t,n,r,s,i,o)}function zr(e){const t=
|
|
961
|
+
*/class Hr{constructor(e,t=null,n=[],r=[],s=null,i=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=s,this.startAt=i,this.endAt=o,this.Pe=null}}function $r(e,t=null,n=[],r=[],s=null,i=null,o=null){return new Hr(e,t,n,r,s,i,o)}function zr(e){const t=Nt(e);if(null===t.Pe){let e=t.path.canonicalString();null!==t.collectionGroup&&(e+="|cg:"+t.collectionGroup),e+="|f:",e+=t.filters.map(e=>Or(e)).join(","),e+="|ob:",e+=t.orderBy.map(e=>function(e){return e.field.canonicalString()+e.dir}(e)).join(","),En(t.limit)||(e+="|l:",e+=t.limit),t.startAt&&(e+="|lb:",e+=t.startAt.inclusive?"b:":"a:",e+=t.startAt.position.map(e=>cr(e)).join(",")),t.endAt&&(e+="|ub:",e+=t.endAt.inclusive?"a:":"b:",e+=t.endAt.position.map(e=>cr(e)).join(",")),t.Pe=e}return t.Pe}function qr(e,t){if(e.limit!==t.limit)return!1;if(e.orderBy.length!==t.orderBy.length)return!1;for(let n=0;n<e.orderBy.length;n++)if(!br(e.orderBy[n],t.orderBy[n]))return!1;if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!Dr(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!Sr(e.startAt,t.startAt)&&Sr(e.endAt,t.endAt)}function Kr(e){return en.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}
|
|
962
962
|
/**
|
|
963
963
|
* @license
|
|
964
964
|
* Copyright 2017 Google LLC
|
|
@@ -974,7 +974,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
974
974
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
975
975
|
* See the License for the specific language governing permissions and
|
|
976
976
|
* limitations under the License.
|
|
977
|
-
*/class
|
|
977
|
+
*/class Gr{constructor(e,t=null,n=[],r=[],s=null,i="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=s,this.limitType=i,this.startAt=o,this.endAt=a,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}}function Wr(e){return new Gr(e)}function Qr(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function Jr(e){return null!==e.collectionGroup}function Yr(e){const t=Nt(e);if(null===t.Te){t.Te=[];const e=new Set;for(const n of t.explicitOrderBy)t.Te.push(n),e.add(n.field.canonicalString());const n=t.explicitOrderBy.length>0?t.explicitOrderBy[t.explicitOrderBy.length-1].dir:"asc",r=function(e){let t=new Dn(Zt.comparator);return e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t}(t);r.forEach(r=>{e.has(r.canonicalString())||r.isKeyField()||t.Te.push(new Ir(r,n))}),e.has(Zt.keyField().canonicalString())||t.Te.push(new Ir(Zt.keyField(),n))}return t.Te}function Xr(e){const t=Nt(e);return t.Ie||(t.Ie=function(e,t){if("F"===e.limitType)return $r(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{const t="desc"===e.dir?"asc":"desc";return new Ir(e.field,t)});const n=e.endAt?new Tr(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new Tr(e.startAt.position,e.startAt.inclusive):null;return $r(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}(t,Yr(e))),t.Ie}function Zr(e,t){const n=e.filters.concat([t]);return new Gr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function es(e,t,n){return new Gr(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function ts(e,t){return qr(Xr(e),Xr(t))&&e.limitType===t.limitType}function ns(e){return`${zr(Xr(e))}|lt:${e.limitType}`}function rs(e){return`Query(target=${function(e){let t=e.path.canonicalString();return null!==e.collectionGroup&&(t+=" collectionGroup="+e.collectionGroup),e.filters.length>0&&(t+=`, filters: [${e.filters.map(e=>Pr(e)).join(", ")}]`),En(e.limit)||(t+=", limit: "+e.limit),e.orderBy.length>0&&(t+=`, orderBy: [${e.orderBy.map(e=>function(e){return`${e.field.canonicalString()} (${e.dir})`}(e)).join(", ")}]`),e.startAt&&(t+=", startAt: ",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>cr(e)).join(",")),e.endAt&&(t+=", endAt: ",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>cr(e)).join(",")),`Target(${t})`}(Xr(e))}; limitType=${e.limitType})`}function ss(e,t){return t.isFoundDocument()&&function(e,t){const n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):en.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(const n of Yr(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(const n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&function(e,t){return!(e.startAt&&!function(e,t,n){const r=Er(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,Yr(e),t))&&!(e.endAt&&!function(e,t,n){const r=Er(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,Yr(e),t))}(e,t)}function is(e){return(t,n)=>{let r=!1;for(const s of Yr(e)){const e=os(s,t,n);if(0!==e)return e;r=r||s.field.isKeyField()}return 0}}function os(e,t,n){const r=e.field.isKeyField()?en.comparator(t.key,n.key):function(e,t,n){const r=t.data.field(e),s=n.data.field(e);return null!==r&&null!==s?ir(r,s):Ct(42886)}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return-1*r;default:return Ct(19790,{direction:e.dir})}}
|
|
978
978
|
/**
|
|
979
979
|
* @license
|
|
980
980
|
* Copyright 2017 Google LLC
|
|
@@ -990,7 +990,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
990
990
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
991
991
|
* See the License for the specific language governing permissions and
|
|
992
992
|
* limitations under the License.
|
|
993
|
-
*/class as{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,r]of n)if(this.equalsFn(t,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){
|
|
993
|
+
*/class as{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n)for(const[t,r]of n)if(this.equalsFn(t,e))return r}has(e){return void 0!==this.get(e)}set(e,t){const n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){const t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){An(this.inner,(t,n)=>{for(const[t,r]of n)e(t,r)})}isEmpty(){return kn(this.inner)}size(){return this.innerSize}}
|
|
994
994
|
/**
|
|
995
995
|
* @license
|
|
996
996
|
* Copyright 2017 Google LLC
|
|
@@ -1006,7 +1006,7 @@ class Dn{constructor(e){this.comparator=e,this.data=new Rn(this.comparator)}has(
|
|
|
1006
1006
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1007
1007
|
* See the License for the specific language governing permissions and
|
|
1008
1008
|
* limitations under the License.
|
|
1009
|
-
*/const cs=new
|
|
1009
|
+
*/const cs=new Nn(en.comparator);function us(){return cs}const hs=new Nn(en.comparator);function ls(...e){let t=hs;for(const n of e)t=t.insert(n.key,n);return t}function ds(e){let t=hs;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function fs(){return gs()}function ps(){return gs()}function gs(){return new as(e=>e.toString(),(e,t)=>e.isEqual(t))}const ms=new Nn(en.comparator),ys=new Dn(en.comparator);function vs(...e){let t=ys;for(const n of e)t=t.add(n);return t}const _s=new Dn(zt);
|
|
1010
1010
|
/**
|
|
1011
1011
|
* @license
|
|
1012
1012
|
* Copyright 2020 Google LLC
|
|
@@ -1055,7 +1055,7 @@ function ws(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t=
|
|
|
1055
1055
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1056
1056
|
* See the License for the specific language governing permissions and
|
|
1057
1057
|
* limitations under the License.
|
|
1058
|
-
*/class Ss{constructor(){this._=void 0}}function Is(e,t,n){return e instanceof
|
|
1058
|
+
*/class Ss{constructor(){this._=void 0}}function Is(e,t,n){return e instanceof As?function(e,t){const n={fields:{[Hn]:{stringValue:Bn},[zn]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&qn(t)&&(t=Kn(t)),t&&(n.fields[$n]=t),{mapValue:n}}(n,t):e instanceof ks?Ns(e,t):e instanceof Rs?Os(e,t):function(e,t){const n=Cs(e,t),r=Ps(n)+Ps(e.Ee);return dr(n)&&dr(e.Ee)?Ts(r):ws(e.serializer,r)}(e,t)}function bs(e,t,n){return e instanceof ks?Ns(e,t):e instanceof Rs?Os(e,t):n}function Cs(e,t){return e instanceof Ds?function(e){return dr(e)||function(e){return!!e&&"doubleValue"in e}(e)}(t)?t:{integerValue:0}:null}class As extends Ss{}class ks extends Ss{constructor(e){super(),this.elements=e}}function Ns(e,t){const n=Ls(t);for(const t of e.elements)n.some(e=>rr(e,t))||n.push(t);return{arrayValue:{values:n}}}class Rs extends Ss{constructor(e){super(),this.elements=e}}function Os(e,t){let n=Ls(t);for(const t of e.elements)n=n.filter(e=>!rr(e,t));return{arrayValue:{values:n}}}class Ds extends Ss{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function Ps(e){return Vn(e.integerValue||e.doubleValue)}function Ls(e){return fr(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class Ms{constructor(e,t){this.version=e,this.transformResults=t}}class xs{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new xs}static exists(e){return new xs(void 0,e)}static updateTime(e){return new xs(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function Us(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class Fs{}function Vs(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new Qs(e.key,xs.none()):new zs(e.key,e.data,xs.none());{const n=e.data,r=vr.empty();let s=new Dn(Zt.comparator);for(let e of t.fields)if(!s.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),s=s.add(e)}return new qs(e.key,r,new Ln(s.toArray()),xs.none())}}function js(e,t,n){e instanceof zs?function(e,t,n){const r=e.value.clone(),s=Gs(e.fieldTransforms,t,n.transformResults);r.setAll(s),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(e,t,n):e instanceof qs?function(e,t,n){if(!Us(e.precondition,t))return void t.convertToUnknownDocument(n.version);const r=Gs(e.fieldTransforms,t,n.transformResults),s=t.data;s.setAll(Ks(e)),s.setAll(r),t.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(e,t,n):function(e,t,n){t.convertToNoDocument(n.version).setHasCommittedMutations()}(0,t,n)}function Bs(e,t,n,r){return e instanceof zs?function(e,t,n,r){if(!Us(e.precondition,t))return n;const s=e.value.clone(),i=Ws(e.fieldTransforms,r,t);return s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null}(e,t,n,r):e instanceof qs?function(e,t,n,r){if(!Us(e.precondition,t))return n;const s=Ws(e.fieldTransforms,r,t),i=t.data;return i.setAll(Ks(e)),i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null===n?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,r):function(e,t,n){return Us(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}(e,t,n)}function Hs(e,t){let n=null;for(const r of e.fieldTransforms){const e=t.data.field(r.field),s=Cs(r.transform,e||null);null!=s&&(null===n&&(n=vr.empty()),n.set(r.field,s))}return n||null}function $s(e,t){return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&!!function(e,t){return void 0===e&&void 0===t||!(!e||!t)&&Wt(e,t,(e,t)=>function(e,t){return e.field.isEqual(t.field)&&function(e,t){return e instanceof ks&&t instanceof ks||e instanceof Rs&&t instanceof Rs?Wt(e.elements,t.elements,rr):e instanceof Ds&&t instanceof Ds?rr(e.Ee,t.Ee):e instanceof As&&t instanceof As}(e.transform,t.transform)}(e,t))}(e.fieldTransforms,t.fieldTransforms)&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class zs extends Fs{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class qs extends Fs{constructor(e,t,n,r,s=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function Ks(e){const t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=e.data.field(n);t.set(n,r)}}),t}function Gs(e,t,n){const r=new Map;kt(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let s=0;s<n.length;s++){const i=e[s],o=i.transform,a=t.data.field(i.field);r.set(i.field,bs(o,a,n[s]))}return r}function Ws(e,t,n){const r=new Map;for(const s of e){const e=s.transform,i=n.data.field(s.field);r.set(s.field,Is(e,i,t))}return r}class Qs extends Fs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class Js extends Fs{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
|
|
1059
1059
|
/**
|
|
1060
1060
|
* @license
|
|
1061
1061
|
* Copyright 2017 Google LLC
|
|
@@ -1119,7 +1119,7 @@ function ws(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t=
|
|
|
1119
1119
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1120
1120
|
* See the License for the specific language governing permissions and
|
|
1121
1121
|
* limitations under the License.
|
|
1122
|
-
*/var ti,ni;function ri(e){if(void 0===e)return St("GRPC error has no .code"),
|
|
1122
|
+
*/var ti,ni;function ri(e){if(void 0===e)return St("GRPC error has no .code"),Rt.UNKNOWN;switch(e){case ti.OK:return Rt.OK;case ti.CANCELLED:return Rt.CANCELLED;case ti.UNKNOWN:return Rt.UNKNOWN;case ti.DEADLINE_EXCEEDED:return Rt.DEADLINE_EXCEEDED;case ti.RESOURCE_EXHAUSTED:return Rt.RESOURCE_EXHAUSTED;case ti.INTERNAL:return Rt.INTERNAL;case ti.UNAVAILABLE:return Rt.UNAVAILABLE;case ti.UNAUTHENTICATED:return Rt.UNAUTHENTICATED;case ti.INVALID_ARGUMENT:return Rt.INVALID_ARGUMENT;case ti.NOT_FOUND:return Rt.NOT_FOUND;case ti.ALREADY_EXISTS:return Rt.ALREADY_EXISTS;case ti.PERMISSION_DENIED:return Rt.PERMISSION_DENIED;case ti.FAILED_PRECONDITION:return Rt.FAILED_PRECONDITION;case ti.ABORTED:return Rt.ABORTED;case ti.OUT_OF_RANGE:return Rt.OUT_OF_RANGE;case ti.UNIMPLEMENTED:return Rt.UNIMPLEMENTED;case ti.DATA_LOSS:return Rt.DATA_LOSS;default:return Ct(39323,{code:e})}}(ni=ti||(ti={}))[ni.OK=0]="OK",ni[ni.CANCELLED=1]="CANCELLED",ni[ni.UNKNOWN=2]="UNKNOWN",ni[ni.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ni[ni.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ni[ni.NOT_FOUND=5]="NOT_FOUND",ni[ni.ALREADY_EXISTS=6]="ALREADY_EXISTS",ni[ni.PERMISSION_DENIED=7]="PERMISSION_DENIED",ni[ni.UNAUTHENTICATED=16]="UNAUTHENTICATED",ni[ni.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ni[ni.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ni[ni.ABORTED=10]="ABORTED",ni[ni.OUT_OF_RANGE=11]="OUT_OF_RANGE",ni[ni.UNIMPLEMENTED=12]="UNIMPLEMENTED",ni[ni.INTERNAL=13]="INTERNAL",ni[ni.UNAVAILABLE=14]="UNAVAILABLE",ni[ni.DATA_LOSS=15]="DATA_LOSS";
|
|
1123
1123
|
/**
|
|
1124
1124
|
* @license
|
|
1125
1125
|
* Copyright 2022 Google LLC
|
|
@@ -1152,7 +1152,7 @@ const si=new st([4294967295,4294967295],0);function ii(e){const t=Ht().encode(e)
|
|
|
1152
1152
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1153
1153
|
* See the License for the specific language governing permissions and
|
|
1154
1154
|
* limitations under the License.
|
|
1155
|
-
*/class ui{constructor(e,t,n,r,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const r=new Map;return r.set(e,hi.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new ui(fn.min(),r,new
|
|
1155
|
+
*/class ui{constructor(e,t,n,r,s){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=s}static createSynthesizedRemoteEventForCurrentChange(e,t,n){const r=new Map;return r.set(e,hi.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new ui(fn.min(),r,new Nn(zt),us(),vs())}}class hi{constructor(e,t,n,r,s){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=s}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new hi(n,t,vs(),vs(),vs())}}
|
|
1156
1156
|
/**
|
|
1157
1157
|
* @license
|
|
1158
1158
|
* Copyright 2017 Google LLC
|
|
@@ -1168,7 +1168,7 @@ const si=new st([4294967295,4294967295],0);function ii(e){const t=Ht().encode(e)
|
|
|
1168
1168
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1169
1169
|
* See the License for the specific language governing permissions and
|
|
1170
1170
|
* limitations under the License.
|
|
1171
|
-
*/class li{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=r}}class di{constructor(e,t){this.targetId=e,this.De=t}}class fi{constructor(e,t,n=xn.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class pi{constructor(){this.ve=0,this.Ce=yi(),this.Fe=xn.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=vs(),t=vs(),n=vs();return this.Ce.forEach((r,s)=>{switch(s){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:At(38017,{changeType:s})}}),new hi(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=yi()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,kt(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class gi{constructor(e){this.We=e,this.Ge=new Map,this.ze=us(),this.je=mi(),this.Je=mi(),this.He=new Rn(zt)}Ye(e){for(const t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(const t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,t=>{const n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:At(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach((e,n)=>{this.nt(n)&&t(n)})}it(e){const t=e.targetId,n=e.De.count,r=this.st(t);if(r){const s=r.target;if(Gr(s))if(0===n){const e=new en(s.path);this.Xe(t,e,wr.newNoDocument(e,fn.min()))}else kt(1===n,20013,{expectedCount:n});else{const r=this.ot(t);if(r!==n){const n=this._t(e),s=n?this.ut(n,e,r):1;if(0!==s){this.rt(t);const e=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(t,e)}}}}}_t(e){const t=e.De.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:s=0}=t;let i,o;try{i=jn(n).toUint8Array()}catch(e){if(e instanceof Mn)return It("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{o=new ai(i,r,s)}catch(e){return It(e instanceof ci?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===o.fe?null:o}ut(e,t,n){return t.De.count===n-this.ht(e,t.targetId)?0:2}ht(e,t){const n=this.We.getRemoteKeysForTarget(t);let r=0;return n.forEach(n=>{const s=this.We.lt(),i=`projects/${s.projectId}/databases/${s.database}/documents/${n.path.canonicalString()}`;e.mightContain(i)||(this.Xe(t,n,null),r++)}),r}Pt(e){const t=new Map;this.Ge.forEach((n,r)=>{const s=this.st(r);if(s){if(n.current&&Gr(s.target)){const t=new en(s.target.path);this.Tt(t).has(r)||this.It(r,t)||this.Xe(r,t,wr.newNoDocument(t,e))}n.Ne&&(t.set(r,n.Le()),n.ke())}});let n=vs();this.Je.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)}),r&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));const r=new ui(e,t,this.He,this.ze,n);return this.ze=us(),this.je=mi(),this.Je=mi(),this.He=new Rn(zt),r}Ze(e,t){if(!this.nt(e))return;const n=this.It(e,t.key)?2:0;this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;const r=this.tt(e);this.It(e,t)?r.qe(t,1):r.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){const t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new pi,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new Dn(zt),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new Dn(zt),this.je=this.je.insert(e,t)),t}nt(e){const t=null!==this.st(e);return t||Et("WatchChangeAggregator","Detected inactive target",e),t}st(e){const t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new pi),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function mi(){return new Rn(en.comparator)}function yi(){return new Rn(en.comparator)}const vi={asc:"ASCENDING",desc:"DESCENDING"},_i={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},wi={and:"AND",or:"OR"};class Ti{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ei(e,t){return e.useProto3Json||En(t)?t:{value:t}}function Si(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ii(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function bi(e,t){return Si(e,t.toTimestamp())}function Ai(e){return kt(!!e,49232),fn.fromTimestamp(function(e){const t=Fn(e);return new dn(t.seconds,t.nanos)}(e))}function Ci(e,t){return ki(e,t).canonicalString()}function ki(e,t){const n=function(e){return new Yt(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Ri(e){const t=Yt.fromString(e);return kt(Ki(t),10190,{key:t.toString()}),t}function Oi(e,t){return Ci(e.databaseId,t.path)}function Ni(e,t){const n=Ri(t);if(n.get(1)!==e.databaseId.projectId)throw new Nt(Ot.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Nt(Ot.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new en(Li(n))}function Di(e,t){return Ci(e.databaseId,t)}function Pi(e){return new Yt(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Li(e){return kt(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Mi(e,t,n){return{name:Oi(e,t),fields:n.value.mapValue.fields}}function xi(e,t){return{documents:[Di(e,t.path)]}}function Ui(e,t){const n={structuredQuery:{}},r=t.path;let s;null!==t.collectionGroup?(s=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Di(e,s);const i=function(e){if(0!==e.length)return qi(kr.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);const o=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:$i(e.field),direction:ji(e.dir)}}(e))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Ei(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{Vt:n,parent:s}}function Fi(e){let t=function(e){const t=Ri(e);return 4===t.length?Yt.emptyPath():Li(t)}(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){kt(1===r,65062);const e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=Vi(e);return t instanceof kr&&Or(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new Ir(zi(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,En(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new Tr(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new Tr(n,t)}(n.endAt)),function(e,t,n,r,s,i,o,a){return new Kr(e,t,n,r,s,i,o,a)}(t,s,o,i,a,"F",c,u)}function Vi(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=zi(e.unaryFilter.field);return Cr.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=zi(e.unaryFilter.field);return Cr.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=zi(e.unaryFilter.field);return Cr.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=zi(e.unaryFilter.field);return Cr.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return At(61313);default:return At(60726)}}(e):void 0!==e.fieldFilter?function(e){return Cr.create(zi(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return At(58110);default:return At(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return kr.create(e.compositeFilter.filters.map(e=>Vi(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return At(1026)}}(e.compositeFilter.op))}(e):At(30097,{filter:e})}function ji(e){return vi[e]}function Bi(e){return _i[e]}function Hi(e){return wi[e]}function $i(e){return{fieldPath:e.canonicalString()}}function zi(e){return Zt.fromServerFormat(e.fieldPath)}function qi(e){return e instanceof Cr?function(e){if("=="===e.op){if(gr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NAN"}};if(pr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(gr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NOT_NAN"}};if(pr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$i(e.field),op:Bi(e.op),value:e.value}}}(e):e instanceof kr?function(e){const t=e.getFilters().map(e=>qi(e));return 1===t.length?t[0]:{compositeFilter:{op:Hi(e.op),filters:t}}}(e):At(54877,{filter:e})}function Gi(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Ki(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
|
|
1171
|
+
*/class li{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=r}}class di{constructor(e,t){this.targetId=e,this.De=t}}class fi{constructor(e,t,n=xn.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class pi{constructor(){this.ve=0,this.Ce=yi(),this.Fe=xn.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=vs(),t=vs(),n=vs();return this.Ce.forEach((r,s)=>{switch(s){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:Ct(38017,{changeType:s})}}),new hi(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=yi()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,kt(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class gi{constructor(e){this.We=e,this.Ge=new Map,this.ze=us(),this.je=mi(),this.Je=mi(),this.He=new Nn(zt)}Ye(e){for(const t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(const t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,t=>{const n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:Ct(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach((e,n)=>{this.nt(n)&&t(n)})}it(e){const t=e.targetId,n=e.De.count,r=this.st(t);if(r){const s=r.target;if(Kr(s))if(0===n){const e=new en(s.path);this.Xe(t,e,wr.newNoDocument(e,fn.min()))}else kt(1===n,20013,{expectedCount:n});else{const r=this.ot(t);if(r!==n){const n=this._t(e),s=n?this.ut(n,e,r):1;if(0!==s){this.rt(t);const e=2===s?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.He=this.He.insert(t,e)}}}}}_t(e){const t=e.De.unchangedNames;if(!t||!t.bits)return null;const{bits:{bitmap:n="",padding:r=0},hashCount:s=0}=t;let i,o;try{i=jn(n).toUint8Array()}catch(e){if(e instanceof Mn)return It("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{o=new ai(i,r,s)}catch(e){return It(e instanceof ci?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===o.fe?null:o}ut(e,t,n){return t.De.count===n-this.ht(e,t.targetId)?0:2}ht(e,t){const n=this.We.getRemoteKeysForTarget(t);let r=0;return n.forEach(n=>{const s=this.We.lt(),i=`projects/${s.projectId}/databases/${s.database}/documents/${n.path.canonicalString()}`;e.mightContain(i)||(this.Xe(t,n,null),r++)}),r}Pt(e){const t=new Map;this.Ge.forEach((n,r)=>{const s=this.st(r);if(s){if(n.current&&Kr(s.target)){const t=new en(s.target.path);this.Tt(t).has(r)||this.It(r,t)||this.Xe(r,t,wr.newNoDocument(t,e))}n.Ne&&(t.set(r,n.Le()),n.ke())}});let n=vs();this.Je.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{const t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)}),r&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));const r=new ui(e,t,this.He,this.ze,n);return this.ze=us(),this.je=mi(),this.Je=mi(),this.He=new Nn(zt),r}Ze(e,t){if(!this.nt(e))return;const n=this.It(e,t.key)?2:0;this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;const r=this.tt(e);this.It(e,t)?r.qe(t,1):r.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){const t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new pi,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new Dn(zt),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new Dn(zt),this.je=this.je.insert(e,t)),t}nt(e){const t=null!==this.st(e);return t||Et("WatchChangeAggregator","Detected inactive target",e),t}st(e){const t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new pi),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function mi(){return new Nn(en.comparator)}function yi(){return new Nn(en.comparator)}const vi={asc:"ASCENDING",desc:"DESCENDING"},_i={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},wi={and:"AND",or:"OR"};class Ti{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function Ei(e,t){return e.useProto3Json||En(t)?t:{value:t}}function Si(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function Ii(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function bi(e,t){return Si(e,t.toTimestamp())}function Ci(e){return kt(!!e,49232),fn.fromTimestamp(function(e){const t=Fn(e);return new dn(t.seconds,t.nanos)}(e))}function Ai(e,t){return ki(e,t).canonicalString()}function ki(e,t){const n=function(e){return new Yt(["projects",e.projectId,"databases",e.database])}(e).child("documents");return void 0===t?n:n.child(t)}function Ni(e){const t=Yt.fromString(e);return kt(Gi(t),10190,{key:t.toString()}),t}function Ri(e,t){return Ai(e.databaseId,t.path)}function Oi(e,t){const n=Ni(t);if(n.get(1)!==e.databaseId.projectId)throw new Ot(Rt.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new Ot(Rt.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new en(Li(n))}function Di(e,t){return Ai(e.databaseId,t)}function Pi(e){return new Yt(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function Li(e){return kt(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function Mi(e,t,n){return{name:Ri(e,t),fields:n.value.mapValue.fields}}function xi(e,t){return{documents:[Di(e,t.path)]}}function Ui(e,t){const n={structuredQuery:{}},r=t.path;let s;null!==t.collectionGroup?(s=r,n.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=Di(e,s);const i=function(e){if(0!==e.length)return qi(kr.create(e,"and"))}(t.filters);i&&(n.structuredQuery.where=i);const o=function(e){if(0!==e.length)return e.map(e=>function(e){return{field:$i(e.field),direction:ji(e.dir)}}(e))}(t.orderBy);o&&(n.structuredQuery.orderBy=o);const a=Ei(e,t.limit);return null!==a&&(n.structuredQuery.limit=a),t.startAt&&(n.structuredQuery.startAt=function(e){return{before:e.inclusive,values:e.position}}(t.startAt)),t.endAt&&(n.structuredQuery.endAt=function(e){return{before:!e.inclusive,values:e.position}}(t.endAt)),{Vt:n,parent:s}}function Fi(e){let t=function(e){const t=Ni(e);return 4===t.length?Yt.emptyPath():Li(t)}(e.parent);const n=e.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){kt(1===r,65062);const e=n.from[0];e.allDescendants?s=e.collectionId:t=t.child(e.collectionId)}let i=[];n.where&&(i=function(e){const t=Vi(e);return t instanceof kr&&Rr(t)?t.getFilters():[t]}(n.where));let o=[];n.orderBy&&(o=function(e){return e.map(e=>function(e){return new Ir(zi(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))}(e))}(n.orderBy));let a=null;n.limit&&(a=function(e){let t;return t="object"==typeof e?e.value:e,En(t)?null:t}(n.limit));let c=null;n.startAt&&(c=function(e){const t=!!e.before,n=e.values||[];return new Tr(n,t)}(n.startAt));let u=null;return n.endAt&&(u=function(e){const t=!e.before,n=e.values||[];return new Tr(n,t)}(n.endAt)),function(e,t,n,r,s,i,o,a){return new Gr(e,t,n,r,s,i,o,a)}(t,s,o,i,a,"F",c,u)}function Vi(e){return void 0!==e.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":const t=zi(e.unaryFilter.field);return Ar.create(t,"==",{doubleValue:NaN});case"IS_NULL":const n=zi(e.unaryFilter.field);return Ar.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=zi(e.unaryFilter.field);return Ar.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=zi(e.unaryFilter.field);return Ar.create(s,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return Ct(61313);default:return Ct(60726)}}(e):void 0!==e.fieldFilter?function(e){return Ar.create(zi(e.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return Ct(58110);default:return Ct(50506)}}(e.fieldFilter.op),e.fieldFilter.value)}(e):void 0!==e.compositeFilter?function(e){return kr.create(e.compositeFilter.filters.map(e=>Vi(e)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return Ct(1026)}}(e.compositeFilter.op))}(e):Ct(30097,{filter:e})}function ji(e){return vi[e]}function Bi(e){return _i[e]}function Hi(e){return wi[e]}function $i(e){return{fieldPath:e.canonicalString()}}function zi(e){return Zt.fromServerFormat(e.fieldPath)}function qi(e){return e instanceof Ar?function(e){if("=="===e.op){if(gr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NAN"}};if(pr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(gr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NOT_NAN"}};if(pr(e.value))return{unaryFilter:{field:$i(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:$i(e.field),op:Bi(e.op),value:e.value}}}(e):e instanceof kr?function(e){const t=e.getFilters().map(e=>qi(e));return 1===t.length?t[0]:{compositeFilter:{op:Hi(e.op),filters:t}}}(e):Ct(54877,{filter:e})}function Ki(e){const t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}function Gi(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}
|
|
1172
1172
|
/**
|
|
1173
1173
|
* @license
|
|
1174
1174
|
* Copyright 2017 Google LLC
|
|
@@ -1346,7 +1346,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1346
1346
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1347
1347
|
* See the License for the specific language governing permissions and
|
|
1348
1348
|
* limitations under the License.
|
|
1349
|
-
*/class ho{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(n=r,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&Bs(n.mutation,e,Ln.empty(),dn.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,vs()).next(()=>t))}getLocalViewOfDocuments(e,t,n=vs()){const r=fs();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=ls();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=fs();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,vs()))}populateOverlays(e,t,n){const r=[];return n.forEach(e=>{t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,r){let s=us();const i=gs(),o=gs();return t.forEach((e,t)=>{const o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof qs)?s=s.insert(t.key,t):void 0!==o?(i.set(t.key,o.mutation.getFieldMask()),Bs(o.mutation,t,o.mutation.getFieldMask(),dn.now())):i.set(t.key,Ln.empty())}),this.recalculateAndSaveOverlays(e,s).next(e=>(e.forEach((e,t)=>i.set(e,t)),t.forEach((e,t)=>{var n;return o.set(e,new uo(t,null!==(n=i.get(e))&&void 0!==n?n:null))}),o))}recalculateAndSaveOverlays(e,t){const n=gs();let r=new
|
|
1349
|
+
*/class ho{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(n=r,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&Bs(n.mutation,e,Ln.empty(),dn.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,vs()).next(()=>t))}getLocalViewOfDocuments(e,t,n=vs()){const r=fs();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=ls();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){const n=fs();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,vs()))}populateOverlays(e,t,n){const r=[];return n.forEach(e=>{t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,r){let s=us();const i=gs(),o=gs();return t.forEach((e,t)=>{const o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof qs)?s=s.insert(t.key,t):void 0!==o?(i.set(t.key,o.mutation.getFieldMask()),Bs(o.mutation,t,o.mutation.getFieldMask(),dn.now())):i.set(t.key,Ln.empty())}),this.recalculateAndSaveOverlays(e,s).next(e=>(e.forEach((e,t)=>i.set(e,t)),t.forEach((e,t)=>{var n;return o.set(e,new uo(t,null!==(n=i.get(e))&&void 0!==n?n:null))}),o))}recalculateAndSaveOverlays(e,t){const n=gs();let r=new Nn((e,t)=>e-t),s=vs();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(const s of e)s.keys().forEach(e=>{const i=t.get(e);if(null===i)return;let o=n.get(e)||Ln.empty();o=s.applyToLocalView(i,o),n.set(e,o);const a=(r.get(s.batchId)||vs()).add(e);r=r.insert(s.batchId,a)})}).next(()=>{const i=[],o=r.getReverseIterator();for(;o.hasNext();){const r=o.getNext(),a=r.key,c=r.value,u=ps();c.forEach(e=>{if(!s.has(e)){const r=Vs(t.get(e),n.get(e));null!==r&&u.set(e,r),s=s.add(e)}}),i.push(this.documentOverlayCache.saveOverlays(e,a,u))}return _n.waitFor(i)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return function(e){return en.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}(t)?this.getDocumentsMatchingDocumentQuery(e,t.path):Jr(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(s=>{const i=r-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-s.size):_n.resolve(fs());let o=-1,a=s;return i.next(t=>_n.forEach(t,(t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),s.get(t)?_n.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{a=a.insert(t,e)}))).next(()=>this.populateOverlays(e,t,s)).next(()=>this.computeViews(e,a,t,vs())).next(e=>({batchId:o,changes:ds(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new en(t)).next(e=>{let t=ls();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){const s=t.collectionGroup;let i=ls();return this.indexManager.getCollectionParents(e,s).next(o=>_n.forEach(o,o=>{const a=function(e,t){return new Gr(t,null,e.explicitOrderBy.slice(),e.filters.slice(),e.limit,e.limitType,e.startAt,e.endAt)}(t,o.child(s));return this.getDocumentsMatchingCollectionQuery(e,a,n,r).next(e=>{e.forEach((e,t)=>{i=i.insert(e,t)})})}).next(()=>i))}getDocumentsMatchingCollectionQuery(e,t,n,r){let s;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(i=>(s=i,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,s,r))).next(e=>{s.forEach((t,n)=>{const r=n.getKey();null===e.get(r)&&(e=e.insert(r,wr.newInvalidDocument(r)))});let n=ls();return e.forEach((e,r)=>{const i=s.get(e);void 0!==i&&Bs(i.mutation,r,Ln.empty(),dn.now()),ss(t,r)&&(n=n.insert(e,r))}),n})}}
|
|
1350
1350
|
/**
|
|
1351
1351
|
* @license
|
|
1352
1352
|
* Copyright 2020 Google LLC
|
|
@@ -1362,7 +1362,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1362
1362
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1363
1363
|
* See the License for the specific language governing permissions and
|
|
1364
1364
|
* limitations under the License.
|
|
1365
|
-
*/class lo{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,t){return _n.resolve(this.Br.get(t))}saveBundleMetadata(e,t){return this.Br.set(t.id,function(e){return{id:e.id,version:e.version,createTime:
|
|
1365
|
+
*/class lo{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}getBundleMetadata(e,t){return _n.resolve(this.Br.get(t))}saveBundleMetadata(e,t){return this.Br.set(t.id,function(e){return{id:e.id,version:e.version,createTime:Ci(e.createTime)}}(t)),_n.resolve()}getNamedQuery(e,t){return _n.resolve(this.Lr.get(t))}saveNamedQuery(e,t){return this.Lr.set(t.name,function(e){return{name:e.name,query:Ji(e.bundledQuery),readTime:Ci(e.readTime)}}(t)),_n.resolve()}}
|
|
1366
1366
|
/**
|
|
1367
1367
|
* @license
|
|
1368
1368
|
* Copyright 2022 Google LLC
|
|
@@ -1378,7 +1378,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1378
1378
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1379
1379
|
* See the License for the specific language governing permissions and
|
|
1380
1380
|
* limitations under the License.
|
|
1381
|
-
*/class fo{constructor(){this.overlays=new
|
|
1381
|
+
*/class fo{constructor(){this.overlays=new Nn(en.comparator),this.kr=new Map}getOverlay(e,t){return _n.resolve(this.overlays.get(t))}getOverlays(e,t){const n=fs();return _n.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}saveOverlays(e,t,n){return n.forEach((n,r)=>{this.wt(e,t,r)}),_n.resolve()}removeOverlaysForBatchId(e,t,n){const r=this.kr.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.kr.delete(n)),_n.resolve()}getOverlaysForCollection(e,t,n){const r=fs(),s=t.length+1,i=new en(t.child("")),o=this.overlays.getIteratorFrom(i);for(;o.hasNext();){const e=o.getNext().value,i=e.getKey();if(!t.isPrefixOf(i.path))break;i.path.length===s&&e.largestBatchId>n&&r.set(e.getKey(),e)}return _n.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let s=new Nn((e,t)=>e-t);const i=this.overlays.getIterator();for(;i.hasNext();){const e=i.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=s.get(e.largestBatchId);null===t&&(t=fs(),s=s.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}const o=fs(),a=s.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((e,t)=>o.set(e,t)),!(o.size()>=r)););return _n.resolve(o)}wt(e,t,n){const r=this.overlays.get(n.key);if(null!==r){const e=this.kr.get(r.largestBatchId).delete(n.key);this.kr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new Zs(t,n));let s=this.kr.get(t);void 0===s&&(s=vs(),this.kr.set(t,s)),this.kr.set(t,s.add(n.key))}}
|
|
1382
1382
|
/**
|
|
1383
1383
|
* @license
|
|
1384
1384
|
* Copyright 2024 Google LLC
|
|
@@ -1442,7 +1442,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1442
1442
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1443
1443
|
* See the License for the specific language governing permissions and
|
|
1444
1444
|
* limitations under the License.
|
|
1445
|
-
*/class vo{constructor(e){this.ni=e,this.docs=new
|
|
1445
|
+
*/class vo{constructor(e){this.ni=e,this.docs=new Nn(en.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){const n=t.key,r=this.docs.get(n),s=r?r.size:0,i=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:i}),this.size+=i-s,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){const t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){const n=this.docs.get(t);return _n.resolve(n?n.document.mutableCopy():wr.newInvalidDocument(t))}getEntries(e,t){let n=us();return t.forEach(e=>{const t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():wr.newInvalidDocument(e))}),_n.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let s=us();const i=t.path,o=new en(i.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){const{key:e,value:{document:o}}=a.getNext();if(!i.isPrefixOf(e.path))break;e.path.length>i.length+1||mn(pn(o),n)<=0||(r.has(o.key)||ss(t,o))&&(s=s.insert(o.key,o.mutableCopy()))}return _n.resolve(s)}getAllFromCollectionGroup(e,t,n,r){Ct(9500)}ri(e,t){return _n.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new _o(this)}getSize(e){return _n.resolve(this.size)}}class _o extends co{constructor(e){super(),this.Or=e}applyChanges(e){const t=[];return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.Or.addEntry(e,r)):this.Or.removeEntry(n)}),_n.waitFor(t)}getFromCache(e,t){return this.Or.getEntry(e,t)}getAllFromCache(e,t){return this.Or.getEntries(e,t)}}
|
|
1446
1446
|
/**
|
|
1447
1447
|
* @license
|
|
1448
1448
|
* Copyright 2017 Google LLC
|
|
@@ -1474,7 +1474,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1474
1474
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1475
1475
|
* See the License for the specific language governing permissions and
|
|
1476
1476
|
* limitations under the License.
|
|
1477
|
-
*/class To{constructor(e,t){this.ai={},this.overlays={},this.ui=new Tn(0),this.ci=!1,this.ci=!0,this.li=new po,this.referenceDelegate=e(this),this.hi=new wo(this),this.indexManager=new Yi,this.remoteDocumentCache=function(e){return new vo(e)}(e=>this.referenceDelegate.Pi(e)),this.serializer=new Qi(t),this.Ti=new lo(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new fo,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new yo(t,this.referenceDelegate),this.ai[e.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,t,n){Et("MemoryPersistence","Starting transaction:",e);const r=new Eo(this.ui.next());return this.referenceDelegate.Ii(),n(r).next(e=>this.referenceDelegate.di(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}Ei(e,t){return _n.or(Object.values(this.ai).map(n=>()=>n.containsKey(e,t)))}}class Eo extends yn{constructor(e){super(),this.currentSequenceNumber=e}}class So{constructor(e){this.persistence=e,this.Ai=new go,this.Ri=null}static Vi(e){return new So(e)}get mi(){if(this.Ri)return this.Ri;throw
|
|
1477
|
+
*/class To{constructor(e,t){this.ai={},this.overlays={},this.ui=new Tn(0),this.ci=!1,this.ci=!0,this.li=new po,this.referenceDelegate=e(this),this.hi=new wo(this),this.indexManager=new Yi,this.remoteDocumentCache=function(e){return new vo(e)}(e=>this.referenceDelegate.Pi(e)),this.serializer=new Qi(t),this.Ti=new lo(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new fo,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new yo(t,this.referenceDelegate),this.ai[e.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,t,n){Et("MemoryPersistence","Starting transaction:",e);const r=new Eo(this.ui.next());return this.referenceDelegate.Ii(),n(r).next(e=>this.referenceDelegate.di(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}Ei(e,t){return _n.or(Object.values(this.ai).map(n=>()=>n.containsKey(e,t)))}}class Eo extends yn{constructor(e){super(),this.currentSequenceNumber=e}}class So{constructor(e){this.persistence=e,this.Ai=new go,this.Ri=null}static Vi(e){return new So(e)}get mi(){if(this.Ri)return this.Ri;throw Ct(60996)}addReference(e,t,n){return this.Ai.addReference(n,t),this.mi.delete(n.toString()),_n.resolve()}removeReference(e,t,n){return this.Ai.removeReference(n,t),this.mi.add(n.toString()),_n.resolve()}markPotentiallyOrphaned(e,t){return this.mi.add(t.toString()),_n.resolve()}removeTarget(e,t){this.Ai.zr(t.targetId).forEach(e=>this.mi.add(e.toString()));const n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.mi.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Ii(){this.Ri=new Set}di(e){const t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return _n.forEach(this.mi,n=>{const r=en.fromPath(n);return this.fi(e,r).next(e=>{e||t.removeEntry(r,fn.min())})}).next(()=>(this.Ri=null,t.apply(e)))}updateLimboDocument(e,t){return this.fi(e,t).next(e=>{e?this.mi.delete(t.toString()):this.mi.add(t.toString())})}Pi(e){return 0}fi(e,t){return _n.or([()=>_n.resolve(this.Ai.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ei(e,t)])}}class Io{constructor(e,t){this.persistence=e,this.gi=new as(e=>function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t=bn(t)),t=In(e.get(n),t);return bn(t)}(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new ao(e,t)}(this,t)}static Vi(e,t){return new Io(e,t)}Ii(){}di(e){return _n.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}mr(e){const t=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}yr(e){let t=0;return this.gr(e,e=>{t++}).next(()=>t)}gr(e,t){return _n.forEach(this.gi,(n,r)=>this.Sr(e,n,r).next(e=>e?_n.resolve():t(r)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0;const r=this.persistence.getRemoteDocumentCache(),s=r.newChangeBuffer();return r.ri(e,r=>this.Sr(e,r,t).next(e=>{e||(n++,s.removeEntry(r,fn.min()))})).next(()=>s.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.gi.set(t,e.currentSequenceNumber),_n.resolve()}removeTarget(e,t){const n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),_n.resolve()}removeReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),_n.resolve()}updateLimboDocument(e,t){return this.gi.set(t,e.currentSequenceNumber),_n.resolve()}Pi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=hr(e.data.value)),t}Sr(e,t,n){return _n.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{const e=this.gi.get(t);return _n.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}
|
|
1478
1478
|
/**
|
|
1479
1479
|
* @license
|
|
1480
1480
|
* Copyright 2017 Google LLC
|
|
@@ -1506,7 +1506,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1506
1506
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1507
1507
|
* See the License for the specific language governing permissions and
|
|
1508
1508
|
* limitations under the License.
|
|
1509
|
-
*/class
|
|
1509
|
+
*/class Co{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}
|
|
1510
1510
|
/**
|
|
1511
1511
|
* @license
|
|
1512
1512
|
* Copyright 2019 Google LLC
|
|
@@ -1522,7 +1522,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1522
1522
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1523
1523
|
* See the License for the specific language governing permissions and
|
|
1524
1524
|
* limitations under the License.
|
|
1525
|
-
*/class
|
|
1525
|
+
*/class Ao{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=_()?8:function(e){const t=e.match(/Android ([\d.]+)/i),n=t?t[1].split(".").slice(0,2).join("."):"-1";return Number(n)}(v())>0?6:4}initialize(e,t){this.gs=e,this.indexManager=t,this.As=!0}getDocumentsMatchingQuery(e,t,n,r){const s={result:null};return this.ps(e,t).next(e=>{s.result=e}).next(()=>{if(!s.result)return this.ys(e,t,r,n).next(e=>{s.result=e})}).next(()=>{if(s.result)return;const n=new Co;return this.ws(e,t,n).next(r=>{if(s.result=r,this.Rs)return this.Ss(e,t,n,r.size)})}).next(()=>s.result)}Ss(e,t,n,r){return n.documentReadCount<this.Vs?(Tt()<=M.DEBUG&&Et("QueryEngine","SDK will not create cache indexes for query:",rs(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),_n.resolve()):(Tt()<=M.DEBUG&&Et("QueryEngine","Query:",rs(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.fs*r?(Tt()<=M.DEBUG&&Et("QueryEngine","The SDK decides to create cache indexes for query:",rs(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Xr(t))):_n.resolve())}ps(e,t){if(Qr(t))return _n.resolve(null);let n=Xr(t);return this.indexManager.getIndexType(e,n).next(r=>0===r?null:(null!==t.limit&&1===r&&(t=es(t,null,"F"),n=Xr(t)),this.indexManager.getDocumentsMatchingTarget(e,n).next(r=>{const s=vs(...r);return this.gs.getDocuments(e,s).next(r=>this.indexManager.getMinOffset(e,n).next(n=>{const i=this.bs(t,r);return this.Ds(t,i,s,n.readTime)?this.ps(e,es(t,null,"F")):this.vs(e,i,t,n)}))})))}ys(e,t,n,r){return Qr(t)||r.isEqual(fn.min())?_n.resolve(null):this.gs.getDocuments(e,n).next(s=>{const i=this.bs(t,s);return this.Ds(t,i,n,r)?_n.resolve(null):(Tt()<=M.DEBUG&&Et("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),rs(t)),this.vs(e,i,t,function(e,t){const n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1,s=fn.fromTimestamp(1e9===r?new dn(n+1,0):new dn(n,r));return new gn(s,en.empty(),t)}(r,-1)).next(e=>e))})}bs(e,t){let n=new Dn(is(e));return t.forEach((t,r)=>{ss(e,r)&&(n=n.add(r))}),n}Ds(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;const s="F"===e.limitType?t.last():t.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(r)>0)}ws(e,t,n){return Tt()<=M.DEBUG&&Et("QueryEngine","Using full collection scan to execute query:",rs(t)),this.gs.getDocumentsMatchingQuery(e,t,gn.min(),n)}vs(e,t,n,r){return this.gs.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}
|
|
1526
1526
|
/**
|
|
1527
1527
|
* @license
|
|
1528
1528
|
* Copyright 2020 Google LLC
|
|
@@ -1538,7 +1538,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1538
1538
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1539
1539
|
* See the License for the specific language governing permissions and
|
|
1540
1540
|
* limitations under the License.
|
|
1541
|
-
*/const ko="LocalStore";class
|
|
1541
|
+
*/const ko="LocalStore";class No{constructor(e,t,n,r){this.persistence=e,this.Cs=t,this.serializer=r,this.Fs=new Nn(zt),this.Ms=new as(e=>zr(e),qr),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(n)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ho(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Fs))}}async function Ro(e,t){const n=Nt(e);return await n.persistence.runTransaction("Handle user change","readonly",e=>{let r;return n.mutationQueue.getAllMutationBatches(e).next(s=>(r=s,n.Ns(t),n.mutationQueue.getAllMutationBatches(e))).next(t=>{const s=[],i=[];let o=vs();for(const e of r){s.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}for(const e of t){i.push(e.batchId);for(const t of e.mutations)o=o.add(t.key)}return n.localDocuments.getDocuments(e,o).next(e=>({Bs:e,removedBatchIds:s,addedBatchIds:i}))})})}function Oo(e){const t=Nt(e);return t.persistence.runTransaction("Get last remote snapshot version","readonly",e=>t.hi.getLastRemoteSnapshotVersion(e))}function Do(e,t){const n=Nt(e),r=t.snapshotVersion;let s=n.Fs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{const i=n.Os.newChangeBuffer({trackRemovals:!0});s=n.Fs;const o=[];t.targetChanges.forEach((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.hi.removeMatchingKeys(e,i.removedDocuments,a).next(()=>n.hi.addMatchingKeys(e,i.addedDocuments,a)));let u=c.withSequenceNumber(e.currentSequenceNumber);null!==t.targetMismatches.get(a)?u=u.withResumeToken(xn.EMPTY_BYTE_STRING,fn.min()).withLastLimboFreeSnapshotVersion(fn.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(e,t,n){if(0===e.resumeToken.approximateByteSize())return!0;if(t.snapshotVersion.toMicroseconds()-e.snapshotVersion.toMicroseconds()>=3e8)return!0;return n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0}(c,u,i)&&o.push(n.hi.updateTargetData(e,u))});let a=us(),c=vs();if(t.documentUpdates.forEach(r=>{t.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(e,r))}),o.push(function(e,t,n){let r=vs(),s=vs();return n.forEach(e=>r=r.add(e)),t.getEntries(e,r).next(e=>{let r=us();return n.forEach((n,i)=>{const o=e.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(fn.min())?(t.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(t.addEntry(i),r=r.insert(n,i)):Et(ko,"Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)}),{Ls:r,ks:s}})}(e,i,t.documentUpdates).next(e=>{a=e.Ls,c=e.ks})),!r.isEqual(fn.min())){const t=n.hi.getLastRemoteSnapshotVersion(e).next(t=>n.hi.setTargetsMetadata(e,e.currentSequenceNumber,r));o.push(t)}return _n.waitFor(o).next(()=>i.apply(e)).next(()=>n.localDocuments.getLocalViewOfDocuments(e,a,c)).next(()=>a)}).then(e=>(n.Fs=s,e))}function Po(e,t){const n=Nt(e);return n.persistence.runTransaction("Get next mutation batch","readonly",e=>(void 0===t&&(t=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(e,t)))}async function Lo(e,t,n){const r=Nt(e),s=r.Fs.get(t),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,e=>r.persistence.referenceDelegate.removeTarget(e,s))}catch(e){if(!wn(e))throw e;Et(ko,`Failed to update sequence numbers for target ${t}: ${e}`)}r.Fs=r.Fs.remove(t),r.Ms.delete(s.target)}function Mo(e,t,n){const r=Nt(e);let s=fn.min(),i=vs();return r.persistence.runTransaction("Execute query","readwrite",e=>function(e,t,n){const r=Nt(e),s=r.Ms.get(n);return void 0!==s?_n.resolve(r.Fs.get(s)):r.hi.getTargetData(t,n)}(r,e,Xr(t)).next(t=>{if(t)return s=t.lastLimboFreeSnapshotVersion,r.hi.getMatchingKeysForTargetId(e,t.targetId).next(e=>{i=e})}).next(()=>r.Cs.getDocumentsMatchingQuery(e,t,n?s:fn.min(),n?i:vs())).next(e=>(function(e,t,n){let r=e.xs.get(t)||fn.min();n.forEach((e,t)=>{t.readTime.compareTo(r)>0&&(r=t.readTime)}),e.xs.set(t,r)}(r,function(e){return e.collectionGroup||(e.path.length%2==1?e.path.lastSegment():e.path.get(e.path.length-2))}(t),e),{documents:e,qs:i})))}class xo{constructor(){this.activeTargetIds=_s}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class Uo{constructor(){this.Fo=new xo,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,t,n){this.Mo[e]=t}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new xo,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}
|
|
1542
1542
|
/**
|
|
1543
1543
|
* @license
|
|
1544
1544
|
* Copyright 2019 Google LLC
|
|
@@ -1618,7 +1618,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1618
1618
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1619
1619
|
* See the License for the specific language governing permissions and
|
|
1620
1620
|
* limitations under the License.
|
|
1621
|
-
*/class
|
|
1621
|
+
*/class Ko{constructor(e){this.Ho=e.Ho,this.Yo=e.Yo}Zo(e){this.Xo=e}e_(e){this.t_=e}n_(e){this.r_=e}onMessage(e){this.i_=e}close(){this.Yo()}send(e){this.Ho(e)}s_(){this.Xo()}o_(){this.t_()}__(e){this.r_(e)}a_(e){this.i_(e)}}
|
|
1622
1622
|
/**
|
|
1623
1623
|
* @license
|
|
1624
1624
|
* Copyright 2017 Google LLC
|
|
@@ -1634,7 +1634,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1634
1634
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1635
1635
|
* See the License for the specific language governing permissions and
|
|
1636
1636
|
* limitations under the License.
|
|
1637
|
-
*/const
|
|
1637
|
+
*/const Go="WebChannelConnection";class Wo extends qo{constructor(e){super(e),this.u_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}jo(e,t,n,r,s){const i=Ho();return new Promise((s,o)=>{const a=new at;a.setWithCredentials(!0),a.listenOnce(ut.COMPLETE,()=>{try{switch(a.getLastErrorCode()){case ht.NO_ERROR:const t=a.getResponseJson();Et(Go,`XHR for RPC '${e}' ${i} received:`,JSON.stringify(t)),s(t);break;case ht.TIMEOUT:Et(Go,`RPC '${e}' ${i} timed out`),o(new Ot(Rt.DEADLINE_EXCEEDED,"Request time out"));break;case ht.HTTP_ERROR:const n=a.getStatus();if(Et(Go,`RPC '${e}' ${i} failed with status:`,n,"response text:",a.getResponseText()),n>0){let e=a.getResponseJson();Array.isArray(e)&&(e=e[0]);const t=null==e?void 0:e.error;if(t&&t.status&&t.message){const e=function(e){const t=e.toLowerCase().replace(/_/g,"-");return Object.values(Rt).indexOf(t)>=0?t:Rt.UNKNOWN}(t.status);o(new Ot(e,t.message))}else o(new Ot(Rt.UNKNOWN,"Server responded with status "+a.getStatus()))}else o(new Ot(Rt.UNAVAILABLE,"Connection failed."));break;default:Ct(9055,{c_:e,streamId:i,l_:a.getLastErrorCode(),h_:a.getLastError()})}}finally{Et(Go,`RPC '${e}' ${i} completed.`)}});const c=JSON.stringify(r);Et(Go,`RPC '${e}' ${i} sending request:`,r),a.send(t,"POST",c,n,15)})}P_(e,t,n){const r=Ho(),s=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],i=pt(),o=ft(),a={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},c=this.longPollingOptions.timeoutSeconds;void 0!==c&&(a.longPollingTimeout=Math.round(1e3*c)),this.useFetchStreams&&(a.useFetchStreams=!0),this.zo(a.initMessageHeaders,t,n),a.encodeInitMessageHeaders=!0;const u=s.join("");Et(Go,`Creating RPC '${e}' stream ${r}: ${u}`,a);const h=i.createWebChannel(u,a);this.T_(h);let l=!1,d=!1;const f=new Ko({Ho:t=>{d?Et(Go,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(l||(Et(Go,`Opening RPC '${e}' stream ${r} transport.`),h.open(),l=!0),Et(Go,`RPC '${e}' stream ${r} sending:`,t),h.send(t))},Yo:()=>h.close()}),p=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return p(h,ct.EventType.OPEN,()=>{d||(Et(Go,`RPC '${e}' stream ${r} transport opened.`),f.s_())}),p(h,ct.EventType.CLOSE,()=>{d||(d=!0,Et(Go,`RPC '${e}' stream ${r} transport closed`),f.__(),this.I_(h))}),p(h,ct.EventType.ERROR,t=>{d||(d=!0,It(Go,`RPC '${e}' stream ${r} transport errored. Name:`,t.name,"Message:",t.message),f.__(new Ot(Rt.UNAVAILABLE,"The operation could not be completed")))}),p(h,ct.EventType.MESSAGE,t=>{var n;if(!d){const s=t.data[0];kt(!!s,16349);const i=s,o=(null==i?void 0:i.error)||(null===(n=i[0])||void 0===n?void 0:n.error);if(o){Et(Go,`RPC '${e}' stream ${r} received error:`,o);const t=o.status;let n=function(e){const t=ti[e];if(void 0!==t)return ri(t)}(t),s=o.message;void 0===n&&(n=Rt.INTERNAL,s="Unknown error status: "+t+" with message "+o.message),d=!0,f.__(new Ot(n,s)),h.close()}else Et(Go,`RPC '${e}' stream ${r} received:`,s),f.a_(s)}}),p(o,dt.STAT_EVENT,t=>{t.stat===lt.PROXY?Et(Go,`RPC '${e}' stream ${r} detected buffering proxy`):t.stat===lt.NOPROXY&&Et(Go,`RPC '${e}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{f.o_()},0),f}terminate(){this.u_.forEach(e=>e.close()),this.u_=[]}T_(e){this.u_.push(e)}I_(e){this.u_=this.u_.filter(t=>t===e)}}function Qo(){return"undefined"!=typeof document?document:null}
|
|
1638
1638
|
/**
|
|
1639
1639
|
* @license
|
|
1640
1640
|
* Copyright 2020 Google LLC
|
|
@@ -1682,7 +1682,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1682
1682
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1683
1683
|
* See the License for the specific language governing permissions and
|
|
1684
1684
|
* limitations under the License.
|
|
1685
|
-
*/const Xo="PersistentStream";class Zo{constructor(e,t,n,r,s,i,o,a){this.Fi=e,this.w_=n,this.S_=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Yo(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===
|
|
1685
|
+
*/const Xo="PersistentStream";class Zo{constructor(e,t,n,r,s,i,o,a){this.Fi=e,this.w_=n,this.S_=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new Yo(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===Rt.RESOURCE_EXHAUSTED?(St(t.toString()),St("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===Rt.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.n_(t)}U_(){}auth(){this.state=1;const e=this.K_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.b_===t&&this.W_(e,n)},t=>{e(()=>{const e=new Ot(Rt.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)})})}W_(e,t){const n=this.K_(this.b_);this.stream=this.z_(e,t),this.stream.Zo(()=>{n(()=>this.listener.Zo())}),this.stream.e_(()=>{n(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(e=>{n(()=>this.G_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.C_?this.j_(e):this.onNext(e))})}O_(){this.state=5,this.F_.g_(async()=>{this.state=0,this.start()})}G_(e){return Et(Xo,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget(()=>this.b_===e?t():(Et(Xo,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class ea extends Zo{constructor(e,t,n,r,s,i){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,i),this.serializer=s}z_(e,t){return this.connection.P_("Listen",e,t)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();const t=function(e,t){let n;if("targetChange"in t){t.targetChange;const r=function(e){return"NO_CHANGE"===e?0:"ADD"===e?1:"REMOVE"===e?2:"CURRENT"===e?3:"RESET"===e?4:Ct(39313,{state:e})}(t.targetChange.targetChangeType||"NO_CHANGE"),s=t.targetChange.targetIds||[],i=function(e,t){return e.useProto3Json?(kt(void 0===t||"string"==typeof t,58123),xn.fromBase64String(t||"")):(kt(void 0===t||t instanceof Buffer||t instanceof Uint8Array,16193),xn.fromUint8Array(t||new Uint8Array))}(e,t.targetChange.resumeToken),o=t.targetChange.cause,a=o&&function(e){const t=void 0===e.code?Rt.UNKNOWN:ri(e.code);return new Ot(t,e.message||"")}(o);n=new fi(r,s,i,a||null)}else if("documentChange"in t){t.documentChange;const r=t.documentChange;r.document,r.document.name,r.document.updateTime;const s=Oi(e,r.document.name),i=Ci(r.document.updateTime),o=r.document.createTime?Ci(r.document.createTime):fn.min(),a=new vr({mapValue:{fields:r.document.fields}}),c=wr.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new li(u,h,c.key,c)}else if("documentDelete"in t){t.documentDelete;const r=t.documentDelete;r.document;const s=Oi(e,r.document),i=r.readTime?Ci(r.readTime):fn.min(),o=wr.newNoDocument(s,i),a=r.removedTargetIds||[];n=new li([],a,o.key,o)}else if("documentRemove"in t){t.documentRemove;const r=t.documentRemove;r.document;const s=Oi(e,r.document),i=r.removedTargetIds||[];n=new li([],i,s,null)}else{if(!("filter"in t))return Ct(11601,{At:t});{t.filter;const e=t.filter;e.targetId;const{count:r=0,unchangedNames:s}=e,i=new ei(r,s),o=e.targetId;n=new di(o,i)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return fn.min();const t=e.targetChange;return t.targetIds&&t.targetIds.length?fn.min():t.readTime?Ci(t.readTime):fn.min()}(e);return this.listener.J_(t,n)}H_(e){const t={};t.database=Pi(this.serializer),t.addTarget=function(e,t){let n;const r=t.target;if(n=Kr(r)?{documents:xi(e,r)}:{query:Ui(e,r).Vt},n.targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=Ii(e,t.resumeToken);const r=Ei(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(fn.min())>0){n.readTime=Si(e,t.snapshotVersion.toTimestamp());const r=Ei(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);const n=function(e,t){const n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return Ct(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.k_(t)}Y_(e){const t={};t.database=Pi(this.serializer),t.removeTarget=e,this.k_(t)}}class ta extends Zo{constructor(e,t,n,r,s,i){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,i),this.serializer=s}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return kt(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,kt(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){kt(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();const t=function(e,t){return e&&e.length>0?(kt(void 0!==t,14353),e.map(e=>function(e,t){let n=e.updateTime?Ci(e.updateTime):Ci(t);return n.isEqual(fn.min())&&(n=Ci(t)),new Ms(n,e.transformResults||[])}(e,t))):[]}(e.writeResults,e.commitTime),n=Ci(e.commitTime);return this.listener.ta(n,t)}na(){const e={};e.database=Pi(this.serializer),this.k_(e)}X_(e){const t={streamToken:this.lastStreamToken,writes:e.map(e=>function(e,t){let n;if(t instanceof zs)n={update:Mi(e,t.key,t.value)};else if(t instanceof Qs)n={delete:Ri(e,t.key)};else if(t instanceof qs)n={update:Mi(e,t.key,t.data),updateMask:Ki(t.fieldMask)};else{if(!(t instanceof Js))return Ct(16599,{Rt:t.type});n={verify:Ri(e,t.key)}}return t.fieldTransforms.length>0&&(n.updateTransforms=t.fieldTransforms.map(e=>function(e,t){const n=t.transform;if(n instanceof As)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof ks)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Rs)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ds)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw Ct(20930,{transform:t.transform})}(0,e))),t.precondition.isNone||(n.currentDocument=function(e,t){return void 0!==t.updateTime?{updateTime:bi(e,t.updateTime)}:void 0!==t.exists?{exists:t.exists}:Ct(27497)}(e,t.precondition)),n}(this.serializer,e))};this.k_(t)}}
|
|
1686
1686
|
/**
|
|
1687
1687
|
* @license
|
|
1688
1688
|
* Copyright 2017 Google LLC
|
|
@@ -1698,7 +1698,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1698
1698
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1699
1699
|
* See the License for the specific language governing permissions and
|
|
1700
1700
|
* limitations under the License.
|
|
1701
|
-
*/class na{}class ra extends na{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.ra=!1}ia(){if(this.ra)throw new
|
|
1701
|
+
*/class na{}class ra extends na{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer=r,this.ra=!1}ia(){if(this.ra)throw new Ot(Rt.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,t,n,r){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,i])=>this.connection.Wo(e,ki(t,n),r,s,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Rt.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Ot(Rt.UNKNOWN,e.toString())})}Jo(e,t,n,r,s){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Jo(e,ki(t,n),r,i,o,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===Rt.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new Ot(Rt.UNKNOWN,e.toString())})}terminate(){this.ra=!0,this.connection.terminate()}}class sa{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.sa=0,this.oa=null,this._a=!0}aa(){0===this.sa&&(this.ua("Unknown"),this.oa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.oa=null,this.ca("Backend didn't respond within 10 seconds."),this.ua("Offline"),Promise.resolve())))}la(e){"Online"===this.state?this.ua("Unknown"):(this.sa++,this.sa>=1&&(this.ha(),this.ca(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ua("Offline")))}set(e){this.ha(),this.sa=0,"Online"===e&&(this._a=!1),this.ua(e)}ua(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ca(e){const t=`Could not reach Cloud Firestore backend. ${e}\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this._a?(St(t),this._a=!1):Et("OnlineStateTracker",t)}ha(){null!==this.oa&&(this.oa.cancel(),this.oa=null)}}
|
|
1702
1702
|
/**
|
|
1703
1703
|
* @license
|
|
1704
1704
|
* Copyright 2017 Google LLC
|
|
@@ -1714,7 +1714,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1714
1714
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1715
1715
|
* See the License for the specific language governing permissions and
|
|
1716
1716
|
* limitations under the License.
|
|
1717
|
-
*/const ia="RemoteStore";class oa{constructor(e,t,n,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=s,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{ga(this)&&(Et(ia,"Restarting streams for network reachability change."),await async function(e){const t=
|
|
1717
|
+
*/const ia="RemoteStore";class oa{constructor(e,t,n,r,s){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=s,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{ga(this)&&(Et(ia,"Restarting streams for network reachability change."),await async function(e){const t=Nt(e);t.Ia.add(4),await ca(t),t.Aa.set("Unknown"),t.Ia.delete(4),await aa(t)}(this))})}),this.Aa=new sa(n,r)}}async function aa(e){if(ga(e))for(const t of e.da)await t(!0)}async function ca(e){for(const t of e.da)await t(!1)}function ua(e,t){const n=Nt(e);n.Ta.has(t.targetId)||(n.Ta.set(t.targetId,t),pa(n)?fa(n):Pa(n).x_()&&la(n,t))}function ha(e,t){const n=Nt(e),r=Pa(n);n.Ta.delete(t),r.x_()&&da(n,t),0===n.Ta.size&&(r.x_()?r.B_():ga(n)&&n.Aa.set("Unknown"))}function la(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(fn.min())>0){const n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}Pa(e).H_(t)}function da(e,t){e.Ra.$e(t),Pa(e).Y_(t)}function fa(e){e.Ra=new gi({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),Pa(e).start(),e.Aa.aa()}function pa(e){return ga(e)&&!Pa(e).M_()&&e.Ta.size>0}function ga(e){return 0===Nt(e).Ia.size}function ma(e){e.Ra=void 0}async function ya(e){e.Aa.set("Online")}async function va(e){e.Ta.forEach((t,n)=>{la(e,t)})}async function _a(e,t){ma(e),pa(e)?(e.Aa.la(t),fa(e)):e.Aa.set("Unknown")}async function wa(e,t,n){if(e.Aa.set("Online"),t instanceof fi&&2===t.state&&t.cause)try{await async function(e,t){const n=t.cause;for(const r of t.targetIds)e.Ta.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.Ta.delete(r),e.Ra.removeTarget(r))}(e,t)}catch(n){Et(ia,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await Ta(e,n)}else if(t instanceof li?e.Ra.Ye(t):t instanceof di?e.Ra.it(t):e.Ra.et(t),!n.isEqual(fn.min()))try{const t=await Oo(e.localStore);n.compareTo(t)>=0&&await function(e,t){const n=e.Ra.Pt(t);return n.targetChanges.forEach((n,r)=>{if(n.resumeToken.approximateByteSize()>0){const s=e.Ta.get(r);s&&e.Ta.set(r,s.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{const r=e.Ta.get(t);if(!r)return;e.Ta.set(t,r.withResumeToken(xn.EMPTY_BYTE_STRING,r.snapshotVersion)),da(e,t);const s=new Wi(r.target,t,n,r.sequenceNumber);la(e,s)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){Et(ia,"Failed to raise snapshot:",t),await Ta(e,t)}}async function Ta(e,t,n){if(!wn(t))throw t;e.Ia.add(1),await ca(e),e.Aa.set("Offline"),n||(n=()=>Oo(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{Et(ia,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await aa(e)})}function Ea(e,t){return t().catch(n=>Ta(e,n,t))}async function Sa(e){const t=Nt(e),n=La(t);let r=t.Pa.length>0?t.Pa[t.Pa.length-1].batchId:-1;for(;Ia(t);)try{const e=await Po(t.localStore,r);if(null===e){0===t.Pa.length&&n.B_();break}r=e.batchId,ba(t,e)}catch(e){await Ta(t,e)}Ca(t)&&Aa(t)}function Ia(e){return ga(e)&&e.Pa.length<10}function ba(e,t){e.Pa.push(t);const n=La(e);n.x_()&&n.Z_&&n.X_(t.mutations)}function Ca(e){return ga(e)&&!La(e).M_()&&e.Pa.length>0}function Aa(e){La(e).start()}async function ka(e){La(e).na()}async function Na(e){const t=La(e);for(const n of e.Pa)t.X_(n.mutations)}async function Ra(e,t,n){const r=e.Pa.shift(),s=Xs.from(r,t,n);await Ea(e,()=>e.remoteSyncer.applySuccessfulWrite(s)),await Sa(e)}async function Oa(e,t){t&&La(e).Z_&&await async function(e,t){if(function(e){return function(e){switch(e){case Rt.OK:return Ct(64938);case Rt.CANCELLED:case Rt.UNKNOWN:case Rt.DEADLINE_EXCEEDED:case Rt.RESOURCE_EXHAUSTED:case Rt.INTERNAL:case Rt.UNAVAILABLE:case Rt.UNAUTHENTICATED:return!1;case Rt.INVALID_ARGUMENT:case Rt.NOT_FOUND:case Rt.ALREADY_EXISTS:case Rt.PERMISSION_DENIED:case Rt.FAILED_PRECONDITION:case Rt.ABORTED:case Rt.OUT_OF_RANGE:case Rt.UNIMPLEMENTED:case Rt.DATA_LOSS:return!0;default:return Ct(15467,{code:e})}}(e)&&e!==Rt.ABORTED}(t.code)){const n=e.Pa.shift();La(e).N_(),await Ea(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await Sa(e)}}(e,t),Ca(e)&&Aa(e)}async function Da(e,t){const n=Nt(e);n.asyncQueue.verifyOperationInProgress(),Et(ia,"RemoteStore received new credentials");const r=ga(n);n.Ia.add(3),await ca(n),r&&n.Aa.set("Unknown"),await n.remoteSyncer.handleCredentialChange(t),n.Ia.delete(3),await aa(n)}function Pa(e){return e.Va||(e.Va=function(e,t,n){const r=Nt(e);return r.ia(),new ea(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)
|
|
1718
1718
|
/**
|
|
1719
1719
|
* @license
|
|
1720
1720
|
* Copyright 2018 Google LLC
|
|
@@ -1730,7 +1730,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1730
1730
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1731
1731
|
* See the License for the specific language governing permissions and
|
|
1732
1732
|
* limitations under the License.
|
|
1733
|
-
*/}(e.datastore,e.asyncQueue,{Zo:ya.bind(null,e),e_:va.bind(null,e),n_:_a.bind(null,e),J_:wa.bind(null,e)}),e.da.push(async t=>{t?(e.Va.N_(),pa(e)?fa(e):e.Aa.set("Unknown")):(await e.Va.stop(),ma(e))})),e.Va}function La(e){return e.ma||(e.ma=function(e,t,n){const r=
|
|
1733
|
+
*/}(e.datastore,e.asyncQueue,{Zo:ya.bind(null,e),e_:va.bind(null,e),n_:_a.bind(null,e),J_:wa.bind(null,e)}),e.da.push(async t=>{t?(e.Va.N_(),pa(e)?fa(e):e.Aa.set("Unknown")):(await e.Va.stop(),ma(e))})),e.Va}function La(e){return e.ma||(e.ma=function(e,t,n){const r=Nt(e);return r.ia(),new ta(t,r.connection,r.authCredentials,r.appCheckCredentials,r.serializer,n)}(e.datastore,e.asyncQueue,{Zo:()=>Promise.resolve(),e_:ka.bind(null,e),n_:Oa.bind(null,e),ea:Na.bind(null,e),ta:Ra.bind(null,e)}),e.da.push(async t=>{t?(e.ma.N_(),await Sa(e)):(await e.ma.stop(),e.Pa.length>0&&(Et(ia,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))})),e.ma
|
|
1734
1734
|
/**
|
|
1735
1735
|
* @license
|
|
1736
1736
|
* Copyright 2017 Google LLC
|
|
@@ -1746,7 +1746,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1746
1746
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1747
1747
|
* See the License for the specific language governing permissions and
|
|
1748
1748
|
* limitations under the License.
|
|
1749
|
-
*/}class Ma{constructor(e,t,n,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Dt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,s){const i=Date.now()+n,o=new Ma(e,t,i,r,s);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new
|
|
1749
|
+
*/}class Ma{constructor(e,t,n,r,s){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=s,this.deferred=new Dt,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,s){const i=Date.now()+n,o=new Ma(e,t,i,r,s);return o.start(n),o}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new Ot(Rt.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function xa(e,t){if(St("AsyncQueue",`${t}: ${e}`),wn(e))return new Ot(Rt.UNAVAILABLE,`${t}: ${e}`);throw e}
|
|
1750
1750
|
/**
|
|
1751
1751
|
* @license
|
|
1752
1752
|
* Copyright 2017 Google LLC
|
|
@@ -1762,7 +1762,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1762
1762
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1763
1763
|
* See the License for the specific language governing permissions and
|
|
1764
1764
|
* limitations under the License.
|
|
1765
|
-
*/class Ua{static emptySet(e){return new Ua(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||en.comparator(t.key,n.key):(e,t)=>en.comparator(e.key,t.key),this.keyedMap=ls(),this.sortedSet=new
|
|
1765
|
+
*/class Ua{static emptySet(e){return new Ua(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||en.comparator(t.key,n.key):(e,t)=>en.comparator(e.key,t.key),this.keyedMap=ls(),this.sortedSet=new Nn(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){const t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){const t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof Ua))return!1;if(this.size!==e.size)return!1;const t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){const e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){const e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){const n=new Ua;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}
|
|
1766
1766
|
/**
|
|
1767
1767
|
* @license
|
|
1768
1768
|
* Copyright 2017 Google LLC
|
|
@@ -1778,7 +1778,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1778
1778
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1779
1779
|
* See the License for the specific language governing permissions and
|
|
1780
1780
|
* limitations under the License.
|
|
1781
|
-
*/class Fa{constructor(){this.fa=new
|
|
1781
|
+
*/class Fa{constructor(){this.fa=new Nn(en.comparator)}track(e){const t=e.doc.key,n=this.fa.get(t);n?0!==e.type&&3===n.type?this.fa=this.fa.insert(t,e):3===e.type&&1!==n.type?this.fa=this.fa.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.fa=this.fa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.fa=this.fa.remove(t):1===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):Ct(63341,{At:e,ga:n}):this.fa=this.fa.insert(t,e)}pa(){const e=[];return this.fa.inorderTraversal((t,n)=>{e.push(n)}),e}}class Va{constructor(e,t,n,r,s,i,o,a,c){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=s,this.fromCache=i,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=c}static fromInitialDocuments(e,t,n,r,s){const i=[];return t.forEach(e=>{i.push({type:0,doc:e})}),new Va(e,t,Ua.emptySet(t),i,n,r,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&ts(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}
|
|
1782
1782
|
/**
|
|
1783
1783
|
* @license
|
|
1784
1784
|
* Copyright 2017 Google LLC
|
|
@@ -1794,7 +1794,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1794
1794
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1795
1795
|
* See the License for the specific language governing permissions and
|
|
1796
1796
|
* limitations under the License.
|
|
1797
|
-
*/class ja{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class Ba{constructor(){this.queries=Ha(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=
|
|
1797
|
+
*/class ja{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class Ba{constructor(){this.queries=Ha(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){const n=Nt(e),r=n.queries;n.queries=Ha(),r.forEach((e,n)=>{for(const e of n.wa)e.onError(t)})}(this,new Ot(Rt.ABORTED,"Firestore shutting down"))}}function Ha(){return new as(e=>ns(e),ts)}async function $a(e,t){const n=Nt(e);let r=3;const s=t.query;let i=n.queries.get(s);i?!i.Sa()&&t.ba()&&(r=2):(i=new ja,r=t.ba()?0:1);try{switch(r){case 0:i.ya=await n.onListen(s,!0);break;case 1:i.ya=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(e){const n=xa(e,`Initialization of query '${rs(t.query)}' failed`);return void t.onError(n)}n.queries.set(s,i),i.wa.push(t),t.va(n.onlineState),i.ya&&t.Ca(i.ya)&&Ga(n)}async function za(e,t){const n=Nt(e),r=t.query;let s=3;const i=n.queries.get(r);if(i){const e=i.wa.indexOf(t);e>=0&&(i.wa.splice(e,1),0===i.wa.length?s=t.ba()?0:1:!i.Sa()&&t.ba()&&(s=2))}switch(s){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function qa(e,t){const n=Nt(e);let r=!1;for(const e of t){const t=e.query,s=n.queries.get(t);if(s){for(const t of s.wa)t.Ca(e)&&(r=!0);s.ya=e}}r&&Ga(n)}function Ka(e,t,n){const r=Nt(e),s=r.queries.get(t);if(s)for(const e of s.wa)e.onError(n);r.queries.delete(t)}function Ga(e){e.Da.forEach(e=>{e.next()})}var Wa,Qa;(Qa=Wa||(Wa={})).Fa="default",Qa.Cache="cache";class Ja{constructor(e,t,n){this.query=e,this.Ma=t,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(e){if(!this.options.includeMetadataChanges){const t=[];for(const n of e.docChanges)3!==n.type&&t.push(n);e=new Va(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),t=!0):this.Ba(e,this.onlineState)&&(this.La(e),t=!0),this.Oa=e,t}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let t=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),t=!0),t}Ba(e,t){if(!e.fromCache)return!0;if(!this.ba())return!0;const n="Offline"!==t;return(!this.options.ka||!n)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Na(e){if(e.docChanges.length>0)return!0;const t=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}La(e){e=Va.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==Wa.Cache}}
|
|
1798
1798
|
/**
|
|
1799
1799
|
* @license
|
|
1800
1800
|
* Copyright 2017 Google LLC
|
|
@@ -1810,7 +1810,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1810
1810
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1811
1811
|
* See the License for the specific language governing permissions and
|
|
1812
1812
|
* limitations under the License.
|
|
1813
|
-
*/class Ya{constructor(e){this.key=e}}class Xa{constructor(e){this.key=e}}class Za{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=vs(),this.mutatedKeys=vs(),this.Xa=is(e),this.eu=new Ua(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new Fa,r=t?t.eu:this.eu;let s=t?t.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal((e,t)=>{const u=r.get(e),h=ss(this.query,t)?t:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.iu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Xa(h,a)>0||c&&this.Xa(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(e):s.delete(e)):(i=i.delete(e),s=s.delete(e)))}),null!==this.query.limit)for(;i.size>this.query.limit;){const e="F"===this.query.limitType?i.last():i.first();i=i.delete(e.key),s=s.delete(e.key),n.track({type:1,doc:e})}return{eu:i,ru:n,Ds:o,mutatedKeys:s}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){const s=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const i=e.ru.pa();i.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return
|
|
1813
|
+
*/class Ya{constructor(e){this.key=e}}class Xa{constructor(e){this.key=e}}class Za{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=vs(),this.mutatedKeys=vs(),this.Xa=is(e),this.eu=new Ua(this.Xa)}get tu(){return this.Ha}nu(e,t){const n=t?t.ru:new Fa,r=t?t.eu:this.eu;let s=t?t.mutatedKeys:this.mutatedKeys,i=r,o=!1;const a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,c="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal((e,t)=>{const u=r.get(e),h=ss(this.query,t)?t:null,l=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations);let f=!1;u&&h?u.data.isEqual(h.data)?l!==d&&(n.track({type:3,doc:h}),f=!0):this.iu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Xa(h,a)>0||c&&this.Xa(h,c)<0)&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||c)&&(o=!0)),f&&(h?(i=i.add(h),s=d?s.add(e):s.delete(e)):(i=i.delete(e),s=s.delete(e)))}),null!==this.query.limit)for(;i.size>this.query.limit;){const e="F"===this.query.limitType?i.last():i.first();i=i.delete(e.key),s=s.delete(e.key),n.track({type:1,doc:e})}return{eu:i,ru:n,Ds:o,mutatedKeys:s}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){const s=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;const i=e.ru.pa();i.sort((e,t)=>function(e,t){const n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return Ct(20277,{At:e})}};return n(e)-n(t)}
|
|
1814
1814
|
/**
|
|
1815
1815
|
* @license
|
|
1816
1816
|
* Copyright 2020 Google LLC
|
|
@@ -1826,7 +1826,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1826
1826
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1827
1827
|
* See the License for the specific language governing permissions and
|
|
1828
1828
|
* limitations under the License.
|
|
1829
|
-
*/(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),r=null!=r&&r;const o=t&&!r?this.ou():[],a=0===this.Za.size&&this.current&&!r?1:0,c=a!==this.Ya;return this.Ya=a,0!==i.length||c?{snapshot:new Va(this.query,e.eu,s,i,e.mutatedKeys,0===a,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Fa,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}ou(){if(!this.current)return[];const e=this.Za;this.Za=vs(),this.eu.forEach(e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))});const t=[];return e.forEach(e=>{this.Za.has(e)||t.push(new Xa(e))}),this.Za.forEach(n=>{e.has(n)||t.push(new Ya(n))}),t}uu(e){this.Ha=e.qs,this.Za=vs();const t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return Va.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}const ec="SyncEngine";class tc{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class nc{constructor(e){this.key=e,this.lu=!1}}class rc{constructor(e,t,n,r,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.hu={},this.Pu=new as(e=>ns(e),ts),this.Tu=new Map,this.Iu=new Set,this.du=new Rn(en.comparator),this.Eu=new Map,this.Au=new go,this.Ru={},this.Vu=new Map,this.mu=no.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function sc(e,t,n=!0){const r=bc(e);let s;const i=r.Pu.get(t);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.cu()):s=await oc(r,t,n,!0),s}async function ic(e,t){const n=bc(e);await oc(n,t,!0,!1)}async function oc(e,t,n,r){const s=await function(e,t){const n=Rt(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let r;return n.hi.getTargetData(e,t).next(s=>s?(r=s,_n.resolve(r)):n.hi.allocateTargetId(e).next(s=>(r=new Wi(t,s,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,r).next(()=>r))))}).then(e=>{const r=n.Fs.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e})}(e.localStore,Xr(t)),i=s.targetId,o=e.sharedClientState.addLocalQueryTarget(i,n);let a;return r&&(a=await async function(e,t,n,r,s){e.gu=(t,n,r)=>async function(e,t,n,r){let s=t.view.nu(n);s.Ds&&(s=await Mo(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,s)));const i=r&&r.targetChanges.get(t.targetId),o=r&&null!=r.targetMismatches.get(t.targetId),a=t.view.applyChanges(s,e.isPrimaryClient,i,o);return _c(e,t.targetId,a._u),a.snapshot}(e,t,n,r);const i=await Mo(e.localStore,t,!0),o=new Za(t,i.qs),a=o.nu(i.documents),c=hi.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,s),u=o.applyChanges(a,e.isPrimaryClient,c);_c(e,n,u._u);const h=new tc(t,n,o);return e.Pu.set(t,h),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),u.snapshot}(e,t,i,"current"===o,s.resumeToken)),e.isPrimaryClient&&n&&ua(e.remoteStore,s),a}async function ac(e,t,n){const r=Rt(e),s=r.Pu.get(t),i=r.Tu.get(s.targetId);if(i.length>1)return r.Tu.set(s.targetId,i.filter(e=>!ts(e,t))),void r.Pu.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Lo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&ha(r.remoteStore,s.targetId),yc(r,s.targetId)}).catch(vn)):(yc(r,s.targetId),await Lo(r.localStore,s.targetId,!0))}async function cc(e,t){const n=Rt(e),r=n.Pu.get(t),s=n.Tu.get(r.targetId);n.isPrimaryClient&&1===s.length&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),ha(n.remoteStore,r.targetId))}async function uc(e,t,n){const r=function(e){const t=Rt(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=fc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=pc.bind(null,t),t}(e);try{const e=await function(e,t){const n=Rt(e),r=dn.now(),s=t.reduce((e,t)=>e.add(t.key),vs());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=us(),c=vs();return n.Os.getEntries(e,s).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(s=>{i=s;const o=[];for(const e of t){const t=Hs(e,i.get(e.key).overlayedDocument);null!=t&&o.push(new qs(e.key,t,_r(t.value.mapValue),xs.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)}).next(t=>{o=t;const r=t.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)})}).then(()=>({batchId:o.batchId,changes:ds(i)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.Ru[e.currentUser.toKey()];r||(r=new Rn(zt)),r=r.insert(t,n),e.Ru[e.currentUser.toKey()]=r}(r,e.batchId,n),await Ec(r,e.changes),await Sa(r.remoteStore)}catch(e){const t=xa(e,"Failed to persist write");n.reject(t)}}async function hc(e,t){const n=Rt(e);try{const e=await Do(n.localStore,t);t.targetChanges.forEach((e,t)=>{const r=n.Eu.get(t);r&&(kt(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.lu=!0:e.modifiedDocuments.size>0?kt(r.lu,14607):e.removedDocuments.size>0&&(kt(r.lu,42227),r.lu=!1))}),await Ec(n,e,t)}catch(e){await vn(e)}}function lc(e,t,n){const r=Rt(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.Pu.forEach((n,r)=>{const s=r.view.va(t);s.snapshot&&e.push(s.snapshot)}),function(e,t){const n=Rt(e);n.onlineState=t;let r=!1;n.queries.forEach((e,n)=>{for(const e of n.wa)e.va(t)&&(r=!0)}),r&&Ka(n)}(r.eventManager,t),e.length&&r.hu.J_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function dc(e,t,n){const r=Rt(e);r.sharedClientState.updateQueryState(t,"rejected",n);const s=r.Eu.get(t),i=s&&s.key;if(i){let e=new Rn(en.comparator);e=e.insert(i,wr.newNoDocument(i,fn.min()));const n=vs().add(i),s=new ui(fn.min(),new Map,new Rn(zt),e,n);await hc(r,s),r.du=r.du.remove(i),r.Eu.delete(t),Tc(r)}else await Lo(r.localStore,t,!1).then(()=>yc(r,t,n)).catch(vn)}async function fc(e,t){const n=Rt(e),r=t.batch.batchId;try{const e=await function(e,t){const n=Rt(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const r=t.batch.keys(),s=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const s=n.batch,i=s.keys();let o=_n.resolve();return i.forEach(e=>{o=o.next(()=>r.getEntry(t,e)).next(t=>{const i=n.docVersions.get(e);kt(null!==i,48541),t.version.compareTo(i)<0&&(s.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,s))}(n,e,t,s).next(()=>s.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=vs();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,r))})}(n.localStore,t);mc(n,r,null),gc(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ec(n,e)}catch(e){await vn(e)}}async function pc(e,t,n){const r=Rt(e);try{const e=await function(e,t){const n=Rt(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(kt(null!==t,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)).next(()=>n.localDocuments.getDocuments(e,r))})}(r.localStore,t);mc(r,t,n),gc(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await Ec(r,e)}catch(n){await vn(n)}}function gc(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function mc(e,t,n){const r=Rt(e);let s=r.Ru[r.currentUser.toKey()];if(s){const e=s.get(t);e&&(n?e.reject(n):e.resolve(),s=s.remove(t)),r.Ru[r.currentUser.toKey()]=s}}function yc(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.Tu.get(t))e.Pu.delete(r),n&&e.hu.pu(r,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||vc(e,t)})}function vc(e,t){e.Iu.delete(t.path.canonicalString());const n=e.du.get(t);null!==n&&(ha(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),Tc(e))}function _c(e,t,n){for(const r of n)r instanceof Ya?(e.Au.addReference(r.key,t),wc(e,r)):r instanceof Xa?(Et(ec,"Document no longer in limbo: "+r.key),e.Au.removeReference(r.key,t),e.Au.containsKey(r.key)||vc(e,r.key)):At(19791,{yu:r})}function wc(e,t){const n=t.key,r=n.path.canonicalString();e.du.get(n)||e.Iu.has(r)||(Et(ec,"New document in limbo: "+n),e.Iu.add(r),Tc(e))}function Tc(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){const t=e.Iu.values().next().value;e.Iu.delete(t);const n=new en(Yt.fromString(t)),r=e.mu.next();e.Eu.set(r,new nc(n)),e.du=e.du.insert(n,r),ua(e.remoteStore,new Wi(Xr(Wr(n.path)),r,"TargetPurposeLimboResolution",Tn.ue))}}async function Ec(e,t,n){const r=Rt(e),s=[],i=[],o=[];r.Pu.isEmpty()||(r.Pu.forEach((e,a)=>{o.push(r.gu(a,t,n).then(e=>{var t;if((e||n)&&r.isPrimaryClient){const s=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;r.sharedClientState.updateQueryState(a.targetId,s?"current":"not-current")}if(e){s.push(e);const t=bo.Es(a.targetId,e);i.push(t)}}))}),await Promise.all(o),r.hu.J_(s),await async function(e,t){const n=Rt(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>_n.forEach(t,t=>_n.forEach(t.Is,r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r)).next(()=>_n.forEach(t.ds,r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))}catch(e){if(!wn(e))throw e;Et(ko,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Fs.get(t),r=e.snapshotVersion,s=e.withLastLimboFreeSnapshotVersion(r);n.Fs=n.Fs.insert(t,s)}}}(r.localStore,i))}async function Sc(e,t){const n=Rt(e);if(!n.currentUser.isEqual(t)){Et(ec,"User change. New user:",t.toKey());const e=await Oo(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new Nt(Ot.CANCELLED,t))})}),e.Vu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ec(n,e.Bs)}}function Ic(e,t){const n=Rt(e),r=n.Eu.get(t);if(r&&r.lu)return vs().add(r.key);{let e=vs();const r=n.Tu.get(t);if(!r)return e;for(const t of r){const r=n.Pu.get(t);e=e.unionWith(r.view.tu)}return e}}function bc(e){const t=Rt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=hc.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ic.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=dc.bind(null,t),t.hu.J_=qa.bind(null,t.eventManager),t.hu.pu=Ga.bind(null,t.eventManager),t}class Ac{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Jo(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){return function(e,t,n,r){return new Ro(e,t,n,r)}(this.persistence,new Co,e.initialUser,this.serializer)}Du(e){return new To(So.Vi,this.serializer)}bu(e){return new Uo}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Ac.provider={build:()=>new Ac};class Cc extends Ac{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){kt(this.persistence.referenceDelegate instanceof Io,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new oo(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?to.withCacheSize(this.cacheSizeBytes):to.DEFAULT;return new To(e=>Io.Vi(e,t),this.serializer)}}class kc{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>lc(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Sc.bind(null,this.syncEngine),await async function(e,t){const n=Rt(e);t?(n.Ia.delete(2),await aa(n)):t||(n.Ia.add(2),await ca(n),n.Aa.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Ba}createDatastore(e){const t=Jo(e.databaseInfo.databaseId),n=function(e){return new Wo(e)}(e.databaseInfo);return function(e,t,n,r){return new ra(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,s){return new oa(e,t,n,r,s)}(this.localStore,this.datastore,e.asyncQueue,e=>lc(this.syncEngine,e,0),jo.C()?new jo:new Fo)}createSyncEngine(e,t){return function(e,t,n,r,s,i,o){const a=new rc(e,t,n,r,s,i);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){const t=Rt(e);Et(ia,"RemoteStore shutting down."),t.Ia.add(5),await ca(t),t.Ea.shutdown(),t.Aa.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate(),null===(t=this.eventManager)||void 0===t||t.terminate()}}kc.provider={build:()=>new kc};
|
|
1829
|
+
*/(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),r=null!=r&&r;const o=t&&!r?this.ou():[],a=0===this.Za.size&&this.current&&!r?1:0,c=a!==this.Ya;return this.Ya=a,0!==i.length||c?{snapshot:new Va(this.query,e.eu,s,i,e.mutatedKeys,0===a,c,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new Fa,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}ou(){if(!this.current)return[];const e=this.Za;this.Za=vs(),this.eu.forEach(e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))});const t=[];return e.forEach(e=>{this.Za.has(e)||t.push(new Xa(e))}),this.Za.forEach(n=>{e.has(n)||t.push(new Ya(n))}),t}uu(e){this.Ha=e.qs,this.Za=vs();const t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return Va.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}const ec="SyncEngine";class tc{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class nc{constructor(e){this.key=e,this.lu=!1}}class rc{constructor(e,t,n,r,s,i){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.hu={},this.Pu=new as(e=>ns(e),ts),this.Tu=new Map,this.Iu=new Set,this.du=new Nn(en.comparator),this.Eu=new Map,this.Au=new go,this.Ru={},this.Vu=new Map,this.mu=no.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function sc(e,t,n=!0){const r=bc(e);let s;const i=r.Pu.get(t);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.cu()):s=await oc(r,t,n,!0),s}async function ic(e,t){const n=bc(e);await oc(n,t,!0,!1)}async function oc(e,t,n,r){const s=await function(e,t){const n=Nt(e);return n.persistence.runTransaction("Allocate target","readwrite",e=>{let r;return n.hi.getTargetData(e,t).next(s=>s?(r=s,_n.resolve(r)):n.hi.allocateTargetId(e).next(s=>(r=new Wi(t,s,"TargetPurposeListen",e.currentSequenceNumber),n.hi.addTargetData(e,r).next(()=>r))))}).then(e=>{const r=n.Fs.get(e.targetId);return(null===r||e.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.Fs=n.Fs.insert(e.targetId,e),n.Ms.set(t,e.targetId)),e})}(e.localStore,Xr(t)),i=s.targetId,o=e.sharedClientState.addLocalQueryTarget(i,n);let a;return r&&(a=await async function(e,t,n,r,s){e.gu=(t,n,r)=>async function(e,t,n,r){let s=t.view.nu(n);s.Ds&&(s=await Mo(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,s)));const i=r&&r.targetChanges.get(t.targetId),o=r&&null!=r.targetMismatches.get(t.targetId),a=t.view.applyChanges(s,e.isPrimaryClient,i,o);return _c(e,t.targetId,a._u),a.snapshot}(e,t,n,r);const i=await Mo(e.localStore,t,!0),o=new Za(t,i.qs),a=o.nu(i.documents),c=hi.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,s),u=o.applyChanges(a,e.isPrimaryClient,c);_c(e,n,u._u);const h=new tc(t,n,o);return e.Pu.set(t,h),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),u.snapshot}(e,t,i,"current"===o,s.resumeToken)),e.isPrimaryClient&&n&&ua(e.remoteStore,s),a}async function ac(e,t,n){const r=Nt(e),s=r.Pu.get(t),i=r.Tu.get(s.targetId);if(i.length>1)return r.Tu.set(s.targetId,i.filter(e=>!ts(e,t))),void r.Pu.delete(t);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedClientState.isActiveQueryTarget(s.targetId)||await Lo(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&ha(r.remoteStore,s.targetId),yc(r,s.targetId)}).catch(vn)):(yc(r,s.targetId),await Lo(r.localStore,s.targetId,!0))}async function cc(e,t){const n=Nt(e),r=n.Pu.get(t),s=n.Tu.get(r.targetId);n.isPrimaryClient&&1===s.length&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),ha(n.remoteStore,r.targetId))}async function uc(e,t,n){const r=function(e){const t=Nt(e);return t.remoteStore.remoteSyncer.applySuccessfulWrite=fc.bind(null,t),t.remoteStore.remoteSyncer.rejectFailedWrite=pc.bind(null,t),t}(e);try{const e=await function(e,t){const n=Nt(e),r=dn.now(),s=t.reduce((e,t)=>e.add(t.key),vs());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",e=>{let a=us(),c=vs();return n.Os.getEntries(e,s).next(e=>{a=e,a.forEach((e,t)=>{t.isValidDocument()||(c=c.add(e))})}).next(()=>n.localDocuments.getOverlayedDocuments(e,a)).next(s=>{i=s;const o=[];for(const e of t){const t=Hs(e,i.get(e.key).overlayedDocument);null!=t&&o.push(new qs(e.key,t,_r(t.value.mapValue),xs.exists(!0)))}return n.mutationQueue.addMutationBatch(e,r,o,t)}).next(t=>{o=t;const r=t.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(e,t.batchId,r)})}).then(()=>({batchId:o.batchId,changes:ds(i)}))}(r.localStore,t);r.sharedClientState.addPendingMutation(e.batchId),function(e,t,n){let r=e.Ru[e.currentUser.toKey()];r||(r=new Nn(zt)),r=r.insert(t,n),e.Ru[e.currentUser.toKey()]=r}(r,e.batchId,n),await Ec(r,e.changes),await Sa(r.remoteStore)}catch(e){const t=xa(e,"Failed to persist write");n.reject(t)}}async function hc(e,t){const n=Nt(e);try{const e=await Do(n.localStore,t);t.targetChanges.forEach((e,t)=>{const r=n.Eu.get(t);r&&(kt(e.addedDocuments.size+e.modifiedDocuments.size+e.removedDocuments.size<=1,22616),e.addedDocuments.size>0?r.lu=!0:e.modifiedDocuments.size>0?kt(r.lu,14607):e.removedDocuments.size>0&&(kt(r.lu,42227),r.lu=!1))}),await Ec(n,e,t)}catch(e){await vn(e)}}function lc(e,t,n){const r=Nt(e);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const e=[];r.Pu.forEach((n,r)=>{const s=r.view.va(t);s.snapshot&&e.push(s.snapshot)}),function(e,t){const n=Nt(e);n.onlineState=t;let r=!1;n.queries.forEach((e,n)=>{for(const e of n.wa)e.va(t)&&(r=!0)}),r&&Ga(n)}(r.eventManager,t),e.length&&r.hu.J_(e),r.onlineState=t,r.isPrimaryClient&&r.sharedClientState.setOnlineState(t)}}async function dc(e,t,n){const r=Nt(e);r.sharedClientState.updateQueryState(t,"rejected",n);const s=r.Eu.get(t),i=s&&s.key;if(i){let e=new Nn(en.comparator);e=e.insert(i,wr.newNoDocument(i,fn.min()));const n=vs().add(i),s=new ui(fn.min(),new Map,new Nn(zt),e,n);await hc(r,s),r.du=r.du.remove(i),r.Eu.delete(t),Tc(r)}else await Lo(r.localStore,t,!1).then(()=>yc(r,t,n)).catch(vn)}async function fc(e,t){const n=Nt(e),r=t.batch.batchId;try{const e=await function(e,t){const n=Nt(e);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{const r=t.batch.keys(),s=n.Os.newChangeBuffer({trackRemovals:!0});return function(e,t,n,r){const s=n.batch,i=s.keys();let o=_n.resolve();return i.forEach(e=>{o=o.next(()=>r.getEntry(t,e)).next(t=>{const i=n.docVersions.get(e);kt(null!==i,48541),t.version.compareTo(i)<0&&(s.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,s))}(n,e,t,s).next(()=>s.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=vs();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,r))})}(n.localStore,t);mc(n,r,null),gc(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await Ec(n,e)}catch(e){await vn(e)}}async function pc(e,t,n){const r=Nt(e);try{const e=await function(e,t){const n=Nt(e);return n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(kt(null!==t,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)).next(()=>n.localDocuments.getDocuments(e,r))})}(r.localStore,t);mc(r,t,n),gc(r,t),r.sharedClientState.updateMutationState(t,"rejected",n),await Ec(r,e)}catch(n){await vn(n)}}function gc(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function mc(e,t,n){const r=Nt(e);let s=r.Ru[r.currentUser.toKey()];if(s){const e=s.get(t);e&&(n?e.reject(n):e.resolve(),s=s.remove(t)),r.Ru[r.currentUser.toKey()]=s}}function yc(e,t,n=null){e.sharedClientState.removeLocalQueryTarget(t);for(const r of e.Tu.get(t))e.Pu.delete(r),n&&e.hu.pu(r,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||vc(e,t)})}function vc(e,t){e.Iu.delete(t.path.canonicalString());const n=e.du.get(t);null!==n&&(ha(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),Tc(e))}function _c(e,t,n){for(const r of n)r instanceof Ya?(e.Au.addReference(r.key,t),wc(e,r)):r instanceof Xa?(Et(ec,"Document no longer in limbo: "+r.key),e.Au.removeReference(r.key,t),e.Au.containsKey(r.key)||vc(e,r.key)):Ct(19791,{yu:r})}function wc(e,t){const n=t.key,r=n.path.canonicalString();e.du.get(n)||e.Iu.has(r)||(Et(ec,"New document in limbo: "+n),e.Iu.add(r),Tc(e))}function Tc(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){const t=e.Iu.values().next().value;e.Iu.delete(t);const n=new en(Yt.fromString(t)),r=e.mu.next();e.Eu.set(r,new nc(n)),e.du=e.du.insert(n,r),ua(e.remoteStore,new Wi(Xr(Wr(n.path)),r,"TargetPurposeLimboResolution",Tn.ue))}}async function Ec(e,t,n){const r=Nt(e),s=[],i=[],o=[];r.Pu.isEmpty()||(r.Pu.forEach((e,a)=>{o.push(r.gu(a,t,n).then(e=>{var t;if((e||n)&&r.isPrimaryClient){const s=e?!e.fromCache:null===(t=null==n?void 0:n.targetChanges.get(a.targetId))||void 0===t?void 0:t.current;r.sharedClientState.updateQueryState(a.targetId,s?"current":"not-current")}if(e){s.push(e);const t=bo.Es(a.targetId,e);i.push(t)}}))}),await Promise.all(o),r.hu.J_(s),await async function(e,t){const n=Nt(e);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",e=>_n.forEach(t,t=>_n.forEach(t.Is,r=>n.persistence.referenceDelegate.addReference(e,t.targetId,r)).next(()=>_n.forEach(t.ds,r=>n.persistence.referenceDelegate.removeReference(e,t.targetId,r)))))}catch(e){if(!wn(e))throw e;Et(ko,"Failed to update sequence numbers: "+e)}for(const e of t){const t=e.targetId;if(!e.fromCache){const e=n.Fs.get(t),r=e.snapshotVersion,s=e.withLastLimboFreeSnapshotVersion(r);n.Fs=n.Fs.insert(t,s)}}}(r.localStore,i))}async function Sc(e,t){const n=Nt(e);if(!n.currentUser.isEqual(t)){Et(ec,"User change. New user:",t.toKey());const e=await Ro(n.localStore,t);n.currentUser=t,function(e,t){e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new Ot(Rt.CANCELLED,t))})}),e.Vu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(t,e.removedBatchIds,e.addedBatchIds),await Ec(n,e.Bs)}}function Ic(e,t){const n=Nt(e),r=n.Eu.get(t);if(r&&r.lu)return vs().add(r.key);{let e=vs();const r=n.Tu.get(t);if(!r)return e;for(const t of r){const r=n.Pu.get(t);e=e.unionWith(r.view.tu)}return e}}function bc(e){const t=Nt(e);return t.remoteStore.remoteSyncer.applyRemoteEvent=hc.bind(null,t),t.remoteStore.remoteSyncer.getRemoteKeysForTarget=Ic.bind(null,t),t.remoteStore.remoteSyncer.rejectListen=dc.bind(null,t),t.hu.J_=qa.bind(null,t.eventManager),t.hu.pu=Ka.bind(null,t.eventManager),t}class Cc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Jo(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){return function(e,t,n,r){return new No(e,t,n,r)}(this.persistence,new Ao,e.initialUser,this.serializer)}Du(e){return new To(So.Vi,this.serializer)}bu(e){return new Uo}async terminate(){var e,t;null===(e=this.gcScheduler)||void 0===e||e.stop(),null===(t=this.indexBackfillerScheduler)||void 0===t||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}Cc.provider={build:()=>new Cc};class Ac extends Cc{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){kt(this.persistence.referenceDelegate instanceof Io,46915);const n=this.persistence.referenceDelegate.garbageCollector;return new oo(n,e.asyncQueue,t)}Du(e){const t=void 0!==this.cacheSizeBytes?to.withCacheSize(this.cacheSizeBytes):to.DEFAULT;return new To(e=>Io.Vi(e,t),this.serializer)}}class kc{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>lc(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=Sc.bind(null,this.syncEngine),await async function(e,t){const n=Nt(e);t?(n.Ia.delete(2),await aa(n)):t||(n.Ia.add(2),await ca(n),n.Aa.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new Ba}createDatastore(e){const t=Jo(e.databaseInfo.databaseId),n=function(e){return new Wo(e)}(e.databaseInfo);return function(e,t,n,r){return new ra(e,t,n,r)}(e.authCredentials,e.appCheckCredentials,n,t)}createRemoteStore(e){return function(e,t,n,r,s){return new oa(e,t,n,r,s)}(this.localStore,this.datastore,e.asyncQueue,e=>lc(this.syncEngine,e,0),jo.C()?new jo:new Fo)}createSyncEngine(e,t){return function(e,t,n,r,s,i,o){const a=new rc(e,t,n,r,s,i);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){const t=Nt(e);Et(ia,"RemoteStore shutting down."),t.Ia.add(5),await ca(t),t.Ea.shutdown(),t.Aa.set("Unknown")}(this.remoteStore),null===(e=this.datastore)||void 0===e||e.terminate(),null===(t=this.eventManager)||void 0===t||t.terminate()}}kc.provider={build:()=>new kc};
|
|
1830
1830
|
/**
|
|
1831
1831
|
* @license
|
|
1832
1832
|
* Copyright 2020 Google LLC
|
|
@@ -1859,7 +1859,7 @@ class co{constructor(){this.changes=new as(e=>e.toString(),(e,t)=>e.isEqual(t)),
|
|
|
1859
1859
|
* See the License for the specific language governing permissions and
|
|
1860
1860
|
* limitations under the License.
|
|
1861
1861
|
*/
|
|
1862
|
-
class
|
|
1862
|
+
class Nc{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):St("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}xu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}
|
|
1863
1863
|
/**
|
|
1864
1864
|
* @license
|
|
1865
1865
|
* Copyright 2017 Google LLC
|
|
@@ -1875,7 +1875,7 @@ class Rc{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.o
|
|
|
1875
1875
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1876
1876
|
* See the License for the specific language governing permissions and
|
|
1877
1877
|
* limitations under the License.
|
|
1878
|
-
*/const
|
|
1878
|
+
*/const Rc="FirestoreClient";class Oc{constructor(e,t,n,r,s){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=vt.UNAUTHENTICATED,this.clientId=$t.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(n,async e=>{Et(Rc,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(Et(Rc,"Received new app check token=",e),this.appCheckCredentialListener(e,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Dt;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(t){const n=xa(t,"Failed to shutdown persistence");e.reject(n)}}),e.promise}}async function Dc(e,t){e.asyncQueue.verifyOperationInProgress(),Et(Rc,"Initializing OfflineComponentProvider");const n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await Ro(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>{It("Terminating Firestore due to IndexedDb database deletion"),e.terminate().then(()=>{Et("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(e=>{It("Terminating Firestore due to IndexedDb database deletion failed",e)})}),e._offlineComponents=t}async function Pc(e,t){e.asyncQueue.verifyOperationInProgress();const n=await async function(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){Et(Rc,"Using user provided OfflineComponentProvider");try{await Dc(e,e._uninitializedComponentsProvider._offline)}catch(t){const n=t;if(!function(e){return"FirebaseError"===e.name?e.code===Rt.FAILED_PRECONDITION||e.code===Rt.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&e instanceof DOMException)||22===e.code||20===e.code||11===e.code}(n))throw n;It("Error using user provided cache. Falling back to memory cache: "+n),await Dc(e,new Cc)}}else Et(Rc,"Using default OfflineComponentProvider"),await Dc(e,new Ac(void 0));return e._offlineComponents}(e);Et(Rc,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>Da(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>Da(t.remoteStore,n)),e._onlineComponents=t}async function Lc(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(Et(Rc,"Using user provided OnlineComponentProvider"),await Pc(e,e._uninitializedComponentsProvider._online)):(Et(Rc,"Using default OnlineComponentProvider"),await Pc(e,new kc))),e._onlineComponents}async function Mc(e){const t=await Lc(e),n=t.eventManager;return n.onListen=sc.bind(null,t.syncEngine),n.onUnlisten=ac.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=ic.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=cc.bind(null,t.syncEngine),n}
|
|
1879
1879
|
/**
|
|
1880
1880
|
* @license
|
|
1881
1881
|
* Copyright 2023 Google LLC
|
|
@@ -1924,7 +1924,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
1924
1924
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1925
1925
|
* See the License for the specific language governing permissions and
|
|
1926
1926
|
* limitations under the License.
|
|
1927
|
-
*/class jc{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new
|
|
1927
|
+
*/class jc{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new Ot(Rt.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=Fc,this.ssl=Vc}else this.host=e.host,this.ssl=null!==(t=e.ssl)&&void 0!==t?t:Vc;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=eo;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new Ot(Rt.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new Ot(Rt.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=xc(null!==(n=e.experimentalLongPollingOptions)&&void 0!==n?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new Ot(Rt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new Ot(Rt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new Ot(Rt.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}
|
|
1928
1928
|
/**
|
|
1929
1929
|
* @license
|
|
1930
1930
|
* Copyright 2020 Google LLC
|
|
@@ -1940,7 +1940,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
1940
1940
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1941
1941
|
* See the License for the specific language governing permissions and
|
|
1942
1942
|
* limitations under the License.
|
|
1943
|
-
*/(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Bc{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new jc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new
|
|
1943
|
+
*/(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(e,t){return e.timeoutSeconds===t.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Bc{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new jc({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Ot(Rt.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._app}get _initialized(){return this._settingsFrozen}get _terminated(){return"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new Ot(Rt.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");this._settings=new jc(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new Lt;switch(e.type){case"firstParty":return new Ft(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new Ot(Rt.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){const t=Uc.get(e);t&&(Et("ComponentProvider","Removing Datastore"),Uc.delete(e),t.terminate())}(this),Promise.resolve()}}function Hc(e,t,n,r={}){var s;e=an(e,Bc);const o=f(t),a=e._getSettings(),c=Object.assign(Object.assign({},a),{emulatorOptions:e._getEmulatorOptions()}),u=`${t}:${n}`;o&&(p(`https://${u}`),y("Firestore",!0)),a.host!==Fc&&a.host!==u&&It("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const h=Object.assign(Object.assign({},a),{host:u,ssl:o,emulatorOptions:r});if(!S(h,c)&&(e._setSettings(h),r.mockUserToken)){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=vt.MOCK_USER;else{t=function(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');const n=t||"demo-project",r=e.iat||0,s=e.sub||e.user_id;if(!s)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:s,user_id:s,firebase:{sign_in_provider:"custom",identities:{}}},e);return[i(JSON.stringify({alg:"none",type:"JWT"})),i(JSON.stringify(o)),""].join(".")}(r.mockUserToken,null===(s=e._app)||void 0===s?void 0:s.options.projectId);const o=r.mockUserToken.sub||r.mockUserToken.user_id;if(!o)throw new Ot(Rt.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new vt(o)}e._authCredentials=new Mt(new Pt(t,n))}}
|
|
1944
1944
|
/**
|
|
1945
1945
|
* @license
|
|
1946
1946
|
* Copyright 2020 Google LLC
|
|
@@ -1956,7 +1956,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
1956
1956
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1957
1957
|
* See the License for the specific language governing permissions and
|
|
1958
1958
|
* limitations under the License.
|
|
1959
|
-
*/class $c{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new $c(this.firestore,e,this._query)}}class zc{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new qc(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new zc(this.firestore,e,this._key)}toJSON(){return{type:zc._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(un(t,zc._jsonSchema))return new zc(e,n||null,new en(Yt.fromString(t.referencePath)))}}zc._jsonSchemaVersion="firestore/documentReference/1.0",zc._jsonSchema={type:cn("string",zc._jsonSchemaVersion),referencePath:cn("string")};class qc extends $c{constructor(e,t,n){super(e,t,Wr(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new zc(this.firestore,null,new en(e))}withConverter(e){return new qc(this.firestore,e,this._path)}}function
|
|
1959
|
+
*/class $c{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new $c(this.firestore,e,this._query)}}class zc{constructor(e,t,n){this.converter=t,this._key=n,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new qc(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new zc(this.firestore,e,this._key)}toJSON(){return{type:zc._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(un(t,zc._jsonSchema))return new zc(e,n||null,new en(Yt.fromString(t.referencePath)))}}zc._jsonSchemaVersion="firestore/documentReference/1.0",zc._jsonSchema={type:cn("string",zc._jsonSchemaVersion),referencePath:cn("string")};class qc extends $c{constructor(e,t,n){super(e,t,Wr(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new zc(this.firestore,null,new en(e))}withConverter(e){return new qc(this.firestore,e,this._path)}}function Kc(e,t,...n){if(e=R(e),tn("collection","path",t),e instanceof Bc){const r=Yt.fromString(t,...n);return rn(r),new qc(e,null,r)}{if(!(e instanceof zc||e instanceof qc))throw new Ot(Rt.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(Yt.fromString(t,...n));return rn(r),new qc(e.firestore,null,r)}}function Gc(e,t,...n){if(e=R(e),1===arguments.length&&(t=$t.newId()),tn("doc","path",t),e instanceof Bc){const r=Yt.fromString(t,...n);return nn(r),new zc(e,null,new en(r))}{if(!(e instanceof zc||e instanceof qc))throw new Ot(Rt.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=e._path.child(Yt.fromString(t,...n));return nn(r),new zc(e.firestore,e instanceof qc?e.converter:null,new en(r))}}
|
|
1960
1960
|
/**
|
|
1961
1961
|
* @license
|
|
1962
1962
|
* Copyright 2020 Google LLC
|
|
@@ -1972,7 +1972,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
1972
1972
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1973
1973
|
* See the License for the specific language governing permissions and
|
|
1974
1974
|
* limitations under the License.
|
|
1975
|
-
*/const Wc="AsyncQueue";class Qc{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new Yo(this,"async_queue_retry"),this.oc=()=>{const e=Qo();e&&Et(Wc,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this._c=e;const t=Qo();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;const t=Qo();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});const t=new Dt;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}async cc(){if(0!==this.Zu.length){try{await this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!wn(e))throw e;Et(Wc,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}}uc(e){const t=this._c.then(()=>(this.nc=!0,e().catch(e=>{throw this.tc=e,this.nc=!1,St("INTERNAL UNHANDLED ERROR: ",Jc(e)),e}).then(e=>(this.nc=!1,e))));return this._c=t,t}enqueueAfterDelay(e,t,n){this.ac(),this.sc.indexOf(e)>-1&&(t=0);const r=Ma.createAndSchedule(this,e,t,n,e=>this.lc(e));return this.ec.push(r),r}ac(){this.tc&&
|
|
1975
|
+
*/const Wc="AsyncQueue";class Qc{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new Yo(this,"async_queue_retry"),this.oc=()=>{const e=Qo();e&&Et(Wc,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this._c=e;const t=Qo();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;const t=Qo();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});const t=new Dt;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}async cc(){if(0!==this.Zu.length){try{await this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!wn(e))throw e;Et(Wc,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}}uc(e){const t=this._c.then(()=>(this.nc=!0,e().catch(e=>{throw this.tc=e,this.nc=!1,St("INTERNAL UNHANDLED ERROR: ",Jc(e)),e}).then(e=>(this.nc=!1,e))));return this._c=t,t}enqueueAfterDelay(e,t,n){this.ac(),this.sc.indexOf(e)>-1&&(t=0);const r=Ma.createAndSchedule(this,e,t,n,e=>this.lc(e));return this.ec.push(r),r}ac(){this.tc&&Ct(47125,{hc:Jc(this.tc)})}verifyOperationInProgress(){}async Pc(){let e;do{e=this._c,await e}while(e!==this._c)}Tc(e){for(const t of this.ec)if(t.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{this.ec.sort((e,t)=>e.targetTimeMs-t.targetTimeMs);for(const t of this.ec)if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){const t=this.ec.indexOf(e);this.ec.splice(t,1)}}function Jc(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t
|
|
1976
1976
|
/**
|
|
1977
1977
|
* @license
|
|
1978
1978
|
* Copyright 2017 Google LLC
|
|
@@ -2004,7 +2004,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
2004
2004
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2005
2005
|
* See the License for the specific language governing permissions and
|
|
2006
2006
|
* limitations under the License.
|
|
2007
|
-
*/(e,["next","error","complete"])}class Xc extends Bc{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new Qc,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Qc(e),this._firestoreClient=void 0,await e}}}function Zc(e,t){const n="object"==typeof e?e:
|
|
2007
|
+
*/(e,["next","error","complete"])}class Xc extends Bc{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new Qc,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Qc(e),this._firestoreClient=void 0,await e}}}function Zc(e,t){const n="object"==typeof e?e:Ke(),r="string"==typeof e?e:Qn,s=je(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const e=(e=>{const t=u(e);if(!t)return;const n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw new Error(`Invalid host ${t} with no separate hostname and port!`);const r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]})("firestore");e&&Hc(s,...e)}return s}function eu(e){if(e._terminated)throw new Ot(Rt.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,r;const s=e._freezeSettings(),i=function(e,t,n,r){return new Wn(e,t,n,r.host,r.ssl,r.experimentalForceLongPolling,r.experimentalAutoDetectLongPolling,xc(r.experimentalLongPollingOptions),r.useFetchStreams,r.isUsingEmulator)}(e._databaseId,(null===(t=e._app)||void 0===t?void 0:t.options.appId)||"",e._persistenceKey,s);e._componentsProvider||(null===(n=s.localCache)||void 0===n?void 0:n._offlineComponentProvider)&&(null===(r=s.localCache)||void 0===r?void 0:r._onlineComponentProvider)&&(e._componentsProvider={_offline:s.localCache._offlineComponentProvider,_online:s.localCache._onlineComponentProvider}),e._firestoreClient=new Oc(e._authCredentials,e._appCheckCredentials,e._queue,i,e._componentsProvider&&function(e){const t=null==e?void 0:e._online.build();return{_offline:null==e?void 0:e._offline.build(t),_online:t}}(e._componentsProvider))}
|
|
2008
2008
|
/**
|
|
2009
2009
|
* @license
|
|
2010
2010
|
* Copyright 2020 Google LLC
|
|
@@ -2020,7 +2020,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
2020
2020
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2021
2021
|
* See the License for the specific language governing permissions and
|
|
2022
2022
|
* limitations under the License.
|
|
2023
|
-
*/(e),e._firestoreClient}class tu{constructor(e){this._byteString=e}static fromBase64String(e){try{return new tu(xn.fromBase64String(e))}catch(e){throw new
|
|
2023
|
+
*/(e),e._firestoreClient}class tu{constructor(e){this._byteString=e}static fromBase64String(e){try{return new tu(xn.fromBase64String(e))}catch(e){throw new Ot(Rt.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new tu(xn.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:tu._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(un(e,tu._jsonSchema))return tu.fromBase64String(e.bytes)}}tu._jsonSchemaVersion="firestore/bytes/1.0",tu._jsonSchema={type:cn("string",tu._jsonSchemaVersion),bytes:cn("string")};
|
|
2024
2024
|
/**
|
|
2025
2025
|
* @license
|
|
2026
2026
|
* Copyright 2020 Google LLC
|
|
@@ -2037,7 +2037,7 @@ function xc(e){const t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.
|
|
|
2037
2037
|
* See the License for the specific language governing permissions and
|
|
2038
2038
|
* limitations under the License.
|
|
2039
2039
|
*/
|
|
2040
|
-
class nu{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new
|
|
2040
|
+
class nu{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new Ot(Rt.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Zt(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}function ru(){return new nu(Qt)}
|
|
2041
2041
|
/**
|
|
2042
2042
|
* @license
|
|
2043
2043
|
* Copyright 2020 Google LLC
|
|
@@ -2069,7 +2069,7 @@ class nu{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw n
|
|
|
2069
2069
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2070
2070
|
* See the License for the specific language governing permissions and
|
|
2071
2071
|
* limitations under the License.
|
|
2072
|
-
*/class iu{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new
|
|
2072
|
+
*/class iu{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new Ot(Rt.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new Ot(Rt.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return zt(this._lat,e._lat)||zt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:iu._jsonSchemaVersion}}static fromJSON(e){if(un(e,iu._jsonSchema))return new iu(e.latitude,e.longitude)}}iu._jsonSchemaVersion="firestore/geoPoint/1.0",iu._jsonSchema={type:cn("string",iu._jsonSchemaVersion),latitude:cn("number"),longitude:cn("number")};
|
|
2073
2073
|
/**
|
|
2074
2074
|
* @license
|
|
2075
2075
|
* Copyright 2024 Google LLC
|
|
@@ -2086,7 +2086,7 @@ class nu{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw n
|
|
|
2086
2086
|
* See the License for the specific language governing permissions and
|
|
2087
2087
|
* limitations under the License.
|
|
2088
2088
|
*/
|
|
2089
|
-
class ou{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:ou._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(un(e,ou._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new ou(e.vectorValues);throw new
|
|
2089
|
+
class ou{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:ou._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(un(e,ou._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new ou(e.vectorValues);throw new Ot(Rt.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}ou._jsonSchemaVersion="firestore/vectorValue/1.0",ou._jsonSchema={type:cn("string",ou._jsonSchemaVersion),vectorValues:cn("object")};
|
|
2090
2090
|
/**
|
|
2091
2091
|
* @license
|
|
2092
2092
|
* Copyright 2017 Google LLC
|
|
@@ -2103,7 +2103,7 @@ class ou{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._va
|
|
|
2103
2103
|
* See the License for the specific language governing permissions and
|
|
2104
2104
|
* limitations under the License.
|
|
2105
2105
|
*/
|
|
2106
|
-
const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new qs(e,this.data,this.fieldMask,t,this.fieldTransforms):new zs(e,this.data,t,this.fieldTransforms)}}function uu(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw
|
|
2106
|
+
const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new qs(e,this.data,this.fieldMask,t,this.fieldTransforms):new zs(e,this.data,t,this.fieldTransforms)}}function uu(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Ct(40011,{Ec:e})}}class hu{constructor(e,t,n,r,s,i){this.settings=e,this.databaseId=t,this.serializer=n,this.ignoreUndefinedProperties=r,void 0===s&&this.Ac(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new hu(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Rc({path:n,mc:!1});return r.fc(e),r}gc(e){var t;const n=null===(t=this.path)||void 0===t?void 0:t.child(e),r=this.Rc({path:n,mc:!1});return r.Ac(),r}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return Tu(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(0===e.length)throw this.wc("Document fields must not be empty");if(uu(this.Ec)&&au.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class lu{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||Jo(e)}Dc(e,t,n,r=!1){return new hu({Ec:e,methodName:t,bc:n,path:Zt.emptyPath(),mc:!1,Sc:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function du(e){const t=e._freezeSettings(),n=Jo(e._databaseId);return new lu(e._databaseId,!!t.ignoreUndefinedProperties,n)}function fu(e,t,n,r,s,i={}){const o=e.Dc(i.merge||i.mergeFields?2:0,t,n,s);yu("Data must be an object, but it was:",o,r);const a=gu(r,o);let c,u;if(i.merge)c=new Ln(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const e=[];for(const r of i.mergeFields){const s=vu(t,r,n);if(!o.contains(s))throw new Ot(Rt.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);Eu(e,s)||e.push(s)}c=new Ln(e),u=o.fieldTransforms.filter(e=>c.covers(e.field))}else c=null,u=o.fieldTransforms;return new cu(new vr(a),c,u)}function pu(e,t){if(mu(e=R(e)))return yu("Unsupported field value:",t,e),gu(e,t);if(e instanceof su)return function(e,t){if(!uu(t.Ec))throw t.wc(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.wc(`${e._methodName}() is not currently supported inside arrays`);const n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.mc&&4!==t.Ec)throw t.wc("Nested arrays are not supported");return function(e,t){const n=[];let r=0;for(const s of e){let e=pu(s,t.yc(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}(e,t)}return function(e,t){if(null===(e=R(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return Es(t.serializer,e);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){const n=dn.fromDate(e);return{timestampValue:Si(t.serializer,n)}}if(e instanceof dn){const n=new dn(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:Si(t.serializer,n)}}if(e instanceof iu)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof tu)return{bytesValue:Ii(t.serializer,e._byteString)};if(e instanceof zc){const n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.wc(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Ai(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof ou)return function(e,t){return{mapValue:{fields:{[Yn]:{stringValue:er},[tr]:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.wc("VectorValues must only contain numeric values.");return ws(t.serializer,e)})}}}}}}(e,t);throw t.wc(`Unsupported field value: ${on(e)}`)}(e,t)}function gu(e,t){const n={};return kn(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):An(e,(e,r)=>{const s=pu(r,t.Vc(e));null!=s&&(n[e]=s)}),{mapValue:{fields:n}}}function mu(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof dn||e instanceof iu||e instanceof tu||e instanceof zc||e instanceof su||e instanceof ou)}function yu(e,t,n){if(!mu(n)||!sn(n)){const r=on(n);throw"an object"===r?t.wc(e+" a custom object"):t.wc(e+" "+r)}}function vu(e,t,n){if((t=R(t))instanceof nu)return t._internalPath;if("string"==typeof t)return wu(e,t);throw Tu("Field path arguments must be of type string or ",e,!1,void 0,n)}const _u=new RegExp("[~\\*/\\[\\]]");function wu(e,t,n){if(t.search(_u)>=0)throw Tu(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new nu(...t.split("."))._internalPath}catch(r){throw Tu(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function Tu(e,t,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${t}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Ot(Rt.INVALID_ARGUMENT,a+e+c)}function Eu(e,t){return e.some(e=>e.isEqual(t))}
|
|
2107
2107
|
/**
|
|
2108
2108
|
* @license
|
|
2109
2109
|
* Copyright 2020 Google LLC
|
|
@@ -2135,7 +2135,7 @@ const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
|
|
|
2135
2135
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2136
2136
|
* See the License for the specific language governing permissions and
|
|
2137
2137
|
* limitations under the License.
|
|
2138
|
-
*/function
|
|
2138
|
+
*/function Cu(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new Ot(Rt.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Au{}class ku extends Au{}function Nu(e,t,...n){let r=[];t instanceof Au&&r.push(t),r=r.concat(n),function(e){const t=e.filter(e=>e instanceof Du).length,n=e.filter(e=>e instanceof Ru).length;if(t>1||t>0&&n>0)throw new Ot(Rt.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(...)))`.")}
|
|
2139
2139
|
/**
|
|
2140
2140
|
* @license
|
|
2141
2141
|
* Copyright 2020 Google LLC
|
|
@@ -2151,7 +2151,7 @@ const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
|
|
|
2151
2151
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2152
2152
|
* See the License for the specific language governing permissions and
|
|
2153
2153
|
* limitations under the License.
|
|
2154
|
-
*/(r);for(const t of r)e=t._apply(e);return e}class
|
|
2154
|
+
*/(r);for(const t of r)e=t._apply(e);return e}class Ru extends ku{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new Ru(e,t,n)}_apply(e){const t=this._parse(e);return Mu(e._query,t),new $c(e.firestore,e.converter,Zr(e._query,t))}_parse(e){const t=du(e.firestore),n=function(e,t,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Ot(Rt.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Lu(o,i);const t=[];for(const n of o)t.push(Pu(r,e,n));a={arrayValue:{values:t}}}else a=Pu(r,e,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Lu(o,i),a=function(e,t,n,r=!1){return pu(n,e.Dc(r?4:3,t))}(n,t,o,"in"===i||"not-in"===i);return Ar.create(s,i,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value);return n}}function Ou(e,t,n){const r=t,s=bu("where",e);return Ru._create(s,r,n)}class Du extends Au{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new Du(e,t)}_parse(e){const t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:kr.create(t,this._getOperator())}_apply(e){const t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;const r=t.getFlattenedFilters();for(const e of r)Mu(n,e),n=Zr(n,e)}(e._query,t),new $c(e.firestore,e.converter,Zr(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Pu(e,t,n){if("string"==typeof(n=R(n))){if(""===n)throw new Ot(Rt.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Jr(t)&&-1!==n.indexOf("/"))throw new Ot(Rt.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=t.path.child(Yt.fromString(n));if(!en.isDocumentKey(r))throw new Ot(Rt.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return lr(e,new en(r))}if(n instanceof zc)return lr(e,n._key);throw new Ot(Rt.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${on(n)}.`)}function Lu(e,t){if(!Array.isArray(e)||0===e.length)throw new Ot(Rt.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function Mu(e,t){const n=function(e,t){for(const n of e)for(const e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(t.op));if(null!==n)throw n===t.op?new Ot(Rt.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new Ot(Rt.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class xu{convertValue(e,t="none"){switch(nr(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Vn(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(jn(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw Ct(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){const n={};return An(e,(e,r)=>{n[e]=this.convertValue(r,t)}),n}convertVectorValue(e){var t,n,r;const s=null===(r=null===(n=null===(t=e.fields)||void 0===t?void 0:t[tr].arrayValue)||void 0===n?void 0:n.values)||void 0===r?void 0:r.map(e=>Vn(e.doubleValue));return new ou(s)}convertGeoPoint(e){return new iu(Vn(e.latitude),Vn(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":const n=Kn(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(Gn(e));default:return null}}convertTimestamp(e){const t=Fn(e);return new dn(t.seconds,t.nanos)}convertDocumentKey(e,t){const n=Yt.fromString(e);kt(Gi(n),9688,{name:e});const r=new Jn(n.get(1),n.get(3)),s=new en(n.popFirst(5));return r.isEqual(t)||St(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),s}}
|
|
2155
2155
|
/**
|
|
2156
2156
|
* @license
|
|
2157
2157
|
* Copyright 2020 Google LLC
|
|
@@ -2167,7 +2167,7 @@ const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
|
|
|
2167
2167
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2168
2168
|
* See the License for the specific language governing permissions and
|
|
2169
2169
|
* limitations under the License.
|
|
2170
|
-
*/class Uu{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Fu extends Su{constructor(e,t,n,r,s,i){super(e,t,n,r,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(bu("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new
|
|
2170
|
+
*/class Uu{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Fu extends Su{constructor(e,t,n,r,s,i){super(e,t,n,r,i),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const t=new Vu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){const n=this._document.data.field(bu("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Rt.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,t={};return t.type=Fu._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()?(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),t.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),t):t}}Fu._jsonSchemaVersion="firestore/documentSnapshot/1.0",Fu._jsonSchema={type:cn("string",Fu._jsonSchemaVersion),bundleSource:cn("string","DocumentSnapshot"),bundleName:cn("string"),bundle:cn("string")};class Vu extends Fu{data(e={}){return super.data(e)}}class ju{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new Uu(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new Vu(this._firestore,this._userDataWriter,n.key,n,new Uu(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new Ot(Rt.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{const r=new Vu(e._firestore,e._userDataWriter,n.doc.key,n.doc,new Uu(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{const r=new Vu(e._firestore,e._userDataWriter,t.doc.key,t.doc,new Uu(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter);let s=-1,i=-1;return 0!==t.type&&(s=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(n=n.add(t.doc),i=n.indexOf(t.doc.key)),{type:Bu(t.type),doc:r,oldIndex:s,newIndex:i}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new Ot(Rt.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ju._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=$t.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const t=[],n=[],r=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),r.push(e.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function Bu(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Ct(61501,{type:e})}}
|
|
2171
2171
|
/**
|
|
2172
2172
|
* @license
|
|
2173
2173
|
* Copyright 2020 Google LLC
|
|
@@ -2183,7 +2183,7 @@ const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
|
|
|
2183
2183
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2184
2184
|
* See the License for the specific language governing permissions and
|
|
2185
2185
|
* limitations under the License.
|
|
2186
|
-
*/function Hu(e){e=an(e,zc);const t=an(e.firestore,Xc);return function(e,t,n={}){const r=new Dt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new
|
|
2186
|
+
*/function Hu(e){e=an(e,zc);const t=an(e.firestore,Xc);return function(e,t,n={}){const r=new Dt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new Nc({next:a=>{i.Ou(),t.enqueueAndForget(()=>za(e,o));const c=a.docs.has(n);!c&&a.fromCache?s.reject(new Ot(Rt.UNAVAILABLE,"Failed to get document because the client is offline.")):c&&a.fromCache&&r&&"server"===r.source?s.reject(new Ot(Rt.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(a)},error:e=>s.reject(e)}),o=new Ja(Wr(n.path),i,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,r)),r.promise}(eu(t),e._key).then(n=>Gu(t,e,n))}ju._jsonSchemaVersion="firestore/querySnapshot/1.0",ju._jsonSchema={type:cn("string",ju._jsonSchemaVersion),bundleSource:cn("string","QuerySnapshot"),bundleName:cn("string"),bundle:cn("string")};class $u extends xu{constructor(e){super(),this.firestore=e}convertBytes(e){return new tu(e)}convertReference(e){const t=this.convertDocumentKey(e,this.firestore._databaseId);return new zc(this.firestore,null,t)}}function zu(e){e=an(e,$c);const t=an(e.firestore,Xc),n=eu(t),r=new $u(t);return Cu(e._query),function(e,t,n={}){const r=new Dt;return e.asyncQueue.enqueueAndForget(async()=>function(e,t,n,r,s){const i=new Nc({next:n=>{i.Ou(),t.enqueueAndForget(()=>za(e,o)),n.fromCache&&"server"===r.source?s.reject(new Ot(Rt.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:e=>s.reject(e)}),o=new Ja(n,i,{includeMetadataChanges:!0,ka:!0});return $a(e,o)}(await Mc(e),e.asyncQueue,t,n,r)),r.promise}(n,e._query).then(n=>new ju(t,r,e,n))}function qu(e,t,n){e=an(e,zc);const r=an(e.firestore,Xc),s=function(e,t,n){let r;return r=e?n&&(n.merge||n.mergeFields)?e.toFirestore(t,n):e.toFirestore(t):t,r}(e.converter,t,n);return function(e,t){return function(e,t){const n=new Dt;return e.asyncQueue.enqueueAndForget(async()=>uc(await function(e){return Lc(e).then(e=>e.syncEngine)}(e),t,n)),n.promise}(eu(e),t)}(r,[fu(du(r),"setDoc",e._key,s,null!==e.converter,n).toMutation(e._key,xs.none())])}function Ku(e,...t){var n,r,s;e=R(e);let i={includeMetadataChanges:!1,source:"default"},o=0;"object"!=typeof t[o]||Yc(t[o])||(i=t[o++]);const a={includeMetadataChanges:i.includeMetadataChanges,source:i.source};if(Yc(t[o])){const e=t[o];t[o]=null===(n=e.next)||void 0===n?void 0:n.bind(e),t[o+1]=null===(r=e.error)||void 0===r?void 0:r.bind(e),t[o+2]=null===(s=e.complete)||void 0===s?void 0:s.bind(e)}let c,u,h;if(e instanceof zc)u=an(e.firestore,Xc),h=Wr(e._key.path),c={next:n=>{t[o]&&t[o](Gu(u,e,n))},error:t[o+1],complete:t[o+2]};else{const n=an(e,$c);u=an(n.firestore,Xc),h=n._query;const r=new $u(u);c={next:e=>{t[o]&&t[o](new ju(u,r,n,e))},error:t[o+1],complete:t[o+2]},Cu(e._query)}return function(e,t,n,r){const s=new Nc(r),i=new Ja(t,s,n);return e.asyncQueue.enqueueAndForget(async()=>$a(await Mc(e),i)),()=>{s.Ou(),e.asyncQueue.enqueueAndForget(async()=>za(await Mc(e),i))}}(eu(u),h,a,c)}function Gu(e,t,n){const r=n.docs.get(t._key),s=new $u(e);return new Fu(e,s,t._key,r,new Uu(n.hasPendingWrites,n.fromCache),t.converter)}!function(e,t=!0){!function(e){_t=e}(ze),Ve(new O("firestore",(e,{instanceIdentifier:n,options:r})=>{const s=e.getProvider("app").getImmediate(),i=new Xc(new xt(e.getProvider("auth-internal")),new jt(s,e.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new Ot(Rt.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Jn(e.options.projectId,t)}(s,n),s);return r=Object.assign({useFetchStreams:t},r),i._setSettings(r),i},"PUBLIC").setMultipleInstances(!0)),Ge(mt,yt,e),Ge(mt,yt,"esm2017")}();
|
|
2187
2187
|
/**
|
|
2188
2188
|
* @license
|
|
2189
2189
|
* Copyright 2020 Google LLC
|
|
@@ -2200,7 +2200,7 @@ const au=/^__.*__$/;class cu{constructor(e,t,n){this.data=e,this.fieldMask=t,thi
|
|
|
2200
2200
|
* See the License for the specific language governing permissions and
|
|
2201
2201
|
* limitations under the License.
|
|
2202
2202
|
*/
|
|
2203
|
-
|
|
2203
|
+
Ge("firebase","11.10.0","app");class Wu{constructor(){}static getInstance(){return Wu.instance||(Wu.instance=new Wu),Wu.instance}setEnv(e){switch(e){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Ju.firebase:Qu.firebase}get api(){return"prod"===this.env?Ju.api:Qu.api}get config(){return"prod"===this.env?Ju.config:Qu.config}}const Qu={firebase:{apiKey:void 0,authDomain:void 0,projectId:void 0,storageBucket:void 0,messagingSenderId:void 0,appId:void 0},api:{url:void 0},config:{avatarTimeout:Number(void 0),vtoTimeout:Number(void 0)}},Ju={firebase:{apiKey:void 0,authDomain:void 0,projectId:void 0,storageBucket:void 0,messagingSenderId:void 0,appId:void 0},api:{url:void 0},config:{avatarTimeout:Number(void 0),vtoTimeout:Number(void 0)}};var Yu=1e3,Xu=6e4,Zu=36e5,eh="millisecond",th="second",nh="minute",rh="hour",sh="day",ih="week",oh="month",ah="quarter",ch="year",uh="date",hh="Invalid Date",lh=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,dh=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,fh={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},ph=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},gh={s:ph,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),s=n%60;return(t<=0?"+":"-")+ph(r,2,"0")+":"+ph(s,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),s=t.clone().add(r,oh),i=n-s<0,o=t.clone().add(r+(i?-1:1),oh);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:oh,y:ch,w:ih,d:sh,D:uh,h:rh,m:nh,s:th,ms:eh,Q:ah}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},mh="en",yh={};yh[mh]=fh;var vh="$isDayjsObject",_h=function(e){return e instanceof Sh||!(!e||!e[vh])},wh=function e(t,n,r){var s;if(!t)return mh;if("string"==typeof t){var i=t.toLowerCase();yh[i]&&(s=i),n&&(yh[i]=n,s=i);var o=t.split("-");if(!s&&o.length>1)return e(o[0])}else{var a=t.name;yh[a]=t,s=a}return!r&&s&&(mh=s),s||!r&&mh},Th=function(e,t){if(_h(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new Sh(n)},Eh=gh;Eh.l=wh,Eh.i=_h,Eh.w=function(e,t){return Th(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var Sh=function(){function e(e){this.$L=wh(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[vh]=!0}var t=e.prototype;return t.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(Eh.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(lh);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(t)}(e),this.init()},t.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},t.$utils=function(){return Eh},t.isValid=function(){return!(this.$d.toString()===hh)},t.isSame=function(e,t){var n=Th(e);return this.startOf(t)<=n&&n<=this.endOf(t)},t.isAfter=function(e,t){return Th(e)<this.startOf(t)},t.isBefore=function(e,t){return this.endOf(t)<Th(e)},t.$g=function(e,t,n){return Eh.u(e)?this[t]:this.set(n,e)},t.unix=function(){return Math.floor(this.valueOf()/1e3)},t.valueOf=function(){return this.$d.getTime()},t.startOf=function(e,t){var n=this,r=!!Eh.u(t)||t,s=Eh.p(e),i=function(e,t){var s=Eh.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?s:s.endOf(sh)},o=function(e,t){return Eh.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case ch:return r?i(1,0):i(31,11);case oh:return r?i(1,c):i(0,c+1);case ih:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case sh:case uh:return o(h+"Hours",0);case rh:return o(h+"Minutes",1);case nh:return o(h+"Seconds",2);case th:return o(h+"Milliseconds",3);default:return this.clone()}},t.endOf=function(e){return this.startOf(e,!1)},t.$set=function(e,t){var n,r=Eh.p(e),s="set"+(this.$u?"UTC":""),i=(n={},n[sh]=s+"Date",n[uh]=s+"Date",n[oh]=s+"Month",n[ch]=s+"FullYear",n[rh]=s+"Hours",n[nh]=s+"Minutes",n[th]=s+"Seconds",n[eh]=s+"Milliseconds",n)[r],o=r===sh?this.$D+(t-this.$W):t;if(r===oh||r===ch){var a=this.clone().set(uh,1);a.$d[i](o),a.init(),this.$d=a.set(uh,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},t.set=function(e,t){return this.clone().$set(e,t)},t.get=function(e){return this[Eh.p(e)]()},t.add=function(e,t){var n,r=this;e=Number(e);var s=Eh.p(t),i=function(t){var n=Th(r);return Eh.w(n.date(n.date()+Math.round(t*e)),r)};if(s===oh)return this.set(oh,this.$M+e);if(s===ch)return this.set(ch,this.$y+e);if(s===sh)return i(1);if(s===ih)return i(7);var o=(n={},n[nh]=Xu,n[rh]=Zu,n[th]=Yu,n)[s]||1,a=this.$d.getTime()+e*o;return Eh.w(a,this)},t.subtract=function(e,t){return this.add(-1*e,t)},t.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||hh;var r=e||"YYYY-MM-DDTHH:mm:ssZ",s=Eh.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(e,n,s,i){return e&&(e[n]||e(t,r))||s[n].slice(0,i)},d=function(e){return Eh.s(i%12||12,e,"0")},f=h||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(dh,function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return Eh.s(t.$y,4,"0");case"M":return a+1;case"MM":return Eh.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return t.$D;case"DD":return Eh.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return l(n.weekdaysMin,t.$W,c,2);case"ddd":return l(n.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(i);case"HH":return Eh.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return Eh.s(o,2,"0");case"s":return String(t.$s);case"ss":return Eh.s(t.$s,2,"0");case"SSS":return Eh.s(t.$ms,3,"0");case"Z":return s}return null}(e)||s.replace(":","")})},t.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},t.diff=function(e,t,n){var r,s=this,i=Eh.p(t),o=Th(e),a=(o.utcOffset()-this.utcOffset())*Xu,c=this-o,u=function(){return Eh.m(s,o)};switch(i){case ch:r=u()/12;break;case oh:r=u();break;case ah:r=u()/3;break;case ih:r=(c-a)/6048e5;break;case sh:r=(c-a)/864e5;break;case rh:r=c/Zu;break;case nh:r=c/Xu;break;case th:r=c/Yu;break;default:r=c}return n?r:Eh.a(r)},t.daysInMonth=function(){return this.endOf(oh).$D},t.$locale=function(){return yh[this.$L]},t.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=wh(e,t,!0);return r&&(n.$L=r),n},t.clone=function(){return Eh.w(this.$d,this)},t.toDate=function(){return new Date(this.valueOf())},t.toJSON=function(){return this.isValid()?this.toISOString():null},t.toISOString=function(){return this.$d.toISOString()},t.toString=function(){return this.$d.toUTCString()},e}(),Ih=Sh.prototype;function bh(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(e);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(e,r[s])&&(n[r[s]]=e[r[s]])}return n}function Ch(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}Th.prototype=Ih,[["$ms",eh],["$s",th],["$m",nh],["$H",rh],["$W",sh],["$M",oh],["$y",ch],["$D",uh]].forEach(function(e){Ih[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),Th.extend=function(e,t){return e.$i||(e(t,Sh,Th),e.$i=!0),Th},Th.locale=wh,Th.isDayjs=_h,Th.unix=function(e){return Th(1e3*e)},Th.en=yh[mh],Th.Ls=yh,Th.p={},"function"==typeof SuppressedError&&SuppressedError;const Ah=Ch,kh=new T("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Nh="auth/user-disabled",Rh=new j("@firebase/auth");function Oh(e,...t){Rh.logLevel<=M.ERROR&&Rh.error(`Auth (${ze}): ${e}`,...t)}
|
|
2204
2204
|
/**
|
|
2205
2205
|
* @license
|
|
2206
2206
|
* Copyright 2020 Google LLC
|
|
@@ -2216,7 +2216,7 @@ Ke("firebase","11.10.0","app");class Wu{constructor(){}static getInstance(){retu
|
|
|
2216
2216
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2217
2217
|
* See the License for the specific language governing permissions and
|
|
2218
2218
|
* limitations under the License.
|
|
2219
|
-
*/function Dh(e,...t){throw xh(e,...t)}function Ph(e,...t){return xh(e,...t)}function Lh(e,t,n){const r=Object.assign(Object.assign({},
|
|
2219
|
+
*/function Dh(e,...t){throw xh(e,...t)}function Ph(e,...t){return xh(e,...t)}function Lh(e,t,n){const r=Object.assign(Object.assign({},Ah()),{[t]:n});return new T("auth","Firebase",r).create(t,{appName:e.name})}function Mh(e){return Lh(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function xh(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return kh.create(e,...t)}function Uh(e,t,...n){if(!e)throw xh(t,...n)}function Fh(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Oh(t),new Error(t)}function Vh(e,t){e||Fh(t)}
|
|
2220
2220
|
/**
|
|
2221
2221
|
* @license
|
|
2222
2222
|
* Copyright 2020 Google LLC
|
|
@@ -2313,7 +2313,7 @@ class $h{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vh(t>e,"Short delay
|
|
|
2313
2313
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2314
2314
|
* See the License for the specific language governing permissions and
|
|
2315
2315
|
* limitations under the License.
|
|
2316
|
-
*/const
|
|
2316
|
+
*/const Kh={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Gh=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Wh=new $h(3e4,6e4);
|
|
2317
2317
|
/**
|
|
2318
2318
|
* @license
|
|
2319
2319
|
* Copyright 2020 Google LLC
|
|
@@ -2329,7 +2329,7 @@ class $h{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vh(t>e,"Short delay
|
|
|
2329
2329
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2330
2330
|
* See the License for the specific language governing permissions and
|
|
2331
2331
|
* limitations under the License.
|
|
2332
|
-
*/function Qh(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Jh(e,t,n,r,s={}){return Yh(e,s,async()=>{let s={},i={};r&&("GET"===t?i=r:s={body:JSON.stringify(r)});const o=b(Object.assign({key:e.config.apiKey},i)).slice(1),a=await e._getAdditionalHeaders();a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode);const c=Object.assign({method:t,headers:a},s);return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&f(e.emulatorConfig.host)&&(c.credentials="include"),qh.fetch()(await Zh(e,e.config.apiHost,n,o),c)})}async function Yh(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},
|
|
2332
|
+
*/function Qh(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Jh(e,t,n,r,s={}){return Yh(e,s,async()=>{let s={},i={};r&&("GET"===t?i=r:s={body:JSON.stringify(r)});const o=b(Object.assign({key:e.config.apiKey},i)).slice(1),a=await e._getAdditionalHeaders();a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode);const c=Object.assign({method:t,headers:a},s);return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent||(c.referrerPolicy="no-referrer"),e.emulatorConfig&&f(e.emulatorConfig.host)&&(c.credentials="include"),qh.fetch()(await Zh(e,e.config.apiHost,n,o),c)})}async function Yh(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Kh),t);try{const t=new tl(e),s=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw nl(e,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const t=s.ok?i.errorMessage:i.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw nl(e,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw nl(e,"email-already-in-use",i);if("USER_DISABLED"===n)throw nl(e,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Lh(e,a,o);Dh(e,a)}}catch(t){if(t instanceof w)throw t;Dh(e,"network-request-failed",{message:String(t)})}}async function Xh(e,t,n,r,s={}){const i=await Jh(e,t,n,r,s);return"mfaPendingCredential"in i&&Dh(e,"multi-factor-auth-required",{_serverResponse:i}),i}async function Zh(e,t,n,r){const s=`${t}${n}?${r}`,i=e,o=i.config.emulator?zh(e.config,s):`${e.config.apiScheme}://${s}`;if(Gh.includes(n)&&(await i._persistenceManagerAvailable,"COOKIE"===i._getPersistenceType())){return i._getPersistence()._getFinalTarget(o).toString()}return o}function el(e){switch(e){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class tl{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(Ph(this.auth,"network-request-failed")),Wh.get())})}}function nl(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Ph(e,t,r);return s.customData._tokenResponse=n,s}function rl(e){return void 0!==e&&void 0!==e.enterprise}class sl{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return el(t.enforcementState);return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function il(e,t){return Jh(e,"POST","/v1/accounts:lookup",t)}
|
|
2333
2333
|
/**
|
|
2334
2334
|
* @license
|
|
2335
2335
|
* Copyright 2020 Google LLC
|
|
@@ -2345,7 +2345,7 @@ class $h{constructor(e,t){this.shortDelay=e,this.longDelay=t,Vh(t>e,"Short delay
|
|
|
2345
2345
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2346
2346
|
* See the License for the specific language governing permissions and
|
|
2347
2347
|
* limitations under the License.
|
|
2348
|
-
*/function ol(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function al(e){return 1e3*Number(e)}function cl(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return
|
|
2348
|
+
*/function ol(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function al(e){return 1e3*Number(e)}function cl(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return Oh("JWT malformed, contained fewer than 3 sections"),null;try{const e=o(n);return e?JSON.parse(e):(Oh("Failed to decode base64 JWT payload"),null)}catch(e){return Oh("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function ul(e){const t=cl(e);return Uh(t,"internal-error"),Uh(void 0!==t.exp,"internal-error"),Uh(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}
|
|
2349
2349
|
/**
|
|
2350
2350
|
* @license
|
|
2351
2351
|
* Copyright 2020 Google LLC
|
|
@@ -2458,7 +2458,7 @@ class gl{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
|
|
|
2458
2458
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2459
2459
|
* See the License for the specific language governing permissions and
|
|
2460
2460
|
* limitations under the License.
|
|
2461
|
-
*/function ml(e,t){Uh("string"==typeof e||void 0===e,"internal-error",{appName:t})}class yl{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,s=bh(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ll(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new dl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await hl(this,this.stsTokenManager.getToken(this.auth,e));return Uh(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=
|
|
2461
|
+
*/function ml(e,t){Uh("string"==typeof e||void 0===e,"internal-error",{appName:t})}class yl{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,s=bh(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ll(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new dl(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await hl(this,this.stsTokenManager.getToken(this.auth,e));return Uh(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const n=R(e),r=await n.getIdToken(t),s=cl(r);Uh(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:ol(al(s.auth_time)),issuedAtTime:ol(al(s.iat)),expirationTime:ol(al(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=R(e);await fl(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Uh(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new yl(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){Uh(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await fl(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Be(this.auth.app))return Promise.reject(Mh(this.auth));const e=await this.getIdToken();return await hl(this,
|
|
2462
2462
|
/**
|
|
2463
2463
|
* @license
|
|
2464
2464
|
* Copyright 2020 Google LLC
|
|
@@ -2539,7 +2539,7 @@ async function(e,t){return Jh(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
|
|
|
2539
2539
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2540
2540
|
* See the License for the specific language governing permissions and
|
|
2541
2541
|
* limitations under the License.
|
|
2542
|
-
*/function Il(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(kl(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(bl(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(
|
|
2542
|
+
*/function Il(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(kl(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(bl(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(Rl(t))return"Blackberry";if(Ol(t))return"Webos";if(Cl(t))return"Safari";if((t.includes("chrome/")||Al(t))&&!t.includes("edge/"))return"Chrome";if(Nl(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function bl(e=v()){return/firefox\//i.test(e)}function Cl(e=v()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function Al(e=v()){return/crios\//i.test(e)}function kl(e=v()){return/iemobile/i.test(e)}function Nl(e=v()){return/android/i.test(e)}function Rl(e=v()){return/blackberry/i.test(e)}function Ol(e=v()){return/webos/i.test(e)}function Dl(e=v()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function Pl(){return function(){const e=v();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ll(e=v()){return Dl(e)||Nl(e)||Ol(e)||Rl(e)||/windows phone/i.test(e)||kl(e)}
|
|
2543
2543
|
/**
|
|
2544
2544
|
* @license
|
|
2545
2545
|
* Copyright 2020 Google LLC
|
|
@@ -2603,7 +2603,7 @@ async function(e,t){return Jh(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
|
|
|
2603
2603
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2604
2604
|
* See the License for the specific language governing permissions and
|
|
2605
2605
|
* limitations under the License.
|
|
2606
|
-
*/class Fl{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jl(this),this.idTokenSubscription=new jl(this),this.beforeStateQueue=new xl(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=kh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=_l(t)),this._initializationPromise=this.queue(async()=>{var n,r,s;if(!this._deleted&&(this.persistenceManager=await Sl.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(r=this._popupRedirectResolver)||void 0===r?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(s=this.currentUser)||void 0===s?void 0:s.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await il(this,{idToken:e}),n=await yl._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(Be(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Uh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await fl(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Be(this.app))return Promise.reject(Mh(this));const t=e?
|
|
2606
|
+
*/class Fl{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jl(this),this.idTokenSubscription=new jl(this),this.beforeStateQueue=new xl(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=kh,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=_l(t)),this._initializationPromise=this.queue(async()=>{var n,r,s;if(!this._deleted&&(this.persistenceManager=await Sl.create(this,e),null===(n=this._resolvePersistenceManagerAvailable)||void 0===n||n.call(this),!this._deleted)){if(null===(r=this._popupRedirectResolver)||void 0===r?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(s=this.currentUser)||void 0===s?void 0:s.uid)||null,this._deleted||(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUserFromIdToken(e){try{const t=await il(this,{idToken:e}),n=await yl._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if(Be(this.app)){const e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Uh(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await fl(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Be(this.app))return Promise.reject(Mh(this));const t=e?R(e):null;return t&&Uh(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&Uh(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return Be(this.app)?Promise.reject(Mh(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Be(this.app)?Promise.reject(Mh(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(_l(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await async function(e,t={}){return Jh(e,"GET","/v2/passwordPolicy",Qh(e,t))}
|
|
2607
2607
|
/**
|
|
2608
2608
|
* @license
|
|
2609
2609
|
* Copyright 2023 Google LLC
|
|
@@ -2619,7 +2619,7 @@ async function(e,t){return Jh(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
|
|
|
2619
2619
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2620
2620
|
* See the License for the specific language governing permissions and
|
|
2621
2621
|
* limitations under the License.
|
|
2622
|
-
*/(this),t=new Ul(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new T("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Jh(e,"POST","/v2/accounts:revokeToken",Qh(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&_l(e)||this._popupRedirectResolver;Uh(t,this,"argument-error"),this.redirectPersistenceManager=await Sl.create(this,[_l(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const s="function"==typeof t?t:t.next.bind(t);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Uh(o,this,"internal-error"),o.then(()=>{i||s(this.currentUser)}),"function"==typeof t){const s=e.addObserver(t,n,r);return()=>{i=!0,s()}}{const n=e.addObserver(t);return()=>{i=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Uh(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ml(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;if(Be(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){
|
|
2622
|
+
*/(this),t=new Ul(e);null===this.tenantId?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new T("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){const t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await async function(e,t){return Jh(e,"POST","/v2/accounts:revokeToken",Qh(e,t))}(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&_l(e)||this._popupRedirectResolver;Uh(t,this,"argument-error"),this.redirectPersistenceManager=await Sl.create(this,[_l(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue(async()=>{}),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const s="function"==typeof t?t:t.next.bind(t);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Uh(o,this,"internal-error"),o.then(()=>{i||s(this.currentUser)}),"function"==typeof t){const s=e.addObserver(t,n,r);return()=>{i=!0,s()}}{const n=e.addObserver(t);return()=>{i=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return Uh(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ml(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;if(Be(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Rh.logLevel<=M.WARN&&Rh.warn(`Auth (${ze}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Vl(e){return R(e)}class jl{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new k(e,t);return n.subscribe.bind(n)}(e=>this.observer=e)}get next(){return Uh(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
|
|
2623
2623
|
/**
|
|
2624
2624
|
* @license
|
|
2625
2625
|
* Copyright 2020 Google LLC
|
|
@@ -2635,7 +2635,7 @@ async function(e,t){return Jh(e,"POST","/v1/accounts:delete",t)}(this.auth,{idTo
|
|
|
2635
2635
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2636
2636
|
* See the License for the specific language governing permissions and
|
|
2637
2637
|
* limitations under the License.
|
|
2638
|
-
*/let Bl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Hl(e){return Bl.loadJS(e)}class $l{constructor(){this.enterprise=new zl}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class zl{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const ql="NO_RECAPTCHA";class
|
|
2638
|
+
*/let Bl={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Hl(e){return Bl.loadJS(e)}class $l{constructor(){this.enterprise=new zl}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class zl{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}const ql="NO_RECAPTCHA";class Kl{constructor(e){this.type="recaptcha-enterprise",this.auth=Vl(e)}async verify(e="verify",t=!1){async function n(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>{(async function(e,t){return Jh(e,"GET","/v2/recaptchaConfig",Qh(e,t))})(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0!==r.recaptchaKey){const n=new sl(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))}).catch(e=>{n(e)})})}function r(t,n,r){const s=window.grecaptcha;rl(s)?s.enterprise.ready(()=>{s.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(ql)})}):r(Error("No reCAPTCHA enterprise script loaded."))}if(this.auth.settings.appVerificationDisabledForTesting){return(new $l).execute("siteKey",{action:"verify"})}return new Promise((e,s)=>{n(this.auth).then(n=>{if(!t&&rl(window.grecaptcha))r(n,e,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let t=Bl.recaptchaEnterpriseScript;0!==t.length&&(t+=n),Hl(t).then(()=>{r(n,e,s)}).catch(e=>{s(e)})}}).catch(e=>{s(e)})})}}async function Gl(e,t,n,r=!1,s=!1){const i=new Kl(e);let o;if(s)o=ql;else try{o=await i.verify(n)}catch(e){o=await i.verify(n,!0)}const a=Object.assign({},t);if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){const e=a.phoneEnrollmentInfo.phoneNumber,t=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){const e=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:o}):Object.assign(a,{captchaResponse:o}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function Wl(e,t,n,r,s){var i;if(null===(i=e._getRecaptchaConfig())||void 0===i?void 0:i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Gl(e,t,n,"getOobCode"===n);return r(e,s)}return r(e,t).catch(async s=>{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Gl(e,t,n,"getOobCode"===n);return r(e,s)}return Promise.reject(s)})}
|
|
2639
2639
|
/**
|
|
2640
2640
|
* @license
|
|
2641
2641
|
* Copyright 2020 Google LLC
|
|
@@ -2780,7 +2780,7 @@ class nd extends Xl{constructor(e,t,n,r=null){super("password",n),this._email=e,
|
|
|
2780
2780
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2781
2781
|
* See the License for the specific language governing permissions and
|
|
2782
2782
|
* limitations under the License.
|
|
2783
|
-
*/class id{constructor(e){var t,n,r,s,i,o;const a=A(
|
|
2783
|
+
*/class id{constructor(e){var t,n,r,s,i,o;const a=C(A(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Uh(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.lang)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=C(A(e)).link,n=t?C(A(t)).deep_link_id:null,r=C(A(e)).deep_link_id;return(r?C(A(r)).link:null)||r||n||t||e}(e);try{return new id(t)}catch(e){return null}}}
|
|
2784
2784
|
/**
|
|
2785
2785
|
* @license
|
|
2786
2786
|
* Copyright 2020 Google LLC
|
|
@@ -2963,7 +2963,7 @@ async function yd(e,t,n=!1){if(Be(e.app))return Promise.reject(Mh(e));const r="s
|
|
|
2963
2963
|
* See the License for the specific language governing permissions and
|
|
2964
2964
|
* limitations under the License.
|
|
2965
2965
|
*/
|
|
2966
|
-
async function vd(e){const t=Vl(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function _d(e,t,n){await async function(e,t){return Jh(e,"POST","/v1/accounts:resetPassword",Qh(e,t))}(
|
|
2966
|
+
async function vd(e){const t=Vl(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function _d(e,t,n){await async function(e,t){return Jh(e,"POST","/v1/accounts:resetPassword",Qh(e,t))}(R(e),{oobCode:t,newPassword:n}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&vd(e),t})}function wd(e,t,n){return Be(e.app)?Promise.reject(Mh(e)):async function(e,t){return yd(Vl(e),t)}(R(e),od.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&vd(e),t})}const Td="__sak";
|
|
2967
2967
|
/**
|
|
2968
2968
|
* @license
|
|
2969
2969
|
* Copyright 2019 Google LLC
|
|
@@ -3011,7 +3011,7 @@ async function vd(e){const t=Vl(e);t._getPasswordPolicyInternal()&&await t._upda
|
|
|
3011
3011
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3012
3012
|
* See the License for the specific language governing permissions and
|
|
3013
3013
|
* limitations under the License.
|
|
3014
|
-
*/class bd extends Ed{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}bd.type="SESSION";const
|
|
3014
|
+
*/class bd extends Ed{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}bd.type="SESSION";const Cd=bd;
|
|
3015
3015
|
/**
|
|
3016
3016
|
* @license
|
|
3017
3017
|
* Copyright 2019 Google LLC
|
|
@@ -3044,7 +3044,7 @@ async function vd(e){const t=Vl(e);t._getPasswordPolicyInternal()&&await t._upda
|
|
|
3044
3044
|
* See the License for the specific language governing permissions and
|
|
3045
3045
|
* limitations under the License.
|
|
3046
3046
|
*/
|
|
3047
|
-
class
|
|
3047
|
+
class Ad{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;const n=new Ad(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:s}=t.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map(async e=>e(t.origin,s)),a=await function(e){return Promise.all(e.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}}))}(o);t.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
|
|
3048
3048
|
/**
|
|
3049
3049
|
* @license
|
|
3050
3050
|
* Copyright 2020 Google LLC
|
|
@@ -3077,7 +3077,7 @@ function kd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random
|
|
|
3077
3077
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3078
3078
|
* See the License for the specific language governing permissions and
|
|
3079
3079
|
* limitations under the License.
|
|
3080
|
-
*/
|
|
3080
|
+
*/Ad.receivers=[];class Nd{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise((o,a)=>{const c=kd("",20);r.port1.start();const u=setTimeout(()=>{a(new Error("unsupported_event"))},n);i={messageChannel:r,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),o(t.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}
|
|
3081
3081
|
/**
|
|
3082
3082
|
* @license
|
|
3083
3083
|
* Copyright 2020 Google LLC
|
|
@@ -3093,7 +3093,7 @@ function kd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random
|
|
|
3093
3093
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3094
3094
|
* See the License for the specific language governing permissions and
|
|
3095
3095
|
* limitations under the License.
|
|
3096
|
-
*/function
|
|
3096
|
+
*/function Rd(){return window}
|
|
3097
3097
|
/**
|
|
3098
3098
|
* @license
|
|
3099
3099
|
* Copyright 2020 Google LLC.
|
|
@@ -3110,7 +3110,7 @@ function kd(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random
|
|
|
3110
3110
|
* See the License for the specific language governing permissions and
|
|
3111
3111
|
* limitations under the License.
|
|
3112
3112
|
*/
|
|
3113
|
-
function
|
|
3113
|
+
function Od(){return void 0!==Rd().WorkerGlobalScope&&"function"==typeof Rd().importScripts}
|
|
3114
3114
|
/**
|
|
3115
3115
|
* @license
|
|
3116
3116
|
* Copyright 2019 Google LLC
|
|
@@ -3127,7 +3127,7 @@ function Nd(){return void 0!==Od().WorkerGlobalScope&&"function"==typeof Od().im
|
|
|
3127
3127
|
* See the License for the specific language governing permissions and
|
|
3128
3128
|
* limitations under the License.
|
|
3129
3129
|
*/
|
|
3130
|
-
const Dd="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Ld="fbase_key";class Md{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function xd(e,t){return e.transaction([Pd],t?"readwrite":"readonly").objectStore(Pd)}function Ud(){const e=indexedDB.open(Dd,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Pd,{keyPath:Ld})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Pd)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Dd);return new Md(e).toPromise()}(),t(await Ud()))})})}async function Fd(e,t,n){const r=xd(e,!0).put({[Ld]:t,value:n});return new Md(r).toPromise()}function Vd(e,t){const n=xd(e,!0).delete(t);return new Md(n).toPromise()}class jd{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await Ud()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return
|
|
3130
|
+
const Dd="firebaseLocalStorageDb",Pd="firebaseLocalStorage",Ld="fbase_key";class Md{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function xd(e,t){return e.transaction([Pd],t?"readwrite":"readonly").objectStore(Pd)}function Ud(){const e=indexedDB.open(Dd,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{const t=e.result;try{t.createObjectStore(Pd,{keyPath:Ld})}catch(e){n(e)}}),e.addEventListener("success",async()=>{const n=e.result;n.objectStoreNames.contains(Pd)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(Dd);return new Md(e).toPromise()}(),t(await Ud()))})})}async function Fd(e,t,n){const r=xd(e,!0).put({[Ld]:t,value:n});return new Md(r).toPromise()}function Vd(e,t){const n=xd(e,!0).delete(t);return new Md(n).toPromise()}class jd{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await Ud()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Od()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ad._getInstance(Od()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new Nd(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Ud();return await Fd(e,Td,"1"),await Vd(e,Td),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>Fd(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(t=>async function(e,t){const n=xd(e,!1).get(t),r=await new Md(n).toPromise();return void 0===r?null:r.value}(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>Vd(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(e=>{const t=xd(e,!1).getAll();return new Md(t).toPromise()});if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;if(0!==e.length)for(const{fbase_key:r,value:s}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}jd.type="LOCAL";const Bd=jd;new $h(3e4,6e4);
|
|
3131
3131
|
/**
|
|
3132
3132
|
* @license
|
|
3133
3133
|
* Copyright 2019 Google LLC
|
|
@@ -3177,7 +3177,7 @@ async function(e,t,n=!1){const{auth:r}=e;if(Be(r.app))return Promise.reject(Mh(r
|
|
|
3177
3177
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3178
3178
|
* See the License for the specific language governing permissions and
|
|
3179
3179
|
* limitations under the License.
|
|
3180
|
-
*/class
|
|
3180
|
+
*/class Kd{constructor(e,t,n,r,s=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=e;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return $d;case"linkViaPopup":case"linkViaRedirect":return qd;case"reauthViaPopup":case"reauthViaRedirect":return zd;default:Dh(this.auth,"internal-error")}}resolve(e){Vh(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Vh(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
|
|
3181
3181
|
/**
|
|
3182
3182
|
* @license
|
|
3183
3183
|
* Copyright 2020 Google LLC
|
|
@@ -3193,7 +3193,7 @@ async function(e,t,n=!1){const{auth:r}=e;if(Be(r.app))return Promise.reject(Mh(r
|
|
|
3193
3193
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3194
3194
|
* See the License for the specific language governing permissions and
|
|
3195
3195
|
* limitations under the License.
|
|
3196
|
-
*/const
|
|
3196
|
+
*/const Gd=new $h(2e3,1e4);class Wd extends Kd{constructor(e,t,n,r,s){super(e,t,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Wd.currentPopupAction&&Wd.currentPopupAction.cancel(),Wd.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Uh(e,this.auth,"internal-error"),e}async onExecution(){Vh(1===this.filter.length,"Popup operations only handle one event");const e=kd();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(Ph(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(Ph(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Wd.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Ph(this.auth,"popup-closed-by-user"))},8e3):this.pollId=window.setTimeout(e,Gd.get())};e()}}Wd.currentPopupAction=null;
|
|
3197
3197
|
/**
|
|
3198
3198
|
* @license
|
|
3199
3199
|
* Copyright 2020 Google LLC
|
|
@@ -3210,7 +3210,7 @@ async function(e,t,n=!1){const{auth:r}=e;if(Be(r.app))return Promise.reject(Mh(r
|
|
|
3210
3210
|
* See the License for the specific language governing permissions and
|
|
3211
3211
|
* limitations under the License.
|
|
3212
3212
|
*/
|
|
3213
|
-
const Qd="pendingRedirect",Jd=new Map;class Yd extends
|
|
3213
|
+
const Qd="pendingRedirect",Jd=new Map;class Yd extends Kd{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=Jd.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return El(Qd,e.config.apiKey,e.name)}(t),r=function(e){return _l(e._redirectPersistence)}(e);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}Jd.set(this.auth._key(),e)}return this.bypassAuthState||Jd.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Xd(e,t){Jd.set(e._key(),t)}async function Zd(e,t,n=!1){if(Be(e.app))return Promise.reject(Mh(e));const r=Vl(e),s=
|
|
3214
3214
|
/**
|
|
3215
3215
|
* @license
|
|
3216
3216
|
* Copyright 2021 Google LLC
|
|
@@ -3292,7 +3292,7 @@ const rf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,sf=/^https?/;async function of(e
|
|
|
3292
3292
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3293
3293
|
* See the License for the specific language governing permissions and
|
|
3294
3294
|
* limitations under the License.
|
|
3295
|
-
*/const cf=new $h(3e4,6e4);function uf(){const e=
|
|
3295
|
+
*/const cf=new $h(3e4,6e4);function uf(){const e=Rd().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}function hf(e){return new Promise((t,n)=>{var r,s,i;function o(){uf(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{uf(),n(Ph(e,"network-request-failed"))},timeout:cf.get()})}if(null===(s=null===(r=Rd().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)t(gapi.iframes.getContext());else{if(!(null===(i=Rd().gapi)||void 0===i?void 0:i.load)){const t=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return Rd()[t]=()=>{gapi.load?o():n(Ph(e,"network-request-failed"))},Hl(`${Bl.gapiScript}?onload=${t}`).catch(e=>n(e))}o()}}).catch(e=>{throw lf=null,e})}let lf=null;
|
|
3296
3296
|
/**
|
|
3297
3297
|
* @license
|
|
3298
3298
|
* Copyright 2020 Google LLC.
|
|
@@ -3309,7 +3309,7 @@ const rf=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,sf=/^https?/;async function of(e
|
|
|
3309
3309
|
* See the License for the specific language governing permissions and
|
|
3310
3310
|
* limitations under the License.
|
|
3311
3311
|
*/
|
|
3312
|
-
const df=new $h(5e3,15e3),ff={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},pf=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gf(e){const t=e.config;Uh(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?zh(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:ze},s=pf.get(e.config.apiHost);s&&(r.eid=s);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${b(r).slice(1)}`}async function mf(e){const t=await function(e){return lf=lf||hf(e),lf}(e),n=
|
|
3312
|
+
const df=new $h(5e3,15e3),ff={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},pf=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function gf(e){const t=e.config;Uh(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?zh(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:ze},s=pf.get(e.config.apiHost);s&&(r.eid=s);const i=e._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${b(r).slice(1)}`}async function mf(e){const t=await function(e){return lf=lf||hf(e),lf}(e),n=Rd().gapi;return Uh(n,e,"internal-error"),t.open({where:document.body,url:gf(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ff,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});const s=Ph(e,"network-request-failed"),i=Rd().setTimeout(()=>{r(s)},df.get());function o(){Rd().clearTimeout(i),n(t)}t.ping(o).then(o,()=>{r(s)})}))}
|
|
3313
3313
|
/**
|
|
3314
3314
|
* @license
|
|
3315
3315
|
* Copyright 2020 Google LLC.
|
|
@@ -3325,7 +3325,7 @@ const df=new $h(5e3,15e3),ff={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3325
3325
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3326
3326
|
* See the License for the specific language governing permissions and
|
|
3327
3327
|
* limitations under the License.
|
|
3328
|
-
*/const yf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class vf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function _f(e,t,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},yf),{width:r.toString(),height:s.toString(),top:i,left:o}),u=v().toLowerCase();n&&(a=
|
|
3328
|
+
*/const yf={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class vf{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function _f(e,t,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},yf),{width:r.toString(),height:s.toString(),top:i,left:o}),u=v().toLowerCase();n&&(a=Al(u)?"_blank":n),bl(u)&&(t=t||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=v()){var t;return Dl(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(u)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
|
|
3329
3329
|
/**
|
|
3330
3330
|
* @license
|
|
3331
3331
|
* Copyright 2021 Google LLC
|
|
@@ -3357,7 +3357,7 @@ const df=new $h(5e3,15e3),ff={style:{position:"absolute",top:"-100px",width:"1px
|
|
|
3357
3357
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3358
3358
|
* See the License for the specific language governing permissions and
|
|
3359
3359
|
* limitations under the License.
|
|
3360
|
-
*/(e)}?${b(a).slice(1)}${u}`}const If="webStorageSupport";const bf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=
|
|
3360
|
+
*/(e)}?${b(a).slice(1)}${u}`}const If="webStorageSupport";const bf=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Cd,this._completeRedirectFn=Zd,this._overrideRedirectResult=Xd}async _openPopup(e,t,n,r){var s;Vh(null===(s=this.eventManagers[e._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return _f(e,await Sf(e,t,n,jh(),r),kd())}async _openRedirect(e,t,n,r){await this._originValidation(e);return function(e){Rd().location.href=e}(await Sf(e,t,n,jh(),r)),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Vh(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){const t=await mf(e),n=new ef(e);return t.register("authEvent",t=>{Uh(null==t?void 0:t.authEvent,e,"invalid-auth-event");return{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(If,{type:If},n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[If];void 0!==s&&t(!!s),Dh(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=of(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Ll()||Cl()||Dl()}};var Cf="@firebase/auth",Af="1.10.8";
|
|
3361
3361
|
/**
|
|
3362
3362
|
* @license
|
|
3363
3363
|
* Copyright 2020 Google LLC
|
|
@@ -3407,5 +3407,5 @@ class kf{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var
|
|
|
3407
3407
|
* See the License for the specific language governing permissions and
|
|
3408
3408
|
* limitations under the License.
|
|
3409
3409
|
*/
|
|
3410
|
-
const Rf=l("authIdTokenMaxAge")||300;let Of=null;function Nf(e=Ge()){const t=je(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=je(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(S(n.getOptions(),null!=t?t:{}))return e;Dh(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:bf,persistence:[Bd,Id,Ad]}),r=l("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(r,location.origin);if(location.origin===e.origin){const t=(s=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Rf)return;const r=null==t?void 0:t.token;Of!==r&&(Of=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){O(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,r){O(e).onIdTokenChanged(t,n,r)}(n,e=>t(e))}}var s;const i=u("auth");return i&&Ql(n,`http://${i}`),n}var Df;Bl={loadJS:e=>new Promise((t,n)=>{const r=document.createElement("script");var s,i;r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Ph("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(null!==(i=null===(s=document.getElementsByTagName("head"))||void 0===s?void 0:s[0])&&void 0!==i?i:document).appendChild(r)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},Df="Browser",Ve(new N("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Uh(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Df,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ml(Df)},c=new Fl(n,r,s,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(_l);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Ve(new N("auth-internal",e=>(e=>new kf(e))(Vl(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Ke(Af,Cf,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Df)),Ke(Af,Cf,"esm2017");class Pf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Lf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Mf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class xf extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Uf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Ff extends Error{constructor(e,t){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=e,this.available_sizes=t}}class Vf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const jf="avatar not created";var Bf=Object.freeze({__proto__:null,AvatarNotCreated:jf,AvatarNotCreatedError:Pf,BrandUserIdNotSetError:xf,NoColorwaySizeAssetsFoundError:Mf,NoFramesFoundError:Uf,NoStylesFoundError:Vf,RecommendedAvailableSizesError:Ff,UserNotLoggedInError:Lf});class Hf{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Nf(t),this.auth.setPersistence(Id)}get id(){var e;return null===(e=this.user)||void 0===e?void 0:e.uid}async onInit(e){this.auth.onAuthStateChanged(t=>{this.setUser(t),t&&(this.logUserLogin(e,t),this.setBrandUserId(t.uid))}),await this.auth.authStateReady();const t=this.auth.currentUser;return this.setUser(t),this.setBrandUserId(null==t?void 0:t.uid),Boolean(t)}setUser(e){this.user=e}async logUserLogin(e,t){var n,r,s,i,o;try{const a=Kc(this.firestore,"user_logging",t.uid),c=await Hu(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[e])||void 0===r?void 0:r.last_login;if(l&&Th(u).diff(Th(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[e])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[e]:{brand_id:e,last_login:u,logins:d}},last_brand_id:e,created_at:c.exists()?c.data().created_at:u,updated_at:u};await qu(a,f,{merge:!0})}catch(e){console.error("LOGGING ERROR:",e)}}setBrandUserId(e){this.brandUserId=e}async getToken(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return await this.user.getIdToken()}get userId(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return this.user.uid}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return(await Hu(Kc(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(e){let t;const n=Ru(Gc(this.firestore,"users"),Nu(ru(),"==",this.id));return t=Gu(n,t=>e(t.docs[0].data())),()=>t()}watchUserProfileForFrames(e){let t;const n=Ru(Gc(this.firestore,"users"),Nu(ru(),"==",this.id));return new Promise(r=>{t=Gu(n,async n=>{await e(n)&&(t(),r(n.docs[0].data()))})})}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await wd(this.auth,e,t);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(e){await async function(e,t){const n=Vl(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Wl(n,r,"getOobCode",td)}(this.auth,e)}async confirmPasswordReset(e,t){await _d(this.auth,e,t)}}class $f{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise(r=>{n=Gu(e,e=>{r(e),t&&n()})}),unsubscribe:()=>n()}};const e=qe(Wu.getInstance().firebase);this.firestore=Zc(e),this.user=new Hf(this.firestore,e)}onInit(e){return this.user.onInit(e)}query(e,t,n=!0){const r=Ru(Gc(this.firestore,e),t);return this.promisefyOnSnapshot(r,n)}getDocs(e,t){return zu(Ru(Gc(this.firestore,e),...t))}async getDoc(e,t){const n=Kc(this.firestore,e,t),r=await Hu(n);return r.exists()?r.data():null}}const zf=e=>{if(e.code===Rh)throw new Error("account has been disabled");throw new Error(e.message)};class qf{static get endpoint(){return Wu.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:r,useToken:s=!0}){const i=this.getUrl(t,s),o={method:n,headers:await this.getHeaders(e,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(e,t){return t?`${this.endpoint}/v1${e}`:this.endpoint+e}static async getHeaders(e,t){if(!t)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await e.getToken()}`}}static Get(e,t,n){return this.Fetch({user:e,endpointPath:t,method:"GET",body:null,useToken:n})}static Post(e,t,n=null,r){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:r})}static Put(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:r})}static Patch(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:r})}static Delete(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:r})}}const Gf=e=>{const t=new Image;return t.src=e,new Promise(e=>{t.onerror=()=>e(!1),t.onload=()=>e(!0)})};class Kf{constructor(e,t){this.brandId=e,this.firebase=t,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(e){var t,n;if(!this.isLoggedIn)throw new Lf;try{const r=await qf.Get(this.user,`/styles/${e}/recommendation`),s=await r.json();return(null===(t=null==s?void 0:s.fits)||void 0===t?void 0:t.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(e){if((null==e?void 0:e.error)===jf)throw new Pf;throw e}}async submitTelephoneNumber(e){const t=e.replace(/[^\+0-9]/g,""),n=await qf.Post(this.user,"/ios-app-link",{phone_number:t},!1);console.log(n)}async getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getColorwaySizeAssetFromBrandStyleId(e){const t=await this.getColorwaySizeAssets(e);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getMeasurementLocationsFromSku(e,t=[]){console.log({sku:e});const n=await this.getColorwaySizeAssetFromSku(e);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(t.length?s.measurement_locations.female.filter(e=>t.includes(e)):s.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getMeasurementLocationsFromBrandStyleId(e,t=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(e);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(t.length?s.measurement_locations.female.filter(e=>t.includes(e)):s.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getStyleByBrandStyleId(e){var t,n;try{const r=[Nu("brand_id","==",this.brandId)];r.push(Nu("brand_style_id","==",e));return null===(n=null===(t=(await this.firebase.getDocs("styles",r)).docs)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data()}catch(e){return zf(e)}}async getColorwaySizeAssets(e,t){const n=[Nu("brand_id","==",this.brandId)];e&&n.push(Nu("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(Nu("sku","in",t));try{const e=await this.firebase.getDocs("colorway_size_assets",n),t=new Map;return e.forEach(e=>{const n=e.data();t.set(n.id,n)}),t}catch(e){return zf(e)}}async getStyle(e){try{return await this.firebase.getDoc("styles",String(e))}catch(e){return zf(e)}}getMeasurementLocationName(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).name:e}getMeasurementLocationSortOrder(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).sort_order:1/0}async tryOn(e,t){if(!this.isLoggedIn)throw new Lf;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t);try{return await this.getColorwaySizeAssetFrames(n)}catch(e){if(!(e instanceof Uf))throw e;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t){var n,r,s;try{const i=[Nu("brand_id","==",this.brandId)];i.push(Nu("style_id","==",e)),i.push(Nu("size_id","==",t));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(e){return zf(e)}}async getGetTaxonomy(e){try{return await this.firebase.getDoc("style_garment_categories",String(e))}catch(e){return zf(e)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach(e=>{this.measurementLocations.set(e.name,{name:e.garment_label,sort_order:e.sort_order})})}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map(e=>e.data())}catch(e){return zf(e)}}async requestThenGetColorwaySizeAssetFrames(e){const[t,n]=await(r=this.getColorwaySizeAssetFromSku(e),r.then(e=>[null,e]).catch(e=>[e]));var r;if(t)throw t;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(e){}return this.awaitColorwaySizeAssetFrames(e)}catch(t){if((null==t?void 0:t.error)===jf)throw new Pf;throw new Vf}}async awaitColorwaySizeAssetFrames(e){var t,n,r,s;if(!this.isLoggedIn)throw new Lf;const i=await this.user.watchUserProfileForFrames(async t=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[e])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&Gf(o[0])});if(!(null===(s=null===(r=null===(n=null===(t=null==i?void 0:i.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Uf;return i.vto[this.brandId][e].frames}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Lf;if(!this.user.brandUserId)throw new xf;await qf.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(t=null==s?void 0:s.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Uf;if(!await Gf(i[0]))throw new Uf;return i}}const Wf=(e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),Wu.getInstance().setEnv(t),new Kf(e,new $f));var Qf;!function(e){e.ACROSS_BACK="across_back",e.ACROSS_FRONT="across_front",e.ACROSS_SHOULDER="across_shoulder",e.ANKLE="ankle",e.ARMEYE="arm_eye",e.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",e.BACK_CROTCH_LENGTH="back_crotch_length",e.BACK_NECK_TO_EBLOW="back_neck_to_elbow",e.BELOW_KNEE="below_knee",e.BICEP="bicep",e.BUST="bust",e.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",e.CALF="calf",e.CB_NECK_TO_WAIST="cb_neck_to_waist",e.CB_NECK_TO_WRIST="cb_neck_to_wrist",e.CF_NECK_TO_WAIST="cf_neck_to_waist",e.ELBOW="elbow",e.FOREARM="forearm",e.FRONT_CROTCH_LENGTH="front_crotch_length",e.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",e.HIGH_HIP="high_hip",e.HSP_TO_ACROSS_BACK="hsp_to_across_back",e.HSP_TO_ACROSS_FRONT="hsp_to_across_front",e.HSP_TO_BUST_POINT="hsp_to_bust_point",e.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",e.HSP_TO_WAIST_POSITION="hsp_to_waist_position",e.INSEAM="inseam",e.KNEE="knee",e.LOW_HIP="low_hip",e.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",e.MID_NECK="mid_neck",e.NECK_AT_BASE="neck_base",e.SHOULDER_DROP="shoulder_drop",e.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",e.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",e.SIDE_WAIST_TO_KNEE="side_waist_to_knee",e.THIGH="thigh",e.TOTAL_RISE_LENGTH="total_rise_length",e.UNDER_BUST="under_bust",e.VERTICAL_TRUNK="vertical_trunk",e.WAIST="waist",e.WRIST="wrist"}(Qf||(Qf={}));const Jf={[Qf.ACROSS_BACK]:"Across back",[Qf.ACROSS_FRONT]:"Across front",[Qf.ACROSS_SHOULDER]:"Across shoulder",[Qf.ANKLE]:"Ankle",[Qf.ARMEYE]:"Armeye",[Qf.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Qf.BACK_CROTCH_LENGTH]:"Back crotch length",[Qf.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Qf.BELOW_KNEE]:"Below knee",[Qf.BICEP]:"Bicep",[Qf.BUST]:"Chest/Bust",[Qf.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Qf.CALF]:"Calf",[Qf.CB_NECK_TO_WAIST]:"Cb neck to waist",[Qf.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Qf.CF_NECK_TO_WAIST]:"Cf neck to waist",[Qf.ELBOW]:"Elbow",[Qf.FOREARM]:"Forearm",[Qf.FRONT_CROTCH_LENGTH]:"Front crotch length",[Qf.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Qf.HIGH_HIP]:"High hip",[Qf.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Qf.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Qf.HSP_TO_BUST_POINT]:"Hsp to bust point",[Qf.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Qf.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Qf.INSEAM]:"Inseam",[Qf.KNEE]:"Knee",[Qf.LOW_HIP]:"Low hip",[Qf.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Qf.MID_NECK]:"Mid neck",[Qf.NECK_AT_BASE]:"Neck at base",[Qf.SHOULDER_DROP]:"Shoulder drop",[Qf.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Qf.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Qf.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Qf.THIGH]:"Thigh",[Qf.TOTAL_RISE_LENGTH]:"Total rise length",[Qf.UNDER_BUST]:"Under bust",[Qf.VERTICAL_TRUNK]:"Vertical trunk",[Qf.WAIST]:"Waist",[Qf.WRIST]:"Wrist"};var Yf;!function(e){e.BLOUSES="blouses",e.COATS="coats",e.DRESSES="dresses",e.JACKETS="jackets",e.PANTS="pants",e.PUFFERS_AND_PARKAS="puffer_and_parkas",e.SHORTS="shorts",e.SKIRTS="skirts",e.SWEATERS="sweaters",e.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Yf||(Yf={}));const Xf={[Yf.BLOUSES]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.COATS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.DRESSES]:[Qf.LOW_HIP,Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST],[Yf.JACKETS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.PANTS]:[Qf.LOW_HIP,Qf.WAIST,Qf.THIGH,Qf.INSEAM],[Yf.PUFFERS_AND_PARKAS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.SHORTS]:[Qf.LOW_HIP,Qf.WAIST,Qf.THIGH,Qf.INSEAM],[Yf.SKIRTS]:[Qf.LOW_HIP,Qf.WAIST],[Yf.SWEATERS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.T_SHIRTS_AND_TANKS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP]},Zf={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},ep={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},tp={activewear:{leggings:Yf.PANTS,joggers:Yf.PANTS,sweatshirts:Yf.SWEATERS},dresses:{a_line:Yf.DRESSES,bodycon:Yf.DRESSES,fit_and_flare:Yf.DRESSES,knit:Yf.DRESSES,shirt:Yf.DRESSES,slip:Yf.DRESSES,straight:Yf.DRESSES,wrap:Yf.DRESSES},jackets_and_coats:{denim_jackets:Yf.JACKETS,parkas:Yf.PUFFERS_AND_PARKAS,peacoats:Yf.COATS,puffer_jackets:Yf.PUFFERS_AND_PARKAS,raincoats:Yf.COATS,rompers:Yf.COATS,shackets:Yf.JACKETS,trench_coats:Yf.COATS},jeans:{bootcut:Yf.PANTS,flared:Yf.PANTS,mom:Yf.PANTS,relaxed:Yf.PANTS,skinny:Yf.PANTS,slim:Yf.PANTS,straight:Yf.PANTS,tapered:Yf.PANTS,wide_leg:Yf.PANTS},jumpsuits_and_rompers:{boiler_suits:Yf.DRESSES,denim:Yf.DRESSES,jumpsuits:Yf.DRESSES,overalls:Yf.DRESSES,rompers:Yf.DRESSES,unitards:Yf.DRESSES},pants_and_shorts:{cigarette:Yf.PANTS,culottes:Yf.SHORTS,denim_shorts:Yf.SHORTS,flared:Yf.PANTS,joggers:Yf.PANTS,leggings:Yf.PANTS,skinny:Yf.PANTS,wide_leg:Yf.PANTS},skirts:{a_line_flared:Yf.SKIRTS,denim:Yf.SKIRTS,knit:Yf.SKIRTS,pencil:Yf.SKIRTS,pleated:Yf.SKIRTS,skater:Yf.SKIRTS,slip:Yf.SKIRTS,wrap:Yf.SKIRTS},suits_and_tailoring:{blazers:Yf.JACKETS,suit_jackets:Yf.JACKETS,suit_skirts:Yf.SKIRTS,suit_trousers:Yf.PANTS,suit_vests:Yf.SWEATERS,trousers:Yf.PANTS},sweaters:{cardigans:Yf.SWEATERS,crewnecks:Yf.SWEATERS,hoodies_and_zipups:Yf.SWEATERS,sweatshirts:Yf.SWEATERS,turtlenecks:Yf.SWEATERS,v_necks:Yf.SWEATERS},tops:{bodysuits:Yf.BLOUSES,corsets_and_bustiers:Yf.BLOUSES,polos:Yf.T_SHIRTS_AND_TANKS,shirts_and_blouses:Yf.BLOUSES,t_shirts:Yf.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Yf.T_SHIRTS_AND_TANKS}};var np;!function(e){e.TOO_TIGHT="too_tight",e.TIGHT="tight",e.SLIGHTLY_TIGHT="slightly_tight",e.PERFECT_FIT="perfect_fit",e.SLIGHTLY_LOOSE="slightly_loose",e.LOOSE="loose",e.OVERSIZED="oversized",e.TOO_SHORT="too_short",e.SHORT="short",e.SLIGHTLY_SHORT="slightly_short",e.SLIGHTLY_LONG="slightly_long",e.LONG="long",e.TOO_LONG="too_long"}(np||(np={}));const rp={[np.TOO_TIGHT]:"Too Tight",[np.TIGHT]:"Tight",[np.SLIGHTLY_TIGHT]:"Slightly Tight",[np.PERFECT_FIT]:"Perfect Fit",[np.SLIGHTLY_LOOSE]:"Slightly Loose",[np.LOOSE]:"Loose",[np.OVERSIZED]:"Oversized",[np.TOO_SHORT]:"Too Short",[np.SHORT]:"Short",[np.SLIGHTLY_SHORT]:"Slightly Short",[np.SLIGHTLY_LONG]:"Slightly Long",[np.LONG]:"Long",[np.TOO_LONG]:"Too Long"};var sp;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(sp||(sp={}));var ip=Object.freeze({__proto__:null,get AvatarState(){return sp},Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],CategoryNames:Zf,get Classification(){return Yf},ClassificationLocations:Xf,get Fit(){return np},FitNames:rp,get MeasurementLocation(){return Qf},MeasurementLocationName:Jf,SubcategoryNames:ep,Taxonomy:tp});export{Bf as Errors,Wf as initShop,e as requests,t as responses,ip as types};
|
|
3410
|
+
const Nf=l("authIdTokenMaxAge")||300;let Rf=null;function Of(e=Ke()){const t=je(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=je(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(S(n.getOptions(),null!=t?t:{}))return e;Dh(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:bf,persistence:[Bd,Id,Cd]}),r=l("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const e=new URL(r,location.origin);if(location.origin===e.origin){const t=(s=e.toString(),async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>Nf)return;const r=null==t?void 0:t.token;Rf!==r&&(Rf=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){R(e).beforeAuthStateChanged(t,n)}(n,t,()=>t(n.currentUser)),function(e,t,n,r){R(e).onIdTokenChanged(t,n,r)}(n,e=>t(e))}}var s;const i=u("auth");return i&&Ql(n,`http://${i}`),n}var Df;Bl={loadJS:e=>new Promise((t,n)=>{const r=document.createElement("script");var s,i;r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Ph("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(null!==(i=null===(s=document.getElementsByTagName("head"))||void 0===s?void 0:s[0])&&void 0!==i?i:document).appendChild(r)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},Df="Browser",Ve(new O("auth",(e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Uh(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Df,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ml(Df)},c=new Fl(n,r,s,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(_l);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(c,t),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),Ve(new O("auth-internal",e=>(e=>new kf(e))(Vl(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),Ge(Cf,Af,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Df)),Ge(Cf,Af,"esm2017");class Pf extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Lf extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Mf extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class xf extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Uf extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class Ff extends Error{constructor(e,t){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=e,this.available_sizes=t}}class Vf extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const jf="avatar not created";var Bf=Object.freeze({__proto__:null,AvatarNotCreated:jf,AvatarNotCreatedError:Pf,BrandUserIdNotSetError:xf,NoColorwaySizeAssetsFoundError:Mf,NoFramesFoundError:Uf,NoStylesFoundError:Vf,RecommendedAvailableSizesError:Ff,UserNotLoggedInError:Lf});class Hf{constructor(e,t){this.firestore=e,this.brandUserId=null,this.auth=Of(t),this.auth.setPersistence(Id)}get id(){var e;return null===(e=this.user)||void 0===e?void 0:e.uid}async onInit(e){this.auth.onAuthStateChanged(t=>{this.setUser(t),t&&(this.logUserLogin(e,t),this.setBrandUserId(t.uid))}),await this.auth.authStateReady();const t=this.auth.currentUser;return this.setUser(t),this.setBrandUserId(null==t?void 0:t.uid),Boolean(t)}setUser(e){this.user=e}async logUserLogin(e,t){var n,r,s,i,o;try{const a=Gc(this.firestore,"user_logging",t.uid),c=await Hu(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[e])||void 0===r?void 0:r.last_login;if(l&&Th(u).diff(Th(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[e])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[e]:{brand_id:e,last_login:u,logins:d}},last_brand_id:e,created_at:c.exists()?c.data().created_at:u,updated_at:u};await qu(a,f,{merge:!0})}catch(e){console.error("LOGGING ERROR:",e)}}setBrandUserId(e){this.brandUserId=e}async getToken(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return await this.user.getIdToken()}get userId(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return this.user.uid}async getUserProfile(){var e;if(!(null===(e=this.user)||void 0===e?void 0:e.uid))throw new Lf;return(await Hu(Gc(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(e){let t;const n=Nu(Kc(this.firestore,"users"),Ou(ru(),"==",this.id));return t=Ku(n,t=>e(t.docs[0].data())),()=>t()}watchUserProfileForFrames(e){let t;const n=Nu(Kc(this.firestore,"users"),Ou(ru(),"==",this.id));return new Promise(r=>{t=Ku(n,async n=>{await e(n)&&(t(),r(n.docs[0].data()))})})}async login(e,t){this.auth.currentUser&&await this.auth.signOut();const n=await wd(this.auth,e,t);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(e){await async function(e,t){const n=Vl(e),r={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};await Wl(n,r,"getOobCode",td)}(this.auth,e)}async confirmPasswordReset(e,t){await _d(this.auth,e,t)}}class $f{constructor(){this.promisefyOnSnapshot=(e,t)=>{let n;return{promise:new Promise(r=>{n=Ku(e,e=>{r(e),t&&n()})}),unsubscribe:()=>n()}};const e=qe(Wu.getInstance().firebase);this.firestore=Zc(e),this.user=new Hf(this.firestore,e)}onInit(e){return this.user.onInit(e)}query(e,t,n=!0){const r=Nu(Kc(this.firestore,e),t);return this.promisefyOnSnapshot(r,n)}getDocs(e,t){return zu(Nu(Kc(this.firestore,e),...t))}async getDoc(e,t){const n=Gc(this.firestore,e,t),r=await Hu(n);return r.exists()?r.data():null}}const zf=e=>{if(e.code===Nh)throw new Error("account has been disabled");throw new Error(e.message)};class qf{static get endpoint(){return Wu.getInstance().api.url}static async Fetch({user:e,endpointPath:t,method:n,body:r,useToken:s=!0}){const i=this.getUrl(t,s),o={method:n,headers:await this.getHeaders(e,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(e,t){return t?`${this.endpoint}/v1${e}`:this.endpoint+e}static async getHeaders(e,t){if(!t)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await e.getToken()}`}}static Get(e,t,n){return this.Fetch({user:e,endpointPath:t,method:"GET",body:null,useToken:n})}static Post(e,t,n=null,r){return this.Fetch({user:e,endpointPath:t,method:"POST",body:n,useToken:r})}static Put(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PUT",body:n,useToken:r})}static Patch(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"PATCH",body:n,useToken:r})}static Delete(e,t,n,r){return this.Fetch({user:e,endpointPath:t,method:"DELETE",body:n,useToken:r})}}const Kf=e=>{const t=new Image;return t.src=e,new Promise(e=>{t.onerror=()=>e(!1),t.onload=()=>e(!0)})};class Gf{constructor(e,t){this.brandId=e,this.firebase=t,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(e){var t,n;if(!this.isLoggedIn)throw new Lf;try{const r=await qf.Get(this.user,`/styles/${e}/recommendation`),s=await r.json();return(null===(t=null==s?void 0:s.fits)||void 0===t?void 0:t.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(e){if((null==e?void 0:e.error)===jf)throw new Pf;throw e}}async submitTelephoneNumber(e){const t=e.replace(/[^\+0-9]/g,""),n=await qf.Post(this.user,"/ios-app-link",{phone_number:t},!1);console.log(n)}async getColorwaySizeAssetFromSku(e){const t=await this.getColorwaySizeAssets(null,[e]);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getColorwaySizeAssetFromBrandStyleId(e){const t=await this.getColorwaySizeAssets(e);if(!(null==t?void 0:t.size))throw new Mf;return Array.from(t.values())[0]}async getMeasurementLocationsFromSku(e,t=[]){console.log({sku:e});const n=await this.getColorwaySizeAssetFromSku(e);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(t.length?s.measurement_locations.female.filter(e=>t.includes(e)):s.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getMeasurementLocationsFromBrandStyleId(e,t=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(e);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(t.length?s.measurement_locations.female.filter(e=>t.includes(e)):s.measurement_locations.female).map(e=>this.measurementLocations.has(e)?this.measurementLocations.get(e):{name:e,sort_order:1/0}).sort((e,t)=>e.sort_order<t.sort_order?-1:0).map(e=>e.name)}async getStyleByBrandStyleId(e){var t,n;try{const r=[Ou("brand_id","==",this.brandId)];r.push(Ou("brand_style_id","==",e));return null===(n=null===(t=(await this.firebase.getDocs("styles",r)).docs)||void 0===t?void 0:t[0])||void 0===n?void 0:n.data()}catch(e){return zf(e)}}async getColorwaySizeAssets(e,t){const n=[Ou("brand_id","==",this.brandId)];e&&n.push(Ou("style_id","==",e)),(null==t?void 0:t.length)>0&&n.push(Ou("sku","in",t));try{const e=await this.firebase.getDocs("colorway_size_assets",n),t=new Map;return e.forEach(e=>{const n=e.data();t.set(n.id,n)}),t}catch(e){return zf(e)}}async getStyle(e){try{return await this.firebase.getDoc("styles",String(e))}catch(e){return zf(e)}}getMeasurementLocationName(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).name:e}getMeasurementLocationSortOrder(e){return this.measurementLocations.has(e)?this.measurementLocations.get(e).sort_order:1/0}async tryOn(e,t){if(!this.isLoggedIn)throw new Lf;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t);try{return await this.getColorwaySizeAssetFrames(n)}catch(e){if(!(e instanceof Uf))throw e;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(e,t){var n,r,s;try{const i=[Ou("brand_id","==",this.brandId)];i.push(Ou("style_id","==",e)),i.push(Ou("size_id","==",t));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(e){return zf(e)}}async getGetTaxonomy(e){try{return await this.firebase.getDoc("style_garment_categories",String(e))}catch(e){return zf(e)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach(e=>{this.measurementLocations.set(e.name,{name:e.garment_label,sort_order:e.sort_order})})}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map(e=>e.data())}catch(e){return zf(e)}}async requestThenGetColorwaySizeAssetFrames(e){const[t,n]=await(r=this.getColorwaySizeAssetFromSku(e),r.then(e=>[null,e]).catch(e=>[e]));var r;if(t)throw t;try{try{this.requestColorwaySizeAssetFrames(n.id)}catch(e){}return this.awaitColorwaySizeAssetFrames(e)}catch(t){if((null==t?void 0:t.error)===jf)throw new Pf;throw new Vf}}async awaitColorwaySizeAssetFrames(e){var t,n,r,s;if(!this.isLoggedIn)throw new Lf;const i=await this.user.watchUserProfileForFrames(async t=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=t.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[e])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&Kf(o[0])});if(!(null===(s=null===(r=null===(n=null===(t=null==i?void 0:i.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Uf;return i.vto[this.brandId][e].frames}async requestColorwaySizeAssetFrames(e){if(!this.isLoggedIn)throw new Lf;if(!this.user.brandUserId)throw new xf;await qf.Post(this.user,`/colorway-size-assets/${e}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(e){var t,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(t=null==s?void 0:s.vto)||void 0===t?void 0:t[this.brandId])||void 0===n?void 0:n[e])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Uf;if(!await Kf(i[0]))throw new Uf;return i}}const Wf=(e,t="dev")=>("dev"!==t&&"development"!==t||console.warn("TfrShop is in development mode"),Wu.getInstance().setEnv(t),new Gf(e,new $f));var Qf;!function(e){e.ACROSS_BACK="across_back",e.ACROSS_FRONT="across_front",e.ACROSS_SHOULDER="across_shoulder",e.ANKLE="ankle",e.ARMEYE="arm_eye",e.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",e.BACK_CROTCH_LENGTH="back_crotch_length",e.BACK_NECK_TO_EBLOW="back_neck_to_elbow",e.BELOW_KNEE="below_knee",e.BICEP="bicep",e.BUST="bust",e.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",e.CALF="calf",e.CB_NECK_TO_WAIST="cb_neck_to_waist",e.CB_NECK_TO_WRIST="cb_neck_to_wrist",e.CF_NECK_TO_WAIST="cf_neck_to_waist",e.ELBOW="elbow",e.FOREARM="forearm",e.FRONT_CROTCH_LENGTH="front_crotch_length",e.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",e.HIGH_HIP="high_hip",e.HSP_TO_ACROSS_BACK="hsp_to_across_back",e.HSP_TO_ACROSS_FRONT="hsp_to_across_front",e.HSP_TO_BUST_POINT="hsp_to_bust_point",e.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",e.HSP_TO_WAIST_POSITION="hsp_to_waist_position",e.INSEAM="inseam",e.KNEE="knee",e.LOW_HIP="low_hip",e.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",e.MID_NECK="mid_neck",e.NECK_AT_BASE="neck_base",e.SHOULDER_DROP="shoulder_drop",e.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",e.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",e.SIDE_WAIST_TO_KNEE="side_waist_to_knee",e.THIGH="thigh",e.TOTAL_RISE_LENGTH="total_rise_length",e.UNDER_BUST="under_bust",e.VERTICAL_TRUNK="vertical_trunk",e.WAIST="waist",e.WRIST="wrist"}(Qf||(Qf={}));const Jf={[Qf.ACROSS_BACK]:"Across back",[Qf.ACROSS_FRONT]:"Across front",[Qf.ACROSS_SHOULDER]:"Across shoulder",[Qf.ANKLE]:"Ankle",[Qf.ARMEYE]:"Armeye",[Qf.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Qf.BACK_CROTCH_LENGTH]:"Back crotch length",[Qf.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Qf.BELOW_KNEE]:"Below knee",[Qf.BICEP]:"Bicep",[Qf.BUST]:"Chest/Bust",[Qf.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Qf.CALF]:"Calf",[Qf.CB_NECK_TO_WAIST]:"Cb neck to waist",[Qf.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Qf.CF_NECK_TO_WAIST]:"Cf neck to waist",[Qf.ELBOW]:"Elbow",[Qf.FOREARM]:"Forearm",[Qf.FRONT_CROTCH_LENGTH]:"Front crotch length",[Qf.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Qf.HIGH_HIP]:"High hip",[Qf.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Qf.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Qf.HSP_TO_BUST_POINT]:"Hsp to bust point",[Qf.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Qf.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Qf.INSEAM]:"Inseam",[Qf.KNEE]:"Knee",[Qf.LOW_HIP]:"Low hip",[Qf.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Qf.MID_NECK]:"Mid neck",[Qf.NECK_AT_BASE]:"Neck at base",[Qf.SHOULDER_DROP]:"Shoulder drop",[Qf.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Qf.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Qf.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Qf.THIGH]:"Thigh",[Qf.TOTAL_RISE_LENGTH]:"Total rise length",[Qf.UNDER_BUST]:"Under bust",[Qf.VERTICAL_TRUNK]:"Vertical trunk",[Qf.WAIST]:"Waist",[Qf.WRIST]:"Wrist"};var Yf;!function(e){e.BLOUSES="blouses",e.COATS="coats",e.DRESSES="dresses",e.JACKETS="jackets",e.PANTS="pants",e.PUFFERS_AND_PARKAS="puffer_and_parkas",e.SHORTS="shorts",e.SKIRTS="skirts",e.SWEATERS="sweaters",e.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Yf||(Yf={}));const Xf={[Yf.BLOUSES]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.COATS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.DRESSES]:[Qf.LOW_HIP,Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST],[Yf.JACKETS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.PANTS]:[Qf.LOW_HIP,Qf.WAIST,Qf.THIGH,Qf.INSEAM],[Yf.PUFFERS_AND_PARKAS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.SHORTS]:[Qf.LOW_HIP,Qf.WAIST,Qf.THIGH,Qf.INSEAM],[Yf.SKIRTS]:[Qf.LOW_HIP,Qf.WAIST],[Yf.SWEATERS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP],[Yf.T_SHIRTS_AND_TANKS]:[Qf.BUST,Qf.ACROSS_SHOULDER,Qf.WAIST,Qf.LOW_HIP,Qf.HIGH_HIP]},Zf={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},ep={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},tp={activewear:{leggings:Yf.PANTS,joggers:Yf.PANTS,sweatshirts:Yf.SWEATERS},dresses:{a_line:Yf.DRESSES,bodycon:Yf.DRESSES,fit_and_flare:Yf.DRESSES,knit:Yf.DRESSES,shirt:Yf.DRESSES,slip:Yf.DRESSES,straight:Yf.DRESSES,wrap:Yf.DRESSES},jackets_and_coats:{denim_jackets:Yf.JACKETS,parkas:Yf.PUFFERS_AND_PARKAS,peacoats:Yf.COATS,puffer_jackets:Yf.PUFFERS_AND_PARKAS,raincoats:Yf.COATS,rompers:Yf.COATS,shackets:Yf.JACKETS,trench_coats:Yf.COATS},jeans:{bootcut:Yf.PANTS,flared:Yf.PANTS,mom:Yf.PANTS,relaxed:Yf.PANTS,skinny:Yf.PANTS,slim:Yf.PANTS,straight:Yf.PANTS,tapered:Yf.PANTS,wide_leg:Yf.PANTS},jumpsuits_and_rompers:{boiler_suits:Yf.DRESSES,denim:Yf.DRESSES,jumpsuits:Yf.DRESSES,overalls:Yf.DRESSES,rompers:Yf.DRESSES,unitards:Yf.DRESSES},pants_and_shorts:{cigarette:Yf.PANTS,culottes:Yf.SHORTS,denim_shorts:Yf.SHORTS,flared:Yf.PANTS,joggers:Yf.PANTS,leggings:Yf.PANTS,skinny:Yf.PANTS,wide_leg:Yf.PANTS},skirts:{a_line_flared:Yf.SKIRTS,denim:Yf.SKIRTS,knit:Yf.SKIRTS,pencil:Yf.SKIRTS,pleated:Yf.SKIRTS,skater:Yf.SKIRTS,slip:Yf.SKIRTS,wrap:Yf.SKIRTS},suits_and_tailoring:{blazers:Yf.JACKETS,suit_jackets:Yf.JACKETS,suit_skirts:Yf.SKIRTS,suit_trousers:Yf.PANTS,suit_vests:Yf.SWEATERS,trousers:Yf.PANTS},sweaters:{cardigans:Yf.SWEATERS,crewnecks:Yf.SWEATERS,hoodies_and_zipups:Yf.SWEATERS,sweatshirts:Yf.SWEATERS,turtlenecks:Yf.SWEATERS,v_necks:Yf.SWEATERS},tops:{bodysuits:Yf.BLOUSES,corsets_and_bustiers:Yf.BLOUSES,polos:Yf.T_SHIRTS_AND_TANKS,shirts_and_blouses:Yf.BLOUSES,t_shirts:Yf.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Yf.T_SHIRTS_AND_TANKS}};var np;!function(e){e.TOO_TIGHT="too_tight",e.TIGHT="tight",e.SLIGHTLY_TIGHT="slightly_tight",e.PERFECT_FIT="perfect_fit",e.SLIGHTLY_LOOSE="slightly_loose",e.LOOSE="loose",e.OVERSIZED="oversized",e.TOO_SHORT="too_short",e.SHORT="short",e.SLIGHTLY_SHORT="slightly_short",e.SLIGHTLY_LONG="slightly_long",e.LONG="long",e.TOO_LONG="too_long"}(np||(np={}));const rp={[np.TOO_TIGHT]:"Too Tight",[np.TIGHT]:"Tight",[np.SLIGHTLY_TIGHT]:"Slightly Tight",[np.PERFECT_FIT]:"Perfect Fit",[np.SLIGHTLY_LOOSE]:"Slightly Loose",[np.LOOSE]:"Loose",[np.OVERSIZED]:"Oversized",[np.TOO_SHORT]:"Too Short",[np.SHORT]:"Short",[np.SLIGHTLY_SHORT]:"Slightly Short",[np.SLIGHTLY_LONG]:"Slightly Long",[np.LONG]:"Long",[np.TOO_LONG]:"Too Long"};var sp;!function(e){e.NOT_CREATED="NOT_CREATED",e.CREATED="CREATED",e.PENDING="PENDING"}(sp||(sp={}));var ip=Object.freeze({__proto__:null,get AvatarState(){return sp},Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],CategoryNames:Zf,get Classification(){return Yf},ClassificationLocations:Xf,get Fit(){return np},FitNames:rp,get MeasurementLocation(){return Qf},MeasurementLocationName:Jf,SubcategoryNames:ep,Taxonomy:tp});export{Bf as Errors,Wf as initShop,e as requests,t as responses,ip as types};
|
|
3411
3411
|
//# sourceMappingURL=index.min.js.map
|