@thefittingroom/sdk 1.5.2 → 2.0.0-alpha-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * thefittingroom v1.5.2 (2024-09-03T15:43:56.403Z)
2
+ * thefittingroom v2.0.0-alpha-1 (2025-01-17T20:00:16.432Z)
3
3
  * Copyright 2022-present, TheFittingRoom, Inc. All rights reserved.
4
4
  */
5
5
  var t=Object.freeze({__proto__:null}),e=Object.freeze({__proto__:null});
@@ -198,7 +198,7 @@ class l{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
198
198
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
199
  * See the License for the specific language governing permissions and
200
200
  * limitations under the License.
201
- */var k;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(k||(k={}));const N={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},R=k.INFO,O={[k.DEBUG]:"log",[k.VERBOSE]:"log",[k.INFO]:"info",[k.WARN]:"warn",[k.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=O[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class L{constructor(t){this.name=t,this._logLevel=R,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in k))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,k.DEBUG,...t),this._logHandler(this,k.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,k.VERBOSE,...t),this._logHandler(this,k.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,k.INFO,...t),this._logHandler(this,k.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,k.WARN,...t),this._logHandler(this,k.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,k.ERROR,...t),this._logHandler(this,k.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,x;const U=new WeakMap,F=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||V.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const r=t.call(W(this),e,...n);return V.set(r,e.sort?e.sort():[e]),K(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(F.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(K(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(B.has(t))return B.get(t);const e=q(t);return e!==t&&(B.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const G=["get","getKey","getAll","getAllKeys","count"],z=["put","add","delete","clear"],Q=new Map;function Y(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Q.get(e))return Q.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=z.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!G.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return Q.set(e,i),i}j=(t=>({...t,get:(e,n,r)=>Y(e,n)||t.get(e,n,r),has:(e,n)=>!!Y(e,n)||t.has(e,n)}))(j);
201
+ */var k;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(k||(k={}));const N={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},R=k.INFO,O={[k.DEBUG]:"log",[k.VERBOSE]:"log",[k.INFO]:"info",[k.WARN]:"warn",[k.ERROR]:"error"},D=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=O[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};class L{constructor(t){this.name=t,this._logLevel=R,this._logHandler=D,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in k))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?N[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,k.DEBUG,...t),this._logHandler(this,k.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,k.VERBOSE,...t),this._logHandler(this,k.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,k.INFO,...t),this._logHandler(this,k.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,k.WARN,...t),this._logHandler(this,k.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,k.ERROR,...t),this._logHandler(this,k.ERROR,...t)}}const P=(t,e)=>e.some((e=>t instanceof e));let M,x;const U=new WeakMap,F=new WeakMap,V=new WeakMap,B=new WeakMap,H=new WeakMap;let j={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return F.get(t);if("objectStoreNames"===e)return t.objectStoreNames||V.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function $(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(x||(x=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(W(this),e),K(U.get(this))}:function(...e){return K(t.apply(W(this),e))}:function(e,...n){const r=t.call(W(this),e,...n);return V.set(r,e.sort?e.sort():[e]),K(r)}}function q(t){return"function"==typeof t?$(t):(t instanceof IDBTransaction&&function(t){if(F.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",i),t.removeEventListener("abort",i)},s=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",s),t.addEventListener("error",i),t.addEventListener("abort",i)}));F.set(t,e)}(t),P(t,M||(M=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(t,j):t)}function K(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",s),t.removeEventListener("error",i)},s=()=>{e(K(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",s),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&U.set(e,t)})).catch((()=>{})),H.set(e,t),e}(t);if(B.has(t))return B.get(t);const e=q(t);return e!==t&&(B.set(t,e),H.set(e,t)),e}const W=t=>H.get(t);const z=["get","getKey","getAll","getAllKeys","count"],G=["put","add","delete","clear"],Q=new Map;function Y(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(Q.get(e))return Q.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=G.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!s&&!z.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,s?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),s&&i.done]))[0]};return Q.set(e,i),i}j=(t=>({...t,get:(e,n,r)=>Y(e,n)||t.get(e,n,r),has:(e,n)=>!!Y(e,n)||t.has(e,n)}))(j);
202
202
  /**
203
203
  * @license
204
204
  * Copyright 2019 Google LLC
@@ -280,7 +280,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
280
280
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
281
281
  * See the License for the specific language governing permissions and
282
282
  * limitations under the License.
283
- */const Ht="firebase-heartbeat-database",jt=1,$t="firebase-heartbeat-store";let qt=null;function Kt(){return qt||(qt=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(t=>s(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore($t)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),qt}async function Wt(t,e){try{const n=(await Kt()).transaction($t,"readwrite"),r=n.objectStore($t);await r.put(e,Gt(t)),await n.done}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}function Gt(t){return`${t.name}!${t.options.appId}`}
283
+ */const Ht="firebase-heartbeat-database",jt=1,$t="firebase-heartbeat-store";let qt=null;function Kt(){return qt||(qt=function(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),a=K(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(K(o.result),t.oldVersion,t.newVersion,K(o.transaction),t)})),n&&o.addEventListener("blocked",(t=>n(t.oldVersion,t.newVersion,t))),a.then((t=>{i&&t.addEventListener("close",(()=>i())),s&&t.addEventListener("versionchange",(t=>s(t.oldVersion,t.newVersion,t)))})).catch((()=>{})),a}(Ht,jt,{upgrade:(t,e)=>{if(0===e)try{t.createObjectStore($t)}catch(t){console.warn(t)}}}).catch((t=>{throw Mt.create("idb-open",{originalErrorMessage:t.message})}))),qt}async function Wt(t,e){try{const n=(await Kt()).transaction($t,"readwrite"),r=n.objectStore($t);await r.put(e,zt(t)),await n.done}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-set",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}function zt(t){return`${t.name}!${t.options.appId}`}
284
284
  /**
285
285
  * @license
286
286
  * Copyright 2021 Google LLC
@@ -296,7 +296,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
296
296
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
297
297
  * See the License for the specific language governing permissions and
298
298
  * limitations under the License.
299
- */class zt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Yt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Qt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some((t=>t.date===s)))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(t){tt.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Qt(),{heartbeatsToSend:n,unsentEntries:r}=function(t,e=1024){const n=[];let r=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),Jt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Jt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return tt.warn(t),""}}}function Qt(){return(new Date).toISOString().substring(0,10)}class Yt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Kt()).transaction($t),n=await e.objectStore($t).get(Gt(t));return await e.done,n}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Jt(t){return i(JSON.stringify({version:2,heartbeats:t})).length}
299
+ */class Gt{constructor(t){this.container=t,this._heartbeatsCache=null;const e=this.container.getProvider("app").getImmediate();this._storage=new Yt(e),this._heartbeatsCachePromise=this._storage.read().then((t=>(this._heartbeatsCache=t,t)))}async triggerHeartbeat(){var t,e,n;try{const r=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),s=Qt();if(console.log("heartbeats",null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats),null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(n=this._heartbeatsCache)||void 0===n?void 0:n.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===s||this._heartbeatsCache.heartbeats.some((t=>t.date===s)))return;return this._heartbeatsCache.heartbeats.push({date:s,agent:r}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((t=>{const e=new Date(t.date).valueOf();return Date.now()-e<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}catch(t){tt.warn(t)}}async getHeartbeatsHeader(){var t;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const e=Qt(),{heartbeatsToSend:n,unsentEntries:r}=function(t,e=1024){const n=[];let r=t.slice();for(const s of t){const t=n.find((t=>t.agent===s.agent));if(t){if(t.dates.push(s.date),Jt(n)>e){t.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),Jt(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),s=i(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),s}catch(t){return tt.warn(t),""}}}function Qt(){return(new Date).toISOString().substring(0,10)}class Yt{constructor(t){this.app=t,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(t){return!1}}()&&new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var t;e((null===(t=s.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((()=>!0)).catch((()=>!1))}async read(){if(await this._canUseIndexedDBPromise){const t=await async function(t){try{const e=(await Kt()).transaction($t),n=await e.objectStore($t).get(zt(t));return await e.done,n}catch(t){if(t instanceof f)tt.warn(t.message);else{const e=Mt.create("idb-get",{originalErrorMessage:null==t?void 0:t.message});tt.warn(e.message)}}}(this.app);return(null==t?void 0:t.heartbeats)?t:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:t.heartbeats})}}async add(t){var e;if(await this._canUseIndexedDBPromise){const n=await this.read();return Wt(this.app,{lastSentHeartbeatDate:null!==(e=t.lastSentHeartbeatDate)&&void 0!==e?e:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...t.heartbeats]})}}}function Jt(t){return i(JSON.stringify({version:2,heartbeats:t})).length}
300
300
  /**
301
301
  * @license
302
302
  * Copyright 2019 Google LLC
@@ -312,7 +312,7 @@ class xt{constructor(t,e,n){this._isDeleted=!1,this._options=Object.assign({},t)
312
312
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
313
313
  * See the License for the specific language governing permissions and
314
314
  * limitations under the License.
315
- */var Xt;Xt="",Dt(new I("platform-logger",(t=>new J(t)),"PRIVATE")),Dt(new I("heartbeat",(t=>new zt(t)),"PRIVATE")),Bt(X,Z,Xt),Bt(X,Z,"esm2017"),Bt("fire-js","");
315
+ */var Xt;Xt="",Dt(new I("platform-logger",(t=>new J(t)),"PRIVATE")),Dt(new I("heartbeat",(t=>new Gt(t)),"PRIVATE")),Bt(X,Z,Xt),Bt(X,Z,"esm2017"),Bt("fire-js","");
316
316
  /**
317
317
  * @license
318
318
  * Copyright 2017 Google LLC
@@ -394,7 +394,7 @@ const ne=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=
394
394
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
395
395
  * See the License for the specific language governing permissions and
396
396
  * limitations under the License.
397
- */var le;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(le||(le={}));const de={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},fe=le.INFO,pe={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},ge=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=pe[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};var me=function(t,e){return me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},me(t,e)};function ye(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ve(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var we,_e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Te=Te||{},Ee=_e||self;function Se(){}function Ie(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function be(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ae="closure_uid_"+(1e9*Math.random()>>>0),Ce=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ne(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Re(t,e,n){return(Re=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ne).apply(null,arguments)}function Oe(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function De(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ae)&&t[Ae]||(t[Ae]=++Ce))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Pe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Ie(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function Ue(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Ue.prototype.h=function(){this.defaultPrevented=!0};var Fe=function(){if(!Ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ee.addEventListener("test",Se,e),Ee.removeEventListener("test",Se,e)}catch(t){}return t}();function Ve(t){return/^[\s\xa0]*$/.test(t)}var Be=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=Ee.navigator;return t&&(t=t.userAgent)?t:""}function $e(t){return-1!=je().indexOf(t)}function qe(t){return qe[" "](t),t}qe[" "]=Se;var Ke,We,Ge=$e("Opera"),ze=$e("Trident")||$e("MSIE"),Qe=$e("Edge"),Ye=Qe||ze,Je=$e("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge"))&&!($e("Trident")||$e("MSIE"))&&!$e("Edge"),Xe=-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge");function Ze(){var t=Ee.document;return t?t.documentMode:void 0}t:{var tn="",en=(We=je(),Je?/rv:([^\);]+)(\)|;)/.exec(We):Qe?/Edge\/([\d\.]+)/.exec(We):ze?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(We):Xe?/WebKit\/(\S+)/.exec(We):Ge?/(?:Version)[ \/]?(\S+)/.exec(We):void 0);if(en&&(tn=en?en[1]:""),ze){var nn=Ze();if(null!=nn&&nn>parseFloat(tn)){Ke=String(nn);break t}}Ke=tn}var rn,sn={};function on(){return function(t){var e=sn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Be(String(Ke)).split("."),n=Be("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=He(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==i[2].length,0==o[2].length)||He(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ee.document&&ze){var an=Ze();rn=an||(parseInt(Ke,10)||void 0)}else rn=void 0;var cn=rn;function un(t,e){if(Ue.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Je){t:{try{qe(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}De(un,Ue);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),dn=0;function fn(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++dn,this.ba=this.ea=!1}function pn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function gn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function mn(t){var e={};for(var n in t)e[n]=t[n];return e}var yn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function vn(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<yn.length;i++)n=yn[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function wn(t){this.src=t,this.g={},this.h=0}function _n(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Pe(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(pn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Tn(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}wn.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Tn(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new fn(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var En="closure_lm_"+(1e6*Math.random()|0),Sn={};function In(t,e,n,r,s){if(r&&r.once)return An(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)In(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!1,r,s)}function bn(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=be(s)?!!s.capture:!!s,a=On(t);if(a||(t[En]=a=new wn(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Rn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Fe||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function An(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)An(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!0,r,s)}function Cn(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Cn(t,e[i],n,r,s);else r=be(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Tn(i=t.g[e],n,r,s))&&(pn(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=On(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Tn(e,n,r,s)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])_n(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=On(e))?(_n(n,t),0==n.h&&(n.src=null,e[En]=null)):pn(t)}}}function Nn(t){return t in Sn?Sn[t]:Sn[t]="on"+t}function Rn(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function On(t){return(t=t[En])instanceof wn?t:null}var Dn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Dn]||(t[Dn]=function(e){return t.handleEvent(e)}),t[Dn])}function Pn(){Le.call(this),this.i=new wn(this),this.P=this,this.I=null}function Mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Ue(e,t);else if(e instanceof Ue)e.target=e.target||t;else{var s=e;vn(e=new Ue(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=xn(o,r,!0,e)&&s}if(s=xn(o=e.g=t,r,!0,e)&&s,s=xn(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=xn(o=e.g=n[i],r,!1,e)&&s}function xn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&_n(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}De(Pn,Le),Pn.prototype[ln]=!0,Pn.prototype.removeEventListener=function(t,e,n,r){Cn(this,t,e,n,r)},Pn.prototype.M=function(){if(Pn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)pn(n[r]);delete e.g[t],e.h--}}this.I=null},Pn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Pn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Un=Ee.JSON.stringify;function Fn(){var t=Wn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Vn,Bn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new jn}),(function(t){return t.reset()})),jn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $n(t){Ee.setTimeout((function(){throw t}),0)}function qn(t,e){Vn||function(){var t=Ee.Promise.resolve(void 0);Vn=function(){t.then(Gn)}}(),Kn||(Vn(),Kn=!0),Wn.add(t,e)}var Kn=!1,Wn=new Bn;function Gn(){for(var t;t=Fn();){try{t.h.call(t.g)}catch(t){$n(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Kn=!1}function zn(t,e){Pn.call(this),this.h=t||1,this.g=e||Ee,this.j=Re(this.lb,this),this.l=Date.now()}function Qn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Yn(t,e,n){if("function"==typeof t)n&&(t=Re(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Re(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ee.setTimeout(t,e||0)}function Jn(t){t.g=Yn((function(){t.g=null,t.i&&(t.i=!1,Jn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}De(zn,Pn),(we=zn.prototype).ca=!1,we.R=null,we.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Mn(this,"tick"),this.ca&&(Qn(this),this.start()))}},we.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},we.M=function(){zn.X.M.call(this),Qn(this),delete this.g};var Xn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}me(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:Jn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Zn(t){Le.call(this),this.h=t,this.g={}}De(Zn,Le);var tr=[];function er(t,e,n,r){Array.isArray(n)||(n&&(tr[0]=n.toString()),n=tr);for(var s=0;s<n.length;s++){var i=In(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function nr(t){gn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function rr(){this.g=!0}function sr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return Un(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Zn.prototype.M=function(){Zn.X.M.call(this),nr(this)},Zn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},rr.prototype.Aa=function(){this.g=!1},rr.prototype.info=function(){};var ir={},or=null;function ar(){return or=or||new Pn}function cr(t){Ue.call(this,ir.Pa,t)}function ur(t){var e=ar();Mn(e,new cr(e))}function hr(t,e){Ue.call(this,ir.STAT_EVENT,t),this.stat=e}function lr(t){var e=ar();Mn(e,new hr(e,t))}function dr(t,e){Ue.call(this,ir.Qa,t),this.size=e}function fr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ee.setTimeout((function(){t()}),e)}ir.Pa="serverreachability",De(cr,Ue),ir.STAT_EVENT="statevent",De(hr,Ue),ir.Qa="timingevent",De(dr,Ue);var pr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},gr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function mr(){}function yr(t){return t.h||(t.h=t.i())}function vr(){}mr.prototype.h=null;var wr,_r={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Tr(){Ue.call(this,"d")}function Er(){Ue.call(this,"c")}function Sr(){}function Ir(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Zn(this),this.O=Ar,t=Ye?125:void 0,this.T=new zn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new br}function br(){this.i=null,this.g="",this.h=!1}De(Tr,Ue),De(Er,Ue),De(Sr,mr),Sr.prototype.g=function(){return new XMLHttpRequest},Sr.prototype.i=function(){return{}},wr=new Sr;var Ar=45e3,Cr={},kr={};function Nr(t,e,n){t.K=1,t.v=zr($r(e)),t.s=n,t.P=!0,Rr(t,null)}function Rr(t,e){t.F=Date.now(),Pr(t),t.A=$r(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),as(n.i,"t",r),t.C=0,n=t.l.H,t.h=new br,t.g=ai(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Xn(Re(t.La,t,t.g),t.N)),er(t.S,t.g,"readystatechange",t.ib),e=t.H?mn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),ur(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Or(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Dr(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),s=!1),sr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Cr){t.o=4,lr(15),sr(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}sr(t.j,t.m,r,null),Vr(t,r)}Or(t)&&r!=kr&&r!=Cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Zs(e),e.K=!0,lr(11))):(sr(t.j,t.m,n,"[Invalid Chunked Response]"),Fr(t),Ur(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Cr:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Pr(t){t.V=Date.now()+t.O,Mr(t,t.O)}function Mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=fr(Re(t.gb,t),e)}function xr(t){t.B&&(Ee.clearTimeout(t.B),t.B=null)}function Ur(t){0==t.l.G||t.I||ni(t.l,t)}function Fr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Qn(t.T),nr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Vr(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||ps(n.h,t)))if(!t.J&&ps(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ei(n),Ks(n)}Xs(n),lr(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=fr(Re(n.cb,n),6e3));if(1>=fs(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else si(n,11)}else if((t.J||n.g==t)&&ei(n),!Ve(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(gs(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,Gr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=oi(r,r.H?r.ka:null,r.V),f.J){ms(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Pr(p)),r.g=f}else Js(r);0<n.i.length&&Gs(n)}else"stop"!=i[0]&&"close"!=i[0]||si(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?si(n,7):qs(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}ur()}catch(i){}}function Br(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Ie(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Ie(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(we=Ir.prototype).setTimeout=function(t){this.O=t},we.ib=function(t){t=t.target;var e=this.L;e&&3==Fs(t)?e.l():this.La(t)},we.La=function(t){try{if(t==this.g)t:{var e=Fs(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ye||this.g&&(this.h.h||this.g.fa()||Vs(this.g)))){this.I||4!=e||7==n||ur(),xr(this);var r=this.g.aa();this.Y=r;e:if(Or(this)){var s=Vs(this.g);t="";var i=s.length,o=4==Fs(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Fr(this),Ur(this);var a="";break e}this.h.i=new Ee.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Ve(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,lr(12),Fr(this),Ur(this);break t}sr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Vr(this,r)}this.P?(Dr(this,e,a),Ye&&this.i&&3==e&&(er(this.S,this.T,"tick",this.hb),this.T.start())):(sr(this.j,this.m,a,null),Vr(this,a)),4==e&&Fr(this),this.i&&!this.I&&(4==e?ni(this.l,this):(this.i=!1,Pr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Fr(this),Ur(this)}}}catch(e){}},we.hb=function(){if(this.g){var t=Fs(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Dr(this,t,e),this.i&&4!=t&&Pr(this))}},we.cancel=function(){this.I=!0,Fr(this)},we.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(ur(),lr(17)),Fr(this),this.o=2,Ur(this)):Mr(this,this.V-t)};var Hr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof jr){this.h=void 0!==e?e:t.h,qr(this,t.j),this.s=t.s,this.g=t.g,Kr(this,t.m),this.l=t.l,e=t.i;var n=new rs;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Wr(this,n),this.o=t.o}else t&&(n=String(t).match(Hr))?(this.h=!!e,qr(this,n[1]||"",!0),this.s=Qr(n[2]||""),this.g=Qr(n[3]||"",!0),Kr(this,n[4]),this.l=Qr(n[5]||"",!0),Wr(this,n[6]||"",!0),this.o=Qr(n[7]||"")):(this.h=!!e,this.i=new rs(null,this.h))}function $r(t){return new jr(t)}function qr(t,e,n){t.j=n?Qr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Wr(t,e,n){e instanceof rs?(t.i=e,function(t,e){e&&!t.j&&(ss(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(is(this,e),as(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Yr(e,es)),t.i=new rs(e,t.h))}function Gr(t,e,n){t.i.set(e,n)}function zr(t){return Gr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Qr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Yr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Jr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Jr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}jr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Yr(e,Xr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Yr(e,Xr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Yr(n,"/"==n.charAt(0)?ts:Zr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Yr(n,ns)),t.join("")};var Xr=/[#\/\?@]/g,Zr=/[#\?:]/g,ts=/[#\?]/g,es=/[#\?@]/g,ns=/#/g;function rs(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ss(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function is(t,e){ss(t),e=cs(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function os(t,e){return ss(t),e=cs(t,e),t.g.has(e)}function as(t,e,n){is(t,e),0<n.length&&(t.i=null,t.g.set(cs(t,e),Me(n)),t.h+=n.length)}function cs(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(we=rs.prototype).add=function(t,e){ss(this),this.i=null,t=cs(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},we.forEach=function(t,e){ss(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},we.oa=function(){ss(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},we.W=function(t){ss(this);var e=[];if("string"==typeof t)os(this,t)&&(e=e.concat(this.g.get(cs(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},we.set=function(t,e){return ss(this),this.i=null,os(this,t=cs(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},we.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},we.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var us=function(t,e){this.h=t,this.g=e};function hs(t){this.l=t||ls,Ee.PerformanceNavigationTiming?t=0<(t=Ee.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ee.g&&Ee.g.Ga&&Ee.g.Ga()&&Ee.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var ls=10;function ds(t){return!!t.h||!!t.g&&t.g.size>=t.j}function fs(t){return t.h?1:t.g?t.g.size:0}function ps(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function gs(t,e){t.g?t.g.add(e):t.h=e}function ms(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function ys(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=ye(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return Me(t.i)}function vs(){}function ws(){this.g=new vs}function _s(t,e,n){var r=n||"";try{Br(t,(function(t,n){var s=t;be(t)&&(s=Un(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Ts(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function Es(t){this.l=t.ac||null,this.j=t.jb||!1}function Ss(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Is,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}hs.prototype.cancel=function(){var t,e;if(this.i=ys(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ye(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},vs.prototype.stringify=function(t){return Ee.JSON.stringify(t,void 0)},vs.prototype.parse=function(t){return Ee.JSON.parse(t,void 0)},De(Es,mr),Es.prototype.g=function(){return new Ss(this.l,this.j)},Es.prototype.i=function(t){return function(){return t}}({}),De(Ss,Pn);var Is=0;function bs(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function As(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Cs(t)}function Cs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(we=Ss.prototype).open=function(t,e){if(this.readyState!=Is)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Cs(this)},we.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||Ee).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},we.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,As(this)),this.readyState=Is},we.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Cs(this)),this.g&&(this.readyState=3,Cs(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ee.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;bs(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},we.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?As(this):Cs(this),3==this.readyState&&bs(this)}},we.Va=function(t){this.g&&(this.response=this.responseText=t,As(this))},we.Ua=function(t){this.g&&(this.response=t,As(this))},we.ga=function(){this.g&&As(this)},we.setRequestHeader=function(t,e){this.v.append(t,e)},we.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},we.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Ss.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ks=Ee.JSON.parse;function Ns(t){Pn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Rs,this.K=this.L=!1}De(Ns,Pn);var Rs="",Os=/^https?$/i,Ds=["POST","PUT"];function Ls(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Ps(t),xs(t)}function Ps(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Ms(t){if(t.h&&void 0!==Te&&(!t.C[1]||4!=Fs(t)||2!=t.aa()))if(t.v&&4==Fs(t))Yn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==Fs(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Hr)[1]||null;if(!i&&Ee.self&&Ee.self.location){var o=Ee.self.location.protocol;i=o.substr(0,o.length-1)}s=!Os.test(i?i.toLowerCase():"")}e=s}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<Fs(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Ps(t)}}finally{xs(t)}}}function xs(t,e){if(t.g){Us(t);var n=t.g,r=t.C[0]?Se:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Us(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ee.clearTimeout(t.A),t.A=null)}function Fs(t){return t.g?t.g.readyState:0}function Vs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Rs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Bs(t){var e="";return gn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hs(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Bs(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):Gr(t,e,n))}function js(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function $s(t){this.Ca=0,this.i=[],this.j=new rr,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=js("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=js("baseRetryDelayMs",5e3,t),this.bb=js("retryDelaySeedMs",1e4,t),this.$a=js("forwardChannelMaxRetries",2,t),this.ta=js("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new hs(t&&t.concurrentRequestLimit),this.Fa=new ws,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function qs(t){if(Ws(t),3==t.G){var e=t.U++,n=$r(t.F);Gr(n,"SID",t.I),Gr(n,"RID",e),Gr(n,"TYPE","terminate"),Qs(t,n),(e=new Ir(t,t.j,e,void 0)).K=2,e.v=zr($r(n)),n=!1,Ee.navigator&&Ee.navigator.sendBeacon&&(n=Ee.navigator.sendBeacon(e.v.toString(),"")),!n&&Ee.Image&&((new Image).src=e.v,n=!0),n||(e.g=ai(e.l,null),e.g.da(e.v)),e.F=Date.now(),Pr(e)}ii(t)}function Ks(t){t.g&&(Zs(t),t.g.cancel(),t.g=null)}function Ws(t){Ks(t),t.u&&(Ee.clearTimeout(t.u),t.u=null),ei(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ee.clearTimeout(t.m),t.m=null)}function Gs(t){ds(t.h)||t.m||(t.m=!0,qn(t.Ja,t),t.C=0)}function zs(t,e){var n;n=e?e.m:t.U++;var r=$r(t.F);Gr(r,"SID",t.I),Gr(r,"RID",n),Gr(r,"AID",t.T),Qs(t,r),t.o&&t.s&&Hs(r,t.o,t.s),n=new Ir(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Ys(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),gs(t.h,n),Nr(n,r,e)}function Qs(t,e){t.ia&&gn(t.ia,(function(t,n){Gr(e,n,t)})),t.l&&Br({},(function(t,n){Gr(e,n,t)}))}function Ys(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Re(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{_s(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Js(t){t.g||t.u||(t.Z=1,qn(t.Ia,t),t.A=0)}function Xs(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=fr(Re(t.Ia,t),ri(t,t.A)),t.A++,!0)}function Zs(t){null!=t.B&&(Ee.clearTimeout(t.B),t.B=null)}function ti(t){t.g=new Ir(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=$r(t.sa);Gr(e,"RID","rpc"),Gr(e,"SID",t.I),Gr(e,"CI",t.L?"0":"1"),Gr(e,"AID",t.T),Gr(e,"TYPE","xmlhttp"),Qs(t,e),t.o&&t.s&&Hs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=zr($r(e)),n.s=null,n.P=!0,Rr(n,t)}function ei(t){null!=t.v&&(Ee.clearTimeout(t.v),t.v=null)}function ni(t,e){var n=null;if(t.g==e){ei(t),Zs(t),t.g=null;var r=2}else{if(!ps(t.h,e))return;n=e.D,ms(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Mn(r=ar(),new dr(r,n)),Gs(t)}else Js(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(fs(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=fr(Re(t.Ja,t,e),ri(t,t.C)),t.C++,0)))}(t,e)||2==r&&Xs(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:si(t,5);break;case 4:si(t,10);break;case 3:si(t,6);break;default:si(t,2)}}function ri(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function si(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Re(t.kb,t);n||(n=new jr("//www.google.com/images/cleardot.gif"),Ee.location&&"http"==Ee.location.protocol||qr(n,"https"),zr(n)),function(t,e){var n=new rr;if(Ee.Image){var r=new Image;r.onload=Oe(Ts,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Oe(Ts,n,r,"TestLoadImage: error",!1,e),r.onabort=Oe(Ts,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Oe(Ts,n,r,"TestLoadImage: timeout",!1,e),Ee.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),ii(t),Ws(t)}function ii(t){if(t.G=0,t.la=[],t.l){var e=ys(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function oi(t,e,n){var r=n instanceof jr?$r(n):new jr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Kr(r,r.m);else{var s=Ee.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new jr(null,void 0);r&&qr(i,r),e&&(i.g=e),s&&Kr(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&Gr(r,n,e),Gr(r,"VER",t.ma),Qs(t,r),r}function ai(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Ns(new Es({jb:!0})):new Ns(t.ra)).Ka(t.H),e}function ci(){}function ui(){if(ze&&!(10<=Number(cn)))throw Error("Environmental error: no available transport.")}function hi(t,e){Pn.call(this),this.g=new $s(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Ve(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ve(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new fi(this)}function li(t){Tr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function di(){Er.call(this),this.status=1}function fi(t){this.g=t}(we=Ns.prototype).Ka=function(t){this.L=t},we.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():wr.g(),this.C=this.u?yr(this.u):yr(wr),this.g.onreadystatechange=Re(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ls(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=ye(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=Ee.FormData&&t instanceof Ee.FormData,!(0<=Pe(Ds,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ye(n),f=d.next();!f.done;f=d.next()){var p=ve(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Us(this),0<this.B&&((this.K=function(t){return ze&&on()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Re(this.qa,this)):this.A=Yn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ls(this,l)}},we.qa=function(){void 0!==Te&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},we.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),xs(this))},we.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xs(this,!0)),Ns.X.M.call(this)},we.Ha=function(){this.s||(this.F||this.v||this.l?Ms(this):this.fb())},we.fb=function(){Ms(this)},we.aa=function(){try{return 2<Fs(this)?this.g.status:-1}catch(t){return-1}},we.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},we.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ks(e)}},we.Ea=function(){return this.m},we.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(we=$s.prototype).ma=8,we.G=1,we.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Ir(this,this.j,t,void 0),n=this.s;if(this.S&&(n?vn(n=mn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=Ys(this,e,r),Gr(s=$r(this.F),"RID",t),Gr(s,"CVER",22),this.D&&Gr(s,"X-HTTP-Session-Id",this.D),Qs(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Bs(n)))+"&"+r:this.o&&Hs(s,this.o,n)),gs(this.h,e),this.Ya&&Gr(s,"TYPE","init"),this.O?(Gr(s,"$req",r),Gr(s,"SID","null"),e.Z=!0,Nr(e,s,null)):Nr(e,s,r),this.G=2}}else 3==this.G&&(t?zs(this,t):0==this.i.length||ds(this.h)||zs(this))},we.Ia=function(){if(this.u=null,ti(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=fr(Re(this.eb,this),t)}},we.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,lr(10),Ks(this),ti(this))},we.cb=function(){null!=this.v&&(this.v=null,Ks(this),Xs(this),lr(19))},we.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(we=ci.prototype).xa=function(){},we.wa=function(){},we.va=function(){},we.ua=function(){},we.Ra=function(){},ui.prototype.g=function(t,e){return new hi(t,e)},De(hi,Pn),hi.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=oi(t,null,t.V),Gs(t)},hi.prototype.close=function(){qs(this.g)},hi.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Un(t),t=n);e.i.push(new us(e.ab++,t)),3==e.G&&Gs(e)},hi.prototype.M=function(){this.g.l=null,delete this.j,qs(this.g),delete this.g,hi.X.M.call(this)},De(li,Tr),De(di,Er),De(fi,ci),fi.prototype.xa=function(){Mn(this.g,"a")},fi.prototype.wa=function(t){Mn(this.g,new li(t))},fi.prototype.va=function(t){Mn(this.g,new di)},fi.prototype.ua=function(){Mn(this.g,"b")},ui.prototype.createWebChannel=ui.prototype.g,hi.prototype.send=hi.prototype.u,hi.prototype.open=hi.prototype.m,hi.prototype.close=hi.prototype.close,pr.NO_ERROR=0,pr.TIMEOUT=8,pr.HTTP_ERROR=6,gr.COMPLETE="complete",vr.EventType=_r,_r.OPEN="a",_r.CLOSE="b",_r.ERROR="c",_r.MESSAGE="d",Pn.prototype.listen=Pn.prototype.N,Ns.prototype.listenOnce=Ns.prototype.O,Ns.prototype.getLastError=Ns.prototype.Oa,Ns.prototype.getLastErrorCode=Ns.prototype.Ea,Ns.prototype.getStatus=Ns.prototype.aa,Ns.prototype.getResponseJson=Ns.prototype.Sa,Ns.prototype.getResponseText=Ns.prototype.fa,Ns.prototype.send=Ns.prototype.da,Ns.prototype.setWithCredentials=Ns.prototype.Ka;var pi=pr,gi=gr,mi=ir,yi=10,vi=11,wi=Es,_i=vr,Ti=Ns;const Ei="@firebase/firestore";
397
+ */var le;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(le||(le={}));const de={debug:le.DEBUG,verbose:le.VERBOSE,info:le.INFO,warn:le.WARN,error:le.ERROR,silent:le.SILENT},fe=le.INFO,pe={[le.DEBUG]:"log",[le.VERBOSE]:"log",[le.INFO]:"info",[le.WARN]:"warn",[le.ERROR]:"error"},ge=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),s=pe[e];if(!s)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[s](`[${r}] ${t.name}:`,...n)};var me=function(t,e){return me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},me(t,e)};function ye(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function ve(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,s,i=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)o.push(r.value)}catch(t){s={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(s)throw s.error}}return o}var we,_e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},Te=Te||{},Ee=_e||self;function Se(){}function Ie(t){var e=typeof t;return"array"==(e="object"!=e?e:t?Array.isArray(t)?"array":e:"null")||"object"==e&&"number"==typeof t.length}function be(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}var Ae="closure_uid_"+(1e9*Math.random()>>>0),Ce=0;function ke(t,e,n){return t.call.apply(t.bind,arguments)}function Ne(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function Re(t,e,n){return(Re=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ke:Ne).apply(null,arguments)}function Oe(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function De(t,e){function n(){}n.prototype=e.prototype,t.X=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Wb=function(t,n,r){for(var s=Array(arguments.length-2),i=2;i<arguments.length;i++)s[i-2]=arguments[i];return e.prototype[n].apply(t,s)}}function Le(){this.s=this.s,this.o=this.o}Le.prototype.s=!1,Le.prototype.na=function(){var t;!this.s&&(this.s=!0,this.M(),0)&&(t=this,Object.prototype.hasOwnProperty.call(t,Ae)&&t[Ae]||(t[Ae]=++Ce))},Le.prototype.M=function(){if(this.o)for(;this.o.length;)this.o.shift()()};var Pe=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if("string"==typeof t)return"string"!=typeof e||1!=e.length?-1:t.indexOf(e,0);for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1};function Me(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function xe(t,e){for(var n=1;n<arguments.length;n++){var r=arguments[n];if(Ie(r)){var s=t.length||0,i=r.length||0;t.length=s+i;for(var o=0;o<i;o++)t[s+o]=r[o]}else t.push(r)}}function Ue(t,e){this.type=t,this.g=this.target=e,this.defaultPrevented=!1}Ue.prototype.h=function(){this.defaultPrevented=!0};var Fe=function(){if(!Ee.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});try{Ee.addEventListener("test",Se,e),Ee.removeEventListener("test",Se,e)}catch(t){}return t}();function Ve(t){return/^[\s\xa0]*$/.test(t)}var Be=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]};function He(t,e){return t<e?-1:t>e?1:0}function je(){var t=Ee.navigator;return t&&(t=t.userAgent)?t:""}function $e(t){return-1!=je().indexOf(t)}function qe(t){return qe[" "](t),t}qe[" "]=Se;var Ke,We,ze=$e("Opera"),Ge=$e("Trident")||$e("MSIE"),Qe=$e("Edge"),Ye=Qe||Ge,Je=$e("Gecko")&&!(-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge"))&&!($e("Trident")||$e("MSIE"))&&!$e("Edge"),Xe=-1!=je().toLowerCase().indexOf("webkit")&&!$e("Edge");function Ze(){var t=Ee.document;return t?t.documentMode:void 0}t:{var tn="",en=(We=je(),Je?/rv:([^\);]+)(\)|;)/.exec(We):Qe?/Edge\/([\d\.]+)/.exec(We):Ge?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(We):Xe?/WebKit\/(\S+)/.exec(We):ze?/(?:Version)[ \/]?(\S+)/.exec(We):void 0);if(en&&(tn=en?en[1]:""),Ge){var nn=Ze();if(null!=nn&&nn>parseFloat(tn)){Ke=String(nn);break t}}Ke=tn}var rn,sn={};function on(){return function(t){var e=sn;return Object.prototype.hasOwnProperty.call(e,9)?e[9]:e[9]=t(9)}((function(){for(var t=0,e=Be(String(Ke)).split("."),n=Be("9").split("."),r=Math.max(e.length,n.length),s=0;0==t&&s<r;s++){var i=e[s]||"",o=n[s]||"";do{if(i=/(\d*)(\D*)(.*)/.exec(i)||["","","",""],o=/(\d*)(\D*)(.*)/.exec(o)||["","","",""],0==i[0].length&&0==o[0].length)break;t=He(0==i[1].length?0:parseInt(i[1],10),0==o[1].length?0:parseInt(o[1],10))||He(0==i[2].length,0==o[2].length)||He(i[2],o[2]),i=i[3],o=o[3]}while(0==t)}return 0<=t}))}if(Ee.document&&Ge){var an=Ze();rn=an||(parseInt(Ke,10)||void 0)}else rn=void 0;var cn=rn;function un(t,e){if(Ue.call(this,t?t.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,t){var n=this.type=t.type,r=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.g=e,e=t.relatedTarget){if(Je){t:{try{qe(e.nodeName);var s=!0;break t}catch(t){}s=!1}s||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0),this.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType="string"==typeof t.pointerType?t.pointerType:hn[t.pointerType]||"",this.state=t.state,this.i=t,t.defaultPrevented&&un.X.h.call(this)}}De(un,Ue);var hn={2:"touch",3:"pen",4:"mouse"};un.prototype.h=function(){un.X.h.call(this);var t=this.i;t.preventDefault?t.preventDefault():t.returnValue=!1};var ln="closure_listenable_"+(1e6*Math.random()|0),dn=0;function fn(t,e,n,r,s){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ha=s,this.key=++dn,this.ba=this.ea=!1}function pn(t){t.ba=!0,t.listener=null,t.proxy=null,t.src=null,t.ha=null}function gn(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function mn(t){var e={};for(var n in t)e[n]=t[n];return e}var yn="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function vn(t,e){for(var n,r,s=1;s<arguments.length;s++){for(n in r=arguments[s])t[n]=r[n];for(var i=0;i<yn.length;i++)n=yn[i],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function wn(t){this.src=t,this.g={},this.h=0}function _n(t,e){var n=e.type;if(n in t.g){var r,s=t.g[n],i=Pe(s,e);(r=0<=i)&&Array.prototype.splice.call(s,i,1),r&&(pn(e),0==t.g[n].length&&(delete t.g[n],t.h--))}}function Tn(t,e,n,r){for(var s=0;s<t.length;++s){var i=t[s];if(!i.ba&&i.listener==e&&i.capture==!!n&&i.ha==r)return s}return-1}wn.prototype.add=function(t,e,n,r,s){var i=t.toString();(t=this.g[i])||(t=this.g[i]=[],this.h++);var o=Tn(t,e,r,s);return-1<o?(e=t[o],n||(e.ea=!1)):((e=new fn(e,this.src,i,!!r,s)).ea=n,t.push(e)),e};var En="closure_lm_"+(1e6*Math.random()|0),Sn={};function In(t,e,n,r,s){if(r&&r.once)return An(t,e,n,r,s);if(Array.isArray(e)){for(var i=0;i<e.length;i++)In(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.N(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!1,r,s)}function bn(t,e,n,r,s,i){if(!e)throw Error("Invalid event type");var o=be(s)?!!s.capture:!!s,a=On(t);if(a||(t[En]=a=new wn(t)),(n=a.add(e,n,r,o,i)).proxy)return n;if(r=function(){function t(n){return e.call(t.src,t.listener,n)}var e=Rn;return t}(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)Fe||(s=o),void 0===s&&(s=!1),t.addEventListener(e.toString(),r,s);else if(t.attachEvent)t.attachEvent(Nn(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return n}function An(t,e,n,r,s){if(Array.isArray(e)){for(var i=0;i<e.length;i++)An(t,e[i],n,r,s);return null}return n=Ln(n),t&&t[ln]?t.O(e,n,be(r)?!!r.capture:!!r,s):bn(t,e,n,!0,r,s)}function Cn(t,e,n,r,s){if(Array.isArray(e))for(var i=0;i<e.length;i++)Cn(t,e[i],n,r,s);else r=be(r)?!!r.capture:!!r,n=Ln(n),t&&t[ln]?(t=t.i,(e=String(e).toString())in t.g&&(-1<(n=Tn(i=t.g[e],n,r,s))&&(pn(i[n]),Array.prototype.splice.call(i,n,1),0==i.length&&(delete t.g[e],t.h--)))):t&&(t=On(t))&&(e=t.g[e.toString()],t=-1,e&&(t=Tn(e,n,r,s)),(n=-1<t?e[t]:null)&&kn(n))}function kn(t){if("number"!=typeof t&&t&&!t.ba){var e=t.src;if(e&&e[ln])_n(e.i,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Nn(n),r):e.addListener&&e.removeListener&&e.removeListener(r),(n=On(e))?(_n(n,t),0==n.h&&(n.src=null,e[En]=null)):pn(t)}}}function Nn(t){return t in Sn?Sn[t]:Sn[t]="on"+t}function Rn(t,e){if(t.ba)t=!0;else{e=new un(e,this);var n=t.listener,r=t.ha||t.src;t.ea&&kn(t),t=n.call(r,e)}return t}function On(t){return(t=t[En])instanceof wn?t:null}var Dn="__closure_events_fn_"+(1e9*Math.random()>>>0);function Ln(t){return"function"==typeof t?t:(t[Dn]||(t[Dn]=function(e){return t.handleEvent(e)}),t[Dn])}function Pn(){Le.call(this),this.i=new wn(this),this.P=this,this.I=null}function Mn(t,e){var n,r=t.I;if(r)for(n=[];r;r=r.I)n.push(r);if(t=t.P,r=e.type||e,"string"==typeof e)e=new Ue(e,t);else if(e instanceof Ue)e.target=e.target||t;else{var s=e;vn(e=new Ue(r,t),s)}if(s=!0,n)for(var i=n.length-1;0<=i;i--){var o=e.g=n[i];s=xn(o,r,!0,e)&&s}if(s=xn(o=e.g=t,r,!0,e)&&s,s=xn(o,r,!1,e)&&s,n)for(i=0;i<n.length;i++)s=xn(o=e.g=n[i],r,!1,e)&&s}function xn(t,e,n,r){if(!(e=t.i.g[String(e)]))return!0;e=e.concat();for(var s=!0,i=0;i<e.length;++i){var o=e[i];if(o&&!o.ba&&o.capture==n){var a=o.listener,c=o.ha||o.src;o.ea&&_n(t.i,o),s=!1!==a.call(c,r)&&s}}return s&&!r.defaultPrevented}De(Pn,Le),Pn.prototype[ln]=!0,Pn.prototype.removeEventListener=function(t,e,n,r){Cn(this,t,e,n,r)},Pn.prototype.M=function(){if(Pn.X.M.call(this),this.i){var t,e=this.i;for(t in e.g){for(var n=e.g[t],r=0;r<n.length;r++)pn(n[r]);delete e.g[t],e.h--}}this.I=null},Pn.prototype.N=function(t,e,n,r){return this.i.add(String(t),e,!1,n,r)},Pn.prototype.O=function(t,e,n,r){return this.i.add(String(t),e,!0,n,r)};var Un=Ee.JSON.stringify;function Fn(){var t=Wn,e=null;return t.g&&(e=t.g,t.g=t.g.next,t.g||(t.h=null),e.next=null),e}var Vn,Bn=function(){function t(){this.h=this.g=null}return t.prototype.add=function(t,e){var n=Hn.get();n.set(t,e),this.h?this.h.next=n:this.g=n,this.h=n},t}(),Hn=new(function(){function t(t,e){this.i=t,this.j=e,this.h=0,this.g=null}return t.prototype.get=function(){var t;return 0<this.h?(this.h--,t=this.g,this.g=t.next,t.next=null):t=this.i(),t},t}())((function(){return new jn}),(function(t){return t.reset()})),jn=function(){function t(){this.next=this.g=this.h=null}return t.prototype.set=function(t,e){this.h=t,this.g=e,this.next=null},t.prototype.reset=function(){this.next=this.g=this.h=null},t}();function $n(t){Ee.setTimeout((function(){throw t}),0)}function qn(t,e){Vn||function(){var t=Ee.Promise.resolve(void 0);Vn=function(){t.then(zn)}}(),Kn||(Vn(),Kn=!0),Wn.add(t,e)}var Kn=!1,Wn=new Bn;function zn(){for(var t;t=Fn();){try{t.h.call(t.g)}catch(t){$n(t)}var e=Hn;e.j(t),100>e.h&&(e.h++,t.next=e.g,e.g=t)}Kn=!1}function Gn(t,e){Pn.call(this),this.h=t||1,this.g=e||Ee,this.j=Re(this.lb,this),this.l=Date.now()}function Qn(t){t.ca=!1,t.R&&(t.g.clearTimeout(t.R),t.R=null)}function Yn(t,e,n){if("function"==typeof t)n&&(t=Re(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=Re(t.handleEvent,t)}return 2147483647<Number(e)?-1:Ee.setTimeout(t,e||0)}function Jn(t){t.g=Yn((function(){t.g=null,t.i&&(t.i=!1,Jn(t))}),t.j);var e=t.h;t.h=null,t.m.apply(null,e)}De(Gn,Pn),(we=Gn.prototype).ca=!1,we.R=null,we.lb=function(){if(this.ca){var t=Date.now()-this.l;0<t&&t<.8*this.h?this.R=this.g.setTimeout(this.j,this.h-t):(this.R&&(this.g.clearTimeout(this.R),this.R=null),Mn(this,"tick"),this.ca&&(Qn(this),this.start()))}},we.start=function(){this.ca=!0,this.R||(this.R=this.g.setTimeout(this.j,this.h),this.l=Date.now())},we.M=function(){Gn.X.M.call(this),Qn(this),delete this.g};var Xn=function(t){function e(e,n){var r=t.call(this)||this;return r.m=e,r.j=n,r.h=null,r.i=!1,r.g=null,r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}me(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.l=function(t){this.h=arguments,this.g?this.i=!0:Jn(this)},e.prototype.M=function(){t.prototype.M.call(this),this.g&&(Ee.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)},e}(Le);function Zn(t){Le.call(this),this.h=t,this.g={}}De(Zn,Le);var tr=[];function er(t,e,n,r){Array.isArray(n)||(n&&(tr[0]=n.toString()),n=tr);for(var s=0;s<n.length;s++){var i=In(e,n[s],r||t.handleEvent,!1,t.h||t);if(!i)break;t.g[i.key]=i}}function nr(t){gn(t.g,(function(t,e){this.g.hasOwnProperty(e)&&kn(t)}),t),t.g={}}function rr(){this.g=!0}function sr(t,e,n,r){t.info((function(){return"XMLHTTP TEXT ("+e+"): "+function(t,e){if(!t.g)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(t=0;t<n.length;t++)if(Array.isArray(n[t])){var r=n[t];if(!(2>r.length)){var s=r[1];if(Array.isArray(s)&&!(1>s.length)){var i=s[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(var o=1;o<s.length;o++)s[o]=""}}}return Un(n)}catch(t){return e}}(t,n)+(r?" "+r:"")}))}Zn.prototype.M=function(){Zn.X.M.call(this),nr(this)},Zn.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},rr.prototype.Aa=function(){this.g=!1},rr.prototype.info=function(){};var ir={},or=null;function ar(){return or=or||new Pn}function cr(t){Ue.call(this,ir.Pa,t)}function ur(t){var e=ar();Mn(e,new cr(e))}function hr(t,e){Ue.call(this,ir.STAT_EVENT,t),this.stat=e}function lr(t){var e=ar();Mn(e,new hr(e,t))}function dr(t,e){Ue.call(this,ir.Qa,t),this.size=e}function fr(t,e){if("function"!=typeof t)throw Error("Fn must not be null and must be a function");return Ee.setTimeout((function(){t()}),e)}ir.Pa="serverreachability",De(cr,Ue),ir.STAT_EVENT="statevent",De(hr,Ue),ir.Qa="timingevent",De(dr,Ue);var pr={NO_ERROR:0,mb:1,zb:2,yb:3,tb:4,xb:5,Ab:6,Ma:7,TIMEOUT:8,Db:9},gr={rb:"complete",Nb:"success",Na:"error",Ma:"abort",Fb:"ready",Gb:"readystatechange",TIMEOUT:"timeout",Bb:"incrementaldata",Eb:"progress",ub:"downloadprogress",Vb:"uploadprogress"};function mr(){}function yr(t){return t.h||(t.h=t.i())}function vr(){}mr.prototype.h=null;var wr,_r={OPEN:"a",qb:"b",Na:"c",Cb:"d"};function Tr(){Ue.call(this,"d")}function Er(){Ue.call(this,"c")}function Sr(){}function Ir(t,e,n,r){this.l=t,this.j=e,this.m=n,this.U=r||1,this.S=new Zn(this),this.O=Ar,t=Ye?125:void 0,this.T=new Gn(t),this.H=null,this.i=!1,this.s=this.A=this.v=this.K=this.F=this.V=this.B=null,this.D=[],this.g=null,this.C=0,this.o=this.u=null,this.Y=-1,this.I=!1,this.N=0,this.L=null,this.$=this.J=this.Z=this.P=!1,this.h=new br}function br(){this.i=null,this.g="",this.h=!1}De(Tr,Ue),De(Er,Ue),De(Sr,mr),Sr.prototype.g=function(){return new XMLHttpRequest},Sr.prototype.i=function(){return{}},wr=new Sr;var Ar=45e3,Cr={},kr={};function Nr(t,e,n){t.K=1,t.v=Gr($r(e)),t.s=n,t.P=!0,Rr(t,null)}function Rr(t,e){t.F=Date.now(),Pr(t),t.A=$r(t.v);var n=t.A,r=t.U;Array.isArray(r)||(r=[String(r)]),as(n.i,"t",r),t.C=0,n=t.l.H,t.h=new br,t.g=ai(t.l,n?e:null,!t.s),0<t.N&&(t.L=new Xn(Re(t.La,t,t.g),t.N)),er(t.S,t.g,"readystatechange",t.ib),e=t.H?mn(t.H):{},t.s?(t.u||(t.u="POST"),e["Content-Type"]="application/x-www-form-urlencoded",t.g.da(t.A,t.u,t.s,e)):(t.u="GET",t.g.da(t.A,t.u,null,e)),ur(),function(t,e,n,r,s,i){t.info((function(){if(t.g)if(i)for(var o="",a=i.split("&"),c=0;c<a.length;c++){var u=a[c].split("=");if(1<u.length){var h=u[0];u=u[1];var l=h.split("_");o=2<=l.length&&"type"==l[1]?o+(h+"=")+u+"&":o+(h+"=redacted&")}}else o=null;else o=i;return"XMLHTTP REQ ("+r+") [attempt "+s+"]: "+e+"\n"+n+"\n"+o}))}(t.j,t.u,t.A,t.m,t.U,t.s)}function Or(t){return!!t.g&&("GET"==t.u&&2!=t.K&&t.l.Da)}function Dr(t,e,n){for(var r,s=!0;!t.I&&t.C<n.length;){if((r=Lr(t,n))==kr){4==e&&(t.o=4,lr(14),s=!1),sr(t.j,t.m,null,"[Incomplete Response]");break}if(r==Cr){t.o=4,lr(15),sr(t.j,t.m,n,"[Invalid Chunk]"),s=!1;break}sr(t.j,t.m,r,null),Vr(t,r)}Or(t)&&r!=kr&&r!=Cr&&(t.h.g="",t.C=0),4!=e||0!=n.length||t.h.h||(t.o=1,lr(16),s=!1),t.i=t.i&&s,s?0<n.length&&!t.$&&(t.$=!0,(e=t.l).g==t&&e.$&&!e.K&&(e.j.info("Great, no buffering proxy detected. Bytes received: "+n.length),Zs(e),e.K=!0,lr(11))):(sr(t.j,t.m,n,"[Invalid Chunked Response]"),Fr(t),Ur(t))}function Lr(t,e){var n=t.C,r=e.indexOf("\n",n);return-1==r?kr:(n=Number(e.substring(n,r)),isNaN(n)?Cr:(r+=1)+n>e.length?kr:(e=e.substr(r,n),t.C=r+n,e))}function Pr(t){t.V=Date.now()+t.O,Mr(t,t.O)}function Mr(t,e){if(null!=t.B)throw Error("WatchDog timer not null");t.B=fr(Re(t.gb,t),e)}function xr(t){t.B&&(Ee.clearTimeout(t.B),t.B=null)}function Ur(t){0==t.l.G||t.I||ni(t.l,t)}function Fr(t){xr(t);var e=t.L;e&&"function"==typeof e.na&&e.na(),t.L=null,Qn(t.T),nr(t.S),t.g&&(e=t.g,t.g=null,e.abort(),e.na())}function Vr(t,e){try{var n=t.l;if(0!=n.G&&(n.g==t||ps(n.h,t)))if(!t.J&&ps(n.h,t)&&3==n.G){try{var r=n.Fa.g.parse(e)}catch(i){r=null}if(Array.isArray(r)&&3==r.length){var s=r;if(0==s[0]){t:if(!n.u){if(n.g){if(!(n.g.F+3e3<t.F))break t;ei(n),Ks(n)}Xs(n),lr(18)}}else n.Ba=s[1],0<n.Ba-n.T&&37500>s[2]&&n.L&&0==n.A&&!n.v&&(n.v=fr(Re(n.cb,n),6e3));if(1>=fs(n.h)&&n.ja){try{n.ja()}catch(i){}n.ja=void 0}}else si(n,11)}else if((t.J||n.g==t)&&ei(n),!Ve(e))for(s=n.Fa.g.parse(e),e=0;e<s.length;e++){var i=s[e];if(n.T=i[0],i=i[1],2==n.G)if("c"==i[0]){n.I=i[1],n.ka=i[2];var o=i[3];null!=o&&(n.ma=o,n.j.info("VER="+n.ma));var a=i[4];null!=a&&(n.Ca=a,n.j.info("SVER="+n.Ca));var c=i[5];null!=c&&"number"==typeof c&&0<c&&(r=1.5*c,n.J=r,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;var u=t.g;if(u){var h=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(h){var l=r.h;l.g||-1==h.indexOf("spdy")&&-1==h.indexOf("quic")&&-1==h.indexOf("h2")||(l.j=l.l,l.g=new Set,l.h&&(gs(l,l.h),l.h=null))}if(r.D){var d=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;d&&(r.za=d,zr(r.F,r.D,d))}}n.G=3,n.l&&n.l.xa(),n.$&&(n.P=Date.now()-t.F,n.j.info("Handshake RTT: "+n.P+"ms"));var f=t;if((r=n).sa=oi(r,r.H?r.ka:null,r.V),f.J){ms(r.h,f);var p=f,g=r.J;g&&p.setTimeout(g),p.B&&(xr(p),Pr(p)),r.g=f}else Js(r);0<n.i.length&&zs(n)}else"stop"!=i[0]&&"close"!=i[0]||si(n,7);else 3==n.G&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?si(n,7):qs(n):"noop"!=i[0]&&n.l&&n.l.wa(i),n.A=0)}ur()}catch(i){}}function Br(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(Ie(t)||"string"==typeof t)Array.prototype.forEach.call(t,e,void 0);else for(var n=function(t){if(t.oa&&"function"==typeof t.oa)return t.oa();if(!t.W||"function"!=typeof t.W){if("undefined"!=typeof Map&&t instanceof Map)return Array.from(t.keys());if(!("undefined"!=typeof Set&&t instanceof Set)){if(Ie(t)||"string"==typeof t){var e=[];t=t.length;for(var n=0;n<t;n++)e.push(n);return e}for(var r in e=[],n=0,t)e[n++]=r;return e}}}(t),r=function(t){if(t.W&&"function"==typeof t.W)return t.W();if("undefined"!=typeof Map&&t instanceof Map||"undefined"!=typeof Set&&t instanceof Set)return Array.from(t.values());if("string"==typeof t)return t.split("");if(Ie(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}for(r in e=[],n=0,t)e[n++]=t[r];return e}(t),s=r.length,i=0;i<s;i++)e.call(void 0,r[i],n&&n[i],t)}(we=Ir.prototype).setTimeout=function(t){this.O=t},we.ib=function(t){t=t.target;var e=this.L;e&&3==Fs(t)?e.l():this.La(t)},we.La=function(t){try{if(t==this.g)t:{var e=Fs(this.g),n=this.g.Ea();this.g.aa();if(!(3>e)&&(3!=e||Ye||this.g&&(this.h.h||this.g.fa()||Vs(this.g)))){this.I||4!=e||7==n||ur(),xr(this);var r=this.g.aa();this.Y=r;e:if(Or(this)){var s=Vs(this.g);t="";var i=s.length,o=4==Fs(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){Fr(this),Ur(this);var a="";break e}this.h.i=new Ee.TextDecoder}for(n=0;n<i;n++)this.h.h=!0,t+=this.h.i.decode(s[n],{stream:o&&n==i-1});s.splice(0,i),this.h.g+=t,this.C=0,a=this.h.g}else a=this.g.fa();if(this.i=200==r,function(t,e,n,r,s,i,o){t.info((function(){return"XMLHTTP RESP ("+r+") [ attempt "+s+"]: "+e+"\n"+n+"\n"+i+" "+o}))}(this.j,this.u,this.A,this.m,this.U,e,r),this.i){if(this.Z&&!this.J){e:{if(this.g){var c,u=this.g;if((c=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!Ve(c)){var h=c;break e}}h=null}if(!(r=h)){this.i=!1,this.o=3,lr(12),Fr(this),Ur(this);break t}sr(this.j,this.m,r,"Initial handshake response via X-HTTP-Initial-Response"),this.J=!0,Vr(this,r)}this.P?(Dr(this,e,a),Ye&&this.i&&3==e&&(er(this.S,this.T,"tick",this.hb),this.T.start())):(sr(this.j,this.m,a,null),Vr(this,a)),4==e&&Fr(this),this.i&&!this.I&&(4==e?ni(this.l,this):(this.i=!1,Pr(this)))}else 400==r&&0<a.indexOf("Unknown SID")?(this.o=3,lr(12)):(this.o=0,lr(13)),Fr(this),Ur(this)}}}catch(e){}},we.hb=function(){if(this.g){var t=Fs(this.g),e=this.g.fa();this.C<e.length&&(xr(this),Dr(this,t,e),this.i&&4!=t&&Pr(this))}},we.cancel=function(){this.I=!0,Fr(this)},we.gb=function(){this.B=null;var t=Date.now();0<=t-this.V?(function(t,e){t.info((function(){return"TIMEOUT: "+e}))}(this.j,this.A),2!=this.K&&(ur(),lr(17)),Fr(this),this.o=2,Ur(this)):Mr(this,this.V-t)};var Hr=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function jr(t,e){if(this.g=this.s=this.j="",this.m=null,this.o=this.l="",this.h=!1,t instanceof jr){this.h=void 0!==e?e:t.h,qr(this,t.j),this.s=t.s,this.g=t.g,Kr(this,t.m),this.l=t.l,e=t.i;var n=new rs;n.i=e.i,e.g&&(n.g=new Map(e.g),n.h=e.h),Wr(this,n),this.o=t.o}else t&&(n=String(t).match(Hr))?(this.h=!!e,qr(this,n[1]||"",!0),this.s=Qr(n[2]||""),this.g=Qr(n[3]||"",!0),Kr(this,n[4]),this.l=Qr(n[5]||"",!0),Wr(this,n[6]||"",!0),this.o=Qr(n[7]||"")):(this.h=!!e,this.i=new rs(null,this.h))}function $r(t){return new jr(t)}function qr(t,e,n){t.j=n?Qr(e,!0):e,t.j&&(t.j=t.j.replace(/:$/,""))}function Kr(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.m=e}else t.m=null}function Wr(t,e,n){e instanceof rs?(t.i=e,function(t,e){e&&!t.j&&(ss(t),t.i=null,t.g.forEach((function(t,e){var n=e.toLowerCase();e!=n&&(is(this,e),as(this,n,t))}),t)),t.j=e}(t.i,t.h)):(n||(e=Yr(e,es)),t.i=new rs(e,t.h))}function zr(t,e,n){t.i.set(e,n)}function Gr(t){return zr(t,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),t}function Qr(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Yr(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Jr),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Jr(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}jr.prototype.toString=function(){var t=[],e=this.j;e&&t.push(Yr(e,Xr,!0),":");var n=this.g;return(n||"file"==e)&&(t.push("//"),(e=this.s)&&t.push(Yr(e,Xr,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.m)&&t.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&t.push("/"),t.push(Yr(n,"/"==n.charAt(0)?ts:Zr,!0))),(n=this.i.toString())&&t.push("?",n),(n=this.o)&&t.push("#",Yr(n,ns)),t.join("")};var Xr=/[#\/\?@]/g,Zr=/[#\?:]/g,ts=/[#\?]/g,es=/[#\?@]/g,ns=/#/g;function rs(t,e){this.h=this.g=null,this.i=t||null,this.j=!!e}function ss(t){t.g||(t.g=new Map,t.h=0,t.i&&function(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),s=null;if(0<=r){var i=t[n].substring(0,r);s=t[n].substring(r+1)}else i=t[n];e(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(t.i,(function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)})))}function is(t,e){ss(t),e=cs(t,e),t.g.has(e)&&(t.i=null,t.h-=t.g.get(e).length,t.g.delete(e))}function os(t,e){return ss(t),e=cs(t,e),t.g.has(e)}function as(t,e,n){is(t,e),0<n.length&&(t.i=null,t.g.set(cs(t,e),Me(n)),t.h+=n.length)}function cs(t,e){return e=String(e),t.j&&(e=e.toLowerCase()),e}(we=rs.prototype).add=function(t,e){ss(this),this.i=null,t=cs(this,t);var n=this.g.get(t);return n||this.g.set(t,n=[]),n.push(e),this.h+=1,this},we.forEach=function(t,e){ss(this),this.g.forEach((function(n,r){n.forEach((function(n){t.call(e,n,r,this)}),this)}),this)},we.oa=function(){ss(this);for(var t=Array.from(this.g.values()),e=Array.from(this.g.keys()),n=[],r=0;r<e.length;r++)for(var s=t[r],i=0;i<s.length;i++)n.push(e[r]);return n},we.W=function(t){ss(this);var e=[];if("string"==typeof t)os(this,t)&&(e=e.concat(this.g.get(cs(this,t))));else{t=Array.from(this.g.values());for(var n=0;n<t.length;n++)e=e.concat(t[n])}return e},we.set=function(t,e){return ss(this),this.i=null,os(this,t=cs(this,t))&&(this.h-=this.g.get(t).length),this.g.set(t,[e]),this.h+=1,this},we.get=function(t,e){return t&&0<(t=this.W(t)).length?String(t[0]):e},we.toString=function(){if(this.i)return this.i;if(!this.g)return"";for(var t=[],e=Array.from(this.g.keys()),n=0;n<e.length;n++){var r=e[n],s=encodeURIComponent(String(r)),i=this.W(r);for(r=0;r<i.length;r++){var o=s;""!==i[r]&&(o+="="+encodeURIComponent(String(i[r]))),t.push(o)}}return this.i=t.join("&")};var us=function(t,e){this.h=t,this.g=e};function hs(t){this.l=t||ls,Ee.PerformanceNavigationTiming?t=0<(t=Ee.performance.getEntriesByType("navigation")).length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol):t=!!(Ee.g&&Ee.g.Ga&&Ee.g.Ga()&&Ee.g.Ga().$b),this.j=t?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}var ls=10;function ds(t){return!!t.h||!!t.g&&t.g.size>=t.j}function fs(t){return t.h?1:t.g?t.g.size:0}function ps(t,e){return t.h?t.h==e:!!t.g&&t.g.has(e)}function gs(t,e){t.g?t.g.add(e):t.h=e}function ms(t,e){t.h&&t.h==e?t.h=null:t.g&&t.g.has(e)&&t.g.delete(e)}function ys(t){var e,n;if(null!=t.h)return t.i.concat(t.h.D);if(null!=t.g&&0!==t.g.size){var r=t.i;try{for(var s=ye(t.g.values()),i=s.next();!i.done;i=s.next()){var o=i.value;r=r.concat(o.D)}}catch(t){e={error:t}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(e)throw e.error}}return r}return Me(t.i)}function vs(){}function ws(){this.g=new vs}function _s(t,e,n){var r=n||"";try{Br(t,(function(t,n){var s=t;be(t)&&(s=Un(t)),e.push(r+n+"="+encodeURIComponent(s))}))}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function Ts(t,e,n,r,s){try{e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,s(r)}catch(t){}}function Es(t){this.l=t.ac||null,this.j=t.jb||!1}function Ss(t,e){Pn.call(this),this.D=t,this.u=e,this.m=void 0,this.readyState=Is,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.v=new Headers,this.h=null,this.C="GET",this.B="",this.g=!1,this.A=this.j=this.l=null}hs.prototype.cancel=function(){var t,e;if(this.i=ys(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){try{for(var n=ye(this.g.values()),r=n.next();!r.done;r=n.next()){r.value.cancel()}}catch(e){t={error:e}}finally{try{r&&!r.done&&(e=n.return)&&e.call(n)}finally{if(t)throw t.error}}this.g.clear()}},vs.prototype.stringify=function(t){return Ee.JSON.stringify(t,void 0)},vs.prototype.parse=function(t){return Ee.JSON.parse(t,void 0)},De(Es,mr),Es.prototype.g=function(){return new Ss(this.l,this.j)},Es.prototype.i=function(t){return function(){return t}}({}),De(Ss,Pn);var Is=0;function bs(t){t.j.read().then(t.Ta.bind(t)).catch(t.ga.bind(t))}function As(t){t.readyState=4,t.l=null,t.j=null,t.A=null,Cs(t)}function Cs(t){t.onreadystatechange&&t.onreadystatechange.call(t)}(we=Ss.prototype).open=function(t,e){if(this.readyState!=Is)throw this.abort(),Error("Error reopening a connection");this.C=t,this.B=e,this.readyState=1,Cs(this)},we.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;var e={headers:this.v,method:this.C,credentials:this.m,cache:void 0};t&&(e.body=t),(this.D||Ee).fetch(new Request(this.B,e)).then(this.Wa.bind(this),this.ga.bind(this))},we.abort=function(){this.response=this.responseText="",this.v=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch((function(){})),1<=this.readyState&&this.g&&4!=this.readyState&&(this.g=!1,As(this)),this.readyState=Is},we.Wa=function(t){if(this.g&&(this.l=t,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=t.headers,this.readyState=2,Cs(this)),this.g&&(this.readyState=3,Cs(this),this.g)))if("arraybuffer"===this.responseType)t.arrayBuffer().then(this.Ua.bind(this),this.ga.bind(this));else if(void 0!==Ee.ReadableStream&&"body"in t){if(this.j=t.body.getReader(),this.u){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.A=new TextDecoder;bs(this)}else t.text().then(this.Va.bind(this),this.ga.bind(this))},we.Ta=function(t){if(this.g){if(this.u&&t.value)this.response.push(t.value);else if(!this.u){var e=t.value?t.value:new Uint8Array(0);(e=this.A.decode(e,{stream:!t.done}))&&(this.response=this.responseText+=e)}t.done?As(this):Cs(this),3==this.readyState&&bs(this)}},we.Va=function(t){this.g&&(this.response=this.responseText=t,As(this))},we.Ua=function(t){this.g&&(this.response=t,As(this))},we.ga=function(){this.g&&As(this)},we.setRequestHeader=function(t,e){this.v.append(t,e)},we.getResponseHeader=function(t){return this.h&&this.h.get(t.toLowerCase())||""},we.getAllResponseHeaders=function(){if(!this.h)return"";for(var t=[],e=this.h.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},Object.defineProperty(Ss.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(t){this.m=t?"include":"same-origin"}});var ks=Ee.JSON.parse;function Ns(t){Pn.call(this),this.headers=new Map,this.u=t||null,this.h=!1,this.C=this.g=null,this.H="",this.m=0,this.j="",this.l=this.F=this.v=this.D=!1,this.B=0,this.A=null,this.J=Rs,this.K=this.L=!1}De(Ns,Pn);var Rs="",Os=/^https?$/i,Ds=["POST","PUT"];function Ls(t,e){t.h=!1,t.g&&(t.l=!0,t.g.abort(),t.l=!1),t.j=e,t.m=5,Ps(t),xs(t)}function Ps(t){t.D||(t.D=!0,Mn(t,"complete"),Mn(t,"error"))}function Ms(t){if(t.h&&void 0!==Te&&(!t.C[1]||4!=Fs(t)||2!=t.aa()))if(t.v&&4==Fs(t))Yn(t.Ha,0,t);else if(Mn(t,"readystatechange"),4==Fs(t)){t.h=!1;try{var e,n=t.aa();t:switch(n){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var r=!0;break t;default:r=!1}if(!(e=r)){var s;if(s=0===n){var i=String(t.H).match(Hr)[1]||null;if(!i&&Ee.self&&Ee.self.location){var o=Ee.self.location.protocol;i=o.substr(0,o.length-1)}s=!Os.test(i?i.toLowerCase():"")}e=s}if(e)Mn(t,"complete"),Mn(t,"success");else{t.m=6;try{var a=2<Fs(t)?t.g.statusText:""}catch(t){a=""}t.j=a+" ["+t.aa()+"]",Ps(t)}}finally{xs(t)}}}function xs(t,e){if(t.g){Us(t);var n=t.g,r=t.C[0]?Se:null;t.g=null,t.C=null,e||Mn(t,"ready");try{n.onreadystatechange=r}catch(t){}}}function Us(t){t.g&&t.K&&(t.g.ontimeout=null),t.A&&(Ee.clearTimeout(t.A),t.A=null)}function Fs(t){return t.g?t.g.readyState:0}function Vs(t){try{if(!t.g)return null;if("response"in t.g)return t.g.response;switch(t.J){case Rs:case"text":return t.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in t.g)return t.g.mozResponseArrayBuffer}return null}catch(t){return null}}function Bs(t){var e="";return gn(t,(function(t,n){e+=n,e+=":",e+=t,e+="\r\n"})),e}function Hs(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}r||(n=Bs(n),"string"==typeof t?null!=n&&encodeURIComponent(String(n)):zr(t,e,n))}function js(t,e,n){return n&&n.internalChannelParams&&n.internalChannelParams[t]||e}function $s(t){this.Ca=0,this.i=[],this.j=new rr,this.ka=this.sa=this.F=this.V=this.g=this.za=this.D=this.ia=this.o=this.S=this.s=null,this.ab=this.U=0,this.Za=js("failFast",!1,t),this.L=this.v=this.u=this.m=this.l=null,this.Y=!0,this.pa=this.Ba=this.T=-1,this.Z=this.A=this.C=0,this.Xa=js("baseRetryDelayMs",5e3,t),this.bb=js("retryDelaySeedMs",1e4,t),this.$a=js("forwardChannelMaxRetries",2,t),this.ta=js("forwardChannelRequestTimeoutMs",2e4,t),this.ra=t&&t.xmlHttpFactory||void 0,this.Da=t&&t.Zb||!1,this.J=void 0,this.H=t&&t.supportsCrossDomainXhr||!1,this.I="",this.h=new hs(t&&t.concurrentRequestLimit),this.Fa=new ws,this.O=t&&t.fastHandshake||!1,this.N=t&&t.encodeInitMessageHeaders||!1,this.O&&this.N&&(this.N=!1),this.Ya=t&&t.Xb||!1,t&&t.Aa&&this.j.Aa(),t&&t.forceLongPolling&&(this.Y=!1),this.$=!this.O&&this.Y&&t&&t.detectBufferingProxy||!1,this.ja=void 0,this.P=0,this.K=!1,this.la=this.B=null}function qs(t){if(Ws(t),3==t.G){var e=t.U++,n=$r(t.F);zr(n,"SID",t.I),zr(n,"RID",e),zr(n,"TYPE","terminate"),Qs(t,n),(e=new Ir(t,t.j,e,void 0)).K=2,e.v=Gr($r(n)),n=!1,Ee.navigator&&Ee.navigator.sendBeacon&&(n=Ee.navigator.sendBeacon(e.v.toString(),"")),!n&&Ee.Image&&((new Image).src=e.v,n=!0),n||(e.g=ai(e.l,null),e.g.da(e.v)),e.F=Date.now(),Pr(e)}ii(t)}function Ks(t){t.g&&(Zs(t),t.g.cancel(),t.g=null)}function Ws(t){Ks(t),t.u&&(Ee.clearTimeout(t.u),t.u=null),ei(t),t.h.cancel(),t.m&&("number"==typeof t.m&&Ee.clearTimeout(t.m),t.m=null)}function zs(t){ds(t.h)||t.m||(t.m=!0,qn(t.Ja,t),t.C=0)}function Gs(t,e){var n;n=e?e.m:t.U++;var r=$r(t.F);zr(r,"SID",t.I),zr(r,"RID",n),zr(r,"AID",t.T),Qs(t,r),t.o&&t.s&&Hs(r,t.o,t.s),n=new Ir(t,t.j,n,t.C+1),null===t.o&&(n.H=t.s),e&&(t.i=e.D.concat(t.i)),e=Ys(t,n,1e3),n.setTimeout(Math.round(.5*t.ta)+Math.round(.5*t.ta*Math.random())),gs(t.h,n),Nr(n,r,e)}function Qs(t,e){t.ia&&gn(t.ia,(function(t,n){zr(e,n,t)})),t.l&&Br({},(function(t,n){zr(e,n,t)}))}function Ys(t,e,n){n=Math.min(t.i.length,n);var r=t.l?Re(t.l.Ra,t.l,t):null;t:for(var s=t.i,i=-1;;){var o=["count="+n];-1==i?0<n?(i=s[0].h,o.push("ofs="+i)):i=0:o.push("ofs="+i);for(var a=!0,c=0;c<n;c++){var u=s[c].h,h=s[c].g;if(0>(u-=i))i=Math.max(0,s[c].h-100),a=!1;else try{_s(h,o,"req"+u+"_")}catch(t){r&&r(h)}}if(a){r=o.join("&");break t}}return t=t.i.splice(0,n),e.D=t,r}function Js(t){t.g||t.u||(t.Z=1,qn(t.Ia,t),t.A=0)}function Xs(t){return!(t.g||t.u||3<=t.A)&&(t.Z++,t.u=fr(Re(t.Ia,t),ri(t,t.A)),t.A++,!0)}function Zs(t){null!=t.B&&(Ee.clearTimeout(t.B),t.B=null)}function ti(t){t.g=new Ir(t,t.j,"rpc",t.Z),null===t.o&&(t.g.H=t.s),t.g.N=0;var e=$r(t.sa);zr(e,"RID","rpc"),zr(e,"SID",t.I),zr(e,"CI",t.L?"0":"1"),zr(e,"AID",t.T),zr(e,"TYPE","xmlhttp"),Qs(t,e),t.o&&t.s&&Hs(e,t.o,t.s),t.J&&t.g.setTimeout(t.J);var n=t.g;t=t.ka,n.K=1,n.v=Gr($r(e)),n.s=null,n.P=!0,Rr(n,t)}function ei(t){null!=t.v&&(Ee.clearTimeout(t.v),t.v=null)}function ni(t,e){var n=null;if(t.g==e){ei(t),Zs(t),t.g=null;var r=2}else{if(!ps(t.h,e))return;n=e.D,ms(t.h,e),r=1}if(0!=t.G)if(t.pa=e.Y,e.i)if(1==r){n=e.s?e.s.length:0,e=Date.now()-e.F;var s=t.C;Mn(r=ar(),new dr(r,n)),zs(t)}else Js(t);else if(3==(s=e.o)||0==s&&0<t.pa||!(1==r&&function(t,e){return!(fs(t.h)>=t.h.j-(t.m?1:0)||(t.m?(t.i=e.D.concat(t.i),0):1==t.G||2==t.G||t.C>=(t.Za?0:t.$a)||(t.m=fr(Re(t.Ja,t,e),ri(t,t.C)),t.C++,0)))}(t,e)||2==r&&Xs(t)))switch(n&&0<n.length&&(e=t.h,e.i=e.i.concat(n)),s){case 1:si(t,5);break;case 4:si(t,10);break;case 3:si(t,6);break;default:si(t,2)}}function ri(t,e){var n=t.Xa+Math.floor(Math.random()*t.bb);return t.l||(n*=2),n*e}function si(t,e){if(t.j.info("Error code "+e),2==e){var n=null;t.l&&(n=null);var r=Re(t.kb,t);n||(n=new jr("//www.google.com/images/cleardot.gif"),Ee.location&&"http"==Ee.location.protocol||qr(n,"https"),Gr(n)),function(t,e){var n=new rr;if(Ee.Image){var r=new Image;r.onload=Oe(Ts,n,r,"TestLoadImage: loaded",!0,e),r.onerror=Oe(Ts,n,r,"TestLoadImage: error",!1,e),r.onabort=Oe(Ts,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=Oe(Ts,n,r,"TestLoadImage: timeout",!1,e),Ee.setTimeout((function(){r.ontimeout&&r.ontimeout()}),1e4),r.src=t}else e(!1)}(n.toString(),r)}else lr(2);t.G=0,t.l&&t.l.va(e),ii(t),Ws(t)}function ii(t){if(t.G=0,t.la=[],t.l){var e=ys(t.h);0==e.length&&0==t.i.length||(xe(t.la,e),xe(t.la,t.i),t.h.i.length=0,Me(t.i),t.i.length=0),t.l.ua()}}function oi(t,e,n){var r=n instanceof jr?$r(n):new jr(n,void 0);if(""!=r.g)e&&(r.g=e+"."+r.g),Kr(r,r.m);else{var s=Ee.location;r=s.protocol,e=e?e+"."+s.hostname:s.hostname,s=+s.port;var i=new jr(null,void 0);r&&qr(i,r),e&&(i.g=e),s&&Kr(i,s),n&&(i.l=n),r=i}return n=t.D,e=t.za,n&&e&&zr(r,n,e),zr(r,"VER",t.ma),Qs(t,r),r}function ai(t,e,n){if(e&&!t.H)throw Error("Can't create secondary domain capable XhrIo object.");return(e=n&&t.Da&&!t.ra?new Ns(new Es({jb:!0})):new Ns(t.ra)).Ka(t.H),e}function ci(){}function ui(){if(Ge&&!(10<=Number(cn)))throw Error("Environmental error: no available transport.")}function hi(t,e){Pn.call(this),this.g=new $s(e),this.l=t,this.h=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.g.s=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.ya&&(t?t["X-WebChannel-Client-Profile"]=e.ya:t={"X-WebChannel-Client-Profile":e.ya}),this.g.S=t,(t=e&&e.Yb)&&!Ve(t)&&(this.g.o=t),this.A=e&&e.supportsCrossDomainXhr||!1,this.v=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!Ve(e)&&(this.g.D=e,null!==(t=this.h)&&e in t&&(e in(t=this.h)&&delete t[e])),this.j=new fi(this)}function li(t){Tr.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.i=t)&&(t=this.i,e=null!==e&&t in e?e[t]:void 0),this.data=e}else this.data=t}function di(){Er.call(this),this.status=1}function fi(t){this.g=t}(we=Ns.prototype).Ka=function(t){this.L=t},we.da=function(t,e,n,r){var s,i,o,a;if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+t);e=e?e.toUpperCase():"GET",this.H=t,this.j="",this.m=0,this.D=!1,this.h=!0,this.g=this.u?this.u.g():wr.g(),this.C=this.u?yr(this.u):yr(wr),this.g.onreadystatechange=Re(this.Ha,this);try{this.F=!0,this.g.open(e,String(t),!0),this.F=!1}catch(l){return void Ls(this,l)}if(t=n||"",n=new Map(this.headers),r)if(Object.getPrototypeOf(r)===Object.prototype)for(var c in r)n.set(c,r[c]);else{if("function"!=typeof r.keys||"function"!=typeof r.get)throw Error("Unknown input type for opt_headers: "+String(r));try{for(var u=ye(r.keys()),h=u.next();!h.done;h=u.next()){var l=h.value;n.set(l,r.get(l))}}catch(t){s={error:t}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(s)throw s.error}}}r=Array.from(n.keys()).find((function(t){return"content-type"==t.toLowerCase()})),c=Ee.FormData&&t instanceof Ee.FormData,!(0<=Pe(Ds,e))||r||c||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");try{for(var d=ye(n),f=d.next();!f.done;f=d.next()){var p=ve(f.value,2),g=(l=p[0],p[1]);this.g.setRequestHeader(l,g)}}catch(t){o={error:t}}finally{try{f&&!f.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}this.J&&(this.g.responseType=this.J),"withCredentials"in this.g&&this.g.withCredentials!==this.L&&(this.g.withCredentials=this.L);try{Us(this),0<this.B&&((this.K=function(t){return Ge&&on()&&"number"==typeof t.timeout&&void 0!==t.ontimeout}(this.g))?(this.g.timeout=this.B,this.g.ontimeout=Re(this.qa,this)):this.A=Yn(this.qa,this.B,this)),this.v=!0,this.g.send(t),this.v=!1}catch(l){Ls(this,l)}},we.qa=function(){void 0!==Te&&this.g&&(this.j="Timed out after "+this.B+"ms, aborting",this.m=8,Mn(this,"timeout"),this.abort(8))},we.abort=function(t){this.g&&this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=t||7,Mn(this,"complete"),Mn(this,"abort"),xs(this))},we.M=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),xs(this,!0)),Ns.X.M.call(this)},we.Ha=function(){this.s||(this.F||this.v||this.l?Ms(this):this.fb())},we.fb=function(){Ms(this)},we.aa=function(){try{return 2<Fs(this)?this.g.status:-1}catch(t){return-1}},we.fa=function(){try{return this.g?this.g.responseText:""}catch(t){return""}},we.Sa=function(t){if(this.g){var e=this.g.responseText;return t&&0==e.indexOf(t)&&(e=e.substring(t.length)),ks(e)}},we.Ea=function(){return this.m},we.Oa=function(){return"string"==typeof this.j?this.j:String(this.j)},(we=$s.prototype).ma=8,we.G=1,we.Ja=function(t){if(this.m)if(this.m=null,1==this.G){if(!t){this.U=Math.floor(1e5*Math.random()),t=this.U++;var e=new Ir(this,this.j,t,void 0),n=this.s;if(this.S&&(n?vn(n=mn(n),this.S):n=this.S),null!==this.o||this.N||(e.H=n,n=null),this.O)t:{for(var r=0,s=0;s<this.i.length;s++){var i=this.i[s];if(void 0===(i="__data__"in i.g&&"string"==typeof(i=i.g.__data__)?i.length:void 0))break;if(4096<(r+=i)){r=s;break t}if(4096===r||s===this.i.length-1){r=s+1;break t}}r=1e3}else r=1e3;r=Ys(this,e,r),zr(s=$r(this.F),"RID",t),zr(s,"CVER",22),this.D&&zr(s,"X-HTTP-Session-Id",this.D),Qs(this,s),n&&(this.N?r="headers="+encodeURIComponent(String(Bs(n)))+"&"+r:this.o&&Hs(s,this.o,n)),gs(this.h,e),this.Ya&&zr(s,"TYPE","init"),this.O?(zr(s,"$req",r),zr(s,"SID","null"),e.Z=!0,Nr(e,s,null)):Nr(e,s,r),this.G=2}}else 3==this.G&&(t?Gs(this,t):0==this.i.length||ds(this.h)||Gs(this))},we.Ia=function(){if(this.u=null,ti(this),this.$&&!(this.K||null==this.g||0>=this.P)){var t=2*this.P;this.j.info("BP detection timer enabled: "+t),this.B=fr(Re(this.eb,this),t)}},we.eb=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.L=!1,this.K=!0,lr(10),Ks(this),ti(this))},we.cb=function(){null!=this.v&&(this.v=null,Ks(this),Xs(this),lr(19))},we.kb=function(t){t?(this.j.info("Successfully pinged google.com"),lr(2)):(this.j.info("Failed to ping google.com"),lr(1))},(we=ci.prototype).xa=function(){},we.wa=function(){},we.va=function(){},we.ua=function(){},we.Ra=function(){},ui.prototype.g=function(t,e){return new hi(t,e)},De(hi,Pn),hi.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.H=!0);var t=this.g,e=this.l,n=this.h||void 0;lr(0),t.V=e,t.ia=n||{},t.L=t.Y,t.F=oi(t,null,t.V),zs(t)},hi.prototype.close=function(){qs(this.g)},hi.prototype.u=function(t){var e=this.g;if("string"==typeof t){var n={};n.__data__=t,t=n}else this.v&&((n={}).__data__=Un(t),t=n);e.i.push(new us(e.ab++,t)),3==e.G&&zs(e)},hi.prototype.M=function(){this.g.l=null,delete this.j,qs(this.g),delete this.g,hi.X.M.call(this)},De(li,Tr),De(di,Er),De(fi,ci),fi.prototype.xa=function(){Mn(this.g,"a")},fi.prototype.wa=function(t){Mn(this.g,new li(t))},fi.prototype.va=function(t){Mn(this.g,new di)},fi.prototype.ua=function(){Mn(this.g,"b")},ui.prototype.createWebChannel=ui.prototype.g,hi.prototype.send=hi.prototype.u,hi.prototype.open=hi.prototype.m,hi.prototype.close=hi.prototype.close,pr.NO_ERROR=0,pr.TIMEOUT=8,pr.HTTP_ERROR=6,gr.COMPLETE="complete",vr.EventType=_r,_r.OPEN="a",_r.CLOSE="b",_r.ERROR="c",_r.MESSAGE="d",Pn.prototype.listen=Pn.prototype.N,Ns.prototype.listenOnce=Ns.prototype.O,Ns.prototype.getLastError=Ns.prototype.Oa,Ns.prototype.getLastErrorCode=Ns.prototype.Ea,Ns.prototype.getStatus=Ns.prototype.aa,Ns.prototype.getResponseJson=Ns.prototype.Sa,Ns.prototype.getResponseText=Ns.prototype.fa,Ns.prototype.send=Ns.prototype.da,Ns.prototype.setWithCredentials=Ns.prototype.Ka;var pi=pr,gi=gr,mi=ir,yi=10,vi=11,wi=Es,_i=vr,Ti=Ns;const Ei="@firebase/firestore";
398
398
  /**
399
399
  * @license
400
400
  * Copyright 2017 Google LLC
@@ -555,7 +555,7 @@ let Ii="9.15.0";
555
555
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
556
556
  * See the License for the specific language governing permissions and
557
557
  * limitations under the License.
558
- */class Wi{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=Ki(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%62))}return n}}function Gi(t,e){return t<e?-1:t>e?1:0}function zi(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
558
+ */class Wi{static R(){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=62*Math.floor(256/62);let n="";for(;n.length<20;){const r=Ki(40);for(let s=0;s<r.length;++s)n.length<20&&r[s]<e&&(n+=t.charAt(r[s]%62))}return n}}function zi(t,e){return t<e?-1:t>e?1:0}function Gi(t,e,n){return t.length===e.length&&t.every(((t,r)=>n(t,e[r])))}
559
559
  /**
560
560
  * @license
561
561
  * Copyright 2017 Google LLC
@@ -571,7 +571,7 @@ let Ii="9.15.0";
571
571
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
572
572
  * See the License for the specific language governing permissions and
573
573
  * limitations under the License.
574
- */class Qi{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Qi.fromMillis(Date.now())}static fromDate(t){return Qi.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Qi(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?Gi(this.nanoseconds,t.nanoseconds):Gi(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
574
+ */class Qi{constructor(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new Mi(Pi.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}static now(){return Qi.fromMillis(Date.now())}static fromDate(t){return Qi.fromMillis(t.getTime())}static fromMillis(t){const e=Math.floor(t/1e3),n=Math.floor(1e6*(t-1e3*e));return new Qi(e,n)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(t){return this.seconds===t.seconds?zi(this.nanoseconds,t.nanoseconds):zi(this.seconds,t.seconds)}isEqual(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const t=this.seconds- -62135596800;return String(t).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}
575
575
  /**
576
576
  * @license
577
577
  * Copyright 2017 Google LLC
@@ -619,7 +619,7 @@ let Ii="9.15.0";
619
619
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
620
620
  * See the License for the specific language governing permissions and
621
621
  * limitations under the License.
622
- */class eo{constructor(t){this.path=t}static fromPath(t){return new eo(Xi.fromString(t))}static fromName(t){return new eo(Xi.fromString(t).popFirst(5))}static empty(){return new eo(Xi.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Xi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Xi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new eo(new Xi(t.slice()))}}function no(t){return new ro(t.readTime,t.key,-1)}class ro{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ro(Yi.min(),eo.empty(),-1)}static max(){return new ro(Yi.max(),eo.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=eo.comparator(t.documentKey,e.documentKey),0!==n?n:Gi(t.largestBatchId,e.largestBatchId)
622
+ */class eo{constructor(t){this.path=t}static fromPath(t){return new eo(Xi.fromString(t))}static fromName(t){return new eo(Xi.fromString(t).popFirst(5))}static empty(){return new eo(Xi.emptyPath())}get collectionGroup(){return this.path.popLast().lastSegment()}hasCollectionId(t){return this.path.length>=2&&this.path.get(this.path.length-2)===t}getCollectionGroup(){return this.path.get(this.path.length-2)}getCollectionPath(){return this.path.popLast()}isEqual(t){return null!==t&&0===Xi.comparator(this.path,t.path)}toString(){return this.path.toString()}static comparator(t,e){return Xi.comparator(t.path,e.path)}static isDocumentKey(t){return t.length%2==0}static fromSegments(t){return new eo(new Xi(t.slice()))}}function no(t){return new ro(t.readTime,t.key,-1)}class ro{constructor(t,e,n){this.readTime=t,this.documentKey=e,this.largestBatchId=n}static min(){return new ro(Yi.min(),eo.empty(),-1)}static max(){return new ro(Yi.max(),eo.empty(),-1)}}function so(t,e){let n=t.readTime.compareTo(e.readTime);return 0!==n?n:(n=eo.comparator(t.documentKey,e.documentKey),0!==n?n:zi(t.largestBatchId,e.largestBatchId)
623
623
  /**
624
624
  * @license
625
625
  * Copyright 2020 Google LLC
@@ -765,7 +765,7 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
765
765
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
766
766
  * See the License for the specific language governing permissions and
767
767
  * limitations under the License.
768
- */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return Gi(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}wo.EMPTY_BYTE_STRING=new wo("");const _o=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function To(t){if(Di(!!t),"string"==typeof t){let e=0;const n=_o.exec(t);if(Di(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Eo(t.seconds),nanos:Eo(t.nanos)}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function So(t){return"string"==typeof t?wo.fromBase64String(t):wo.fromUint8Array(t)}
768
+ */(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(t){return zi(this.binaryString,t.binaryString)}isEqual(t){return this.binaryString===t.binaryString}}wo.EMPTY_BYTE_STRING=new wo("");const _o=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function To(t){if(Di(!!t),"string"==typeof t){let e=0;const n=_o.exec(t);if(Di(!!n),n[1]){let t=n[1];t=(t+"000000000").substr(0,9),e=Number(t)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:Eo(t.seconds),nanos:Eo(t.nanos)}}function Eo(t){return"number"==typeof t?t:"string"==typeof t?Number(t):0}function So(t){return"string"==typeof t?wo.fromBase64String(t):wo.fromUint8Array(t)}
769
769
  /**
770
770
  * @license
771
771
  * Copyright 2020 Google LLC
@@ -813,7 +813,7 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
813
813
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
814
814
  * See the License for the specific language governing permissions and
815
815
  * limitations under the License.
816
- */(t)?9007199254740991:10:Oi()}function No(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ao(t).isEqual(Ao(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=To(t.timestampValue),r=To(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return So(t.bytesValue).isEqual(So(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Eo(t.geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Eo(t.doubleValue),r=Eo(e.doubleValue);return n===r?vo(n)===vo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return zi(t.arrayValue.values||[],e.arrayValue.values||[],No);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(po(n)!==po(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!No(n[t],r[t])))return!1;return!0}(t,e);default:return Oi()}}function Ro(t,e){return void 0!==(t.values||[]).find((t=>No(t,e)))}function Oo(t,e){if(t===e)return 0;const n=ko(t),r=ko(e);if(n!==r)return Gi(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return Gi(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Eo(t.integerValue||t.doubleValue),r=Eo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Do(t.timestampValue,e.timestampValue);case 4:return Do(Ao(t),Ao(e));case 5:return Gi(t.stringValue,e.stringValue);case 6:return function(t,e){const n=So(t),r=So(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=Gi(n[t],r[t]);if(0!==e)return e}return Gi(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=Gi(Eo(t.latitude),Eo(e.latitude));return 0!==n?n:Gi(Eo(t.longitude),Eo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Oo(n[t],r[t]);if(e)return e}return Gi(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Co.mapValue&&e===Co.mapValue)return 0;if(t===Co.mapValue)return 1;if(e===Co.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=Gi(r[t],i[t]);if(0!==e)return e;const o=Oo(n[r[t]],s[i[t]]);if(0!==o)return o}return Gi(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Oi()}}function Do(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return Gi(t,e);const n=To(t),r=To(e),s=Gi(n.seconds,r.seconds);return 0!==s?s:Gi(n.nanos,r.nanos)}function Lo(t){return Po(t)}function Po(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=To(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?So(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,eo.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Po(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Po(t.fields[s])}`;return n+"}"}(t.mapValue):Oi();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function xo(t){return!!t&&"integerValue"in t}function Uo(t){return!!t&&"arrayValue"in t}function Fo(t){return!!t&&"nullValue"in t}function Vo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Bo(t){return!!t&&"mapValue"in t}function Ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return go(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function $o(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?eo.comparator(eo.fromName(o.referenceValue),n.key):Oo(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function qo(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!No(t.position[n],e.position[n]))return!1;return!0}
816
+ */(t)?9007199254740991:10:Oi()}function No(t,e){if(t===e)return!0;const n=ko(t);if(n!==ko(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ao(t).isEqual(Ao(e));case 3:return function(t,e){if("string"==typeof t.timestampValue&&"string"==typeof e.timestampValue&&t.timestampValue.length===e.timestampValue.length)return t.timestampValue===e.timestampValue;const n=To(t.timestampValue),r=To(e.timestampValue);return n.seconds===r.seconds&&n.nanos===r.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(t,e){return So(t.bytesValue).isEqual(So(e.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(t,e){return Eo(t.geoPointValue.latitude)===Eo(e.geoPointValue.latitude)&&Eo(t.geoPointValue.longitude)===Eo(e.geoPointValue.longitude)}(t,e);case 2:return function(t,e){if("integerValue"in t&&"integerValue"in e)return Eo(t.integerValue)===Eo(e.integerValue);if("doubleValue"in t&&"doubleValue"in e){const n=Eo(t.doubleValue),r=Eo(e.doubleValue);return n===r?vo(n)===vo(r):isNaN(n)&&isNaN(r)}return!1}(t,e);case 9:return Gi(t.arrayValue.values||[],e.arrayValue.values||[],No);case 10:return function(t,e){const n=t.mapValue.fields||{},r=e.mapValue.fields||{};if(po(n)!==po(r))return!1;for(const t in n)if(n.hasOwnProperty(t)&&(void 0===r[t]||!No(n[t],r[t])))return!1;return!0}(t,e);default:return Oi()}}function Ro(t,e){return void 0!==(t.values||[]).find((t=>No(t,e)))}function Oo(t,e){if(t===e)return 0;const n=ko(t),r=ko(e);if(n!==r)return zi(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return zi(t.booleanValue,e.booleanValue);case 2:return function(t,e){const n=Eo(t.integerValue||t.doubleValue),r=Eo(e.integerValue||e.doubleValue);return n<r?-1:n>r?1:n===r?0:isNaN(n)?isNaN(r)?0:-1:1}(t,e);case 3:return Do(t.timestampValue,e.timestampValue);case 4:return Do(Ao(t),Ao(e));case 5:return zi(t.stringValue,e.stringValue);case 6:return function(t,e){const n=So(t),r=So(e);return n.compareTo(r)}(t.bytesValue,e.bytesValue);case 7:return function(t,e){const n=t.split("/"),r=e.split("/");for(let t=0;t<n.length&&t<r.length;t++){const e=zi(n[t],r[t]);if(0!==e)return e}return zi(n.length,r.length)}(t.referenceValue,e.referenceValue);case 8:return function(t,e){const n=zi(Eo(t.latitude),Eo(e.latitude));return 0!==n?n:zi(Eo(t.longitude),Eo(e.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return function(t,e){const n=t.values||[],r=e.values||[];for(let t=0;t<n.length&&t<r.length;++t){const e=Oo(n[t],r[t]);if(e)return e}return zi(n.length,r.length)}(t.arrayValue,e.arrayValue);case 10:return function(t,e){if(t===Co.mapValue&&e===Co.mapValue)return 0;if(t===Co.mapValue)return 1;if(e===Co.mapValue)return-1;const n=t.fields||{},r=Object.keys(n),s=e.fields||{},i=Object.keys(s);r.sort(),i.sort();for(let t=0;t<r.length&&t<i.length;++t){const e=zi(r[t],i[t]);if(0!==e)return e;const o=Oo(n[r[t]],s[i[t]]);if(0!==o)return o}return zi(r.length,i.length)}(t.mapValue,e.mapValue);default:throw Oi()}}function Do(t,e){if("string"==typeof t&&"string"==typeof e&&t.length===e.length)return zi(t,e);const n=To(t),r=To(e),s=zi(n.seconds,r.seconds);return 0!==s?s:zi(n.nanos,r.nanos)}function Lo(t){return Po(t)}function Po(t){return"nullValue"in t?"null":"booleanValue"in t?""+t.booleanValue:"integerValue"in t?""+t.integerValue:"doubleValue"in t?""+t.doubleValue:"timestampValue"in t?function(t){const e=To(t);return`time(${e.seconds},${e.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?So(t.bytesValue).toBase64():"referenceValue"in t?(n=t.referenceValue,eo.fromName(n).toString()):"geoPointValue"in t?`geo(${(e=t.geoPointValue).latitude},${e.longitude})`:"arrayValue"in t?function(t){let e="[",n=!0;for(const r of t.values||[])n?n=!1:e+=",",e+=Po(r);return e+"]"}(t.arrayValue):"mapValue"in t?function(t){const e=Object.keys(t.fields||{}).sort();let n="{",r=!0;for(const s of e)r?r=!1:n+=",",n+=`${s}:${Po(t.fields[s])}`;return n+"}"}(t.mapValue):Oi();var e,n}function Mo(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function xo(t){return!!t&&"integerValue"in t}function Uo(t){return!!t&&"arrayValue"in t}function Fo(t){return!!t&&"nullValue"in t}function Vo(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Bo(t){return!!t&&"mapValue"in t}function Ho(t){if(t.geoPointValue)return{geoPointValue:Object.assign({},t.geoPointValue)};if(t.timestampValue&&"object"==typeof t.timestampValue)return{timestampValue:Object.assign({},t.timestampValue)};if(t.mapValue){const e={mapValue:{fields:{}}};return go(t.mapValue.fields,((t,n)=>e.mapValue.fields[t]=Ho(n))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Ho(t.arrayValue.values[n]);return e}return Object.assign({},t)}class jo{constructor(t,e){this.position=t,this.inclusive=e}}function $o(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(r=i.field.isKeyField()?eo.comparator(eo.fromName(o.referenceValue),n.key):Oo(o,n.data.field(i.field)),"desc"===i.dir&&(r*=-1),0!==r)break}return r}function qo(t,e){if(null===t)return null===e;if(null===e)return!1;if(t.inclusive!==e.inclusive||t.position.length!==e.position.length)return!1;for(let n=0;n<t.position.length;n++)if(!No(t.position[n],e.position[n]))return!1;return!0}
817
817
  /**
818
818
  * @license
819
819
  * Copyright 2022 Google LLC
@@ -829,7 +829,7 @@ class wo{constructor(t){this.binaryString=t}static fromBase64String(t){const e=a
829
829
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
830
830
  * See the License for the specific language governing permissions and
831
831
  * limitations under the License.
832
- */class Ko{}class Wo extends Ko{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Zo(t,e,n):"array-contains"===e?new ra(t,n):"in"===e?new sa(t,n):"not-in"===e?new ia(t,n):"array-contains-any"===e?new oa(t,n):new Wo(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ta(t,n):new ea(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Oo(e,this.value)):null!==e&&ko(this.value)===ko(e)&&this.matchesComparison(Oo(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Oi()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class Go extends Ko{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new Go(t,e)}matches(t){return zo(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function zo(t){return"and"===t.op}function Qo(t){return function(t){for(const e of t.filters)if(e instanceof Go)return!1;return!0}(t)&&zo(t)}function Yo(t){if(t instanceof Wo)return t.field.canonicalString()+t.op.toString()+Lo(t.value);{const e=t.filters.map((t=>Yo(t))).join(",");return`${t.op}(${e})`}}function Jo(t,e){return t instanceof Wo?function(t,e){return e instanceof Wo&&t.op===e.op&&t.field.isEqual(e.field)&&No(t.value,e.value)}(t,e):t instanceof Go?function(t,e){return e instanceof Go&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Jo(n,e.filters[r])),!0)}(t,e):void Oi()}function Xo(t){return t instanceof Wo?function(t){return`${t.field.canonicalString()} ${t.op} ${Lo(t.value)}`}(t):t instanceof Go?function(t){return t.op.toString()+" {"+t.getFilters().map(Xo).join(" ,")+"}"}(t):"Filter"}class Zo extends Wo{constructor(t,e,n){super(t,e,n),this.key=eo.fromName(n.referenceValue)}matches(t){const e=eo.comparator(t.key,this.key);return this.matchesComparison(e)}}class ta extends Wo{constructor(t,e){super(t,"in",e),this.keys=na("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class ea extends Wo{constructor(t,e){super(t,"not-in",e),this.keys=na("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function na(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>eo.fromName(t.referenceValue)))}class ra extends Wo{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Uo(e)&&Ro(e.arrayValue,this.value)}}class sa extends Wo{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Ro(this.value.arrayValue,e)}}class ia extends Wo{constructor(t,e){super(t,"not-in",e)}matches(t){if(Ro(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Ro(this.value.arrayValue,e)}}class oa extends Wo{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Uo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Ro(this.value.arrayValue,t)))}}
832
+ */class Ko{}class Wo extends Ko{constructor(t,e,n){super(),this.field=t,this.op=e,this.value=n}static create(t,e,n){return t.isKeyField()?"in"===e||"not-in"===e?this.createKeyFieldInFilter(t,e,n):new Zo(t,e,n):"array-contains"===e?new ra(t,n):"in"===e?new sa(t,n):"not-in"===e?new ia(t,n):"array-contains-any"===e?new oa(t,n):new Wo(t,e,n)}static createKeyFieldInFilter(t,e,n){return"in"===e?new ta(t,n):new ea(t,n)}matches(t){const e=t.data.field(this.field);return"!="===this.op?null!==e&&this.matchesComparison(Oo(e,this.value)):null!==e&&ko(this.value)===ko(e)&&this.matchesComparison(Oo(e,this.value))}matchesComparison(t){switch(this.op){case"<":return t<0;case"<=":return t<=0;case"==":return 0===t;case"!=":return 0!==t;case">":return t>0;case">=":return t>=0;default:return Oi()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}getFirstInequalityField(){return this.isInequality()?this.field:null}}class zo extends Ko{constructor(t,e){super(),this.filters=t,this.op=e,this.ht=null}static create(t,e){return new zo(t,e)}matches(t){return Go(this)?void 0===this.filters.find((e=>!e.matches(t))):void 0!==this.filters.find((e=>e.matches(t)))}getFlattenedFilters(){return null!==this.ht||(this.ht=this.filters.reduce(((t,e)=>t.concat(e.getFlattenedFilters())),[])),this.ht}getFilters(){return Object.assign([],this.filters)}getFirstInequalityField(){const t=this.lt((t=>t.isInequality()));return null!==t?t.field:null}lt(t){for(const e of this.getFlattenedFilters())if(t(e))return e;return null}}function Go(t){return"and"===t.op}function Qo(t){return function(t){for(const e of t.filters)if(e instanceof zo)return!1;return!0}(t)&&Go(t)}function Yo(t){if(t instanceof Wo)return t.field.canonicalString()+t.op.toString()+Lo(t.value);{const e=t.filters.map((t=>Yo(t))).join(",");return`${t.op}(${e})`}}function Jo(t,e){return t instanceof Wo?function(t,e){return e instanceof Wo&&t.op===e.op&&t.field.isEqual(e.field)&&No(t.value,e.value)}(t,e):t instanceof zo?function(t,e){return e instanceof zo&&t.op===e.op&&t.filters.length===e.filters.length&&t.filters.reduce(((t,n,r)=>t&&Jo(n,e.filters[r])),!0)}(t,e):void Oi()}function Xo(t){return t instanceof Wo?function(t){return`${t.field.canonicalString()} ${t.op} ${Lo(t.value)}`}(t):t instanceof zo?function(t){return t.op.toString()+" {"+t.getFilters().map(Xo).join(" ,")+"}"}(t):"Filter"}class Zo extends Wo{constructor(t,e,n){super(t,e,n),this.key=eo.fromName(n.referenceValue)}matches(t){const e=eo.comparator(t.key,this.key);return this.matchesComparison(e)}}class ta extends Wo{constructor(t,e){super(t,"in",e),this.keys=na("in",e)}matches(t){return this.keys.some((e=>e.isEqual(t.key)))}}class ea extends Wo{constructor(t,e){super(t,"not-in",e),this.keys=na("not-in",e)}matches(t){return!this.keys.some((e=>e.isEqual(t.key)))}}function na(t,e){var n;return((null===(n=e.arrayValue)||void 0===n?void 0:n.values)||[]).map((t=>eo.fromName(t.referenceValue)))}class ra extends Wo{constructor(t,e){super(t,"array-contains",e)}matches(t){const e=t.data.field(this.field);return Uo(e)&&Ro(e.arrayValue,this.value)}}class sa extends Wo{constructor(t,e){super(t,"in",e)}matches(t){const e=t.data.field(this.field);return null!==e&&Ro(this.value.arrayValue,e)}}class ia extends Wo{constructor(t,e){super(t,"not-in",e)}matches(t){if(Ro(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const e=t.data.field(this.field);return null!==e&&!Ro(this.value.arrayValue,e)}}class oa extends Wo{constructor(t,e){super(t,"array-contains-any",e)}matches(t){const e=t.data.field(this.field);return!(!Uo(e)||!e.arrayValue.values)&&e.arrayValue.values.some((t=>Ro(this.value.arrayValue,t)))}}
833
833
  /**
834
834
  * @license
835
835
  * Copyright 2022 Google LLC
@@ -894,7 +894,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(this.comparator)}has(
894
894
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
895
895
  * See the License for the specific language governing permissions and
896
896
  * limitations under the License.
897
- */class pa{constructor(t){this.fields=t,t.sort(to.comparator)}static empty(){return new pa([])}unionWith(t){let e=new da(to.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new pa(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return zi(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
897
+ */class pa{constructor(t){this.fields=t,t.sort(to.comparator)}static empty(){return new pa([])}unionWith(t){let e=new da(to.comparator);for(const t of this.fields)e=e.add(t);for(const n of t)e=e.add(n);return new pa(e.toArray())}covers(t){for(const e of this.fields)if(e.isPrefixOf(t))return!0;return!1}isEqual(t){return Gi(this.fields,t.fields,((t,e)=>t.isEqual(e)))}}
898
898
  /**
899
899
  * @license
900
900
  * Copyright 2017 Google LLC
@@ -990,7 +990,7 @@ class da{constructor(t){this.comparator=t,this.data=new ua(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 ja{constructor(){this._=void 0}}function $a(t,e,n){return t instanceof Wa?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof Ga?za(t,e):t instanceof Qa?Ya(t,e):function(t,e){const n=Ka(t,e),r=Xa(n)+Xa(t.gt);return xo(n)&&xo(t.gt)?Ba(r):Va(t.yt,r)}(t,e)}function qa(t,e,n){return t instanceof Ga?za(t,e):t instanceof Qa?Ya(t,e):n}function Ka(t,e){return t instanceof Ja?xo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Wa extends ja{}class Ga extends ja{constructor(t){super(),this.elements=t}}function za(t,e){const n=Za(e);for(const e of t.elements)n.some((t=>No(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Qa extends ja{constructor(t){super(),this.elements=t}}function Ya(t,e){let n=Za(e);for(const e of t.elements)n=n.filter((t=>!No(t,e)));return{arrayValue:{values:n}}}class Ja extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Xa(t){return Eo(t.integerValue||t.doubleValue)}function Za(t){return Uo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class tc{constructor(t,e){this.version=t,this.transformResults=e}}class ec{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ec}static exists(t){return new ec(void 0,t)}static updateTime(t){return new ec(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function nc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class rc{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new pc(t.key,ec.none()):new uc(t.key,t.data,ec.none());{const n=t.data,r=ga.empty();let s=new da(to.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new hc(t.key,r,new pa(s.toArray()),ec.none())}}function ic(t,e,n){t instanceof uc?function(t,e,n){const r=t.value.clone(),s=dc(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!nc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=dc(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(lc(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function oc(t,e,n,r){return t instanceof uc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=t.value.clone(),i=fc(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof hc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=fc(t.fieldTransforms,r,e),i=e.data;return i.setAll(lc(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return nc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ac(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=Ka(r.transform,t||null);null!=s&&(null===n&&(n=ga.empty()),n.set(r.field,s))}return n||null}function cc(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&zi(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof Ga&&e instanceof Ga||t instanceof Qa&&e instanceof Qa?zi(t.elements,e.elements,No):t instanceof Ja&&e instanceof Ja?No(t.gt,e.gt):t instanceof Wa&&e instanceof Wa}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class uc extends rc{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class hc extends rc{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function lc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function dc(t,e,n){const r=new Map;Di(t.length===n.length);for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,qa(o,a,n[s]))}return r}function fc(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,$a(t,i,e))}return r}class pc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class gc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
993
+ */class ja{constructor(){this._=void 0}}function $a(t,e,n){return t instanceof Wa?function(t,e){const n={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:t.seconds,nanos:t.nanoseconds}}}};return e&&(n.fields.__previous_value__=e),{mapValue:n}}(n,e):t instanceof za?Ga(t,e):t instanceof Qa?Ya(t,e):function(t,e){const n=Ka(t,e),r=Xa(n)+Xa(t.gt);return xo(n)&&xo(t.gt)?Ba(r):Va(t.yt,r)}(t,e)}function qa(t,e,n){return t instanceof za?Ga(t,e):t instanceof Qa?Ya(t,e):n}function Ka(t,e){return t instanceof Ja?xo(n=e)||function(t){return!!t&&"doubleValue"in t}(n)?e:{integerValue:0}:null;var n}class Wa extends ja{}class za extends ja{constructor(t){super(),this.elements=t}}function Ga(t,e){const n=Za(e);for(const e of t.elements)n.some((t=>No(t,e)))||n.push(e);return{arrayValue:{values:n}}}class Qa extends ja{constructor(t){super(),this.elements=t}}function Ya(t,e){let n=Za(e);for(const e of t.elements)n=n.filter((t=>!No(t,e)));return{arrayValue:{values:n}}}class Ja extends ja{constructor(t,e){super(),this.yt=t,this.gt=e}}function Xa(t){return Eo(t.integerValue||t.doubleValue)}function Za(t){return Uo(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}class tc{constructor(t,e){this.version=t,this.transformResults=e}}class ec{constructor(t,e){this.updateTime=t,this.exists=e}static none(){return new ec}static exists(t){return new ec(void 0,t)}static updateTime(t){return new ec(t)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(t){return this.exists===t.exists&&(this.updateTime?!!t.updateTime&&this.updateTime.isEqual(t.updateTime):!t.updateTime)}}function nc(t,e){return void 0!==t.updateTime?e.isFoundDocument()&&e.version.isEqual(t.updateTime):void 0===t.exists||t.exists===e.isFoundDocument()}class rc{}function sc(t,e){if(!t.hasLocalMutations||e&&0===e.fields.length)return null;if(null===e)return t.isNoDocument()?new pc(t.key,ec.none()):new uc(t.key,t.data,ec.none());{const n=t.data,r=ga.empty();let s=new da(to.comparator);for(let t of e.fields)if(!s.has(t)){let e=n.field(t);null===e&&t.length>1&&(t=t.popLast(),e=n.field(t)),null===e?r.delete(t):r.set(t,e),s=s.add(t)}return new hc(t.key,r,new pa(s.toArray()),ec.none())}}function ic(t,e,n){t instanceof uc?function(t,e,n){const r=t.value.clone(),s=dc(t.fieldTransforms,e,n.transformResults);r.setAll(s),e.convertToFoundDocument(n.version,r).setHasCommittedMutations()}(t,e,n):t instanceof hc?function(t,e,n){if(!nc(t.precondition,e))return void e.convertToUnknownDocument(n.version);const r=dc(t.fieldTransforms,e,n.transformResults),s=e.data;s.setAll(lc(t)),s.setAll(r),e.convertToFoundDocument(n.version,s).setHasCommittedMutations()}(t,e,n):function(t,e,n){e.convertToNoDocument(n.version).setHasCommittedMutations()}(0,e,n)}function oc(t,e,n,r){return t instanceof uc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=t.value.clone(),i=fc(t.fieldTransforms,r,e);return s.setAll(i),e.convertToFoundDocument(e.version,s).setHasLocalMutations(),null}(t,e,n,r):t instanceof hc?function(t,e,n,r){if(!nc(t.precondition,e))return n;const s=fc(t.fieldTransforms,r,e),i=e.data;return i.setAll(lc(t)),i.setAll(s),e.convertToFoundDocument(e.version,i).setHasLocalMutations(),null===n?null:n.unionWith(t.fieldMask.fields).unionWith(t.fieldTransforms.map((t=>t.field)))}(t,e,n,r):function(t,e,n){return nc(t.precondition,e)?(e.convertToNoDocument(e.version).setHasLocalMutations(),null):n}(t,e,n)}function ac(t,e){let n=null;for(const r of t.fieldTransforms){const t=e.data.field(r.field),s=Ka(r.transform,t||null);null!=s&&(null===n&&(n=ga.empty()),n.set(r.field,s))}return n||null}function cc(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(t,e){return void 0===t&&void 0===e||!(!t||!e)&&Gi(t,e,((t,e)=>function(t,e){return t.field.isEqual(e.field)&&function(t,e){return t instanceof za&&e instanceof za||t instanceof Qa&&e instanceof Qa?Gi(t.elements,e.elements,No):t instanceof Ja&&e instanceof Ja?No(t.gt,e.gt):t instanceof Wa&&e instanceof Wa}(t.transform,e.transform)}(t,e)))}(t.fieldTransforms,e.fieldTransforms)&&(0===t.type?t.value.isEqual(e.value):1!==t.type||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class uc extends rc{constructor(t,e,n,r=[]){super(),this.key=t,this.value=e,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class hc extends rc{constructor(t,e,n,r,s=[]){super(),this.key=t,this.data=e,this.fieldMask=n,this.precondition=r,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function lc(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}})),e}function dc(t,e,n){const r=new Map;Di(t.length===n.length);for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,a=e.data.field(i.field);r.set(i.field,qa(o,a,n[s]))}return r}function fc(t,e,n){const r=new Map;for(const s of t){const t=s.transform,i=n.data.field(s.field);r.set(s.field,$a(t,i,e))}return r}class pc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class gc extends rc{constructor(t,e){super(),this.key=t,this.precondition=e,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}
994
994
  /**
995
995
  * @license
996
996
  * Copyright 2017 Google LLC
@@ -1055,7 +1055,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
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
- */const Tc=new ua(eo.comparator);function Ec(){return Tc}const Sc=new ua(eo.comparator);function Ic(...t){let e=Sc;for(const n of t)e=e.insert(n.key,n);return e}function bc(t){let e=Sc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Ac(){return kc()}function Cc(){return kc()}function kc(){return new _c((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Nc=new ua(eo.comparator),Rc=new da(eo.comparator);function Oc(...t){let e=Rc;for(const n of t)e=e.add(n);return e}const Dc=new da(Gi);function Lc(){return Dc}
1058
+ */const Tc=new ua(eo.comparator);function Ec(){return Tc}const Sc=new ua(eo.comparator);function Ic(...t){let e=Sc;for(const n of t)e=e.insert(n.key,n);return e}function bc(t){let e=Sc;return t.forEach(((t,n)=>e=e.insert(t,n.overlayedDocument))),e}function Ac(){return kc()}function Cc(){return kc()}function kc(){return new _c((t=>t.toString()),((t,e)=>t.isEqual(e)))}const Nc=new ua(eo.comparator),Rc=new da(eo.comparator);function Oc(...t){let e=Rc;for(const n of t)e=e.add(n);return e}const Dc=new da(zi);function Lc(){return Dc}
1059
1059
  /**
1060
1060
  * @license
1061
1061
  * Copyright 2017 Google LLC
@@ -1087,7 +1087,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1087
1087
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1088
1088
  * See the License for the specific language governing permissions and
1089
1089
  * limitations under the License.
1090
- */class xc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Uc{constructor(t,e){this.targetId=t,this.Et=e}}class Fc{constructor(t,e,n=wo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Vc{constructor(){this.At=0,this.Rt=jc(),this.bt=wo.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Oc(),e=Oc(),n=Oc();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Oi()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Bc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(Gi)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Oi()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ea(t))if(0===n){const n=new eo(t.path);this.Qt(e,n,ya.newNoDocument(n,Yi.min()))}else Di(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&Ea(s.target)){const e=new eo(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,ya.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Oc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new Pc(t,e,this.Ut,this.Lt,n);return this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(Gi),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Vc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new da(Gi),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ci("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Vc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(eo.comparator)}function jc(){return new ua(eo.comparator)}
1090
+ */class xc{constructor(t,e,n,r){this.It=t,this.removedTargetIds=e,this.key=n,this.Tt=r}}class Uc{constructor(t,e){this.targetId=t,this.Et=e}}class Fc{constructor(t,e,n=wo.EMPTY_BYTE_STRING,r=null){this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}}class Vc{constructor(){this.At=0,this.Rt=jc(),this.bt=wo.EMPTY_BYTE_STRING,this.Pt=!1,this.vt=!0}get current(){return this.Pt}get resumeToken(){return this.bt}get Vt(){return 0!==this.At}get St(){return this.vt}Dt(t){t.approximateByteSize()>0&&(this.vt=!0,this.bt=t)}Ct(){let t=Oc(),e=Oc(),n=Oc();return this.Rt.forEach(((r,s)=>{switch(s){case 0:t=t.add(r);break;case 2:e=e.add(r);break;case 1:n=n.add(r);break;default:Oi()}})),new Mc(this.bt,this.Pt,t,e,n)}xt(){this.vt=!1,this.Rt=jc()}Nt(t,e){this.vt=!0,this.Rt=this.Rt.insert(t,e)}kt(t){this.vt=!0,this.Rt=this.Rt.remove(t)}Ot(){this.At+=1}Mt(){this.At-=1}Ft(){this.vt=!0,this.Pt=!0}}class Bc{constructor(t){this.$t=t,this.Bt=new Map,this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(zi)}Kt(t){for(const e of t.It)t.Tt&&t.Tt.isFoundDocument()?this.Gt(e,t.Tt):this.Qt(e,t.key,t.Tt);for(const e of t.removedTargetIds)this.Qt(e,t.key,t.Tt)}jt(t){this.forEachTarget(t,(e=>{const n=this.Wt(e);switch(t.state){case 0:this.zt(e)&&n.Dt(t.resumeToken);break;case 1:n.Mt(),n.Vt||n.xt(),n.Dt(t.resumeToken);break;case 2:n.Mt(),n.Vt||this.removeTarget(e);break;case 3:this.zt(e)&&(n.Ft(),n.Dt(t.resumeToken));break;case 4:this.zt(e)&&(this.Ht(e),n.Dt(t.resumeToken));break;default:Oi()}}))}forEachTarget(t,e){t.targetIds.length>0?t.targetIds.forEach(e):this.Bt.forEach(((t,n)=>{this.zt(n)&&e(n)}))}Jt(t){const e=t.targetId,n=t.Et.count,r=this.Yt(e);if(r){const t=r.target;if(Ea(t))if(0===n){const n=new eo(t.path);this.Qt(e,n,ya.newNoDocument(n,Yi.min()))}else Di(1===n);else this.Xt(e)!==n&&(this.Ht(e),this.Ut=this.Ut.add(e))}}Zt(t){const e=new Map;this.Bt.forEach(((n,r)=>{const s=this.Yt(r);if(s){if(n.current&&Ea(s.target)){const e=new eo(s.target.path);null!==this.Lt.get(e)||this.te(r,e)||this.Qt(r,e,ya.newNoDocument(e,t))}n.St&&(e.set(r,n.Ct()),n.xt())}}));let n=Oc();this.qt.forEach(((t,e)=>{let r=!0;e.forEachWhile((t=>{const e=this.Yt(t);return!e||2===e.purpose||(r=!1,!1)})),r&&(n=n.add(t))})),this.Lt.forEach(((e,n)=>n.setReadTime(t)));const r=new Pc(t,e,this.Ut,this.Lt,n);return this.Lt=Ec(),this.qt=Hc(),this.Ut=new da(zi),r}Gt(t,e){if(!this.zt(t))return;const n=this.te(t,e.key)?2:0;this.Wt(t).Nt(e.key,n),this.Lt=this.Lt.insert(e.key,e),this.qt=this.qt.insert(e.key,this.ee(e.key).add(t))}Qt(t,e,n){if(!this.zt(t))return;const r=this.Wt(t);this.te(t,e)?r.Nt(e,1):r.kt(e),this.qt=this.qt.insert(e,this.ee(e).delete(t)),n&&(this.Lt=this.Lt.insert(e,n))}removeTarget(t){this.Bt.delete(t)}Xt(t){const e=this.Wt(t).Ct();return this.$t.getRemoteKeysForTarget(t).size+e.addedDocuments.size-e.removedDocuments.size}Ot(t){this.Wt(t).Ot()}Wt(t){let e=this.Bt.get(t);return e||(e=new Vc,this.Bt.set(t,e)),e}ee(t){let e=this.qt.get(t);return e||(e=new da(zi),this.qt=this.qt.insert(t,e)),e}zt(t){const e=null!==this.Yt(t);return e||Ci("WatchChangeAggregator","Detected inactive target",t),e}Yt(t){const e=this.Bt.get(t);return e&&e.Vt?null:this.$t.ne(t)}Ht(t){this.Bt.set(t,new Vc),this.$t.getRemoteKeysForTarget(t).forEach((e=>{this.Qt(t,e,null)}))}te(t,e){return this.$t.getRemoteKeysForTarget(t).has(e)}}function Hc(){return new ua(eo.comparator)}function jc(){return new ua(eo.comparator)}
1091
1091
  /**
1092
1092
  * @license
1093
1093
  * Copyright 2017 Google LLC
@@ -1103,7 +1103,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1103
1103
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1104
1104
  * See the License for the specific language governing permissions and
1105
1105
  * limitations under the License.
1106
- */const $c={asc:"ASCENDING",desc:"DESCENDING"},qc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Kc={and:"AND",or:"OR"};class Wc{constructor(t,e){this.databaseId=t,this.wt=e}}function Gc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function zc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Qc(t,e){return Gc(t,e.toTimestamp())}function Yc(t){return Di(!!t),Yi.fromTimestamp(function(t){const e=To(t);return new Qi(e.seconds,e.nanos)}(t))}function Jc(t,e){return function(t){return new Xi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Xc(t){const e=Xi.fromString(t);return Di(mu(e)),e}function Zc(t,e){return Jc(t.databaseId,e.path)}function tu(t,e){const n=Xc(e);if(n.get(1)!==t.databaseId.projectId)throw new Mi(Pi.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Mi(Pi.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new eo(ru(n))}function eu(t,e){return Jc(t.databaseId,e)}function nu(t){return new Xi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function ru(t){return Di(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function su(t,e,n){return{name:Zc(t,e),fields:n.value.mapValue.fields}}function iu(t,e){return{documents:[eu(t,e.path)]}}function ou(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=eu(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=eu(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return pu(Go.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:du(t.field),direction:uu(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||yo(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function au(t){let e=function(t){const e=Xc(t);return 4===e.length?Xi.emptyPath():ru(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Di(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=cu(t);return e instanceof Go&&Qo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new aa(fu(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,yo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new Sa(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function cu(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=fu(t.unaryFilter.field);return Wo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=fu(t.unaryFilter.field);return Wo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=fu(t.unaryFilter.field);return Wo.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=fu(t.unaryFilter.field);return Wo.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Oi()}}(t):void 0!==t.fieldFilter?function(t){return Wo.create(fu(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Oi()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return Go.create(t.compositeFilter.filters.map((t=>cu(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Oi()}}(t.compositeFilter.op))}(t):Oi()}function uu(t){return $c[t]}function hu(t){return qc[t]}function lu(t){return Kc[t]}function du(t){return{fieldPath:t.canonicalString()}}function fu(t){return to.fromServerFormat(t.fieldPath)}function pu(t){return t instanceof Wo?function(t){if("=="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:du(t.field),op:hu(t.op),value:t.value}}}(t):t instanceof Go?function(t){const e=t.getFilters().map((t=>pu(t)));return 1===e.length?e[0]:{compositeFilter:{op:lu(t.op),filters:e}}}(t):Oi()}function gu(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function mu(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1106
+ */const $c={asc:"ASCENDING",desc:"DESCENDING"},qc={"<":"LESS_THAN","<=":"LESS_THAN_OR_EQUAL",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL","==":"EQUAL","!=":"NOT_EQUAL","array-contains":"ARRAY_CONTAINS",in:"IN","not-in":"NOT_IN","array-contains-any":"ARRAY_CONTAINS_ANY"},Kc={and:"AND",or:"OR"};class Wc{constructor(t,e){this.databaseId=t,this.wt=e}}function zc(t,e){return t.wt?`${new Date(1e3*e.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+e.nanoseconds).slice(-9)}Z`:{seconds:""+e.seconds,nanos:e.nanoseconds}}function Gc(t,e){return t.wt?e.toBase64():e.toUint8Array()}function Qc(t,e){return zc(t,e.toTimestamp())}function Yc(t){return Di(!!t),Yi.fromTimestamp(function(t){const e=To(t);return new Qi(e.seconds,e.nanos)}(t))}function Jc(t,e){return function(t){return new Xi(["projects",t.projectId,"databases",t.database])}(t).child("documents").child(e).canonicalString()}function Xc(t){const e=Xi.fromString(t);return Di(mu(e)),e}function Zc(t,e){return Jc(t.databaseId,e.path)}function tu(t,e){const n=Xc(e);if(n.get(1)!==t.databaseId.projectId)throw new Mi(Pi.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+t.databaseId.projectId);if(n.get(3)!==t.databaseId.database)throw new Mi(Pi.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new eo(ru(n))}function eu(t,e){return Jc(t.databaseId,e)}function nu(t){return new Xi(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function ru(t){return Di(t.length>4&&"documents"===t.get(4)),t.popFirst(5)}function su(t,e,n){return{name:Zc(t,e),fields:n.value.mapValue.fields}}function iu(t,e){return{documents:[eu(t,e.path)]}}function ou(t,e){const n={structuredQuery:{}},r=e.path;null!==e.collectionGroup?(n.parent=eu(t,r),n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(n.parent=eu(t,r.popLast()),n.structuredQuery.from=[{collectionId:r.lastSegment()}]);const s=function(t){if(0!==t.length)return pu(zo.create(t,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const i=function(t){if(0!==t.length)return t.map((t=>function(t){return{field:du(t.field),direction:uu(t.dir)}}(t)))}(e.orderBy);i&&(n.structuredQuery.orderBy=i);const o=function(t,e){return t.wt||yo(e)?e:{value:e}}(t,e.limit);var a;return null!==o&&(n.structuredQuery.limit=o),e.startAt&&(n.structuredQuery.startAt={before:(a=e.startAt).inclusive,values:a.position}),e.endAt&&(n.structuredQuery.endAt=function(t){return{before:!t.inclusive,values:t.position}}(e.endAt)),n}function au(t){let e=function(t){const e=Xc(t);return 4===e.length?Xi.emptyPath():ru(e)}(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){Di(1===r);const t=n.from[0];t.allDescendants?s=t.collectionId:e=e.child(t.collectionId)}let i=[];n.where&&(i=function(t){const e=cu(t);return e instanceof zo&&Qo(e)?e.getFilters():[e]}(n.where));let o=[];n.orderBy&&(o=n.orderBy.map((t=>function(t){return new aa(fu(t.field),function(t){switch(t){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(t.direction))}(t))));let a=null;n.limit&&(a=function(t){let e;return e="object"==typeof t?t.value:t,yo(e)?null:e}(n.limit));let c=null;n.startAt&&(c=function(t){const e=!!t.before,n=t.values||[];return new jo(n,e)}(n.startAt));let u=null;return n.endAt&&(u=function(t){const e=!t.before,n=t.values||[];return new jo(n,e)}(n.endAt)),function(t,e,n,r,s,i,o,a){return new Sa(t,e,n,r,s,i,o,a)}(e,s,o,i,a,"F",c,u)}function cu(t){return void 0!==t.unaryFilter?function(t){switch(t.unaryFilter.op){case"IS_NAN":const e=fu(t.unaryFilter.field);return Wo.create(e,"==",{doubleValue:NaN});case"IS_NULL":const n=fu(t.unaryFilter.field);return Wo.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const r=fu(t.unaryFilter.field);return Wo.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const s=fu(t.unaryFilter.field);return Wo.create(s,"!=",{nullValue:"NULL_VALUE"});default:return Oi()}}(t):void 0!==t.fieldFilter?function(t){return Wo.create(fu(t.fieldFilter.field),function(t){switch(t){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return Oi()}}(t.fieldFilter.op),t.fieldFilter.value)}(t):void 0!==t.compositeFilter?function(t){return zo.create(t.compositeFilter.filters.map((t=>cu(t))),function(t){switch(t){case"AND":return"and";case"OR":return"or";default:return Oi()}}(t.compositeFilter.op))}(t):Oi()}function uu(t){return $c[t]}function hu(t){return qc[t]}function lu(t){return Kc[t]}function du(t){return{fieldPath:t.canonicalString()}}function fu(t){return to.fromServerFormat(t.fieldPath)}function pu(t){return t instanceof Wo?function(t){if("=="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NULL"}}}else if("!="===t.op){if(Vo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NAN"}};if(Fo(t.value))return{unaryFilter:{field:du(t.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:du(t.field),op:hu(t.op),value:t.value}}}(t):t instanceof zo?function(t){const e=t.getFilters().map((t=>pu(t)));return 1===e.length?e[0]:{compositeFilter:{op:lu(t.op),filters:e}}}(t):Oi()}function gu(t){const e=[];return t.fields.forEach((t=>e.push(t.canonicalString()))),{fieldPaths:e}}function mu(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)}
1107
1107
  /**
1108
1108
  * @license
1109
1109
  * Copyright 2017 Google LLC
@@ -1119,7 +1119,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
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
- */class yu{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&ic(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Cc();return this.mutations.forEach((r=>{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=sc(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(Yi.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Oc())}isEqual(t){return this.batchId===t.batchId&&zi(this.mutations,t.mutations,((t,e)=>cc(t,e)))&&zi(this.baseMutations,t.baseMutations,((t,e)=>cc(t,e)))}}class vu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Di(t.mutations.length===n.length);let r=Nc;const s=t.mutations;for(let t=0;t<s.length;t++)r=r.insert(s[t].key,n[t].version);return new vu(t,e,n,r)}}
1122
+ */class yu{constructor(t,e,n,r){this.batchId=t,this.localWriteTime=e,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(t,e){const n=e.mutationResults;for(let e=0;e<this.mutations.length;e++){const r=this.mutations[e];r.key.isEqual(t.key)&&ic(r,t,n[e])}}applyToLocalView(t,e){for(const n of this.baseMutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));for(const n of this.mutations)n.key.isEqual(t.key)&&(e=oc(n,t,e,this.localWriteTime));return e}applyToLocalDocumentSet(t,e){const n=Cc();return this.mutations.forEach((r=>{const s=t.get(r.key),i=s.overlayedDocument;let o=this.applyToLocalView(i,s.mutatedFields);o=e.has(r.key)?null:o;const a=sc(i,o);null!==a&&n.set(r.key,a),i.isValidDocument()||i.convertToNoDocument(Yi.min())})),n}keys(){return this.mutations.reduce(((t,e)=>t.add(e.key)),Oc())}isEqual(t){return this.batchId===t.batchId&&Gi(this.mutations,t.mutations,((t,e)=>cc(t,e)))&&Gi(this.baseMutations,t.baseMutations,((t,e)=>cc(t,e)))}}class vu{constructor(t,e,n,r){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.docVersions=r}static from(t,e,n){Di(t.mutations.length===n.length);let r=Nc;const s=t.mutations;for(let t=0;t<s.length;t++)r=r.insert(s[t].key,n[t].version);return new vu(t,e,n,r)}}
1123
1123
  /**
1124
1124
  * @license
1125
1125
  * Copyright 2022 Google LLC
@@ -1311,7 +1311,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1311
1311
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1312
1312
  * See the License for the specific language governing permissions and
1313
1313
  * limitations under the License.
1314
- */class Ou{constructor(){this.ns=new da(Du.ss),this.rs=new da(Du.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Du(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Du(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1),s=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),s.push(t.key)})),s}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1);let s=Oc();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Du(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Du{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return eo.comparator(t.key,e.key)||Gi(t._s,e._s)}static os(t,e){return Gi(t._s,e._s)||eo.comparator(t.key,e.key)}}
1314
+ */class Ou{constructor(){this.ns=new da(Du.ss),this.rs=new da(Du.os)}isEmpty(){return this.ns.isEmpty()}addReference(t,e){const n=new Du(t,e);this.ns=this.ns.add(n),this.rs=this.rs.add(n)}us(t,e){t.forEach((t=>this.addReference(t,e)))}removeReference(t,e){this.cs(new Du(t,e))}hs(t,e){t.forEach((t=>this.removeReference(t,e)))}ls(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1),s=[];return this.rs.forEachInRange([n,r],(t=>{this.cs(t),s.push(t.key)})),s}fs(){this.ns.forEach((t=>this.cs(t)))}cs(t){this.ns=this.ns.delete(t),this.rs=this.rs.delete(t)}ds(t){const e=new eo(new Xi([])),n=new Du(e,t),r=new Du(e,t+1);let s=Oc();return this.rs.forEachInRange([n,r],(t=>{s=s.add(t.key)})),s}containsKey(t){const e=new Du(t,0),n=this.ns.firstAfterOrEqual(e);return null!==n&&t.isEqual(n.key)}}class Du{constructor(t,e){this.key=t,this._s=e}static ss(t,e){return eo.comparator(t.key,e.key)||zi(t._s,e._s)}static os(t,e){return zi(t._s,e._s)||eo.comparator(t.key,e.key)}}
1315
1315
  /**
1316
1316
  * @license
1317
1317
  * Copyright 2017 Google LLC
@@ -1327,7 +1327,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1327
1327
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1328
1328
  * See the License for the specific language governing permissions and
1329
1329
  * limitations under the License.
1330
- */class Lu{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new da(Du.ss)}checkEmpty(t){return co.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new yu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Du(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return co.resolve(i)}lookupMutationBatch(t,e){return co.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return co.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return co.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return co.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Du(e,0),r=new Du(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),co.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new da(Gi);return e.forEach((t=>{const e=new Du(t,0),r=new Du(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),co.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;eo.isDocumentKey(s)||(s=s.child(""));const i=new Du(new eo(s),0);let o=new da(Gi);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),co.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Di(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return co.forEach(e.mutations,(r=>{const s=new Du(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Du(e,0),r=this.gs.firstAfterOrEqual(n);return co.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,co.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
1330
+ */class Lu{constructor(t,e){this.indexManager=t,this.referenceDelegate=e,this.mutationQueue=[],this.ws=1,this.gs=new da(Du.ss)}checkEmpty(t){return co.resolve(0===this.mutationQueue.length)}addMutationBatch(t,e,n,r){const s=this.ws;this.ws++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const i=new yu(s,e,n,r);this.mutationQueue.push(i);for(const e of r)this.gs=this.gs.add(new Du(e.key,s)),this.indexManager.addToCollectionParentIndex(t,e.key.path.popLast());return co.resolve(i)}lookupMutationBatch(t,e){return co.resolve(this.ys(e))}getNextMutationBatchAfterBatchId(t,e){const n=e+1,r=this.ps(n),s=r<0?0:r;return co.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return co.resolve(0===this.mutationQueue.length?-1:this.ws-1)}getAllMutationBatches(t){return co.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(t,e){const n=new Du(e,0),r=new Du(e,Number.POSITIVE_INFINITY),s=[];return this.gs.forEachInRange([n,r],(t=>{const e=this.ys(t._s);s.push(e)})),co.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(t,e){let n=new da(zi);return e.forEach((t=>{const e=new Du(t,0),r=new Du(t,Number.POSITIVE_INFINITY);this.gs.forEachInRange([e,r],(t=>{n=n.add(t._s)}))})),co.resolve(this.Is(n))}getAllMutationBatchesAffectingQuery(t,e){const n=e.path,r=n.length+1;let s=n;eo.isDocumentKey(s)||(s=s.child(""));const i=new Du(new eo(s),0);let o=new da(zi);return this.gs.forEachWhile((t=>{const e=t.key.path;return!!n.isPrefixOf(e)&&(e.length===r&&(o=o.add(t._s)),!0)}),i),co.resolve(this.Is(o))}Is(t){const e=[];return t.forEach((t=>{const n=this.ys(t);null!==n&&e.push(n)})),e}removeMutationBatch(t,e){Di(0===this.Ts(e.batchId,"removed")),this.mutationQueue.shift();let n=this.gs;return co.forEach(e.mutations,(r=>{const s=new Du(r.key,e.batchId);return n=n.delete(s),this.referenceDelegate.markPotentiallyOrphaned(t,r.key)})).next((()=>{this.gs=n}))}An(t){}containsKey(t,e){const n=new Du(e,0),r=this.gs.firstAfterOrEqual(n);return co.resolve(e.isEqual(r&&r.key))}performConsistencyCheck(t){return this.mutationQueue.length,co.resolve()}Ts(t,e){return this.ps(t)}ps(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId}ys(t){const e=this.ps(t);return e<0||e>=this.mutationQueue.length?null:this.mutationQueue[e]}}
1331
1331
  /**
1332
1332
  * @license
1333
1333
  * Copyright 2017 Google LLC
@@ -1423,7 +1423,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1423
1423
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1424
1424
  * See the License for the specific language governing permissions and
1425
1425
  * limitations under the License.
1426
- */class ju{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new ua(Gi),this.Ui=new _c((t=>_a(t)),Ta),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new ku(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function $u(t,e){const n=Li(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Oc();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function qu(t){const e=Li(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Ku(t,e){const n=Li(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(wo.EMPTY_BYTE_STRING,Yi.min()).withLastLimboFreeSnapshotVersion(Yi.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ec(),c=Oc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Oc(),s=Oc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ec();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Yi.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ci("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Yi.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return co.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}function Wu(t,e){const n=Li(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function Gu(t,e,n){const r=Li(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!uo(t))throw t;Ci("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function zu(t,e,n){const r=Li(t);let s=Yi.min(),i=Oc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Li(t),s=r.Ui.get(n);return void 0!==s?co.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Ra(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:Yi.min(),n?i:Oc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Yi.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class Qu{constructor(){this.activeTargetIds=Lc()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class Yu{constructor(){this.Lr=new Qu,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Qu,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1426
+ */class ju{constructor(t,e,n,r){this.persistence=t,this.Li=e,this.yt=r,this.qi=new ua(zi),this.Ui=new _c((t=>_a(t)),Ta),this.Ki=new Map,this.Gi=t.getRemoteDocumentCache(),this.Cs=t.getTargetCache(),this.Ns=t.getBundleCache(),this.Qi(n)}Qi(t){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(t),this.indexManager=this.persistence.getIndexManager(t),this.mutationQueue=this.persistence.getMutationQueue(t,this.indexManager),this.localDocuments=new ku(this.Gi,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Gi.setIndexManager(this.indexManager),this.Li.initialize(this.localDocuments,this.indexManager)}collectGarbage(t){return this.persistence.runTransaction("Collect garbage","readwrite-primary",(e=>t.collect(e,this.qi)))}}async function $u(t,e){const n=Li(t);return await n.persistence.runTransaction("Handle user change","readonly",(t=>{let r;return n.mutationQueue.getAllMutationBatches(t).next((s=>(r=s,n.Qi(e),n.mutationQueue.getAllMutationBatches(t)))).next((e=>{const s=[],i=[];let o=Oc();for(const t of r){s.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}for(const t of e){i.push(t.batchId);for(const e of t.mutations)o=o.add(e.key)}return n.localDocuments.getDocuments(t,o).next((t=>({ji:t,removedBatchIds:s,addedBatchIds:i})))}))}))}function qu(t){const e=Li(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(t=>e.Cs.getLastRemoteSnapshotVersion(t)))}function Ku(t,e){const n=Li(t),r=e.snapshotVersion;let s=n.qi;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(t=>{const i=n.Gi.newChangeBuffer({trackRemovals:!0});s=n.qi;const o=[];e.targetChanges.forEach(((i,a)=>{const c=s.get(a);if(!c)return;o.push(n.Cs.removeMatchingKeys(t,i.removedDocuments,a).next((()=>n.Cs.addMatchingKeys(t,i.addedDocuments,a))));let u=c.withSequenceNumber(t.currentSequenceNumber);e.targetMismatches.has(a)?u=u.withResumeToken(wo.EMPTY_BYTE_STRING,Yi.min()).withLastLimboFreeSnapshotVersion(Yi.min()):i.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(i.resumeToken,r)),s=s.insert(a,u),function(t,e,n){return 0===t.resumeToken.approximateByteSize()||(e.snapshotVersion.toMicroseconds()-t.snapshotVersion.toMicroseconds()>=3e8||n.addedDocuments.size+n.modifiedDocuments.size+n.removedDocuments.size>0)}(c,u,i)&&o.push(n.Cs.updateTargetData(t,u))}));let a=Ec(),c=Oc();if(e.documentUpdates.forEach((r=>{e.resolvedLimboDocuments.has(r)&&o.push(n.persistence.referenceDelegate.updateLimboDocument(t,r))})),o.push(function(t,e,n){let r=Oc(),s=Oc();return n.forEach((t=>r=r.add(t))),e.getEntries(t,r).next((t=>{let r=Ec();return n.forEach(((n,i)=>{const o=t.get(n);i.isFoundDocument()!==o.isFoundDocument()&&(s=s.add(n)),i.isNoDocument()&&i.version.isEqual(Yi.min())?(e.removeEntry(n,i.readTime),r=r.insert(n,i)):!o.isValidDocument()||i.version.compareTo(o.version)>0||0===i.version.compareTo(o.version)&&o.hasPendingWrites?(e.addEntry(i),r=r.insert(n,i)):Ci("LocalStore","Ignoring outdated watch update for ",n,". Current version:",o.version," Watch version:",i.version)})),{Wi:r,zi:s}}))}(t,i,e.documentUpdates).next((t=>{a=t.Wi,c=t.zi}))),!r.isEqual(Yi.min())){const e=n.Cs.getLastRemoteSnapshotVersion(t).next((e=>n.Cs.setTargetsMetadata(t,t.currentSequenceNumber,r)));o.push(e)}return co.waitFor(o).next((()=>i.apply(t))).next((()=>n.localDocuments.getLocalViewOfDocuments(t,a,c))).next((()=>a))})).then((t=>(n.qi=s,t)))}function Wu(t,e){const n=Li(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(t=>(void 0===e&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(t,e))))}async function zu(t,e,n){const r=Li(t),s=r.qi.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,(t=>r.persistence.referenceDelegate.removeTarget(t,s)))}catch(t){if(!uo(t))throw t;Ci("LocalStore",`Failed to update sequence numbers for target ${e}: ${t}`)}r.qi=r.qi.remove(e),r.Ui.delete(s.target)}function Gu(t,e,n){const r=Li(t);let s=Yi.min(),i=Oc();return r.persistence.runTransaction("Execute query","readonly",(t=>function(t,e,n){const r=Li(t),s=r.Ui.get(n);return void 0!==s?co.resolve(r.qi.get(s)):r.Cs.getTargetData(e,n)}(r,t,Ra(e)).next((e=>{if(e)return s=e.lastLimboFreeSnapshotVersion,r.Cs.getMatchingKeysForTargetId(t,e.targetId).next((t=>{i=t}))})).next((()=>r.Li.getDocumentsMatchingQuery(t,e,n?s:Yi.min(),n?i:Oc()))).next((t=>(function(t,e,n){let r=t.Ki.get(e)||Yi.min();n.forEach(((t,e)=>{e.readTime.compareTo(r)>0&&(r=e.readTime)})),t.Ki.set(e,r)}(r,function(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}(e),t),{documents:t,Hi:i})))))}class Qu{constructor(){this.activeTargetIds=Lc()}er(t){this.activeTargetIds=this.activeTargetIds.add(t)}nr(t){this.activeTargetIds=this.activeTargetIds.delete(t)}tr(){const t={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(t)}}class Yu{constructor(){this.Lr=new Qu,this.qr={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(t){}updateMutationState(t,e,n){}addLocalQueryTarget(t){return this.Lr.er(t),this.qr[t]||"not-current"}updateQueryState(t,e,n){this.qr[t]=e}removeLocalQueryTarget(t){this.Lr.nr(t)}isLocalQueryTarget(t){return this.Lr.activeTargetIds.has(t)}clearQueryState(t){delete this.qr[t]}getAllActiveQueryTargets(){return this.Lr.activeTargetIds}isActiveQueryTarget(t){return this.Lr.activeTargetIds.has(t)}start(){return this.Lr=new Qu,Promise.resolve()}handleUserChange(t,e,n){}setOnlineState(t){}shutdown(){}writeSequenceNumber(t){}notifyBundleLoaded(t){}}
1427
1427
  /**
1428
1428
  * @license
1429
1429
  * Copyright 2019 Google LLC
@@ -1535,7 +1535,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1535
1535
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1536
1536
  * See the License for the specific language governing permissions and
1537
1537
  * limitations under the License.
1538
- */class ih{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new sh(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Pi.RESOURCE_EXHAUSTED?(ki(e.toString()),ki("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Pi.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Mi(Pi.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Ci("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ci("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class oh extends ih{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Oi()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Di(void 0===e||"string"==typeof e),wo.fromBase64String(e||"")):(Di(void 0===e||e instanceof Uint8Array),wo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Pi.UNKNOWN:wc(t.code);return new Mi(e,t.message||"")}(o);n=new Fc(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=tu(t,r.document.name),i=Yc(r.document.updateTime),o=r.document.createTime?Yc(r.document.createTime):Yi.min(),a=new ga({mapValue:{fields:r.document.fields}}),c=ya.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new xc(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=tu(t,r.document),i=r.readTime?Yc(r.readTime):Yi.min(),o=ya.newNoDocument(s,i),a=r.removedTargetIds||[];n=new xc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=tu(t,r.document),i=r.removedTargetIds||[];n=new xc([],i,s,null)}else{if(!("filter"in e))return Oi();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new mc(r),i=t.targetId;n=new Uc(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Yi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Yi.min():e.readTime?Yc(e.readTime):Yi.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=nu(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ea(r)?{documents:iu(t,r)}:{query:ou(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=zc(t,e.resumeToken):e.snapshotVersion.compareTo(Yi.min())>0&&(n.readTime=Gc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Oi()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=nu(this.yt),e.removeTarget=t,this.Bo(e)}}class ah extends ih{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.yt=s,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Di(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Di(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Yc(t.updateTime):Yc(e);return n.isEqual(Yi.min())&&(n=Yc(e)),new tc(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Yc(t.commitTime);return this.listener.Zo(n,e)}return Di(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=nu(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:su(t,e.key,e.value)};else if(e instanceof pc)n={delete:Zc(t,e.key)};else if(e instanceof hc)n={update:su(t,e.key,e.data),updateMask:gu(e.fieldMask)};else{if(!(e instanceof gc))return Oi();n={verify:Zc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof Ga)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Qa)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ja)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Oi()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Qc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Oi()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1538
+ */class ih{constructor(t,e,n,r,s,i,o,a){this.Hs=t,this.vo=n,this.Vo=r,this.connection=s,this.authCredentialsProvider=i,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.So=0,this.Do=null,this.Co=null,this.stream=null,this.xo=new sh(t,e)}No(){return 1===this.state||5===this.state||this.ko()}ko(){return 2===this.state||3===this.state}start(){4!==this.state?this.auth():this.Oo()}async stop(){this.No()&&await this.close(0)}Mo(){this.state=0,this.xo.reset()}Fo(){this.ko()&&null===this.Do&&(this.Do=this.Hs.enqueueAfterDelay(this.vo,6e4,(()=>this.$o())))}Bo(t){this.Lo(),this.stream.send(t)}async $o(){if(this.ko())return this.close(0)}Lo(){this.Do&&(this.Do.cancel(),this.Do=null)}qo(){this.Co&&(this.Co.cancel(),this.Co=null)}async close(t,e){this.Lo(),this.qo(),this.xo.cancel(),this.So++,4!==t?this.xo.reset():e&&e.code===Pi.RESOURCE_EXHAUSTED?(ki(e.toString()),ki("Using maximum backoff delay to prevent overloading the backend."),this.xo.Ao()):e&&e.code===Pi.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.Uo(),this.stream.close(),this.stream=null),this.state=t,await this.listener.Zr(e)}Uo(){}auth(){this.state=1;const t=this.Ko(this.So),e=this.So;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then((([t,n])=>{this.So===e&&this.Go(t,n)}),(e=>{t((()=>{const t=new Mi(Pi.UNKNOWN,"Fetching auth token failed: "+e.message);return this.Qo(t)}))}))}Go(t,e){const n=this.Ko(this.So);this.stream=this.jo(t,e),this.stream.Yr((()=>{n((()=>(this.state=2,this.Co=this.Hs.enqueueAfterDelay(this.Vo,1e4,(()=>(this.ko()&&(this.state=3),Promise.resolve()))),this.listener.Yr())))})),this.stream.Zr((t=>{n((()=>this.Qo(t)))})),this.stream.onMessage((t=>{n((()=>this.onMessage(t)))}))}Oo(){this.state=5,this.xo.Ro((async()=>{this.state=0,this.start()}))}Qo(t){return Ci("PersistentStream",`close with error: ${t}`),this.stream=null,this.close(4,t)}Ko(t){return e=>{this.Hs.enqueueAndForget((()=>this.So===t?e():(Ci("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class oh extends ih{constructor(t,e,n,r,s,i){super(t,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",e,n,r,i),this.yt=s}jo(t,e){return this.connection.wo("Listen",t,e)}onMessage(t){this.xo.reset();const e=function(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(t){return"NO_CHANGE"===t?0:"ADD"===t?1:"REMOVE"===t?2:"CURRENT"===t?3:"RESET"===t?4:Oi()}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(t,e){return t.wt?(Di(void 0===e||"string"==typeof e),wo.fromBase64String(e||"")):(Di(void 0===e||e instanceof Uint8Array),wo.fromUint8Array(e||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,a=o&&function(t){const e=void 0===t.code?Pi.UNKNOWN:wc(t.code);return new Mi(e,t.message||"")}(o);n=new Fc(r,s,i,a||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=tu(t,r.document.name),i=Yc(r.document.updateTime),o=r.document.createTime?Yc(r.document.createTime):Yi.min(),a=new ga({mapValue:{fields:r.document.fields}}),c=ya.newFoundDocument(s,i,o,a),u=r.targetIds||[],h=r.removedTargetIds||[];n=new xc(u,h,c.key,c)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=tu(t,r.document),i=r.readTime?Yc(r.readTime):Yi.min(),o=ya.newNoDocument(s,i),a=r.removedTargetIds||[];n=new xc([],a,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=tu(t,r.document),i=r.removedTargetIds||[];n=new xc([],i,s,null)}else{if(!("filter"in e))return Oi();{e.filter;const t=e.filter;t.targetId;const r=t.count||0,s=new mc(r),i=t.targetId;n=new Uc(i,s)}}return n}(this.yt,t),n=function(t){if(!("targetChange"in t))return Yi.min();const e=t.targetChange;return e.targetIds&&e.targetIds.length?Yi.min():e.readTime?Yc(e.readTime):Yi.min()}(t);return this.listener.Wo(e,n)}zo(t){const e={};e.database=nu(this.yt),e.addTarget=function(t,e){let n;const r=e.target;return n=Ea(r)?{documents:iu(t,r)}:{query:ou(t,r)},n.targetId=e.targetId,e.resumeToken.approximateByteSize()>0?n.resumeToken=Gc(t,e.resumeToken):e.snapshotVersion.compareTo(Yi.min())>0&&(n.readTime=zc(t,e.snapshotVersion.toTimestamp())),n}(this.yt,t);const n=function(t,e){const n=function(t,e){switch(e){case 0:return null;case 1:return"existence-filter-mismatch";case 2:return"limbo-document";default:return Oi()}}(0,e.purpose);return null==n?null:{"goog-listen-tags":n}}(this.yt,t);n&&(e.labels=n),this.Bo(e)}Ho(t){const e={};e.database=nu(this.yt),e.removeTarget=t,this.Bo(e)}}class ah extends ih{constructor(t,e,n,r,s,i){super(t,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",e,n,r,i),this.yt=s,this.Jo=!1}get Yo(){return this.Jo}start(){this.Jo=!1,this.lastStreamToken=void 0,super.start()}Uo(){this.Jo&&this.Xo([])}jo(t,e){return this.connection.wo("Write",t,e)}onMessage(t){if(Di(!!t.streamToken),this.lastStreamToken=t.streamToken,this.Jo){this.xo.reset();const e=function(t,e){return t&&t.length>0?(Di(void 0!==e),t.map((t=>function(t,e){let n=t.updateTime?Yc(t.updateTime):Yc(e);return n.isEqual(Yi.min())&&(n=Yc(e)),new tc(n,t.transformResults||[])}(t,e)))):[]}(t.writeResults,t.commitTime),n=Yc(t.commitTime);return this.listener.Zo(n,e)}return Di(!t.writeResults||0===t.writeResults.length),this.Jo=!0,this.listener.tu()}eu(){const t={};t.database=nu(this.yt),this.Bo(t)}Xo(t){const e={streamToken:this.lastStreamToken,writes:t.map((t=>function(t,e){let n;if(e instanceof uc)n={update:su(t,e.key,e.value)};else if(e instanceof pc)n={delete:Zc(t,e.key)};else if(e instanceof hc)n={update:su(t,e.key,e.data),updateMask:gu(e.fieldMask)};else{if(!(e instanceof gc))return Oi();n={verify:Zc(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((t=>function(t,e){const n=e.transform;if(n instanceof Wa)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof za)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof Qa)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof Ja)return{fieldPath:e.field.canonicalString(),increment:n.gt};throw Oi()}(0,t)))),e.precondition.isNone||(n.currentDocument=function(t,e){return void 0!==e.updateTime?{updateTime:Qc(t,e.updateTime)}:void 0!==e.exists?{exists:e.exists}:Oi()}(t,e.precondition)),n}(this.yt,t)))};this.Bo(e)}}
1539
1539
  /**
1540
1540
  * @license
1541
1541
  * Copyright 2017 Google LLC
@@ -1647,7 +1647,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1647
1647
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1648
1648
  * See the License for the specific language governing permissions and
1649
1649
  * limitations under the License.
1650
- */class $h{constructor(){this.Au=void 0,this.listeners=[]}}class qh{constructor(){this.queries=new _c((t=>Pa(t)),La),this.onlineState="Unknown",this.Ru=new Set}}async function Kh(t,e){const n=Li(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new $h),s)try{i.Au=await n.onListen(r)}catch(t){const n=Vh(t,`Initialization of query '${Ma(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Qh(n)}async function Wh(t,e){const n=Li(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function Gh(t,e){const n=Li(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.listeners)e.Pu(t)&&(r=!0);s.Au=t}}r&&Qh(n)}function zh(t,e,n){const r=Li(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Qh(t){t.Ru.forEach((t=>{t.next()}))}class Yh{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new jh(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=jh.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1650
+ */class $h{constructor(){this.Au=void 0,this.listeners=[]}}class qh{constructor(){this.queries=new _c((t=>Pa(t)),La),this.onlineState="Unknown",this.Ru=new Set}}async function Kh(t,e){const n=Li(t),r=e.query;let s=!1,i=n.queries.get(r);if(i||(s=!0,i=new $h),s)try{i.Au=await n.onListen(r)}catch(t){const n=Vh(t,`Initialization of query '${Ma(e.query)}' failed`);return void e.onError(n)}n.queries.set(r,i),i.listeners.push(e),e.bu(n.onlineState),i.Au&&e.Pu(i.Au)&&Qh(n)}async function Wh(t,e){const n=Li(t),r=e.query;let s=!1;const i=n.queries.get(r);if(i){const t=i.listeners.indexOf(e);t>=0&&(i.listeners.splice(t,1),s=0===i.listeners.length)}if(s)return n.queries.delete(r),n.onUnlisten(r)}function zh(t,e){const n=Li(t);let r=!1;for(const t of e){const e=t.query,s=n.queries.get(e);if(s){for(const e of s.listeners)e.Pu(t)&&(r=!0);s.Au=t}}r&&Qh(n)}function Gh(t,e,n){const r=Li(t),s=r.queries.get(e);if(s)for(const t of s.listeners)t.onError(n);r.queries.delete(e)}function Qh(t){t.Ru.forEach((t=>{t.next()}))}class Yh{constructor(t,e,n){this.query=t,this.vu=e,this.Vu=!1,this.Su=null,this.onlineState="Unknown",this.options=n||{}}Pu(t){if(!this.options.includeMetadataChanges){const e=[];for(const n of t.docChanges)3!==n.type&&e.push(n);t=new jh(t.query,t.docs,t.oldDocs,e,t.mutatedKeys,t.fromCache,t.syncStateChanged,!0,t.hasCachedResults)}let e=!1;return this.Vu?this.Du(t)&&(this.vu.next(t),e=!0):this.Cu(t,this.onlineState)&&(this.xu(t),e=!0),this.Su=t,e}onError(t){this.vu.error(t)}bu(t){this.onlineState=t;let e=!1;return this.Su&&!this.Vu&&this.Cu(this.Su,t)&&(this.xu(this.Su),e=!0),e}Cu(t,e){if(!t.fromCache)return!0;const n="Offline"!==e;return(!this.options.Nu||!n)&&(!t.docs.isEmpty()||t.hasCachedResults||"Offline"===e)}Du(t){if(t.docChanges.length>0)return!0;const e=this.Su&&this.Su.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges}xu(t){t=jh.fromInitialDocuments(t.query,t.docs,t.mutatedKeys,t.fromCache,t.hasCachedResults),this.Vu=!0,this.vu.next(t)}}
1651
1651
  /**
1652
1652
  * @license
1653
1653
  * Copyright 2017 Google LLC
@@ -1679,7 +1679,7 @@ class _c{constructor(t,e){this.mapKeyFn=t,this.equalsFn=e,this.inner={},this.inn
1679
1679
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1680
1680
  * See the License for the specific language governing permissions and
1681
1681
  * limitations under the License.
1682
- */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new jh(this.query,t.Qu,r,s,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hh,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Xh(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Jh(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return jh.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class tl{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class el{constructor(t){this.key=t,this.nc=!1}}class nl{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _c((t=>Pa(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new ua(eo.comparator),this.cc=new Map,this.ac=new Ou,this.hc={},this.lc=new Map,this.fc=bu.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function rl(t,e){const n=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ol.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=_l.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=cl.bind(null,e),e.sc.Wo=Gh.bind(null,e.eventManager),e.sc.wc=zh.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,co.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new _u(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Ra(e));n.isPrimaryClient&&fh(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await zu(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return gl(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await zu(t.localStore,e,!0),o=new Zh(e,i.Hi),a=o.Wu(i.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);gl(t,n,u.Xu);const h=new tl(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,r,"current"===i,t.resumeToken)}return s}async function sl(t,e){const n=Li(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await Gu(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),ph(n.remoteStore,r.targetId),fl(n,r.targetId)})).catch(ao)):(fl(n,r.targetId),await Gu(n.localStore,r.targetId,!0))}async function il(t,e,n){const r=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ul.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hl.bind(null,e),e}(t);try{const t=await function(t,e){const n=Li(t),r=Qi.now(),s=e.reduce(((t,e)=>t.add(e.key)),Oc());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=Ec(),c=Oc();return n.Gi.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=ac(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ma(e.value.mapValue),ec.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:bc(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new ua(Gi)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await vl(r,t.changes),await Ah(r.remoteStore)}catch(t){const e=Vh(t,"Failed to persist write");n.reject(e)}}async function ol(t,e){const n=Li(t);try{const t=await Ku(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Di(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Di(r.nc):t.removedDocuments.size>0&&(Di(r.nc),r.nc=!1))})),await vl(n,t,e)}catch(t){await ao(t)}}function al(t,e,n){const r=Li(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Li(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Qh(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function cl(t,e,n){const r=Li(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new ua(eo.comparator);t=t.insert(i,ya.newNoDocument(i,Yi.min()));const n=Oc().add(i),s=new Pc(Yi.min(),new Map,new da(Gi),t,n);await ol(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),yl(r)}else await Gu(r.localStore,e,!1).then((()=>fl(r,e,n))).catch(ao)}async function ul(t,e){const n=Li(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=co.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Di(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Oc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);dl(n,r,null),ll(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await vl(n,t)}catch(t){await ao(t)}}async function hl(t,e,n){const r=Li(t);try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Di(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);dl(r,e,n),ll(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await vl(r,t)}catch(n){await ao(n)}}function ll(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function dl(t,e,n){const r=Li(t);let s=r.hc[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.hc[r.currentUser.toKey()]=s}}function fl(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||pl(t,e)}))}function pl(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ph(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),yl(t))}function gl(t,e,n){for(const r of n)r instanceof Jh?(t.ac.addReference(r.key,e),ml(t,r)):r instanceof Xh?(Ci("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||pl(t,r.key)):Oi()}function ml(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ci("SyncEngine","New document in limbo: "+n),t.oc.add(r),yl(t))}function yl(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new eo(Xi.fromString(e)),r=t.fc.next();t.cc.set(r,new el(n)),t.uc=t.uc.insert(n,r),fh(t.remoteStore,new _u(Ra(Ia(n.path)),r,2,ho.at))}}async function vl(t,e,n){const r=Li(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Bu.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Li(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>co.forEach(e,(e=>co.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>co.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!uo(t))throw t;Ci("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function wl(t,e){const n=Li(t);if(!n.currentUser.isEqual(e)){Ci("SyncEngine","User change. New user:",e.toKey());const t=await $u(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Mi(Pi.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await vl(n,t.ji)}}function _l(t,e){const n=Li(t),r=n.cc.get(e);if(r&&r.nc)return Oc().add(r.key);{let t=Oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Tl{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=rh(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new ju(t,e,n,r)}(this.persistence,new Hu,t.initialUser,this.yt)}yc(t){return new Uu(Vu.Bs,this.yt)}gc(t){return new Yu}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class El{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>al(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=wl.bind(null,this.syncEngine),await async function(t,e){const n=Li(t);e?(n._u.delete(2),await lh(n)):e||(n._u.add(2),await dh(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new qh}createDatastore(t){const e=rh(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new eh(r));var r;return function(t,e,n,r){return new ch(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>al(this.syncEngine,t,0),i=Xu.C()?new Xu:new Ju,new hh(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new nl(t,e,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Li(t);Ci("RemoteStore","RemoteStore shutting down."),e._u.add(5),await dh(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1682
+ */(t.type,e.type)||this.Gu(t.doc,e.doc))),this.Ju(n);const i=e?this.Yu():[],o=0===this.Ku.size&&this.current?1:0,a=o!==this.Uu;return this.Uu=o,0!==s.length||a?{snapshot:new jh(this.query,t.Qu,r,s,t.mutatedKeys,0===o,a,!1,!!n&&n.resumeToken.approximateByteSize()>0),Xu:i}:{Xu:i}}bu(t){return this.current&&"Offline"===t?(this.current=!1,this.applyChanges({Qu:this.Qu,zu:new Hh,mutatedKeys:this.mutatedKeys,$i:!1},!1)):{Xu:[]}}Zu(t){return!this.qu.has(t)&&!!this.Qu.has(t)&&!this.Qu.get(t).hasLocalMutations}Ju(t){t&&(t.addedDocuments.forEach((t=>this.qu=this.qu.add(t))),t.modifiedDocuments.forEach((t=>{})),t.removedDocuments.forEach((t=>this.qu=this.qu.delete(t))),this.current=t.current)}Yu(){if(!this.current)return[];const t=this.Ku;this.Ku=Oc(),this.Qu.forEach((t=>{this.Zu(t.key)&&(this.Ku=this.Ku.add(t.key))}));const e=[];return t.forEach((t=>{this.Ku.has(t)||e.push(new Xh(t))})),this.Ku.forEach((n=>{t.has(n)||e.push(new Jh(n))})),e}tc(t){this.qu=t.Hi,this.Ku=Oc();const e=this.Wu(t.documents);return this.applyChanges(e,!0)}ec(){return jh.fromInitialDocuments(this.query,this.Qu,this.mutatedKeys,0===this.Uu,this.hasCachedResults)}}class tl{constructor(t,e,n){this.query=t,this.targetId=e,this.view=n}}class el{constructor(t){this.key=t,this.nc=!1}}class nl{constructor(t,e,n,r,s,i){this.localStore=t,this.remoteStore=e,this.eventManager=n,this.sharedClientState=r,this.currentUser=s,this.maxConcurrentLimboResolutions=i,this.sc={},this.ic=new _c((t=>Pa(t)),La),this.rc=new Map,this.oc=new Set,this.uc=new ua(eo.comparator),this.cc=new Map,this.ac=new Ou,this.hc={},this.lc=new Map,this.fc=bu.vn(),this.onlineState="Unknown",this.dc=void 0}get isPrimaryClient(){return!0===this.dc}}async function rl(t,e){const n=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=ol.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=_l.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=cl.bind(null,e),e.sc.Wo=zh.bind(null,e.eventManager),e.sc.wc=Gh.bind(null,e.eventManager),e}(t);let r,s;const i=n.ic.get(e);if(i)r=i.targetId,n.sharedClientState.addLocalQueryTarget(r),s=i.view.ec();else{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Allocate target","readwrite",(t=>{let r;return n.Cs.getTargetData(t,e).next((s=>s?(r=s,co.resolve(r)):n.Cs.allocateTargetId(t).next((s=>(r=new _u(e,s,0,t.currentSequenceNumber),n.Cs.addTargetData(t,r).next((()=>r)))))))})).then((t=>{const r=n.qi.get(t.targetId);return(null===r||t.snapshotVersion.compareTo(r.snapshotVersion)>0)&&(n.qi=n.qi.insert(t.targetId,t),n.Ui.set(e,t.targetId)),t}))}(n.localStore,Ra(e));n.isPrimaryClient&&fh(n.remoteStore,t);const i=n.sharedClientState.addLocalQueryTarget(t.targetId);r=t.targetId,s=await async function(t,e,n,r,s){t._c=(e,n,r)=>async function(t,e,n,r){let s=e.view.Wu(n);s.$i&&(s=await Gu(t.localStore,e.query,!1).then((({documents:t})=>e.view.Wu(t,s))));const i=r&&r.targetChanges.get(e.targetId),o=e.view.applyChanges(s,t.isPrimaryClient,i);return gl(t,e.targetId,o.Xu),o.snapshot}(t,e,n,r);const i=await Gu(t.localStore,e,!0),o=new Zh(e,i.Hi),a=o.Wu(i.documents),c=Mc.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==t.onlineState,s),u=o.applyChanges(a,t.isPrimaryClient,c);gl(t,n,u.Xu);const h=new tl(e,n,o);return t.ic.set(e,h),t.rc.has(n)?t.rc.get(n).push(e):t.rc.set(n,[e]),u.snapshot}(n,e,r,"current"===i,t.resumeToken)}return s}async function sl(t,e){const n=Li(t),r=n.ic.get(e),s=n.rc.get(r.targetId);if(s.length>1)return n.rc.set(r.targetId,s.filter((t=>!La(t,e)))),void n.ic.delete(e);n.isPrimaryClient?(n.sharedClientState.removeLocalQueryTarget(r.targetId),n.sharedClientState.isActiveQueryTarget(r.targetId)||await zu(n.localStore,r.targetId,!1).then((()=>{n.sharedClientState.clearQueryState(r.targetId),ph(n.remoteStore,r.targetId),fl(n,r.targetId)})).catch(ao)):(fl(n,r.targetId),await zu(n.localStore,r.targetId,!0))}async function il(t,e,n){const r=function(t){const e=Li(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=ul.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=hl.bind(null,e),e}(t);try{const t=await function(t,e){const n=Li(t),r=Qi.now(),s=e.reduce(((t,e)=>t.add(e.key)),Oc());let i,o;return n.persistence.runTransaction("Locally write mutations","readwrite",(t=>{let a=Ec(),c=Oc();return n.Gi.getEntries(t,s).next((t=>{a=t,a.forEach(((t,e)=>{e.isValidDocument()||(c=c.add(t))}))})).next((()=>n.localDocuments.getOverlayedDocuments(t,a))).next((s=>{i=s;const o=[];for(const t of e){const e=ac(t,i.get(t.key).overlayedDocument);null!=e&&o.push(new hc(t.key,e,ma(e.value.mapValue),ec.exists(!0)))}return n.mutationQueue.addMutationBatch(t,r,o,e)})).next((e=>{o=e;const r=e.applyToLocalDocumentSet(i,c);return n.documentOverlayCache.saveOverlays(t,e.batchId,r)}))})).then((()=>({batchId:o.batchId,changes:bc(i)})))}(r.localStore,e);r.sharedClientState.addPendingMutation(t.batchId),function(t,e,n){let r=t.hc[t.currentUser.toKey()];r||(r=new ua(zi)),r=r.insert(e,n),t.hc[t.currentUser.toKey()]=r}(r,t.batchId,n),await vl(r,t.changes),await Ah(r.remoteStore)}catch(t){const e=Vh(t,"Failed to persist write");n.reject(e)}}async function ol(t,e){const n=Li(t);try{const t=await Ku(n.localStore,e);e.targetChanges.forEach(((t,e)=>{const r=n.cc.get(e);r&&(Di(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1),t.addedDocuments.size>0?r.nc=!0:t.modifiedDocuments.size>0?Di(r.nc):t.removedDocuments.size>0&&(Di(r.nc),r.nc=!1))})),await vl(n,t,e)}catch(t){await ao(t)}}function al(t,e,n){const r=Li(t);if(r.isPrimaryClient&&0===n||!r.isPrimaryClient&&1===n){const t=[];r.ic.forEach(((n,r)=>{const s=r.view.bu(e);s.snapshot&&t.push(s.snapshot)})),function(t,e){const n=Li(t);n.onlineState=e;let r=!1;n.queries.forEach(((t,n)=>{for(const t of n.listeners)t.bu(e)&&(r=!0)})),r&&Qh(n)}(r.eventManager,e),t.length&&r.sc.Wo(t),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function cl(t,e,n){const r=Li(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.cc.get(e),i=s&&s.key;if(i){let t=new ua(eo.comparator);t=t.insert(i,ya.newNoDocument(i,Yi.min()));const n=Oc().add(i),s=new Pc(Yi.min(),new Map,new da(zi),t,n);await ol(r,s),r.uc=r.uc.remove(i),r.cc.delete(e),yl(r)}else await zu(r.localStore,e,!1).then((()=>fl(r,e,n))).catch(ao)}async function ul(t,e){const n=Li(t),r=e.batch.batchId;try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(t=>{const r=e.batch.keys(),s=n.Gi.newChangeBuffer({trackRemovals:!0});return function(t,e,n,r){const s=n.batch,i=s.keys();let o=co.resolve();return i.forEach((t=>{o=o.next((()=>r.getEntry(e,t))).next((e=>{const i=n.docVersions.get(t);Di(null!==i),e.version.compareTo(i)<0&&(s.applyToRemoteDocument(e,n),e.isValidDocument()&&(e.setReadTime(n.commitVersion),r.addEntry(e)))}))})),o.next((()=>t.mutationQueue.removeMutationBatch(e,s)))}(n,t,e,s).next((()=>s.apply(t))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,function(t){let e=Oc();for(let n=0;n<t.mutationResults.length;++n)t.mutationResults[n].transformResults.length>0&&(e=e.add(t.batch.mutations[n].key));return e}(e)))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(n.localStore,e);dl(n,r,null),ll(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await vl(n,t)}catch(t){await ao(t)}}async function hl(t,e,n){const r=Li(t);try{const t=await function(t,e){const n=Li(t);return n.persistence.runTransaction("Reject batch","readwrite-primary",(t=>{let r;return n.mutationQueue.lookupMutationBatch(t,e).next((e=>(Di(null!==e),r=e.keys(),n.mutationQueue.removeMutationBatch(t,e)))).next((()=>n.mutationQueue.performConsistencyCheck(t))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(t,r,e))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(t,r))).next((()=>n.localDocuments.getDocuments(t,r)))}))}(r.localStore,e);dl(r,e,n),ll(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await vl(r,t)}catch(n){await ao(n)}}function ll(t,e){(t.lc.get(e)||[]).forEach((t=>{t.resolve()})),t.lc.delete(e)}function dl(t,e,n){const r=Li(t);let s=r.hc[r.currentUser.toKey()];if(s){const t=s.get(e);t&&(n?t.reject(n):t.resolve(),s=s.remove(e)),r.hc[r.currentUser.toKey()]=s}}function fl(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.rc.get(e))t.ic.delete(r),n&&t.sc.wc(r,n);t.rc.delete(e),t.isPrimaryClient&&t.ac.ls(e).forEach((e=>{t.ac.containsKey(e)||pl(t,e)}))}function pl(t,e){t.oc.delete(e.path.canonicalString());const n=t.uc.get(e);null!==n&&(ph(t.remoteStore,n),t.uc=t.uc.remove(e),t.cc.delete(n),yl(t))}function gl(t,e,n){for(const r of n)r instanceof Jh?(t.ac.addReference(r.key,e),ml(t,r)):r instanceof Xh?(Ci("SyncEngine","Document no longer in limbo: "+r.key),t.ac.removeReference(r.key,e),t.ac.containsKey(r.key)||pl(t,r.key)):Oi()}function ml(t,e){const n=e.key,r=n.path.canonicalString();t.uc.get(n)||t.oc.has(r)||(Ci("SyncEngine","New document in limbo: "+n),t.oc.add(r),yl(t))}function yl(t){for(;t.oc.size>0&&t.uc.size<t.maxConcurrentLimboResolutions;){const e=t.oc.values().next().value;t.oc.delete(e);const n=new eo(Xi.fromString(e)),r=t.fc.next();t.cc.set(r,new el(n)),t.uc=t.uc.insert(n,r),fh(t.remoteStore,new _u(Ra(Ia(n.path)),r,2,ho.at))}}async function vl(t,e,n){const r=Li(t),s=[],i=[],o=[];r.ic.isEmpty()||(r.ic.forEach(((t,a)=>{o.push(r._c(a,e,n).then((t=>{if((t||n)&&r.isPrimaryClient&&r.sharedClientState.updateQueryState(a.targetId,(null==t?void 0:t.fromCache)?"not-current":"current"),t){s.push(t);const e=Bu.Ci(a.targetId,t);i.push(e)}})))})),await Promise.all(o),r.sc.Wo(s),await async function(t,e){const n=Li(t);try{await n.persistence.runTransaction("notifyLocalViewChanges","readwrite",(t=>co.forEach(e,(e=>co.forEach(e.Si,(r=>n.persistence.referenceDelegate.addReference(t,e.targetId,r))).next((()=>co.forEach(e.Di,(r=>n.persistence.referenceDelegate.removeReference(t,e.targetId,r)))))))))}catch(t){if(!uo(t))throw t;Ci("LocalStore","Failed to update sequence numbers: "+t)}for(const t of e){const e=t.targetId;if(!t.fromCache){const t=n.qi.get(e),r=t.snapshotVersion,s=t.withLastLimboFreeSnapshotVersion(r);n.qi=n.qi.insert(e,s)}}}(r.localStore,i))}async function wl(t,e){const n=Li(t);if(!n.currentUser.isEqual(e)){Ci("SyncEngine","User change. New user:",e.toKey());const t=await $u(n.localStore,e);n.currentUser=e,function(t,e){t.lc.forEach((t=>{t.forEach((t=>{t.reject(new Mi(Pi.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))}))})),t.lc.clear()}(n),n.sharedClientState.handleUserChange(e,t.removedBatchIds,t.addedBatchIds),await vl(n,t.ji)}}function _l(t,e){const n=Li(t),r=n.cc.get(e);if(r&&r.nc)return Oc().add(r.key);{let t=Oc();const r=n.rc.get(e);if(!r)return t;for(const e of r){const r=n.ic.get(e);t=t.unionWith(r.view.ju)}return t}}class Tl{constructor(){this.synchronizeTabs=!1}async initialize(t){this.yt=rh(t.databaseInfo.databaseId),this.sharedClientState=this.gc(t),this.persistence=this.yc(t),await this.persistence.start(),this.localStore=this.Ic(t),this.gcScheduler=this.Tc(t,this.localStore),this.indexBackfillerScheduler=this.Ec(t,this.localStore)}Tc(t,e){return null}Ec(t,e){return null}Ic(t){return function(t,e,n,r){return new ju(t,e,n,r)}(this.persistence,new Hu,t.initialUser,this.yt)}yc(t){return new Uu(Vu.Bs,this.yt)}gc(t){return new Yu}async terminate(){this.gcScheduler&&this.gcScheduler.stop(),await this.sharedClientState.shutdown(),await this.persistence.shutdown()}}class El{async initialize(t,e){this.localStore||(this.localStore=t.localStore,this.sharedClientState=t.sharedClientState,this.datastore=this.createDatastore(e),this.remoteStore=this.createRemoteStore(e),this.eventManager=this.createEventManager(e),this.syncEngine=this.createSyncEngine(e,!t.synchronizeTabs),this.sharedClientState.onlineStateHandler=t=>al(this.syncEngine,t,1),this.remoteStore.remoteSyncer.handleCredentialChange=wl.bind(null,this.syncEngine),await async function(t,e){const n=Li(t);e?(n._u.delete(2),await lh(n)):e||(n._u.add(2),await dh(n),n.gu.set("Unknown"))}(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(t){return new qh}createDatastore(t){const e=rh(t.databaseInfo.databaseId),n=(r=t.databaseInfo,new eh(r));var r;return function(t,e,n,r){return new ch(t,e,n,r)}(t.authCredentials,t.appCheckCredentials,n,e)}createRemoteStore(t){return e=this.localStore,n=this.datastore,r=t.asyncQueue,s=t=>al(this.syncEngine,t,0),i=Xu.C()?new Xu:new Ju,new hh(e,n,r,s,i);var e,n,r,s,i}createSyncEngine(t,e){return function(t,e,n,r,s,i,o){const a=new nl(t,e,n,r,s,i);return o&&(a.dc=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,t.initialUser,t.maxConcurrentLimboResolutions,e)}terminate(){return async function(t){const e=Li(t);Ci("RemoteStore","RemoteStore shutting down."),e._u.add(5),await dh(e),e.mu.shutdown(),e.gu.set("Unknown")}(this.remoteStore)}}
1683
1683
  /**
1684
1684
  * @license
1685
1685
  * Copyright 2017 Google LLC
@@ -1904,7 +1904,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1904
1904
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1905
1905
  * See the License for the specific language governing permissions and
1906
1906
  * limitations under the License.
1907
- */class Gl{constructor(t){this._byteString=t}static fromBase64String(t){try{return new Gl(wo.fromBase64String(t))}catch(t){throw new Mi(Pi.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new Gl(wo.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
1907
+ */class zl{constructor(t){this._byteString=t}static fromBase64String(t){try{return new zl(wo.fromBase64String(t))}catch(t){throw new Mi(Pi.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+t)}}static fromUint8Array(t){return new zl(wo.fromUint8Array(t))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(t){return this._byteString.isEqual(t._byteString)}}
1908
1908
  /**
1909
1909
  * @license
1910
1910
  * Copyright 2020 Google LLC
@@ -1920,7 +1920,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1920
1920
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1921
1921
  * See the License for the specific language governing permissions and
1922
1922
  * limitations under the License.
1923
- */class zl{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new to(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}
1923
+ */class Gl{constructor(...t){for(let e=0;e<t.length;++e)if(0===t[e].length)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new to(t)}isEqual(t){return this._internalPath.isEqual(t._internalPath)}}function Ql(){return new Gl("__name__")}
1924
1924
  /**
1925
1925
  * @license
1926
1926
  * Copyright 2020 Google LLC
@@ -1936,8 +1936,7 @@ function(t,e){if(t.uid)throw new Error('The "uid" field is no longer supported b
1936
1936
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1937
1937
  * See the License for the specific language governing permissions and
1938
1938
  * limitations under the License.
1939
- */
1940
- class Ql{constructor(t){this._methodName=t}}
1939
+ */class Yl{constructor(t){this._methodName=t}}
1941
1940
  /**
1942
1941
  * @license
1943
1942
  * Copyright 2017 Google LLC
@@ -1953,7 +1952,7 @@ class Ql{constructor(t){this._methodName=t}}
1953
1952
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1954
1953
  * See the License for the specific language governing permissions and
1955
1954
  * limitations under the License.
1956
- */class Yl{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Mi(Pi.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Mi(Pi.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return Gi(this._lat,t._lat)||Gi(this._long,t._long)}}
1955
+ */class Jl{constructor(t,e){if(!isFinite(t)||t<-90||t>90)throw new Mi(Pi.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new Mi(Pi.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}get latitude(){return this._lat}get longitude(){return this._long}isEqual(t){return this._lat===t._lat&&this._long===t._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(t){return zi(this._lat,t._lat)||zi(this._long,t._long)}}
1957
1956
  /**
1958
1957
  * @license
1959
1958
  * Copyright 2017 Google LLC
@@ -1969,7 +1968,7 @@ class Ql{constructor(t){this._methodName=t}}
1969
1968
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1970
1969
  * See the License for the specific language governing permissions and
1971
1970
  * limitations under the License.
1972
- */const Jl=/^__.*__$/;class Xl{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function Zl(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Oi()}}class td{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new td(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return ld(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(Zl(this.sa)&&Jl.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class ed{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||rh(t)}da(t,e,n,r=!1){return new td({sa:t,methodName:e,fa:n,path:to.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function nd(t){const e=t._freezeSettings(),n=rh(t._databaseId);return new ed(t._databaseId,!!e.ignoreUndefinedProperties,n)}function rd(t,e,n,r,s,i={}){const o=t.da(i.merge||i.mergeFields?2:0,e,n,s);ad("Data must be an object, but it was:",o,r);const a=id(r,o);let c,u;if(i.merge)c=new pa(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const t=[];for(const r of i.mergeFields){const s=cd(e,r,n);if(!o.contains(s))throw new Mi(Pi.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);dd(t,s)||t.push(s)}c=new pa(t),u=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,u=o.fieldTransforms;return new Xl(new ga(a),c,u)}function sd(t,e){if(od(t=ue(t)))return ad("Unsupported field value:",e,t),id(t,e);if(t instanceof Ql)return function(t,e){if(!Zl(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=sd(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Qi.fromDate(t);return{timestampValue:Gc(e.yt,n)}}if(t instanceof Qi){const n=new Qi(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:Gc(e.yt,n)}}if(t instanceof Yl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof Gl)return{bytesValue:zc(e.yt,t._byteString)};if(t instanceof Dl){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Jc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Al(t)}`)}(t,e)}function id(t,e){const n={};return mo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):go(t,((t,r)=>{const s=sd(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function od(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Qi||t instanceof Yl||t instanceof Gl||t instanceof Dl||t instanceof Ql)}function ad(t,e,n){if(!od(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Al(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function cd(t,e,n){if((e=ue(e))instanceof zl)return e._internalPath;if("string"==typeof e)return hd(t,e);throw ld("Field path arguments must be of type string or ",t,!1,void 0,n)}const ud=new RegExp("[~\\*/\\[\\]]");function hd(t,e,n){if(e.search(ud)>=0)throw ld(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new zl(...e.split("."))._internalPath}catch(r){throw ld(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function ld(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Mi(Pi.INVALID_ARGUMENT,a+t+c)}function dd(t,e){return t.some((t=>t.isEqual(e)))}
1971
+ */const Xl=/^__.*__$/;class Zl{constructor(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}toMutation(t,e){return null!==this.fieldMask?new hc(t,this.data,this.fieldMask,e,this.fieldTransforms):new uc(t,this.data,e,this.fieldTransforms)}}function td(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw Oi()}}class ed{constructor(t,e,n,r,s,i){this.settings=t,this.databaseId=e,this.yt=n,this.ignoreUndefinedProperties=r,void 0===s&&this.na(),this.fieldTransforms=s||[],this.fieldMask=i||[]}get path(){return this.settings.path}get sa(){return this.settings.sa}ia(t){return new ed(Object.assign(Object.assign({},this.settings),t),this.databaseId,this.yt,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}ra(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.ua(t),r}ca(t){var e;const n=null===(e=this.path)||void 0===e?void 0:e.child(t),r=this.ia({path:n,oa:!1});return r.na(),r}aa(t){return this.ia({path:void 0,oa:!0})}ha(t){return dd(t,this.settings.methodName,this.settings.la||!1,this.path,this.settings.fa)}contains(t){return void 0!==this.fieldMask.find((e=>t.isPrefixOf(e)))||void 0!==this.fieldTransforms.find((e=>t.isPrefixOf(e.field)))}na(){if(this.path)for(let t=0;t<this.path.length;t++)this.ua(this.path.get(t))}ua(t){if(0===t.length)throw this.ha("Document fields must not be empty");if(td(this.sa)&&Xl.test(t))throw this.ha('Document fields cannot begin and end with "__"')}}class nd{constructor(t,e,n){this.databaseId=t,this.ignoreUndefinedProperties=e,this.yt=n||rh(t)}da(t,e,n,r=!1){return new ed({sa:t,methodName:e,fa:n,path:to.emptyPath(),oa:!1,la:r},this.databaseId,this.yt,this.ignoreUndefinedProperties)}}function rd(t){const e=t._freezeSettings(),n=rh(t._databaseId);return new nd(t._databaseId,!!e.ignoreUndefinedProperties,n)}function sd(t,e,n,r,s,i={}){const o=t.da(i.merge||i.mergeFields?2:0,e,n,s);cd("Data must be an object, but it was:",o,r);const a=od(r,o);let c,u;if(i.merge)c=new pa(o.fieldMask),u=o.fieldTransforms;else if(i.mergeFields){const t=[];for(const r of i.mergeFields){const s=ud(e,r,n);if(!o.contains(s))throw new Mi(Pi.INVALID_ARGUMENT,`Field '${s}' is specified in your field mask but missing from your input data.`);fd(t,s)||t.push(s)}c=new pa(t),u=o.fieldTransforms.filter((t=>c.covers(t.field)))}else c=null,u=o.fieldTransforms;return new Zl(new ga(a),c,u)}function id(t,e){if(ad(t=ue(t)))return cd("Unsupported field value:",e,t),od(t,e);if(t instanceof Yl)return function(t,e){if(!td(e.sa))throw e.ha(`${t._methodName}() can only be used with update() and set()`);if(!e.path)throw e.ha(`${t._methodName}() is not currently supported inside arrays`);const n=t._toFieldTransform(e);n&&e.fieldTransforms.push(n)}(t,e),null;if(void 0===t&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.oa&&4!==e.sa)throw e.ha("Nested arrays are not supported");return function(t,e){const n=[];let r=0;for(const s of t){let t=id(s,e.aa(r));null==t&&(t={nullValue:"NULL_VALUE"}),n.push(t),r++}return{arrayValue:{values:n}}}(t,e)}return function(t,e){if(null===(t=ue(t)))return{nullValue:"NULL_VALUE"};if("number"==typeof t)return Ha(e.yt,t);if("boolean"==typeof t)return{booleanValue:t};if("string"==typeof t)return{stringValue:t};if(t instanceof Date){const n=Qi.fromDate(t);return{timestampValue:zc(e.yt,n)}}if(t instanceof Qi){const n=new Qi(t.seconds,1e3*Math.floor(t.nanoseconds/1e3));return{timestampValue:zc(e.yt,n)}}if(t instanceof Jl)return{geoPointValue:{latitude:t.latitude,longitude:t.longitude}};if(t instanceof zl)return{bytesValue:Gc(e.yt,t._byteString)};if(t instanceof Dl){const n=e.databaseId,r=t.firestore._databaseId;if(!r.isEqual(n))throw e.ha(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:Jc(t.firestore._databaseId||e.databaseId,t._key.path)}}throw e.ha(`Unsupported field value: ${Al(t)}`)}(t,e)}function od(t,e){const n={};return mo(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):go(t,((t,r)=>{const s=id(r,e.ra(t));null!=s&&(n[t]=s)})),{mapValue:{fields:n}}}function ad(t){return!("object"!=typeof t||null===t||t instanceof Array||t instanceof Date||t instanceof Qi||t instanceof Jl||t instanceof zl||t instanceof Dl||t instanceof Yl)}function cd(t,e,n){if(!ad(n)||!function(t){return"object"==typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}(n)){const r=Al(n);throw"an object"===r?e.ha(t+" a custom object"):e.ha(t+" "+r)}}function ud(t,e,n){if((e=ue(e))instanceof Gl)return e._internalPath;if("string"==typeof e)return ld(t,e);throw dd("Field path arguments must be of type string or ",t,!1,void 0,n)}const hd=new RegExp("[~\\*/\\[\\]]");function ld(t,e,n){if(e.search(hd)>=0)throw dd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Gl(...e.split("."))._internalPath}catch(r){throw dd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function dd(t,e,n,r,s){const i=r&&!r.isEmpty(),o=void 0!==s;let a=`Function ${e}() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let c="";return(i||o)&&(c+=" (found",i&&(c+=` in field ${r}`),o&&(c+=` in document ${s}`),c+=")"),new Mi(Pi.INVALID_ARGUMENT,a+t+c)}function fd(t,e){return t.some((t=>t.isEqual(e)))}
1973
1972
  /**
1974
1973
  * @license
1975
1974
  * Copyright 2020 Google LLC
@@ -1985,7 +1984,7 @@ class Ql{constructor(t){this._methodName=t}}
1985
1984
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1986
1985
  * See the License for the specific language governing permissions and
1987
1986
  * limitations under the License.
1988
- */class fd{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Dl(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new pd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(gd("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class pd extends fd{data(){return super.data()}}function gd(t,e){return"string"==typeof e?hd(t,e):e instanceof zl?e._internalPath:e._delegate._internalPath}
1987
+ */class pd{constructor(t,e,n,r,s){this._firestore=t,this._userDataWriter=e,this._key=n,this._document=r,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Dl(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){const t=new gd(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(t)}return this._userDataWriter.convertValue(this._document.data.value)}}get(t){if(this._document){const e=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==e)return this._userDataWriter.convertValue(e)}}}class gd extends pd{data(){return super.data()}}function md(t,e){return"string"==typeof e?ld(t,e):e instanceof Gl?e._internalPath:e._delegate._internalPath}
1989
1988
  /**
1990
1989
  * @license
1991
1990
  * Copyright 2020 Google LLC
@@ -2001,7 +2000,7 @@ class Ql{constructor(t){this._methodName=t}}
2001
2000
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2002
2001
  * See the License for the specific language governing permissions and
2003
2002
  * limitations under the License.
2004
- */function md(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Mi(Pi.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class yd{}class vd extends yd{}function wd(t,e,...n){let r=[];e instanceof yd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Ed)).length,n=t.filter((t=>t instanceof _d)).length;if(e>1||e>0&&n>0)throw new Mi(Pi.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
2003
+ */function yd(t){if("L"===t.limitType&&0===t.explicitOrderBy.length)throw new Mi(Pi.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class vd{}class wd extends vd{}function _d(t,e,...n){let r=[];e instanceof vd&&r.push(e),r=r.concat(n),function(t){const e=t.filter((t=>t instanceof Sd)).length,n=t.filter((t=>t instanceof Td)).length;if(e>1||e>0&&n>0)throw new Mi(Pi.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}
2005
2004
  /**
2006
2005
  * @license
2007
2006
  * Copyright 2020 Google LLC
@@ -2017,7 +2016,7 @@ class Ql{constructor(t){this._methodName=t}}
2017
2016
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2018
2017
  * See the License for the specific language governing permissions and
2019
2018
  * limitations under the License.
2020
- */(r);for(const e of r)t=e._apply(t);return t}class _d extends vd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new _d(t,e,n)}_apply(t){const e=this._parse(t);return bd(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e))}_parse(t){const e=nd(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){Id(o,i);const e=[];for(const n of o)e.push(Sd(r,t,n));a={arrayValue:{values:e}}}else a=Sd(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||Id(o,i),a=function(t,e,n,r=!1){return sd(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Wo.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function Td(t,e,n){const r=e,s=gd("where",t);return _d._create(s,r,n)}class Ed extends yd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Ed(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:Go.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)bd(n,t),n=Oa(n,t)}(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Sd(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ka(e)&&-1!==n.indexOf("/"))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Xi.fromString(n));if(!eo.isDocumentKey(r))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Mo(t,new eo(r))}if(n instanceof Dl)return Mo(t,n._key);throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Al(n)}.`)}function Id(t,e){if(!Array.isArray(t)||0===t.length)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function bd(t,e){if(e.isInequality()){const n=Ca(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Aa(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Ad{convertValue(t,e="none"){switch(ko(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(So(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Oi()}}convertObject(t,e){const n={};return go(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Yl(Eo(t.latitude),Eo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=bo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ao(t));default:return null}}convertTimestamp(t){const e=To(t);return new Qi(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Xi.fromString(t);Di(mu(n));const r=new fo(n.get(1),n.get(3)),s=new eo(n.popFirst(5));return r.isEqual(e)||ki(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
2019
+ */(r);for(const e of r)t=e._apply(t);return t}class Td extends wd{constructor(t,e,n){super(),this._field=t,this._op=e,this._value=n,this.type="where"}static _create(t,e,n){return new Td(t,e,n)}_apply(t){const e=this._parse(t);return Ad(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e))}_parse(t){const e=rd(t.firestore),n=function(t,e,n,r,s,i,o){let a;if(s.isKeyField()){if("array-contains"===i||"array-contains-any"===i)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. You can't perform '${i}' queries on documentId().`);if("in"===i||"not-in"===i){bd(o,i);const e=[];for(const n of o)e.push(Id(r,t,n));a={arrayValue:{values:e}}}else a=Id(r,t,o)}else"in"!==i&&"not-in"!==i&&"array-contains-any"!==i||bd(o,i),a=function(t,e,n,r=!1){return id(n,t.da(r?4:3,e))}(n,"where",o,"in"===i||"not-in"===i);return Wo.create(s,i,a)}(t._query,0,e,t.firestore._databaseId,this._field,this._op,this._value);return n}}function Ed(t,e,n){const r=e,s=md("where",t);return Td._create(s,r,n)}class Sd extends vd{constructor(t,e){super(),this.type=t,this._queryConstraints=e}static _create(t,e){return new Sd(t,e)}_parse(t){const e=this._queryConstraints.map((e=>e._parse(t))).filter((t=>t.getFilters().length>0));return 1===e.length?e[0]:zo.create(e,this._getOperator())}_apply(t){const e=this._parse(t);return 0===e.getFilters().length?t:(function(t,e){let n=t;const r=e.getFlattenedFilters();for(const t of r)Ad(n,t),n=Oa(n,t)}(t._query,e),new Ll(t.firestore,t.converter,Oa(t._query,e)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function Id(t,e,n){if("string"==typeof(n=ue(n))){if(""===n)throw new Mi(Pi.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!ka(e)&&-1!==n.indexOf("/"))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Xi.fromString(n));if(!eo.isDocumentKey(r))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Mo(t,new eo(r))}if(n instanceof Dl)return Mo(t,n._key);throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Al(n)}.`)}function bd(t,e){if(!Array.isArray(t)||0===t.length)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`);if(t.length>10)throw new Mi(Pi.INVALID_ARGUMENT,`Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`)}function Ad(t,e){if(e.isInequality()){const n=Ca(t),r=e.field;if(null!==n&&!n.isEqual(r))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. All where filters with an inequality (<, <=, !=, not-in, >, or >=) must be on the same field. But you have inequality filters on '${n.toString()}' and '${r.toString()}'`);const s=Aa(t);null!==s&&function(t,e,n){if(!n.isEqual(e))throw new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You have a where filter with an inequality (<, <=, !=, not-in, >, or >=) on field '${e.toString()}' and so you must also use '${e.toString()}' as your first argument to orderBy(), but your first orderBy() is on field '${n.toString()}' instead.`)}(0,r,s)}const n=function(t,e){for(const n of t)for(const t of n.getFlattenedFilters())if(e.indexOf(t.op)>=0)return t.op;return null}(t.filters,function(t){switch(t){case"!=":return["!=","not-in"];case"array-contains":return["array-contains","array-contains-any","not-in"];case"in":return["array-contains-any","in","not-in"];case"array-contains-any":return["array-contains","array-contains-any","in","not-in"];case"not-in":return["array-contains","array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(null!==n)throw n===e.op?new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Mi(Pi.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class Cd{convertValue(t,e="none"){switch(ko(t)){case 0:return null;case 1:return t.booleanValue;case 2:return Eo(t.integerValue||t.doubleValue);case 3:return this.convertTimestamp(t.timestampValue);case 4:return this.convertServerTimestamp(t,e);case 5:return t.stringValue;case 6:return this.convertBytes(So(t.bytesValue));case 7:return this.convertReference(t.referenceValue);case 8:return this.convertGeoPoint(t.geoPointValue);case 9:return this.convertArray(t.arrayValue,e);case 10:return this.convertObject(t.mapValue,e);default:throw Oi()}}convertObject(t,e){const n={};return go(t.fields,((t,r)=>{n[t]=this.convertValue(r,e)})),n}convertGeoPoint(t){return new Jl(Eo(t.latitude),Eo(t.longitude))}convertArray(t,e){return(t.values||[]).map((t=>this.convertValue(t,e)))}convertServerTimestamp(t,e){switch(e){case"previous":const n=bo(t);return null==n?null:this.convertValue(n,e);case"estimate":return this.convertTimestamp(Ao(t));default:return null}}convertTimestamp(t){const e=To(t);return new Qi(e.seconds,e.nanos)}convertDocumentKey(t,e){const n=Xi.fromString(t);Di(mu(n));const r=new fo(n.get(1),n.get(3)),s=new eo(n.popFirst(5));return r.isEqual(e)||ki(`Document ${s} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),s}}
2021
2020
  /**
2022
2021
  * @license
2023
2022
  * Copyright 2020 Google LLC
@@ -2050,7 +2049,7 @@ class Ql{constructor(t){this._methodName=t}}
2050
2049
  * See the License for the specific language governing permissions and
2051
2050
  * limitations under the License.
2052
2051
  */
2053
- class Cd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class kd extends fd{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Nd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(gd("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Nd extends kd{data(t={}){return super.data(t)}}class Rd{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new Cd(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Nd(this._firestore,this._userDataWriter,n.key,n,new Cd(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Mi(Pi.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Nd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new Cd(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Nd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new Cd(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Od(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Od(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Oi()}}
2052
+ class kd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache}}class Nd extends pd{constructor(t,e,n,r,s,i){super(t,e,n,r,i),this._firestore=t,this._firestoreImpl=t,this.metadata=s}exists(){return super.exists()}data(t={}){if(this._document){if(this._converter){const e=new Rd(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(e,t)}return this._userDataWriter.convertValue(this._document.data.value,t.serverTimestamps)}}get(t,e={}){if(this._document){const n=this._document.data.field(md("DocumentSnapshot.get",t));if(null!==n)return this._userDataWriter.convertValue(n,e.serverTimestamps)}}}class Rd extends Nd{data(t={}){return super.data(t)}}class Od{constructor(t,e,n,r){this._firestore=t,this._userDataWriter=e,this._snapshot=r,this.metadata=new kd(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){const t=[];return this.forEach((e=>t.push(e))),t}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(t,e){this._snapshot.docs.forEach((n=>{t.call(e,new Rd(this._firestore,this._userDataWriter,n.key,n,new kd(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(t={}){const e=!!t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new Mi(Pi.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=function(t,e){if(t._snapshot.oldDocs.isEmpty()){let e=0;return t._snapshot.docChanges.map((n=>{const r=new Rd(t._firestore,t._userDataWriter,n.doc.key,n.doc,new kd(t._snapshot.mutatedKeys.has(n.doc.key),t._snapshot.fromCache),t.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:e++}}))}{let n=t._snapshot.oldDocs;return t._snapshot.docChanges.filter((t=>e||3!==t.type)).map((e=>{const r=new Rd(t._firestore,t._userDataWriter,e.doc.key,e.doc,new kd(t._snapshot.mutatedKeys.has(e.doc.key),t._snapshot.fromCache),t.query.converter);let s=-1,i=-1;return 0!==e.type&&(s=n.indexOf(e.doc.key),n=n.delete(e.doc.key)),1!==e.type&&(n=n.add(e.doc),i=n.indexOf(e.doc.key)),{type:Dd(e.type),doc:r,oldIndex:s,newIndex:i}}))}}(this,e),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges}}function Dd(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return Oi()}}
2054
2053
  /**
2055
2054
  * @license
2056
2055
  * Copyright 2020 Google LLC
@@ -2066,7 +2065,7 @@ class Cd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2066
2065
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2067
2066
  * See the License for the specific language governing permissions and
2068
2067
  * limitations under the License.
2069
- */function Dd(t){t=Cl(t,Dl);const e=Cl(t.firestore,ql);return function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:i=>{e.enqueueAndForget((()=>Wh(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Mi(Pi.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Mi(Pi.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Yh(Ia(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(Kl(e),t._key).then((n=>Ud(e,t,n)))}class Ld extends Ad{constructor(t){super(),this.firestore=t}convertBytes(t){return new Gl(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Dl(this.firestore,null,e)}}function Pd(t){t=Cl(t,Ll);const e=Cl(t.firestore,ql),n=Kl(e),r=new Ld(e);return md(t._query),function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:n=>{e.enqueueAndForget((()=>Wh(t,o))),n.fromCache&&"server"===r.source?s.reject(new Mi(Pi.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Yh(n,i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Rd(e,r,t,n)))}function Md(t,e,n){t=Cl(t,Dl);const r=Cl(t.firestore,ql),s=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new xi;return t.asyncQueue.enqueueAndForget((async()=>il(await function(t){return Bl(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Kl(t),e)}(r,[rd(nd(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,ec.none())])}function xd(t,...e){var n,r,s;t=ue(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||$l(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if($l(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof Dl)u=Cl(t.firestore,ql),h=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Ud(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Cl(t,Ll);u=Cl(n.firestore,ql),h=n._query;const r=new Ld(u);c={next:t=>{e[o]&&e[o](new Rd(u,r,n,t))},error:e[o+1],complete:e[o+2]},md(t._query)}return function(t,e,n,r){const s=new Ul(r),i=new Yh(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Kh(await Hl(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Wh(await Hl(t),i)))}}(Kl(u),h,a,c)}function Ud(t,e,n){const r=n.docs.get(e._key),s=new Ld(t);return new kd(t,s,e._key,r,new Cd(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ii=Ut,Dt(new he("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new ql(new Bi(t.getProvider("auth-internal")),new qi(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Mi(Pi.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new fo(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),Bt(Ei,"3.8.0",t),Bt(Ei,"3.8.0","esm2017")}();
2068
+ */function Ld(t){t=Cl(t,Dl);const e=Cl(t.firestore,ql);return function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:i=>{e.enqueueAndForget((()=>Wh(t,o)));const a=i.docs.has(n);!a&&i.fromCache?s.reject(new Mi(Pi.UNAVAILABLE,"Failed to get document because the client is offline.")):a&&i.fromCache&&r&&"server"===r.source?s.reject(new Mi(Pi.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):s.resolve(i)},error:t=>s.reject(t)}),o=new Yh(Ia(n.path),i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(Kl(e),t._key).then((n=>Fd(e,t,n)))}class Pd extends Cd{constructor(t){super(),this.firestore=t}convertBytes(t){return new zl(t)}convertReference(t){const e=this.convertDocumentKey(t,this.firestore._databaseId);return new Dl(this.firestore,null,e)}}function Md(t){t=Cl(t,Ll);const e=Cl(t.firestore,ql),n=Kl(e),r=new Pd(e);return yd(t._query),function(t,e,n={}){const r=new xi;return t.asyncQueue.enqueueAndForget((async()=>function(t,e,n,r,s){const i=new Ul({next:n=>{e.enqueueAndForget((()=>Wh(t,o))),n.fromCache&&"server"===r.source?s.reject(new Mi(Pi.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):s.resolve(n)},error:t=>s.reject(t)}),o=new Yh(n,i,{includeMetadataChanges:!0,Nu:!0});return Kh(t,o)}(await Hl(t),t.asyncQueue,e,n,r))),r.promise}(n,t._query).then((n=>new Od(e,r,t,n)))}function xd(t,e,n){t=Cl(t,Dl);const r=Cl(t.firestore,ql),s=function(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}(t.converter,e,n);return function(t,e){return function(t,e){const n=new xi;return t.asyncQueue.enqueueAndForget((async()=>il(await function(t){return Bl(t).then((t=>t.syncEngine))}(t),e,n))),n.promise}(Kl(t),e)}(r,[sd(rd(r),"setDoc",t._key,s,null!==t.converter,n).toMutation(t._key,ec.none())])}function Ud(t,...e){var n,r,s;t=ue(t);let i={includeMetadataChanges:!1},o=0;"object"!=typeof e[o]||$l(e[o])||(i=e[o],o++);const a={includeMetadataChanges:i.includeMetadataChanges};if($l(e[o])){const t=e[o];e[o]=null===(n=t.next)||void 0===n?void 0:n.bind(t),e[o+1]=null===(r=t.error)||void 0===r?void 0:r.bind(t),e[o+2]=null===(s=t.complete)||void 0===s?void 0:s.bind(t)}let c,u,h;if(t instanceof Dl)u=Cl(t.firestore,ql),h=Ia(t._key.path),c={next:n=>{e[o]&&e[o](Fd(u,t,n))},error:e[o+1],complete:e[o+2]};else{const n=Cl(t,Ll);u=Cl(n.firestore,ql),h=n._query;const r=new Pd(u);c={next:t=>{e[o]&&e[o](new Od(u,r,n,t))},error:e[o+1],complete:e[o+2]},yd(t._query)}return function(t,e,n,r){const s=new Ul(r),i=new Yh(e,s,n);return t.asyncQueue.enqueueAndForget((async()=>Kh(await Hl(t),i))),()=>{s.bc(),t.asyncQueue.enqueueAndForget((async()=>Wh(await Hl(t),i)))}}(Kl(u),h,a,c)}function Fd(t,e,n){const r=n.docs.get(e._key),s=new Pd(t);return new Nd(t,s,e._key,r,new kd(n.hasPendingWrites,n.fromCache),e.converter)}!function(t,e=!0){Ii=Ut,Dt(new he("firestore",((t,{instanceIdentifier:n,options:r})=>{const s=t.getProvider("app").getImmediate(),i=new ql(new Bi(t.getProvider("auth-internal")),new qi(t.getProvider("app-check-internal")),function(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new Mi(Pi.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new fo(t.options.projectId,e)}(s,n),s);return r=Object.assign({useFetchStreams:e},r),i._setSettings(r),i}),"PUBLIC").setMultipleInstances(!0)),Bt(Ei,"3.8.0",t),Bt(Ei,"3.8.0","esm2017")}();
2070
2069
  /**
2071
2070
  * @license
2072
2071
  * Copyright 2020 Google LLC
@@ -2083,7 +2082,7 @@ class Cd{constructor(t,e){this.hasPendingWrites=t,this.fromCache=e}isEqual(t){re
2083
2082
  * See the License for the specific language governing permissions and
2084
2083
  * limitations under the License.
2085
2084
  */
2086
- Bt("firebase","10.13.0","app");class Fd{constructor(){}static getInstance(){return Fd.instance||(Fd.instance=new Fd),Fd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Bd.firebase:Vd.firebase}get api(){return"prod"===this.env?Bd.api:Vd.api}get config(){return"prod"===this.env?Bd.config:Vd.config}}const Vd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Bd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var Hd=1e3,jd=6e4,$d=36e5,qd="millisecond",Kd="second",Wd="minute",Gd="hour",zd="day",Qd="week",Yd="month",Jd="quarter",Xd="year",Zd="date",tf="Invalid Date",ef=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,nf=/\[([^\]]+)]|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,rf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},sf=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},of={s:sf,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+sf(r,2,"0")+":"+sf(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,Yd),i=n-s<0,o=e.clone().add(r+(i?-1:1),Yd);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Yd,y:Xd,w:Qd,d:zd,D:Zd,h:Gd,m:Wd,s:Kd,ms:qd,Q:Jd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},af="en",cf={};cf[af]=rf;var uf="$isDayjsObject",hf=function(t){return t instanceof pf||!(!t||!t[uf])},lf=function t(e,n,r){var s;if(!e)return af;if("string"==typeof e){var i=e.toLowerCase();cf[i]&&(s=i),n&&(cf[i]=n,s=i);var o=e.split("-");if(!s&&o.length>1)return t(o[0])}else{var a=e.name;cf[a]=e,s=a}return!r&&s&&(af=s),s||!r&&af},df=function(t,e){if(hf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new pf(n)},ff=of;ff.l=lf,ff.i=hf,ff.w=function(t,e){return df(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var pf=function(){function t(t){this.$L=lf(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[uf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(ff.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(ef);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return ff},e.isValid=function(){return!(this.$d.toString()===tf)},e.isSame=function(t,e){var n=df(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return df(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<df(t)},e.$g=function(t,e,n){return ff.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!ff.u(e)||e,s=ff.p(t),i=function(t,e){var s=ff.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(zd)},o=function(t,e){return ff.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case Xd:return r?i(1,0):i(31,11);case Yd:return r?i(1,c):i(0,c+1);case Qd:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case zd:case Zd:return o(h+"Hours",0);case Gd:return o(h+"Minutes",1);case Wd:return o(h+"Seconds",2);case Kd:return o(h+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=ff.p(t),s="set"+(this.$u?"UTC":""),i=(n={},n[zd]=s+"Date",n[Zd]=s+"Date",n[Yd]=s+"Month",n[Xd]=s+"FullYear",n[Gd]=s+"Hours",n[Wd]=s+"Minutes",n[Kd]=s+"Seconds",n[qd]=s+"Milliseconds",n)[r],o=r===zd?this.$D+(e-this.$W):e;if(r===Yd||r===Xd){var a=this.clone().set(Zd,1);a.$d[i](o),a.init(),this.$d=a.set(Zd,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[ff.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var s=ff.p(e),i=function(e){var n=df(r);return ff.w(n.date(n.date()+Math.round(e*t)),r)};if(s===Yd)return this.set(Yd,this.$M+t);if(s===Xd)return this.set(Xd,this.$y+t);if(s===zd)return i(1);if(s===Qd)return i(7);var o=(n={},n[Wd]=jd,n[Gd]=$d,n[Kd]=Hd,n)[s]||1,a=this.$d.getTime()+t*o;return ff.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||tf;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=ff.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].slice(0,i)},d=function(t){return ff.s(i%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(nf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return ff.s(e.$y,4,"0");case"M":return a+1;case"MM":return ff.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return e.$D;case"DD":return ff.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(n.weekdaysMin,e.$W,c,2);case"ddd":return l(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(i);case"HH":return ff.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 ff.s(o,2,"0");case"s":return String(e.$s);case"ss":return ff.s(e.$s,2,"0");case"SSS":return ff.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,s=this,i=ff.p(e),o=df(t),a=(o.utcOffset()-this.utcOffset())*jd,c=this-o,u=function(){return ff.m(s,o)};switch(i){case Xd:r=u()/12;break;case Yd:r=u();break;case Jd:r=u()/3;break;case Qd:r=(c-a)/6048e5;break;case zd:r=(c-a)/864e5;break;case Gd:r=c/$d;break;case Wd:r=c/jd;break;case Kd:r=c/Hd;break;default:r=c}return n?r:ff.a(r)},e.daysInMonth=function(){return this.endOf(Yd).$D},e.$locale=function(){return cf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=lf(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return ff.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),gf=pf.prototype;function mf(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n}function yf(){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."}}df.prototype=gf,[["$ms",qd],["$s",Kd],["$m",Wd],["$H",Gd],["$W",zd],["$M",Yd],["$y",Xd],["$D",Zd]].forEach((function(t){gf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),df.extend=function(t,e){return t.$i||(t(e,pf,df),t.$i=!0),df},df.locale=lf,df.isDayjs=hf,df.unix=function(t){return df(1e3*t)},df.en=cf[af],df.Ls=cf,df.p={},"function"==typeof SuppressedError&&SuppressedError;const vf=yf,wf=new p("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),_f="auth/user-disabled",Tf=new L("@firebase/auth");function Ef(t,...e){Tf.logLevel<=k.ERROR&&Tf.error(`Auth (${Ut}): ${t}`,...e)}
2085
+ Bt("firebase","10.13.0","app");class Vd{constructor(){}static getInstance(){return Vd.instance||(Vd.instance=new Vd),Vd.instance}setEnv(t){switch(t){case"production":case"prod":this.env="prod";break;default:this.env="dev"}}get firebase(){return"prod"===this.env?Hd.firebase:Bd.firebase}get api(){return"prod"===this.env?Hd.api:Bd.api}get config(){return"prod"===this.env?Hd.config:Bd.config}}const Bd={firebase:{apiKey:"AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8",authDomain:"fittingroom-dev-5d248.firebaseapp.com",projectId:"fittingroom-dev-5d248",storageBucket:"fittingroom-dev-5d248.appspot.com",messagingSenderId:"2298664147",appId:"1:2298664147:web:340bda75cd5d25f3997026"},api:{url:"https://tfr.dev.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}},Hd={firebase:{apiKey:"AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y",authDomain:"fittingroom-prod.firebaseapp.com",projectId:"fittingroom-prod",storageBucket:"fittingroom-prod.appspot.com",messagingSenderId:"965656825574",appId:"1:965656825574:web:933493cddc73213bd43527"},api:{url:"https://tfr.p.thefittingroom.xyz"},config:{avatarTimeout:Number("120000"),vtoTimeout:Number("120000")}};var jd=1e3,$d=6e4,qd=36e5,Kd="millisecond",Wd="second",zd="minute",Gd="hour",Qd="day",Yd="week",Jd="month",Xd="quarter",Zd="year",tf="date",ef="Invalid Date",nf=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,rf=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,sf={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"}},of=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},af={s:of,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),s=n%60;return(e<=0?"+":"-")+of(r,2,"0")+":"+of(s,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),s=e.clone().add(r,Jd),i=n-s<0,o=e.clone().add(r+(i?-1:1),Jd);return+(-(r+(n-s)/(i?s-o:o-s))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:Jd,y:Zd,w:Yd,d:Qd,D:tf,h:Gd,m:zd,s:Wd,ms:Kd,Q:Xd}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},cf="en",uf={};uf[cf]=sf;var hf="$isDayjsObject",lf=function(t){return t instanceof gf||!(!t||!t[hf])},df=function t(e,n,r){var s;if(!e)return cf;if("string"==typeof e){var i=e.toLowerCase();uf[i]&&(s=i),n&&(uf[i]=n,s=i);var o=e.split("-");if(!s&&o.length>1)return t(o[0])}else{var a=e.name;uf[a]=e,s=a}return!r&&s&&(cf=s),s||!r&&cf},ff=function(t,e){if(lf(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new gf(n)},pf=af;pf.l=df,pf.i=lf,pf.w=function(t,e){return ff(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var gf=function(){function t(t){this.$L=df(t.locale,null,!0),this.parse(t),this.$x=this.$x||t.x||{},this[hf]=!0}var e=t.prototype;return e.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(pf.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(nf);if(r){var s=r[2]-1||0,i=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)):new Date(r[1],s,r[3]||1,r[4]||0,r[5]||0,r[6]||0,i)}}return new Date(e)}(t),this.init()},e.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},e.$utils=function(){return pf},e.isValid=function(){return!(this.$d.toString()===ef)},e.isSame=function(t,e){var n=ff(t);return this.startOf(e)<=n&&n<=this.endOf(e)},e.isAfter=function(t,e){return ff(t)<this.startOf(e)},e.isBefore=function(t,e){return this.endOf(e)<ff(t)},e.$g=function(t,e,n){return pf.u(t)?this[e]:this.set(n,t)},e.unix=function(){return Math.floor(this.valueOf()/1e3)},e.valueOf=function(){return this.$d.getTime()},e.startOf=function(t,e){var n=this,r=!!pf.u(e)||e,s=pf.p(t),i=function(t,e){var s=pf.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?s:s.endOf(Qd)},o=function(t,e){return pf.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},a=this.$W,c=this.$M,u=this.$D,h="set"+(this.$u?"UTC":"");switch(s){case Zd:return r?i(1,0):i(31,11);case Jd:return r?i(1,c):i(0,c+1);case Yd:var l=this.$locale().weekStart||0,d=(a<l?a+7:a)-l;return i(r?u-d:u+(6-d),c);case Qd:case tf:return o(h+"Hours",0);case Gd:return o(h+"Minutes",1);case zd:return o(h+"Seconds",2);case Wd:return o(h+"Milliseconds",3);default:return this.clone()}},e.endOf=function(t){return this.startOf(t,!1)},e.$set=function(t,e){var n,r=pf.p(t),s="set"+(this.$u?"UTC":""),i=(n={},n[Qd]=s+"Date",n[tf]=s+"Date",n[Jd]=s+"Month",n[Zd]=s+"FullYear",n[Gd]=s+"Hours",n[zd]=s+"Minutes",n[Wd]=s+"Seconds",n[Kd]=s+"Milliseconds",n)[r],o=r===Qd?this.$D+(e-this.$W):e;if(r===Jd||r===Zd){var a=this.clone().set(tf,1);a.$d[i](o),a.init(),this.$d=a.set(tf,Math.min(this.$D,a.daysInMonth())).$d}else i&&this.$d[i](o);return this.init(),this},e.set=function(t,e){return this.clone().$set(t,e)},e.get=function(t){return this[pf.p(t)]()},e.add=function(t,e){var n,r=this;t=Number(t);var s=pf.p(e),i=function(e){var n=ff(r);return pf.w(n.date(n.date()+Math.round(e*t)),r)};if(s===Jd)return this.set(Jd,this.$M+t);if(s===Zd)return this.set(Zd,this.$y+t);if(s===Qd)return i(1);if(s===Yd)return i(7);var o=(n={},n[zd]=$d,n[Gd]=qd,n[Wd]=jd,n)[s]||1,a=this.$d.getTime()+t*o;return pf.w(a,this)},e.subtract=function(t,e){return this.add(-1*t,e)},e.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||ef;var r=t||"YYYY-MM-DDTHH:mm:ssZ",s=pf.z(this),i=this.$H,o=this.$m,a=this.$M,c=n.weekdays,u=n.months,h=n.meridiem,l=function(t,n,s,i){return t&&(t[n]||t(e,r))||s[n].slice(0,i)},d=function(t){return pf.s(i%12||12,t,"0")},f=h||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(rf,(function(t,r){return r||function(t){switch(t){case"YY":return String(e.$y).slice(-2);case"YYYY":return pf.s(e.$y,4,"0");case"M":return a+1;case"MM":return pf.s(a+1,2,"0");case"MMM":return l(n.monthsShort,a,u,3);case"MMMM":return l(u,a);case"D":return e.$D;case"DD":return pf.s(e.$D,2,"0");case"d":return String(e.$W);case"dd":return l(n.weekdaysMin,e.$W,c,2);case"ddd":return l(n.weekdaysShort,e.$W,c,3);case"dddd":return c[e.$W];case"H":return String(i);case"HH":return pf.s(i,2,"0");case"h":return d(1);case"hh":return d(2);case"a":return f(i,o,!0);case"A":return f(i,o,!1);case"m":return String(o);case"mm":return pf.s(o,2,"0");case"s":return String(e.$s);case"ss":return pf.s(e.$s,2,"0");case"SSS":return pf.s(e.$ms,3,"0");case"Z":return s}return null}(t)||s.replace(":","")}))},e.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},e.diff=function(t,e,n){var r,s=this,i=pf.p(e),o=ff(t),a=(o.utcOffset()-this.utcOffset())*$d,c=this-o,u=function(){return pf.m(s,o)};switch(i){case Zd:r=u()/12;break;case Jd:r=u();break;case Xd:r=u()/3;break;case Yd:r=(c-a)/6048e5;break;case Qd:r=(c-a)/864e5;break;case Gd:r=c/qd;break;case zd:r=c/$d;break;case Wd:r=c/jd;break;default:r=c}return n?r:pf.a(r)},e.daysInMonth=function(){return this.endOf(Jd).$D},e.$locale=function(){return uf[this.$L]},e.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=df(t,e,!0);return r&&(n.$L=r),n},e.clone=function(){return pf.w(this.$d,this)},e.toDate=function(){return new Date(this.valueOf())},e.toJSON=function(){return this.isValid()?this.toISOString():null},e.toISOString=function(){return this.$d.toISOString()},e.toString=function(){return this.$d.toUTCString()},t}(),mf=gf.prototype;function yf(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]])}return n}function vf(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}ff.prototype=mf,[["$ms",Kd],["$s",Wd],["$m",zd],["$H",Gd],["$W",Qd],["$M",Jd],["$y",Zd],["$D",tf]].forEach((function(t){mf[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),ff.extend=function(t,e){return t.$i||(t(e,gf,ff),t.$i=!0),ff},ff.locale=df,ff.isDayjs=lf,ff.unix=function(t){return ff(1e3*t)},ff.en=uf[cf],ff.Ls=uf,ff.p={},"function"==typeof SuppressedError&&SuppressedError;const wf=vf,_f=new p("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),Tf="auth/user-disabled",Ef=new L("@firebase/auth");function Sf(t,...e){Ef.logLevel<=k.ERROR&&Ef.error(`Auth (${Ut}): ${t}`,...e)}
2087
2086
  /**
2088
2087
  * @license
2089
2088
  * Copyright 2020 Google LLC
@@ -2099,7 +2098,7 @@ Bt("firebase","10.13.0","app");class Fd{constructor(){}static getInstance(){retu
2099
2098
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2100
2099
  * See the License for the specific language governing permissions and
2101
2100
  * limitations under the License.
2102
- */function Sf(t,...e){throw Cf(t,...e)}function If(t,...e){return Cf(t,...e)}function bf(t,e,n){const r=Object.assign(Object.assign({},vf()),{[e]:n});return new p("auth","Firebase",r).create(e,{appName:t.name})}function Af(t){return bf(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Cf(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return wf.create(t,...e)}function kf(t,e,...n){if(!t)throw Cf(e,...n)}function Nf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Ef(e),new Error(e)}function Rf(t,e){t||Nf(e)}
2101
+ */function If(t,...e){throw kf(t,...e)}function bf(t,...e){return kf(t,...e)}function Af(t,e,n){const r=Object.assign(Object.assign({},wf()),{[e]:n});return new p("auth","Firebase",r).create(e,{appName:t.name})}function Cf(t){return Af(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function kf(t,...e){if("string"!=typeof t){const n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return _f.create(t,...e)}function Nf(t,e,...n){if(!t)throw kf(e,...n)}function Rf(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Sf(e),new Error(e)}function Of(t,e){t||Rf(e)}
2103
2102
  /**
2104
2103
  * @license
2105
2104
  * Copyright 2020 Google LLC
@@ -2115,7 +2114,7 @@ Bt("firebase","10.13.0","app");class Fd{constructor(){}static getInstance(){retu
2115
2114
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2116
2115
  * See the License for the specific language governing permissions and
2117
2116
  * limitations under the License.
2118
- */function Of(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2117
+ */function Df(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.href)||""}function Lf(){var t;return"undefined"!=typeof self&&(null===(t=self.location)||void 0===t?void 0:t.protocol)||null}
2119
2118
  /**
2120
2119
  * @license
2121
2120
  * Copyright 2020 Google LLC
@@ -2131,7 +2130,7 @@ Bt("firebase","10.13.0","app");class Fd{constructor(){}static getInstance(){retu
2131
2130
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2132
2131
  * See the License for the specific language governing permissions and
2133
2132
  * limitations under the License.
2134
- */function Lf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Df()&&"https:"!==Df()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2133
+ */function Pf(){return"undefined"==typeof navigator||!navigator||!("onLine"in navigator)||"boolean"!=typeof navigator.onLine||"http:"!==Lf()&&"https:"!==Lf()&&!function(){const t="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof t&&void 0!==t.id}()&&!("connection"in navigator)||navigator.onLine}
2135
2134
  /**
2136
2135
  * @license
2137
2136
  * Copyright 2020 Google LLC
@@ -2148,7 +2147,7 @@ Bt("firebase","10.13.0","app");class Fd{constructor(){}static getInstance(){retu
2148
2147
  * See the License for the specific language governing permissions and
2149
2148
  * limitations under the License.
2150
2149
  */
2151
- class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Lf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2150
+ class Mf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Of(e>t,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Pf()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}
2152
2151
  /**
2153
2152
  * @license
2154
2153
  * Copyright 2020 Google LLC
@@ -2164,7 +2163,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2164
2163
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2165
2164
  * See the License for the specific language governing permissions and
2166
2165
  * limitations under the License.
2167
- */function Mf(t,e){Rf(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2166
+ */function xf(t,e){Of(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}
2168
2167
  /**
2169
2168
  * @license
2170
2169
  * Copyright 2020 Google LLC
@@ -2180,7 +2179,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2180
2179
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2181
2180
  * See the License for the specific language governing permissions and
2182
2181
  * limitations under the License.
2183
- */class xf{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Nf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Nf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Nf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2182
+ */class Uf{static initialize(t,e,n){this.fetchImpl=t,e&&(this.headersImpl=e),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void Rf("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void Rf("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void Rf("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}
2184
2183
  /**
2185
2184
  * @license
2186
2185
  * Copyright 2020 Google LLC
@@ -2196,7 +2195,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2196
2195
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2197
2196
  * See the License for the specific language governing permissions and
2198
2197
  * limitations under the License.
2199
- */const Uf={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"},Ff=new Pf(3e4,6e4);
2198
+ */const Ff={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Vf=new Mf(3e4,6e4);
2200
2199
  /**
2201
2200
  * @license
2202
2201
  * Copyright 2020 Google LLC
@@ -2212,7 +2211,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2212
2211
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2213
2212
  * See the License for the specific language governing permissions and
2214
2213
  * limitations under the License.
2215
- */function Vf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Bf(t,e,n,r,s={}){return Hf(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=v(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),xf.fetch()($f(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function Hf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Uf),e);try{const e=new Kf(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw Wf(t,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const e=s.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Wf(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw Wf(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw Wf(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw bf(t,a,o);Sf(t,a)}}catch(e){if(e instanceof f)throw e;Sf(t,"network-request-failed",{message:String(e)})}}async function jf(t,e,n,r,s={}){const i=await Bf(t,e,n,r,s);return"mfaPendingCredential"in i&&Sf(t,"multi-factor-auth-required",{_serverResponse:i}),i}function $f(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?Mf(t.config,s):`${t.config.apiScheme}://${s}`}function qf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Kf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(If(this.auth,"network-request-failed"))),Ff.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Wf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=If(t,e,r);return s.customData._tokenResponse=n,s}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class zf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return qf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Qf(t,e){return Bf(t,"POST","/v1/accounts:lookup",e)}
2214
+ */function Bf(t,e){return t.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:t.tenantId}):e}async function Hf(t,e,n,r,s={}){return jf(t,s,(async()=>{let s={},i={};r&&("GET"===e?i=r:s={body:JSON.stringify(r)});const o=v(Object.assign({key:t.config.apiKey},i)).slice(1),a=await t._getAdditionalHeaders();return a["Content-Type"]="application/json",t.languageCode&&(a["X-Firebase-Locale"]=t.languageCode),Uf.fetch()(qf(t,t.config.apiHost,n,o),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))}))}async function jf(t,e,n){t._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ff),e);try{const e=new Wf(t),s=await Promise.race([n(),e.promise]);e.clearNetworkTimeout();const i=await s.json();if("needConfirmation"in i)throw zf(t,"account-exists-with-different-credential",i);if(s.ok&&!("errorMessage"in i))return i;{const e=s.ok?i.errorMessage:i.error.message,[n,o]=e.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw zf(t,"credential-already-in-use",i);if("EMAIL_EXISTS"===n)throw zf(t,"email-already-in-use",i);if("USER_DISABLED"===n)throw zf(t,"user-disabled",i);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Af(t,a,o);If(t,a)}}catch(e){if(e instanceof f)throw e;If(t,"network-request-failed",{message:String(e)})}}async function $f(t,e,n,r,s={}){const i=await Hf(t,e,n,r,s);return"mfaPendingCredential"in i&&If(t,"multi-factor-auth-required",{_serverResponse:i}),i}function qf(t,e,n,r){const s=`${e}${n}?${r}`;return t.config.emulator?xf(t.config,s):`${t.config.apiScheme}://${s}`}function Kf(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class Wf{constructor(t){this.auth=t,this.timer=null,this.promise=new Promise(((t,e)=>{this.timer=setTimeout((()=>e(bf(this.auth,"network-request-failed"))),Vf.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function zf(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=bf(t,e,r);return s.customData._tokenResponse=n,s}function Gf(t){return void 0!==t&&void 0!==t.enterprise}class Qf{constructor(t){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===t.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=t.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=t.recaptchaEnforcementState}getProviderEnforcementState(t){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(const e of this.recaptchaEnforcementState)if(e.provider&&e.provider===t)return Kf(e.enforcementState);return null}isProviderEnabled(t){return"ENFORCE"===this.getProviderEnforcementState(t)||"AUDIT"===this.getProviderEnforcementState(t)}}async function Yf(t,e){return Hf(t,"POST","/v1/accounts:lookup",e)}
2216
2215
  /**
2217
2216
  * @license
2218
2217
  * Copyright 2020 Google LLC
@@ -2228,7 +2227,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2228
2227
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2229
2228
  * See the License for the specific language governing permissions and
2230
2229
  * limitations under the License.
2231
- */function Yf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Jf(t){return 1e3*Number(t)}function Xf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return Ef("JWT malformed, contained fewer than 3 sections"),null;try{const t=o(n);return t?JSON.parse(t):(Ef("Failed to decode base64 JWT payload"),null)}catch(t){return Ef("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function Zf(t){const e=Xf(t);return kf(e,"internal-error"),kf(void 0!==e.exp,"internal-error"),kf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2230
+ */function Jf(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch(t){}}function Xf(t){return 1e3*Number(t)}function Zf(t){const[e,n,r]=t.split(".");if(void 0===e||void 0===n||void 0===r)return Sf("JWT malformed, contained fewer than 3 sections"),null;try{const t=o(n);return t?JSON.parse(t):(Sf("Failed to decode base64 JWT payload"),null)}catch(t){return Sf("Caught error parsing JWT payload as JSON",null==t?void 0:t.toString()),null}}function tp(t){const e=Zf(t);return Nf(e,"internal-error"),Nf(void 0!==e.exp,"internal-error"),Nf(void 0!==e.iat,"internal-error"),Number(e.exp)-Number(e.iat)}
2232
2231
  /**
2233
2232
  * @license
2234
2233
  * Copyright 2020 Google LLC
@@ -2244,7 +2243,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2244
2243
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2245
2244
  * See the License for the specific language governing permissions and
2246
2245
  * limitations under the License.
2247
- */async function tp(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof f&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2246
+ */async function ep(t,e,n=!1){if(n)return e;try{return await e}catch(e){throw e instanceof f&&function({code:t}){return"auth/user-disabled"===t||"auth/user-token-expired"===t}
2248
2247
  /**
2249
2248
  * @license
2250
2249
  * Copyright 2020 Google LLC
@@ -2260,7 +2259,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2260
2259
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2261
2260
  * See the License for the specific language governing permissions and
2262
2261
  * limitations under the License.
2263
- */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class ep{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
2262
+ */(e)&&t.auth.currentUser===t&&await t.auth.signOut(),e}}class np{constructor(t){this.user=t,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(t){var e;if(t){const t=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),t}{this.errorBackoff=3e4;const t=(null!==(e=this.user.stsTokenManager.expirationTime)&&void 0!==e?e:0)-Date.now()-3e5;return Math.max(0,t)}}schedule(t=!1){if(!this.isRunning)return;const e=this.getInterval(t);this.timerId=setTimeout((async()=>{await this.iteration()}),e)}async iteration(){try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null==t?void 0:t.code)&&this.schedule(!0))}this.schedule()}}
2264
2263
  /**
2265
2264
  * @license
2266
2265
  * Copyright 2020 Google LLC
@@ -2276,7 +2275,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2276
2275
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2277
2276
  * See the License for the specific language governing permissions and
2278
2277
  * limitations under the License.
2279
- */class np{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Yf(this.lastLoginAt),this.creationTime=Yf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2278
+ */class rp{constructor(t,e){this.createdAt=t,this.lastLoginAt=e,this._initializeTime()}_initializeTime(){this.lastSignInTime=Jf(this.lastLoginAt),this.creationTime=Jf(this.createdAt)}_copy(t){this.createdAt=t.createdAt,this.lastLoginAt=t.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}
2280
2279
  /**
2281
2280
  * @license
2282
2281
  * Copyright 2019 Google LLC
@@ -2292,7 +2291,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2292
2291
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2293
2292
  * See the License for the specific language governing permissions and
2294
2293
  * limitations under the License.
2295
- */async function rp(t){var e;const n=t.auth,r=await t.getIdToken(),s=await tp(t,Qf(n,{idToken:r}));kf(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?sp(i.providerUserInfo):[],a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new np(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}function sp(t){return t.map((t=>{var{providerId:e}=t,n=mf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
2294
+ */async function sp(t){var e;const n=t.auth,r=await t.getIdToken(),s=await ep(t,Yf(n,{idToken:r}));Nf(null==s?void 0:s.users.length,n,"internal-error");const i=s.users[0];t._notifyReloadListener(i);const o=(null===(e=i.providerUserInfo)||void 0===e?void 0:e.length)?ip(i.providerUserInfo):[],a=(c=t.providerData,u=o,[...c.filter((t=>!u.some((e=>e.providerId===t.providerId)))),...u]);var c,u;const h=t.isAnonymous,l=!(t.email&&i.passwordHash||(null==a?void 0:a.length)),d=!!h&&l,f={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new rp(i.createdAt,i.lastLoginAt),isAnonymous:d};Object.assign(t,f)}function ip(t){return t.map((t=>{var{providerId:e}=t,n=yf(t,["providerId"]);return{providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}}))}
2296
2295
  /**
2297
2296
  * @license
2298
2297
  * Copyright 2020 Google LLC
@@ -2325,7 +2324,7 @@ class Pf{constructor(t,e){this.shortDelay=t,this.longDelay=e,Rf(e>t,"Short delay
2325
2324
  * See the License for the specific language governing permissions and
2326
2325
  * limitations under the License.
2327
2326
  */
2328
- class ip{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){kf(t.idToken,"internal-error"),kf(void 0!==t.idToken,"internal-error"),kf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):Zf(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){kf(0!==t.length,"internal-error");const e=Zf(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(kf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:s}=await async function(t,e){const n=await Hf(t,{},(async()=>{const n=v({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=$f(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",xf.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new ip;return n&&(kf("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(kf("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(kf("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new ip,this.toJSON())}_performRefresh(){return Nf("not implemented")}}
2327
+ class op{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(t){Nf(t.idToken,"internal-error"),Nf(void 0!==t.idToken,"internal-error"),Nf(void 0!==t.refreshToken,"internal-error");const e="expiresIn"in t&&void 0!==t.expiresIn?Number(t.expiresIn):tp(t.idToken);this.updateTokensAndExpiration(t.idToken,t.refreshToken,e)}updateFromIdToken(t){Nf(0!==t.length,"internal-error");const e=tp(t);this.updateTokensAndExpiration(t,null,e)}async getToken(t,e=!1){return e||!this.accessToken||this.isExpired?(Nf(this.refreshToken,t,"user-token-expired"),this.refreshToken?(await this.refresh(t,this.refreshToken),this.accessToken):null):this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(t,e){const{accessToken:n,refreshToken:r,expiresIn:s}=await async function(t,e){const n=await jf(t,{},(async()=>{const n=v({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=t.config,i=qf(t,r,"/v1/token",`key=${s}`),o=await t._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Uf.fetch()(i,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(t,e);this.updateTokensAndExpiration(n,r,Number(s))}updateTokensAndExpiration(t,e,n){this.refreshToken=e||null,this.accessToken=t||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(t,e){const{refreshToken:n,accessToken:r,expirationTime:s}=e,i=new op;return n&&(Nf("string"==typeof n,"internal-error",{appName:t}),i.refreshToken=n),r&&(Nf("string"==typeof r,"internal-error",{appName:t}),i.accessToken=r),s&&(Nf("number"==typeof s,"internal-error",{appName:t}),i.expirationTime=s),i}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(t){this.accessToken=t.accessToken,this.refreshToken=t.refreshToken,this.expirationTime=t.expirationTime}_clone(){return Object.assign(new op,this.toJSON())}_performRefresh(){return Rf("not implemented")}}
2329
2328
  /**
2330
2329
  * @license
2331
2330
  * Copyright 2020 Google LLC
@@ -2341,7 +2340,7 @@ class ip{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2341
2340
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2342
2341
  * See the License for the specific language governing permissions and
2343
2342
  * limitations under the License.
2344
- */function op(t,e){kf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class ap{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=mf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new ep(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new np(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await tp(this,this.stsTokenManager.getToken(this.auth,t));return kf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=S(t),r=await n.getIdToken(e),s=Xf(r);kf(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:Yf(Jf(s.auth_time)),issuedAtTime:Yf(Jf(s.iat)),expirationTime:Yf(Jf(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=S(t);await rp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(kf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new ap(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){kf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await rp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Af(this.auth));const t=await this.getIdToken();return await tp(this,
2343
+ */function ap(t,e){Nf("string"==typeof t||void 0===t,"internal-error",{appName:e})}class cp{constructor(t){var{uid:e,auth:n,stsTokenManager:r}=t,s=yf(t,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new np(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new rp(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(t){const e=await ep(this,this.stsTokenManager.getToken(this.auth,t));return Nf(e,this.auth,"internal-error"),this.accessToken!==e&&(this.accessToken=e,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),e}getIdTokenResult(t){return async function(t,e=!1){const n=S(t),r=await n.getIdToken(e),s=Zf(r);Nf(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i="object"==typeof s.firebase?s.firebase:void 0,o=null==i?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:Jf(Xf(s.auth_time)),issuedAtTime:Jf(Xf(s.iat)),expirationTime:Jf(Xf(s.exp)),signInProvider:o||null,signInSecondFactor:(null==i?void 0:i.sign_in_second_factor)||null}}(this,t)}reload(){return async function(t){const e=S(t);await sp(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}(this)}_assign(t){this!==t&&(Nf(this.uid===t.uid,this.auth,"internal-error"),this.displayName=t.displayName,this.photoURL=t.photoURL,this.email=t.email,this.emailVerified=t.emailVerified,this.phoneNumber=t.phoneNumber,this.isAnonymous=t.isAnonymous,this.tenantId=t.tenantId,this.providerData=t.providerData.map((t=>Object.assign({},t))),this.metadata._copy(t.metadata),this.stsTokenManager._assign(t.stsTokenManager))}_clone(t){const e=new cp(Object.assign(Object.assign({},this),{auth:t,stsTokenManager:this.stsTokenManager._clone()}));return e.metadata._copy(this.metadata),e}_onReload(t){Nf(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=t,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(t){this.reloadListener?this.reloadListener(t):this.reloadUserInfo=t}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(t,e=!1){let n=!1;t.idToken&&t.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(t),n=!0),e&&await sp(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Pt(this.auth.app))return Promise.reject(Cf(this.auth));const t=await this.getIdToken();return await ep(this,
2345
2344
  /**
2346
2345
  * @license
2347
2346
  * Copyright 2020 Google LLC
@@ -2358,7 +2357,7 @@ class ip{constructor(){this.refreshToken=null,this.accessToken=null,this.expirat
2358
2357
  * See the License for the specific language governing permissions and
2359
2358
  * limitations under the License.
2360
2359
  */
2361
- async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:E}=e;kf(v&&E,t,"internal-error");const S=ip.fromJSON(this.name,E);kf("string"==typeof v,t,"internal-error"),op(h,t.name),op(l,t.name),kf("boolean"==typeof w,t,"internal-error"),kf("boolean"==typeof _,t,"internal-error"),op(d,t.name),op(f,t.name),op(p,t.name),op(g,t.name),op(m,t.name),op(y,t.name);const I=new ap({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const r=new ip;r.updateFromServerResponse(e);const s=new ap({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await rp(s),s}static async _fromGetAccountInfoResponse(t,e,n){const r=e.users[0];kf(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?sp(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||(null==s?void 0:s.length)),o=new ip;o.updateFromIdToken(n);const a=new ap({uid:r.localId,auth:t,stsTokenManager:o,isAnonymous:i}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new np(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==s?void 0:s.length))};return Object.assign(a,c),a}}
2360
+ async function(t,e){return Hf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idToken:t})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((t=>Object.assign({},t))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(t,e){var n,r,s,i,o,a,c,u;const h=null!==(n=e.displayName)&&void 0!==n?n:void 0,l=null!==(r=e.email)&&void 0!==r?r:void 0,d=null!==(s=e.phoneNumber)&&void 0!==s?s:void 0,f=null!==(i=e.photoURL)&&void 0!==i?i:void 0,p=null!==(o=e.tenantId)&&void 0!==o?o:void 0,g=null!==(a=e._redirectEventId)&&void 0!==a?a:void 0,m=null!==(c=e.createdAt)&&void 0!==c?c:void 0,y=null!==(u=e.lastLoginAt)&&void 0!==u?u:void 0,{uid:v,emailVerified:w,isAnonymous:_,providerData:T,stsTokenManager:E}=e;Nf(v&&E,t,"internal-error");const S=op.fromJSON(this.name,E);Nf("string"==typeof v,t,"internal-error"),ap(h,t.name),ap(l,t.name),Nf("boolean"==typeof w,t,"internal-error"),Nf("boolean"==typeof _,t,"internal-error"),ap(d,t.name),ap(f,t.name),ap(p,t.name),ap(g,t.name),ap(m,t.name),ap(y,t.name);const I=new cp({uid:v,auth:t,email:l,emailVerified:w,displayName:h,isAnonymous:_,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:m,lastLoginAt:y});return T&&Array.isArray(T)&&(I.providerData=T.map((t=>Object.assign({},t)))),g&&(I._redirectEventId=g),I}static async _fromIdTokenResponse(t,e,n=!1){const r=new op;r.updateFromServerResponse(e);const s=new cp({uid:e.localId,auth:t,stsTokenManager:r,isAnonymous:n});return await sp(s),s}static async _fromGetAccountInfoResponse(t,e,n){const r=e.users[0];Nf(void 0!==r.localId,"internal-error");const s=void 0!==r.providerUserInfo?ip(r.providerUserInfo):[],i=!(r.email&&r.passwordHash||(null==s?void 0:s.length)),o=new op;o.updateFromIdToken(n);const a=new cp({uid:r.localId,auth:t,stsTokenManager:o,isAnonymous:i}),c={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new rp(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash||(null==s?void 0:s.length))};return Object.assign(a,c),a}}
2362
2361
  /**
2363
2362
  * @license
2364
2363
  * Copyright 2020 Google LLC
@@ -2374,7 +2373,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2374
2373
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2375
2374
  * See the License for the specific language governing permissions and
2376
2375
  * limitations under the License.
2377
- */const cp=new Map;function up(t){Rf(t instanceof Function,"Expected a class definition");let e=cp.get(t);return e?(Rf(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,cp.set(t,e),e)}
2376
+ */const up=new Map;function hp(t){Of(t instanceof Function,"Expected a class definition");let e=up.get(t);return e?(Of(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,up.set(t,e),e)}
2378
2377
  /**
2379
2378
  * @license
2380
2379
  * Copyright 2019 Google LLC
@@ -2390,7 +2389,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2390
2389
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2391
2390
  * See the License for the specific language governing permissions and
2392
2391
  * limitations under the License.
2393
- */class hp{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}hp.type="NONE";const lp=hp;
2392
+ */class lp{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(t,e){this.storage[t]=e}async _get(t){const e=this.storage[t];return void 0===e?null:e}async _remove(t){delete this.storage[t]}_addListener(t,e){}_removeListener(t,e){}}lp.type="NONE";const dp=lp;
2394
2393
  /**
2395
2394
  * @license
2396
2395
  * Copyright 2019 Google LLC
@@ -2406,7 +2405,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2406
2405
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2407
2406
  * See the License for the specific language governing permissions and
2408
2407
  * limitations under the License.
2409
- */function dp(t,e,n){return`firebase:${t}:${e}:${n}`}class fp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=dp(this.userKey,r.apiKey,s),this.fullPersistenceKey=dp("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?ap._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new fp(up(lp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||up(lp);const i=dp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=ap._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new fp(s,t,n)):new fp(s,t,n)}}
2408
+ */function fp(t,e,n){return`firebase:${t}:${e}:${n}`}class pp{constructor(t,e,n){this.persistence=t,this.auth=e,this.userKey=n;const{config:r,name:s}=this.auth;this.fullUserKey=fp(this.userKey,r.apiKey,s),this.fullPersistenceKey=fp("persistence",r.apiKey,s),this.boundEventHandler=e._onStorageEvent.bind(e),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(t){return this.persistence._set(this.fullUserKey,t.toJSON())}async getCurrentUser(){const t=await this.persistence._get(this.fullUserKey);return t?cp._fromJSON(this.auth,t):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(t){if(this.persistence===t)return;const e=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=t,e?this.setCurrentUser(e):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(t,e,n="authUser"){if(!e.length)return new pp(hp(dp),t,n);const r=(await Promise.all(e.map((async t=>{if(await t._isAvailable())return t})))).filter((t=>t));let s=r[0]||hp(dp);const i=fp(n,t.config.apiKey,t.name);let o=null;for(const n of e)try{const e=await n._get(i);if(e){const r=cp._fromJSON(t,e);n!==s&&(o=r),s=n;break}}catch(t){}const a=r.filter((t=>t._shouldAllowMigration));return s._shouldAllowMigration&&a.length?(s=a[0],o&&await s._set(i,o.toJSON()),await Promise.all(e.map((async t=>{if(t!==s)try{await t._remove(i)}catch(t){}}))),new pp(s,t,n)):new pp(s,t,n)}}
2410
2409
  /**
2411
2410
  * @license
2412
2411
  * Copyright 2020 Google LLC
@@ -2422,7 +2421,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2422
2421
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2423
2422
  * See the License for the specific language governing permissions and
2424
2423
  * limitations under the License.
2425
- */function pp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(vp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(gp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(_p(e))return"Blackberry";if(Tp(e))return"Webos";if(mp(e))return"Safari";if((e.includes("chrome/")||yp(e))&&!e.includes("edge/"))return"Chrome";if(wp(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function gp(t=d()){return/firefox\//i.test(t)}function mp(t=d()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function yp(t=d()){return/crios\//i.test(t)}function vp(t=d()){return/iemobile/i.test(t)}function wp(t=d()){return/android/i.test(t)}function _p(t=d()){return/blackberry/i.test(t)}function Tp(t=d()){return/webos/i.test(t)}function Ep(t=d()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Sp(){return function(){const t=d();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function Ip(t=d()){return Ep(t)||wp(t)||Tp(t)||_p(t)||/windows phone/i.test(t)||vp(t)}
2424
+ */function gp(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(wp(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(mp(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Tp(e))return"Blackberry";if(Ep(e))return"Webos";if(yp(e))return"Safari";if((e.includes("chrome/")||vp(e))&&!e.includes("edge/"))return"Chrome";if(_p(e))return"Android";{const e=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=t.match(e);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function mp(t=d()){return/firefox\//i.test(t)}function yp(t=d()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function vp(t=d()){return/crios\//i.test(t)}function wp(t=d()){return/iemobile/i.test(t)}function _p(t=d()){return/android/i.test(t)}function Tp(t=d()){return/blackberry/i.test(t)}function Ep(t=d()){return/webos/i.test(t)}function Sp(t=d()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Ip(){return function(){const t=d();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}()&&10===document.documentMode}function bp(t=d()){return Sp(t)||_p(t)||Ep(t)||Tp(t)||/windows phone/i.test(t)||wp(t)}
2426
2425
  /**
2427
2426
  * @license
2428
2427
  * Copyright 2020 Google LLC
@@ -2438,7 +2437,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2438
2437
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2439
2438
  * See the License for the specific language governing permissions and
2440
2439
  * limitations under the License.
2441
- */function bp(t,e=[]){let n;switch(t){case"Browser":n=pp(d());break;case"Worker":n=`${pp(d())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ut}/${r}`}
2440
+ */function Ap(t,e=[]){let n;switch(t){case"Browser":n=gp(d());break;case"Worker":n=`${gp(d())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Ut}/${r}`}
2442
2441
  /**
2443
2442
  * @license
2444
2443
  * Copyright 2022 Google LLC
@@ -2454,7 +2453,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2454
2453
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2455
2454
  * See the License for the specific language governing permissions and
2456
2455
  * limitations under the License.
2457
- */class Ap{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2456
+ */class Cp{constructor(t){this.auth=t,this.queue=[]}pushCallback(t,e){const n=e=>new Promise(((n,r)=>{try{n(t(e))}catch(t){r(t)}}));n.onAbort=e,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(t){if(this.auth.currentUser===t)return;const e=[];try{for(const n of this.queue)await n(t),n.onAbort&&e.push(n.onAbort)}catch(t){e.reverse();for(const t of e)try{t()}catch(t){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==t?void 0:t.message})}}}
2458
2457
  /**
2459
2458
  * @license
2460
2459
  * Copyright 2023 Google LLC
@@ -2470,7 +2469,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2470
2469
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2471
2470
  * See the License for the specific language governing permissions and
2472
2471
  * limitations under the License.
2473
- */class Cp{constructor(t){var e,n,r,s;const i=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=i.minPasswordLength)&&void 0!==e?e:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(s=t.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,r,s,i,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void 0===s||s),a.isValid&&(a.isValid=null===(i=a.containsNumericCharacter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let r=0;r<t.length;r++)n=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,r,s){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=s))}}
2472
+ */class kp{constructor(t){var e,n,r,s;const i=t.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!==(e=i.minPasswordLength)&&void 0!==e?e:6,i.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=i.maxPasswordLength),void 0!==i.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=i.containsLowercaseCharacter),void 0!==i.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=i.containsUppercaseCharacter),void 0!==i.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=i.containsNumericCharacter),void 0!==i.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=i.containsNonAlphanumericCharacter),this.enforcementState=t.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!==(r=null===(n=t.allowedNonAlphanumericCharacters)||void 0===n?void 0:n.join(""))&&void 0!==r?r:"",this.forceUpgradeOnSignin=null!==(s=t.forceUpgradeOnSignin)&&void 0!==s&&s,this.schemaVersion=t.schemaVersion}validatePassword(t){var e,n,r,s,i,o;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(t,a),this.validatePasswordCharacterOptions(t,a),a.isValid&&(a.isValid=null===(e=a.meetsMinPasswordLength)||void 0===e||e),a.isValid&&(a.isValid=null===(n=a.meetsMaxPasswordLength)||void 0===n||n),a.isValid&&(a.isValid=null===(r=a.containsLowercaseLetter)||void 0===r||r),a.isValid&&(a.isValid=null===(s=a.containsUppercaseLetter)||void 0===s||s),a.isValid&&(a.isValid=null===(i=a.containsNumericCharacter)||void 0===i||i),a.isValid&&(a.isValid=null===(o=a.containsNonAlphanumericCharacter)||void 0===o||o),a}validatePasswordLengthOptions(t,e){const n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(e.meetsMinPasswordLength=t.length>=n),r&&(e.meetsMaxPasswordLength=t.length<=r)}validatePasswordCharacterOptions(t,e){let n;this.updatePasswordCharacterOptionsStatuses(e,!1,!1,!1,!1);for(let r=0;r<t.length;r++)n=t.charAt(r),this.updatePasswordCharacterOptionsStatuses(e,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(t,e,n,r,s){this.customStrengthOptions.containsLowercaseLetter&&(t.containsLowercaseLetter||(t.containsLowercaseLetter=e)),this.customStrengthOptions.containsUppercaseLetter&&(t.containsUppercaseLetter||(t.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(t.containsNumericCharacter||(t.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(t.containsNonAlphanumericCharacter||(t.containsNonAlphanumericCharacter=s))}}
2474
2473
  /**
2475
2474
  * @license
2476
2475
  * Copyright 2020 Google LLC
@@ -2486,7 +2485,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2486
2485
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2487
2486
  * See the License for the specific language governing permissions and
2488
2487
  * limitations under the License.
2489
- */class kp{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Rp(this),this.idTokenSubscription=new Rp(this),this.beforeStateQueue=new Ap(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=wf,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=up(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await fp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Qf(this,{idToken:t}),n=await ap._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(Pt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return kf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await rp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Af(this));const e=t?S(t):null;return e&&kf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&kf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Af(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Af(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(up(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Bf(t,"GET","/v2/passwordPolicy",Vf(t,e))}
2488
+ */class Np{constructor(t,e,n,r){this.app=t,this.heartbeatServiceProvider=e,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Op(this),this.idTokenSubscription=new Op(this),this.beforeStateQueue=new Cp(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=_f,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=t.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(t,e){return e&&(this._popupRedirectResolver=hp(e)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await pp.create(this,t),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(t){}await this.initializeCurrentUser(e),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const t=await this.assertedPersistence.getCurrentUser();return this.currentUser||t?this.currentUser&&t&&this.currentUser.uid===t.uid?(this._currentUser._assign(t),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(t,!0):void 0}async initializeCurrentUserFromIdToken(t){try{const e=await Yf(this,{idToken:t}),n=await cp._fromGetAccountInfoResponse(this,e,t);await this.directlySetCurrentUser(n)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(t){var e;if(Pt(this.app)){const t=this.app.settings.authIdToken;return t?new Promise((e=>{setTimeout((()=>this.initializeCurrentUserFromIdToken(t).then(e,e)))})):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(t&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(e=this.redirectUser)||void 0===e?void 0:e._redirectEventId,i=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(t);n&&n!==i||!(null==o?void 0:o.user)||(r=o.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(t){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(t)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Nf(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(t){let e=null;try{e=await this._popupRedirectResolver._completeRedirectFn(this,t,!0)}catch(t){await this._setRedirectUser(null)}return e}async reloadAndSetCurrentUserOrClear(t){try{await sp(t)}catch(t){if("auth/network-request-failed"!==(null==t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(t)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(t){if(Pt(this.app))return Promise.reject(Cf(this));const e=t?S(t):null;return e&&Nf(e.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(e&&e._clone(this))}async _updateCurrentUser(t,e=!1){if(!this._deleted)return t&&Nf(this.tenantId===t.tenantId,this,"tenant-id-mismatch"),e||await this.beforeStateQueue.runMiddleware(t),this.queue((async()=>{await this.directlySetCurrentUser(t),this.notifyAuthListeners()}))}async signOut(){return Pt(this.app)?Promise.reject(Cf(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(t){return Pt(this.app)?Promise.reject(Cf(this)):this.queue((async()=>{await this.assertedPersistence.setPersistence(hp(t))}))}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(t){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const e=this._getPasswordPolicyInternal();return e.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):e.validatePassword(t)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const t=await async function(t,e={}){return Hf(t,"GET","/v2/passwordPolicy",Bf(t,e))}
2490
2489
  /**
2491
2490
  * @license
2492
2491
  * Copyright 2023 Google LLC
@@ -2502,7 +2501,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2502
2501
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2503
2502
  * See the License for the specific language governing permissions and
2504
2503
  * limitations under the License.
2505
- */(this),e=new Cp(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new p("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Bf(t,"POST","/v2/accounts:revokeToken",Vf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&up(t)||this._popupRedirectResolver;kf(e,this,"argument-error"),this.redirectPersistenceManager=await fp.create(this,[up(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(kf(o,this,"internal-error"),o.then((()=>{i||s(this.currentUser)})),"function"==typeof e){const s=t.addObserver(e,n,r);return()=>{i=!0,s()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return kf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=bp(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){Tf.logLevel<=k.WARN&&Tf.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Np(t){return S(t)}class Rp{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new T(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return kf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2504
+ */(this),e=new kp(t);null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(t){this._errorFactory=new p("auth","Firebase",t())}onAuthStateChanged(t,e,n){return this.registerStateListener(this.authStateSubscription,t,e,n)}beforeAuthStateChanged(t,e){return this.beforeStateQueue.pushCallback(t,e)}onIdTokenChanged(t,e,n){return this.registerStateListener(this.idTokenSubscription,t,e,n)}authStateReady(){return new Promise(((t,e)=>{if(this.currentUser)t();else{const n=this.onAuthStateChanged((()=>{n(),t()}),e)}}))}async revokeAccessToken(t){if(this.currentUser){const e={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:t,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(e.tenantId=this.tenantId),await async function(t,e){return Hf(t,"POST","/v2/accounts:revokeToken",Bf(t,e))}(this,e)}}toJSON(){var t;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(t=this._currentUser)||void 0===t?void 0:t.toJSON()}}async _setRedirectUser(t,e){const n=await this.getOrInitRedirectPersistenceManager(e);return null===t?n.removeCurrentUser():n.setCurrentUser(t)}async getOrInitRedirectPersistenceManager(t){if(!this.redirectPersistenceManager){const e=t&&hp(t)||this._popupRedirectResolver;Nf(e,this,"argument-error"),this.redirectPersistenceManager=await pp.create(this,[hp(e._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(t){var e,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(e=this._currentUser)||void 0===e?void 0:e._redirectEventId)===t?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._redirectEventId)===t?this.redirectUser:null}async _persistUserIfCurrent(t){if(t===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(t)))}_notifyListenersIfCurrent(t){t===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var t,e;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const n=null!==(e=null===(t=this.currentUser)||void 0===t?void 0:t.uid)&&void 0!==e?e:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(t,e,n,r){if(this._deleted)return()=>{};const s="function"==typeof e?e:e.next.bind(e);let i=!1;const o=this._isInitialized?Promise.resolve():this._initializationPromise;if(Nf(o,this,"internal-error"),o.then((()=>{i||s(this.currentUser)})),"function"==typeof e){const s=t.addObserver(e,n,r);return()=>{i=!0,s()}}{const n=t.addObserver(e);return()=>{i=!0,n()}}}async directlySetCurrentUser(t){this.currentUser&&this.currentUser!==t&&this._currentUser._stopProactiveRefresh(),t&&this.isProactiveRefreshEnabled&&t._startProactiveRefresh(),this.currentUser=t,t?await this.assertedPersistence.setCurrentUser(t):await this.assertedPersistence.removeCurrentUser()}queue(t){return this.operations=this.operations.then(t,t),this.operations}get assertedPersistence(){return Nf(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(t){t&&!this.frameworks.includes(t)&&(this.frameworks.push(t),this.frameworks.sort(),this.clientVersion=Ap(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var t;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await(null===(t=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var t;const e=await(null===(t=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===t?void 0:t.getToken());return(null==e?void 0:e.error)&&function(t,...e){Ef.logLevel<=k.WARN&&Ef.warn(`Auth (${Ut}): ${t}`,...e)}(`Error while retrieving App Check token: ${e.error}`),null==e?void 0:e.token}}function Rp(t){return S(t)}class Op{constructor(t){this.auth=t,this.observer=null,this.addObserver=function(t,e){const n=new T(t,e);return n.subscribe.bind(n)}((t=>this.observer=t))}get next(){return Nf(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}
2506
2505
  /**
2507
2506
  * @license
2508
2507
  * Copyright 2020 Google LLC
@@ -2518,7 +2517,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2518
2517
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2519
2518
  * See the License for the specific language governing permissions and
2520
2519
  * limitations under the License.
2521
- */let Op={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Dp(t){return Op.loadJS(t)}class Lp{constructor(t){this.type="recaptcha-enterprise",this.auth=Np(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Bf(t,"GET","/v2/recaptchaConfig",Vf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new zf(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function r(e,n,r){const s=window.grecaptcha;Gf(s)?s.enterprise.ready((()=>{s.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,s)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))r(n,t,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let e=Op.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Dp(e).then((()=>{r(n,t,s)})).catch((t=>{s(t)}))}})).catch((t=>{s(t)}))}))}}async function Pp(t,e,n,r=!1){const s=new Lp(t);let i;try{i=await s.verify(n)}catch(t){i=await s.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:i}):Object.assign(o,{captchaResponse:i}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function Mp(t,e,n,r){var s;if(null===(s=t._getRecaptchaConfig())||void 0===s?void 0:s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Pp(t,e,n,"getOobCode"===n);return r(t,s)}return r(t,e).catch((async s=>{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Pp(t,e,n,"getOobCode"===n);return r(t,s)}return Promise.reject(s)}))}
2520
+ */let Dp={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function Lp(t){return Dp.loadJS(t)}class Pp{constructor(t){this.type="recaptcha-enterprise",this.auth=Rp(t)}async verify(t="verify",e=!1){async function n(t){if(!e){if(null==t.tenantId&&null!=t._agentRecaptchaConfig)return t._agentRecaptchaConfig.siteKey;if(null!=t.tenantId&&void 0!==t._tenantRecaptchaConfigs[t.tenantId])return t._tenantRecaptchaConfigs[t.tenantId].siteKey}return new Promise((async(e,n)=>{(async function(t,e){return Hf(t,"GET","/v2/recaptchaConfig",Bf(t,e))})(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new Qf(r);return null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,e(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((t=>{n(t)}))}))}function r(e,n,r){const s=window.grecaptcha;Gf(s)?s.enterprise.ready((()=>{s.enterprise.execute(e,{action:t}).then((t=>{n(t)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((t,s)=>{n(this.auth).then((n=>{if(!e&&Gf(window.grecaptcha))r(n,t,s);else{if("undefined"==typeof window)return void s(new Error("RecaptchaVerifier is only supported in browser"));let e=Dp.recaptchaEnterpriseScript;0!==e.length&&(e+=n),Lp(e).then((()=>{r(n,t,s)})).catch((t=>{s(t)}))}})).catch((t=>{s(t)}))}))}}async function Mp(t,e,n,r=!1){const s=new Pp(t);let i;try{i=await s.verify(n)}catch(t){i=await s.verify(n,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:i}):Object.assign(o,{captchaResponse:i}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function xp(t,e,n,r){var s;if(null===(s=t._getRecaptchaConfig())||void 0===s?void 0:s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const s=await Mp(t,e,n,"getOobCode"===n);return r(t,s)}return r(t,e).catch((async s=>{if("auth/missing-recaptcha-token"===s.code){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);const s=await Mp(t,e,n,"getOobCode"===n);return r(t,s)}return Promise.reject(s)}))}
2522
2521
  /**
2523
2522
  * @license
2524
2523
  * Copyright 2020 Google LLC
@@ -2534,7 +2533,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2534
2533
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2535
2534
  * See the License for the specific language governing permissions and
2536
2535
  * limitations under the License.
2537
- */function xp(t,e,n){const r=Np(t);kf(r._canInitEmulator,r,"emulator-config-failed"),kf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=Up(e),{host:o,port:a}=function(t){const e=Up(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:Fp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Fp(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
2536
+ */function Up(t,e,n){const r=Rp(t);Nf(r._canInitEmulator,r,"emulator-config-failed"),Nf(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!!(null==n?void 0:n.disableWarnings),i=Fp(e),{host:o,port:a}=function(t){const e=Fp(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const t=s[1];return{host:t,port:Vp(r.substr(t.length+1))}}{const[t,e]=r.split(":");return{host:t,port:Vp(e)}}}(e),c=null===a?"":`:${a}`;r.config.emulator={url:`${i}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})}),s||function(){function t(){const t=document.createElement("p"),e=t.style;t.innerText="Running in emulator mode. Do not use with production credentials.",e.position="fixed",e.width="100%",e.backgroundColor="#ffffff",e.border=".1em solid #000000",e.color="#b50000",e.bottom="0px",e.left="0px",e.margin="0px",e.zIndex="10000",e.textAlign="center",t.classList.add("firebase-emulator-warning"),document.body.appendChild(t)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials.");"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",t):t())}
2538
2537
  /**
2539
2538
  * @license
2540
2539
  * Copyright 2020 Google LLC
@@ -2550,7 +2549,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2550
2549
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2551
2550
  * See the License for the specific language governing permissions and
2552
2551
  * limitations under the License.
2553
- */()}function Up(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Fp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Vp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Nf("not implemented")}_getIdTokenResponse(t){return Nf("not implemented")}_linkToIdToken(t,e){return Nf("not implemented")}_getReauthenticationResolver(t){return Nf("not implemented")}}
2552
+ */()}function Fp(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function Vp(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}class Bp{constructor(t,e){this.providerId=t,this.signInMethod=e}toJSON(){return Rf("not implemented")}_getIdTokenResponse(t){return Rf("not implemented")}_linkToIdToken(t,e){return Rf("not implemented")}_getReauthenticationResolver(t){return Rf("not implemented")}}
2554
2553
  /**
2555
2554
  * @license
2556
2555
  * Copyright 2020 Google LLC
@@ -2566,7 +2565,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2566
2565
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2567
2566
  * See the License for the specific language governing permissions and
2568
2567
  * limitations under the License.
2569
- */async function Bp(t,e){return Bf(t,"POST","/v1/accounts:signUp",e)}
2568
+ */async function Hp(t,e){return Hf(t,"POST","/v1/accounts:signUp",e)}
2570
2569
  /**
2571
2570
  * @license
2572
2571
  * Copyright 2020 Google LLC
@@ -2582,7 +2581,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2582
2581
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2583
2582
  * See the License for the specific language governing permissions and
2584
2583
  * limitations under the License.
2585
- */async function Hp(t,e){return jf(t,"POST","/v1/accounts:signInWithPassword",Vf(t,e))}async function jp(t,e){return async function(t,e){return Bf(t,"POST","/v1/accounts:sendOobCode",Vf(t,e))}(t,e)}
2584
+ */async function jp(t,e){return $f(t,"POST","/v1/accounts:signInWithPassword",Bf(t,e))}async function $p(t,e){return async function(t,e){return Hf(t,"POST","/v1/accounts:sendOobCode",Bf(t,e))}(t,e)}
2586
2585
  /**
2587
2586
  * @license
2588
2587
  * Copyright 2020 Google LLC
@@ -2615,7 +2614,7 @@ async function(t,e){return Bf(t,"POST","/v1/accounts:delete",e)}(this.auth,{idTo
2615
2614
  * See the License for the specific language governing permissions and
2616
2615
  * limitations under the License.
2617
2616
  */
2618
- class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new $p(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new $p(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return Mp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",Hp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{email:this._email,oobCode:this._password});default:Sf(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return Mp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Bp);case"emailLink":return async function(t,e){return jf(t,"POST","/v1/accounts:signInWithEmailLink",Vf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:Sf(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2617
+ class qp extends Bp{constructor(t,e,n,r=null){super("password",n),this._email=t,this._password=e,this._tenantId=r}static _fromEmailAndPassword(t,e){return new qp(t,e,"password")}static _fromEmailAndCode(t,e,n=null){return new qp(t,e,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t;if((null==e?void 0:e.email)&&(null==e?void 0:e.password)){if("password"===e.signInMethod)return this._fromEmailAndPassword(e.email,e.password);if("emailLink"===e.signInMethod)return this._fromEmailAndCode(e.email,e.password,e.tenantId)}return null}async _getIdTokenResponse(t){switch(this.signInMethod){case"password":return xp(t,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",jp);case"emailLink":return async function(t,e){return $f(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{email:this._email,oobCode:this._password});default:If(t,"internal-error")}}async _linkToIdToken(t,e){switch(this.signInMethod){case"password":return xp(t,{idToken:e,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Hp);case"emailLink":return async function(t,e){return $f(t,"POST","/v1/accounts:signInWithEmailLink",Bf(t,e))}(t,{idToken:e,email:this._email,oobCode:this._password});default:If(t,"internal-error")}}_getReauthenticationResolver(t){return this._getIdTokenResponse(t)}}
2619
2618
  /**
2620
2619
  * @license
2621
2620
  * Copyright 2020 Google LLC
@@ -2631,7 +2630,7 @@ class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2631
2630
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2632
2631
  * See the License for the specific language governing permissions and
2633
2632
  * limitations under the License.
2634
- */async function qp(t,e){return jf(t,"POST","/v1/accounts:signInWithIdp",Vf(t,e))}
2633
+ */async function Kp(t,e){return $f(t,"POST","/v1/accounts:signInWithIdp",Bf(t,e))}
2635
2634
  /**
2636
2635
  * @license
2637
2636
  * Copyright 2020 Google LLC
@@ -2647,7 +2646,7 @@ class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2647
2646
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2648
2647
  * See the License for the specific language governing permissions and
2649
2648
  * limitations under the License.
2650
- */class Kp extends Vp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Kp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):Sf("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,s=mf(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Kp(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(t){return qp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,qp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,qp(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=v(e)}return t}}
2649
+ */class Wp extends Bp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(t){const e=new Wp(t.providerId,t.signInMethod);return t.idToken||t.accessToken?(t.idToken&&(e.idToken=t.idToken),t.accessToken&&(e.accessToken=t.accessToken),t.nonce&&!t.pendingToken&&(e.nonce=t.nonce),t.pendingToken&&(e.pendingToken=t.pendingToken)):t.oauthToken&&t.oauthTokenSecret?(e.accessToken=t.oauthToken,e.secret=t.oauthTokenSecret):If("argument-error"),e}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(t){const e="string"==typeof t?JSON.parse(t):t,{providerId:n,signInMethod:r}=e,s=yf(e,["providerId","signInMethod"]);if(!n||!r)return null;const i=new Wp(n,r);return i.idToken=s.idToken||void 0,i.accessToken=s.accessToken||void 0,i.secret=s.secret,i.nonce=s.nonce,i.pendingToken=s.pendingToken||null,i}_getIdTokenResponse(t){return Kp(t,this.buildRequest())}_linkToIdToken(t,e){const n=this.buildRequest();return n.idToken=e,Kp(t,n)}_getReauthenticationResolver(t){const e=this.buildRequest();return e.autoCreate=!1,Kp(t,e)}buildRequest(){const t={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)t.pendingToken=this.pendingToken;else{const e={};this.idToken&&(e.id_token=this.idToken),this.accessToken&&(e.access_token=this.accessToken),this.secret&&(e.oauth_token_secret=this.secret),e.providerId=this.providerId,this.nonce&&!this.pendingToken&&(e.nonce=this.nonce),t.postBody=v(e)}return t}}
2651
2650
  /**
2652
2651
  * @license
2653
2652
  * Copyright 2020 Google LLC
@@ -2663,7 +2662,7 @@ class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2663
2662
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2664
2663
  * See the License for the specific language governing permissions and
2665
2664
  * limitations under the License.
2666
- */class Wp{constructor(t){var e,n,r,s,i,o;const a=w(_(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);kf(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=w(_(t)).link,n=e?w(_(e)).deep_link_id:null,r=w(_(t)).deep_link_id;return(r?w(_(r)).link:null)||r||n||e||t}(t);try{return new Wp(e)}catch(t){return null}}}
2665
+ */class zp{constructor(t){var e,n,r,s,i,o;const a=w(_(t)),c=null!==(e=a.apiKey)&&void 0!==e?e:null,u=null!==(n=a.oobCode)&&void 0!==n?n:null,h=function(t){switch(t){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(r=a.mode)&&void 0!==r?r:null);Nf(c&&u&&h,"argument-error"),this.apiKey=c,this.operation=h,this.code=u,this.continueUrl=null!==(s=a.continueUrl)&&void 0!==s?s:null,this.languageCode=null!==(i=a.languageCode)&&void 0!==i?i:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(t){const e=function(t){const e=w(_(t)).link,n=e?w(_(e)).deep_link_id:null,r=w(_(t)).deep_link_id;return(r?w(_(r)).link:null)||r||n||e||t}(t);try{return new zp(e)}catch(t){return null}}}
2667
2666
  /**
2668
2667
  * @license
2669
2668
  * Copyright 2020 Google LLC
@@ -2679,7 +2678,7 @@ class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2679
2678
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2680
2679
  * See the License for the specific language governing permissions and
2681
2680
  * limitations under the License.
2682
- */class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return $p._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=Wp.parseLink(e);return kf(n,"argument-error"),$p._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2681
+ */class Gp{constructor(){this.providerId=Gp.PROVIDER_ID}static credential(t,e){return qp._fromEmailAndPassword(t,e)}static credentialWithLink(t,e){const n=zp.parseLink(e);return Nf(n,"argument-error"),qp._fromEmailAndCode(t,n.code,n.tenantId)}}Gp.PROVIDER_ID="password",Gp.EMAIL_PASSWORD_SIGN_IN_METHOD="password",Gp.EMAIL_LINK_SIGN_IN_METHOD="emailLink";
2683
2682
  /**
2684
2683
  * @license
2685
2684
  * Copyright 2020 Google LLC
@@ -2696,7 +2695,7 @@ class $p extends Vp{constructor(t,e,n,r=null){super("password",n),this._email=t,
2696
2695
  * See the License for the specific language governing permissions and
2697
2696
  * limitations under the License.
2698
2697
  */
2699
- class zp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
2698
+ class Qp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(t){this.defaultLanguageCode=t}setCustomParameters(t){return this.customParameters=t,this}getCustomParameters(){return this.customParameters}}
2700
2699
  /**
2701
2700
  * @license
2702
2701
  * Copyright 2019 Google LLC
@@ -2712,7 +2711,7 @@ class zp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2712
2711
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2713
2712
  * See the License for the specific language governing permissions and
2714
2713
  * limitations under the License.
2715
- */class Qp extends zp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2714
+ */class Yp extends Qp{constructor(){super(...arguments),this.scopes=[]}addScope(t){return this.scopes.includes(t)||this.scopes.push(t),this}getScopes(){return[...this.scopes]}}
2716
2715
  /**
2717
2716
  * @license
2718
2717
  * Copyright 2020 Google LLC
@@ -2728,7 +2727,7 @@ class zp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2728
2727
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2729
2728
  * See the License for the specific language governing permissions and
2730
2729
  * limitations under the License.
2731
- */class Yp extends Qp{constructor(){super("facebook.com")}static credential(t){return Kp._fromParams({providerId:Yp.PROVIDER_ID,signInMethod:Yp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Yp.credentialFromTaggedObject(t)}static credentialFromError(t){return Yp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Yp.credential(t.oauthAccessToken)}catch(t){return null}}}Yp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Yp.PROVIDER_ID="facebook.com";
2730
+ */class Jp extends Yp{constructor(){super("facebook.com")}static credential(t){return Wp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.FACEBOOK_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Jp.credential(t.oauthAccessToken)}catch(t){return null}}}Jp.FACEBOOK_SIGN_IN_METHOD="facebook.com",Jp.PROVIDER_ID="facebook.com";
2732
2731
  /**
2733
2732
  * @license
2734
2733
  * Copyright 2020 Google LLC
@@ -2745,7 +2744,7 @@ class zp{constructor(t){this.providerId=t,this.defaultLanguageCode=null,this.cus
2745
2744
  * See the License for the specific language governing permissions and
2746
2745
  * limitations under the License.
2747
2746
  */
2748
- class Jp extends Qp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Kp._fromParams({providerId:Jp.PROVIDER_ID,signInMethod:Jp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Jp.credentialFromTaggedObject(t)}static credentialFromError(t){return Jp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Jp.credential(e,n)}catch(t){return null}}}Jp.GOOGLE_SIGN_IN_METHOD="google.com",Jp.PROVIDER_ID="google.com";
2747
+ class Xp extends Yp{constructor(){super("google.com"),this.addScope("profile")}static credential(t,e){return Wp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GOOGLE_SIGN_IN_METHOD,idToken:t,accessToken:e})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthIdToken:e,oauthAccessToken:n}=t;if(!e&&!n)return null;try{return Xp.credential(e,n)}catch(t){return null}}}Xp.GOOGLE_SIGN_IN_METHOD="google.com",Xp.PROVIDER_ID="google.com";
2749
2748
  /**
2750
2749
  * @license
2751
2750
  * Copyright 2020 Google LLC
@@ -2762,7 +2761,7 @@ class Jp extends Qp{constructor(){super("google.com"),this.addScope("profile")}s
2762
2761
  * See the License for the specific language governing permissions and
2763
2762
  * limitations under the License.
2764
2763
  */
2765
- class Xp extends Qp{constructor(){super("github.com")}static credential(t){return Kp._fromParams({providerId:Xp.PROVIDER_ID,signInMethod:Xp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Xp.credentialFromTaggedObject(t)}static credentialFromError(t){return Xp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Xp.credential(t.oauthAccessToken)}catch(t){return null}}}Xp.GITHUB_SIGN_IN_METHOD="github.com",Xp.PROVIDER_ID="github.com";
2764
+ class Zp extends Yp{constructor(){super("github.com")}static credential(t){return Wp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.GITHUB_SIGN_IN_METHOD,accessToken:t})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t||!("oauthAccessToken"in t))return null;if(!t.oauthAccessToken)return null;try{return Zp.credential(t.oauthAccessToken)}catch(t){return null}}}Zp.GITHUB_SIGN_IN_METHOD="github.com",Zp.PROVIDER_ID="github.com";
2766
2765
  /**
2767
2766
  * @license
2768
2767
  * Copyright 2020 Google LLC
@@ -2779,7 +2778,7 @@ class Xp extends Qp{constructor(){super("github.com")}static credential(t){retur
2779
2778
  * See the License for the specific language governing permissions and
2780
2779
  * limitations under the License.
2781
2780
  */
2782
- class Zp extends Qp{constructor(){super("twitter.com")}static credential(t,e){return Kp._fromParams({providerId:Zp.PROVIDER_ID,signInMethod:Zp.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return Zp.credentialFromTaggedObject(t)}static credentialFromError(t){return Zp.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return Zp.credential(e,n)}catch(t){return null}}}Zp.TWITTER_SIGN_IN_METHOD="twitter.com",Zp.PROVIDER_ID="twitter.com";
2781
+ class tg extends Yp{constructor(){super("twitter.com")}static credential(t,e){return Wp._fromParams({providerId:tg.PROVIDER_ID,signInMethod:tg.TWITTER_SIGN_IN_METHOD,oauthToken:t,oauthTokenSecret:e})}static credentialFromResult(t){return tg.credentialFromTaggedObject(t)}static credentialFromError(t){return tg.credentialFromTaggedObject(t.customData||{})}static credentialFromTaggedObject({_tokenResponse:t}){if(!t)return null;const{oauthAccessToken:e,oauthTokenSecret:n}=t;if(!e||!n)return null;try{return tg.credential(e,n)}catch(t){return null}}}tg.TWITTER_SIGN_IN_METHOD="twitter.com",tg.PROVIDER_ID="twitter.com";
2783
2782
  /**
2784
2783
  * @license
2785
2784
  * Copyright 2020 Google LLC
@@ -2796,7 +2795,7 @@ class Zp extends Qp{constructor(){super("twitter.com")}static credential(t,e){re
2796
2795
  * See the License for the specific language governing permissions and
2797
2796
  * limitations under the License.
2798
2797
  */
2799
- class tg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await ap._fromIdTokenResponse(t,n,r),i=eg(n);return new tg({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=eg(n);return new tg({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function eg(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2798
+ class eg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._tokenResponse=t._tokenResponse,this.operationType=t.operationType}static async _fromIdTokenResponse(t,e,n,r=!1){const s=await cp._fromIdTokenResponse(t,n,r),i=ng(n);return new eg({user:s,providerId:i,_tokenResponse:n,operationType:e})}static async _forOperation(t,e,n){await t._updateTokensIfNecessary(n,!0);const r=ng(n);return new eg({user:t,providerId:r,_tokenResponse:n,operationType:e})}}function ng(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}
2800
2799
  /**
2801
2800
  * @license
2802
2801
  * Copyright 2020 Google LLC
@@ -2812,7 +2811,7 @@ class tg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2812
2811
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2813
2812
  * See the License for the specific language governing permissions and
2814
2813
  * limitations under the License.
2815
- */class ng extends f{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,ng.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new ng(t,e,n,r)}}function rg(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw ng._fromErrorAndOperation(t,n,e,r);throw n}))}
2814
+ */class rg extends f{constructor(t,e,n,r){var s;super(e.code,e.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,rg.prototype),this.customData={appName:t.name,tenantId:null!==(s=t.tenantId)&&void 0!==s?s:void 0,_serverResponse:e.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(t,e,n,r){return new rg(t,e,n,r)}}function sg(t,e,n,r){return("reauthenticate"===e?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw rg._fromErrorAndOperation(t,n,e,r);throw n}))}
2816
2815
  /**
2817
2816
  * @license
2818
2817
  * Copyright 2020 Google LLC
@@ -2829,7 +2828,7 @@ class tg{constructor(t){this.user=t.user,this.providerId=t.providerId,this._toke
2829
2828
  * See the License for the specific language governing permissions and
2830
2829
  * limitations under the License.
2831
2830
  */
2832
- async function sg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const r="signIn",s=await rg(t,r,e),i=await tg._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2831
+ async function ig(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const r="signIn",s=await sg(t,r,e),i=await eg._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}
2833
2832
  /**
2834
2833
  * @license
2835
2834
  * Copyright 2020 Google LLC
@@ -2846,7 +2845,7 @@ async function sg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const r="s
2846
2845
  * See the License for the specific language governing permissions and
2847
2846
  * limitations under the License.
2848
2847
  */
2849
- async function ig(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function og(t,e,n){const r=Np(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
2848
+ async function og(t){const e=Rp(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ag(t,e,n){const r=Rp(t),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&
2850
2849
  /**
2851
2850
  * @license
2852
2851
  * Copyright 2020 Google LLC
@@ -2863,7 +2862,7 @@ async function ig(t){const e=Np(t);e._getPasswordPolicyInternal()&&await e._upda
2863
2862
  * See the License for the specific language governing permissions and
2864
2863
  * limitations under the License.
2865
2864
  */
2866
- function(t,e,n){var r;kf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),kf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(kf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(kf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,s,n),await Mp(r,s,"getOobCode",jp)}async function ag(t,e,n){await async function(t,e){return Bf(t,"POST","/v1/accounts:resetPassword",Vf(t,e))}(S(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ig(t),e}))}function cg(t,e,n){return Pt(t.app)?Promise.reject(Af(t)):async function(t,e){return sg(Np(t),e)}(S(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&ig(t),e}))}const ug="__sak";
2865
+ function(t,e,n){var r;Nf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"invalid-continue-uri"),Nf(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(Nf(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(Nf(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}(r,s,n),await xp(r,s,"getOobCode",$p)}async function cg(t,e,n){await async function(t,e){return Hf(t,"POST","/v1/accounts:resetPassword",Bf(t,e))}(S(t),{oobCode:e,newPassword:n}).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}function ug(t,e,n){return Pt(t.app)?Promise.reject(Cf(t)):async function(t,e){return ig(Rp(t),e)}(S(t),Gp.credential(e,n)).catch((async e=>{throw"auth/password-does-not-meet-requirements"===e.code&&og(t),e}))}const hg="__sak";
2867
2866
  /**
2868
2867
  * @license
2869
2868
  * Copyright 2019 Google LLC
@@ -2879,7 +2878,7 @@ function(t,e,n){var r;kf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2879
2878
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2880
2879
  * See the License for the specific language governing permissions and
2881
2880
  * limitations under the License.
2882
- */class hg{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(ug,"1"),this.storage.removeItem(ug),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
2881
+ */class lg{constructor(t,e){this.storageRetriever=t,this.type=e}_isAvailable(){try{return this.storage?(this.storage.setItem(hg,"1"),this.storage.removeItem(hg),Promise.resolve(!0)):Promise.resolve(!1)}catch(t){return Promise.resolve(!1)}}_set(t,e){return this.storage.setItem(t,JSON.stringify(e)),Promise.resolve()}_get(t){const e=this.storage.getItem(t);return Promise.resolve(e?JSON.parse(e):null)}_remove(t){return this.storage.removeItem(t),Promise.resolve()}get storage(){return this.storageRetriever()}}
2883
2882
  /**
2884
2883
  * @license
2885
2884
  * Copyright 2020 Google LLC
@@ -2895,7 +2894,7 @@ function(t,e,n){var r;kf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2895
2894
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2896
2895
  * See the License for the specific language governing permissions and
2897
2896
  * limitations under the License.
2898
- */class lg extends hg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Ip(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);Sp()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}lg.type="LOCAL";const dg=lg;
2897
+ */class dg extends lg{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(t,e)=>this.onStorageEvent(t,e),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=bp(),this._shouldAllowMigration=!0}forAllChangedKeys(t){for(const e of Object.keys(this.listeners)){const n=this.storage.getItem(e),r=this.localCache[e];n!==r&&t(e,r,n)}}onStorageEvent(t,e=!1){if(!t.key)return void this.forAllChangedKeys(((t,e,n)=>{this.notifyListeners(t,n)}));const n=t.key;e?this.detachListener():this.stopPolling();const r=()=>{const t=this.storage.getItem(n);(e||this.localCache[n]!==t)&&this.notifyListeners(n,t)},s=this.storage.getItem(n);Ip()&&s!==t.newValue&&t.newValue!==t.oldValue?setTimeout(r,10):r()}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e?JSON.parse(e):e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((t,e,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:t,oldValue:e,newValue:n}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(t,e){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[t]||(this.listeners[t]=new Set,this.localCache[t]=this.storage.getItem(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(t,e){await super._set(t,e),this.localCache[t]=JSON.stringify(e)}async _get(t){const e=await super._get(t);return this.localCache[t]=JSON.stringify(e),e}async _remove(t){await super._remove(t),delete this.localCache[t]}}dg.type="LOCAL";const fg=dg;
2899
2898
  /**
2900
2899
  * @license
2901
2900
  * Copyright 2020 Google LLC
@@ -2911,7 +2910,7 @@ function(t,e,n){var r;kf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2911
2910
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2912
2911
  * See the License for the specific language governing permissions and
2913
2912
  * limitations under the License.
2914
- */class fg extends hg{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}fg.type="SESSION";const pg=fg;
2913
+ */class pg extends lg{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(t,e){}_removeListener(t,e){}}pg.type="SESSION";const gg=pg;
2915
2914
  /**
2916
2915
  * @license
2917
2916
  * Copyright 2019 Google LLC
@@ -2944,7 +2943,7 @@ function(t,e,n){var r;kf((null===(r=n.url)||void 0===r?void 0:r.length)>0,t,"inv
2944
2943
  * See the License for the specific language governing permissions and
2945
2944
  * limitations under the License.
2946
2945
  */
2947
- class gg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new gg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:s}=e.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2946
+ class mg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(t){const e=this.receivers.find((e=>e.isListeningto(t)));if(e)return e;const n=new mg(t);return this.receivers.push(n),n}isListeningto(t){return this.eventTarget===t}async handleEvent(t){const e=t,{eventId:n,eventType:r,data:s}=e.data,i=this.handlersMap[r];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:n,eventType:r});const o=Array.from(i).map((async t=>t(e.origin,s))),a=await function(t){return Promise.all(t.map((async t=>{try{return{fulfilled:!0,value:await t}}catch(t){return{fulfilled:!1,reason:t}}})))}(o);e.ports[0].postMessage({status:"done",eventId:n,eventType:r,response:a})}_subscribe(t,e){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[t]||(this.handlersMap[t]=new Set),this.handlersMap[t].add(e)}_unsubscribe(t,e){this.handlersMap[t]&&e&&this.handlersMap[t].delete(e),e&&0!==this.handlersMap[t].size||delete this.handlersMap[t],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}
2948
2947
  /**
2949
2948
  * @license
2950
2949
  * Copyright 2020 Google LLC
@@ -2961,7 +2960,7 @@ class gg{constructor(t){this.eventTarget=t,this.handlersMap={},this.boundEventHa
2961
2960
  * See the License for the specific language governing permissions and
2962
2961
  * limitations under the License.
2963
2962
  */
2964
- function mg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2963
+ function yg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random());return t+n}
2965
2964
  /**
2966
2965
  * @license
2967
2966
  * Copyright 2019 Google LLC
@@ -2977,7 +2976,7 @@ function mg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2977
2976
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2978
2977
  * See the License for the specific language governing permissions and
2979
2978
  * limitations under the License.
2980
- */gg.receivers=[];class yg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=mg("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2979
+ */mg.receivers=[];class vg{constructor(t){this.target=t,this.handlers=new Set}removeMessageHandler(t){t.messageChannel&&(t.messageChannel.port1.removeEventListener("message",t.onMessage),t.messageChannel.port1.close()),this.handlers.delete(t)}async _send(t,e,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,i;return new Promise(((o,a)=>{const c=yg("",20);r.port1.start();const u=setTimeout((()=>{a(new Error("unsupported_event"))}),n);i={messageChannel:r,onMessage(t){const e=t;if(e.data.eventId===c)switch(e.data.status){case"ack":clearTimeout(u),s=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(s),o(e.data.response);break;default:clearTimeout(u),clearTimeout(s),a(new Error("invalid_response"))}}},this.handlers.add(i),r.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:t,eventId:c,data:e},[r.port2])})).finally((()=>{i&&this.removeMessageHandler(i)}))}}
2981
2980
  /**
2982
2981
  * @license
2983
2982
  * Copyright 2020 Google LLC
@@ -2993,7 +2992,7 @@ function mg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
2993
2992
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2994
2993
  * See the License for the specific language governing permissions and
2995
2994
  * limitations under the License.
2996
- */function vg(){return window}
2995
+ */function wg(){return window}
2997
2996
  /**
2998
2997
  * @license
2999
2998
  * Copyright 2020 Google LLC.
@@ -3010,7 +3009,7 @@ function mg(t="",e=10){let n="";for(let t=0;t<e;t++)n+=Math.floor(10*Math.random
3010
3009
  * See the License for the specific language governing permissions and
3011
3010
  * limitations under the License.
3012
3011
  */
3013
- function wg(){return void 0!==vg().WorkerGlobalScope&&"function"==typeof vg().importScripts}
3012
+ function _g(){return void 0!==wg().WorkerGlobalScope&&"function"==typeof wg().importScripts}
3014
3013
  /**
3015
3014
  * @license
3016
3015
  * Copyright 2019 Google LLC
@@ -3027,7 +3026,7 @@ function wg(){return void 0!==vg().WorkerGlobalScope&&"function"==typeof vg().im
3027
3026
  * See the License for the specific language governing permissions and
3028
3027
  * limitations under the License.
3029
3028
  */
3030
- const _g="firebaseLocalStorageDb",Tg="firebaseLocalStorage",Eg="fbase_key";class Sg{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function Ig(t,e){return t.transaction([Tg],e?"readwrite":"readonly").objectStore(Tg)}function bg(){const t=indexedDB.open(_g,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Tg,{keyPath:Eg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Tg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(_g);return new Sg(t).toPromise()}(),e(await bg()))}))}))}async function Ag(t,e,n){const r=Ig(t,!0).put({[Eg]:e,value:n});return new Sg(r).toPromise()}function Cg(t,e){const n=Ig(t,!0).delete(e);return new Sg(n).toPromise()}class kg{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 bg()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return wg()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=gg._getInstance(wg()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new yg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await bg();return await Ag(t,ug,"1"),await Cg(t,ug),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Ag(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=Ig(t,!1).get(e),r=await new Sg(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>Cg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=Ig(t,!1).getAll();return new Sg(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}kg.type="LOCAL";const Ng=kg;new Pf(3e4,6e4);
3029
+ const Tg="firebaseLocalStorageDb",Eg="firebaseLocalStorage",Sg="fbase_key";class Ig{constructor(t){this.request=t}toPromise(){return new Promise(((t,e)=>{this.request.addEventListener("success",(()=>{t(this.request.result)})),this.request.addEventListener("error",(()=>{e(this.request.error)}))}))}}function bg(t,e){return t.transaction([Eg],e?"readwrite":"readonly").objectStore(Eg)}function Ag(){const t=indexedDB.open(Tg,1);return new Promise(((e,n)=>{t.addEventListener("error",(()=>{n(t.error)})),t.addEventListener("upgradeneeded",(()=>{const e=t.result;try{e.createObjectStore(Eg,{keyPath:Sg})}catch(t){n(t)}})),t.addEventListener("success",(async()=>{const n=t.result;n.objectStoreNames.contains(Eg)?e(n):(n.close(),await function(){const t=indexedDB.deleteDatabase(Tg);return new Ig(t).toPromise()}(),e(await Ag()))}))}))}async function Cg(t,e,n){const r=bg(t,!0).put({[Sg]:e,value:n});return new Ig(r).toPromise()}function kg(t,e){const n=bg(t,!0).delete(e);return new Ig(n).toPromise()}class Ng{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Ag()),this.db}async _withRetries(t){let e=0;for(;;)try{const e=await this._openDb();return await t(e)}catch(t){if(e++>3)throw t;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return _g()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=mg._getInstance(_g()?self:null),this.receiver._subscribe("keyChanged",(async(t,e)=>({keyProcessed:(await this._poll()).includes(e.key)}))),this.receiver._subscribe("ping",(async(t,e)=>["keyChanged"]))}async initializeSender(){var t,e;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(t){return null}}(),!this.activeServiceWorker)return;this.sender=new vg(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(t=n[0])||void 0===t?void 0:t.fulfilled)&&(null===(e=n[0])||void 0===e?void 0:e.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(t){if(this.sender&&this.activeServiceWorker&&function(){var t;return(null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null}()===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:t},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const t=await Ag();return await Cg(t,hg,"1"),await kg(t,hg),!0}catch(t){}return!1}async _withPendingWrite(t){this.pendingWrites++;try{await t()}finally{this.pendingWrites--}}async _set(t,e){return this._withPendingWrite((async()=>(await this._withRetries((n=>Cg(n,t,e))),this.localCache[t]=e,this.notifyServiceWorker(t))))}async _get(t){const e=await this._withRetries((e=>async function(t,e){const n=bg(t,!1).get(e),r=await new Ig(n).toPromise();return void 0===r?null:r.value}(e,t)));return this.localCache[t]=e,e}async _remove(t){return this._withPendingWrite((async()=>(await this._withRetries((e=>kg(e,t))),delete this.localCache[t],this.notifyServiceWorker(t))))}async _poll(){const t=await this._withRetries((t=>{const e=bg(t,!1).getAll();return new Ig(e).toPromise()}));if(!t)return[];if(0!==this.pendingWrites)return[];const e=[],n=new Set;if(0!==t.length)for(const{fbase_key:r,value:s}of t)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),e.push(r));for(const t of Object.keys(this.localCache))this.localCache[t]&&!n.has(t)&&(this.notifyListeners(t,null),e.push(t));return e}notifyListeners(t,e){this.localCache[t]=e;const n=this.listeners[t];if(n)for(const t of Array.from(n))t(e)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(t,e){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[t]||(this.listeners[t]=new Set,this._get(t)),this.listeners[t].add(e)}_removeListener(t,e){this.listeners[t]&&(this.listeners[t].delete(e),0===this.listeners[t].size&&delete this.listeners[t]),0===Object.keys(this.listeners).length&&this.stopPolling()}}Ng.type="LOCAL";const Rg=Ng;new Mf(3e4,6e4);
3031
3030
  /**
3032
3031
  * @license
3033
3032
  * Copyright 2019 Google LLC
@@ -3044,7 +3043,7 @@ const _g="firebaseLocalStorageDb",Tg="firebaseLocalStorage",Eg="fbase_key";class
3044
3043
  * See the License for the specific language governing permissions and
3045
3044
  * limitations under the License.
3046
3045
  */
3047
- class Rg extends Vp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return qp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return qp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return qp(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Og(t){return sg(t.auth,new Rg(t),t.bypassAuthState)}function Dg(t){const{auth:e,user:n}=t;return kf(n,e,"internal-error"),
3046
+ class Og extends Bp{constructor(t){super("custom","custom"),this.params=t}_getIdTokenResponse(t){return Kp(t,this._buildIdpRequest())}_linkToIdToken(t,e){return Kp(t,this._buildIdpRequest(e))}_getReauthenticationResolver(t){return Kp(t,this._buildIdpRequest())}_buildIdpRequest(t){const e={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return t&&(e.idToken=t),e}}function Dg(t){return ig(t.auth,new Og(t),t.bypassAuthState)}function Lg(t){const{auth:e,user:n}=t;return Nf(n,e,"internal-error"),
3048
3047
  /**
3049
3048
  * @license
3050
3049
  * Copyright 2019 Google LLC
@@ -3061,7 +3060,7 @@ class Rg extends Vp{constructor(t){super("custom","custom"),this.params=t}_getId
3061
3060
  * See the License for the specific language governing permissions and
3062
3061
  * limitations under the License.
3063
3062
  */
3064
- async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Af(r));const s="reauthenticate";try{const i=await tp(t,rg(r,s,e,t),n);kf(i.idToken,r,"internal-error");const o=Xf(i.idToken);kf(o,r,"internal-error");const{sub:a}=o;return kf(t.uid===a,r,"user-mismatch"),tg._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&Sf(r,"user-mismatch"),t}}(n,new Rg(t),t.bypassAuthState)}async function Lg(t){const{auth:e,user:n}=t;return kf(n,e,"internal-error"),async function(t,e,n=!1){const r=await tp(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return tg._forOperation(t,"link",r)}(n,new Rg(t),t.bypassAuthState)}
3063
+ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Cf(r));const s="reauthenticate";try{const i=await ep(t,sg(r,s,e,t),n);Nf(i.idToken,r,"internal-error");const o=Zf(i.idToken);Nf(o,r,"internal-error");const{sub:a}=o;return Nf(t.uid===a,r,"user-mismatch"),eg._forOperation(t,s,i)}catch(t){throw"auth/user-not-found"===(null==t?void 0:t.code)&&If(r,"user-mismatch"),t}}(n,new Og(t),t.bypassAuthState)}async function Pg(t){const{auth:e,user:n}=t;return Nf(n,e,"internal-error"),async function(t,e,n=!1){const r=await ep(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return eg._forOperation(t,"link",r)}(n,new Og(t),t.bypassAuthState)}
3065
3064
  /**
3066
3065
  * @license
3067
3066
  * Copyright 2020 Google LLC
@@ -3077,7 +3076,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Af(r
3077
3076
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3078
3077
  * See the License for the specific language governing permissions and
3079
3078
  * limitations under the License.
3080
- */class Pg{constructor(t,e,n,r,s=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Og;case"linkViaPopup":case"linkViaRedirect":return Lg;case"reauthViaPopup":case"reauthViaRedirect":return Dg;default:Sf(this.auth,"internal-error")}}resolve(t){Rf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Rf(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
3079
+ */class Mg{constructor(t,e,n,r,s=!1){this.auth=t,this.resolver=n,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(e)?e:[e]}execute(){return new Promise((async(t,e)=>{this.pendingPromise={resolve:t,reject:e};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(t){this.reject(t)}}))}async onAuthEvent(t){const{urlResponse:e,sessionId:n,postBody:r,tenantId:s,error:i,type:o}=t;if(i)return void this.reject(i);const a={auth:this.auth,requestUri:e,sessionId:n,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(t){this.reject(t)}}onError(t){this.reject(t)}getIdpTask(t){switch(t){case"signInViaPopup":case"signInViaRedirect":return Dg;case"linkViaPopup":case"linkViaRedirect":return Pg;case"reauthViaPopup":case"reauthViaRedirect":return Lg;default:If(this.auth,"internal-error")}}resolve(t){Of(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(t),this.unregisterAndCleanUp()}reject(t){Of(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(t),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}
3081
3080
  /**
3082
3081
  * @license
3083
3082
  * Copyright 2020 Google LLC
@@ -3093,7 +3092,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Af(r
3093
3092
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3094
3093
  * See the License for the specific language governing permissions and
3095
3094
  * limitations under the License.
3096
- */const Mg=new Pf(2e3,1e4);class xg extends Pg{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,xg.currentPopupAction&&xg.currentPopupAction.cancel(),xg.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return kf(t,this.auth,"internal-error"),t}async onExecution(){Rf(1===this.filter.length,"Popup operations only handle one event");const t=mg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(If(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(If(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,xg.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(If(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,Mg.get())};t()}}xg.currentPopupAction=null;
3095
+ */const xg=new Mf(2e3,1e4);class Ug extends Mg{constructor(t,e,n,r,s){super(t,e,r,s),this.provider=n,this.authWindow=null,this.pollId=null,Ug.currentPopupAction&&Ug.currentPopupAction.cancel(),Ug.currentPopupAction=this}async executeNotNull(){const t=await this.execute();return Nf(t,this.auth,"internal-error"),t}async onExecution(){Of(1===this.filter.length,"Popup operations only handle one event");const t=yg();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],t),this.authWindow.associatedEvent=t,this.resolver._originValidation(this.auth).catch((t=>{this.reject(t)})),this.resolver._isIframeWebStorageSupported(this.auth,(t=>{t||this.reject(bf(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var t;return(null===(t=this.authWindow)||void 0===t?void 0:t.associatedEvent)||null}cancel(){this.reject(bf(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ug.currentPopupAction=null}pollUserCancellation(){const t=()=>{var e,n;(null===(n=null===(e=this.authWindow)||void 0===e?void 0:e.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(bf(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(t,xg.get())};t()}}Ug.currentPopupAction=null;
3097
3096
  /**
3098
3097
  * @license
3099
3098
  * Copyright 2020 Google LLC
@@ -3110,7 +3109,7 @@ async function(t,e,n=!1){const{auth:r}=t;if(Pt(r.app))return Promise.reject(Af(r
3110
3109
  * See the License for the specific language governing permissions and
3111
3110
  * limitations under the License.
3112
3111
  */
3113
- const Ug="pendingRedirect",Fg=new Map;class Vg extends Pg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Fg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return dp(Ug,t.config.apiKey,t.name)}(e),r=function(t){return up(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}Fg.set(this.auth._key(),t)}return this.bypassAuthState||Fg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Bg(t,e){Fg.set(t._key(),e)}async function Hg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Af(t));const r=Np(t),s=
3112
+ const Fg="pendingRedirect",Vg=new Map;class Bg extends Mg{constructor(t,e,n=!1){super(t,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],e,void 0,n),this.eventId=null}async execute(){let t=Vg.get(this.auth._key());if(!t){try{const e=await async function(t,e){const n=function(t){return fp(Fg,t.config.apiKey,t.name)}(e),r=function(t){return hp(t._redirectPersistence)}(t);if(!await r._isAvailable())return!1;const s="true"===await r._get(n);return await r._remove(n),s}(this.resolver,this.auth)?await super.execute():null;t=()=>Promise.resolve(e)}catch(e){t=()=>Promise.reject(e)}Vg.set(this.auth._key(),t)}return this.bypassAuthState||Vg.set(this.auth._key(),(()=>Promise.resolve(null))),t()}async onAuthEvent(t){if("signInViaRedirect"===t.type)return super.onAuthEvent(t);if("unknown"!==t.type){if(t.eventId){const e=await this.auth._redirectUserForId(t.eventId);if(e)return this.user=e,super.onAuthEvent(t);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function Hg(t,e){Vg.set(t._key(),e)}async function jg(t,e,n=!1){if(Pt(t.app))return Promise.reject(Cf(t));const r=Rp(t),s=
3114
3113
  /**
3115
3114
  * @license
3116
3115
  * Copyright 2021 Google LLC
@@ -3127,7 +3126,7 @@ const Ug="pendingRedirect",Fg=new Map;class Vg extends Pg{constructor(t,e,n=!1){
3127
3126
  * See the License for the specific language governing permissions and
3128
3127
  * limitations under the License.
3129
3128
  */
3130
- function(t,e){return e?up(e):(kf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new Vg(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
3129
+ function(t,e){return e?hp(e):(Nf(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}(r,e),i=new Bg(r,s,n),o=await i.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}
3131
3130
  /**
3132
3131
  * @license
3133
3132
  * Copyright 2020 Google LLC
@@ -3143,7 +3142,7 @@ function(t,e){return e?up(e):(kf(t._popupRedirectResolver,t,"argument-error"),t.
3143
3142
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3144
3143
  * See the License for the specific language governing permissions and
3145
3144
  * limitations under the License.
3146
- */class jg{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return qg(t);default:return!1}}
3145
+ */class $g{constructor(t){this.auth=t,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(t){this.consumers.add(t),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,t)&&(this.sendToConsumer(this.queuedRedirectEvent,t),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(t){this.consumers.delete(t)}onEvent(t){if(this.hasEventBeenHandled(t))return!1;let e=!1;return this.consumers.forEach((n=>{this.isEventForConsumer(t,n)&&(e=!0,this.sendToConsumer(t,n),this.saveEventToCache(t))})),this.hasHandledPotentialRedirect||!function(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Kg(t);default:return!1}}
3147
3146
  /**
3148
3147
  * @license
3149
3148
  * Copyright 2020 Google LLC
@@ -3159,7 +3158,7 @@ function(t,e){return e?up(e):(kf(t._popupRedirectResolver,t,"argument-error"),t.
3159
3158
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3160
3159
  * See the License for the specific language governing permissions and
3161
3160
  * limitations under the License.
3162
- */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!qg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(If(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has($g(t))}saveEventToCache(t){this.cachedEventUids.add($g(t)),this.lastProcessedEventTime=Date.now()}}function $g(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function qg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3161
+ */(t)||(this.hasHandledPotentialRedirect=!0,e||(this.queuedRedirectEvent=t,e=!0)),e}sendToConsumer(t,e){var n;if(t.error&&!Kg(t)){const r=(null===(n=t.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";e.onError(bf(this.auth,r))}else e.onAuthEvent(t)}isEventForConsumer(t,e){const n=null===e.eventId||!!t.eventId&&t.eventId===e.eventId;return e.filter.includes(t.type)&&n}hasEventBeenHandled(t){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(qg(t))}saveEventToCache(t){this.cachedEventUids.add(qg(t)),this.lastProcessedEventTime=Date.now()}}function qg(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter((t=>t)).join("-")}function Kg({type:t,error:e}){return"unknown"===t&&"auth/no-auth-event"===(null==e?void 0:e.code)}
3163
3162
  /**
3164
3163
  * @license
3165
3164
  * Copyright 2020 Google LLC
@@ -3176,7 +3175,7 @@ function(t,e){return e?up(e):(kf(t._popupRedirectResolver,t,"argument-error"),t.
3176
3175
  * See the License for the specific language governing permissions and
3177
3176
  * limitations under the License.
3178
3177
  */
3179
- const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Bf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(zg(t))return}catch(t){}Sf(t,"unauthorized-domain")}function zg(t){const e=Of(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!Wg.test(n))return!1;if(Kg.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3178
+ const Wg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,zg=/^https?/;async function Gg(t){if(t.config.emulator)return;const{authorizedDomains:e}=await async function(t,e={}){return Hf(t,"GET","/v1/projects",e)}(t);for(const t of e)try{if(Qg(t))return}catch(t){}If(t,"unauthorized-domain")}function Qg(t){const e=Df(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){const s=new URL(t);return""===s.hostname&&""===r?"chrome-extension:"===n&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):"chrome-extension:"===n&&s.hostname===r}if(!zg.test(n))return!1;if(Wg.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}
3180
3179
  /**
3181
3180
  * @license
3182
3181
  * Copyright 2020 Google LLC.
@@ -3192,7 +3191,7 @@ const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t
3192
3191
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3193
3192
  * See the License for the specific language governing permissions and
3194
3193
  * limitations under the License.
3195
- */const Qg=new Pf(3e4,6e4);function Yg(){const t=vg().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Jg(t){return new Promise(((e,n)=>{var r,s,i;function o(){Yg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Yg(),n(If(t,"network-request-failed"))},timeout:Qg.get()})}if(null===(s=null===(r=vg().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=vg().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return vg()[e]=()=>{gapi.load?o():n(If(t,"network-request-failed"))},Dp(`${Op.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Xg=null,t}))}let Xg=null;
3194
+ */const Yg=new Mf(3e4,6e4);function Jg(){const t=wg().___jsl;if(null==t?void 0:t.H)for(const e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let e=0;e<t.CP.length;e++)t.CP[e]=null}function Xg(t){return new Promise(((e,n)=>{var r,s,i;function o(){Jg(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Jg(),n(bf(t,"network-request-failed"))},timeout:Yg.get()})}if(null===(s=null===(r=wg().gapi)||void 0===r?void 0:r.iframes)||void 0===s?void 0:s.Iframe)e(gapi.iframes.getContext());else{if(!(null===(i=wg().gapi)||void 0===i?void 0:i.load)){const e=`__${"iframefcb"}${Math.floor(1e6*Math.random())}`;return wg()[e]=()=>{gapi.load?o():n(bf(t,"network-request-failed"))},Lp(`${Dp.gapiScript}?onload=${e}`).catch((t=>n(t)))}o()}})).catch((t=>{throw Zg=null,t}))}let Zg=null;
3196
3195
  /**
3197
3196
  * @license
3198
3197
  * Copyright 2020 Google LLC.
@@ -3209,7 +3208,7 @@ const Kg=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Wg=/^https?/;async function Gg(t
3209
3208
  * See the License for the specific language governing permissions and
3210
3209
  * limitations under the License.
3211
3210
  */
3212
- const Zg=new Pf(5e3,15e3),tm="__/auth/iframe",em="emulator/auth/iframe",nm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},rm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function sm(t){const e=t.config;kf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Mf(e,em):`https://${t.config.authDomain}/${tm}`,r={apiKey:e.apiKey,appName:t.name,v:Ut},s=rm.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${v(r).slice(1)}`}async function im(t){const e=await function(t){return Xg=Xg||Jg(t),Xg}(t),n=vg().gapi;return kf(n,t,"internal-error"),e.open({where:document.body,url:sm(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:nm,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=If(t,"network-request-failed"),i=vg().setTimeout((()=>{r(s)}),Zg.get());function o(){vg().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3211
+ const tm=new Mf(5e3,15e3),em="__/auth/iframe",nm="emulator/auth/iframe",rm={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},sm=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function im(t){const e=t.config;Nf(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?xf(e,nm):`https://${t.config.authDomain}/${em}`,r={apiKey:e.apiKey,appName:t.name,v:Ut},s=sm.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${v(r).slice(1)}`}async function om(t){const e=await function(t){return Zg=Zg||Xg(t),Zg}(t),n=wg().gapi;return Nf(n,t,"internal-error"),e.open({where:document.body,url:im(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rm,dontclear:!0},(e=>new Promise((async(n,r)=>{await e.restyle({setHideOnLeave:!1});const s=bf(t,"network-request-failed"),i=wg().setTimeout((()=>{r(s)}),tm.get());function o(){wg().clearTimeout(i),n(e)}e.ping(o).then(o,(()=>{r(s)}))}))))}
3213
3212
  /**
3214
3213
  * @license
3215
3214
  * Copyright 2020 Google LLC.
@@ -3225,7 +3224,7 @@ const Zg=new Pf(5e3,15e3),tm="__/auth/iframe",em="emulator/auth/iframe",nm={styl
3225
3224
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3226
3225
  * See the License for the specific language governing permissions and
3227
3226
  * limitations under the License.
3228
- */const om={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class am{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function cm(t,e,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},om),{width:r.toString(),height:s.toString(),top:i,left:o}),u=d().toLowerCase();n&&(a=yp(u)?"_blank":n),gp(u)&&(e=e||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=d()){var e;return Ep(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3227
+ */const am={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class cm{constructor(t){this.window=t,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(t){}}}function um(t,e,n,r=500,s=600){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},am),{width:r.toString(),height:s.toString(),top:i,left:o}),u=d().toLowerCase();n&&(a=vp(u)?"_blank":n),mp(u)&&(e=e||"http://localhost",c.scrollbars="yes");const h=Object.entries(c).reduce(((t,[e,n])=>`${t}${e}=${n},`),"");if(function(t=d()){var e;return Sp(t)&&!!(null===(e=window.navigator)||void 0===e?void 0:e.standalone)}(u)&&"_self"!==a)return function(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}
3229
3228
  /**
3230
3229
  * @license
3231
3230
  * Copyright 2021 Google LLC
@@ -3241,7 +3240,7 @@ const Zg=new Pf(5e3,15e3),tm="__/auth/iframe",em="emulator/auth/iframe",nm={styl
3241
3240
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3242
3241
  * See the License for the specific language governing permissions and
3243
3242
  * limitations under the License.
3244
- */(e||"",a),new am(null);const l=window.open(e||"",a,h);kf(l,t,"popup-blocked");try{l.focus()}catch(t){}return new am(l)}const um="__/auth/handler",hm="emulator/auth/handler",lm=encodeURIComponent("fac");async function dm(t,e,n,r,s,i){kf(t.config.authDomain,t,"auth-domain-config-required"),kf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ut,eventId:s};if(e instanceof zp){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof Qp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),u=c?`#${lm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${um}`;return Mf(t,hm)}
3243
+ */(e||"",a),new cm(null);const l=window.open(e||"",a,h);Nf(l,t,"popup-blocked");try{l.focus()}catch(t){}return new cm(l)}const hm="__/auth/handler",lm="emulator/auth/handler",dm=encodeURIComponent("fac");async function fm(t,e,n,r,s,i){Nf(t.config.authDomain,t,"auth-domain-config-required"),Nf(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Ut,eventId:s};if(e instanceof Qp){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",function(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[t,e]of Object.entries(i||{}))o[t]=e}if(e instanceof Yp){const t=e.getScopes().filter((t=>""!==t));t.length>0&&(o.scopes=t.join(","))}t.tenantId&&(o.tid=t.tenantId);const a=o;for(const t of Object.keys(a))void 0===a[t]&&delete a[t];const c=await t._getAppCheckToken(),u=c?`#${dm}=${encodeURIComponent(c)}`:"";return`${function({config:t}){if(!t.emulator)return`https://${t.authDomain}/${hm}`;return xf(t,lm)}
3245
3244
  /**
3246
3245
  * @license
3247
3246
  * Copyright 2020 Google LLC
@@ -3257,7 +3256,7 @@ const Zg=new Pf(5e3,15e3),tm="__/auth/iframe",em="emulator/auth/iframe",nm={styl
3257
3256
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3258
3257
  * See the License for the specific language governing permissions and
3259
3258
  * limitations under the License.
3260
- */(t)}?${v(a).slice(1)}${u}`}const fm="webStorageSupport";const pm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=pg,this._completeRedirectFn=Hg,this._overrideRedirectResult=Bg}async _openPopup(t,e,n,r){var s;Rf(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return cm(t,await dm(t,e,n,Of(),r),mg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){vg().location.href=t}(await dm(t,e,n,Of(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Rf(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await im(t),n=new jg(t);return e.register("authEvent",(e=>{kf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(fm,{type:fm},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[fm];void 0!==s&&e(!!s),Sf(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return Ip()||mp()||Ep()}};var gm="@firebase/auth",mm="1.7.7";
3259
+ */(t)}?${v(a).slice(1)}${u}`}const pm="webStorageSupport";const gm=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=gg,this._completeRedirectFn=jg,this._overrideRedirectResult=Hg}async _openPopup(t,e,n,r){var s;Of(null===(s=this.eventManagers[t._key()])||void 0===s?void 0:s.manager,"_initialize() not called before _openPopup()");return um(t,await fm(t,e,n,Df(),r),yg())}async _openRedirect(t,e,n,r){await this._originValidation(t);return function(t){wg().location.href=t}(await fm(t,e,n,Df(),r)),new Promise((()=>{}))}_initialize(t){const e=t._key();if(this.eventManagers[e]){const{manager:t,promise:n}=this.eventManagers[e];return t?Promise.resolve(t):(Of(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(t);return this.eventManagers[e]={promise:n},n.catch((()=>{delete this.eventManagers[e]})),n}async initAndGetManager(t){const e=await om(t),n=new $g(t);return e.register("authEvent",(e=>{Nf(null==e?void 0:e.authEvent,t,"invalid-auth-event");return{status:n.onEvent(e.authEvent)?"ACK":"ERROR"}}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[t._key()]={manager:n},this.iframes[t._key()]=e,n}_isIframeWebStorageSupported(t,e){this.iframes[t._key()].send(pm,{type:pm},(n=>{var r;const s=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[pm];void 0!==s&&e(!!s),If(t,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(t){const e=t._key();return this.originValidationPromises[e]||(this.originValidationPromises[e]=Gg(t)),this.originValidationPromises[e]}get _shouldInitProactively(){return bp()||yp()||Sp()}};var mm="@firebase/auth",ym="1.7.7";
3261
3260
  /**
3262
3261
  * @license
3263
3262
  * Copyright 2020 Google LLC
@@ -3274,7 +3273,7 @@ const Zg=new Pf(5e3,15e3),tm="__/auth/iframe",em="emulator/auth/iframe",nm={styl
3274
3273
  * See the License for the specific language governing permissions and
3275
3274
  * limitations under the License.
3276
3275
  */
3277
- class ym{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){kf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3276
+ class vm{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var t;return this.assertAuthConfigured(),(null===(t=this.auth.currentUser)||void 0===t?void 0:t.uid)||null}async getToken(t){if(this.assertAuthConfigured(),await this.auth._initializationPromise,!this.auth.currentUser)return null;return{accessToken:await this.auth.currentUser.getIdToken(t)}}addAuthTokenListener(t){if(this.assertAuthConfigured(),this.internalListeners.has(t))return;const e=this.auth.onIdTokenChanged((e=>{t((null==e?void 0:e.stsTokenManager.accessToken)||null)}));this.internalListeners.set(t,e),this.updateProactiveRefresh()}removeAuthTokenListener(t){this.assertAuthConfigured();const e=this.internalListeners.get(t);e&&(this.internalListeners.delete(t),e(),this.updateProactiveRefresh())}assertAuthConfigured(){Nf(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}
3278
3277
  /**
3279
3278
  * @license
3280
3279
  * Copyright 2020 Google LLC
@@ -3307,5 +3306,5 @@ class ym{constructor(t){this.auth=t,this.internalListeners=new Map}getUid(){var
3307
3306
  * See the License for the specific language governing permissions and
3308
3307
  * limitations under the License.
3309
3308
  */
3310
- const vm=h("authIdTokenMaxAge")||300;let wm=null;function _m(t=Vt()){const e=Lt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Lt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;Sf(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:pm,persistence:[Ng,dg,pg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>vm)return;const r=null==e?void 0:e.token;wm!==r&&(wm=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&xp(n,`http://${i}`),n}var Tm;!function(t){Op=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=If("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Tm="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;kf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Tm,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:bp(Tm)},c=new kp(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(up);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Dt(new I("auth-internal",(t=>(t=>new ym(t))(Np(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Bt(gm,mm,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Tm)),Bt(gm,mm,"esm2017");class Em extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Sm extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class Im extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}const bm="avatar not created";var Am=Object.freeze({__proto__:null,AvatarNotCreatedError:Em,UserNotLoggedInError:Sm,NoColorwaySizeAssetsFoundError:Im,AvatarNotCreated:bm});class Cm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=_m(e),this.auth.setPersistence(dg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&this.logUserLogin(t,e)})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=xl(this.firestore,"user_logging",e.uid),c=await Dd(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&df(u).diff(df(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await Md(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Sm;return await this.user.getIdToken()}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Sm;return(await Dd(xl(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=wd(Ml(this.firestore,"users"),Td(new zl("__name__"),"==",this.id));return e=xd(n,(e=>t(e.docs[0].data()))),()=>e()}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await cg(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await og(this.auth,t)}async confirmPasswordReset(t,e){await ag(this.auth,t,e)}}class km{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=xd(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Ft(Fd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Lt("object"==typeof t?t:Vt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ie("firestore");t&&Ol(r,...t)}return r}(t),this.user=new Cm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=wd(Ml(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Pd(wd(Ml(this.firestore,t),...e))}async getDoc(t,e){const n=xl(this.firestore,t,e),r=await Dd(n);return r.exists()?r.data():null}}const Nm=t=>{if(t.code===_f)throw new Error("account has been disabled");throw new Error(t.message)};class Rm{static get endpoint(){return Fd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}class Om{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Sm;try{const r=await Rm.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===bm)throw new Em;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Rm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new Im;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[Td("brand_id","==",this.brandId)];r.push(Td("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Nm(t)}}async getColorwaySizeAssets(t,e){const n=[Td("brand_id","==",this.brandId)];t&&n.push(Td("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Td("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return Nm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Nm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Nm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Nm(t)}}}const Dm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Fd.getInstance().setEnv(e),new Om(t,new km));var Lm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Lm||(Lm={}));const Pm={[Lm.ACROSS_BACK]:"Across back",[Lm.ACROSS_FRONT]:"Across front",[Lm.ACROSS_SHOULDER]:"Across shoulder",[Lm.ANKLE]:"Ankle",[Lm.ARMEYE]:"Armeye",[Lm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Lm.BACK_CROTCH_LENGTH]:"Back crotch length",[Lm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Lm.BELOW_KNEE]:"Below knee",[Lm.BICEP]:"Bicep",[Lm.BUST]:"Chest/Bust",[Lm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Lm.CALF]:"Calf",[Lm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Lm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Lm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Lm.ELBOW]:"Elbow",[Lm.FOREARM]:"Forearm",[Lm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Lm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Lm.HIGH_HIP]:"High hip",[Lm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Lm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Lm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Lm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Lm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Lm.INSEAM]:"Inseam",[Lm.KNEE]:"Knee",[Lm.LOW_HIP]:"Low hip",[Lm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Lm.MID_NECK]:"Mid neck",[Lm.NECK_AT_BASE]:"Neck at base",[Lm.SHOULDER_DROP]:"Shoulder drop",[Lm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Lm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Lm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Lm.THIGH]:"Thigh",[Lm.TOTAL_RISE_LENGTH]:"Total rise length",[Lm.UNDER_BUST]:"Under bust",[Lm.VERTICAL_TRUNK]:"Vertical trunk",[Lm.WAIST]:"Waist",[Lm.WRIST]:"Wrist"};var Mm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Mm||(Mm={}));const xm={[Mm.BLOUSES]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.COATS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.DRESSES]:[Lm.LOW_HIP,Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST],[Mm.JACKETS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.PANTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Mm.PUFFERS_AND_PARKAS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.SHORTS]:[Lm.LOW_HIP,Lm.WAIST,Lm.THIGH,Lm.INSEAM],[Mm.SKIRTS]:[Lm.LOW_HIP,Lm.WAIST],[Mm.SWEATERS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP],[Mm.T_SHIRTS_AND_TANKS]:[Lm.BUST,Lm.ACROSS_SHOULDER,Lm.WAIST,Lm.LOW_HIP,Lm.HIGH_HIP]},Um={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"},Fm={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"},Vm={activewear:{leggings:Mm.PANTS,joggers:Mm.PANTS,sweatshirts:Mm.SWEATERS},dresses:{a_line:Mm.DRESSES,bodycon:Mm.DRESSES,fit_and_flare:Mm.DRESSES,knit:Mm.DRESSES,shirt:Mm.DRESSES,slip:Mm.DRESSES,straight:Mm.DRESSES,wrap:Mm.DRESSES},jackets_and_coats:{denim_jackets:Mm.JACKETS,parkas:Mm.PUFFERS_AND_PARKAS,peacoats:Mm.COATS,puffer_jackets:Mm.PUFFERS_AND_PARKAS,raincoats:Mm.COATS,rompers:Mm.COATS,shackets:Mm.JACKETS,trench_coats:Mm.COATS},jeans:{bootcut:Mm.PANTS,flared:Mm.PANTS,mom:Mm.PANTS,relaxed:Mm.PANTS,skinny:Mm.PANTS,slim:Mm.PANTS,straight:Mm.PANTS,tapered:Mm.PANTS,wide_leg:Mm.PANTS},jumpsuits_and_rompers:{boiler_suits:Mm.DRESSES,denim:Mm.DRESSES,jumpsuits:Mm.DRESSES,overalls:Mm.DRESSES,rompers:Mm.DRESSES,unitards:Mm.DRESSES},pants_and_shorts:{cigarette:Mm.PANTS,culottes:Mm.SHORTS,denim_shorts:Mm.SHORTS,flared:Mm.PANTS,joggers:Mm.PANTS,leggings:Mm.PANTS,skinny:Mm.PANTS,wide_leg:Mm.PANTS},skirts:{a_line_flared:Mm.SKIRTS,denim:Mm.SKIRTS,knit:Mm.SKIRTS,pencil:Mm.SKIRTS,pleated:Mm.SKIRTS,skater:Mm.SKIRTS,slip:Mm.SKIRTS,wrap:Mm.SKIRTS},suits_and_tailoring:{blazers:Mm.JACKETS,suit_jackets:Mm.JACKETS,suit_skirts:Mm.SKIRTS,suit_trousers:Mm.PANTS,suit_vests:Mm.SWEATERS,trousers:Mm.PANTS},sweaters:{cardigans:Mm.SWEATERS,crewnecks:Mm.SWEATERS,hoodies_and_zipups:Mm.SWEATERS,sweatshirts:Mm.SWEATERS,turtlenecks:Mm.SWEATERS,v_necks:Mm.SWEATERS},tops:{bodysuits:Mm.BLOUSES,corsets_and_bustiers:Mm.BLOUSES,polos:Mm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Mm.BLOUSES,t_shirts:Mm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Mm.T_SHIRTS_AND_TANKS}};var Bm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Bm||(Bm={}));const Hm={[Bm.TOO_TIGHT]:"Too Tight",[Bm.TIGHT]:"Tight",[Bm.SLIGHTLY_TIGHT]:"Slightly Tight",[Bm.PERFECT_FIT]:"Perfect Fit",[Bm.SLIGHTLY_LOOSE]:"Slightly Loose",[Bm.LOOSE]:"Loose",[Bm.OVERSIZED]:"Oversized",[Bm.TOO_SHORT]:"Too Short",[Bm.SHORT]:"Short",[Bm.SLIGHTLY_SHORT]:"Slightly Short",[Bm.SLIGHTLY_LONG]:"Slightly Long",[Bm.LONG]:"Long",[Bm.TOO_LONG]:"Too Long"};var jm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(jm||(jm={}));var $m=Object.freeze({__proto__:null,get AvatarState(){return jm},get MeasurementLocation(){return Lm},MeasurementLocationName:Pm,get Classification(){return Mm},ClassificationLocations:xm,CategoryNames:Um,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:Fm,Taxonomy:Vm,get Fit(){return Bm},FitNames:Hm});export{Am as Errors,Dm as initShop,t as requests,e as responses,$m as types};
3309
+ const wm=h("authIdTokenMaxAge")||300;let _m=null;function Tm(t=Vt()){const e=Lt(t,"auth");if(e.isInitialized())return e.getImmediate();const n=function(t,e){const n=Lt(t,"auth");if(n.isInitialized()){const t=n.getImmediate();if(m(n.getOptions(),null!=e?e:{}))return t;If(t,"already-initialized")}return n.initialize({options:e})}(t,{popupRedirectResolver:gm,persistence:[Rg,fg,gg]}),r=h("authTokenSyncURL");if(r&&"boolean"==typeof isSecureContext&&isSecureContext){const t=new URL(r,location.origin);if(location.origin===t.origin){const e=(s=t.toString(),async t=>{const e=t&&await t.getIdTokenResult(),n=e&&((new Date).getTime()-Date.parse(e.issuedAtTime))/1e3;if(n&&n>wm)return;const r=null==e?void 0:e.token;_m!==r&&(_m=r,await fetch(s,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(t,e,n){S(t).beforeAuthStateChanged(e,n)}(n,e,(()=>e(n.currentUser))),function(t,e,n,r){S(t).onIdTokenChanged(e,n,r)}(n,(t=>e(t)))}}var s;const i=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})("auth");return i&&Up(n,`http://${i}`),n}var Em;!function(t){Dp=t}({loadJS:t=>new Promise(((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=t=>{const e=bf("internal-error");e.customData=t,n(e)},r.type="text/javascript",r.charset="UTF-8",function(){var t,e;return null!==(e=null===(t=document.getElementsByTagName("head"))||void 0===t?void 0:t[0])&&void 0!==e?e:document}().appendChild(r)})),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="}),Em="Browser",Dt(new I("auth",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:i,authDomain:o}=n.options;Nf(i&&!i.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:i,authDomain:o,clientPlatform:Em,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ap(Em)},c=new Np(n,r,s,a);return function(t,e){const n=(null==e?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(hp);(null==e?void 0:e.errorMap)&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,null==e?void 0:e.popupRedirectResolver)}(c,e),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((t,e,n)=>{t.getProvider("auth-internal").initialize()}))),Dt(new I("auth-internal",(t=>(t=>new vm(t))(Rp(t.getProvider("auth").getImmediate()))),"PRIVATE").setInstantiationMode("EXPLICIT")),Bt(mm,ym,function(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(Em)),Bt(mm,ym,"esm2017");class Sm extends Error{constructor(){super("Avatar not created"),this.name="AvatarNotCreatedError"}}class Im extends Error{constructor(){super("user not logged in"),this.name="UserNotLoggedInError"}}class bm extends Error{constructor(){super("no colorway size assets found"),this.name="NoColorwaySizeAssetsFoundError"}}class Am extends Error{constructor(){super("brand user id not set"),this.name="BrandUserIdNotSetError"}}class Cm extends Error{constructor(){super("no frames found"),this.name="NoFramesFoundError"}}class km extends Error{constructor(t,e){super("recommended available sizes error"),this.name="RecommendedAvailableSizesError",this.recommended_size=t,this.available_sizes=e}}class Nm extends Error{constructor(){super("no styles found"),this.name="NoStylesFoundError"}}const Rm="avatar not created";var Om=Object.freeze({__proto__:null,AvatarNotCreatedError:Sm,UserNotLoggedInError:Im,NoColorwaySizeAssetsFoundError:bm,BrandUserIdNotSetError:Am,NoFramesFoundError:Cm,RecommendedAvailableSizesError:km,NoStylesFoundError:Nm,AvatarNotCreated:Rm});class Dm{constructor(t,e){this.firestore=t,this.brandUserId=null,this.auth=Tm(e),this.auth.setPersistence(fg)}get id(){var t;return null===(t=this.user)||void 0===t?void 0:t.uid}async onInit(t){this.auth.onAuthStateChanged((e=>{this.setUser(e),e&&(this.logUserLogin(t,e),this.setBrandUserId(e.uid))})),await this.auth.authStateReady();const e=this.auth.currentUser;return this.setUser(e),this.setBrandUserId(null==e?void 0:e.uid),Boolean(e)}setUser(t){this.user=t}async logUserLogin(t,e){var n,r,s,i,o;try{const a=xl(this.firestore,"user_logging",e.uid),c=await Ld(a),u=new Date,h=c.exists?c.data():null,l=null===(r=null===(n=null==h?void 0:h.brands)||void 0===n?void 0:n[t])||void 0===r?void 0:r.last_login;if(l&&ff(u).diff(ff(1e3*l.seconds),"seconds")<=10080)return;const d=null!==(o=null===(i=null===(s=null==h?void 0:h.brands)||void 0===s?void 0:s[t])||void 0===i?void 0:i.logins)&&void 0!==o?o:[];d.push(u);const f={brands:{[t]:{brand_id:t,last_login:u,logins:d}},last_brand_id:t,created_at:c.exists()?c.data().created_at:u,updated_at:u};await xd(a,f,{merge:!0})}catch(t){console.error("LOGGING ERROR:",t)}}setBrandUserId(t){this.brandUserId=t}async getToken(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return await this.user.getIdToken()}get userId(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return this.user.uid}async getUserProfile(){var t;if(!(null===(t=this.user)||void 0===t?void 0:t.uid))throw new Im;return(await Ld(xl(this.firestore,"users",this.id))).data()}watchUserProfileForChanges(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return e=Ud(n,(e=>t(e.docs[0].data()))),()=>e()}watchUserProfileForFrames(t){let e;const n=_d(Ml(this.firestore,"users"),Ed(Ql(),"==",this.id));return new Promise((r=>{e=Ud(n,(async n=>{await t(n)&&(e(),r(n.docs[0].data()))}))}))}async login(t,e){this.auth.currentUser&&await this.auth.signOut();const n=await ug(this.auth,t,e);this.setUser(n.user)}async logout(){await this.auth.signOut(),this.setUser(null)}async sendPasswordResetEmail(t){await ag(this.auth,t)}async confirmPasswordReset(t,e){await cg(this.auth,t,e)}}class Lm{constructor(){this.promisefyOnSnapshot=(t,e)=>{let n;return{promise:new Promise((r=>{n=Ud(t,(t=>{r(t),e&&n()}))})),unsubscribe:()=>n()}};const t=Ft(Vd.getInstance().firebase);this.firestore=function(t,e){const n="string"==typeof t?t:e||"(default)",r=Lt("object"==typeof t?t:Vt(),"firestore").getImmediate({identifier:n});if(!r._initialized){const t=ie("firestore");t&&Ol(r,...t)}return r}(t),this.user=new Dm(this.firestore,t)}onInit(t){return this.user.onInit(t)}query(t,e,n=!0){const r=_d(Ml(this.firestore,t),e);return this.promisefyOnSnapshot(r,n)}getDocs(t,e){return Md(_d(Ml(this.firestore,t),...e))}async getDoc(t,e){const n=xl(this.firestore,t,e),r=await Ld(n);return r.exists()?r.data():null}}const Pm=t=>{if(t.code===Tf)throw new Error("account has been disabled");throw new Error(t.message)};class Mm{static get endpoint(){return Vd.getInstance().api.url}static async Fetch({user:t,endpointPath:e,method:n,body:r,useToken:s=!0}){const i=this.getUrl(e,s),o={method:n,headers:await this.getHeaders(t,s),credentials:"omit"};r&&(o.body=JSON.stringify(r));const a=await fetch(i,o);if(a.ok)return a;if(500===a.status)throw new Error(a.statusText);const c=await a.json();return Promise.reject(c)}static getUrl(t,e){return e?`${this.endpoint}/v1${t}`:this.endpoint+t}static async getHeaders(t,e){if(!e)return{"Content-Type":"application/json"};return{"Content-Type":"application/json",Authorization:`Bearer ${await t.getToken()}`}}static Get(t,e,n){return this.Fetch({user:t,endpointPath:e,method:"GET",body:null,useToken:n})}static Post(t,e,n=null,r){return this.Fetch({user:t,endpointPath:e,method:"POST",body:n,useToken:r})}static Put(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PUT",body:n,useToken:r})}static Patch(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"PATCH",body:n,useToken:r})}static Delete(t,e,n,r){return this.Fetch({user:t,endpointPath:e,method:"DELETE",body:n,useToken:r})}}const xm=t=>{const e=new Image;return e.src=t,new Promise((t=>{e.onerror=()=>t(!1),e.onload=()=>t(!0)}))};class Um{constructor(t,e){this.brandId=t,this.firebase=e,this.measurementLocations=new Map}get user(){return this.firebase.user}get isLoggedIn(){return!this.firebase||Boolean(this.user.id)}async onInit(){return await this.getMeasurementLocations(),this.firebase.onInit(this.brandId)}async getRecommendedSizes(t){var e,n;if(!this.isLoggedIn)throw new Im;try{const r=await Mm.Get(this.user,`/styles/${t}/recommendation`),s=await r.json();return(null===(e=null==s?void 0:s.fits)||void 0===e?void 0:e.length)&&(null===(n=null==s?void 0:s.recommended_size)||void 0===n?void 0:n.id)?s:null}catch(t){if((null==t?void 0:t.error)===Rm)throw new Sm;throw t}}async submitTelephoneNumber(t){const e=t.replace(/[^\+0-9]/g,""),n=await Mm.Post(this.user,"/ios-app-link",{phone_number:e},!1);console.log(n)}async getColorwaySizeAssetFromSku(t){const e=await this.getColorwaySizeAssets(null,[t]);if(!(null==e?void 0:e.size))throw new bm;return Array.from(e.values())[0]}async getColorwaySizeAssetFromBrandStyleId(t){const e=await this.getColorwaySizeAssets(t);if(!(null==e?void 0:e.size))throw new bm;return Array.from(e.values())[0]}async getMeasurementLocationsFromSku(t,e=[]){console.log({sku:t});const n=await this.getColorwaySizeAssetFromSku(t);if(!n)throw new Error("No colorway size asset found for sku");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getMeasurementLocationsFromBrandStyleId(t,e=[]){const n=await this.getColorwaySizeAssetFromBrandStyleId(t);if(!n)throw new Error("No colorway size asset found for brand style id");const r=await this.getStyle(n.style_id);if(!r)throw new Error("Style category not found for style id");const s=await this.getGetTaxonomy(r.style_garment_category_id);if(!s)throw new Error("Taxonomy not found for style garment category id");return(e.length?s.measurement_locations.female.filter((t=>e.includes(t))):s.measurement_locations.female).map((t=>this.measurementLocations.has(t)?this.measurementLocations.get(t):{name:t,sort_order:1/0})).sort(((t,e)=>t.sort_order<e.sort_order?-1:0)).map((t=>t.name))}async getStyleByBrandStyleId(t){var e,n;try{const r=[Ed("brand_id","==",this.brandId)];r.push(Ed("brand_style_id","==",t));return null===(n=null===(e=(await this.firebase.getDocs("styles",r)).docs)||void 0===e?void 0:e[0])||void 0===n?void 0:n.data()}catch(t){return Pm(t)}}async getColorwaySizeAssets(t,e){const n=[Ed("brand_id","==",this.brandId)];t&&n.push(Ed("style_id","==",t)),(null==e?void 0:e.length)>0&&n.push(Ed("sku","in",e));try{const t=await this.firebase.getDocs("colorway_size_assets",n),e=new Map;return t.forEach((t=>{const n=t.data();e.set(n.id,n)})),e}catch(t){return Pm(t)}}async getStyle(t){try{return await this.firebase.getDoc("styles",String(t))}catch(t){return Pm(t)}}getMeasurementLocationName(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).name:t}getMeasurementLocationSortOrder(t){return this.measurementLocations.has(t)?this.measurementLocations.get(t).sort_order:1/0}async tryOn(t,e){if(!this.isLoggedIn)throw new Im;const n=await this.getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e);try{return await this.getColorwaySizeAssetFrames(n)}catch(t){if(!(t instanceof Cm))throw t;return this.requestThenGetColorwaySizeAssetFrames(n)}}async getColorwaySizeAssetSkuFromStyleIdAndSizeId(t,e){var n,r,s;try{const i=[Ed("brand_id","==",this.brandId)];i.push(Ed("style_id","==",t)),i.push(Ed("size_id","==",e));return null===(s=null===(r=null===(n=(await this.firebase.getDocs("colorway_size_assets",i)).docs)||void 0===n?void 0:n[0])||void 0===r?void 0:r.data())||void 0===s?void 0:s.sku}catch(t){return Pm(t)}}async getGetTaxonomy(t){try{return await this.firebase.getDoc("style_garment_categories",String(t))}catch(t){return Pm(t)}}async getMeasurementLocations(){(await this.fetchMeasurementLocations()).forEach((t=>{this.measurementLocations.set(t.name,{name:t.garment_label,sort_order:t.sort_order})}))}async fetchMeasurementLocations(){try{return(await this.firebase.getDocs("measurement_locations",[])).docs.map((t=>t.data()))}catch(t){return Pm(t)}}async requestThenGetColorwaySizeAssetFrames(t){const[e,n]=await(r=this.getColorwaySizeAssetFromSku(t),r.then((t=>[null,t])).catch((t=>[t])));var r;if(e)throw e;try{return await this.requestColorwaySizeAssetFrames(n.id),this.awaitColorwaySizeAssetFrames(t)}catch(e){if((null==e?void 0:e.error)===Rm)throw new Sm;throw new Nm}}async awaitColorwaySizeAssetFrames(t){var e,n,r,s;if(!this.isLoggedIn)throw new Im;const i=await this.user.watchUserProfileForFrames((async e=>{var n,r,s,i;const o=null===(i=null===(s=null===(r=null===(n=e.docs[0].data())||void 0===n?void 0:n.vto)||void 0===r?void 0:r[this.brandId])||void 0===s?void 0:s[t])||void 0===i?void 0:i.frames;return!!(null==o?void 0:o.length)&&xm(o[0])}));if(!(null===(s=null===(r=null===(n=null===(e=null==i?void 0:i.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||void 0===s?void 0:s.length))throw new Cm;return i.vto[this.brandId][t].frames}async requestColorwaySizeAssetFrames(t){if(!this.isLoggedIn)throw new Im;if(!this.user.brandUserId)throw new Am;await Mm.Post(this.user,`/colorway-size-assets/${t}/frames`,{brand_user_id:String(this.user.brandUserId)})}async getColorwaySizeAssetFrames(t){var e,n,r;const s=await this.user.getUserProfile(),i=(null===(r=null===(n=null===(e=null==s?void 0:s.vto)||void 0===e?void 0:e[this.brandId])||void 0===n?void 0:n[t])||void 0===r?void 0:r.frames)||[];if(!i.length)throw new Cm;if(!await xm(i[0]))throw new Cm;return i}}const Fm=(t,e="dev")=>("dev"!==e&&"development"!==e||console.warn("TfrShop is in development mode"),Vd.getInstance().setEnv(e),new Um(t,new Lm));var Vm;!function(t){t.ACROSS_BACK="across_back",t.ACROSS_FRONT="across_front",t.ACROSS_SHOULDER="across_shoulder",t.ANKLE="ankle",t.ARMEYE="arm_eye",t.ARM_LENGTH_FROM_SHOULDER="arm_length_from_shoulder",t.BACK_CROTCH_LENGTH="back_crotch_length",t.BACK_NECK_TO_EBLOW="back_neck_to_elbow",t.BELOW_KNEE="below_knee",t.BICEP="bicep",t.BUST="bust",t.BUST_POINT_TO_BUST_POINT="bust_point_to_bust_point",t.CALF="calf",t.CB_NECK_TO_WAIST="cb_neck_to_waist",t.CB_NECK_TO_WRIST="cb_neck_to_wrist",t.CF_NECK_TO_WAIST="cf_neck_to_waist",t.ELBOW="elbow",t.FOREARM="forearm",t.FRONT_CROTCH_LENGTH="front_crotch_length",t.HIGH_HIP_PLACEMENT_FROM_WAIST="high_hip_placement",t.HIGH_HIP="high_hip",t.HSP_TO_ACROSS_BACK="hsp_to_across_back",t.HSP_TO_ACROSS_FRONT="hsp_to_across_front",t.HSP_TO_BUST_POINT="hsp_to_bust_point",t.HSP_TO_LOW_HIP_POSITION="hsp_to_low_hip_position",t.HSP_TO_WAIST_POSITION="hsp_to_waist_position",t.INSEAM="inseam",t.KNEE="knee",t.LOW_HIP="low_hip",t.LOW_HIP_PLACEMENT_FROM_WAIST="low_hip_placement",t.MID_NECK="mid_neck",t.NECK_AT_BASE="neck_base",t.SHOULDER_DROP="shoulder_drop",t.SHOULDER_TO_SHOULDER="shoulder_to_shoulder",t.SIDE_WAIST_TO_FLOOR="side_waist_to_floor",t.SIDE_WAIST_TO_KNEE="side_waist_to_knee",t.THIGH="thigh",t.TOTAL_RISE_LENGTH="total_rise_length",t.UNDER_BUST="under_bust",t.VERTICAL_TRUNK="vertical_trunk",t.WAIST="waist",t.WRIST="wrist"}(Vm||(Vm={}));const Bm={[Vm.ACROSS_BACK]:"Across back",[Vm.ACROSS_FRONT]:"Across front",[Vm.ACROSS_SHOULDER]:"Across shoulder",[Vm.ANKLE]:"Ankle",[Vm.ARMEYE]:"Armeye",[Vm.ARM_LENGTH_FROM_SHOULDER]:"Arm length from shoulder",[Vm.BACK_CROTCH_LENGTH]:"Back crotch length",[Vm.BACK_NECK_TO_EBLOW]:"Back neck to eblow",[Vm.BELOW_KNEE]:"Below knee",[Vm.BICEP]:"Bicep",[Vm.BUST]:"Chest/Bust",[Vm.BUST_POINT_TO_BUST_POINT]:"Bust point to bust point",[Vm.CALF]:"Calf",[Vm.CB_NECK_TO_WAIST]:"Cb neck to waist",[Vm.CB_NECK_TO_WRIST]:"Cb neck to wrist",[Vm.CF_NECK_TO_WAIST]:"Cf neck to waist",[Vm.ELBOW]:"Elbow",[Vm.FOREARM]:"Forearm",[Vm.FRONT_CROTCH_LENGTH]:"Front crotch length",[Vm.HIGH_HIP_PLACEMENT_FROM_WAIST]:"High hip placement from waist",[Vm.HIGH_HIP]:"High hip",[Vm.HSP_TO_ACROSS_BACK]:"Hsp to across back",[Vm.HSP_TO_ACROSS_FRONT]:"Hsp to across front",[Vm.HSP_TO_BUST_POINT]:"Hsp to bust point",[Vm.HSP_TO_LOW_HIP_POSITION]:"Hsp to low hip position",[Vm.HSP_TO_WAIST_POSITION]:"Hsp to waist position",[Vm.INSEAM]:"Inseam",[Vm.KNEE]:"Knee",[Vm.LOW_HIP]:"Low hip",[Vm.LOW_HIP_PLACEMENT_FROM_WAIST]:"Low hip placement from waist",[Vm.MID_NECK]:"Mid neck",[Vm.NECK_AT_BASE]:"Neck at base",[Vm.SHOULDER_DROP]:"Shoulder drop",[Vm.SHOULDER_TO_SHOULDER]:"Shoulder to shoulder",[Vm.SIDE_WAIST_TO_FLOOR]:"Side waist to floor",[Vm.SIDE_WAIST_TO_KNEE]:"Side waist to knee",[Vm.THIGH]:"Thigh",[Vm.TOTAL_RISE_LENGTH]:"Total rise length",[Vm.UNDER_BUST]:"Under bust",[Vm.VERTICAL_TRUNK]:"Vertical trunk",[Vm.WAIST]:"Waist",[Vm.WRIST]:"Wrist"};var Hm;!function(t){t.BLOUSES="blouses",t.COATS="coats",t.DRESSES="dresses",t.JACKETS="jackets",t.PANTS="pants",t.PUFFERS_AND_PARKAS="puffer_and_parkas",t.SHORTS="shorts",t.SKIRTS="skirts",t.SWEATERS="sweaters",t.T_SHIRTS_AND_TANKS="t_shirts_and_tanks"}(Hm||(Hm={}));const jm={[Hm.BLOUSES]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.COATS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.DRESSES]:[Vm.LOW_HIP,Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST],[Hm.JACKETS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.PANTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.PUFFERS_AND_PARKAS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.SHORTS]:[Vm.LOW_HIP,Vm.WAIST,Vm.THIGH,Vm.INSEAM],[Hm.SKIRTS]:[Vm.LOW_HIP,Vm.WAIST],[Hm.SWEATERS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP],[Hm.T_SHIRTS_AND_TANKS]:[Vm.BUST,Vm.ACROSS_SHOULDER,Vm.WAIST,Vm.LOW_HIP,Vm.HIGH_HIP]},$m={activewear:"Active Wear",dresses:"Dresses",jackets_and_coats:"Jackets and Coats",jeans:"Jeans",jumpsuits_and_rompers:"Jumpsuits and Rompers",pants_and_shorts:"Pants and Shorts",skirts:"Skirts",suits_and_tailoring:"Suits and Tailoring",sweaters:"Sweaters",tops:"Tops"},qm={a_line:"A Line",a_line_flared:"A Line Flared",blazers:"Blazers",bodycon:"Bodycon",bodysuits:"Bodysuits",boiler_suits:"Boiler Suits",bootcut:"Bootcut",cardigans:"Cardigans",cigarette:"Cigarette",corsets_and_bustiers:"Corsets and Bustiers",crewnecks:"Crewnecks",culottes:"Culottes",denim:"Denim",denim_jackets:"Denim Jackets",denim_shorts:"Denim Shorts",fit_and_flare:"Fit and Flare",flared:"Flared",hoodies_and_zipups:"Hoodies and Zipups",joggers:"Joggers",jumpsuits:"Jumpsuits",knit:"Knit",leggings:"Leggings",mom:"Mom",overalls:"Overalls",parkas:"Parkas",peacoats:"Peacoats",pencil:"Pencil",pleated:"Pleated",polos:"Polos",puffer_jackets:"Puffer Jackets",raincoats:"Raincoats",relaxed:"Relaxed",rompers:"Rompers",shackets:"Shackets",shirt:"Shirt",shirts_and_blouses:"Shirts and Blouses",skater:"Skater",skinny:"Skinny",slim:"Slim",slip:"Slip",sports_bras:"Sports Bras",straight:"Straight",suit_jackets:"Suit Jackets",suit_skirts:"Suit Skirts",suit_trousers:"Suit Trousers",suit_vests:"Suit Vests",sweatshirts:"Sweatshirts",t_shirts:"T-Shirts",tank_tops_and_camisoles:"Tank Tops and Camisoles",tapered:"Tapered",trench_coats:"Trench Coats",trousers:"Trousers",turtlenecks:"Turtleneck",unitards:"Unitards",v_necks:"V-Necks",wide_leg:"Wide Leg",wrap:"Wrap"},Km={activewear:{leggings:Hm.PANTS,joggers:Hm.PANTS,sweatshirts:Hm.SWEATERS},dresses:{a_line:Hm.DRESSES,bodycon:Hm.DRESSES,fit_and_flare:Hm.DRESSES,knit:Hm.DRESSES,shirt:Hm.DRESSES,slip:Hm.DRESSES,straight:Hm.DRESSES,wrap:Hm.DRESSES},jackets_and_coats:{denim_jackets:Hm.JACKETS,parkas:Hm.PUFFERS_AND_PARKAS,peacoats:Hm.COATS,puffer_jackets:Hm.PUFFERS_AND_PARKAS,raincoats:Hm.COATS,rompers:Hm.COATS,shackets:Hm.JACKETS,trench_coats:Hm.COATS},jeans:{bootcut:Hm.PANTS,flared:Hm.PANTS,mom:Hm.PANTS,relaxed:Hm.PANTS,skinny:Hm.PANTS,slim:Hm.PANTS,straight:Hm.PANTS,tapered:Hm.PANTS,wide_leg:Hm.PANTS},jumpsuits_and_rompers:{boiler_suits:Hm.DRESSES,denim:Hm.DRESSES,jumpsuits:Hm.DRESSES,overalls:Hm.DRESSES,rompers:Hm.DRESSES,unitards:Hm.DRESSES},pants_and_shorts:{cigarette:Hm.PANTS,culottes:Hm.SHORTS,denim_shorts:Hm.SHORTS,flared:Hm.PANTS,joggers:Hm.PANTS,leggings:Hm.PANTS,skinny:Hm.PANTS,wide_leg:Hm.PANTS},skirts:{a_line_flared:Hm.SKIRTS,denim:Hm.SKIRTS,knit:Hm.SKIRTS,pencil:Hm.SKIRTS,pleated:Hm.SKIRTS,skater:Hm.SKIRTS,slip:Hm.SKIRTS,wrap:Hm.SKIRTS},suits_and_tailoring:{blazers:Hm.JACKETS,suit_jackets:Hm.JACKETS,suit_skirts:Hm.SKIRTS,suit_trousers:Hm.PANTS,suit_vests:Hm.SWEATERS,trousers:Hm.PANTS},sweaters:{cardigans:Hm.SWEATERS,crewnecks:Hm.SWEATERS,hoodies_and_zipups:Hm.SWEATERS,sweatshirts:Hm.SWEATERS,turtlenecks:Hm.SWEATERS,v_necks:Hm.SWEATERS},tops:{bodysuits:Hm.BLOUSES,corsets_and_bustiers:Hm.BLOUSES,polos:Hm.T_SHIRTS_AND_TANKS,shirts_and_blouses:Hm.BLOUSES,t_shirts:Hm.T_SHIRTS_AND_TANKS,tank_tops_and_camisoles:Hm.T_SHIRTS_AND_TANKS}};var Wm;!function(t){t.TOO_TIGHT="too_tight",t.TIGHT="tight",t.SLIGHTLY_TIGHT="slightly_tight",t.PERFECT_FIT="perfect_fit",t.SLIGHTLY_LOOSE="slightly_loose",t.LOOSE="loose",t.OVERSIZED="oversized",t.TOO_SHORT="too_short",t.SHORT="short",t.SLIGHTLY_SHORT="slightly_short",t.SLIGHTLY_LONG="slightly_long",t.LONG="long",t.TOO_LONG="too_long"}(Wm||(Wm={}));const zm={[Wm.TOO_TIGHT]:"Too Tight",[Wm.TIGHT]:"Tight",[Wm.SLIGHTLY_TIGHT]:"Slightly Tight",[Wm.PERFECT_FIT]:"Perfect Fit",[Wm.SLIGHTLY_LOOSE]:"Slightly Loose",[Wm.LOOSE]:"Loose",[Wm.OVERSIZED]:"Oversized",[Wm.TOO_SHORT]:"Too Short",[Wm.SHORT]:"Short",[Wm.SLIGHTLY_SHORT]:"Slightly Short",[Wm.SLIGHTLY_LONG]:"Slightly Long",[Wm.LONG]:"Long",[Wm.TOO_LONG]:"Too Long"};var Gm;!function(t){t.NOT_CREATED="NOT_CREATED",t.CREATED="CREATED",t.PENDING="PENDING"}(Gm||(Gm={}));var Qm=Object.freeze({__proto__:null,get AvatarState(){return Gm},get MeasurementLocation(){return Vm},MeasurementLocationName:Bm,get Classification(){return Hm},ClassificationLocations:jm,CategoryNames:$m,Categories:["activewear","dresses","jackets_and_coats","jeans","jumpsuits_and_rompers","pants_and_shorts","skirts","suits_and_tailoring","sweaters","tops"],SubcategoryNames:qm,Taxonomy:Km,get Fit(){return Wm},FitNames:zm});export{Om as Errors,Fm as initShop,t as requests,e as responses,Qm as types};
3311
3310
  //# sourceMappingURL=index.min.js.map