@firebase/firestore 3.4.1-canary.be7ccb8ed → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.rn.js CHANGED
@@ -2,11 +2,11 @@ import { _getProvider, getApp as t, _removeServiceInstance as e, _registerCompon
2
2
 
3
3
  import { Component as r } from "@firebase/component";
4
4
 
5
- import { Logger as o, LogLevel as c } from "@firebase/logger";
5
+ import { Logger as o, LogLevel as a } from "@firebase/logger";
6
6
 
7
- import { FirebaseError as a, base64 as u, getUA as h, isIndexedDBAvailable as l, isSafari as f, isMobileCordova as d, isReactNative as w, isElectron as _, isIE as m, isUWP as g, isBrowserExtension as y, createMockUserToken as p, getModularInstance as T, deepEqual as E } from "@firebase/util";
7
+ import { FirebaseError as c, base64 as u, getUA as h, isIndexedDBAvailable as l, isSafari as f, isMobileCordova as d, isReactNative as w, isElectron as _, isIE as m, isUWP as g, isBrowserExtension as y, createMockUserToken as p, getModularInstance as T, deepEqual as E } from "@firebase/util";
8
8
 
9
- import { XhrIo as I, EventType as A, ErrorCode as R, createWebChannelTransport as b, getStatEventTarget as P, FetchXmlHttpFactory as v, WebChannel as V, Event as S, Stat as D } from "@firebase/webchannel-wrapper";
9
+ import { XhrIo as I, EventType as A, ErrorCode as R, createWebChannelTransport as P, getStatEventTarget as b, FetchXmlHttpFactory as v, WebChannel as V, Event as S, Stat as D } from "@firebase/webchannel-wrapper";
10
10
 
11
11
  const C = "@firebase/firestore";
12
12
 
@@ -70,7 +70,7 @@ N.MOCK_USER = new N("mock-user");
70
70
  * See the License for the specific language governing permissions and
71
71
  * limitations under the License.
72
72
  */
73
- let k = "9.6.1-canary.be7ccb8ed";
73
+ let k = "9.6.2";
74
74
 
75
75
  /**
76
76
  * @license
@@ -112,14 +112,14 @@ function $() {
112
112
  }
113
113
 
114
114
  function F(t, ...e) {
115
- if (x.logLevel <= c.DEBUG) {
115
+ if (x.logLevel <= a.DEBUG) {
116
116
  const n = e.map(B);
117
117
  x.debug(`Firestore (${k}): ${t}`, ...n);
118
118
  }
119
119
  }
120
120
 
121
121
  function M(t, ...e) {
122
- if (x.logLevel <= c.ERROR) {
122
+ if (x.logLevel <= a.ERROR) {
123
123
  const n = e.map(B);
124
124
  x.error(`Firestore (${k}): ${t}`, ...n);
125
125
  }
@@ -128,7 +128,7 @@ function M(t, ...e) {
128
128
  /**
129
129
  * @internal
130
130
  */ function L(t, ...e) {
131
- if (x.logLevel <= c.WARN) {
131
+ if (x.logLevel <= a.WARN) {
132
132
  const n = e.map(B);
133
133
  x.warn(`Firestore (${k}): ${t}`, ...n);
134
134
  }
@@ -356,7 +356,7 @@ e) {
356
356
  DATA_LOSS: "data-loss"
357
357
  };
358
358
 
359
- /** An error returned by a Firestore operation. */ class W extends a {
359
+ /** An error returned by a Firestore operation. */ class W extends c {
360
360
  /** @hideconstructor */
361
361
  constructor(
362
362
  /**
@@ -733,14 +733,14 @@ function ot(t, e) {
733
733
  return t < e ? -1 : t > e ? 1 : 0;
734
734
  }
735
735
 
736
- /** Helper to compare arrays using isEqual(). */ function ct(t, e, n) {
736
+ /** Helper to compare arrays using isEqual(). */ function at(t, e, n) {
737
737
  return t.length === e.length && t.every(((t, s) => n(t, e[s])));
738
738
  }
739
739
 
740
740
  /**
741
741
  * Returns the immediate lexicographically-following string. This is useful to
742
742
  * construct an inclusive range for indexeddb iterators.
743
- */ function at(t) {
743
+ */ function ct(t) {
744
744
  // Return the input string, with an additional NUL byte appended.
745
745
  return t + "\0";
746
746
  }
@@ -1195,7 +1195,7 @@ const mt = /^[_a-zA-Z][_a-zA-Z0-9]*$/;
1195
1195
  return !1;
1196
1196
  }
1197
1197
  isEqual(t) {
1198
- return ct(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1198
+ return at(this.fields, t.fields, ((t, e) => t.isEqual(e)));
1199
1199
  }
1200
1200
  }
1201
1201
 
@@ -1377,7 +1377,7 @@ const It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1377
1377
  return "number" == typeof t ? t : "string" == typeof t ? Number(t) : 0;
1378
1378
  }
1379
1379
 
1380
- /** Converts the possible Proto types for Blobs into a ByteString. */ function bt(t) {
1380
+ /** Converts the possible Proto types for Blobs into a ByteString. */ function Pt(t) {
1381
1381
  return "string" == typeof t ? Et.fromBase64String(t) : Et.fromUint8Array(t);
1382
1382
  }
1383
1383
 
@@ -1414,7 +1414,7 @@ const It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1414
1414
  * FieldValueOptions to value().
1415
1415
  * - With respect to other ServerTimestampValues, they sort by their
1416
1416
  * localWriteTime.
1417
- */ function Pt(t) {
1417
+ */ function bt(t) {
1418
1418
  var e, n;
1419
1419
  return "server_timestamp" === (null === (n = ((null === (e = null == t ? void 0 : t.mapValue) || void 0 === e ? void 0 : e.fields) || {}).__type__) || void 0 === n ? void 0 : n.stringValue);
1420
1420
  }
@@ -1430,7 +1430,7 @@ const It = new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);
1430
1430
  */
1431
1431
  function vt(t) {
1432
1432
  const e = t.mapValue.fields.__previous_value__;
1433
- return Pt(e) ? vt(e) : e;
1433
+ return bt(e) ? vt(e) : e;
1434
1434
  }
1435
1435
 
1436
1436
  /**
@@ -1547,7 +1547,7 @@ function St(t) {
1547
1547
  * limitations under the License.
1548
1548
  */
1549
1549
  /** Extracts the backend's type order for the provided value. */ function kt(t) {
1550
- return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? Pt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : U();
1550
+ return "nullValue" in t ? 0 /* NullValue */ : "booleanValue" in t ? 1 /* BooleanValue */ : "integerValue" in t || "doubleValue" in t ? 2 /* NumberValue */ : "timestampValue" in t ? 3 /* TimestampValue */ : "stringValue" in t ? 5 /* StringValue */ : "bytesValue" in t ? 6 /* BlobValue */ : "referenceValue" in t ? 7 /* RefValue */ : "geoPointValue" in t ? 8 /* GeoPointValue */ : "arrayValue" in t ? 9 /* ArrayValue */ : "mapValue" in t ? bt(t) ? 4 /* ServerTimestampValue */ : 10 /* ObjectValue */ : U();
1551
1551
  }
1552
1552
 
1553
1553
  /** Tests `left` and `right` for equality based on the backend semantics. */ function xt(t, e) {
@@ -1578,7 +1578,7 @@ function St(t) {
1578
1578
 
1579
1579
  case 6 /* BlobValue */ :
1580
1580
  return function(t, e) {
1581
- return bt(t.bytesValue).isEqual(bt(e.bytesValue));
1581
+ return Pt(t.bytesValue).isEqual(Pt(e.bytesValue));
1582
1582
  }(t, e);
1583
1583
 
1584
1584
  case 7 /* RefValue */ :
@@ -1600,7 +1600,7 @@ function St(t) {
1600
1600
  }(t, e);
1601
1601
 
1602
1602
  case 9 /* ArrayValue */ :
1603
- return ct(t.arrayValue.values || [], e.arrayValue.values || [], xt);
1603
+ return at(t.arrayValue.values || [], e.arrayValue.values || [], xt);
1604
1604
 
1605
1605
  case 10 /* ObjectValue */ :
1606
1606
  return function(t, e) {
@@ -1650,7 +1650,7 @@ function Ot(t, e) {
1650
1650
 
1651
1651
  case 6 /* BlobValue */ :
1652
1652
  return function(t, e) {
1653
- const n = bt(t), s = bt(e);
1653
+ const n = Pt(t), s = Pt(e);
1654
1654
  return n.compareTo(s);
1655
1655
  }(t.bytesValue, e.bytesValue);
1656
1656
 
@@ -1721,7 +1721,7 @@ function Lt(t) {
1721
1721
  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) {
1722
1722
  const e = At(t);
1723
1723
  return `time(${e.seconds},${e.nanos})`;
1724
- }(t.timestampValue) : "stringValue" in t ? t.stringValue : "bytesValue" in t ? bt(t.bytesValue).toBase64() : "referenceValue" in t ? (n = t.referenceValue,
1724
+ }(t.timestampValue) : "stringValue" in t ? t.stringValue : "bytesValue" in t ? Pt(t.bytesValue).toBase64() : "referenceValue" in t ? (n = t.referenceValue,
1725
1725
  Nt.fromName(n).toString()) : "geoPointValue" in t ? `geo(${(e = t.geoPointValue).latitude},${e.longitude})` : "arrayValue" in t ? function(t) {
1726
1726
  let e = "[", n = !0;
1727
1727
  for (const s of t.values || []) n ? n = !1 : e += ",", e += Lt(s);
@@ -2123,7 +2123,7 @@ class ne extends class {} {
2123
2123
  /**
2124
2124
  * Creates a filter based on the provided arguments.
2125
2125
  */ static create(t, e, n) {
2126
- return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.P(t, e, n) : new ie(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ae(t, n) : "in" /* IN */ === e ? new ue(t, n) : "not-in" /* NOT_IN */ === e ? new he(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new le(t, n) : new ne(t, e, n);
2126
+ return t.isKeyField() ? "in" /* IN */ === e || "not-in" /* NOT_IN */ === e ? this.P(t, e, n) : new ie(t, e, n) : "array-contains" /* ARRAY_CONTAINS */ === e ? new ce(t, n) : "in" /* IN */ === e ? new ue(t, n) : "not-in" /* NOT_IN */ === e ? new he(t, n) : "array-contains-any" /* ARRAY_CONTAINS_ANY */ === e ? new le(t, n) : new ne(t, e, n);
2127
2127
  }
2128
2128
  static P(t, e, n) {
2129
2129
  return "in" /* IN */ === e ? new re(t, n) : new oe(t, n);
@@ -2182,7 +2182,7 @@ class ie extends ne {
2182
2182
 
2183
2183
  /** Filter that matches on key fields within an array. */ class re extends ne {
2184
2184
  constructor(t, e) {
2185
- super(t, "in" /* IN */ , e), this.keys = ce("in" /* IN */ , e);
2185
+ super(t, "in" /* IN */ , e), this.keys = ae("in" /* IN */ , e);
2186
2186
  }
2187
2187
  matches(t) {
2188
2188
  return this.keys.some((e => e.isEqual(t.key)));
@@ -2191,19 +2191,19 @@ class ie extends ne {
2191
2191
 
2192
2192
  /** Filter that matches on key fields not present within an array. */ class oe extends ne {
2193
2193
  constructor(t, e) {
2194
- super(t, "not-in" /* NOT_IN */ , e), this.keys = ce("not-in" /* NOT_IN */ , e);
2194
+ super(t, "not-in" /* NOT_IN */ , e), this.keys = ae("not-in" /* NOT_IN */ , e);
2195
2195
  }
2196
2196
  matches(t) {
2197
2197
  return !this.keys.some((e => e.isEqual(t.key)));
2198
2198
  }
2199
2199
  }
2200
2200
 
2201
- function ce(t, e) {
2201
+ function ae(t, e) {
2202
2202
  var n;
2203
2203
  return ((null === (n = e.arrayValue) || void 0 === n ? void 0 : n.values) || []).map((t => Nt.fromName(t.referenceValue)));
2204
2204
  }
2205
2205
 
2206
- /** A Filter that implements the array-contains operator. */ class ae extends ne {
2206
+ /** A Filter that implements the array-contains operator. */ class ce extends ne {
2207
2207
  constructor(t, e) {
2208
2208
  super(t, "array-contains" /* ARRAY_CONTAINS */ , e);
2209
2209
  }
@@ -2334,16 +2334,16 @@ function ge(t, e) {
2334
2334
  * Initializes a Query with a path and optional additional query constraints.
2335
2335
  * Path must currently be empty if this is a collection group query.
2336
2336
  */
2337
- constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, c = null) {
2337
+ constructor(t, e = null, n = [], s = [], i = null, r = "F" /* First */ , o = null, a = null) {
2338
2338
  this.path = t, this.collectionGroup = e, this.explicitOrderBy = n, this.filters = s,
2339
- this.limit = i, this.limitType = r, this.startAt = o, this.endAt = c, this.S = null,
2339
+ this.limit = i, this.limitType = r, this.startAt = o, this.endAt = a, this.S = null,
2340
2340
  // The corresponding `Target` of this `Query` instance.
2341
2341
  this.D = null, this.startAt, this.endAt;
2342
2342
  }
2343
2343
  }
2344
2344
 
2345
- /** Creates a new Query instance with the options provided. */ function pe(t, e, n, s, i, r, o, c) {
2346
- return new ye(t, e, n, s, i, r, o, c);
2345
+ /** Creates a new Query instance with the options provided. */ function pe(t, e, n, s, i, r, o, a) {
2346
+ return new ye(t, e, n, s, i, r, o, a);
2347
2347
  }
2348
2348
 
2349
2349
  /** Creates a new Query for a query that matches all documents at `path` */ function Te(t) {
@@ -2380,7 +2380,7 @@ function Re(t) {
2380
2380
  * Returns whether the query matches a collection group rather than a specific
2381
2381
  * collection.
2382
2382
  */
2383
- function be(t) {
2383
+ function Pe(t) {
2384
2384
  return null !== t.collectionGroup;
2385
2385
  }
2386
2386
 
@@ -2388,7 +2388,7 @@ function be(t) {
2388
2388
  * Returns the implicit order by constraint that is used to execute the Query,
2389
2389
  * which can be different from the order by constraints the user provided (e.g.
2390
2390
  * the SDK and backend always orders by `__name__`).
2391
- */ function Pe(t) {
2391
+ */ function be(t) {
2392
2392
  const e = j(t);
2393
2393
  if (null === e.S) {
2394
2394
  e.S = [];
@@ -2415,10 +2415,10 @@ function be(t) {
2415
2415
  * Converts this `Query` instance to it's corresponding `Target` representation.
2416
2416
  */ function ve(t) {
2417
2417
  const e = j(t);
2418
- if (!e.D) if ("F" /* First */ === e.limitType) e.D = Yt(e.path, e.collectionGroup, Pe(e), e.filters, e.limit, e.startAt, e.endAt); else {
2418
+ if (!e.D) if ("F" /* First */ === e.limitType) e.D = Yt(e.path, e.collectionGroup, be(e), e.filters, e.limit, e.startAt, e.endAt); else {
2419
2419
  // Flip the orderBy directions since we want the last results
2420
2420
  const t = [];
2421
- for (const n of Pe(e)) {
2421
+ for (const n of be(e)) {
2422
2422
  const e = "desc" /* DESCENDING */ === n.dir ? "asc" /* ASCENDING */ : "desc" /* DESCENDING */;
2423
2423
  t.push(new we(n.field, e));
2424
2424
  }
@@ -2467,8 +2467,8 @@ function Ce(t) {
2467
2467
  return !0;
2468
2468
  }
2469
2469
  /** Makes sure a document is within the bounds, if provided. */ (t, e) && function(t, e) {
2470
- if (t.startAt && !me(t.startAt, Pe(t), e)) return !1;
2471
- if (t.endAt && me(t.endAt, Pe(t), e)) return !1;
2470
+ if (t.startAt && !me(t.startAt, be(t), e)) return !1;
2471
+ if (t.endAt && me(t.endAt, be(t), e)) return !1;
2472
2472
  return !0;
2473
2473
  }
2474
2474
  /**
@@ -2480,7 +2480,7 @@ function Ce(t) {
2480
2480
  function ke(t) {
2481
2481
  return (e, n) => {
2482
2482
  let s = !1;
2483
- for (const i of Pe(t)) {
2483
+ for (const i of be(t)) {
2484
2484
  const t = xe(i, e, n);
2485
2485
  if (0 !== t) return t;
2486
2486
  s = s || i.field.isKeyField();
@@ -2724,7 +2724,7 @@ function He(t) {
2724
2724
 
2725
2725
  function Ye(t, e) {
2726
2726
  return t.field.isEqual(e.field) && function(t, e) {
2727
- return t instanceof Ke && e instanceof Ke || t instanceof Qe && e instanceof Qe ? ct(t.elements, e.elements, xt) : t instanceof Ge && e instanceof Ge ? xt(t.N, e.N) : t instanceof qe && e instanceof qe;
2727
+ return t instanceof Ke && e instanceof Ke || t instanceof Qe && e instanceof Qe ? at(t.elements, e.elements, xt) : t instanceof Ge && e instanceof Ge ? xt(t.N, e.N) : t instanceof qe && e instanceof qe;
2728
2728
  }(t.transform, e.transform);
2729
2729
  }
2730
2730
 
@@ -2840,7 +2840,7 @@ class Xe {
2840
2840
  * of the document.
2841
2841
  * @param mutationResult - The result of applying the mutation from the backend.
2842
2842
  */ function nn(t, e, n) {
2843
- t instanceof an ? function(t, e, n) {
2843
+ t instanceof cn ? function(t, e, n) {
2844
2844
  // Unlike setMutationApplyToLocalView, if we're applying a mutation to a
2845
2845
  // remote document the server has accepted the mutation so the precondition
2846
2846
  // must have held.
@@ -2875,13 +2875,13 @@ class Xe {
2875
2875
  * @param localWriteTime - A timestamp indicating the local write time of the
2876
2876
  * batch this mutation is a part of.
2877
2877
  */ function sn(t, e, n) {
2878
- t instanceof an ? function(t, e, n) {
2878
+ t instanceof cn ? function(t, e, n) {
2879
2879
  if (!tn(t.precondition, e))
2880
2880
  // The mutation failed to apply (e.g. a document ID created with add()
2881
2881
  // caused a name collision).
2882
2882
  return;
2883
2883
  const s = t.value.clone(), i = fn(t.fieldTransforms, n, e);
2884
- s.setAll(i), e.convertToFoundDocument(cn(e), s).setHasLocalMutations();
2884
+ s.setAll(i), e.convertToFoundDocument(an(e), s).setHasLocalMutations();
2885
2885
  }
2886
2886
  /**
2887
2887
  * A mutation that modifies fields of the document at the given key with the
@@ -2898,7 +2898,7 @@ class Xe {
2898
2898
  */ (t, e, n) : t instanceof un ? function(t, e, n) {
2899
2899
  if (!tn(t.precondition, e)) return;
2900
2900
  const s = fn(t.fieldTransforms, n, e), i = e.data;
2901
- i.setAll(hn(t)), i.setAll(s), e.convertToFoundDocument(cn(e), i).setHasLocalMutations();
2901
+ i.setAll(hn(t)), i.setAll(s), e.convertToFoundDocument(an(e), i).setHasLocalMutations();
2902
2902
  }
2903
2903
  /**
2904
2904
  * Returns a FieldPath/Value map with the content of the PatchMutation.
@@ -2943,7 +2943,7 @@ class Xe {
2943
2943
 
2944
2944
  function on(t, e) {
2945
2945
  return t.type === e.type && (!!t.key.isEqual(e.key) && (!!t.precondition.isEqual(e.precondition) && (!!function(t, e) {
2946
- return void 0 === t && void 0 === e || !(!t || !e) && ct(t, e, ((t, e) => Ye(t, e)));
2946
+ return void 0 === t && void 0 === e || !(!t || !e) && at(t, e, ((t, e) => Ye(t, e)));
2947
2947
  }(t.fieldTransforms, e.fieldTransforms) && (0 /* Set */ === t.type ? t.value.isEqual(e.value) : 1 /* Patch */ !== t.type || t.data.isEqual(e.data) && t.fieldMask.isEqual(e.fieldMask)))));
2948
2948
  }
2949
2949
 
@@ -2952,14 +2952,14 @@ function on(t, e) {
2952
2952
  * mutation. Mutations are defined to return the version of the base document
2953
2953
  * only if it is an existing document. Deleted and unknown documents have a
2954
2954
  * post-mutation version of SnapshotVersion.min().
2955
- */ function cn(t) {
2955
+ */ function an(t) {
2956
2956
  return t.isFoundDocument() ? t.version : ht.min();
2957
2957
  }
2958
2958
 
2959
2959
  /**
2960
2960
  * A mutation that creates or replaces the document at the given key with the
2961
2961
  * object value contents.
2962
- */ class an extends en {
2962
+ */ class cn extends en {
2963
2963
  constructor(t, e, n, s = []) {
2964
2964
  super(), this.key = t, this.value = e, this.precondition = n, this.fieldTransforms = s,
2965
2965
  this.type = 0 /* Set */;
@@ -2997,8 +2997,8 @@ function hn(t) {
2997
2997
  const s = new Map;
2998
2998
  q(t.length === n.length);
2999
2999
  for (let i = 0; i < n.length; i++) {
3000
- const r = t[i], o = r.transform, c = e.data.field(r.field);
3001
- s.set(r.field, Be(o, c, n[i]));
3000
+ const r = t[i], o = r.transform, a = e.data.field(r.field);
3001
+ s.set(r.field, Be(o, a, n[i]));
3002
3002
  }
3003
3003
  return s;
3004
3004
  }
@@ -3690,10 +3690,10 @@ class Rn {
3690
3690
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3691
3691
  * See the License for the specific language governing permissions and
3692
3692
  * limitations under the License.
3693
- */ const bn = new Tn(Nt.comparator);
3693
+ */ const Pn = new Tn(Nt.comparator);
3694
3694
 
3695
- function Pn() {
3696
- return bn;
3695
+ function bn() {
3696
+ return Pn;
3697
3697
  }
3698
3698
 
3699
3699
  const vn = new Tn(Nt.comparator);
@@ -3778,7 +3778,7 @@ function xn() {
3778
3778
  // PORTING NOTE: Multi-tab only
3779
3779
  static createSynthesizedRemoteEventForCurrentChange(t, e) {
3780
3780
  const n = new Map;
3781
- return n.set(t, On.createSynthesizedTargetChangeForCurrentChange(t, e)), new $n(ht.min(), n, xn(), Pn(), Nn());
3781
+ return n.set(t, On.createSynthesizedTargetChangeForCurrentChange(t, e)), new $n(ht.min(), n, xn(), bn(), Nn());
3782
3782
  }
3783
3783
  }
3784
3784
 
@@ -3998,7 +3998,7 @@ class Un {
3998
3998
  /** The internal state of all tracked targets. */
3999
3999
  this.nt = new Map,
4000
4000
  /** Keeps track of the documents to update since the last raised snapshot. */
4001
- this.st = Pn(),
4001
+ this.st = bn(),
4002
4002
  /** A mapping of document keys to their set of target IDs. */
4003
4003
  this.it = qn(),
4004
4004
  /**
@@ -4011,8 +4011,8 @@ class Un {
4011
4011
  /**
4012
4012
  * Processes and adds the DocumentWatchChange to the current set of changes.
4013
4013
  */ ot(t) {
4014
- for (const e of t.$) t.O && t.O.isFoundDocument() ? this.ct(e, t.O) : this.at(e, t.key, t.O);
4015
- for (const e of t.removedTargetIds) this.at(e, t.key, t.O);
4014
+ for (const e of t.$) t.O && t.O.isFoundDocument() ? this.at(e, t.O) : this.ct(e, t.key, t.O);
4015
+ for (const e of t.removedTargetIds) this.ct(e, t.key, t.O);
4016
4016
  }
4017
4017
  /** Processes and adds the WatchTargetChange to the current set of changes. */ ut(t) {
4018
4018
  this.forEachTarget(t, (e => {
@@ -4082,7 +4082,7 @@ class Un {
4082
4082
  // until it is resolved, essentially exposing inconsistency between
4083
4083
  // queries.
4084
4084
  const n = new Nt(t.path);
4085
- this.at(e, n, Ht.newNoDocument(n, ht.min()));
4085
+ this.ct(e, n, Ht.newNoDocument(n, ht.min()));
4086
4086
  } else q(1 === n); else {
4087
4087
  this._t(e) !== n && (
4088
4088
  // Existence filter mismatch: We reset the mapping and raise a new
@@ -4109,7 +4109,7 @@ class Un {
4109
4109
  // instead resulting in an explicit delete message and we could
4110
4110
  // remove this special logic.
4111
4111
  const e = new Nt(i.target.path);
4112
- null !== this.st.get(e) || this.yt(s, e) || this.at(s, e, Ht.newNoDocument(e, t));
4112
+ null !== this.st.get(e) || this.yt(s, e) || this.ct(s, e, Ht.newNoDocument(e, t));
4113
4113
  }
4114
4114
  n.j && (e.set(s, n.G()), n.H());
4115
4115
  }
@@ -4128,14 +4128,14 @@ class Un {
4128
4128
  })), s && (n = n.add(t));
4129
4129
  }));
4130
4130
  const s = new $n(t, e, this.rt, this.st, n);
4131
- return this.st = Pn(), this.it = qn(), this.rt = new An(ot), s;
4131
+ return this.st = bn(), this.it = qn(), this.rt = new An(ot), s;
4132
4132
  }
4133
4133
  /**
4134
4134
  * Adds the provided document to the internal list of document updates and
4135
4135
  * its document key to the given target's mapping.
4136
4136
  */
4137
4137
  // Visible for testing.
4138
- ct(t, e) {
4138
+ at(t, e) {
4139
4139
  if (!this.lt(t)) return;
4140
4140
  const n = this.yt(t, e.key) ? 2 /* Modified */ : 0 /* Added */;
4141
4141
  this.ht(t).J(e.key, n), this.st = this.st.insert(e.key, e), this.it = this.it.insert(e.key, this.Tt(e.key).add(t));
@@ -4148,7 +4148,7 @@ class Un {
4148
4148
  * to update the remote document cache.
4149
4149
  */
4150
4150
  // Visible for testing.
4151
- at(t, e, n) {
4151
+ ct(t, e, n) {
4152
4152
  if (!this.lt(t)) return;
4153
4153
  const s = this.ht(t);
4154
4154
  this.yt(t, e) ? s.J(e, 1 /* Removed */) :
@@ -4203,7 +4203,7 @@ class Un {
4203
4203
  */ ft(t) {
4204
4204
  this.nt.set(t, new Bn);
4205
4205
  this.et.getRemoteKeysForTarget(t).forEach((e => {
4206
- this.at(t, e, /*updatedDocument=*/ null);
4206
+ this.ct(t, e, /*updatedDocument=*/ null);
4207
4207
  }));
4208
4208
  }
4209
4209
  /**
@@ -4322,7 +4322,7 @@ function Yn(t, e) {
4322
4322
 
4323
4323
  function Xn(t) {
4324
4324
  const e = _t.fromString(t);
4325
- return q(Ps(e)), e;
4325
+ return q(bs(e)), e;
4326
4326
  }
4327
4327
 
4328
4328
  function Zn(t, e) {
@@ -4373,7 +4373,7 @@ function os(t, e, n) {
4373
4373
  return n && o.setHasCommittedMutations(), n ? o.setHasCommittedMutations() : o;
4374
4374
  }
4375
4375
 
4376
- function cs(t, e) {
4376
+ function as(t, e) {
4377
4377
  return "found" in e ? function(t, e) {
4378
4378
  q(!!e.found), e.found.name, e.found.updateTime;
4379
4379
  const n = ts(t, e.found.name), s = Jn(e.found.updateTime), i = new Gt({
@@ -4389,7 +4389,7 @@ function cs(t, e) {
4389
4389
  }(t, e) : U();
4390
4390
  }
4391
4391
 
4392
- function as(t, e) {
4392
+ function cs(t, e) {
4393
4393
  let n;
4394
4394
  if ("targetChange" in e) {
4395
4395
  e.targetChange;
@@ -4400,7 +4400,7 @@ function as(t, e) {
4400
4400
  }(e.targetChange.targetChangeType || "NO_CHANGE"), i = e.targetChange.targetIds || [], r = function(t, e) {
4401
4401
  return t.C ? (q(void 0 === e || "string" == typeof e), Et.fromBase64String(e || "")) : (q(void 0 === e || e instanceof Uint8Array),
4402
4402
  Et.fromUint8Array(e || new Uint8Array));
4403
- }(t, e.targetChange.resumeToken), o = e.targetChange.cause, c = o && function(t) {
4403
+ }(t, e.targetChange.resumeToken), o = e.targetChange.cause, a = o && function(t) {
4404
4404
  const e = void 0 === t.code ? Q.UNKNOWN : pn(t.code);
4405
4405
  return new W(e, t.message || "");
4406
4406
  }
@@ -4412,7 +4412,7 @@ function as(t, e) {
4412
4412
  * our generated proto interfaces say Int32Value must be. But GRPC actually
4413
4413
  * expects a { value: <number> } struct.
4414
4414
  */ (o);
4415
- n = new Ln(s, i, r, c || null);
4415
+ n = new Ln(s, i, r, a || null);
4416
4416
  } else if ("documentChange" in e) {
4417
4417
  e.documentChange;
4418
4418
  const s = e.documentChange;
@@ -4421,14 +4421,14 @@ function as(t, e) {
4421
4421
  mapValue: {
4422
4422
  fields: s.document.fields
4423
4423
  }
4424
- }), c = Ht.newFoundDocument(i, r, o), a = s.targetIds || [], u = s.removedTargetIds || [];
4425
- n = new Fn(a, u, c.key, c);
4424
+ }), a = Ht.newFoundDocument(i, r, o), c = s.targetIds || [], u = s.removedTargetIds || [];
4425
+ n = new Fn(c, u, a.key, a);
4426
4426
  } else if ("documentDelete" in e) {
4427
4427
  e.documentDelete;
4428
4428
  const s = e.documentDelete;
4429
4429
  s.document;
4430
- const i = ts(t, s.document), r = s.readTime ? Jn(s.readTime) : ht.min(), o = Ht.newNoDocument(i, r), c = s.removedTargetIds || [];
4431
- n = new Fn([], c, o.key, o);
4430
+ const i = ts(t, s.document), r = s.readTime ? Jn(s.readTime) : ht.min(), o = Ht.newNoDocument(i, r), a = s.removedTargetIds || [];
4431
+ n = new Fn([], a, o.key, o);
4432
4432
  } else if ("documentRemove" in e) {
4433
4433
  e.documentRemove;
4434
4434
  const s = e.documentRemove;
@@ -4450,13 +4450,13 @@ function as(t, e) {
4450
4450
 
4451
4451
  function us(t, e) {
4452
4452
  let n;
4453
- if (e instanceof an) n = {
4453
+ if (e instanceof cn) n = {
4454
4454
  update: rs(t, e.key, e.value)
4455
4455
  }; else if (e instanceof dn) n = {
4456
4456
  delete: Zn(t, e.key)
4457
4457
  }; else if (e instanceof un) n = {
4458
4458
  update: rs(t, e.key, e.data),
4459
- updateMask: bs(e.fieldMask)
4459
+ updateMask: Ps(e.fieldMask)
4460
4460
  }; else {
4461
4461
  if (!(e instanceof wn)) return U();
4462
4462
  n = {
@@ -4524,7 +4524,7 @@ function hs(t, e) {
4524
4524
  }(e.updateMask);
4525
4525
  return new un(i, r, t, n, s);
4526
4526
  }
4527
- return new an(i, r, n, s);
4527
+ return new cn(i, r, n, s);
4528
4528
  }
4529
4529
  if (e.delete) {
4530
4530
  const s = ts(t, e.delete);
@@ -4671,15 +4671,15 @@ function ws(t) {
4671
4671
  // visible for testing
4672
4672
  (t.direction));
4673
4673
  }(t))));
4674
- let c = null;
4675
- n.limit && (c = function(t) {
4674
+ let a = null;
4675
+ n.limit && (a = function(t) {
4676
4676
  let e;
4677
4677
  return e = "object" == typeof t ? t.value : t, St(e) ? null : e;
4678
4678
  }(n.limit));
4679
- let a = null;
4680
- n.startAt && (a = ys(n.startAt));
4679
+ let c = null;
4680
+ n.startAt && (c = ys(n.startAt));
4681
4681
  let u = null;
4682
- return n.endAt && (u = ys(n.endAt)), pe(e, i, o, r, c, "F" /* First */ , a, u);
4682
+ return n.endAt && (u = ys(n.endAt)), pe(e, i, o, r, a, "F" /* First */ , c, u);
4683
4683
  }
4684
4684
 
4685
4685
  function _s(t, e) {
@@ -4808,14 +4808,14 @@ function Rs(t) {
4808
4808
  }
4809
4809
  }
4810
4810
 
4811
- function bs(t) {
4811
+ function Ps(t) {
4812
4812
  const e = [];
4813
4813
  return t.fields.forEach((t => e.push(t.canonicalString()))), {
4814
4814
  fieldPaths: e
4815
4815
  };
4816
4816
  }
4817
4817
 
4818
- function Ps(t) {
4818
+ function bs(t) {
4819
4819
  // Resource names have at least 4 components (project ID, database ID)
4820
4820
  return t.length >= 4 && "projects" === t.get(0) && "databases" === t.get(2);
4821
4821
  }
@@ -5720,12 +5720,12 @@ class Ys {
5720
5720
  // bug we're checking for should exist in iOS >= 12.2 and < 13, but for
5721
5721
  // whatever reason it's much harder to hit after 12.2 so we only proactively
5722
5722
  // log on 12.2.
5723
- 12.2 === Xs.bt(h()) && M("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");
5723
+ 12.2 === Xs.Pt(h()) && M("Firestore persistence suffers from a bug in iOS 12.2 Safari that may cause your app to stop working. See https://stackoverflow.com/q/56496296/110915 for details and a potential workaround.");
5724
5724
  }
5725
5725
  /** Deletes the specified database. */ static delete(t) {
5726
5726
  return F("SimpleDb", "Removing database:", t), si(window.indexedDB.deleteDatabase(t)).toPromise();
5727
5727
  }
5728
- /** Returns true if IndexedDB is available in the current environment. */ static Pt() {
5728
+ /** Returns true if IndexedDB is available in the current environment. */ static bt() {
5729
5729
  if (!l()) return !1;
5730
5730
  if (Xs.vt()) return !0;
5731
5731
  // We extensively use indexed array values and compound keys,
@@ -5735,7 +5735,7 @@ class Ys {
5735
5735
  // For tracking support of this feature, see here:
5736
5736
  // https://developer.microsoft.com/en-us/microsoft-edge/platform/status/indexeddbarraysandmultientrysupport/
5737
5737
  // Check the UA string to find out the browser.
5738
- const t = h(), e = Xs.bt(t), n = 0 < e && e < 10, s = Xs.Vt(t), i = 0 < s && s < 4.5;
5738
+ const t = h(), e = Xs.Pt(t), n = 0 < e && e < 10, s = Xs.Vt(t), i = 0 < s && s < 4.5;
5739
5739
  // IE 10
5740
5740
  // ua = 'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)';
5741
5741
  // IE 11
@@ -5758,7 +5758,7 @@ class Ys {
5758
5758
  }
5759
5759
  // visible for testing
5760
5760
  /** Parse User Agent to determine iOS version. Returns -1 if not found. */
5761
- static bt(t) {
5761
+ static Pt(t) {
5762
5762
  const e = t.match(/i(?:phone|pad|pod) os ([\d_]+)/i), n = e ? e[1].split("_").slice(0, 2).join(".") : "-1";
5763
5763
  return Number(n);
5764
5764
  }
@@ -6028,7 +6028,7 @@ class Ys {
6028
6028
  let ii = !1;
6029
6029
 
6030
6030
  function ri(t) {
6031
- const e = Xs.bt(h());
6031
+ const e = Xs.Pt(h());
6032
6032
  if (e >= 12.2 && e < 13) {
6033
6033
  const e = "An internal error was encountered in the Indexed Database server";
6034
6034
  if (t.message.indexOf(e) >= 0) {
@@ -6066,7 +6066,7 @@ function ri(t) {
6066
6066
  }
6067
6067
  }
6068
6068
 
6069
- function ci(t, e) {
6069
+ function ai(t, e) {
6070
6070
  const n = j(t);
6071
6071
  return Xs.Dt(n.Wt, e);
6072
6072
  }
@@ -6089,7 +6089,7 @@ function ci(t, e) {
6089
6089
  */
6090
6090
  /**
6091
6091
  * A batch of mutations that will be sent as one unit to the backend.
6092
- */ class ai {
6092
+ */ class ci {
6093
6093
  /**
6094
6094
  * @param batchId - The unique ID of this mutation batch.
6095
6095
  * @param localWriteTime - The original write time of this mutation.
@@ -6150,7 +6150,7 @@ function ci(t, e) {
6150
6150
  return this.mutations.reduce(((t, e) => t.add(e.key)), Nn());
6151
6151
  }
6152
6152
  isEqual(t) {
6153
- return this.batchId === t.batchId && ct(this.mutations, t.mutations, ((t, e) => on(t, e))) && ct(this.baseMutations, t.baseMutations, ((t, e) => on(t, e)));
6153
+ return this.batchId === t.batchId && at(this.mutations, t.mutations, ((t, e) => on(t, e))) && at(this.baseMutations, t.baseMutations, ((t, e) => on(t, e)));
6154
6154
  }
6155
6155
  }
6156
6156
 
@@ -6345,7 +6345,7 @@ function yi(t, e) {
6345
6345
  }
6346
6346
  }
6347
6347
  const s = e.mutations.map((e => hs(t.Gt, e))), i = ut.fromMillis(e.localWriteTimeMs);
6348
- return new ai(e.batchId, i, n, s);
6348
+ return new ci(e.batchId, i, n, s);
6349
6349
  }
6350
6350
 
6351
6351
  /** Decodes a DbTarget into TargetData */ function pi(t) {
@@ -6447,13 +6447,13 @@ class Ii {
6447
6447
  /**
6448
6448
  * Helper to get a typed SimpleDbStore for the bundles object store.
6449
6449
  */ function Ai(t) {
6450
- return ci(t, Qs.store);
6450
+ return ai(t, Qs.store);
6451
6451
  }
6452
6452
 
6453
6453
  /**
6454
6454
  * Helper to get a typed SimpleDbStore for the namedQueries object store.
6455
6455
  */ function Ri(t) {
6456
- return ci(t, Ws.store);
6456
+ return ai(t, Ws.store);
6457
6457
  }
6458
6458
 
6459
6459
  /**
@@ -6474,9 +6474,9 @@ class Ii {
6474
6474
  */
6475
6475
  /**
6476
6476
  * An in-memory implementation of IndexManager.
6477
- */ class bi {
6477
+ */ class Pi {
6478
6478
  constructor() {
6479
- this.zt = new Pi;
6479
+ this.zt = new bi;
6480
6480
  }
6481
6481
  addToCollectionParentIndex(t, e) {
6482
6482
  return this.zt.add(e), Js.resolve();
@@ -6490,7 +6490,7 @@ class Ii {
6490
6490
  * Internal implementation of the collection-parent index exposed by MemoryIndexManager.
6491
6491
  * Also used for in-memory caching by IndexedDbIndexManager and initial index population
6492
6492
  * in indexeddb_schema.ts
6493
- */ class Pi {
6493
+ */ class bi {
6494
6494
  constructor() {
6495
6495
  this.index = {};
6496
6496
  }
@@ -6535,7 +6535,7 @@ class Ii {
6535
6535
  * This is *NOT* a complete cache of what's in persistence and so can never be used to
6536
6536
  * satisfy reads.
6537
6537
  */
6538
- this.Ht = new Pi;
6538
+ this.Ht = new bi;
6539
6539
  }
6540
6540
  /**
6541
6541
  * Adds a new entry to the collection parent index.
@@ -6560,7 +6560,7 @@ class Ii {
6560
6560
  return Js.resolve();
6561
6561
  }
6562
6562
  getCollectionParents(t, e) {
6563
- const n = [], s = IDBKeyRange.bound([ e, "" ], [ at(e), "" ],
6563
+ const n = [], s = IDBKeyRange.bound([ e, "" ], [ ct(e), "" ],
6564
6564
  /*lowerOpen=*/ !1,
6565
6565
  /*upperOpen=*/ !0);
6566
6566
  return Vi(t).Bt(s).next((t => {
@@ -6581,7 +6581,7 @@ class Ii {
6581
6581
  * Helper to get a typed SimpleDbStore for the collectionParents
6582
6582
  * document store.
6583
6583
  */ function Vi(t) {
6584
- return ci(t, Ks.store);
6584
+ return ai(t, Ks.store);
6585
6585
  }
6586
6586
 
6587
6587
  /**
@@ -6645,12 +6645,12 @@ class Di {
6645
6645
  */
6646
6646
  function Ci(t, e, n) {
6647
6647
  const s = t.store(xs.store), i = t.store($s.store), r = [], o = IDBKeyRange.only(n.batchId);
6648
- let c = 0;
6649
- const a = s.jt({
6648
+ let a = 0;
6649
+ const c = s.jt({
6650
6650
  range: o
6651
- }, ((t, e, n) => (c++, n.delete())));
6652
- r.push(a.next((() => {
6653
- q(1 === c);
6651
+ }, ((t, e, n) => (a++, n.delete())));
6652
+ r.push(c.next((() => {
6653
+ q(1 === a);
6654
6654
  })));
6655
6655
  const u = [];
6656
6656
  for (const t of n.mutations) {
@@ -6750,20 +6750,20 @@ class ki {
6750
6750
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6751
6751
  return r.add({}).next((o => {
6752
6752
  q("number" == typeof o);
6753
- const c = new ai(o, e, n, s), a = function(t, e, n) {
6753
+ const a = new ci(o, e, n, s), c = function(t, e, n) {
6754
6754
  const s = n.baseMutations.map((e => us(t.Gt, e))), i = n.mutations.map((e => us(t.Gt, e)));
6755
6755
  return new xs(e, n.batchId, n.localWriteTime.toMillis(), s, i);
6756
- }(this.k, this.userId, c), u = [];
6756
+ }(this.k, this.userId, a), u = [];
6757
6757
  let h = new An(((t, e) => ot(t.canonicalString(), e.canonicalString())));
6758
6758
  for (const t of s) {
6759
6759
  const e = $s.key(this.userId, t.key.path, o);
6760
- h = h.add(t.key.path.popLast()), u.push(r.put(a)), u.push(i.put(e, $s.PLACEHOLDER));
6760
+ h = h.add(t.key.path.popLast()), u.push(r.put(c)), u.push(i.put(e, $s.PLACEHOLDER));
6761
6761
  }
6762
6762
  return h.forEach((e => {
6763
6763
  u.push(this.Jt.addToCollectionParentIndex(t, e));
6764
6764
  })), t.addOnCommittedListener((() => {
6765
- this.Yt[o] = c.keys();
6766
- })), Js.waitFor(u).next((() => c));
6765
+ this.Yt[o] = a.keys();
6766
+ })), Js.waitFor(u).next((() => a));
6767
6767
  }));
6768
6768
  }
6769
6769
  lookupMutationBatch(t, e) {
@@ -6817,7 +6817,7 @@ class ki {
6817
6817
  return Oi(t).jt({
6818
6818
  range: s
6819
6819
  }, ((n, s, r) => {
6820
- const [o, c, a] = n, u = Ds(c);
6820
+ const [o, a, c] = n, u = Ds(a);
6821
6821
  // Only consider rows matching exactly the specific key of
6822
6822
  // interest. Note that because we order by path first, and we
6823
6823
  // order terminators before path separators, we'll encounter all
@@ -6827,7 +6827,7 @@ class ki {
6827
6827
  // can stop as soon as we hit any such row.
6828
6828
  if (o === this.userId && e.path.isEqual(u))
6829
6829
  // Look up the mutation batch in the store.
6830
- return $i(t).get(a).next((t => {
6830
+ return $i(t).get(c).next((t => {
6831
6831
  if (!t) throw U();
6832
6832
  q(t.userId === this.userId), i.push(yi(this.k, t));
6833
6833
  }));
@@ -6841,7 +6841,7 @@ class ki {
6841
6841
  const i = $s.prefixForPath(this.userId, e.path), r = IDBKeyRange.lowerBound(i), o = Oi(t).jt({
6842
6842
  range: r
6843
6843
  }, ((t, s, i) => {
6844
- const [r, o, c] = t, a = Ds(o);
6844
+ const [r, o, a] = t, c = Ds(o);
6845
6845
  // Only consider rows matching exactly the specific key of
6846
6846
  // interest. Note that because we order by path first, and we
6847
6847
  // order terminators before path separators, we'll encounter all
@@ -6849,7 +6849,7 @@ class ki {
6849
6849
  // the rows for documentKey will occur before any rows for
6850
6850
  // documents nested in a subcollection beneath documentKey so we
6851
6851
  // can stop as soon as we hit any such row.
6852
- r === this.userId && e.path.isEqual(a) ? n = n.add(c) : i.done();
6852
+ r === this.userId && e.path.isEqual(c) ? n = n.add(a) : i.done();
6853
6853
  }));
6854
6854
  s.push(o);
6855
6855
  })), Js.waitFor(s).next((() => this.te(t, n)));
@@ -6863,14 +6863,14 @@ class ki {
6863
6863
  return Oi(t).jt({
6864
6864
  range: r
6865
6865
  }, ((t, e, i) => {
6866
- const [r, c, a] = t, u = Ds(c);
6866
+ const [r, a, c] = t, u = Ds(a);
6867
6867
  r === this.userId && n.isPrefixOf(u) ?
6868
6868
  // Rows with document keys more than one segment longer than the
6869
6869
  // query path can't be matches. For example, a query on 'rooms'
6870
6870
  // can't match the document /rooms/abc/messages/xyx.
6871
6871
  // TODO(mcg): we'll need a different scanner when we implement
6872
6872
  // ancestor queries.
6873
- u.length === s && (o = o.add(a)) : i.done();
6873
+ u.length === s && (o = o.add(c)) : i.done();
6874
6874
  })).next((() => this.te(t, o)));
6875
6875
  }
6876
6876
  te(t, e) {
@@ -6939,8 +6939,8 @@ class ki {
6939
6939
  range: r,
6940
6940
  Kt: !0
6941
6941
  }, ((t, n, s) => {
6942
- const [r, c, /*batchID*/ a] = t;
6943
- r === e && c === i && (o = !0), s.done();
6942
+ const [r, a, /*batchID*/ c] = t;
6943
+ r === e && a === i && (o = !0), s.done();
6944
6944
  })).next((() => o));
6945
6945
  }
6946
6946
 
@@ -6949,19 +6949,19 @@ class ki {
6949
6949
  * Helper to get a typed SimpleDbStore for the mutations object store.
6950
6950
  */
6951
6951
  function $i(t) {
6952
- return ci(t, xs.store);
6952
+ return ai(t, xs.store);
6953
6953
  }
6954
6954
 
6955
6955
  /**
6956
6956
  * Helper to get a typed SimpleDbStore for the mutationQueues object store.
6957
6957
  */ function Oi(t) {
6958
- return ci(t, $s.store);
6958
+ return ai(t, $s.store);
6959
6959
  }
6960
6960
 
6961
6961
  /**
6962
6962
  * Helper to get a typed SimpleDbStore for the mutationQueues object store.
6963
6963
  */ function Fi(t) {
6964
- return ci(t, ks.store);
6964
+ return ai(t, ks.store);
6965
6965
  }
6966
6966
 
6967
6967
  /**
@@ -7043,7 +7043,7 @@ class Mi {
7043
7043
  allocateTargetId(t) {
7044
7044
  return this.oe(t).next((e => {
7045
7045
  const n = new Mi(e.highestTargetId);
7046
- return e.highestTargetId = n.next(), this.ce(t, e).next((() => e.highestTargetId));
7046
+ return e.highestTargetId = n.next(), this.ae(t, e).next((() => e.highestTargetId));
7047
7047
  }));
7048
7048
  }
7049
7049
  getLastRemoteSnapshotVersion(t) {
@@ -7054,18 +7054,18 @@ class Mi {
7054
7054
  }
7055
7055
  setTargetsMetadata(t, e, n) {
7056
7056
  return this.oe(t).next((s => (s.highestListenSequenceNumber = e, n && (s.lastRemoteSnapshotVersion = n.toTimestamp()),
7057
- e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.ce(t, s))));
7057
+ e > s.highestListenSequenceNumber && (s.highestListenSequenceNumber = e), this.ae(t, s))));
7058
7058
  }
7059
7059
  addTargetData(t, e) {
7060
- return this.ae(t, e).next((() => this.oe(t).next((n => (n.targetCount += 1, this.ue(e, n),
7061
- this.ce(t, n))))));
7060
+ return this.ce(t, e).next((() => this.oe(t).next((n => (n.targetCount += 1, this.ue(e, n),
7061
+ this.ae(t, n))))));
7062
7062
  }
7063
7063
  updateTargetData(t, e) {
7064
- return this.ae(t, e);
7064
+ return this.ce(t, e);
7065
7065
  }
7066
7066
  removeTargetData(t, e) {
7067
7067
  return this.removeMatchingKeysForTargetId(t, e.targetId).next((() => Bi(t).delete(e.targetId))).next((() => this.oe(t))).next((e => (q(e.targetCount > 0),
7068
- e.targetCount -= 1, this.ce(t, e))));
7068
+ e.targetCount -= 1, this.ae(t, e))));
7069
7069
  }
7070
7070
  /**
7071
7071
  * Drops any targets with sequence number less than or equal to the upper bound, excepting those
@@ -7075,8 +7075,8 @@ class Mi {
7075
7075
  let s = 0;
7076
7076
  const i = [];
7077
7077
  return Bi(t).jt(((r, o) => {
7078
- const c = pi(o);
7079
- c.sequenceNumber <= e && null === n.get(c.targetId) && (s++, i.push(this.removeTargetData(t, c)));
7078
+ const a = pi(o);
7079
+ a.sequenceNumber <= e && null === n.get(a.targetId) && (s++, i.push(this.removeTargetData(t, a)));
7080
7080
  })).next((() => Js.waitFor(i))).next((() => s));
7081
7081
  }
7082
7082
  /**
@@ -7090,10 +7090,10 @@ class Mi {
7090
7090
  oe(t) {
7091
7091
  return Ui(t).get(qs.key).next((t => (q(null !== t), t)));
7092
7092
  }
7093
- ce(t, e) {
7093
+ ae(t, e) {
7094
7094
  return Ui(t).put(qs.key, e);
7095
7095
  }
7096
- ae(t, e) {
7096
+ ce(t, e) {
7097
7097
  return Bi(t).put(Ti(this.k, e));
7098
7098
  }
7099
7099
  /**
@@ -7163,7 +7163,7 @@ class Mi {
7163
7163
  })).next((() => i));
7164
7164
  }
7165
7165
  containsKey(t, e) {
7166
- const n = vs(e.path), s = IDBKeyRange.bound([ n ], [ at(n) ],
7166
+ const n = vs(e.path), s = IDBKeyRange.bound([ n ], [ ct(n) ],
7167
7167
  /*lowerOpen=*/ !1,
7168
7168
  /*upperOpen=*/ !0);
7169
7169
  let i = 0;
@@ -7194,19 +7194,19 @@ class Mi {
7194
7194
  /**
7195
7195
  * Helper to get a typed SimpleDbStore for the queries object store.
7196
7196
  */ function Bi(t) {
7197
- return ci(t, Bs.store);
7197
+ return ai(t, Bs.store);
7198
7198
  }
7199
7199
 
7200
7200
  /**
7201
7201
  * Helper to get a typed SimpleDbStore for the target globals object store.
7202
7202
  */ function Ui(t) {
7203
- return ci(t, qs.store);
7203
+ return ai(t, qs.store);
7204
7204
  }
7205
7205
 
7206
7206
  /**
7207
7207
  * Helper to get a typed SimpleDbStore for the document target object store.
7208
7208
  */ function qi(t) {
7209
- return ci(t, Us.store);
7209
+ return ai(t, Us.store);
7210
7210
  }
7211
7211
 
7212
7212
  /**
@@ -7345,16 +7345,16 @@ class Mi {
7345
7345
  return this.ge.getCacheSize(t);
7346
7346
  }
7347
7347
  Te(t, e) {
7348
- let n, s, i, r, o, a, u;
7348
+ let n, s, i, r, o, c, u;
7349
7349
  const h = Date.now();
7350
7350
  return this.calculateTargetCount(t, this.params.percentileToCollect).next((e => (
7351
7351
  // Cap at the configured max
7352
7352
  e > this.params.maximumSequenceNumbersToCollect ? (F("LruGarbageCollector", `Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${e}`),
7353
7353
  s = this.params.maximumSequenceNumbersToCollect) : s = e, r = Date.now(), this.nthSequenceNumber(t, s)))).next((s => (n = s,
7354
- o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, a = Date.now(),
7354
+ o = Date.now(), this.removeTargets(t, n, e)))).next((e => (i = e, c = Date.now(),
7355
7355
  this.removeOrphanedDocuments(t, n)))).next((t => {
7356
- if (u = Date.now(), $() <= c.DEBUG) {
7357
- F("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (a - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - a) + "ms\n" + `Total Duration: ${u - h}ms`);
7356
+ if (u = Date.now(), $() <= a.DEBUG) {
7357
+ F("LruGarbageCollector", `LRU Garbage Collection\n\tCounted targets in ${r - h}ms\n\tDetermined least recently used ${s} in ` + (o - r) + "ms\n" + `\tRemoved ${i} targets in ` + (c - o) + "ms\n" + `\tRemoved ${t} documents in ` + (u - c) + "ms\n" + `Total Duration: ${u - h}ms`);
7358
7358
  }
7359
7359
  return Js.resolve({
7360
7360
  didRun: !0,
@@ -7711,23 +7711,23 @@ function Hi(t, e) {
7711
7711
  return this.getMetadata(t).next((n => (n.byteSize += e, this.Re(t, n))));
7712
7712
  }
7713
7713
  getEntry(t, e) {
7714
- return er(t).get(nr(e)).next((t => this.be(e, t)));
7714
+ return er(t).get(nr(e)).next((t => this.Pe(e, t)));
7715
7715
  }
7716
7716
  /**
7717
7717
  * Looks up an entry in the cache.
7718
7718
  *
7719
7719
  * @param documentKey - The key of the entry to look up.
7720
7720
  * @returns The cached document entry and its size.
7721
- */ Pe(t, e) {
7721
+ */ be(t, e) {
7722
7722
  return er(t).get(nr(e)).next((t => ({
7723
- document: this.be(e, t),
7723
+ document: this.Pe(e, t),
7724
7724
  size: Ni(t)
7725
7725
  })));
7726
7726
  }
7727
7727
  getEntries(t, e) {
7728
- let n = Pn();
7728
+ let n = bn();
7729
7729
  return this.ve(t, e, ((t, e) => {
7730
- const s = this.be(t, e);
7730
+ const s = this.Pe(t, e);
7731
7731
  n = n.insert(t, s);
7732
7732
  })).next((() => n));
7733
7733
  }
@@ -7738,9 +7738,9 @@ function Hi(t, e) {
7738
7738
  * @returns A map of documents indexed by key and a map of sizes indexed by
7739
7739
  * key (zero if the document does not exist).
7740
7740
  */ Ve(t, e) {
7741
- let n = Pn(), s = new Tn(Nt.comparator);
7741
+ let n = bn(), s = new Tn(Nt.comparator);
7742
7742
  return this.ve(t, e, ((t, e) => {
7743
- const i = this.be(t, e);
7743
+ const i = this.Pe(t, e);
7744
7744
  n = n.insert(t, i), s = s.insert(t, Ni(e));
7745
7745
  })).next((() => ({
7746
7746
  documents: n,
@@ -7769,7 +7769,7 @@ function Hi(t, e) {
7769
7769
  }));
7770
7770
  }
7771
7771
  getDocumentsMatchingQuery(t, e, n) {
7772
- let s = Pn();
7772
+ let s = bn();
7773
7773
  const i = e.path.length + 1, r = {};
7774
7774
  if (n.isEqual(ht.min())) {
7775
7775
  // Documents are ordered by key, so we can use a prefix scan to narrow
@@ -7810,7 +7810,7 @@ function Hi(t, e) {
7810
7810
  /**
7811
7811
  * Decodes `remoteDoc` and returns the document (or null, if the document
7812
7812
  * corresponds to the format used for sentinel deletes).
7813
- */ be(t, e) {
7813
+ */ Pe(t, e) {
7814
7814
  if (e) {
7815
7815
  const t = fi(this.k, e);
7816
7816
  // Whether the document is a sentinel removal and should only be used in the
@@ -7851,10 +7851,10 @@ class Zi extends Yi {
7851
7851
  return this.changes.forEach(((i, r) => {
7852
7852
  const o = this.Ce.get(i);
7853
7853
  if (r.document.isValidDocument()) {
7854
- const c = di(this.De.k, r.document, this.getReadTime(i));
7854
+ const a = di(this.De.k, r.document, this.getReadTime(i));
7855
7855
  s = s.add(i.path.popLast());
7856
- const a = Ni(c);
7857
- n += a - o, e.push(this.De.addEntry(t, i, c));
7856
+ const c = Ni(a);
7857
+ n += c - o, e.push(this.De.addEntry(t, i, a));
7858
7858
  } else if (n -= o, this.trackRemovals) {
7859
7859
  // In order to track removals, we store a "sentinel delete" in the
7860
7860
  // RemoteDocumentCache. This entry is represented by a NoDocument
@@ -7869,7 +7869,7 @@ class Zi extends Yi {
7869
7869
  }
7870
7870
  getFromCache(t, e) {
7871
7871
  // Record the size of everything we load from the cache so we can compute a delta later.
7872
- return this.De.Pe(t, e).next((t => (this.Ce.set(e, t.size), t.document)));
7872
+ return this.De.be(t, e).next((t => (this.Ce.set(e, t.size), t.document)));
7873
7873
  }
7874
7874
  getAllFromCache(t, e) {
7875
7875
  // Record the size of everything we load from the cache so we can compute
@@ -7885,13 +7885,13 @@ class Zi extends Yi {
7885
7885
  }
7886
7886
 
7887
7887
  function tr(t) {
7888
- return ci(t, Ls.store);
7888
+ return ai(t, Ls.store);
7889
7889
  }
7890
7890
 
7891
7891
  /**
7892
7892
  * Helper to get a typed SimpleDbStore for the remoteDocuments object store.
7893
7893
  */ function er(t) {
7894
- return ci(t, Ms.store);
7894
+ return ai(t, Ms.store);
7895
7895
  }
7896
7896
 
7897
7897
  function nr(t) {
@@ -8080,7 +8080,7 @@ function nr(t) {
8080
8080
  t.createObjectStore(Ks.store, {
8081
8081
  keyPath: Ks.keyPath
8082
8082
  });
8083
- const n = e.store(Ks.store), s = new Pi, i = t => {
8083
+ const n = e.store(Ks.store), s = new bi, i = t => {
8084
8084
  if (s.add(t)) {
8085
8085
  const e = t.lastSegment(), s = t.popLast();
8086
8086
  return n.put({
@@ -8184,14 +8184,14 @@ class or {
8184
8184
  * Whether to synchronize the in-memory state of multiple tabs and share
8185
8185
  * access to local persistence.
8186
8186
  */
8187
- t, e, n, s, i, r, o, c, a,
8187
+ t, e, n, s, i, r, o, a, c,
8188
8188
  /**
8189
8189
  * If set to true, forcefully obtains database access. Existing tabs will
8190
8190
  * no longer be able to access IndexedDB.
8191
8191
  */
8192
8192
  u) {
8193
8193
  if (this.allowTabSynchronization = t, this.persistenceKey = e, this.clientId = n,
8194
- this.Fe = i, this.window = r, this.document = o, this.Me = a, this.Le = u, this.Be = null,
8194
+ this.Fe = i, this.window = r, this.document = o, this.Me = c, this.Le = u, this.Be = null,
8195
8195
  this.Ue = !1, this.isPrimary = !1, this.networkEnabled = !0,
8196
8196
  /** Our window.unload handler, if registered. */
8197
8197
  this.qe = null, this.inForeground = !1,
@@ -8202,8 +8202,8 @@ class or {
8202
8202
  /** The last time we garbage collected the client metadata object store. */
8203
8203
  this.Qe = Number.NEGATIVE_INFINITY,
8204
8204
  /** A listener to notify on primary state changes. */
8205
- this.We = t => Promise.resolve(), !or.Pt()) throw new W(Q.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
8206
- this.referenceDelegate = new zi(this, s), this.Ge = e + "main", this.k = new li(c),
8205
+ this.We = t => Promise.resolve(), !or.bt()) throw new W(Q.UNIMPLEMENTED, "This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled.");
8206
+ this.referenceDelegate = new zi(this, s), this.Ge = e + "main", this.k = new li(a),
8207
8207
  this.ze = new Xs(this.Ge, 11, new sr(this.k)), this.He = new Li(this.referenceDelegate, this.k),
8208
8208
  this.Jt = new vi, this.Je = function(t, e) {
8209
8209
  return new Xi(t, e);
@@ -8277,11 +8277,11 @@ class or {
8277
8277
  * primary state listener if the client either newly obtained or released its
8278
8278
  * primary lease.
8279
8279
  */ Ze() {
8280
- return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", (t => ar(t).put(new js(this.clientId, Date.now(), this.networkEnabled, this.inForeground)).next((() => {
8280
+ return this.runTransaction("updateClientMetadataAndTryBecomePrimary", "readwrite", (t => cr(t).put(new js(this.clientId, Date.now(), this.networkEnabled, this.inForeground)).next((() => {
8281
8281
  if (this.isPrimary) return this.rn(t).next((t => {
8282
8282
  t || (this.isPrimary = !1, this.Fe.enqueueRetryable((() => this.We(!1))));
8283
8283
  }));
8284
- })).next((() => this.on(t))).next((e => this.isPrimary && !e ? this.cn(t).next((() => !1)) : !!e && this.an(t).next((() => !0)))))).catch((t => {
8284
+ })).next((() => this.on(t))).next((e => this.isPrimary && !e ? this.an(t).next((() => !1)) : !!e && this.cn(t).next((() => !0)))))).catch((t => {
8285
8285
  if (ei(t))
8286
8286
  // Proceed with the existing state. Any subsequent access to
8287
8287
  // IndexedDB will verify the lease.
@@ -8294,10 +8294,10 @@ class or {
8294
8294
  }));
8295
8295
  }
8296
8296
  rn(t) {
8297
- return cr(t).get(Ns.key).next((t => Js.resolve(this.un(t))));
8297
+ return ar(t).get(Ns.key).next((t => Js.resolve(this.un(t))));
8298
8298
  }
8299
8299
  hn(t) {
8300
- return ar(t).delete(this.clientId);
8300
+ return cr(t).delete(this.clientId);
8301
8301
  }
8302
8302
  /**
8303
8303
  * If the garbage collection threshold has passed, prunes the
@@ -8307,7 +8307,7 @@ class or {
8307
8307
  if (this.isPrimary && !this.fn(this.Qe, 18e5)) {
8308
8308
  this.Qe = Date.now();
8309
8309
  const t = await this.runTransaction("maybeGarbageCollectMultiClientState", "readwrite-primary", (t => {
8310
- const e = ci(t, js.store);
8310
+ const e = ai(t, js.store);
8311
8311
  return e.Bt().next((t => {
8312
8312
  const n = this.dn(t, 18e5), s = t.filter((t => -1 === n.indexOf(t)));
8313
8313
  // Delete metadata for clients that are no longer considered active.
@@ -8339,7 +8339,7 @@ class or {
8339
8339
  * (foreground) client should become leaseholder instead.
8340
8340
  */ on(t) {
8341
8341
  if (this.Le) return Js.resolve(!0);
8342
- return cr(t).get(Ns.key).next((e => {
8342
+ return ar(t).get(Ns.key).next((e => {
8343
8343
  // A client is eligible for the primary lease if:
8344
8344
  // - its network is enabled and the client's tab is in the foreground.
8345
8345
  // - its network is enabled and no other client's tab is in the
@@ -8368,7 +8368,7 @@ class or {
8368
8368
  return !1;
8369
8369
  }
8370
8370
  }
8371
- return !(!this.networkEnabled || !this.inForeground) || ar(t).Bt().next((t => void 0 === this.dn(t, 5e3).find((t => {
8371
+ return !(!this.networkEnabled || !this.inForeground) || cr(t).Bt().next((t => void 0 === this.dn(t, 5e3).find((t => {
8372
8372
  if (this.clientId !== t.clientId) {
8373
8373
  const e = !this.networkEnabled && t.networkEnabled, n = !this.inForeground && t.inForeground, s = this.networkEnabled === t.networkEnabled;
8374
8374
  if (e || n && s) return !0;
@@ -8387,7 +8387,7 @@ class or {
8387
8387
  // has obtained the primary lease.
8388
8388
  await this.ze.runTransaction("shutdown", "readwrite", [ Ns.store, js.store ], (t => {
8389
8389
  const e = new oi(t, st.I);
8390
- return this.cn(e).next((() => this.hn(e)));
8390
+ return this.an(e).next((() => this.hn(e)));
8391
8391
  })), this.ze.close(),
8392
8392
  // Remove the entry marking the client as zombied from LocalStorage since
8393
8393
  // we successfully deleted its metadata from IndexedDb.
@@ -8406,7 +8406,7 @@ class or {
8406
8406
  *
8407
8407
  * PORTING NOTE: This is only used for Web multi-tab.
8408
8408
  */ Tn() {
8409
- return this.runTransaction("getActiveClients", "readonly", (t => ar(t).Bt().next((t => this.dn(t, 18e5).map((t => t.clientId))))));
8409
+ return this.runTransaction("getActiveClients", "readonly", (t => cr(t).Bt().next((t => this.dn(t, 18e5).map((t => t.clientId))))));
8410
8410
  }
8411
8411
  get started() {
8412
8412
  return this.Ue;
@@ -8437,7 +8437,7 @@ class or {
8437
8437
  if (!e) throw M(`Failed to obtain primary lease for action '${t}'.`), this.isPrimary = !1,
8438
8438
  this.Fe.enqueueRetryable((() => this.We(!1))), new W(Q.FAILED_PRECONDITION, zs);
8439
8439
  return n(i);
8440
- })).next((t => this.an(i).next((() => t)))) : this.En(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
8440
+ })).next((t => this.cn(i).next((() => t)))) : this.En(i).next((() => n(i)))))).then((t => (i.raiseOnCommittedEvent(),
8441
8441
  t)));
8442
8442
  }
8443
8443
  /**
@@ -8447,22 +8447,22 @@ class or {
8447
8447
  // TODO(b/114226234): Remove this check when `synchronizeTabs` can no longer
8448
8448
  // be turned off.
8449
8449
  En(t) {
8450
- return cr(t).get(Ns.key).next((t => {
8450
+ return ar(t).get(Ns.key).next((t => {
8451
8451
  if (null !== t && this.fn(t.leaseTimestampMs, 5e3) && !this._n(t.ownerId) && !this.un(t) && !(this.Le || this.allowTabSynchronization && t.allowTabSynchronization)) throw new W(Q.FAILED_PRECONDITION, rr);
8452
8452
  }));
8453
8453
  }
8454
8454
  /**
8455
8455
  * Obtains or extends the new primary lease for the local client. This
8456
8456
  * method does not verify that the client is eligible for this lease.
8457
- */ an(t) {
8457
+ */ cn(t) {
8458
8458
  const e = new Ns(this.clientId, this.allowTabSynchronization, Date.now());
8459
- return cr(t).put(Ns.key, e);
8459
+ return ar(t).put(Ns.key, e);
8460
8460
  }
8461
- static Pt() {
8462
- return Xs.Pt();
8461
+ static bt() {
8462
+ return Xs.bt();
8463
8463
  }
8464
- /** Checks the primary lease and removes it if we are the current primary. */ cn(t) {
8465
- const e = cr(t);
8464
+ /** Checks the primary lease and removes it if we are the current primary. */ an(t) {
8465
+ const e = ar(t);
8466
8466
  return e.get(Ns.key).next((t => this.un(t) ? (F("IndexedDbPersistence", "Releasing primary lease."),
8467
8467
  e.delete(Ns.key)) : Js.resolve()));
8468
8468
  }
@@ -8546,14 +8546,14 @@ class or {
8546
8546
 
8547
8547
  /**
8548
8548
  * Helper to get a typed SimpleDbStore for the primary client object store.
8549
- */ function cr(t) {
8550
- return ci(t, Ns.store);
8549
+ */ function ar(t) {
8550
+ return ai(t, Ns.store);
8551
8551
  }
8552
8552
 
8553
8553
  /**
8554
8554
  * Helper to get a typed SimpleDbStore for the client metadata object store.
8555
- */ function ar(t) {
8556
- return ci(t, js.store);
8555
+ */ function cr(t) {
8556
+ return ai(t, js.store);
8557
8557
  }
8558
8558
 
8559
8559
  /**
@@ -8622,9 +8622,9 @@ class hr {
8622
8622
  * @returns Local view of the document or null if we don't have any cached
8623
8623
  * state for it.
8624
8624
  */ Rn(t, e) {
8625
- return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.bn(t, e, n)));
8625
+ return this.An.getAllMutationBatchesAffectingDocumentKey(t, e).next((n => this.Pn(t, e, n)));
8626
8626
  }
8627
- /** Internal version of `getDocument` that allows reusing batches. */ bn(t, e, n) {
8627
+ /** Internal version of `getDocument` that allows reusing batches. */ Pn(t, e, n) {
8628
8628
  return this.Je.getEntry(t, e).next((t => {
8629
8629
  for (const e of n) e.applyToLocalView(t);
8630
8630
  return t;
@@ -8632,7 +8632,7 @@ class hr {
8632
8632
  }
8633
8633
  // Returns the view of the given `docs` as they would appear after applying
8634
8634
  // all mutations in the given `batches`.
8635
- Pn(t, e) {
8635
+ bn(t, e) {
8636
8636
  t.forEach(((t, n) => {
8637
8637
  for (const t of e) t.applyToLocalView(n);
8638
8638
  }));
@@ -8649,7 +8649,7 @@ class hr {
8649
8649
  * Applies the local view the given `baseDocs` without retrieving documents
8650
8650
  * from the local store.
8651
8651
  */ Vn(t, e) {
8652
- return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.Pn(e, t)));
8652
+ return this.An.getAllMutationBatchesAffectingDocumentKeys(t, e).next((t => this.bn(e, t)));
8653
8653
  }
8654
8654
  /**
8655
8655
  * Performs a query against the local view of all documents.
@@ -8665,7 +8665,7 @@ class hr {
8665
8665
  */
8666
8666
  return function(t) {
8667
8667
  return Nt.isDocumentKey(t.path) && null === t.collectionGroup && 0 === t.filters.length;
8668
- }(e) ? this.Sn(t, e.path) : be(e) ? this.Dn(t, e, n) : this.Cn(t, e, n);
8668
+ }(e) ? this.Sn(t, e.path) : Pe(e) ? this.Dn(t, e, n) : this.Cn(t, e, n);
8669
8669
  }
8670
8670
  Sn(t, e) {
8671
8671
  // Just do a simple document lookup.
@@ -8808,7 +8808,7 @@ class hr {
8808
8808
  return 0 === t.filters.length && null === t.limit && null == t.startAt && null == t.endAt && (0 === t.explicitOrderBy.length || 1 === t.explicitOrderBy.length && t.explicitOrderBy[0].field.isKeyField());
8809
8809
  }(e) || n.isEqual(ht.min()) ? this.Mn(t, e) : this.Fn.vn(t, s).next((i => {
8810
8810
  const r = this.Ln(e, i);
8811
- return (Ee(e) || Ie(e)) && this.Bn(e.limitType, r, s, n) ? this.Mn(t, e) : ($() <= c.DEBUG && F("QueryEngine", "Re-using previous result from %s to execute query: %s", n.toString(), Ce(e)),
8811
+ return (Ee(e) || Ie(e)) && this.Bn(e.limitType, r, s, n) ? this.Mn(t, e) : ($() <= a.DEBUG && F("QueryEngine", "Re-using previous result from %s to execute query: %s", n.toString(), Ce(e)),
8812
8812
  this.Fn.getDocumentsMatchingQuery(t, e, n).next((t => (
8813
8813
  // We merge `previousResults` into `updateResults`, since
8814
8814
  // `updateResults` is already a DocumentMap. If a document is
@@ -8854,7 +8854,7 @@ class hr {
8854
8854
  return !!i && (i.hasPendingWrites || i.version.compareTo(s) > 0);
8855
8855
  }
8856
8856
  Mn(t, e) {
8857
- return $() <= c.DEBUG && F("QueryEngine", "Using full collection scan to execute query:", Ce(e)),
8857
+ return $() <= a.DEBUG && F("QueryEngine", "Using full collection scan to execute query:", Ce(e)),
8858
8858
  this.Fn.getDocumentsMatchingQuery(t, e, ht.min());
8859
8859
  }
8860
8860
  }
@@ -9033,21 +9033,19 @@ function yr(t) {
9033
9033
  // Reset newTargetDataByTargetMap in case this transaction gets re-run.
9034
9034
  i = n.qn;
9035
9035
  const o = [];
9036
- e.targetChanges.forEach(((e, r) => {
9037
- const c = i.get(r);
9036
+ e.targetChanges.forEach(((r, a) => {
9037
+ const c = i.get(a);
9038
9038
  if (!c) return;
9039
9039
  // Only update the remote keys if the target is still active. This
9040
9040
  // ensures that we can persist the updated target data along with
9041
9041
  // the updated assignment.
9042
- o.push(n.He.removeMatchingKeys(t, e.removedDocuments, r).next((() => n.He.addMatchingKeys(t, e.addedDocuments, r))));
9043
- const a = e.resumeToken;
9044
- // Update the resume token if the change includes one.
9045
- if (a.approximateByteSize() > 0) {
9046
- const u = c.withResumeToken(a, s).withSequenceNumber(t.currentSequenceNumber);
9047
- i = i.insert(r, u),
9048
- // Update the target data if there are target changes (or if
9049
- // sufficient time has passed since the last update).
9050
- /**
9042
+ o.push(n.He.removeMatchingKeys(t, r.removedDocuments, a).next((() => n.He.addMatchingKeys(t, r.addedDocuments, a))));
9043
+ let u = c.withSequenceNumber(t.currentSequenceNumber);
9044
+ e.targetMismatches.has(a) ? u = u.withResumeToken(Et.EMPTY_BYTE_STRING, ht.min()).withLastLimboFreeSnapshotVersion(ht.min()) : r.resumeToken.approximateByteSize() > 0 && (u = u.withResumeToken(r.resumeToken, s)),
9045
+ i = i.insert(a, u),
9046
+ // Update the target data if there are target changes (or if
9047
+ // sufficient time has passed since the last update).
9048
+ /**
9051
9049
  * Returns true if the newTargetData should be persisted during an update of
9052
9050
  * an active target. TargetData should always be persisted when a target is
9053
9051
  * being released and should not call this function.
@@ -9058,28 +9056,27 @@ function yr(t) {
9058
9056
  * values from getting too stale after a crash, but this doesn't have to be
9059
9057
  * too frequent.
9060
9058
  */
9061
- function(t, e, n) {
9062
- // Always persist target data if we don't already have a resume token.
9063
- if (q(e.resumeToken.approximateByteSize() > 0), 0 === t.resumeToken.approximateByteSize()) return !0;
9064
- // Don't allow resume token changes to be buffered indefinitely. This
9065
- // allows us to be reasonably up-to-date after a crash and avoids needing
9066
- // to loop over all active queries on shutdown. Especially in the browser
9067
- // we may not get time to do anything interesting while the current tab is
9068
- // closing.
9069
- if (e.snapshotVersion.toMicroseconds() - t.snapshotVersion.toMicroseconds() >= 3e8) return !0;
9070
- // Otherwise if the only thing that has changed about a target is its resume
9071
- // token it's not worth persisting. Note that the RemoteStore keeps an
9072
- // in-memory view of the currently active targets which includes the current
9073
- // resume token, so stream failure or user changes will still use an
9074
- // up-to-date resume token regardless of what we do here.
9075
- return n.addedDocuments.size + n.modifiedDocuments.size + n.removedDocuments.size > 0;
9076
- }
9077
- /**
9078
- * Notifies local store of the changed views to locally pin documents.
9079
- */ (c, u, e) && o.push(n.He.updateTargetData(t, u));
9059
+ function(t, e, n) {
9060
+ // Always persist target data if we don't already have a resume token.
9061
+ if (0 === t.resumeToken.approximateByteSize()) return !0;
9062
+ // Don't allow resume token changes to be buffered indefinitely. This
9063
+ // allows us to be reasonably up-to-date after a crash and avoids needing
9064
+ // to loop over all active queries on shutdown. Especially in the browser
9065
+ // we may not get time to do anything interesting while the current tab is
9066
+ // closing.
9067
+ if (e.snapshotVersion.toMicroseconds() - t.snapshotVersion.toMicroseconds() >= 3e8) return !0;
9068
+ // Otherwise if the only thing that has changed about a target is its resume
9069
+ // token it's not worth persisting. Note that the RemoteStore keeps an
9070
+ // in-memory view of the currently active targets which includes the current
9071
+ // resume token, so stream failure or user changes will still use an
9072
+ // up-to-date resume token regardless of what we do here.
9073
+ return n.addedDocuments.size + n.modifiedDocuments.size + n.removedDocuments.size > 0;
9080
9074
  }
9075
+ /**
9076
+ * Notifies local store of the changed views to locally pin documents.
9077
+ */ (c, u, r) && o.push(n.He.updateTargetData(t, u));
9081
9078
  }));
9082
- let c = Pn();
9079
+ let a = bn();
9083
9080
  // HACK: The only reason we allow a null snapshot version is so that we
9084
9081
  // can synthesize remote events when we get permission denied errors while
9085
9082
  // trying to resolve the state of a locally cached document that is in
@@ -9090,12 +9087,12 @@ function yr(t) {
9090
9087
  // Each loop iteration only affects its "own" doc, so it's safe to get all the remote
9091
9088
  // documents in advance in a single call.
9092
9089
  o.push(Tr(t, r, e.documentUpdates, s, void 0).next((t => {
9093
- c = t;
9090
+ a = t;
9094
9091
  }))), !s.isEqual(ht.min())) {
9095
9092
  const e = n.He.getLastRemoteSnapshotVersion(t).next((e => n.He.setTargetsMetadata(t, t.currentSequenceNumber, s)));
9096
9093
  o.push(e);
9097
9094
  }
9098
- return Js.waitFor(o).next((() => r.apply(t))).next((() => n.Wn.Vn(t, c))).next((() => c));
9095
+ return Js.waitFor(o).next((() => r.apply(t))).next((() => n.Wn.Vn(t, a))).next((() => a));
9099
9096
  })).then((t => (n.qn = i, t)));
9100
9097
  }
9101
9098
 
@@ -9120,9 +9117,9 @@ function yr(t) {
9120
9117
  i) {
9121
9118
  let r = Nn();
9122
9119
  return n.forEach((t => r = r.add(t))), e.getEntries(t, r).next((t => {
9123
- let r = Pn();
9120
+ let r = bn();
9124
9121
  return n.forEach(((n, o) => {
9125
- const c = t.get(n), a = (null == i ? void 0 : i.get(n)) || s;
9122
+ const a = t.get(n), c = (null == i ? void 0 : i.get(n)) || s;
9126
9123
  // Note: The order of the steps below is important, since we want
9127
9124
  // to ensure that rejected limbo resolutions (which fabricate
9128
9125
  // NoDocuments with SnapshotVersion.min()) never add documents to
@@ -9131,8 +9128,8 @@ i) {
9131
9128
  // NoDocuments with SnapshotVersion.min() are used in manufactured
9132
9129
  // events. We remove these documents from cache since we lost
9133
9130
  // access.
9134
- e.removeEntry(n, a), r = r.insert(n, o)) : !c.isValidDocument() || o.version.compareTo(c.version) > 0 || 0 === o.version.compareTo(c.version) && c.hasPendingWrites ? (e.addEntry(o, a),
9135
- r = r.insert(n, o)) : F("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", c.version, " Watch version:", o.version);
9131
+ e.removeEntry(n, c), r = r.insert(n, o)) : !a.isValidDocument() || o.version.compareTo(a.version) > 0 || 0 === o.version.compareTo(a.version) && a.hasPendingWrites ? (e.addEntry(o, c),
9132
+ r = r.insert(n, o)) : F("LocalStore", "Ignoring outdated watch update for ", n, ". Current version:", a.version, " Watch version:", o.version);
9136
9133
  })), r;
9137
9134
  }));
9138
9135
  }
@@ -9233,7 +9230,7 @@ async function Ar(t, e, n) {
9233
9230
  }
9234
9231
 
9235
9232
  // PORTING NOTE: Multi-Tab only.
9236
- function br(t, e) {
9233
+ function Pr(t, e) {
9237
9234
  const n = j(t), s = j(n.He), i = n.qn.get(e);
9238
9235
  return i ? Promise.resolve(i.target) : n.persistence.runTransaction("Get target data", "readonly", (t => s.Et(t, e).next((t => t ? t.target : null))));
9239
9236
  }
@@ -9245,15 +9242,15 @@ function br(t, e) {
9245
9242
  * since the prior call.
9246
9243
  */
9247
9244
  // PORTING NOTE: Multi-Tab only.
9248
- function Pr(t) {
9245
+ function br(t) {
9249
9246
  const e = j(t);
9250
9247
  return e.persistence.runTransaction("Get new document changes", "readonly", (t => function(t, e, n) {
9251
9248
  const s = j(t);
9252
- let i = Pn(), r = wi(n);
9253
- const o = er(e), c = IDBKeyRange.lowerBound(r, !0);
9249
+ let i = bn(), r = wi(n);
9250
+ const o = er(e), a = IDBKeyRange.lowerBound(r, !0);
9254
9251
  return o.jt({
9255
9252
  index: Ms.readTimeIndex,
9256
- range: c
9253
+ range: a
9257
9254
  }, ((t, e) => {
9258
9255
  // Unlike `getEntry()` and others, `getNewDocumentChanges()` parses
9259
9256
  // the documents directly since we want to keep sentinel deletes.
@@ -9310,12 +9307,12 @@ async function vr(t) {
9310
9307
  */
9311
9308
  async function Vr(t, e, n, s) {
9312
9309
  const i = j(t);
9313
- let r = Nn(), o = Pn(), c = Dn();
9310
+ let r = Nn(), o = bn(), a = Dn();
9314
9311
  for (const t of n) {
9315
9312
  const n = e.Hn(t.metadata.name);
9316
- t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)), c = c.insert(n, e.Yn(t.metadata.readTime));
9313
+ t.document && (r = r.add(n)), o = o.insert(n, e.Jn(t)), a = a.insert(n, e.Yn(t.metadata.readTime));
9317
9314
  }
9318
- const a = i.Qn.newChangeBuffer({
9315
+ const c = i.Qn.newChangeBuffer({
9319
9316
  trackRemovals: !0
9320
9317
  }), u = await Ir(i, function(t) {
9321
9318
  // It is OK that the path used for the query is not valid, because this will
@@ -9324,7 +9321,7 @@ async function Vr(t, e, n, s) {
9324
9321
  }(s));
9325
9322
  // Allocates a target to hold all document keys from the bundle, such that
9326
9323
  // they will not get garbage collected right away.
9327
- return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => Tr(t, a, o, ht.min(), c).next((e => (a.apply(t),
9324
+ return i.persistence.runTransaction("Apply bundle documents", "readwrite", (t => Tr(t, c, o, ht.min(), a).next((e => (c.apply(t),
9328
9325
  e))).next((e => i.He.removeMatchingKeysForTargetId(t, u.targetId).next((() => i.He.addMatchingKeys(t, r, u.targetId))).next((() => i.Wn.Vn(t, e))).next((() => e))))));
9329
9326
  }
9330
9327
 
@@ -9528,7 +9525,7 @@ class Nr {
9528
9525
  addMutationBatch(t, e, n, s) {
9529
9526
  const i = this.ds;
9530
9527
  this.ds++, this.An.length > 0 && this.An[this.An.length - 1];
9531
- const r = new ai(i, e, n, s);
9528
+ const r = new ci(i, e, n, s);
9532
9529
  this.An.push(r);
9533
9530
  // Track references by document key and index collection parents.
9534
9531
  for (const e of s) this.ws = this.ws.add(new Nr(e.key, i)), this.Jt.addToCollectionParentIndex(t, e.key.path.popLast());
@@ -9717,14 +9714,14 @@ class xr {
9717
9714
  return Js.resolve(n ? n.document.mutableCopy() : Ht.newInvalidDocument(e));
9718
9715
  }
9719
9716
  getEntries(t, e) {
9720
- let n = Pn();
9717
+ let n = bn();
9721
9718
  return e.forEach((t => {
9722
9719
  const e = this.docs.get(t);
9723
9720
  n = n.insert(t, e ? e.document.mutableCopy() : Ht.newInvalidDocument(t));
9724
9721
  })), Js.resolve(n);
9725
9722
  }
9726
9723
  getDocumentsMatchingQuery(t, e, n) {
9727
- let s = Pn();
9724
+ let s = bn();
9728
9725
  // Documents are ordered by key, so we can use a prefix scan to narrow down
9729
9726
  // the documents we need to match the query against.
9730
9727
  const i = new Nt(e.path.child("")), r = this.docs.getIteratorFrom(i);
@@ -9809,7 +9806,7 @@ class $r extends Yi {
9809
9806
  * A ordered bidirectional mapping between documents and the remote target
9810
9807
  * IDs.
9811
9808
  */
9812
- this.Rs = new Cr, this.targetCount = 0, this.bs = Mi.ie();
9809
+ this.Rs = new Cr, this.targetCount = 0, this.Ps = Mi.ie();
9813
9810
  }
9814
9811
  forEachTarget(t, e) {
9815
9812
  return this.Is.forEach(((t, n) => e(n))), Js.resolve();
@@ -9821,22 +9818,22 @@ class $r extends Yi {
9821
9818
  return Js.resolve(this.As);
9822
9819
  }
9823
9820
  allocateTargetId(t) {
9824
- return this.highestTargetId = this.bs.next(), Js.resolve(this.highestTargetId);
9821
+ return this.highestTargetId = this.Ps.next(), Js.resolve(this.highestTargetId);
9825
9822
  }
9826
9823
  setTargetsMetadata(t, e, n) {
9827
9824
  return n && (this.lastRemoteSnapshotVersion = n), e > this.As && (this.As = e),
9828
9825
  Js.resolve();
9829
9826
  }
9830
- ae(t) {
9827
+ ce(t) {
9831
9828
  this.Is.set(t.target, t);
9832
9829
  const e = t.targetId;
9833
- e > this.highestTargetId && (this.bs = new Mi(e), this.highestTargetId = e), t.sequenceNumber > this.As && (this.As = t.sequenceNumber);
9830
+ e > this.highestTargetId && (this.Ps = new Mi(e), this.highestTargetId = e), t.sequenceNumber > this.As && (this.As = t.sequenceNumber);
9834
9831
  }
9835
9832
  addTargetData(t, e) {
9836
- return this.ae(e), this.targetCount += 1, Js.resolve();
9833
+ return this.ce(e), this.targetCount += 1, Js.resolve();
9837
9834
  }
9838
9835
  updateTargetData(t, e) {
9839
- return this.ae(e), Js.resolve();
9836
+ return this.ce(e), Js.resolve();
9840
9837
  }
9841
9838
  removeTargetData(t, e) {
9842
9839
  return this.Is.delete(e.target), this.Rs.us(e.targetId), this.targetCount -= 1,
@@ -9907,9 +9904,9 @@ class Fr {
9907
9904
  * checked or asserted on every access.
9908
9905
  */
9909
9906
  constructor(t, e) {
9910
- this.Ps = {}, this.Be = new st(0), this.Ue = !1, this.Ue = !0, this.referenceDelegate = t(this),
9907
+ this.bs = {}, this.Be = new st(0), this.Ue = !1, this.Ue = !0, this.referenceDelegate = t(this),
9911
9908
  this.He = new Or(this);
9912
- this.Jt = new bi, this.Je = function(t, e) {
9909
+ this.Jt = new Pi, this.Je = function(t, e) {
9913
9910
  return new xr(t, e);
9914
9911
  }(this.Jt, (t => this.referenceDelegate.vs(t))), this.k = new li(e), this.Ye = new Dr(this.k);
9915
9912
  }
@@ -9933,8 +9930,8 @@ class Fr {
9933
9930
  return this.Jt;
9934
9931
  }
9935
9932
  getMutationQueue(t) {
9936
- let e = this.Ps[t.toKey()];
9937
- return e || (e = new kr(this.Jt, this.referenceDelegate), this.Ps[t.toKey()] = e),
9933
+ let e = this.bs[t.toKey()];
9934
+ return e || (e = new kr(this.Jt, this.referenceDelegate), this.bs[t.toKey()] = e),
9938
9935
  e;
9939
9936
  }
9940
9937
  getTargetCache() {
@@ -9953,7 +9950,7 @@ class Fr {
9953
9950
  t)));
9954
9951
  }
9955
9952
  Ds(t, e) {
9956
- return Js.or(Object.values(this.Ps).map((n => () => n.containsKey(t, e))));
9953
+ return Js.or(Object.values(this.bs).map((n => () => n.containsKey(t, e))));
9957
9954
  }
9958
9955
  }
9959
9956
 
@@ -10266,7 +10263,7 @@ class Gr {
10266
10263
  // mutations but before we observe WebStorage events.
10267
10264
  this.window.addEventListener("storage", this.Us);
10268
10265
  }
10269
- /** Returns 'true' if WebStorage is available in the current environment. */ static Pt(t) {
10266
+ /** Returns 'true' if WebStorage is available in the current environment. */ static bt(t) {
10270
10267
  return !(!t || !t.localStorage);
10271
10268
  }
10272
10269
  async start() {
@@ -10353,7 +10350,7 @@ class Gr {
10353
10350
  this.oi(t);
10354
10351
  }
10355
10352
  notifyBundleLoaded() {
10356
- this.ci();
10353
+ this.ai();
10357
10354
  }
10358
10355
  shutdown() {
10359
10356
  this.started && (this.window.removeEventListener("storage", this.Us), this.removeItem(this.Qs),
@@ -10379,7 +10376,7 @@ class Gr {
10379
10376
  if (this.started) {
10380
10377
  if (null !== e.key) if (this.Gs.test(e.key)) {
10381
10378
  if (null == e.newValue) {
10382
- const t = this.ai(e.key);
10379
+ const t = this.ci(e.key);
10383
10380
  return this.ui(t, null);
10384
10381
  }
10385
10382
  {
@@ -10448,13 +10445,13 @@ class Gr {
10448
10445
  const s = qr(this.persistenceKey, t), i = new jr(t, e, n);
10449
10446
  this.setItem(s, i.Fs());
10450
10447
  }
10451
- ci() {
10448
+ ai() {
10452
10449
  this.setItem(this.Ys, "value-not-used");
10453
10450
  }
10454
10451
  /**
10455
10452
  * Parses a client state key in WebStorage. Returns null if the key does not
10456
10453
  * match the expected key format.
10457
- */ ai(t) {
10454
+ */ ci(t) {
10458
10455
  const e = this.Gs.exec(t);
10459
10456
  return e ? e[1] : null;
10460
10457
  }
@@ -10462,7 +10459,7 @@ class Gr {
10462
10459
  * Parses a client state in WebStorage. Returns 'null' if the value could not
10463
10460
  * be parsed.
10464
10461
  */ hi(t, e) {
10465
- const n = this.ai(t);
10462
+ const n = this.ci(t);
10466
10463
  return Qr.Os(n, e);
10467
10464
  }
10468
10465
  /**
@@ -10612,10 +10609,10 @@ class Hr {
10612
10609
  */
10613
10610
  class Yr {
10614
10611
  constructor() {
10615
- this.Ii = () => this.Ai(), this.Ri = () => this.bi(), this.Pi = [], this.vi();
10612
+ this.Ii = () => this.Ai(), this.Ri = () => this.Pi(), this.bi = [], this.vi();
10616
10613
  }
10617
10614
  Ei(t) {
10618
- this.Pi.push(t);
10615
+ this.bi.push(t);
10619
10616
  }
10620
10617
  shutdown() {
10621
10618
  window.removeEventListener("online", this.Ii), window.removeEventListener("offline", this.Ri);
@@ -10625,16 +10622,16 @@ class Yr {
10625
10622
  }
10626
10623
  Ai() {
10627
10624
  F("ConnectivityMonitor", "Network connectivity changed: AVAILABLE");
10628
- for (const t of this.Pi) t(0 /* AVAILABLE */);
10625
+ for (const t of this.bi) t(0 /* AVAILABLE */);
10629
10626
  }
10630
- bi() {
10627
+ Pi() {
10631
10628
  F("ConnectivityMonitor", "Network connectivity changed: UNAVAILABLE");
10632
- for (const t of this.Pi) t(1 /* UNAVAILABLE */);
10629
+ for (const t of this.bi) t(1 /* UNAVAILABLE */);
10633
10630
  }
10634
10631
  // TODO(chenbrian): Consider passing in window either into this component or
10635
10632
  // here for testing via FakeWindow.
10636
10633
  /** Checks that all used attributes of window are available. */
10637
- static Pt() {
10634
+ static bt() {
10638
10635
  return "undefined" != typeof window && void 0 !== window.addEventListener && void 0 !== window.removeEventListener;
10639
10636
  }
10640
10637
  }
@@ -10818,12 +10815,12 @@ class {
10818
10815
  F("Connection", 'RPC "' + t + '" completed.');
10819
10816
  }
10820
10817
  }));
10821
- const c = JSON.stringify(s);
10822
- o.send(e, "POST", c, n, 15);
10818
+ const a = JSON.stringify(s);
10819
+ o.send(e, "POST", a, n, 15);
10823
10820
  }));
10824
10821
  }
10825
10822
  Qi(t, e, n) {
10826
- const s = [ this.Mi, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = b(), r = P(), o = {
10823
+ const s = [ this.Mi, "/", "google.firestore.v1.Firestore", "/", t, "/channel" ], i = P(), r = b(), o = {
10827
10824
  // Required for backend stickiness, routing behavior is based on this
10828
10825
  // parameter.
10829
10826
  httpSessionIdParam: "gsessionid",
@@ -10864,9 +10861,9 @@ class {
10864
10861
  // known to (sometimes) not include an Origin. See
10865
10862
  // https://github.com/firebase/firebase-js-sdk/issues/1491.
10866
10863
  d() || w() || _() || m() || g() || y() || (o.httpHeadersOverwriteParam = "$httpHeaders");
10867
- const c = s.join("");
10868
- F("Connection", "Creating WebChannel: " + c, o);
10869
- const a = i.createWebChannel(c, o);
10864
+ const a = s.join("");
10865
+ F("Connection", "Creating WebChannel: " + a, o);
10866
+ const c = i.createWebChannel(a, o);
10870
10867
  // WebChannel supports sending the first message with the handshake - saving
10871
10868
  // a network round trip. However, it will have to call send in the same
10872
10869
  // JS event loop as open. In order to enforce this, we delay actually
@@ -10879,9 +10876,9 @@ class {
10879
10876
  const l = new Zr({
10880
10877
  Vi: t => {
10881
10878
  h ? F("Connection", "Not sending because WebChannel is closed:", t) : (u || (F("Connection", "Opening WebChannel transport."),
10882
- a.open(), u = !0), F("Connection", "WebChannel sending:", t), a.send(t));
10879
+ c.open(), u = !0), F("Connection", "WebChannel sending:", t), c.send(t));
10883
10880
  },
10884
- Si: () => a.close()
10881
+ Si: () => c.close()
10885
10882
  }), f = (t, e, n) => {
10886
10883
  // TODO(dimond): closure typing seems broken because WebChannel does
10887
10884
  // not implement goog.events.Listenable
@@ -10899,13 +10896,13 @@ class {
10899
10896
  // exception and rethrow using a setTimeout so they become visible again.
10900
10897
  // Note that eventually this function could go away if we are confident
10901
10898
  // enough the code is exception free.
10902
- return f(a, V.EventType.OPEN, (() => {
10899
+ return f(c, V.EventType.OPEN, (() => {
10903
10900
  h || F("Connection", "WebChannel transport opened.");
10904
- })), f(a, V.EventType.CLOSE, (() => {
10901
+ })), f(c, V.EventType.CLOSE, (() => {
10905
10902
  h || (h = !0, F("Connection", "WebChannel transport closed"), l.Oi());
10906
- })), f(a, V.EventType.ERROR, (t => {
10903
+ })), f(c, V.EventType.ERROR, (t => {
10907
10904
  h || (h = !0, L("Connection", "WebChannel transport errored:", t), l.Oi(new W(Q.UNAVAILABLE, "The operation could not be completed")));
10908
- })), f(a, V.EventType.MESSAGE, (t => {
10905
+ })), f(c, V.EventType.MESSAGE, (t => {
10909
10906
  var e;
10910
10907
  if (!h) {
10911
10908
  const n = t.data[0];
@@ -10935,7 +10932,7 @@ class {
10935
10932
  }(t), n = i.message;
10936
10933
  void 0 === e && (e = Q.INTERNAL, n = "Unknown error status: " + t + " with message " + i.message),
10937
10934
  // Mark closed so no further events are propagated
10938
- h = !0, l.Oi(new W(e, n)), a.close();
10935
+ h = !0, l.Oi(new W(e, n)), c.close();
10939
10936
  } else F("Connection", "WebChannel received:", n), l.Fi(n);
10940
10937
  }
10941
10938
  })), f(r, S.STAT_EVENT, (t => {
@@ -11150,15 +11147,15 @@ class io {
11150
11147
  * ListenerType: The type of the listener that will be used for callbacks
11151
11148
  */
11152
11149
  class ro {
11153
- constructor(t, e, n, s, i, r, o, c) {
11150
+ constructor(t, e, n, s, i, r, o, a) {
11154
11151
  this.Fe = t, this.nr = n, this.sr = s, this.ir = i, this.authCredentialsProvider = r,
11155
- this.appCheckCredentialsProvider = o, this.listener = c, this.state = 0 /* Initial */ ,
11152
+ this.appCheckCredentialsProvider = o, this.listener = a, this.state = 0 /* Initial */ ,
11156
11153
  /**
11157
11154
  * A close count that's incremented every time the stream is closed; used by
11158
11155
  * getCloseGuardedDispatcher() to invalidate callbacks that happen after
11159
11156
  * close.
11160
11157
  */
11161
- this.rr = 0, this.cr = null, this.ar = null, this.stream = null, this.ur = new io(t, e);
11158
+ this.rr = 0, this.ar = null, this.cr = null, this.stream = null, this.ur = new io(t, e);
11162
11159
  }
11163
11160
  /**
11164
11161
  * Returns true if start() has been called and no error has occurred. True
@@ -11214,7 +11211,7 @@ class ro {
11214
11211
  */ _r() {
11215
11212
  // Starts the idle time if we are in state 'Open' and are not yet already
11216
11213
  // running a timer (in which case the previous idle timeout still applies).
11217
- this.lr() && null === this.cr && (this.cr = this.Fe.enqueueAfterDelay(this.nr, 6e4, (() => this.mr())));
11214
+ this.lr() && null === this.ar && (this.ar = this.Fe.enqueueAfterDelay(this.nr, 6e4, (() => this.mr())));
11218
11215
  }
11219
11216
  /** Sends a message to the underlying stream. */ gr(t) {
11220
11217
  this.yr(), this.stream.send(t);
@@ -11226,10 +11223,10 @@ class ro {
11226
11223
  return this.close(0 /* Initial */);
11227
11224
  }
11228
11225
  /** Marks the stream as active again. */ yr() {
11229
- this.cr && (this.cr.cancel(), this.cr = null);
11226
+ this.ar && (this.ar.cancel(), this.ar = null);
11230
11227
  }
11231
11228
  /** Cancels the health check delayed operation. */ pr() {
11232
- this.ar && (this.ar.cancel(), this.ar = null);
11229
+ this.cr && (this.cr.cancel(), this.cr = null);
11233
11230
  }
11234
11231
  /**
11235
11232
  * Closes the stream and cleans up as necessary:
@@ -11297,7 +11294,7 @@ class ro {
11297
11294
  Ir(t, e) {
11298
11295
  const n = this.Er(this.rr);
11299
11296
  this.stream = this.Rr(t, e), this.stream.Di((() => {
11300
- n((() => (this.state = 2 /* Open */ , this.ar = this.Fe.enqueueAfterDelay(this.sr, 1e4, (() => (this.lr() && (this.state = 3 /* Healthy */),
11297
+ n((() => (this.state = 2 /* Open */ , this.cr = this.Fe.enqueueAfterDelay(this.sr, 1e4, (() => (this.lr() && (this.state = 3 /* Healthy */),
11301
11298
  Promise.resolve()))), this.listener.Di())));
11302
11299
  })), this.stream.Ni((t => {
11303
11300
  n((() => this.Ar(t)));
@@ -11348,7 +11345,7 @@ class ro {
11348
11345
  onMessage(t) {
11349
11346
  // A successful response means the stream is healthy
11350
11347
  this.ur.reset();
11351
- const e = as(this.k, t), n = function(t) {
11348
+ const e = cs(this.k, t), n = function(t) {
11352
11349
  // We have only reached a consistent snapshot for the entire stream if there
11353
11350
  // is a read_time set and it applies to all targets (i.e. the list of
11354
11351
  // targets is empty). The backend is guaranteed to send such responses.
@@ -11356,14 +11353,14 @@ class ro {
11356
11353
  const e = t.targetChange;
11357
11354
  return e.targetIds && e.targetIds.length ? ht.min() : e.readTime ? Jn(e.readTime) : ht.min();
11358
11355
  }(t);
11359
- return this.listener.br(e, n);
11356
+ return this.listener.Pr(e, n);
11360
11357
  }
11361
11358
  /**
11362
11359
  * Registers interest in the results of the given target. If the target
11363
11360
  * includes a resumeToken it will be included in the request. Results that
11364
11361
  * affect the target will be streamed back as WatchChange messages that
11365
11362
  * reference the targetId.
11366
- */ Pr(t) {
11363
+ */ br(t) {
11367
11364
  const e = {};
11368
11365
  e.database = ss(this.k), e.addTarget = function(t, e) {
11369
11366
  let n;
@@ -11406,7 +11403,7 @@ class ro {
11406
11403
  * okay to use the same streamToken for the calls to writeMutations.
11407
11404
  *
11408
11405
  * TODO(b/33271235): Use proto types
11409
- */ class co extends ro {
11406
+ */ class ao extends ro {
11410
11407
  constructor(t, e, n, s, i, r) {
11411
11408
  super(t, "write_stream_connection_backoff" /* WriteStreamConnectionBackoff */ , "write_stream_idle" /* WriteStreamIdle */ , "health_check_timeout" /* HealthCheckTimeout */ , e, n, s, r),
11412
11409
  this.k = i, this.Vr = !1;
@@ -11485,7 +11482,7 @@ class ro {
11485
11482
  * An implementation of Datastore that exposes additional state for internal
11486
11483
  * consumption.
11487
11484
  */
11488
- class ao extends class {} {
11485
+ class co extends class {} {
11489
11486
  constructor(t, e, n, s) {
11490
11487
  super(), this.authCredentials = t, this.appCheckCredentials = e, this.ir = n, this.k = s,
11491
11488
  this.$r = !1;
@@ -11712,7 +11709,7 @@ function wo(t, e) {
11712
11709
  * We need to increment the the expected number of pending responses we're due
11713
11710
  * from watch so we wait for the ack to process any messages from this target.
11714
11711
  */ function mo(t, e) {
11715
- t.Yr.X(e.targetId), Fo(t).Pr(e);
11712
+ t.Yr.X(e.targetId), Fo(t).br(e);
11716
11713
  }
11717
11714
 
11718
11715
  /**
@@ -11786,7 +11783,7 @@ async function Ro(t, e, n) {
11786
11783
  */ (t, e);
11787
11784
  } catch (n) {
11788
11785
  F("RemoteStore", "Failed to remove targets %s: %s ", e.targetIds.join(","), n),
11789
- await bo(t, n);
11786
+ await Po(t, n);
11790
11787
  } else if (e instanceof Fn ? t.Yr.ot(e) : e instanceof Mn ? t.Yr.dt(e) : t.Yr.ut(e),
11791
11788
  !n.isEqual(ht.min())) try {
11792
11789
  const e = await yr(t.localStore);
@@ -11832,7 +11829,7 @@ async function Ro(t, e, n) {
11832
11829
  })), t.remoteSyncer.applyRemoteEvent(n);
11833
11830
  }(t, n);
11834
11831
  } catch (e) {
11835
- F("RemoteStore", "Failed to raise snapshot:", e), await bo(t, e);
11832
+ F("RemoteStore", "Failed to raise snapshot:", e), await Po(t, e);
11836
11833
  }
11837
11834
  }
11838
11835
 
@@ -11844,7 +11841,7 @@ async function Ro(t, e, n) {
11844
11841
  *
11845
11842
  * The returned Promise is resolved once the network is disabled and before
11846
11843
  * any retry attempt.
11847
- */ async function bo(t, e, n) {
11844
+ */ async function Po(t, e, n) {
11848
11845
  if (!ei(e)) throw e;
11849
11846
  t.Gr.add(1 /* IndexedDbFailed */),
11850
11847
  // Disable network and raise offline snapshots
@@ -11863,8 +11860,8 @@ async function Ro(t, e, n) {
11863
11860
  /**
11864
11861
  * Executes `op`. If `op` fails, takes the network offline until `op`
11865
11862
  * succeeds. Returns after the first attempt.
11866
- */ function Po(t, e) {
11867
- return e().catch((n => bo(t, n, e)));
11863
+ */ function bo(t, e) {
11864
+ return e().catch((n => Po(t, n, e)));
11868
11865
  }
11869
11866
 
11870
11867
  async function vo(t) {
@@ -11878,7 +11875,7 @@ async function vo(t) {
11878
11875
  }
11879
11876
  s = t.batchId, So(e, t);
11880
11877
  } catch (t) {
11881
- await bo(e, t);
11878
+ await Po(e, t);
11882
11879
  }
11883
11880
  Do(e) && Co(e);
11884
11881
  }
@@ -11919,7 +11916,7 @@ async function ko(t) {
11919
11916
 
11920
11917
  async function xo(t, e, n) {
11921
11918
  const s = t.Qr.shift(), i = ui.from(s, e, n);
11922
- await Po(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
11919
+ await bo(t, (() => t.remoteSyncer.applySuccessfulWrite(i))),
11923
11920
  // It's possible that with the completion of this mutation another
11924
11921
  // slot has freed up.
11925
11922
  await vo(t);
@@ -11940,7 +11937,7 @@ async function $o(t, e) {
11940
11937
  // In this case it's also unlikely that the server itself is melting
11941
11938
  // down -- this was just a bad request so inhibit backoff on the next
11942
11939
  // restart.
11943
- Mo(t).wr(), await Po(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
11940
+ Mo(t).wr(), await bo(t, (() => t.remoteSyncer.rejectFailedWrite(n.batchId, e))),
11944
11941
  // It's possible that with the completion of this mutation
11945
11942
  // another slot has freed up.
11946
11943
  await vo(t);
@@ -11993,7 +11990,7 @@ async function Oo(t, e) {
11993
11990
  */ (t.datastore, t.asyncQueue, {
11994
11991
  Di: Io.bind(null, t),
11995
11992
  Ni: Ao.bind(null, t),
11996
- br: Ro.bind(null, t)
11993
+ Pr: Ro.bind(null, t)
11997
11994
  }), t.zr.push((async e => {
11998
11995
  e ? (t.Xr.wr(), po(t) ? yo(t) : t.Jr.set("Unknown" /* Unknown */)) : (await t.Xr.stop(),
11999
11996
  Eo(t));
@@ -12012,7 +12009,7 @@ async function Oo(t, e) {
12012
12009
  // Create stream (but note that it is not started yet).
12013
12010
  t.Zr = function(t, e, n) {
12014
12011
  const s = j(t);
12015
- return s.Or(), new co(e, s.ir, s.authCredentials, s.appCheckCredentials, s.k, n);
12012
+ return s.Or(), new ao(e, s.ir, s.authCredentials, s.appCheckCredentials, s.k, n);
12016
12013
  }(t.datastore, t.asyncQueue, {
12017
12014
  Di: No.bind(null, t),
12018
12015
  Ni: $o.bind(null, t),
@@ -12273,9 +12270,9 @@ class Lo {
12273
12270
  }
12274
12271
 
12275
12272
  class Ko {
12276
- constructor(t, e, n, s, i, r, o, c) {
12273
+ constructor(t, e, n, s, i, r, o, a) {
12277
12274
  this.query = t, this.docs = e, this.oldDocs = n, this.docChanges = s, this.mutatedKeys = i,
12278
- this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = c;
12275
+ this.fromCache = r, this.syncStateChanged = o, this.excludesMetadataChanges = a;
12279
12276
  }
12280
12277
  /** Returns a view snapshot as if all documents in the snapshot were added. */ static fromInitialDocuments(t, e, n, s) {
12281
12278
  const i = [];
@@ -12394,12 +12391,12 @@ function Jo(t) {
12394
12391
  * It uses an Observer to dispatch events.
12395
12392
  */ class Yo {
12396
12393
  constructor(t, e, n) {
12397
- this.query = t, this.co = e,
12394
+ this.query = t, this.ao = e,
12398
12395
  /**
12399
12396
  * Initial snapshots (e.g. from cache) may not be propagated to the wrapped
12400
12397
  * observer. This flag is set to true once we've actually raised an event.
12401
12398
  */
12402
- this.ao = !1, this.uo = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
12399
+ this.co = !1, this.uo = null, this.onlineState = "Unknown" /* Unknown */ , this.options = n || {};
12403
12400
  }
12404
12401
  /**
12405
12402
  * Applies the new ViewSnapshot to this listener, raising a user-facing event
@@ -12415,16 +12412,16 @@ function Jo(t) {
12415
12412
  /* excludesMetadataChanges= */ !0);
12416
12413
  }
12417
12414
  let e = !1;
12418
- return this.ao ? this.ho(t) && (this.co.next(t), e = !0) : this.lo(t, this.onlineState) && (this.fo(t),
12415
+ return this.co ? this.ho(t) && (this.ao.next(t), e = !0) : this.lo(t, this.onlineState) && (this.fo(t),
12419
12416
  e = !0), this.uo = t, e;
12420
12417
  }
12421
12418
  onError(t) {
12422
- this.co.error(t);
12419
+ this.ao.error(t);
12423
12420
  }
12424
12421
  /** Returns whether a snapshot was raised. */ ro(t) {
12425
12422
  this.onlineState = t;
12426
12423
  let e = !1;
12427
- return this.uo && !this.ao && this.lo(this.uo, t) && (this.fo(this.uo), e = !0),
12424
+ return this.uo && !this.co && this.lo(this.uo, t) && (this.fo(this.uo), e = !0),
12428
12425
  e;
12429
12426
  }
12430
12427
  lo(t, e) {
@@ -12451,8 +12448,8 @@ function Jo(t) {
12451
12448
  // stripped out.
12452
12449
  }
12453
12450
  fo(t) {
12454
- t = Ko.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.ao = !0,
12455
- this.co.next(t);
12451
+ t = Ko.fromInitialDocuments(t.query, t.docs, t.mutatedKeys, t.fromCache), this.co = !0,
12452
+ this.ao.next(t);
12456
12453
  }
12457
12454
  }
12458
12455
 
@@ -12524,13 +12521,13 @@ function Jo(t) {
12524
12521
  /**
12525
12522
  * A class to process the elements from a bundle, load them into local
12526
12523
  * storage and provide progress update while loading.
12527
- */ class tc {
12524
+ */ class ta {
12528
12525
  constructor(t, e, n) {
12529
12526
  this.mo = t, this.localStore = e, this.k = n,
12530
12527
  /** Batched queries to be saved into storage */
12531
12528
  this.queries = [],
12532
12529
  /** Batched documents to be saved into storage */
12533
- this.documents = [], this.progress = ec(t);
12530
+ this.documents = [], this.progress = ea(t);
12534
12531
  }
12535
12532
  /**
12536
12533
  * Adds an element from the bundle to the loader.
@@ -12569,7 +12566,7 @@ function Jo(t) {
12569
12566
  /**
12570
12567
  * Returns a `LoadBundleTaskProgress` representing the initial progress of
12571
12568
  * loading a bundle.
12572
- */ function ec(t) {
12569
+ */ function ea(t) {
12573
12570
  return {
12574
12571
  taskState: "Running",
12575
12572
  documentsLoaded: 0,
@@ -12599,13 +12596,13 @@ function Jo(t) {
12599
12596
  * See the License for the specific language governing permissions and
12600
12597
  * limitations under the License.
12601
12598
  */
12602
- class nc {
12599
+ class na {
12603
12600
  constructor(t) {
12604
12601
  this.key = t;
12605
12602
  }
12606
12603
  }
12607
12604
 
12608
- class sc {
12605
+ class sa {
12609
12606
  constructor(t) {
12610
12607
  this.key = t;
12611
12608
  }
@@ -12615,7 +12612,7 @@ class sc {
12615
12612
  * View is responsible for computing the final merged truth of what docs are in
12616
12613
  * a query. It gets notified of local and remote changes to docs, and applies
12617
12614
  * the query filters and limits to determine the most correct possible results.
12618
- */ class ic {
12615
+ */ class ia {
12619
12616
  constructor(t,
12620
12617
  /** Documents included in the remote target */
12621
12618
  e) {
@@ -12635,7 +12632,7 @@ class sc {
12635
12632
  /**
12636
12633
  * The set of remote documents that the server has told us belongs to the target associated with
12637
12634
  * this view.
12638
- */ get bo() {
12635
+ */ get Po() {
12639
12636
  return this.To;
12640
12637
  }
12641
12638
  /**
@@ -12647,7 +12644,7 @@ class sc {
12647
12644
  * @param previousChanges - If this is being called with a refill, then start
12648
12645
  * with this set of docs and changes instead of the current view.
12649
12646
  * @returns a new set of docs, changes, and refill flag.
12650
- */ Po(t, e) {
12647
+ */ bo(t, e) {
12651
12648
  const n = e ? e.vo : new qo, s = e ? e.Ro : this.Ro;
12652
12649
  let i = e ? e.mutatedKeys : this.mutatedKeys, r = s, o = !1;
12653
12650
  // Track the last doc in a (full) limit. This is necessary, because some
@@ -12658,7 +12655,7 @@ class sc {
12658
12655
  // deletes. So we keep this doc at the old limit to compare the updates to.
12659
12656
  // Note that this should never get used in a refill (when previousChanges is
12660
12657
  // set), because there will only be adds -- no deletes or updates.
12661
- const c = Ee(this.query) && s.size === this.query.limit ? s.last() : null, a = Ie(this.query) && s.size === this.query.limit ? s.first() : null;
12658
+ const a = Ee(this.query) && s.size === this.query.limit ? s.last() : null, c = Ie(this.query) && s.size === this.query.limit ? s.first() : null;
12662
12659
  // Drop documents out to meet limit/limitToLast requirement.
12663
12660
  if (t.inorderTraversal(((t, e) => {
12664
12661
  const u = s.get(t), h = Ne(this.query, e) ? e : null, l = !!u && this.mutatedKeys.has(u.key), f = !!h && (h.hasLocalMutations ||
@@ -12674,7 +12671,7 @@ class sc {
12674
12671
  }), d = !0) : this.Vo(u, h) || (n.track({
12675
12672
  type: 2 /* Modified */ ,
12676
12673
  doc: h
12677
- }), d = !0, (c && this.Ao(h, c) > 0 || a && this.Ao(h, a) < 0) && (
12674
+ }), d = !0, (a && this.Ao(h, a) > 0 || c && this.Ao(h, c) < 0) && (
12678
12675
  // This doc moved from inside the limit to outside the limit.
12679
12676
  // That means there may be some other doc in the local cache
12680
12677
  // that should be included instead.
@@ -12685,7 +12682,7 @@ class sc {
12685
12682
  }), d = !0) : u && !h && (n.track({
12686
12683
  type: 1 /* Removed */ ,
12687
12684
  doc: u
12688
- }), d = !0, (c || a) && (
12685
+ }), d = !0, (a || c) && (
12689
12686
  // A doc was removed from a full limit query. We'll need to
12690
12687
  // requery from the local cache to see if we know about some other
12691
12688
  // doc that should be in the results.
@@ -12769,10 +12766,10 @@ class sc {
12769
12766
  * See the License for the specific language governing permissions and
12770
12767
  * limitations under the License.
12771
12768
  */ (t.type, e.type) || this.Ao(t.doc, e.doc))), this.So(n);
12772
- const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ , c = o !== this.Eo;
12773
- if (this.Eo = o, 0 !== i.length || c) {
12769
+ const r = e ? this.Do() : [], o = 0 === this.Io.size && this.current ? 1 /* Synced */ : 0 /* Local */ , a = o !== this.Eo;
12770
+ if (this.Eo = o, 0 !== i.length || a) {
12774
12771
  return {
12775
- snapshot: new Ko(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, c,
12772
+ snapshot: new Ko(this.query, t.Ro, s, i, t.mutatedKeys, 0 /* Local */ === o, a,
12776
12773
  /* excludesMetadataChanges= */ !1),
12777
12774
  Co: r
12778
12775
  };
@@ -12828,9 +12825,9 @@ class sc {
12828
12825
  // Diff the new limbo docs with the old limbo docs.
12829
12826
  const e = [];
12830
12827
  return t.forEach((t => {
12831
- this.Io.has(t) || e.push(new sc(t));
12828
+ this.Io.has(t) || e.push(new sa(t));
12832
12829
  })), this.Io.forEach((n => {
12833
- t.has(n) || e.push(new nc(n));
12830
+ t.has(n) || e.push(new na(n));
12834
12831
  })), e;
12835
12832
  }
12836
12833
  /**
@@ -12855,7 +12852,7 @@ class sc {
12855
12852
  // PORTING NOTE: Multi-tab only.
12856
12853
  ko(t) {
12857
12854
  this.To = t.zn, this.Io = Nn();
12858
- const e = this.Po(t.documents);
12855
+ const e = this.bo(t.documents);
12859
12856
  return this.applyChanges(e, /*updateLimboDocuments=*/ !0);
12860
12857
  }
12861
12858
  /**
@@ -12873,7 +12870,7 @@ class sc {
12873
12870
  * QueryView contains all of the data that SyncEngine needs to keep track of for
12874
12871
  * a particular query.
12875
12872
  */
12876
- class rc {
12873
+ class ra {
12877
12874
  constructor(
12878
12875
  /**
12879
12876
  * The query itself.
@@ -12895,7 +12892,7 @@ class rc {
12895
12892
  }
12896
12893
  }
12897
12894
 
12898
- /** Tracks a limbo resolution. */ class oc {
12895
+ /** Tracks a limbo resolution. */ class oa {
12899
12896
  constructor(t) {
12900
12897
  this.key = t,
12901
12898
  /**
@@ -12920,7 +12917,7 @@ class rc {
12920
12917
  * the class is not exported so they are only accessible from this module.
12921
12918
  * This is useful to implement optional features (like bundles) in free
12922
12919
  * functions, such that they are tree-shakeable.
12923
- */ class cc {
12920
+ */ class aa {
12924
12921
  constructor(t, e, n,
12925
12922
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
12926
12923
  s, i, r) {
@@ -12966,8 +12963,8 @@ class rc {
12966
12963
  * server. All the subsequent view snapshots or errors are sent to the
12967
12964
  * subscribed handlers. Returns the initial snapshot.
12968
12965
  */
12969
- async function ac(t, e) {
12970
- const n = Fc(t);
12966
+ async function ca(t, e) {
12967
+ const n = Fa(t);
12971
12968
  let s, i;
12972
12969
  const r = n.Fo.get(e);
12973
12970
  if (r)
@@ -12979,7 +12976,7 @@ async function ac(t, e) {
12979
12976
  // case and calls `listen` to obtain this ID.
12980
12977
  s = r.targetId, n.sharedClientState.addLocalQueryTarget(s), i = r.view.xo(); else {
12981
12978
  const t = await Ir(n.localStore, ve(e)), r = n.sharedClientState.addLocalQueryTarget(t.targetId);
12982
- s = t.targetId, i = await uc(n, e, s, "current" === r), n.isPrimaryClient && wo(n.remoteStore, t);
12979
+ s = t.targetId, i = await ua(n, e, s, "current" === r), n.isPrimaryClient && wo(n.remoteStore, t);
12983
12980
  }
12984
12981
  return i;
12985
12982
  }
@@ -12987,31 +12984,31 @@ async function ac(t, e) {
12987
12984
  /**
12988
12985
  * Registers a view for a previously unknown query and computes its initial
12989
12986
  * snapshot.
12990
- */ async function uc(t, e, n, s) {
12987
+ */ async function ua(t, e, n, s) {
12991
12988
  // PORTING NOTE: On Web only, we inject the code that registers new Limbo
12992
12989
  // targets based on view changes. This allows us to only depend on Limbo
12993
12990
  // changes when user code includes queries.
12994
12991
  t.Go = (e, n, s) => async function(t, e, n, s) {
12995
- let i = e.view.Po(n);
12992
+ let i = e.view.bo(n);
12996
12993
  i.Bn && (
12997
12994
  // The query has a limit and some docs were removed, so we need
12998
12995
  // to re-run the query against the local store to make sure we
12999
12996
  // didn't lose any good docs that had been past the limit.
13000
12997
  i = await Rr(t.localStore, e.query,
13001
- /* usePreviousResults= */ !1).then((({documents: t}) => e.view.Po(t, i))));
12998
+ /* usePreviousResults= */ !1).then((({documents: t}) => e.view.bo(t, i))));
13002
12999
  const r = s && s.targetChanges.get(e.targetId), o = e.view.applyChanges(i,
13003
13000
  /* updateLimboDocuments= */ t.isPrimaryClient, r);
13004
- return Ic(t, e.targetId, o.Co), o.snapshot;
13001
+ return Ia(t, e.targetId, o.Co), o.snapshot;
13005
13002
  }(t, e, n, s);
13006
13003
  const i = await Rr(t.localStore, e,
13007
- /* usePreviousResults= */ !0), r = new ic(e, i.zn), o = r.Po(i.documents), c = On.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), a = r.applyChanges(o,
13008
- /* updateLimboDocuments= */ t.isPrimaryClient, c);
13009
- Ic(t, n, a.Co);
13010
- const u = new rc(e, n, r);
13011
- return t.Fo.set(e, u), t.Mo.has(n) ? t.Mo.get(n).push(e) : t.Mo.set(n, [ e ]), a.snapshot;
13004
+ /* usePreviousResults= */ !0), r = new ia(e, i.zn), o = r.bo(i.documents), a = On.createSynthesizedTargetChangeForCurrentChange(n, s && "Offline" /* Offline */ !== t.onlineState), c = r.applyChanges(o,
13005
+ /* updateLimboDocuments= */ t.isPrimaryClient, a);
13006
+ Ia(t, n, c.Co);
13007
+ const u = new ra(e, n, r);
13008
+ return t.Fo.set(e, u), t.Mo.has(n) ? t.Mo.get(n).push(e) : t.Mo.set(n, [ e ]), c.snapshot;
13012
13009
  }
13013
13010
 
13014
- /** Stops listening to the query. */ async function hc(t, e) {
13011
+ /** Stops listening to the query. */ async function ha(t, e) {
13015
13012
  const n = j(t), s = n.Fo.get(e), i = n.Mo.get(s.targetId);
13016
13013
  if (i.length > 1) return n.Mo.set(s.targetId, i.filter((t => !Se(t, e)))), void n.Fo.delete(e);
13017
13014
  // No other queries are mapped to the target, clean up the query and the target.
@@ -13022,9 +13019,9 @@ async function ac(t, e) {
13022
13019
  n.sharedClientState.isActiveQueryTarget(s.targetId) || await Ar(n.localStore, s.targetId,
13023
13020
  /*keepPersistedTargetData=*/ !1).then((() => {
13024
13021
  n.sharedClientState.clearQueryState(s.targetId), _o(n.remoteStore, s.targetId),
13025
- Tc(n, s.targetId);
13022
+ Ta(n, s.targetId);
13026
13023
  })).catch(Ki);
13027
- } else Tc(n, s.targetId), await Ar(n.localStore, s.targetId,
13024
+ } else Ta(n, s.targetId), await Ar(n.localStore, s.targetId,
13028
13025
  /*keepPersistedTargetData=*/ !0);
13029
13026
  }
13030
13027
 
@@ -13037,8 +13034,8 @@ async function ac(t, e) {
13037
13034
  * have completed, *not* when the write was acked by the backend. The
13038
13035
  * userCallback is resolved once the write was acked/rejected by the
13039
13036
  * backend (or failed locally for any other reason).
13040
- */ async function lc(t, e, n) {
13041
- const s = Mc(t);
13037
+ */ async function la(t, e, n) {
13038
+ const s = Ma(t);
13042
13039
  try {
13043
13040
  const t = await function(t, e) {
13044
13041
  const n = j(t), s = ut.now(), i = e.reduce(((t, e) => t.add(e.key)), Nn());
@@ -13073,7 +13070,7 @@ async function ac(t, e) {
13073
13070
  /**
13074
13071
  * Resolves or rejects the user callback for the given batch and then discards
13075
13072
  * it.
13076
- */ (s, t.batchId, n), await bc(s, t.changes), await vo(s.remoteStore);
13073
+ */ (s, t.batchId, n), await Pa(s, t.changes), await vo(s.remoteStore);
13077
13074
  } catch (t) {
13078
13075
  // If we can't persist the mutation, we reject the user callback and
13079
13076
  // don't send the mutation. The user can then retry the write.
@@ -13086,7 +13083,7 @@ async function ac(t, e) {
13086
13083
  * Applies one remote event to the sync engine, notifying any views of the
13087
13084
  * changes, and releasing any pending mutation batches that would become
13088
13085
  * visible because of the snapshot version the remote event contains.
13089
- */ async function fc(t, e) {
13086
+ */ async function fa(t, e) {
13090
13087
  const n = j(t);
13091
13088
  try {
13092
13089
  const t = await pr(n.localStore, e);
@@ -13099,7 +13096,7 @@ async function ac(t, e) {
13099
13096
  q(t.addedDocuments.size + t.modifiedDocuments.size + t.removedDocuments.size <= 1),
13100
13097
  t.addedDocuments.size > 0 ? s.$o = !0 : t.modifiedDocuments.size > 0 ? q(s.$o) : t.removedDocuments.size > 0 && (q(s.$o),
13101
13098
  s.$o = !1));
13102
- })), await bc(n, t, e);
13099
+ })), await Pa(n, t, e);
13103
13100
  } catch (t) {
13104
13101
  await Ki(t);
13105
13102
  }
@@ -13108,7 +13105,7 @@ async function ac(t, e) {
13108
13105
  /**
13109
13106
  * Applies an OnlineState change to the sync engine and notifies any views of
13110
13107
  * the change.
13111
- */ function dc(t, e, n) {
13108
+ */ function da(t, e, n) {
13112
13109
  const s = j(t);
13113
13110
  // If we are the secondary client, we explicitly ignore the remote store's
13114
13111
  // online state (the local client may go offline, even though the primary
@@ -13128,7 +13125,7 @@ async function ac(t, e) {
13128
13125
  // Run global snapshot listeners if a consistent snapshot has been emitted.
13129
13126
  t.ro(e) && (s = !0);
13130
13127
  })), s && Jo(n);
13131
- }(s.eventManager, e), t.length && s.Oo.br(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
13128
+ }(s.eventManager, e), t.length && s.Oo.Pr(t), s.onlineState = e, s.isPrimaryClient && s.sharedClientState.setOnlineState(e);
13132
13129
  }
13133
13130
  }
13134
13131
 
@@ -13142,7 +13139,7 @@ async function ac(t, e) {
13142
13139
  * @param err - A description of the condition that has forced the rejection.
13143
13140
  * Nearly always this will be an indication that the user is no longer
13144
13141
  * authorized to see the data matching the target.
13145
- */ async function wc(t, e, n) {
13142
+ */ async function wa(t, e, n) {
13146
13143
  const s = j(t);
13147
13144
  // PORTING NOTE: Multi-tab only.
13148
13145
  s.sharedClientState.updateQueryState(e, "rejected", n);
@@ -13159,18 +13156,18 @@ async function ac(t, e) {
13159
13156
  const n = Nn().add(r), i = new $n(ht.min(),
13160
13157
  /* targetChanges= */ new Map,
13161
13158
  /* targetMismatches= */ new An(ot), t, n);
13162
- await fc(s, i),
13159
+ await fa(s, i),
13163
13160
  // Since this query failed, we won't want to manually unlisten to it.
13164
13161
  // We only remove it from bookkeeping after we successfully applied the
13165
13162
  // RemoteEvent. If `applyRemoteEvent()` throws, we want to re-listen to
13166
13163
  // this query when the RemoteStore restarts the Watch stream, which should
13167
13164
  // re-trigger the target failure.
13168
- s.Bo = s.Bo.remove(r), s.Uo.delete(e), Rc(s);
13165
+ s.Bo = s.Bo.remove(r), s.Uo.delete(e), Ra(s);
13169
13166
  } else await Ar(s.localStore, e,
13170
- /* keepPersistedTargetData */ !1).then((() => Tc(s, e, n))).catch(Ki);
13167
+ /* keepPersistedTargetData */ !1).then((() => Ta(s, e, n))).catch(Ki);
13171
13168
  }
13172
13169
 
13173
- async function _c(t, e) {
13170
+ async function _a(t, e) {
13174
13171
  const n = j(t), s = e.batch.batchId;
13175
13172
  try {
13176
13173
  const t = await gr(n.localStore, e);
@@ -13178,14 +13175,14 @@ async function _c(t, e) {
13178
13175
  // raise events immediately (depending on whether the watcher is caught
13179
13176
  // up), so we raise user callbacks first so that they consistently happen
13180
13177
  // before listen events.
13181
- pc(n, s, /*error=*/ null), yc(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
13182
- await bc(n, t);
13178
+ pa(n, s, /*error=*/ null), ya(n, s), n.sharedClientState.updateMutationState(s, "acknowledged"),
13179
+ await Pa(n, t);
13183
13180
  } catch (t) {
13184
13181
  await Ki(t);
13185
13182
  }
13186
13183
  }
13187
13184
 
13188
- async function mc(t, e, n) {
13185
+ async function ma(t, e, n) {
13189
13186
  const s = j(t);
13190
13187
  try {
13191
13188
  const t = await function(t, e) {
@@ -13205,8 +13202,8 @@ async function mc(t, e, n) {
13205
13202
  // raise events immediately (depending on whether the watcher is caught up),
13206
13203
  // so we raise user callbacks first so that they consistently happen before
13207
13204
  // listen events.
13208
- pc(s, e, n), yc(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
13209
- await bc(s, t);
13205
+ pa(s, e, n), ya(s, e), s.sharedClientState.updateMutationState(e, "rejected", n),
13206
+ await Pa(s, t);
13210
13207
  } catch (n) {
13211
13208
  await Ki(n);
13212
13209
  }
@@ -13215,7 +13212,7 @@ async function mc(t, e, n) {
13215
13212
  /**
13216
13213
  * Registers a user callback that resolves when all pending mutations at the moment of calling
13217
13214
  * are acknowledged .
13218
- */ async function gc(t, e) {
13215
+ */ async function ga(t, e) {
13219
13216
  const n = j(t);
13220
13217
  To(n.remoteStore) || F("SyncEngine", "The network is disabled. The task returned by 'awaitPendingWrites()' will not complete until the network is enabled.");
13221
13218
  try {
@@ -13237,13 +13234,13 @@ async function mc(t, e, n) {
13237
13234
  /**
13238
13235
  * Triggers the callbacks that are waiting for this batch id to get acknowledged by server,
13239
13236
  * if there are any.
13240
- */ function yc(t, e) {
13237
+ */ function ya(t, e) {
13241
13238
  (t.jo.get(e) || []).forEach((t => {
13242
13239
  t.resolve();
13243
13240
  })), t.jo.delete(e);
13244
13241
  }
13245
13242
 
13246
- /** Reject all outstanding callbacks waiting for pending writes to complete. */ function pc(t, e, n) {
13243
+ /** Reject all outstanding callbacks waiting for pending writes to complete. */ function pa(t, e, n) {
13247
13244
  const s = j(t);
13248
13245
  let i = s.Ko[s.currentUser.toKey()];
13249
13246
  // NOTE: Mutations restored from persistence won't have callbacks, so it's
@@ -13254,39 +13251,39 @@ async function mc(t, e, n) {
13254
13251
  }
13255
13252
  }
13256
13253
 
13257
- function Tc(t, e, n = null) {
13254
+ function Ta(t, e, n = null) {
13258
13255
  t.sharedClientState.removeLocalQueryTarget(e);
13259
13256
  for (const s of t.Mo.get(e)) t.Fo.delete(s), n && t.Oo.zo(s, n);
13260
13257
  if (t.Mo.delete(e), t.isPrimaryClient) {
13261
13258
  t.qo.us(e).forEach((e => {
13262
13259
  t.qo.containsKey(e) ||
13263
13260
  // We removed the last reference for this key
13264
- Ec(t, e);
13261
+ Ea(t, e);
13265
13262
  }));
13266
13263
  }
13267
13264
  }
13268
13265
 
13269
- function Ec(t, e) {
13266
+ function Ea(t, e) {
13270
13267
  t.Lo.delete(e.path.canonicalString());
13271
13268
  // It's possible that the target already got removed because the query failed. In that case,
13272
13269
  // the key won't exist in `limboTargetsByKey`. Only do the cleanup if we still have the target.
13273
13270
  const n = t.Bo.get(e);
13274
- null !== n && (_o(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), Rc(t));
13271
+ null !== n && (_o(t.remoteStore, n), t.Bo = t.Bo.remove(e), t.Uo.delete(n), Ra(t));
13275
13272
  }
13276
13273
 
13277
- function Ic(t, e, n) {
13278
- for (const s of n) if (s instanceof nc) t.qo.addReference(s.key, e), Ac(t, s); else if (s instanceof sc) {
13274
+ function Ia(t, e, n) {
13275
+ for (const s of n) if (s instanceof na) t.qo.addReference(s.key, e), Aa(t, s); else if (s instanceof sa) {
13279
13276
  F("SyncEngine", "Document no longer in limbo: " + s.key), t.qo.removeReference(s.key, e);
13280
13277
  t.qo.containsKey(s.key) ||
13281
13278
  // We removed the last reference for this key
13282
- Ec(t, s.key);
13279
+ Ea(t, s.key);
13283
13280
  } else U();
13284
13281
  }
13285
13282
 
13286
- function Ac(t, e) {
13283
+ function Aa(t, e) {
13287
13284
  const n = e.key, s = n.path.canonicalString();
13288
13285
  t.Bo.get(n) || t.Lo.has(s) || (F("SyncEngine", "New document in limbo: " + n), t.Lo.add(s),
13289
- Rc(t));
13286
+ Ra(t));
13290
13287
  }
13291
13288
 
13292
13289
  /**
@@ -13296,27 +13293,27 @@ function Ac(t, e) {
13296
13293
  * Without bounding the number of concurrent resolutions, the server can fail
13297
13294
  * with "resource exhausted" errors which can lead to pathological client
13298
13295
  * behavior as seen in https://github.com/firebase/firebase-js-sdk/issues/2683.
13299
- */ function Rc(t) {
13296
+ */ function Ra(t) {
13300
13297
  for (;t.Lo.size > 0 && t.Bo.size < t.maxConcurrentLimboResolutions; ) {
13301
13298
  const e = t.Lo.values().next().value;
13302
13299
  t.Lo.delete(e);
13303
13300
  const n = new Nt(_t.fromString(e)), s = t.Qo.next();
13304
- t.Uo.set(s, new oc(n)), t.Bo = t.Bo.insert(n, s), wo(t.remoteStore, new hi(ve(Te(n.path)), s, 2 /* LimboResolution */ , st.I));
13301
+ t.Uo.set(s, new oa(n)), t.Bo = t.Bo.insert(n, s), wo(t.remoteStore, new hi(ve(Te(n.path)), s, 2 /* LimboResolution */ , st.I));
13305
13302
  }
13306
13303
  }
13307
13304
 
13308
- async function bc(t, e, n) {
13305
+ async function Pa(t, e, n) {
13309
13306
  const s = j(t), i = [], r = [], o = [];
13310
- s.Fo.isEmpty() || (s.Fo.forEach(((t, c) => {
13311
- o.push(s.Go(c, e, n).then((t => {
13307
+ s.Fo.isEmpty() || (s.Fo.forEach(((t, a) => {
13308
+ o.push(s.Go(a, e, n).then((t => {
13312
13309
  if (t) {
13313
- s.isPrimaryClient && s.sharedClientState.updateQueryState(c.targetId, t.fromCache ? "not-current" : "current"),
13310
+ s.isPrimaryClient && s.sharedClientState.updateQueryState(a.targetId, t.fromCache ? "not-current" : "current"),
13314
13311
  i.push(t);
13315
- const e = fr.$n(c.targetId, t);
13312
+ const e = fr.$n(a.targetId, t);
13316
13313
  r.push(e);
13317
13314
  }
13318
13315
  })));
13319
- })), await Promise.all(o), s.Oo.br(i), await async function(t, e) {
13316
+ })), await Promise.all(o), s.Oo.Pr(i), await async function(t, e) {
13320
13317
  const n = j(t);
13321
13318
  try {
13322
13319
  await n.persistence.runTransaction("notifyLocalViewChanges", "readwrite", (t => Js.forEach(e, (e => Js.forEach(e.kn, (s => n.persistence.referenceDelegate.addReference(t, e.targetId, s))).next((() => Js.forEach(e.xn, (s => n.persistence.referenceDelegate.removeReference(t, e.targetId, s)))))))));
@@ -13339,7 +13336,7 @@ async function bc(t, e, n) {
13339
13336
  }(s.localStore, r));
13340
13337
  }
13341
13338
 
13342
- async function Pc(t, e) {
13339
+ async function ba(t, e) {
13343
13340
  const n = j(t);
13344
13341
  if (!n.currentUser.isEqual(e)) {
13345
13342
  F("SyncEngine", "User change. New user:", e.toKey());
@@ -13354,11 +13351,11 @@ async function Pc(t, e) {
13354
13351
  })), t.jo.clear();
13355
13352
  }(n, "'waitForPendingWrites' promise is rejected due to a user change."),
13356
13353
  // TODO(b/114226417): Consider calling this only in the primary tab.
13357
- n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await bc(n, t.Gn);
13354
+ n.sharedClientState.handleUserChange(e, t.removedBatchIds, t.addedBatchIds), await Pa(n, t.Gn);
13358
13355
  }
13359
13356
  }
13360
13357
 
13361
- function vc(t, e) {
13358
+ function va(t, e) {
13362
13359
  const n = j(t), s = n.Uo.get(e);
13363
13360
  if (s && s.$o) return Nn().add(s.key);
13364
13361
  {
@@ -13367,7 +13364,7 @@ function vc(t, e) {
13367
13364
  if (!s) return t;
13368
13365
  for (const e of s) {
13369
13366
  const s = n.Fo.get(e);
13370
- t = t.unionWith(s.view.bo);
13367
+ t = t.unionWith(s.view.Po);
13371
13368
  }
13372
13369
  return t;
13373
13370
  }
@@ -13376,10 +13373,10 @@ function vc(t, e) {
13376
13373
  /**
13377
13374
  * Reconcile the list of synced documents in an existing view with those
13378
13375
  * from persistence.
13379
- */ async function Vc(t, e) {
13376
+ */ async function Va(t, e) {
13380
13377
  const n = j(t), s = await Rr(n.localStore, e.query,
13381
13378
  /* usePreviousResults= */ !0), i = e.view.ko(s);
13382
- return n.isPrimaryClient && Ic(n, e.targetId, i.Co), i;
13379
+ return n.isPrimaryClient && Ia(n, e.targetId, i.Co), i;
13383
13380
  }
13384
13381
 
13385
13382
  /**
@@ -13387,14 +13384,14 @@ function vc(t, e) {
13387
13384
  * snapshots if needed.
13388
13385
  */
13389
13386
  // PORTING NOTE: Multi-Tab only.
13390
- async function Sc(t) {
13387
+ async function Sa(t) {
13391
13388
  const e = j(t);
13392
- return Pr(e.localStore).then((t => bc(e, t)));
13389
+ return br(e.localStore).then((t => Pa(e, t)));
13393
13390
  }
13394
13391
 
13395
13392
  /** Applies a mutation state to an existing batch. */
13396
13393
  // PORTING NOTE: Multi-Tab only.
13397
- async function Dc(t, e, n, s) {
13394
+ async function Da(t, e, n, s) {
13398
13395
  const i = j(t), r = await function(t, e) {
13399
13396
  const n = j(t), s = j(n.An);
13400
13397
  return n.persistence.runTransaction("Lookup mutation documents", "readonly", (t => s.Zt(t, e).next((e => e ? n.Wn.vn(t, e) : Js.resolve(null)))));
@@ -13408,11 +13405,11 @@ async function Dc(t, e, n, s) {
13408
13405
  await vo(i.remoteStore) : "acknowledged" === n || "rejected" === n ? (
13409
13406
  // NOTE: Both these methods are no-ops for batches that originated from
13410
13407
  // other clients.
13411
- pc(i, e, s || null), yc(i, e), function(t, e) {
13408
+ pa(i, e, s || null), ya(i, e), function(t, e) {
13412
13409
  j(j(t).An).ee(e);
13413
13410
  }
13414
13411
  // PORTING NOTE: Multi-Tab only.
13415
- (i.localStore, e)) : U(), await bc(i, r)) :
13412
+ (i.localStore, e)) : U(), await Pa(i, r)) :
13416
13413
  // A throttled tab may not have seen the mutation before it was completed
13417
13414
  // and removed from the mutation queue, in which case we won't have cached
13418
13415
  // the affected documents. In this case we can safely ignore the update
@@ -13425,26 +13422,26 @@ async function Dc(t, e, n, s) {
13425
13422
 
13426
13423
  /** Applies a query target change from a different tab. */
13427
13424
  // PORTING NOTE: Multi-Tab only.
13428
- async function Cc(t, e) {
13425
+ async function Ca(t, e) {
13429
13426
  const n = j(t);
13430
- if (Fc(n), Mc(n), !0 === e && !0 !== n.Wo) {
13427
+ if (Fa(n), Ma(n), !0 === e && !0 !== n.Wo) {
13431
13428
  // Secondary tabs only maintain Views for their local listeners and the
13432
13429
  // Views internal state may not be 100% populated (in particular
13433
13430
  // secondary tabs don't track syncedDocuments, the set of documents the
13434
13431
  // server considers to be in the target). So when a secondary becomes
13435
13432
  // primary, we need to need to make sure that all views for all targets
13436
13433
  // match the state on disk.
13437
- const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Nc(n, t.toArray());
13434
+ const t = n.sharedClientState.getAllActiveQueryTargets(), e = await Na(n, t.toArray());
13438
13435
  n.Wo = !0, await Oo(n.remoteStore, !0);
13439
13436
  for (const t of e) wo(n.remoteStore, t);
13440
13437
  } else if (!1 === e && !1 !== n.Wo) {
13441
13438
  const t = [];
13442
13439
  let e = Promise.resolve();
13443
13440
  n.Mo.forEach(((s, i) => {
13444
- n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (Tc(n, i),
13441
+ n.sharedClientState.isLocalQueryTarget(i) ? t.push(i) : e = e.then((() => (Ta(n, i),
13445
13442
  Ar(n.localStore, i,
13446
13443
  /*keepPersistedTargetData=*/ !0)))), _o(n.remoteStore, i);
13447
- })), await e, await Nc(n, t),
13444
+ })), await e, await Na(n, t),
13448
13445
  // PORTING NOTE: Multi-Tab only.
13449
13446
  function(t) {
13450
13447
  const e = j(t);
@@ -13467,7 +13464,7 @@ async function Cc(t, e) {
13467
13464
  }
13468
13465
  }
13469
13466
 
13470
- async function Nc(t, e, n) {
13467
+ async function Na(t, e, n) {
13471
13468
  const s = j(t), i = [], r = [];
13472
13469
  for (const t of e) {
13473
13470
  let e;
@@ -13479,19 +13476,19 @@ async function Nc(t, e, n) {
13479
13476
  // state (the list of syncedDocuments may have gotten out of sync).
13480
13477
  e = await Ir(s.localStore, ve(n[0]));
13481
13478
  for (const t of n) {
13482
- const e = s.Fo.get(t), n = await Vc(s, e);
13479
+ const e = s.Fo.get(t), n = await Va(s, e);
13483
13480
  n.snapshot && r.push(n.snapshot);
13484
13481
  }
13485
13482
  } else {
13486
13483
  // For queries that never executed on this client, we need to
13487
13484
  // allocate the target in LocalStore and initialize a new View.
13488
- const n = await br(s.localStore, t);
13489
- e = await Ir(s.localStore, n), await uc(s, kc(n), t,
13485
+ const n = await Pr(s.localStore, t);
13486
+ e = await Ir(s.localStore, n), await ua(s, ka(n), t,
13490
13487
  /*current=*/ !1);
13491
13488
  }
13492
13489
  i.push(e);
13493
13490
  }
13494
- return s.Oo.br(r), i;
13491
+ return s.Oo.Pr(r), i;
13495
13492
  }
13496
13493
 
13497
13494
  /**
@@ -13505,20 +13502,20 @@ async function Nc(t, e, n) {
13505
13502
  * difference will not cause issues.
13506
13503
  */
13507
13504
  // PORTING NOTE: Multi-Tab only.
13508
- function kc(t) {
13505
+ function ka(t) {
13509
13506
  return pe(t.path, t.collectionGroup, t.orderBy, t.filters, t.limit, "F" /* First */ , t.startAt, t.endAt);
13510
13507
  }
13511
13508
 
13512
13509
  /** Returns the IDs of the clients that are currently active. */
13513
13510
  // PORTING NOTE: Multi-Tab only.
13514
- function xc(t) {
13511
+ function xa(t) {
13515
13512
  const e = j(t);
13516
13513
  return j(j(e.localStore).persistence).Tn();
13517
13514
  }
13518
13515
 
13519
13516
  /** Applies a query target change from a different tab. */
13520
13517
  // PORTING NOTE: Multi-Tab only.
13521
- async function $c(t, e, n, s) {
13518
+ async function $a(t, e, n, s) {
13522
13519
  const i = j(t);
13523
13520
  if (i.Wo)
13524
13521
  // If we receive a target state notification via WebStorage, we are
@@ -13527,14 +13524,14 @@ async function $c(t, e, n, s) {
13527
13524
  case "current":
13528
13525
  case "not-current":
13529
13526
  {
13530
- const t = await Pr(i.localStore), s = $n.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
13531
- await bc(i, t, s);
13527
+ const t = await br(i.localStore), s = $n.createSynthesizedRemoteEventForCurrentChange(e, "current" === n);
13528
+ await Pa(i, t, s);
13532
13529
  break;
13533
13530
  }
13534
13531
 
13535
13532
  case "rejected":
13536
13533
  await Ar(i.localStore, e,
13537
- /* keepPersistedTargetData */ !0), Tc(i, e, s);
13534
+ /* keepPersistedTargetData */ !0), Ta(i, e, s);
13538
13535
  break;
13539
13536
 
13540
13537
  default:
@@ -13542,8 +13539,8 @@ async function $c(t, e, n, s) {
13542
13539
  }
13543
13540
  }
13544
13541
 
13545
- /** Adds or removes Watch targets for queries from different tabs. */ async function Oc(t, e, n) {
13546
- const s = Fc(t);
13542
+ /** Adds or removes Watch targets for queries from different tabs. */ async function Oa(t, e, n) {
13543
+ const s = Fa(t);
13547
13544
  if (s.Wo) {
13548
13545
  for (const t of e) {
13549
13546
  if (s.Mo.has(t)) {
@@ -13551,8 +13548,8 @@ async function $c(t, e, n, s) {
13551
13548
  F("SyncEngine", "Adding an already active target " + t);
13552
13549
  continue;
13553
13550
  }
13554
- const e = await br(s.localStore, t), n = await Ir(s.localStore, e);
13555
- await uc(s, kc(e), n.targetId,
13551
+ const e = await Pr(s.localStore, t), n = await Ir(s.localStore, e);
13552
+ await ua(s, ka(e), n.targetId,
13556
13553
  /*current=*/ !1), wo(s.remoteStore, n);
13557
13554
  }
13558
13555
  for (const t of n)
@@ -13562,21 +13559,21 @@ async function $c(t, e, n, s) {
13562
13559
  // Release queries that are still active.
13563
13560
  await Ar(s.localStore, t,
13564
13561
  /* keepPersistedTargetData */ !1).then((() => {
13565
- _o(s.remoteStore, t), Tc(s, t);
13562
+ _o(s.remoteStore, t), Ta(s, t);
13566
13563
  })).catch(Ki);
13567
13564
  }
13568
13565
  }
13569
13566
 
13570
- function Fc(t) {
13567
+ function Fa(t) {
13571
13568
  const e = j(t);
13572
- return e.remoteStore.remoteSyncer.applyRemoteEvent = fc.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = vc.bind(null, e),
13573
- e.remoteStore.remoteSyncer.rejectListen = wc.bind(null, e), e.Oo.br = zo.bind(null, e.eventManager),
13569
+ return e.remoteStore.remoteSyncer.applyRemoteEvent = fa.bind(null, e), e.remoteStore.remoteSyncer.getRemoteKeysForTarget = va.bind(null, e),
13570
+ e.remoteStore.remoteSyncer.rejectListen = wa.bind(null, e), e.Oo.Pr = zo.bind(null, e.eventManager),
13574
13571
  e.Oo.zo = Ho.bind(null, e.eventManager), e;
13575
13572
  }
13576
13573
 
13577
- function Mc(t) {
13574
+ function Ma(t) {
13578
13575
  const e = j(t);
13579
- return e.remoteStore.remoteSyncer.applySuccessfulWrite = _c.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = mc.bind(null, e),
13576
+ return e.remoteStore.remoteSyncer.applySuccessfulWrite = _a.bind(null, e), e.remoteStore.remoteSyncer.rejectFailedWrite = ma.bind(null, e),
13580
13577
  e;
13581
13578
  }
13582
13579
 
@@ -13587,7 +13584,7 @@ function Mc(t) {
13587
13584
  * @param syncEngine - SyncEngine to use.
13588
13585
  * @param bundleReader - Bundle to load into the SDK.
13589
13586
  * @param task - LoadBundleTask used to update the loading progress to public API.
13590
- */ function Lc(t, e, n) {
13587
+ */ function La(t, e, n) {
13591
13588
  const s = j(t);
13592
13589
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
13593
13590
  (async function(t, e, n) {
@@ -13608,8 +13605,8 @@ function Mc(t) {
13608
13605
  totalBytes: t.totalBytes
13609
13606
  };
13610
13607
  }(s));
13611
- n._updateProgress(ec(s));
13612
- const i = new tc(s, t.localStore, e.k);
13608
+ n._updateProgress(ea(s));
13609
+ const i = new ta(s, t.localStore, e.k);
13613
13610
  let r = await e.Ho();
13614
13611
  for (;r; ) {
13615
13612
  const t = await i.yo(r);
@@ -13619,7 +13616,7 @@ function Mc(t) {
13619
13616
  // TODO(b/160876443): This currently raises snapshots with
13620
13617
  // `fromCache=false` if users already listen to some queries and bundles
13621
13618
  // has newer version.
13622
- await bc(t, o.In,
13619
+ await Pa(t, o.In,
13623
13620
  /* remoteEvent */ void 0),
13624
13621
  // Save metadata, so loading the same bundle will skip.
13625
13622
  await function(t, e) {
@@ -13658,7 +13655,7 @@ function Mc(t) {
13658
13655
  }));
13659
13656
  }
13660
13657
 
13661
- class Bc {
13658
+ class Ba {
13662
13659
  constructor() {
13663
13660
  this.synchronizeTabs = !1;
13664
13661
  }
@@ -13686,14 +13683,14 @@ class Bc {
13686
13683
 
13687
13684
  /**
13688
13685
  * Provides all components needed for Firestore with IndexedDB persistence.
13689
- */ class Uc extends Bc {
13686
+ */ class Ua extends Ba {
13690
13687
  constructor(t, e, n) {
13691
- super(), this.tc = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
13688
+ super(), this.ta = t, this.cacheSizeBytes = e, this.forceOwnership = n, this.synchronizeTabs = !1;
13692
13689
  }
13693
13690
  async initialize(t) {
13694
- await super.initialize(t), await vr(this.localStore), await this.tc.initialize(this, t),
13691
+ await super.initialize(t), await vr(this.localStore), await this.ta.initialize(this, t),
13695
13692
  // Enqueue writes from a previous session
13696
- await Mc(this.tc.syncEngine), await vo(this.tc.remoteStore),
13693
+ await Ma(this.ta.syncEngine), await vo(this.ta.remoteStore),
13697
13694
  // NOTE: This will immediately call the listener, so we make sure to
13698
13695
  // set it after localStore / remoteStore are started.
13699
13696
  await this.persistence.sn((() => (this.gcScheduler && !this.gcScheduler.started && this.gcScheduler.start(this.localStore),
@@ -13722,29 +13719,29 @@ class Bc {
13722
13719
  * In the legacy client, this provider is used to provide both multi-tab and
13723
13720
  * non-multi-tab persistence since we cannot tell at build time whether
13724
13721
  * `synchronizeTabs` will be enabled.
13725
- */ class qc extends Uc {
13722
+ */ class qa extends Ua {
13726
13723
  constructor(t, e) {
13727
- super(t, e, /* forceOwnership= */ !1), this.tc = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
13724
+ super(t, e, /* forceOwnership= */ !1), this.ta = t, this.cacheSizeBytes = e, this.synchronizeTabs = !0;
13728
13725
  }
13729
13726
  async initialize(t) {
13730
13727
  await super.initialize(t);
13731
- const e = this.tc.syncEngine;
13728
+ const e = this.ta.syncEngine;
13732
13729
  this.sharedClientState instanceof zr && (this.sharedClientState.syncEngine = {
13733
- mi: Dc.bind(null, e),
13734
- gi: $c.bind(null, e),
13735
- yi: Oc.bind(null, e),
13736
- Tn: xc.bind(null, e),
13737
- _i: Sc.bind(null, e)
13730
+ mi: Da.bind(null, e),
13731
+ gi: $a.bind(null, e),
13732
+ yi: Oa.bind(null, e),
13733
+ Tn: xa.bind(null, e),
13734
+ _i: Sa.bind(null, e)
13738
13735
  }, await this.sharedClientState.start()),
13739
13736
  // NOTE: This will immediately call the listener, so we make sure to
13740
13737
  // set it after localStore / remoteStore are started.
13741
13738
  await this.persistence.sn((async t => {
13742
- await Cc(this.tc.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
13739
+ await Ca(this.ta.syncEngine, t), this.gcScheduler && (t && !this.gcScheduler.started ? this.gcScheduler.start(this.localStore) : t || this.gcScheduler.stop());
13743
13740
  }));
13744
13741
  }
13745
13742
  Jo(t) {
13746
13743
  const e = eo();
13747
- if (!zr.Pt(e)) throw new W(Q.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
13744
+ if (!zr.bt(e)) throw new W(Q.UNIMPLEMENTED, "IndexedDB persistence is only available on platforms that support LocalStorage.");
13748
13745
  const n = ur(t.databaseInfo.databaseId, t.databaseInfo.persistenceKey);
13749
13746
  return new zr(e, t.asyncQueue, n, t.clientId, t.initialUser);
13750
13747
  }
@@ -13753,13 +13750,13 @@ class Bc {
13753
13750
  /**
13754
13751
  * Initializes and wires the components that are needed to interface with the
13755
13752
  * network.
13756
- */ class Kc {
13753
+ */ class Ka {
13757
13754
  async initialize(t, e) {
13758
13755
  this.localStore || (this.localStore = t.localStore, this.sharedClientState = t.sharedClientState,
13759
13756
  this.datastore = this.createDatastore(e), this.remoteStore = this.createRemoteStore(e),
13760
13757
  this.eventManager = this.createEventManager(e), this.syncEngine = this.createSyncEngine(e,
13761
- /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => dc(this.syncEngine, t, 1 /* SharedClientState */),
13762
- this.remoteStore.remoteSyncer.handleCredentialChange = Pc.bind(null, this.syncEngine),
13758
+ /* startAsPrimary=*/ !t.synchronizeTabs), this.sharedClientState.onlineStateHandler = t => da(this.syncEngine, t, 1 /* SharedClientState */),
13759
+ this.remoteStore.remoteSyncer.handleCredentialChange = ba.bind(null, this.syncEngine),
13763
13760
  await Oo(this.remoteStore, this.syncEngine.isPrimaryClient));
13764
13761
  }
13765
13762
  createEventManager(t) {
@@ -13769,20 +13766,20 @@ class Bc {
13769
13766
  const e = so(t.databaseInfo.databaseId), n = (s = t.databaseInfo, new to(s));
13770
13767
  var s;
13771
13768
  /** Return the Platform-specific connectivity monitor. */ return function(t, e, n, s) {
13772
- return new ao(t, e, n, s);
13769
+ return new co(t, e, n, s);
13773
13770
  }(t.authCredentials, t.appCheckCredentials, n, e);
13774
13771
  }
13775
13772
  createRemoteStore(t) {
13776
- return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => dc(this.syncEngine, t, 0 /* RemoteStore */),
13777
- r = Yr.Pt() ? new Yr : new Jr, new ho(e, n, s, i, r);
13773
+ return e = this.localStore, n = this.datastore, s = t.asyncQueue, i = t => da(this.syncEngine, t, 0 /* RemoteStore */),
13774
+ r = Yr.bt() ? new Yr : new Jr, new ho(e, n, s, i, r);
13778
13775
  var e, n, s, i, r;
13779
13776
  /** Re-enables the network. Idempotent. */ }
13780
13777
  createSyncEngine(t, e) {
13781
13778
  return function(t, e, n,
13782
13779
  // PORTING NOTE: Manages state synchronization in multi-tab environments.
13783
13780
  s, i, r, o) {
13784
- const c = new cc(t, e, n, s, i, r);
13785
- return o && (c.Wo = !0), c;
13781
+ const a = new aa(t, e, n, s, i, r);
13782
+ return o && (a.Wo = !0), a;
13786
13783
  }(this.localStore, this.remoteStore, this.eventManager, this.sharedClientState, t.initialUser, t.maxConcurrentLimboResolutions, e);
13787
13784
  }
13788
13785
  terminate() {
@@ -13824,7 +13821,7 @@ class Bc {
13824
13821
  * @param bytesPerRead - How many bytes each `read()` from the returned reader
13825
13822
  * will read.
13826
13823
  */
13827
- function jc(t, e = 10240) {
13824
+ function ja(t, e = 10240) {
13828
13825
  let n = 0;
13829
13826
  // The TypeScript definition for ReadableStreamReader changed. We use
13830
13827
  // `any` here to allow this code to compile with different versions.
@@ -13890,7 +13887,7 @@ function jc(t, e = 10240) {
13890
13887
  * asynchronously. To allow immediate silencing, a mute call is added which
13891
13888
  * causes events scheduled to no longer be raised.
13892
13889
  */
13893
- class Qc {
13890
+ class Qa {
13894
13891
  constructor(t) {
13895
13892
  this.observer = t,
13896
13893
  /**
@@ -13900,15 +13897,15 @@ class Qc {
13900
13897
  this.muted = !1;
13901
13898
  }
13902
13899
  next(t) {
13903
- this.observer.next && this.ec(this.observer.next, t);
13900
+ this.observer.next && this.ea(this.observer.next, t);
13904
13901
  }
13905
13902
  error(t) {
13906
- this.observer.error ? this.ec(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
13903
+ this.observer.error ? this.ea(this.observer.error, t) : console.error("Uncaught Error in snapshot listener:", t);
13907
13904
  }
13908
- nc() {
13905
+ na() {
13909
13906
  this.muted = !0;
13910
13907
  }
13911
- ec(t, e) {
13908
+ ea(t, e) {
13912
13909
  this.muted || setTimeout((() => {
13913
13910
  this.muted || t(e);
13914
13911
  }), 0);
@@ -13936,32 +13933,32 @@ class Qc {
13936
13933
  *
13937
13934
  * Takes a bundle stream or buffer, and presents abstractions to read bundled
13938
13935
  * elements out of the underlying content.
13939
- */ class Wc {
13936
+ */ class Wa {
13940
13937
  constructor(
13941
13938
  /** The reader to read from underlying binary bundle data source. */
13942
13939
  t, e) {
13943
- this.sc = t, this.k = e,
13940
+ this.sa = t, this.k = e,
13944
13941
  /** Cached bundle metadata. */
13945
13942
  this.metadata = new G,
13946
13943
  /**
13947
13944
  * Internal buffer to hold bundle content, accumulating incomplete element
13948
13945
  * content.
13949
13946
  */
13950
- this.buffer = new Uint8Array, this.ic = new TextDecoder("utf-8"),
13947
+ this.buffer = new Uint8Array, this.ia = new TextDecoder("utf-8"),
13951
13948
  // Read the metadata (which is the first element).
13952
- this.rc().then((t => {
13949
+ this.ra().then((t => {
13953
13950
  t && t._o() ? this.metadata.resolve(t.payload.metadata) : this.metadata.reject(new Error(`The first element of the bundle is not a metadata, it is\n ${JSON.stringify(null == t ? void 0 : t.payload)}`));
13954
13951
  }), (t => this.metadata.reject(t)));
13955
13952
  }
13956
13953
  close() {
13957
- return this.sc.cancel();
13954
+ return this.sa.cancel();
13958
13955
  }
13959
13956
  async getMetadata() {
13960
13957
  return this.metadata.promise;
13961
13958
  }
13962
13959
  async Ho() {
13963
13960
  // Makes sure metadata is read before proceeding.
13964
- return await this.getMetadata(), this.rc();
13961
+ return await this.getMetadata(), this.ra();
13965
13962
  }
13966
13963
  /**
13967
13964
  * Reads from the head of internal buffer, and pulling more data from
@@ -13972,15 +13969,15 @@ class Qc {
13972
13969
  *
13973
13970
  * Returns either the bundled element, or null if we have reached the end of
13974
13971
  * the stream.
13975
- */ async rc() {
13976
- const t = await this.oc();
13972
+ */ async ra() {
13973
+ const t = await this.oa();
13977
13974
  if (null === t) return null;
13978
- const e = this.ic.decode(t), n = Number(e);
13979
- isNaN(n) && this.cc(`length string (${e}) is not valid number`);
13980
- const s = await this.ac(n);
13975
+ const e = this.ia.decode(t), n = Number(e);
13976
+ isNaN(n) && this.aa(`length string (${e}) is not valid number`);
13977
+ const s = await this.ca(n);
13981
13978
  return new Xo(JSON.parse(s), t.length + n);
13982
13979
  }
13983
- /** First index of '{' from the underlying buffer. */ uc() {
13980
+ /** First index of '{' from the underlying buffer. */ ua() {
13984
13981
  return this.buffer.findIndex((t => t === "{".charCodeAt(0)));
13985
13982
  }
13986
13983
  /**
@@ -13988,17 +13985,17 @@ class Qc {
13988
13985
  * return the content.
13989
13986
  *
13990
13987
  * If reached end of the stream, returns a null.
13991
- */ async oc() {
13992
- for (;this.uc() < 0; ) {
13993
- if (await this.hc()) break;
13988
+ */ async oa() {
13989
+ for (;this.ua() < 0; ) {
13990
+ if (await this.ha()) break;
13994
13991
  }
13995
13992
  // Broke out of the loop because underlying stream is closed, and there
13996
13993
  // happens to be no more data to process.
13997
13994
  if (0 === this.buffer.length) return null;
13998
- const t = this.uc();
13995
+ const t = this.ua();
13999
13996
  // Broke out of the loop because underlying stream is closed, but still
14000
13997
  // cannot find an open bracket.
14001
- t < 0 && this.cc("Reached the end of bundle when a length string is expected.");
13998
+ t < 0 && this.aa("Reached the end of bundle when a length string is expected.");
14002
13999
  const e = this.buffer.slice(0, t);
14003
14000
  // Update the internal buffer to drop the read length.
14004
14001
  return this.buffer = this.buffer.slice(t), e;
@@ -14008,23 +14005,23 @@ class Qc {
14008
14005
  * number of bytes, pulling more data from the underlying stream if needed.
14009
14006
  *
14010
14007
  * Returns a string decoded from the read bytes.
14011
- */ async ac(t) {
14008
+ */ async ca(t) {
14012
14009
  for (;this.buffer.length < t; ) {
14013
- await this.hc() && this.cc("Reached the end of bundle when more is expected.");
14010
+ await this.ha() && this.aa("Reached the end of bundle when more is expected.");
14014
14011
  }
14015
- const e = this.ic.decode(this.buffer.slice(0, t));
14012
+ const e = this.ia.decode(this.buffer.slice(0, t));
14016
14013
  // Update the internal buffer to drop the read json string.
14017
14014
  return this.buffer = this.buffer.slice(t), e;
14018
14015
  }
14019
- cc(t) {
14016
+ aa(t) {
14020
14017
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
14021
- throw this.sc.cancel(), new Error(`Invalid bundle format: ${t}`);
14018
+ throw this.sa.cancel(), new Error(`Invalid bundle format: ${t}`);
14022
14019
  }
14023
14020
  /**
14024
14021
  * Pulls more data from underlying stream to internal buffer.
14025
14022
  * Returns a boolean indicating whether the stream is finished.
14026
- */ async hc() {
14027
- const t = await this.sc.read();
14023
+ */ async ha() {
14024
+ const t = await this.sa.read();
14028
14025
  if (!t.done) {
14029
14026
  const e = new Uint8Array(this.buffer.length + t.value.length);
14030
14027
  e.set(this.buffer), e.set(t.value, this.buffer.length), this.buffer = e;
@@ -14053,7 +14050,7 @@ class Qc {
14053
14050
  * Internal transaction object responsible for accumulating the mutations to
14054
14051
  * perform and the base versions for any documents read.
14055
14052
  */
14056
- class Gc {
14053
+ class Ga {
14057
14054
  constructor(t) {
14058
14055
  this.datastore = t,
14059
14056
  // The version of each document that was read during this transaction.
@@ -14078,14 +14075,14 @@ class Gc {
14078
14075
  documents: e.map((t => Zn(n.k, t)))
14079
14076
  }, r = await n.ji("BatchGetDocuments", s, i), o = new Map;
14080
14077
  r.forEach((t => {
14081
- const e = cs(n.k, t);
14078
+ const e = as(n.k, t);
14082
14079
  o.set(e.key.toString(), e);
14083
14080
  }));
14084
- const c = [];
14081
+ const a = [];
14085
14082
  return e.forEach((t => {
14086
14083
  const e = o.get(t.toString());
14087
- q(!!e), c.push(e);
14088
- })), c;
14084
+ q(!!e), a.push(e);
14085
+ })), a;
14089
14086
  }(this.datastore, t);
14090
14087
  return e.forEach((t => this.recordVersion(t))), e;
14091
14088
  }
@@ -14194,29 +14191,29 @@ class Gc {
14194
14191
  * TransactionRunner encapsulates the logic needed to run and retry transactions
14195
14192
  * with backoff.
14196
14193
  */
14197
- class zc {
14194
+ class za {
14198
14195
  constructor(t, e, n, s) {
14199
14196
  this.asyncQueue = t, this.datastore = e, this.updateFunction = n, this.deferred = s,
14200
- this.lc = 5, this.ur = new io(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
14197
+ this.la = 5, this.ur = new io(this.asyncQueue, "transaction_retry" /* TransactionRetry */);
14201
14198
  }
14202
14199
  /** Runs the transaction and sets the result on deferred. */ run() {
14203
- this.lc -= 1, this.fc();
14200
+ this.la -= 1, this.fa();
14204
14201
  }
14205
- fc() {
14202
+ fa() {
14206
14203
  this.ur.Zi((async () => {
14207
- const t = new Gc(this.datastore), e = this.dc(t);
14204
+ const t = new Ga(this.datastore), e = this.da(t);
14208
14205
  e && e.then((e => {
14209
14206
  this.asyncQueue.enqueueAndForget((() => t.commit().then((() => {
14210
14207
  this.deferred.resolve(e);
14211
14208
  })).catch((t => {
14212
- this.wc(t);
14209
+ this.wa(t);
14213
14210
  }))));
14214
14211
  })).catch((t => {
14215
- this.wc(t);
14212
+ this.wa(t);
14216
14213
  }));
14217
14214
  }));
14218
14215
  }
14219
- dc(t) {
14216
+ da(t) {
14220
14217
  try {
14221
14218
  const e = this.updateFunction(t);
14222
14219
  return !St(e) && e.catch && e.then ? e : (this.deferred.reject(Error("Transaction callback must return a Promise")),
@@ -14226,11 +14223,11 @@ class zc {
14226
14223
  return this.deferred.reject(t), null;
14227
14224
  }
14228
14225
  }
14229
- wc(t) {
14230
- this.lc > 0 && this._c(t) ? (this.lc -= 1, this.asyncQueue.enqueueAndForget((() => (this.fc(),
14226
+ wa(t) {
14227
+ this.la > 0 && this._a(t) ? (this.la -= 1, this.asyncQueue.enqueueAndForget((() => (this.fa(),
14231
14228
  Promise.resolve())))) : this.deferred.reject(t);
14232
14229
  }
14233
- _c(t) {
14230
+ _a(t) {
14234
14231
  if ("FirebaseError" === t.name) {
14235
14232
  // In transactions, the backend will fail outdated reads with FAILED_PRECONDITION and
14236
14233
  // non-matching document versions with ABORTED. These errors should be retried.
@@ -14262,7 +14259,7 @@ class zc {
14262
14259
  * pieces of the client SDK architecture. It is responsible for creating the
14263
14260
  * async queue that is shared by all of the other components in the system.
14264
14261
  */
14265
- class Hc {
14262
+ class Ha {
14266
14263
  constructor(t, e,
14267
14264
  /**
14268
14265
  * Asynchronous queue responsible for all of our internal processing. When
@@ -14320,7 +14317,7 @@ class Hc {
14320
14317
  }
14321
14318
  }
14322
14319
 
14323
- async function Jc(t, e) {
14320
+ async function Ja(t, e) {
14324
14321
  t.asyncQueue.verifyOperationInProgress(), F("FirestoreClient", "Initializing OfflineComponentProvider");
14325
14322
  const n = await t.getConfiguration();
14326
14323
  await e.initialize(n);
@@ -14333,9 +14330,9 @@ async function Jc(t, e) {
14333
14330
  e.persistence.setDatabaseDeletedListener((() => t.terminate())), t.offlineComponents = e;
14334
14331
  }
14335
14332
 
14336
- async function Yc(t, e) {
14333
+ async function Ya(t, e) {
14337
14334
  t.asyncQueue.verifyOperationInProgress();
14338
- const n = await Xc(t);
14335
+ const n = await Xa(t);
14339
14336
  F("FirestoreClient", "Initializing OnlineComponentProvider");
14340
14337
  const s = await t.getConfiguration();
14341
14338
  await e.initialize(n, s),
@@ -14355,41 +14352,41 @@ async function Yc(t, e) {
14355
14352
  }(e.remoteStore, t))), t.onlineComponents = e;
14356
14353
  }
14357
14354
 
14358
- async function Xc(t) {
14355
+ async function Xa(t) {
14359
14356
  return t.offlineComponents || (F("FirestoreClient", "Using default OfflineComponentProvider"),
14360
- await Jc(t, new Bc)), t.offlineComponents;
14357
+ await Ja(t, new Ba)), t.offlineComponents;
14361
14358
  }
14362
14359
 
14363
- async function Zc(t) {
14360
+ async function Za(t) {
14364
14361
  return t.onlineComponents || (F("FirestoreClient", "Using default OnlineComponentProvider"),
14365
- await Yc(t, new Kc)), t.onlineComponents;
14362
+ await Ya(t, new Ka)), t.onlineComponents;
14366
14363
  }
14367
14364
 
14368
- function ta(t) {
14369
- return Xc(t).then((t => t.persistence));
14365
+ function tc(t) {
14366
+ return Xa(t).then((t => t.persistence));
14370
14367
  }
14371
14368
 
14372
- function ea(t) {
14373
- return Xc(t).then((t => t.localStore));
14369
+ function ec(t) {
14370
+ return Xa(t).then((t => t.localStore));
14374
14371
  }
14375
14372
 
14376
- function na(t) {
14377
- return Zc(t).then((t => t.remoteStore));
14373
+ function nc(t) {
14374
+ return Za(t).then((t => t.remoteStore));
14378
14375
  }
14379
14376
 
14380
- function sa(t) {
14381
- return Zc(t).then((t => t.syncEngine));
14377
+ function sc(t) {
14378
+ return Za(t).then((t => t.syncEngine));
14382
14379
  }
14383
14380
 
14384
- async function ia(t) {
14385
- const e = await Zc(t), n = e.eventManager;
14386
- return n.onListen = ac.bind(null, e.syncEngine), n.onUnlisten = hc.bind(null, e.syncEngine),
14381
+ async function ic(t) {
14382
+ const e = await Za(t), n = e.eventManager;
14383
+ return n.onListen = ca.bind(null, e.syncEngine), n.onUnlisten = ha.bind(null, e.syncEngine),
14387
14384
  n;
14388
14385
  }
14389
14386
 
14390
- /** Enables the network connection and re-enqueues all pending operations. */ function ra(t) {
14387
+ /** Enables the network connection and re-enqueues all pending operations. */ function rc(t) {
14391
14388
  return t.asyncQueue.enqueue((async () => {
14392
- const e = await ta(t), n = await na(t);
14389
+ const e = await tc(t), n = await nc(t);
14393
14390
  return e.setNetworkEnabled(!0), function(t) {
14394
14391
  const e = j(t);
14395
14392
  return e.Gr.delete(0 /* UserDisabled */), lo(e);
@@ -14397,9 +14394,9 @@ async function ia(t) {
14397
14394
  }));
14398
14395
  }
14399
14396
 
14400
- /** Disables the network connection. Pending operations will not complete. */ function oa(t) {
14397
+ /** Disables the network connection. Pending operations will not complete. */ function oc(t) {
14401
14398
  return t.asyncQueue.enqueue((async () => {
14402
- const e = await ta(t), n = await na(t);
14399
+ const e = await tc(t), n = await nc(t);
14403
14400
  return e.setNetworkEnabled(!1), async function(t) {
14404
14401
  const e = j(t);
14405
14402
  e.Gr.add(0 /* UserDisabled */), await fo(e),
@@ -14413,7 +14410,7 @@ async function ia(t) {
14413
14410
  * Returns a Promise that resolves when all writes that were pending at the time
14414
14411
  * this method was called received server acknowledgement. An acknowledgement
14415
14412
  * can be either acceptance or rejection.
14416
- */ function ca(t, e) {
14413
+ */ function ac(t, e) {
14417
14414
  const n = new G;
14418
14415
  return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
14419
14416
  try {
@@ -14430,19 +14427,19 @@ async function ia(t) {
14430
14427
  /**
14431
14428
  * Retrieves a latency-compensated document from the backend via a
14432
14429
  * SnapshotListener.
14433
- */ (await ea(t), e, n))), n.promise;
14430
+ */ (await ec(t), e, n))), n.promise;
14434
14431
  }
14435
14432
 
14436
- function aa(t, e, n = {}) {
14433
+ function cc(t, e, n = {}) {
14437
14434
  const s = new G;
14438
14435
  return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
14439
- const r = new Qc({
14436
+ const r = new Qa({
14440
14437
  next: r => {
14441
14438
  // Remove query first before passing event to user to avoid
14442
14439
  // user actions affecting the now stale query.
14443
14440
  e.enqueueAndForget((() => Go(t, o)));
14444
- const c = r.docs.has(n);
14445
- !c && r.fromCache ?
14441
+ const a = r.docs.has(n);
14442
+ !a && r.fromCache ?
14446
14443
  // TODO(dimond): If we're online and the document doesn't
14447
14444
  // exist then we resolve with a doc.exists set to false. If
14448
14445
  // we're offline however, we reject the Promise in this
@@ -14450,7 +14447,7 @@ function aa(t, e, n = {}) {
14450
14447
  // the server so we can deliver that even when you're
14451
14448
  // offline 2) Actually reject the Promise in the online case
14452
14449
  // if the document doesn't exist.
14453
- i.reject(new W(Q.UNAVAILABLE, "Failed to get document because the client is offline.")) : c && r.fromCache && s && "server" === s.source ? i.reject(new W(Q.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
14450
+ i.reject(new W(Q.UNAVAILABLE, "Failed to get document because the client is offline.")) : a && r.fromCache && s && "server" === s.source ? i.reject(new W(Q.UNAVAILABLE, 'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')) : i.resolve(r);
14454
14451
  },
14455
14452
  error: t => i.reject(t)
14456
14453
  }), o = new Yo(Te(n.path), r, {
@@ -14458,15 +14455,15 @@ function aa(t, e, n = {}) {
14458
14455
  wo: !0
14459
14456
  });
14460
14457
  return Wo(t, o);
14461
- }(await ia(t), t.asyncQueue, e, n, s))), s.promise;
14458
+ }(await ic(t), t.asyncQueue, e, n, s))), s.promise;
14462
14459
  }
14463
14460
 
14464
- function ua(t, e) {
14461
+ function uc(t, e) {
14465
14462
  const n = new G;
14466
14463
  return t.asyncQueue.enqueueAndForget((async () => async function(t, e, n) {
14467
14464
  try {
14468
14465
  const s = await Rr(t, e,
14469
- /* usePreviousResults= */ !0), i = new ic(e, s.zn), r = i.Po(s.documents), o = i.applyChanges(r,
14466
+ /* usePreviousResults= */ !0), i = new ia(e, s.zn), r = i.bo(s.documents), o = i.applyChanges(r,
14470
14467
  /* updateLimboDocuments= */ !1);
14471
14468
  n.resolve(o.snapshot);
14472
14469
  } catch (t) {
@@ -14477,13 +14474,13 @@ function ua(t, e) {
14477
14474
  /**
14478
14475
  * Retrieves a latency-compensated query snapshot from the backend via a
14479
14476
  * SnapshotListener.
14480
- */ (await ea(t), e, n))), n.promise;
14477
+ */ (await ec(t), e, n))), n.promise;
14481
14478
  }
14482
14479
 
14483
- function ha(t, e, n = {}) {
14480
+ function hc(t, e, n = {}) {
14484
14481
  const s = new G;
14485
14482
  return t.asyncQueue.enqueueAndForget((async () => function(t, e, n, s, i) {
14486
- const r = new Qc({
14483
+ const r = new Qa({
14487
14484
  next: n => {
14488
14485
  // Remove query first before passing event to user to avoid
14489
14486
  // user actions affecting the now stale query.
@@ -14495,20 +14492,20 @@ function ha(t, e, n = {}) {
14495
14492
  wo: !0
14496
14493
  });
14497
14494
  return Wo(t, o);
14498
- }(await ia(t), t.asyncQueue, e, n, s))), s.promise;
14495
+ }(await ic(t), t.asyncQueue, e, n, s))), s.promise;
14499
14496
  }
14500
14497
 
14501
- function la(t, e) {
14502
- const n = new Qc(e);
14498
+ function lc(t, e) {
14499
+ const n = new Qa(e);
14503
14500
  return t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14504
14501
  j(t).io.add(e),
14505
14502
  // Immediately fire an initial event, indicating all existing listeners
14506
14503
  // are in-sync.
14507
14504
  e.next();
14508
- }(await ia(t), n))), () => {
14509
- n.nc(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14505
+ }(await ic(t), n))), () => {
14506
+ n.na(), t.asyncQueue.enqueueAndForget((async () => function(t, e) {
14510
14507
  j(t).io.delete(e);
14511
- }(await ia(t), n)));
14508
+ }(await ic(t), n)));
14512
14509
  };
14513
14510
  }
14514
14511
 
@@ -14526,25 +14523,25 @@ function la(t, e) {
14526
14523
  * accessed with the transaction will not reflect local changes that have not
14527
14524
  * been committed. For this reason, it is required that all reads are
14528
14525
  * performed before any writes. Transactions must be performed while online.
14529
- */ function fa(t, e) {
14526
+ */ function fc(t, e) {
14530
14527
  const n = new G;
14531
14528
  return t.asyncQueue.enqueueAndForget((async () => {
14532
14529
  const s = await function(t) {
14533
- return Zc(t).then((t => t.datastore));
14530
+ return Za(t).then((t => t.datastore));
14534
14531
  }(t);
14535
- new zc(t.asyncQueue, s, e, n).run();
14532
+ new za(t.asyncQueue, s, e, n).run();
14536
14533
  })), n.promise;
14537
14534
  }
14538
14535
 
14539
- function da(t, e, n, s) {
14536
+ function dc(t, e, n, s) {
14540
14537
  const i = function(t, e) {
14541
14538
  let n;
14542
14539
  n = "string" == typeof t ? (new TextEncoder).encode(t) : t;
14543
14540
  return function(t, e) {
14544
- return new Wc(t, e);
14541
+ return new Wa(t, e);
14545
14542
  }(function(t, e) {
14546
- if (t instanceof Uint8Array) return jc(t, e);
14547
- if (t instanceof ArrayBuffer) return jc(new Uint8Array(t), e);
14543
+ if (t instanceof Uint8Array) return ja(t, e);
14544
+ if (t instanceof ArrayBuffer) return ja(new Uint8Array(t), e);
14548
14545
  if (t instanceof ReadableStream) return t.getReader();
14549
14546
  throw new Error("Source of `toByteStreamReader` has to be a ArrayBuffer or ReadableStream");
14550
14547
  }(n), e);
@@ -14566,18 +14563,18 @@ function da(t, e, n, s) {
14566
14563
  * limitations under the License.
14567
14564
  */ (n, so(e));
14568
14565
  t.asyncQueue.enqueueAndForget((async () => {
14569
- Lc(await sa(t), i, s);
14566
+ La(await sc(t), i, s);
14570
14567
  }));
14571
14568
  }
14572
14569
 
14573
- function wa(t, e) {
14570
+ function wc(t, e) {
14574
14571
  return t.asyncQueue.enqueue((async () => function(t, e) {
14575
14572
  const n = j(t);
14576
14573
  return n.persistence.runTransaction("Get named query", "readonly", (t => n.Ye.getNamedQuery(t, e)));
14577
- }(await ea(t), e)));
14574
+ }(await ec(t), e)));
14578
14575
  }
14579
14576
 
14580
- class _a {
14577
+ class _c {
14581
14578
  /**
14582
14579
  * Constructs a DatabaseInfo using the provided host, databaseId and
14583
14580
  * persistenceKey.
@@ -14595,9 +14592,9 @@ class _a {
14595
14592
  * @param useFetchStreams Whether to use the Fetch API instead of
14596
14593
  * XMLHTTPRequest
14597
14594
  */
14598
- constructor(t, e, n, s, i, r, o, c) {
14595
+ constructor(t, e, n, s, i, r, o, a) {
14599
14596
  this.databaseId = t, this.appId = e, this.persistenceKey = n, this.host = s, this.ssl = i,
14600
- this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = c;
14597
+ this.forceLongPolling = r, this.autoDetectLongPolling = o, this.useFetchStreams = a;
14601
14598
  }
14602
14599
  }
14603
14600
 
@@ -14606,7 +14603,7 @@ class _a {
14606
14603
  * Represents the database ID a Firestore client is associated with.
14607
14604
  * @internal
14608
14605
  */
14609
- class ma {
14606
+ class mc {
14610
14607
  constructor(t, e) {
14611
14608
  this.projectId = t, this.database = e || "(default)";
14612
14609
  }
@@ -14614,7 +14611,7 @@ class ma {
14614
14611
  return "(default)" === this.database;
14615
14612
  }
14616
14613
  isEqual(t) {
14617
- return t instanceof ma && t.projectId === this.projectId && t.database === this.database;
14614
+ return t instanceof mc && t.projectId === this.projectId && t.database === this.database;
14618
14615
  }
14619
14616
  }
14620
14617
 
@@ -14633,7 +14630,7 @@ class ma {
14633
14630
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14634
14631
  * See the License for the specific language governing permissions and
14635
14632
  * limitations under the License.
14636
- */ const ga = new Map;
14633
+ */ const gc = new Map;
14637
14634
 
14638
14635
  /**
14639
14636
  * An instance map that ensures only one Datastore exists per Firestore
@@ -14655,28 +14652,28 @@ class ma {
14655
14652
  * See the License for the specific language governing permissions and
14656
14653
  * limitations under the License.
14657
14654
  */
14658
- function ya(t, e, n) {
14655
+ function yc(t, e, n) {
14659
14656
  if (!n) throw new W(Q.INVALID_ARGUMENT, `Function ${t}() cannot be called with an empty ${e}.`);
14660
14657
  }
14661
14658
 
14662
14659
  /**
14663
14660
  * Validates that two boolean options are not set at the same time.
14664
14661
  * @internal
14665
- */ function pa(t, e, n, s) {
14662
+ */ function pc(t, e, n, s) {
14666
14663
  if (!0 === e && !0 === s) throw new W(Q.INVALID_ARGUMENT, `${t} and ${n} cannot be used together.`);
14667
14664
  }
14668
14665
 
14669
14666
  /**
14670
14667
  * Validates that `path` refers to a document (indicated by the fact it contains
14671
14668
  * an even numbers of segments).
14672
- */ function Ta(t) {
14669
+ */ function Tc(t) {
14673
14670
  if (!Nt.isDocumentKey(t)) throw new W(Q.INVALID_ARGUMENT, `Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`);
14674
14671
  }
14675
14672
 
14676
14673
  /**
14677
14674
  * Validates that `path` refers to a collection (indicated by the fact it
14678
14675
  * contains an odd numbers of segments).
14679
- */ function Ea(t) {
14676
+ */ function Ec(t) {
14680
14677
  if (Nt.isDocumentKey(t)) throw new W(Q.INVALID_ARGUMENT, `Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`);
14681
14678
  }
14682
14679
 
@@ -14685,7 +14682,7 @@ function ya(t, e, n) {
14685
14682
  * (i.e. excludes Array, Date, etc.).
14686
14683
  */
14687
14684
  /** Returns a string describing the type / value of the provided input. */
14688
- function Ia(t) {
14685
+ function Ic(t) {
14689
14686
  if (void 0 === t) return "undefined";
14690
14687
  if (null === t) return "null";
14691
14688
  if ("string" == typeof t) return t.length > 20 && (t = `${t.substring(0, 20)}...`),
@@ -14714,7 +14711,7 @@ function Ia(t) {
14714
14711
  return "function" == typeof t ? "a function" : U();
14715
14712
  }
14716
14713
 
14717
- function Aa(t,
14714
+ function Ac(t,
14718
14715
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14719
14716
  e) {
14720
14717
  if ("_delegate" in t && (
@@ -14723,14 +14720,14 @@ e) {
14723
14720
  t = t._delegate), !(t instanceof e)) {
14724
14721
  if (e.name === t.constructor.name) throw new W(Q.INVALID_ARGUMENT, "Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");
14725
14722
  {
14726
- const n = Ia(t);
14723
+ const n = Ic(t);
14727
14724
  throw new W(Q.INVALID_ARGUMENT, `Expected type '${e.name}', but it was: ${n}`);
14728
14725
  }
14729
14726
  }
14730
14727
  return t;
14731
14728
  }
14732
14729
 
14733
- function Ra(t, e) {
14730
+ function Rc(t, e) {
14734
14731
  if (e <= 0) throw new W(Q.INVALID_ARGUMENT, `Function ${t}() requires a positive number, but it was: ${e}.`);
14735
14732
  }
14736
14733
 
@@ -14756,7 +14753,7 @@ function Ra(t, e) {
14756
14753
  * user-supplied `FirestoreSettings` object. This is a separate type so that
14757
14754
  * defaults can be supplied and the value can be checked for equality.
14758
14755
  */
14759
- class ba {
14756
+ class Pc {
14760
14757
  constructor(t) {
14761
14758
  var e;
14762
14759
  if (void 0 === t.host) {
@@ -14769,7 +14766,7 @@ class ba {
14769
14766
  this.cacheSizeBytes = t.cacheSizeBytes;
14770
14767
  }
14771
14768
  this.experimentalForceLongPolling = !!t.experimentalForceLongPolling, this.experimentalAutoDetectLongPolling = !!t.experimentalAutoDetectLongPolling,
14772
- this.useFetchStreams = !!t.useFetchStreams, pa("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
14769
+ this.useFetchStreams = !!t.useFetchStreams, pc("experimentalForceLongPolling", t.experimentalForceLongPolling, "experimentalAutoDetectLongPolling", t.experimentalAutoDetectLongPolling);
14773
14770
  }
14774
14771
  isEqual(t) {
14775
14772
  return this.host === t.host && this.ssl === t.ssl && this.credentials === t.credentials && this.cacheSizeBytes === t.cacheSizeBytes && this.experimentalForceLongPolling === t.experimentalForceLongPolling && this.experimentalAutoDetectLongPolling === t.experimentalAutoDetectLongPolling && this.ignoreUndefinedProperties === t.ignoreUndefinedProperties && this.useFetchStreams === t.useFetchStreams;
@@ -14796,18 +14793,18 @@ class ba {
14796
14793
  * The Cloud Firestore service interface.
14797
14794
  *
14798
14795
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
14799
- */ class Pa {
14796
+ */ class bc {
14800
14797
  /** @hideconstructor */
14801
14798
  constructor(t, e, n) {
14802
14799
  this._authCredentials = e, this._appCheckCredentials = n,
14803
14800
  /**
14804
14801
  * Whether it's a Firestore or Firestore Lite instance.
14805
14802
  */
14806
- this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new ba({}),
14807
- this._settingsFrozen = !1, t instanceof ma ? this._databaseId = t : (this._app = t,
14803
+ this.type = "firestore-lite", this._persistenceKey = "(lite)", this._settings = new Pc({}),
14804
+ this._settingsFrozen = !1, t instanceof mc ? this._databaseId = t : (this._app = t,
14808
14805
  this._databaseId = function(t) {
14809
14806
  if (!Object.prototype.hasOwnProperty.apply(t.options, [ "projectId" ])) throw new W(Q.INVALID_ARGUMENT, '"projectId" not provided in firebase.initializeApp.');
14810
- return new ma(t.options.projectId);
14807
+ return new mc(t.options.projectId);
14811
14808
  }
14812
14809
  /**
14813
14810
  * Modify this instance to communicate with the Cloud Firestore emulator.
@@ -14838,7 +14835,7 @@ class ba {
14838
14835
  }
14839
14836
  _setSettings(t) {
14840
14837
  if (this._settingsFrozen) throw new W(Q.FAILED_PRECONDITION, "Firestore has already been started and its settings can no longer be changed. You can only modify settings before calling any other methods on a Firestore object.");
14841
- this._settings = new ba(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
14838
+ this._settings = new Pc(t), void 0 !== t.credentials && (this._authCredentials = function(t) {
14842
14839
  if (!t) return new H;
14843
14840
  switch (t.type) {
14844
14841
  case "gapi":
@@ -14883,15 +14880,15 @@ class ba {
14883
14880
  * when the `Firestore` instance is terminated.
14884
14881
  */
14885
14882
  return function(t) {
14886
- const e = ga.get(t);
14887
- e && (F("ComponentProvider", "Removing Datastore"), ga.delete(t), e.terminate());
14883
+ const e = gc.get(t);
14884
+ e && (F("ComponentProvider", "Removing Datastore"), gc.delete(t), e.terminate());
14888
14885
  }(this), Promise.resolve();
14889
14886
  }
14890
14887
  }
14891
14888
 
14892
- function va(t, e, n, s = {}) {
14889
+ function vc(t, e, n, s = {}) {
14893
14890
  var i;
14894
- const r = (t = Aa(t, Pa))._getSettings();
14891
+ const r = (t = Ac(t, bc))._getSettings();
14895
14892
  if ("firestore.googleapis.com" !== r.host && r.host !== e && L("Host has been set in both settings() and useEmulator(), emulator host will be used"),
14896
14893
  t._setSettings(Object.assign(Object.assign({}, r), {
14897
14894
  host: `${e}:${n}`,
@@ -14930,7 +14927,7 @@ function va(t, e, n, s = {}) {
14930
14927
  * A `DocumentReference` refers to a document location in a Firestore database
14931
14928
  * and can be used to write, read, or listen to the location. The document at
14932
14929
  * the referenced location may or may not exist.
14933
- */ class Va {
14930
+ */ class Vc {
14934
14931
  /** @hideconstructor */
14935
14932
  constructor(t,
14936
14933
  /**
@@ -14958,17 +14955,17 @@ function va(t, e, n, s = {}) {
14958
14955
  /**
14959
14956
  * The collection this `DocumentReference` belongs to.
14960
14957
  */ get parent() {
14961
- return new Da(this.firestore, this.converter, this._key.path.popLast());
14958
+ return new Dc(this.firestore, this.converter, this._key.path.popLast());
14962
14959
  }
14963
14960
  withConverter(t) {
14964
- return new Va(this.firestore, t, this._key);
14961
+ return new Vc(this.firestore, t, this._key);
14965
14962
  }
14966
14963
  }
14967
14964
 
14968
14965
  /**
14969
14966
  * A `Query` refers to a query which you can read or listen to. You can also
14970
14967
  * construct refined `Query` objects by adding filters and ordering.
14971
- */ class Sa {
14968
+ */ class Sc {
14972
14969
  // This is the lite version of the Query class in the main SDK.
14973
14970
  /** @hideconstructor protected */
14974
14971
  constructor(t,
@@ -14981,14 +14978,14 @@ function va(t, e, n, s = {}) {
14981
14978
  this.type = "query", this.firestore = t;
14982
14979
  }
14983
14980
  withConverter(t) {
14984
- return new Sa(this.firestore, t, this._query);
14981
+ return new Sc(this.firestore, t, this._query);
14985
14982
  }
14986
14983
  }
14987
14984
 
14988
14985
  /**
14989
14986
  * A `CollectionReference` object can be used for adding documents, getting
14990
14987
  * document references, and querying for documents (using {@link query}).
14991
- */ class Da extends Sa {
14988
+ */ class Dc extends Sc {
14992
14989
  /** @hideconstructor */
14993
14990
  constructor(t, e, n) {
14994
14991
  super(t, e, Te(n)), this._path = n,
@@ -15009,23 +15006,23 @@ function va(t, e, n, s = {}) {
15009
15006
  * subcollection. If this isn't a subcollection, the reference is null.
15010
15007
  */ get parent() {
15011
15008
  const t = this._path.popLast();
15012
- return t.isEmpty() ? null : new Va(this.firestore,
15009
+ return t.isEmpty() ? null : new Vc(this.firestore,
15013
15010
  /* converter= */ null, new Nt(t));
15014
15011
  }
15015
15012
  withConverter(t) {
15016
- return new Da(this.firestore, t, this._path);
15013
+ return new Dc(this.firestore, t, this._path);
15017
15014
  }
15018
15015
  }
15019
15016
 
15020
- function Ca(t, e, ...n) {
15021
- if (t = T(t), ya("collection", "path", e), t instanceof Pa) {
15017
+ function Cc(t, e, ...n) {
15018
+ if (t = T(t), yc("collection", "path", e), t instanceof bc) {
15022
15019
  const s = _t.fromString(e, ...n);
15023
- return Ea(s), new Da(t, /* converter= */ null, s);
15020
+ return Ec(s), new Dc(t, /* converter= */ null, s);
15024
15021
  }
15025
15022
  {
15026
- if (!(t instanceof Va || t instanceof Da)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15023
+ if (!(t instanceof Vc || t instanceof Dc)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15027
15024
  const s = t._path.child(_t.fromString(e, ...n));
15028
- return Ea(s), new Da(t.firestore,
15025
+ return Ec(s), new Dc(t.firestore,
15029
15026
  /* converter= */ null, s);
15030
15027
  }
15031
15028
  }
@@ -15042,9 +15039,9 @@ function Ca(t, e, ...n) {
15042
15039
  * collection or subcollection with this ID as the last segment of its path
15043
15040
  * will be included. Cannot contain a slash.
15044
15041
  * @returns The created `Query`.
15045
- */ function Na(t, e) {
15046
- if (t = Aa(t, Pa), ya("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new W(Q.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
15047
- return new Sa(t,
15042
+ */ function Nc(t, e) {
15043
+ if (t = Ac(t, bc), yc("collectionGroup", "collection id", e), e.indexOf("/") >= 0) throw new W(Q.INVALID_ARGUMENT, `Invalid collection ID '${e}' passed to function collectionGroup(). Collection IDs must not contain '/'.`);
15044
+ return new Sc(t,
15048
15045
  /* converter= */ null,
15049
15046
  /**
15050
15047
  * Creates a new Query for a collection group query that matches all documents
@@ -15055,19 +15052,19 @@ function Ca(t, e, ...n) {
15055
15052
  }(e));
15056
15053
  }
15057
15054
 
15058
- function ka(t, e, ...n) {
15055
+ function kc(t, e, ...n) {
15059
15056
  if (t = T(t),
15060
15057
  // We allow omission of 'pathString' but explicitly prohibit passing in both
15061
15058
  // 'undefined' and 'null'.
15062
- 1 === arguments.length && (e = rt.A()), ya("doc", "path", e), t instanceof Pa) {
15059
+ 1 === arguments.length && (e = rt.A()), yc("doc", "path", e), t instanceof bc) {
15063
15060
  const s = _t.fromString(e, ...n);
15064
- return Ta(s), new Va(t,
15061
+ return Tc(s), new Vc(t,
15065
15062
  /* converter= */ null, new Nt(s));
15066
15063
  }
15067
15064
  {
15068
- if (!(t instanceof Va || t instanceof Da)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15065
+ if (!(t instanceof Vc || t instanceof Dc)) throw new W(Q.INVALID_ARGUMENT, "Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");
15069
15066
  const s = t._path.child(_t.fromString(e, ...n));
15070
- return Ta(s), new Va(t.firestore, t instanceof Da ? t.converter : null, new Nt(s));
15067
+ return Tc(s), new Vc(t.firestore, t instanceof Dc ? t.converter : null, new Nt(s));
15071
15068
  }
15072
15069
  }
15073
15070
 
@@ -15078,8 +15075,8 @@ function ka(t, e, ...n) {
15078
15075
  * @param right - A reference to compare.
15079
15076
  * @returns true if the references point to the same location in the same
15080
15077
  * Firestore database.
15081
- */ function xa(t, e) {
15082
- return t = T(t), e = T(e), (t instanceof Va || t instanceof Da) && (e instanceof Va || e instanceof Da) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
15078
+ */ function xc(t, e) {
15079
+ return t = T(t), e = T(e), (t instanceof Vc || t instanceof Dc) && (e instanceof Vc || e instanceof Dc) && (t.firestore === e.firestore && t.path === e.path && t.converter === e.converter);
15083
15080
  }
15084
15081
 
15085
15082
  /**
@@ -15090,8 +15087,8 @@ function ka(t, e, ...n) {
15090
15087
  * @param right - A `Query` to compare.
15091
15088
  * @returns true if the references point to the same location in the same
15092
15089
  * Firestore database.
15093
- */ function $a(t, e) {
15094
- return t = T(t), e = T(e), t instanceof Sa && e instanceof Sa && (t.firestore === e.firestore && Se(t._query, e._query) && t.converter === e.converter);
15090
+ */ function $c(t, e) {
15091
+ return t = T(t), e = T(e), t instanceof Sc && e instanceof Sc && (t.firestore === e.firestore && Se(t._query, e._query) && t.converter === e.converter);
15095
15092
  }
15096
15093
 
15097
15094
  /**
@@ -15109,42 +15106,42 @@ function ka(t, e, ...n) {
15109
15106
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15110
15107
  * See the License for the specific language governing permissions and
15111
15108
  * limitations under the License.
15112
- */ class Oa {
15109
+ */ class Oc {
15113
15110
  constructor() {
15114
15111
  // The last promise in the queue.
15115
- this.mc = Promise.resolve(),
15112
+ this.ma = Promise.resolve(),
15116
15113
  // A list of retryable operations. Retryable operations are run in order and
15117
15114
  // retried with backoff.
15118
- this.gc = [],
15115
+ this.ga = [],
15119
15116
  // Is this AsyncQueue being shut down? Once it is set to true, it will not
15120
15117
  // be changed again.
15121
- this.yc = !1,
15118
+ this.ya = !1,
15122
15119
  // Operations scheduled to be queued in the future. Operations are
15123
15120
  // automatically removed after they are run or canceled.
15124
- this.Tc = [],
15121
+ this.pa = [],
15125
15122
  // visible for testing
15126
- this.Ec = null,
15123
+ this.Ta = null,
15127
15124
  // Flag set while there's an outstanding AsyncQueue operation, used for
15128
15125
  // assertion sanity-checks.
15129
- this.Ic = !1,
15126
+ this.Ea = !1,
15130
15127
  // Enabled during shutdown on Safari to prevent future access to IndexedDB.
15131
- this.Ac = !1,
15128
+ this.Ia = !1,
15132
15129
  // List of TimerIds to fast-forward delays for.
15133
- this.Rc = [],
15130
+ this.Aa = [],
15134
15131
  // Backoff timer used to schedule retries for retryable operations
15135
15132
  this.ur = new io(this, "async_queue_retry" /* AsyncQueueRetry */),
15136
15133
  // Visibility handler that triggers an immediate retry of all retryable
15137
15134
  // operations. Meant to speed up recovery when we regain file system access
15138
15135
  // after page comes into foreground.
15139
- this.bc = () => {
15136
+ this.Ra = () => {
15140
15137
  const t = no();
15141
15138
  t && F("AsyncQueue", "Visibility state changed to " + t.visibilityState), this.ur.er();
15142
15139
  };
15143
15140
  const t = no();
15144
- t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.bc);
15141
+ t && "function" == typeof t.addEventListener && t.addEventListener("visibilitychange", this.Ra);
15145
15142
  }
15146
15143
  get isShuttingDown() {
15147
- return this.yc;
15144
+ return this.ya;
15148
15145
  }
15149
15146
  /**
15150
15147
  * Adds a new operation to the queue without waiting for it to complete (i.e.
@@ -15154,44 +15151,44 @@ function ka(t, e, ...n) {
15154
15151
  this.enqueue(t);
15155
15152
  }
15156
15153
  enqueueAndForgetEvenWhileRestricted(t) {
15157
- this.Pc(),
15154
+ this.Pa(),
15158
15155
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
15159
- this.vc(t);
15156
+ this.ba(t);
15160
15157
  }
15161
15158
  enterRestrictedMode(t) {
15162
- if (!this.yc) {
15163
- this.yc = !0, this.Ac = t || !1;
15159
+ if (!this.ya) {
15160
+ this.ya = !0, this.Ia = t || !1;
15164
15161
  const e = no();
15165
- e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.bc);
15162
+ e && "function" == typeof e.removeEventListener && e.removeEventListener("visibilitychange", this.Ra);
15166
15163
  }
15167
15164
  }
15168
15165
  enqueue(t) {
15169
- if (this.Pc(), this.yc)
15166
+ if (this.Pa(), this.ya)
15170
15167
  // Return a Promise which never resolves.
15171
15168
  return new Promise((() => {}));
15172
15169
  // Create a deferred Promise that we can return to the callee. This
15173
15170
  // allows us to return a "hanging Promise" only to the callee and still
15174
15171
  // advance the queue even when the operation is not run.
15175
15172
  const e = new G;
15176
- return this.vc((() => this.yc && this.Ac ? Promise.resolve() : (t().then(e.resolve, e.reject),
15173
+ return this.ba((() => this.ya && this.Ia ? Promise.resolve() : (t().then(e.resolve, e.reject),
15177
15174
  e.promise))).then((() => e.promise));
15178
15175
  }
15179
15176
  enqueueRetryable(t) {
15180
- this.enqueueAndForget((() => (this.gc.push(t), this.Vc())));
15177
+ this.enqueueAndForget((() => (this.ga.push(t), this.va())));
15181
15178
  }
15182
15179
  /**
15183
15180
  * Runs the next operation from the retryable queue. If the operation fails,
15184
15181
  * reschedules with backoff.
15185
- */ async Vc() {
15186
- if (0 !== this.gc.length) {
15182
+ */ async va() {
15183
+ if (0 !== this.ga.length) {
15187
15184
  try {
15188
- await this.gc[0](), this.gc.shift(), this.ur.reset();
15185
+ await this.ga[0](), this.ga.shift(), this.ur.reset();
15189
15186
  } catch (t) {
15190
15187
  if (!ei(t)) throw t;
15191
15188
  // Failure will be handled by AsyncQueue
15192
15189
  F("AsyncQueue", "Operation failed with retryable error: " + t);
15193
15190
  }
15194
- this.gc.length > 0 &&
15191
+ this.ga.length > 0 &&
15195
15192
  // If there are additional operations, we re-schedule `retryNextOp()`.
15196
15193
  // This is necessary to run retryable operations that failed during
15197
15194
  // their initial attempt since we don't know whether they are already
@@ -15202,12 +15199,12 @@ function ka(t, e, ...n) {
15202
15199
  // Since `backoffAndRun()` cancels an existing backoff and schedules a
15203
15200
  // new backoff on every call, there is only ever a single additional
15204
15201
  // operation in the queue.
15205
- this.ur.Zi((() => this.Vc()));
15202
+ this.ur.Zi((() => this.va()));
15206
15203
  }
15207
15204
  }
15208
- vc(t) {
15209
- const e = this.mc.then((() => (this.Ic = !0, t().catch((t => {
15210
- this.Ec = t, this.Ic = !1;
15205
+ ba(t) {
15206
+ const e = this.ma.then((() => (this.Ea = !0, t().catch((t => {
15207
+ this.Ta = t, this.Ea = !1;
15211
15208
  const e =
15212
15209
  /**
15213
15210
  * Chrome includes Error.message in Error.stack. Other browsers do not.
@@ -15239,38 +15236,38 @@ function ka(t, e, ...n) {
15239
15236
  // all further attempts to chain (via .then) will just short-circuit
15240
15237
  // and return the rejected Promise.
15241
15238
  throw M("INTERNAL UNHANDLED ERROR: ", e), t;
15242
- })).then((t => (this.Ic = !1, t))))));
15243
- return this.mc = e, e;
15239
+ })).then((t => (this.Ea = !1, t))))));
15240
+ return this.ma = e, e;
15244
15241
  }
15245
15242
  enqueueAfterDelay(t, e, n) {
15246
- this.Pc(),
15243
+ this.Pa(),
15247
15244
  // Fast-forward delays for timerIds that have been overriden.
15248
- this.Rc.indexOf(t) > -1 && (e = 0);
15249
- const s = Lo.createAndSchedule(this, t, e, n, (t => this.Sc(t)));
15250
- return this.Tc.push(s), s;
15245
+ this.Aa.indexOf(t) > -1 && (e = 0);
15246
+ const s = Lo.createAndSchedule(this, t, e, n, (t => this.Va(t)));
15247
+ return this.pa.push(s), s;
15251
15248
  }
15252
- Pc() {
15253
- this.Ec && U();
15249
+ Pa() {
15250
+ this.Ta && U();
15254
15251
  }
15255
15252
  verifyOperationInProgress() {}
15256
15253
  /**
15257
15254
  * Waits until all currently queued tasks are finished executing. Delayed
15258
15255
  * operations are not run.
15259
- */ async Dc() {
15256
+ */ async Sa() {
15260
15257
  // Operations in the queue prior to draining may have enqueued additional
15261
15258
  // operations. Keep draining the queue until the tail is no longer advanced,
15262
15259
  // which indicates that no more new operations were enqueued and that all
15263
15260
  // operations were executed.
15264
15261
  let t;
15265
15262
  do {
15266
- t = this.mc, await t;
15267
- } while (t !== this.mc);
15263
+ t = this.ma, await t;
15264
+ } while (t !== this.ma);
15268
15265
  }
15269
15266
  /**
15270
15267
  * For Tests: Determine if a delayed operation with a particular TimerId
15271
15268
  * exists.
15272
- */ Cc(t) {
15273
- for (const e of this.Tc) if (e.timerId === t) return !0;
15269
+ */ Da(t) {
15270
+ for (const e of this.pa) if (e.timerId === t) return !0;
15274
15271
  return !1;
15275
15272
  }
15276
15273
  /**
@@ -15279,28 +15276,28 @@ function ka(t, e, ...n) {
15279
15276
  * @param lastTimerId - Delayed operations up to and including this TimerId
15280
15277
  * will be drained. Pass TimerId.All to run all delayed operations.
15281
15278
  * @returns a Promise that resolves once all operations have been run.
15282
- */ Nc(t) {
15279
+ */ Ca(t) {
15283
15280
  // Note that draining may generate more delayed ops, so we do that first.
15284
- return this.Dc().then((() => {
15281
+ return this.Sa().then((() => {
15285
15282
  // Run ops in the same order they'd run if they ran naturally.
15286
- this.Tc.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
15287
- for (const e of this.Tc) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
15288
- return this.Dc();
15283
+ this.pa.sort(((t, e) => t.targetTimeMs - e.targetTimeMs));
15284
+ for (const e of this.pa) if (e.skipDelay(), "all" /* All */ !== t && e.timerId === t) break;
15285
+ return this.Sa();
15289
15286
  }));
15290
15287
  }
15291
15288
  /**
15292
15289
  * For Tests: Skip all subsequent delays for a timer id.
15293
- */ kc(t) {
15294
- this.Rc.push(t);
15290
+ */ Na(t) {
15291
+ this.Aa.push(t);
15295
15292
  }
15296
- /** Called once a DelayedOperation is run or canceled. */ Sc(t) {
15293
+ /** Called once a DelayedOperation is run or canceled. */ Va(t) {
15297
15294
  // NOTE: indexOf / slice are O(n), but delayedOperations is expected to be small.
15298
- const e = this.Tc.indexOf(t);
15299
- this.Tc.splice(e, 1);
15295
+ const e = this.pa.indexOf(t);
15296
+ this.pa.splice(e, 1);
15300
15297
  }
15301
15298
  }
15302
15299
 
15303
- function Fa(t) {
15300
+ function Fc(t) {
15304
15301
  /**
15305
15302
  * Returns true if obj is an object and contains at least one of the specified
15306
15303
  * methods.
@@ -15335,7 +15332,7 @@ function Fa(t) {
15335
15332
  */ (t, [ "next", "error", "complete" ]);
15336
15333
  }
15337
15334
 
15338
- class Ma {
15335
+ class Mc {
15339
15336
  constructor() {
15340
15337
  this._progressObserver = {}, this._taskCompletionResolver = new G, this._lastProgress = {
15341
15338
  taskState: "Running",
@@ -15419,27 +15416,27 @@ class Ma {
15419
15416
  * See the License for the specific language governing permissions and
15420
15417
  * limitations under the License.
15421
15418
  */
15422
- /** DOMException error code constants. */ const La = -1;
15419
+ /** DOMException error code constants. */ const Lc = -1;
15423
15420
 
15424
15421
  /**
15425
15422
  * The Cloud Firestore service interface.
15426
15423
  *
15427
15424
  * Do not call this constructor directly. Instead, use {@link getFirestore}.
15428
15425
  */
15429
- class Ba extends Pa {
15426
+ class Bc extends bc {
15430
15427
  /** @hideconstructor */
15431
15428
  constructor(t, e, n) {
15432
15429
  super(t, e, n),
15433
15430
  /**
15434
15431
  * Whether it's a {@link Firestore} or Firestore Lite instance.
15435
15432
  */
15436
- this.type = "firestore", this._queue = new Oa, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
15433
+ this.type = "firestore", this._queue = new Oc, this._persistenceKey = "name" in t ? t.name : "[DEFAULT]";
15437
15434
  }
15438
15435
  _terminate() {
15439
15436
  return this._firestoreClient ||
15440
15437
  // The client must be initialized to ensure that all subsequent API
15441
15438
  // usage throws an exception.
15442
- ja(this), this._firestoreClient.terminate();
15439
+ jc(this), this._firestoreClient.terminate();
15443
15440
  }
15444
15441
  }
15445
15442
 
@@ -15453,7 +15450,7 @@ class Ba extends Pa {
15453
15450
  * be associated.
15454
15451
  * @param settings - A settings object to configure the {@link Firestore} instance.
15455
15452
  * @returns A newly initialized {@link Firestore} instance.
15456
- */ function Ua(t, e) {
15453
+ */ function Uc(t, e) {
15457
15454
  const n = _getProvider(t, "firestore");
15458
15455
  if (n.isInitialized()) {
15459
15456
  const t = n.getImmediate(), s = n.getOptions();
@@ -15474,22 +15471,22 @@ class Ba extends Pa {
15474
15471
  * @param app - The {@link @firebase/app#FirebaseApp} instance that the returned {@link Firestore}
15475
15472
  * instance is associated with.
15476
15473
  * @returns The {@link Firestore} instance of the provided app.
15477
- */ function qa(e = t()) {
15474
+ */ function qc(e = t()) {
15478
15475
  return _getProvider(e, "firestore").getImmediate();
15479
15476
  }
15480
15477
 
15481
15478
  /**
15482
15479
  * @internal
15483
- */ function Ka(t) {
15484
- return t._firestoreClient || ja(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
15480
+ */ function Kc(t) {
15481
+ return t._firestoreClient || jc(t), t._firestoreClient.verifyNotTerminated(), t._firestoreClient;
15485
15482
  }
15486
15483
 
15487
- function ja(t) {
15484
+ function jc(t) {
15488
15485
  var e;
15489
15486
  const n = t._freezeSettings(), s = function(t, e, n, s) {
15490
- return new _a(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
15487
+ return new _c(t, e, n, s.host, s.ssl, s.experimentalForceLongPolling, s.experimentalAutoDetectLongPolling, s.useFetchStreams);
15491
15488
  }(t._databaseId, (null === (e = t._app) || void 0 === e ? void 0 : e.options.appId) || "", t._persistenceKey, n);
15492
- t._firestoreClient = new Hc(t._authCredentials, t._appCheckCredentials, t._queue, s);
15489
+ t._firestoreClient = new Ha(t._authCredentials, t._appCheckCredentials, t._queue, s);
15493
15490
  }
15494
15491
 
15495
15492
  /**
@@ -15514,10 +15511,10 @@ function ja(t) {
15514
15511
  * @param persistenceSettings - Optional settings object to configure
15515
15512
  * persistence.
15516
15513
  * @returns A `Promise` that represents successfully enabling persistent storage.
15517
- */ function Qa(t, e) {
15518
- eu(t = Aa(t, Ba));
15519
- const n = Ka(t), s = t._freezeSettings(), i = new Kc;
15520
- return Ga(n, i, new Uc(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
15514
+ */ function Qc(t, e) {
15515
+ eu(t = Ac(t, Bc));
15516
+ const n = Kc(t), s = t._freezeSettings(), i = new Ka;
15517
+ return Gc(n, i, new Ua(i, s.cacheSizeBytes, null == e ? void 0 : e.forceOwnership));
15521
15518
  }
15522
15519
 
15523
15520
  /**
@@ -15541,10 +15538,10 @@ function ja(t) {
15541
15538
  * @param firestore - The {@link Firestore} instance to enable persistence for.
15542
15539
  * @returns A `Promise` that represents successfully enabling persistent
15543
15540
  * storage.
15544
- */ function Wa(t) {
15545
- eu(t = Aa(t, Ba));
15546
- const e = Ka(t), n = t._freezeSettings(), s = new Kc;
15547
- return Ga(e, s, new qc(s, n.cacheSizeBytes));
15541
+ */ function Wc(t) {
15542
+ eu(t = Ac(t, Bc));
15543
+ const e = Kc(t), n = t._freezeSettings(), s = new Ka;
15544
+ return Gc(e, s, new qa(s, n.cacheSizeBytes));
15548
15545
  }
15549
15546
 
15550
15547
  /**
@@ -15552,11 +15549,11 @@ function ja(t) {
15552
15549
  * If the operation fails with a recoverable error (see
15553
15550
  * `canRecoverFromIndexedDbError()` below), the returned Promise is rejected
15554
15551
  * but the client remains usable.
15555
- */ function Ga(t, e, n) {
15552
+ */ function Gc(t, e, n) {
15556
15553
  const s = new G;
15557
15554
  return t.asyncQueue.enqueue((async () => {
15558
15555
  try {
15559
- await Jc(t, n), await Yc(t, e), s.resolve();
15556
+ await Ja(t, n), await Ya(t, e), s.resolve();
15560
15557
  } catch (t) {
15561
15558
  if (!
15562
15559
  /**
@@ -15610,13 +15607,13 @@ function ja(t) {
15610
15607
  })).then((() => s.promise));
15611
15608
  }
15612
15609
 
15613
- function za(t) {
15610
+ function zc(t) {
15614
15611
  if (t._initialized && !t._terminated) throw new W(Q.FAILED_PRECONDITION, "Persistence can only be cleared before a Firestore instance is initialized or after it is terminated.");
15615
15612
  const e = new G;
15616
15613
  return t._queue.enqueueAndForgetEvenWhileRestricted((async () => {
15617
15614
  try {
15618
15615
  await async function(t) {
15619
- if (!Xs.Pt()) return Promise.resolve();
15616
+ if (!Xs.bt()) return Promise.resolve();
15620
15617
  const e = t + "main";
15621
15618
  await Xs.delete(e);
15622
15619
  }(ur(t._databaseId, t._persistenceKey)), e.resolve();
@@ -15641,11 +15638,11 @@ function za(t) {
15641
15638
  *
15642
15639
  * @returns A `Promise` which resolves when all currently pending writes have been
15643
15640
  * acknowledged by the backend.
15644
- */ function Ha(t) {
15641
+ */ function Hc(t) {
15645
15642
  return function(t) {
15646
15643
  const e = new G;
15647
- return t.asyncQueue.enqueueAndForget((async () => gc(await sa(t), e))), e.promise;
15648
- }(Ka(t = Aa(t, Ba)));
15644
+ return t.asyncQueue.enqueueAndForget((async () => ga(await sc(t), e))), e.promise;
15645
+ }(Kc(t = Ac(t, Bc)));
15649
15646
  }
15650
15647
 
15651
15648
  /**
@@ -15653,8 +15650,8 @@ function za(t) {
15653
15650
  * call to {@link disableNetwork}.
15654
15651
  *
15655
15652
  * @returns A `Promise` that is resolved once the network has been enabled.
15656
- */ function Ja(t) {
15657
- return ra(Ka(t = Aa(t, Ba)));
15653
+ */ function Jc(t) {
15654
+ return rc(Kc(t = Ac(t, Bc)));
15658
15655
  }
15659
15656
 
15660
15657
  /**
@@ -15664,8 +15661,8 @@ function za(t) {
15664
15661
  * operations will be queued until the network is restored.
15665
15662
  *
15666
15663
  * @returns A `Promise` that is resolved once the network has been disabled.
15667
- */ function Ya(t) {
15668
- return oa(Ka(t = Aa(t, Ba)));
15664
+ */ function Yc(t) {
15665
+ return oc(Kc(t = Ac(t, Bc)));
15669
15666
  }
15670
15667
 
15671
15668
  /**
@@ -15689,7 +15686,7 @@ function za(t) {
15689
15686
  *
15690
15687
  * @returns A `Promise` that is resolved when the instance has been successfully
15691
15688
  * terminated.
15692
- */ function Xa(t) {
15689
+ */ function Xc(t) {
15693
15690
  return e(t.app, "firestore"), t._delete();
15694
15691
  }
15695
15692
 
@@ -15703,9 +15700,9 @@ function za(t) {
15703
15700
  * @returns
15704
15701
  * A `LoadBundleTask` object, which notifies callers with progress updates, and completion
15705
15702
  * or error events. It can be used as a `Promise<LoadBundleTaskProgress>`.
15706
- */ function Za(t, e) {
15707
- const n = Ka(t = Aa(t, Ba)), s = new Ma;
15708
- return da(n, t._databaseId, e, s), s;
15703
+ */ function Zc(t, e) {
15704
+ const n = Kc(t = Ac(t, Bc)), s = new Mc;
15705
+ return dc(n, t._databaseId, e, s), s;
15709
15706
  }
15710
15707
 
15711
15708
  /**
@@ -15715,7 +15712,7 @@ function za(t) {
15715
15712
  * with resulting documents), and loaded to local cache using `loadBundle`. Once in local
15716
15713
  * cache, use this method to extract a {@link Query} by name.
15717
15714
  */ function tu(t, e) {
15718
- return wa(Ka(t = Aa(t, Ba)), e).then((e => e ? new Sa(t, null, e.query) : null));
15715
+ return wc(Kc(t = Ac(t, Bc)), e).then((e => e ? new Sc(t, null, e.query) : null));
15719
15716
  }
15720
15717
 
15721
15718
  function eu(t) {
@@ -15973,14 +15970,14 @@ class nu {
15973
15970
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15974
15971
  * See the License for the specific language governing permissions and
15975
15972
  * limitations under the License.
15976
- */ const cu = /^__.*__$/;
15973
+ */ const au = /^__.*__$/;
15977
15974
 
15978
- /** The result of parsing document data (e.g. for a setData call). */ class au {
15975
+ /** The result of parsing document data (e.g. for a setData call). */ class cu {
15979
15976
  constructor(t, e, n) {
15980
15977
  this.data = t, this.fieldMask = e, this.fieldTransforms = n;
15981
15978
  }
15982
15979
  toMutation(t, e) {
15983
- return null !== this.fieldMask ? new un(t, this.data, this.fieldMask, e, this.fieldTransforms) : new an(t, this.data, e, this.fieldTransforms);
15980
+ return null !== this.fieldMask ? new un(t, this.data, this.fieldMask, e, this.fieldTransforms) : new cn(t, this.data, e, this.fieldTransforms);
15984
15981
  }
15985
15982
  }
15986
15983
 
@@ -16036,55 +16033,55 @@ function hu(t) {
16036
16033
  this.settings = t, this.databaseId = e, this.k = n, this.ignoreUndefinedProperties = s,
16037
16034
  // Minor hack: If fieldTransforms is undefined, we assume this is an
16038
16035
  // external call and we need to validate the entire path.
16039
- void 0 === i && this.xc(), this.fieldTransforms = i || [], this.fieldMask = r || [];
16036
+ void 0 === i && this.ka(), this.fieldTransforms = i || [], this.fieldMask = r || [];
16040
16037
  }
16041
16038
  get path() {
16042
16039
  return this.settings.path;
16043
16040
  }
16044
- get $c() {
16045
- return this.settings.$c;
16041
+ get xa() {
16042
+ return this.settings.xa;
16046
16043
  }
16047
- /** Returns a new context with the specified settings overwritten. */ Oc(t) {
16044
+ /** Returns a new context with the specified settings overwritten. */ $a(t) {
16048
16045
  return new lu(Object.assign(Object.assign({}, this.settings), t), this.databaseId, this.k, this.ignoreUndefinedProperties, this.fieldTransforms, this.fieldMask);
16049
16046
  }
16050
- Fc(t) {
16047
+ Oa(t) {
16051
16048
  var e;
16052
- const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.Oc({
16049
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$a({
16053
16050
  path: n,
16054
- Mc: !1
16051
+ Fa: !1
16055
16052
  });
16056
- return s.Lc(t), s;
16053
+ return s.Ma(t), s;
16057
16054
  }
16058
- Bc(t) {
16055
+ La(t) {
16059
16056
  var e;
16060
- const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.Oc({
16057
+ const n = null === (e = this.path) || void 0 === e ? void 0 : e.child(t), s = this.$a({
16061
16058
  path: n,
16062
- Mc: !1
16059
+ Fa: !1
16063
16060
  });
16064
- return s.xc(), s;
16061
+ return s.ka(), s;
16065
16062
  }
16066
- Uc(t) {
16063
+ Ba(t) {
16067
16064
  // TODO(b/34871131): We don't support array paths right now; so make path
16068
16065
  // undefined.
16069
- return this.Oc({
16066
+ return this.$a({
16070
16067
  path: void 0,
16071
- Mc: !0
16068
+ Fa: !0
16072
16069
  });
16073
16070
  }
16074
- qc(t) {
16075
- return Cu(t, this.settings.methodName, this.settings.Kc || !1, this.path, this.settings.jc);
16071
+ Ua(t) {
16072
+ return Cu(t, this.settings.methodName, this.settings.qa || !1, this.path, this.settings.Ka);
16076
16073
  }
16077
16074
  /** Returns 'true' if 'fieldPath' was traversed when creating this context. */ contains(t) {
16078
16075
  return void 0 !== this.fieldMask.find((e => t.isPrefixOf(e))) || void 0 !== this.fieldTransforms.find((e => t.isPrefixOf(e.field)));
16079
16076
  }
16080
- xc() {
16077
+ ka() {
16081
16078
  // TODO(b/34871131): Remove null check once we have proper paths for fields
16082
16079
  // within arrays.
16083
- if (this.path) for (let t = 0; t < this.path.length; t++) this.Lc(this.path.get(t));
16080
+ if (this.path) for (let t = 0; t < this.path.length; t++) this.Ma(this.path.get(t));
16084
16081
  }
16085
- Lc(t) {
16086
- if (0 === t.length) throw this.qc("Document fields must not be empty");
16087
- if (hu(this.$c) && cu.test(t)) throw this.qc('Document fields cannot begin and end with "__"');
16082
+ Ma(t) {
16083
+ if (0 === t.length) throw this.Ua("Document fields must not be empty");
16084
+ if (hu(this.xa) && au.test(t)) throw this.Ua('Document fields cannot begin and end with "__"');
16088
16085
  }
16089
16086
  }
16090
16087
 
@@ -16095,14 +16092,14 @@ function hu(t) {
16095
16092
  constructor(t, e, n) {
16096
16093
  this.databaseId = t, this.ignoreUndefinedProperties = e, this.k = n || so(t);
16097
16094
  }
16098
- /** Creates a new top-level parse context. */ Qc(t, e, n, s = !1) {
16095
+ /** Creates a new top-level parse context. */ ja(t, e, n, s = !1) {
16099
16096
  return new lu({
16100
- $c: t,
16097
+ xa: t,
16101
16098
  methodName: e,
16102
- jc: n,
16099
+ Ka: n,
16103
16100
  path: gt.emptyPath(),
16104
- Mc: !1,
16105
- Kc: s
16101
+ Fa: !1,
16102
+ qa: s
16106
16103
  }, this.databaseId, this.k, this.ignoreUndefinedProperties);
16107
16104
  }
16108
16105
  }
@@ -16113,25 +16110,25 @@ function du(t) {
16113
16110
  }
16114
16111
 
16115
16112
  /** Parse document data from a set() call. */ function wu(t, e, n, s, i, r = {}) {
16116
- const o = t.Qc(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
16113
+ const o = t.ja(r.merge || r.mergeFields ? 2 /* MergeSet */ : 0 /* Set */ , e, n, i);
16117
16114
  vu("Data must be an object, but it was:", o, s);
16118
- const c = bu(s, o);
16119
- let a, u;
16120
- if (r.merge) a = new yt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
16115
+ const a = Pu(s, o);
16116
+ let c, u;
16117
+ if (r.merge) c = new yt(o.fieldMask), u = o.fieldTransforms; else if (r.mergeFields) {
16121
16118
  const t = [];
16122
16119
  for (const s of r.mergeFields) {
16123
16120
  const i = Vu(e, s, n);
16124
16121
  if (!o.contains(i)) throw new W(Q.INVALID_ARGUMENT, `Field '${i}' is specified in your field mask but missing from your input data.`);
16125
16122
  Nu(t, i) || t.push(i);
16126
16123
  }
16127
- a = new yt(t), u = o.fieldTransforms.filter((t => a.covers(t.field)));
16128
- } else a = null, u = o.fieldTransforms;
16129
- return new au(new Gt(c), a, u);
16124
+ c = new yt(t), u = o.fieldTransforms.filter((t => c.covers(t.field)));
16125
+ } else c = null, u = o.fieldTransforms;
16126
+ return new cu(new Gt(a), c, u);
16130
16127
  }
16131
16128
 
16132
16129
  class _u extends ru {
16133
16130
  _toFieldTransform(t) {
16134
- if (2 /* MergeSet */ !== t.$c) throw 1 /* Update */ === t.$c ? t.qc(`${this._methodName}() can only appear at the top level of your update data`) : t.qc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
16131
+ if (2 /* MergeSet */ !== t.xa) throw 1 /* Update */ === t.xa ? t.Ua(`${this._methodName}() can only appear at the top level of your update data`) : t.Ua(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);
16135
16132
  // No transform to add for a delete, but we need to add it to our
16136
16133
  // fieldMask so it gets deleted.
16137
16134
  return t.fieldMask.push(t.path), null;
@@ -16158,10 +16155,10 @@ class _u extends ru {
16158
16155
  * @param arrayElement - Whether or not the FieldValue has an array.
16159
16156
  */ function mu(t, e, n) {
16160
16157
  return new lu({
16161
- $c: 3 /* Argument */ ,
16162
- jc: e.settings.jc,
16158
+ xa: 3 /* Argument */ ,
16159
+ Ka: e.settings.Ka,
16163
16160
  methodName: t._methodName,
16164
- Mc: n
16161
+ Fa: n
16165
16162
  }, e.databaseId, e.k, e.ignoreUndefinedProperties);
16166
16163
  }
16167
16164
 
@@ -16176,11 +16173,11 @@ class gu extends ru {
16176
16173
 
16177
16174
  class yu extends ru {
16178
16175
  constructor(t, e) {
16179
- super(t), this.Wc = e;
16176
+ super(t), this.Qa = e;
16180
16177
  }
16181
16178
  _toFieldTransform(t) {
16182
16179
  const e = mu(this, t,
16183
- /*array=*/ !0), n = this.Wc.map((t => Ru(t, e))), s = new Ke(n);
16180
+ /*array=*/ !0), n = this.Qa.map((t => Ru(t, e))), s = new Ke(n);
16184
16181
  return new Je(t.path, s);
16185
16182
  }
16186
16183
  isEqual(t) {
@@ -16191,11 +16188,11 @@ class yu extends ru {
16191
16188
 
16192
16189
  class pu extends ru {
16193
16190
  constructor(t, e) {
16194
- super(t), this.Wc = e;
16191
+ super(t), this.Qa = e;
16195
16192
  }
16196
16193
  _toFieldTransform(t) {
16197
16194
  const e = mu(this, t,
16198
- /*array=*/ !0), n = this.Wc.map((t => Ru(t, e))), s = new Qe(n);
16195
+ /*array=*/ !0), n = this.Qa.map((t => Ru(t, e))), s = new Qe(n);
16199
16196
  return new Je(t.path, s);
16200
16197
  }
16201
16198
  isEqual(t) {
@@ -16206,10 +16203,10 @@ class pu extends ru {
16206
16203
 
16207
16204
  class Tu extends ru {
16208
16205
  constructor(t, e) {
16209
- super(t), this.Gc = e;
16206
+ super(t), this.Wa = e;
16210
16207
  }
16211
16208
  _toFieldTransform(t) {
16212
- const e = new Ge(t.k, Fe(t.k, this.Gc));
16209
+ const e = new Ge(t.k, Fe(t.k, this.Wa));
16213
16210
  return new Je(t.path, e);
16214
16211
  }
16215
16212
  isEqual(t) {
@@ -16219,40 +16216,40 @@ class Tu extends ru {
16219
16216
  }
16220
16217
 
16221
16218
  /** Parse update data from an update() call. */ function Eu(t, e, n, s) {
16222
- const i = t.Qc(1 /* Update */ , e, n);
16219
+ const i = t.ja(1 /* Update */ , e, n);
16223
16220
  vu("Data must be an object, but it was:", i, s);
16224
16221
  const r = [], o = Gt.empty();
16225
16222
  ft(s, ((t, s) => {
16226
- const c = Du(e, t, n);
16223
+ const a = Du(e, t, n);
16227
16224
  // For Compat types, we have to "extract" the underlying types before
16228
16225
  // performing validation.
16229
16226
  s = T(s);
16230
- const a = i.Bc(c);
16227
+ const c = i.La(a);
16231
16228
  if (s instanceof _u)
16232
16229
  // Add it to the field mask, but don't add anything to updateData.
16233
- r.push(c); else {
16234
- const t = Ru(s, a);
16235
- null != t && (r.push(c), o.set(c, t));
16230
+ r.push(a); else {
16231
+ const t = Ru(s, c);
16232
+ null != t && (r.push(a), o.set(a, t));
16236
16233
  }
16237
16234
  }));
16238
- const c = new yt(r);
16239
- return new uu(o, c, i.fieldTransforms);
16235
+ const a = new yt(r);
16236
+ return new uu(o, a, i.fieldTransforms);
16240
16237
  }
16241
16238
 
16242
16239
  /** Parse update data from a list of field/value arguments. */ function Iu(t, e, n, s, i, r) {
16243
- const o = t.Qc(1 /* Update */ , e, n), c = [ Vu(e, s, n) ], a = [ i ];
16240
+ const o = t.ja(1 /* Update */ , e, n), a = [ Vu(e, s, n) ], c = [ i ];
16244
16241
  if (r.length % 2 != 0) throw new W(Q.INVALID_ARGUMENT, `Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);
16245
- for (let t = 0; t < r.length; t += 2) c.push(Vu(e, r[t])), a.push(r[t + 1]);
16242
+ for (let t = 0; t < r.length; t += 2) a.push(Vu(e, r[t])), c.push(r[t + 1]);
16246
16243
  const u = [], h = Gt.empty();
16247
16244
  // We iterate in reverse order to pick the last value for a field if the
16248
16245
  // user specified the field multiple times.
16249
- for (let t = c.length - 1; t >= 0; --t) if (!Nu(u, c[t])) {
16250
- const e = c[t];
16251
- let n = a[t];
16246
+ for (let t = a.length - 1; t >= 0; --t) if (!Nu(u, a[t])) {
16247
+ const e = a[t];
16248
+ let n = c[t];
16252
16249
  // For Compat types, we have to "extract" the underlying types before
16253
16250
  // performing validation.
16254
16251
  n = T(n);
16255
- const s = o.Bc(e);
16252
+ const s = o.La(e);
16256
16253
  if (n instanceof _u)
16257
16254
  // Add it to the field mask, but don't add anything to updateData.
16258
16255
  u.push(e); else {
@@ -16271,7 +16268,7 @@ class Tu extends ru {
16271
16268
  * @param allowArrays - Whether the query value is an array that may directly
16272
16269
  * contain additional arrays (e.g. the operand of an `in` query).
16273
16270
  */ function Au(t, e, n, s = !1) {
16274
- return Ru(n, t.Qc(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
16271
+ return Ru(n, t.ja(s ? 4 /* ArrayArgument */ : 3 /* Argument */ , e));
16275
16272
  }
16276
16273
 
16277
16274
  /**
@@ -16283,10 +16280,10 @@ class Tu extends ru {
16283
16280
  * @returns The parsed value, or null if the value was a FieldValue sentinel
16284
16281
  * that should not be included in the resulting parsed data.
16285
16282
  */ function Ru(t, e) {
16286
- if (Pu(
16283
+ if (bu(
16287
16284
  // Unwrap the API type from the Compat SDK. This will return the API type
16288
16285
  // from firestore-exp.
16289
- t = T(t))) return vu("Unsupported field value:", e, t), bu(t, e);
16286
+ t = T(t))) return vu("Unsupported field value:", e, t), Pu(t, e);
16290
16287
  if (t instanceof ru)
16291
16288
  // FieldValues usually parse into transforms (except FieldValue.delete())
16292
16289
  // in which case we do not want to include this field in our parsed data
@@ -16299,8 +16296,8 @@ class Tu extends ru {
16299
16296
  */
16300
16297
  return function(t, e) {
16301
16298
  // Sentinels are only supported with writes, and not within arrays.
16302
- if (!hu(e.$c)) throw e.qc(`${t._methodName}() can only be used with update() and set()`);
16303
- if (!e.path) throw e.qc(`${t._methodName}() is not currently supported inside arrays`);
16299
+ if (!hu(e.xa)) throw e.Ua(`${t._methodName}() can only be used with update() and set()`);
16300
+ if (!e.path) throw e.Ua(`${t._methodName}() is not currently supported inside arrays`);
16304
16301
  const n = t._toFieldTransform(e);
16305
16302
  n && e.fieldTransforms.push(n);
16306
16303
  }
@@ -16324,12 +16321,12 @@ class Tu extends ru {
16324
16321
  // the set of values to be included for the IN query) that may directly
16325
16322
  // contain additional arrays (each representing an individual field
16326
16323
  // value), so we disable this validation.
16327
- if (e.settings.Mc && 4 /* ArrayArgument */ !== e.$c) throw e.qc("Nested arrays are not supported");
16324
+ if (e.settings.Fa && 4 /* ArrayArgument */ !== e.xa) throw e.Ua("Nested arrays are not supported");
16328
16325
  return function(t, e) {
16329
16326
  const n = [];
16330
16327
  let s = 0;
16331
16328
  for (const i of t) {
16332
- let t = Ru(i, e.Uc(s));
16329
+ let t = Ru(i, e.Ba(s));
16333
16330
  null == t && (
16334
16331
  // Just include nulls in the array for fields being replaced with a
16335
16332
  // sentinel.
@@ -16379,14 +16376,14 @@ class Tu extends ru {
16379
16376
  if (t instanceof iu) return {
16380
16377
  bytesValue: zn(e.k, t._byteString)
16381
16378
  };
16382
- if (t instanceof Va) {
16379
+ if (t instanceof Vc) {
16383
16380
  const n = e.databaseId, s = t.firestore._databaseId;
16384
- if (!s.isEqual(n)) throw e.qc(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
16381
+ if (!s.isEqual(n)) throw e.Ua(`Document reference is for database ${s.projectId}/${s.database} but should be for database ${n.projectId}/${n.database}`);
16385
16382
  return {
16386
16383
  referenceValue: Yn(t.firestore._databaseId || e.databaseId, t._key.path)
16387
16384
  };
16388
16385
  }
16389
- throw e.qc(`Unsupported field value: ${Ia(t)}`);
16386
+ throw e.Ua(`Unsupported field value: ${Ic(t)}`);
16390
16387
  }
16391
16388
  /**
16392
16389
  * Checks whether an object looks like a JSON object that should be converted
@@ -16397,13 +16394,13 @@ class Tu extends ru {
16397
16394
  */ (t, e);
16398
16395
  }
16399
16396
 
16400
- function bu(t, e) {
16397
+ function Pu(t, e) {
16401
16398
  const n = {};
16402
16399
  return dt(t) ?
16403
16400
  // If we encounter an empty object, we explicitly add it to the update
16404
16401
  // mask to ensure that the server creates a map entry.
16405
16402
  e.path && e.path.length > 0 && e.fieldMask.push(e.path) : ft(t, ((t, s) => {
16406
- const i = Ru(s, e.Fc(t));
16403
+ const i = Ru(s, e.Oa(t));
16407
16404
  null != i && (n[t] = i);
16408
16405
  })), {
16409
16406
  mapValue: {
@@ -16412,16 +16409,16 @@ function bu(t, e) {
16412
16409
  };
16413
16410
  }
16414
16411
 
16415
- function Pu(t) {
16416
- return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof ou || t instanceof iu || t instanceof Va || t instanceof ru);
16412
+ function bu(t) {
16413
+ return !("object" != typeof t || null === t || t instanceof Array || t instanceof Date || t instanceof ut || t instanceof ou || t instanceof iu || t instanceof Vc || t instanceof ru);
16417
16414
  }
16418
16415
 
16419
16416
  function vu(t, e, n) {
16420
- if (!Pu(n) || !function(t) {
16417
+ if (!bu(n) || !function(t) {
16421
16418
  return "object" == typeof t && null !== t && (Object.getPrototypeOf(t) === Object.prototype || null === Object.getPrototypeOf(t));
16422
16419
  }(n)) {
16423
- const s = Ia(n);
16424
- throw "an object" === s ? e.qc(t + " a custom object") : e.qc(t + " " + s);
16420
+ const s = Ic(n);
16421
+ throw "an object" === s ? e.Ua(t + " a custom object") : e.Ua(t + " " + s);
16425
16422
  }
16426
16423
  }
16427
16424
 
@@ -16465,11 +16462,11 @@ function vu(t, e, n) {
16465
16462
 
16466
16463
  function Cu(t, e, n, s, i) {
16467
16464
  const r = s && !s.isEmpty(), o = void 0 !== i;
16468
- let c = `Function ${e}() called with invalid data`;
16469
- n && (c += " (via `toFirestore()`)"), c += ". ";
16470
- let a = "";
16471
- return (r || o) && (a += " (found", r && (a += ` in field ${s}`), o && (a += ` in document ${i}`),
16472
- a += ")"), new W(Q.INVALID_ARGUMENT, c + t + a);
16465
+ let a = `Function ${e}() called with invalid data`;
16466
+ n && (a += " (via `toFirestore()`)"), a += ". ";
16467
+ let c = "";
16468
+ return (r || o) && (c += " (found", r && (c += ` in field ${s}`), o && (c += ` in document ${i}`),
16469
+ c += ")"), new W(Q.INVALID_ARGUMENT, a + t + c);
16473
16470
  }
16474
16471
 
16475
16472
  /** Checks `haystack` if FieldPath `needle` is present. Runs in O(n). */ function Nu(t, e) {
@@ -16516,7 +16513,7 @@ function Cu(t, e, n, s, i) {
16516
16513
  /**
16517
16514
  * The `DocumentReference` for the document included in the `DocumentSnapshot`.
16518
16515
  */ get ref() {
16519
- return new Va(this._firestore, this._converter, this._key);
16516
+ return new Vc(this._firestore, this._converter, this._key);
16520
16517
  }
16521
16518
  /**
16522
16519
  * Signals whether or not the document at the snapshot's location exists.
@@ -16824,7 +16821,7 @@ function Bu(t) {
16824
16821
  * @param right - A snapshot to compare.
16825
16822
  * @returns true if the snapshots are equal.
16826
16823
  */ function Uu(t, e) {
16827
- return t instanceof Fu && e instanceof Fu ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Lu && e instanceof Lu && (t._firestore === e._firestore && $a(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
16824
+ return t instanceof Fu && e instanceof Fu ? t._firestore === e._firestore && t._key.isEqual(e._key) && (null === t._document ? null === e._document : t._document.isEqual(e._document)) && t._converter === e._converter : t instanceof Lu && e instanceof Lu && (t._firestore === e._firestore && $c(t.query, e.query) && t.metadata.isEqual(e.metadata) && t._snapshot.isEqual(e._snapshot));
16828
16825
  }
16829
16826
 
16830
16827
  /**
@@ -16870,33 +16867,33 @@ function Bu(t) {
16870
16867
 
16871
16868
  class Qu extends Ku {
16872
16869
  constructor(t, e, n) {
16873
- super(), this.zc = t, this.Hc = e, this.Jc = n, this.type = "where";
16870
+ super(), this.Ga = t, this.za = e, this.Ha = n, this.type = "where";
16874
16871
  }
16875
16872
  _apply(t) {
16876
16873
  const e = du(t.firestore), n = function(t, e, n, s, i, r, o) {
16877
- let c;
16874
+ let a;
16878
16875
  if (i.isKeyField()) {
16879
16876
  if ("array-contains" /* ARRAY_CONTAINS */ === r || "array-contains-any" /* ARRAY_CONTAINS_ANY */ === r) throw new W(Q.INVALID_ARGUMENT, `Invalid Query. You can't perform '${r}' queries on FieldPath.documentId().`);
16880
16877
  if ("in" /* IN */ === r || "not-in" /* NOT_IN */ === r) {
16881
16878
  oh(o, r);
16882
16879
  const e = [];
16883
16880
  for (const n of o) e.push(rh(s, t, n));
16884
- c = {
16881
+ a = {
16885
16882
  arrayValue: {
16886
16883
  values: e
16887
16884
  }
16888
16885
  };
16889
- } else c = rh(s, t, o);
16886
+ } else a = rh(s, t, o);
16890
16887
  } else "in" /* IN */ !== r && "not-in" /* NOT_IN */ !== r && "array-contains-any" /* ARRAY_CONTAINS_ANY */ !== r || oh(o, r),
16891
- c = Au(n, e, o,
16888
+ a = Au(n, e, o,
16892
16889
  /* allowArrays= */ "in" /* IN */ === r || "not-in" /* NOT_IN */ === r);
16893
- const a = ne.create(i, r, c);
16890
+ const c = ne.create(i, r, a);
16894
16891
  return function(t, e) {
16895
16892
  if (e.V()) {
16896
16893
  const n = Re(t);
16897
16894
  if (null !== n && !n.isEqual(e.field)) throw new W(Q.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 '${e.field.toString()}'`);
16898
16895
  const s = Ae(t);
16899
- null !== s && ch(t, e.field, s);
16896
+ null !== s && ah(t, e.field, s);
16900
16897
  }
16901
16898
  const n = function(t, e) {
16902
16899
  for (const n of t.filters) if (e.indexOf(n.op) >= 0) return n.op;
@@ -16938,9 +16935,9 @@ class Qu extends Ku {
16938
16935
  if (null !== n)
16939
16936
  // Special case when it's a duplicate op to give a slightly clearer error message.
16940
16937
  throw n === e.op ? new W(Q.INVALID_ARGUMENT, `Invalid query. You cannot use more than one '${e.op.toString()}' filter.`) : new W(Q.INVALID_ARGUMENT, `Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`);
16941
- }(t, a), a;
16942
- }(t._query, "where", e, t.firestore._databaseId, this.zc, this.Hc, this.Jc);
16943
- return new Sa(t.firestore, t.converter, function(t, e) {
16938
+ }(t, c), c;
16939
+ }(t._query, "where", e, t.firestore._databaseId, this.Ga, this.za, this.Ha);
16940
+ return new Sc(t.firestore, t.converter, function(t, e) {
16944
16941
  const n = t.filters.concat([ e ]);
16945
16942
  return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), n, t.limit, t.limitType, t.startAt, t.endAt);
16946
16943
  }(t._query, n));
@@ -16964,7 +16961,7 @@ class Qu extends Ku {
16964
16961
 
16965
16962
  class Gu extends Ku {
16966
16963
  constructor(t, e) {
16967
- super(), this.zc = t, this.Yc = e, this.type = "orderBy";
16964
+ super(), this.Ga = t, this.Ja = e, this.type = "orderBy";
16968
16965
  }
16969
16966
  _apply(t) {
16970
16967
  const e = function(t, e, n) {
@@ -16975,7 +16972,7 @@ class Gu extends Ku {
16975
16972
  if (null === Ae(t)) {
16976
16973
  // This is the first order by. It must match any inequality.
16977
16974
  const n = Re(t);
16978
- null !== n && ch(t, n, e.field);
16975
+ null !== n && ah(t, n, e.field);
16979
16976
  }
16980
16977
  }(t, s), s;
16981
16978
  }
@@ -16989,8 +16986,8 @@ class Gu extends Ku {
16989
16986
  * Will throw if the document does not contain all fields of the order by
16990
16987
  * of the query or if any of the fields in the order by are an uncommitted
16991
16988
  * server timestamp.
16992
- */ (t._query, this.zc, this.Yc);
16993
- return new Sa(t.firestore, t.converter, function(t, e) {
16989
+ */ (t._query, this.Ga, this.Ja);
16990
+ return new Sc(t.firestore, t.converter, function(t, e) {
16994
16991
  // TODO(dimond): validate that orderBy does not list the same key twice.
16995
16992
  const n = t.explicitOrderBy.concat([ e ]);
16996
16993
  return new ye(t.path, t.collectionGroup, n, t.filters.slice(), t.limit, t.limitType, t.startAt, t.endAt);
@@ -17013,10 +17010,10 @@ class Gu extends Ku {
17013
17010
 
17014
17011
  class Hu extends Ku {
17015
17012
  constructor(t, e, n) {
17016
- super(), this.type = t, this.Xc = e, this.Zc = n;
17013
+ super(), this.type = t, this.Ya = e, this.Xa = n;
17017
17014
  }
17018
17015
  _apply(t) {
17019
- return new Sa(t.firestore, t.converter, Ve(t._query, this.Xc, this.Zc));
17016
+ return new Sc(t.firestore, t.converter, Ve(t._query, this.Ya, this.Xa));
17020
17017
  }
17021
17018
  }
17022
17019
 
@@ -17026,7 +17023,7 @@ class Hu extends Ku {
17026
17023
  * @param limit - The maximum number of items to return.
17027
17024
  * @returns The created {@link Query}.
17028
17025
  */ function Ju(t) {
17029
- return Ra("limit", t), new Hu("limit", t, "F" /* First */);
17026
+ return Rc("limit", t), new Hu("limit", t, "F" /* First */);
17030
17027
  }
17031
17028
 
17032
17029
  /**
@@ -17038,16 +17035,16 @@ class Hu extends Ku {
17038
17035
  * @param limit - The maximum number of items to return.
17039
17036
  * @returns The created {@link Query}.
17040
17037
  */ function Yu(t) {
17041
- return Ra("limitToLast", t), new Hu("limitToLast", t, "L" /* Last */);
17038
+ return Rc("limitToLast", t), new Hu("limitToLast", t, "L" /* Last */);
17042
17039
  }
17043
17040
 
17044
17041
  class Xu extends Ku {
17045
17042
  constructor(t, e, n) {
17046
- super(), this.type = t, this.ta = e, this.ea = n;
17043
+ super(), this.type = t, this.Za = e, this.tc = n;
17047
17044
  }
17048
17045
  _apply(t) {
17049
- const e = ih(t, this.type, this.ta, this.ea);
17050
- return new Sa(t.firestore, t.converter, function(t, e) {
17046
+ const e = ih(t, this.type, this.Za, this.tc);
17047
+ return new Sc(t.firestore, t.converter, function(t, e) {
17051
17048
  return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, e, t.endAt);
17052
17049
  }(t._query, e));
17053
17050
  }
@@ -17064,11 +17061,11 @@ function th(...t) {
17064
17061
 
17065
17062
  class eh extends Ku {
17066
17063
  constructor(t, e, n) {
17067
- super(), this.type = t, this.ta = e, this.ea = n;
17064
+ super(), this.type = t, this.Za = e, this.tc = n;
17068
17065
  }
17069
17066
  _apply(t) {
17070
- const e = ih(t, this.type, this.ta, this.ea);
17071
- return new Sa(t.firestore, t.converter, function(t, e) {
17067
+ const e = ih(t, this.type, this.Za, this.tc);
17068
+ return new Sc(t.firestore, t.converter, function(t, e) {
17072
17069
  return new ye(t.path, t.collectionGroup, t.explicitOrderBy.slice(), t.filters.slice(), t.limit, t.limitType, t.startAt, e);
17073
17070
  }(t._query, e));
17074
17071
  }
@@ -17093,9 +17090,9 @@ function sh(...t) {
17093
17090
  // the provided document. Without the key (by using the explicit sort
17094
17091
  // orders), multiple documents could match the position, yielding duplicate
17095
17092
  // results.
17096
- for (const n of Pe(t)) if (n.field.isKeyField()) r.push(Bt(e, s.key)); else {
17093
+ for (const n of be(t)) if (n.field.isKeyField()) r.push(Bt(e, s.key)); else {
17097
17094
  const t = s.data.field(n.field);
17098
- if (Pt(t)) throw new W(Q.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
17095
+ if (bt(t)) throw new W(Q.INVALID_ARGUMENT, 'Invalid query. You are trying to start or end a query using a document for which the field "' + n.field + '" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');
17099
17096
  if (null === t) {
17100
17097
  const t = n.field.canonicalString();
17101
17098
  throw new W(Q.INVALID_ARGUMENT, `Invalid query. You are trying to start or end a query using a document for which the field '${t}' (used as the orderBy) does not exist.`);
@@ -17113,22 +17110,22 @@ function sh(...t) {
17113
17110
  // Use explicit order by's because it has to match the query the user made
17114
17111
  const o = t.explicitOrderBy;
17115
17112
  if (i.length > o.length) throw new W(Q.INVALID_ARGUMENT, `Too many arguments provided to ${s}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);
17116
- const c = [];
17113
+ const a = [];
17117
17114
  for (let r = 0; r < i.length; r++) {
17118
- const a = i[r];
17115
+ const c = i[r];
17119
17116
  if (o[r].field.isKeyField()) {
17120
- if ("string" != typeof a) throw new W(Q.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof a}`);
17121
- if (!be(t) && -1 !== a.indexOf("/")) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to ${s}() must be a plain document ID, but '${a}' contains a slash.`);
17122
- const n = t.path.child(_t.fromString(a));
17117
+ if ("string" != typeof c) throw new W(Q.INVALID_ARGUMENT, `Invalid query. Expected a string for document ID in ${s}(), but got a ${typeof c}`);
17118
+ if (!Pe(t) && -1 !== c.indexOf("/")) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection and ordering by FieldPath.documentId(), the value passed to ${s}() must be a plain document ID, but '${c}' contains a slash.`);
17119
+ const n = t.path.child(_t.fromString(c));
17123
17120
  if (!Nt.isDocumentKey(n)) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection group and ordering by FieldPath.documentId(), the value passed to ${s}() must result in a valid document path, but '${n}' is not because it contains an odd number of segments.`);
17124
17121
  const i = new Nt(n);
17125
- c.push(Bt(e, i));
17122
+ a.push(Bt(e, i));
17126
17123
  } else {
17127
- const t = Au(n, s, a);
17128
- c.push(t);
17124
+ const t = Au(n, s, c);
17125
+ a.push(t);
17129
17126
  }
17130
17127
  }
17131
- return new fe(c, r);
17128
+ return new fe(a, r);
17132
17129
  }
17133
17130
  /**
17134
17131
  * Parses the given `documentIdValue` into a `ReferenceValue`, throwing
@@ -17141,13 +17138,13 @@ function sh(...t) {
17141
17138
  function rh(t, e, n) {
17142
17139
  if ("string" == typeof (n = T(n))) {
17143
17140
  if ("" === n) throw new W(Q.INVALID_ARGUMENT, "Invalid query. When querying with FieldPath.documentId(), you must provide a valid document ID, but it was an empty string.");
17144
- if (!be(e) && -1 !== n.indexOf("/")) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
17141
+ if (!Pe(e) && -1 !== n.indexOf("/")) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection by FieldPath.documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);
17145
17142
  const s = e.path.child(_t.fromString(n));
17146
17143
  if (!Nt.isDocumentKey(s)) throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying a collection group by FieldPath.documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);
17147
17144
  return Bt(t, new Nt(s));
17148
17145
  }
17149
- if (n instanceof Va) return Bt(t, n._key);
17150
- throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ia(n)}.`);
17146
+ if (n instanceof Vc) return Bt(t, n._key);
17147
+ throw new W(Q.INVALID_ARGUMENT, `Invalid query. When querying with FieldPath.documentId(), you must provide a valid string or a DocumentReference, but it was: ${Ic(n)}.`);
17151
17148
  }
17152
17149
 
17153
17150
  /**
@@ -17158,7 +17155,7 @@ function rh(t, e, n) {
17158
17155
  if (t.length > 10) throw new W(Q.INVALID_ARGUMENT, `Invalid Query. '${e.toString()}' filters support a maximum of 10 elements in the value array.`);
17159
17156
  }
17160
17157
 
17161
- function ch(t, e, n) {
17158
+ function ah(t, e, n) {
17162
17159
  if (!n.isEqual(e)) throw new W(Q.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.`);
17163
17160
  }
17164
17161
 
@@ -17183,7 +17180,7 @@ function ch(t, e, n) {
17183
17180
  * to the user.
17184
17181
  *
17185
17182
  * @internal
17186
- */ class ah {
17183
+ */ class ch {
17187
17184
  convertValue(t, e = "none") {
17188
17185
  switch (kt(t)) {
17189
17186
  case 0 /* NullValue */ :
@@ -17205,7 +17202,7 @@ function ch(t, e, n) {
17205
17202
  return t.stringValue;
17206
17203
 
17207
17204
  case 6 /* BlobValue */ :
17208
- return this.convertBytes(bt(t.bytesValue));
17205
+ return this.convertBytes(Pt(t.bytesValue));
17209
17206
 
17210
17207
  case 7 /* RefValue */ :
17211
17208
  return this.convertReference(t.referenceValue);
@@ -17254,8 +17251,8 @@ function ch(t, e, n) {
17254
17251
  }
17255
17252
  convertDocumentKey(t, e) {
17256
17253
  const n = _t.fromString(t);
17257
- q(Ps(n));
17258
- const s = new ma(n.get(1), n.get(3)), i = new Nt(n.popFirst(5));
17254
+ q(bs(n));
17255
+ const s = new mc(n.get(1), n.get(3)), i = new Nt(n.popFirst(5));
17259
17256
  return s.isEqual(e) ||
17260
17257
  // TODO(b/64130202): Somehow support foreign references.
17261
17258
  M(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${e.projectId}/${e.database}) instead.`),
@@ -17296,7 +17293,7 @@ function ch(t, e, n) {
17296
17293
  s;
17297
17294
  }
17298
17295
 
17299
- class hh extends ah {
17296
+ class hh extends ch {
17300
17297
  constructor(t) {
17301
17298
  super(), this.firestore = t;
17302
17299
  }
@@ -17305,7 +17302,7 @@ class hh extends ah {
17305
17302
  }
17306
17303
  convertReference(t) {
17307
17304
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
17308
- return new Va(this.firestore, /* converter= */ null, e);
17305
+ return new Vc(this.firestore, /* converter= */ null, e);
17309
17306
  }
17310
17307
  }
17311
17308
 
@@ -17440,12 +17437,12 @@ function fh(t, e) {
17440
17437
  * current document contents.
17441
17438
  */
17442
17439
  function dh(t) {
17443
- t = Aa(t, Va);
17444
- const e = Aa(t.firestore, Ba);
17445
- return aa(Ka(e), t._key).then((n => vh(e, t, n)));
17440
+ t = Ac(t, Vc);
17441
+ const e = Ac(t.firestore, Bc);
17442
+ return cc(Kc(e), t._key).then((n => vh(e, t, n)));
17446
17443
  }
17447
17444
 
17448
- class wh extends ah {
17445
+ class wh extends ch {
17449
17446
  constructor(t) {
17450
17447
  super(), this.firestore = t;
17451
17448
  }
@@ -17454,7 +17451,7 @@ class wh extends ah {
17454
17451
  }
17455
17452
  convertReference(t) {
17456
17453
  const e = this.convertDocumentKey(t, this.firestore._databaseId);
17457
- return new Va(this.firestore, /* converter= */ null, e);
17454
+ return new Vc(this.firestore, /* converter= */ null, e);
17458
17455
  }
17459
17456
  }
17460
17457
 
@@ -17465,9 +17462,9 @@ class wh extends ah {
17465
17462
  * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
17466
17463
  * current document contents.
17467
17464
  */ function _h(t) {
17468
- t = Aa(t, Va);
17469
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17470
- return ca(n, t._key).then((n => new Fu(e, s, t._key, n, new Ou(null !== n && n.hasLocalMutations,
17465
+ t = Ac(t, Vc);
17466
+ const e = Ac(t.firestore, Bc), n = Kc(e), s = new wh(e);
17467
+ return ac(n, t._key).then((n => new Fu(e, s, t._key, n, new Ou(null !== n && n.hasLocalMutations,
17471
17468
  /* fromCache= */ !0), t.converter)));
17472
17469
  }
17473
17470
 
@@ -17478,9 +17475,9 @@ class wh extends ah {
17478
17475
  * @returns A `Promise` resolved with a `DocumentSnapshot` containing the
17479
17476
  * current document contents.
17480
17477
  */ function mh(t) {
17481
- t = Aa(t, Va);
17482
- const e = Aa(t.firestore, Ba);
17483
- return aa(Ka(e), t._key, {
17478
+ t = Ac(t, Vc);
17479
+ const e = Ac(t.firestore, Bc);
17480
+ return cc(Kc(e), t._key, {
17484
17481
  source: "server"
17485
17482
  }).then((n => vh(e, t, n)));
17486
17483
  }
@@ -17495,9 +17492,9 @@ class wh extends ah {
17495
17492
  *
17496
17493
  * @returns A `Promise` that will be resolved with the results of the query.
17497
17494
  */ function gh(t) {
17498
- t = Aa(t, Sa);
17499
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17500
- return qu(t._query), ha(n, t._query).then((n => new Lu(e, s, t, n)));
17495
+ t = Ac(t, Sc);
17496
+ const e = Ac(t.firestore, Bc), n = Kc(e), s = new wh(e);
17497
+ return qu(t._query), hc(n, t._query).then((n => new Lu(e, s, t, n)));
17501
17498
  }
17502
17499
 
17503
17500
  /**
@@ -17506,9 +17503,9 @@ class wh extends ah {
17506
17503
  *
17507
17504
  * @returns A `Promise` that will be resolved with the results of the query.
17508
17505
  */ function yh(t) {
17509
- t = Aa(t, Sa);
17510
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17511
- return ua(n, t._query).then((n => new Lu(e, s, t, n)));
17506
+ t = Ac(t, Sc);
17507
+ const e = Ac(t.firestore, Bc), n = Kc(e), s = new wh(e);
17508
+ return uc(n, t._query).then((n => new Lu(e, s, t, n)));
17512
17509
  }
17513
17510
 
17514
17511
  /**
@@ -17517,28 +17514,28 @@ class wh extends ah {
17517
17514
  *
17518
17515
  * @returns A `Promise` that will be resolved with the results of the query.
17519
17516
  */ function ph(t) {
17520
- t = Aa(t, Sa);
17521
- const e = Aa(t.firestore, Ba), n = Ka(e), s = new wh(e);
17522
- return ha(n, t._query, {
17517
+ t = Ac(t, Sc);
17518
+ const e = Ac(t.firestore, Bc), n = Kc(e), s = new wh(e);
17519
+ return hc(n, t._query, {
17523
17520
  source: "server"
17524
17521
  }).then((n => new Lu(e, s, t, n)));
17525
17522
  }
17526
17523
 
17527
17524
  function Th(t, e, n) {
17528
- t = Aa(t, Va);
17529
- const s = Aa(t.firestore, Ba), i = uh(t.converter, e, n);
17530
- return Ph(s, [ wu(du(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ze.none()) ]);
17525
+ t = Ac(t, Vc);
17526
+ const s = Ac(t.firestore, Bc), i = uh(t.converter, e, n);
17527
+ return bh(s, [ wu(du(s), "setDoc", t._key, i, null !== t.converter, n).toMutation(t._key, Ze.none()) ]);
17531
17528
  }
17532
17529
 
17533
17530
  function Eh(t, e, n, ...s) {
17534
- t = Aa(t, Va);
17535
- const i = Aa(t.firestore, Ba), r = du(i);
17531
+ t = Ac(t, Vc);
17532
+ const i = Ac(t.firestore, Bc), r = du(i);
17536
17533
  let o;
17537
17534
  o = "string" == typeof (
17538
17535
  // For Compat types, we have to "extract" the underlying types before
17539
17536
  // performing validation.
17540
17537
  e = T(e)) || e instanceof nu ? Iu(r, "updateDoc", t._key, e, n, s) : Eu(r, "updateDoc", t._key, e);
17541
- return Ph(i, [ o.toMutation(t._key, Ze.exists(!0)) ]);
17538
+ return bh(i, [ o.toMutation(t._key, Ze.exists(!0)) ]);
17542
17539
  }
17543
17540
 
17544
17541
  /**
@@ -17548,7 +17545,7 @@ function Eh(t, e, n, ...s) {
17548
17545
  * @returns A Promise resolved once the document has been successfully
17549
17546
  * deleted from the backend (note that it won't resolve while you're offline).
17550
17547
  */ function Ih(t) {
17551
- return Ph(Aa(t.firestore, Ba), [ new dn(t._key, Ze.none()) ]);
17548
+ return bh(Ac(t.firestore, Bc), [ new dn(t._key, Ze.none()) ]);
17552
17549
  }
17553
17550
 
17554
17551
  /**
@@ -17561,8 +17558,8 @@ function Eh(t, e, n, ...s) {
17561
17558
  * newly created document after it has been written to the backend (Note that it
17562
17559
  * won't resolve while you're offline).
17563
17560
  */ function Ah(t, e) {
17564
- const n = Aa(t.firestore, Ba), s = ka(t), i = uh(t.converter, e);
17565
- return Ph(n, [ wu(du(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ze.exists(!1)) ]).then((() => s));
17561
+ const n = Ac(t.firestore, Bc), s = kc(t), i = uh(t.converter, e);
17562
+ return bh(n, [ wu(du(t.firestore), "addDoc", s._key, i, null !== t.converter, {}).toMutation(s._key, Ze.exists(!1)) ]).then((() => s));
17566
17563
  }
17567
17564
 
17568
17565
  function Rh(t, ...e) {
@@ -17571,27 +17568,27 @@ function Rh(t, ...e) {
17571
17568
  let r = {
17572
17569
  includeMetadataChanges: !1
17573
17570
  }, o = 0;
17574
- "object" != typeof e[o] || Fa(e[o]) || (r = e[o], o++);
17575
- const c = {
17571
+ "object" != typeof e[o] || Fc(e[o]) || (r = e[o], o++);
17572
+ const a = {
17576
17573
  includeMetadataChanges: r.includeMetadataChanges
17577
17574
  };
17578
- if (Fa(e[o])) {
17575
+ if (Fc(e[o])) {
17579
17576
  const t = e[o];
17580
17577
  e[o] = null === (n = t.next) || void 0 === n ? void 0 : n.bind(t), e[o + 1] = null === (s = t.error) || void 0 === s ? void 0 : s.bind(t),
17581
17578
  e[o + 2] = null === (i = t.complete) || void 0 === i ? void 0 : i.bind(t);
17582
17579
  }
17583
- let a, u, h;
17584
- if (t instanceof Va) u = Aa(t.firestore, Ba), h = Te(t._key.path), a = {
17580
+ let c, u, h;
17581
+ if (t instanceof Vc) u = Ac(t.firestore, Bc), h = Te(t._key.path), c = {
17585
17582
  next: n => {
17586
17583
  e[o] && e[o](vh(u, t, n));
17587
17584
  },
17588
17585
  error: e[o + 1],
17589
17586
  complete: e[o + 2]
17590
17587
  }; else {
17591
- const n = Aa(t, Sa);
17592
- u = Aa(n.firestore, Ba), h = n._query;
17588
+ const n = Ac(t, Sc);
17589
+ u = Ac(n.firestore, Bc), h = n._query;
17593
17590
  const s = new wh(u);
17594
- a = {
17591
+ c = {
17595
17592
  next: t => {
17596
17593
  e[o] && e[o](new Lu(u, s, n, t));
17597
17594
  },
@@ -17600,15 +17597,15 @@ function Rh(t, ...e) {
17600
17597
  }, qu(t._query);
17601
17598
  }
17602
17599
  return function(t, e, n, s) {
17603
- const i = new Qc(s), r = new Yo(e, i, n);
17604
- return t.asyncQueue.enqueueAndForget((async () => Wo(await ia(t), r))), () => {
17605
- i.nc(), t.asyncQueue.enqueueAndForget((async () => Go(await ia(t), r)));
17600
+ const i = new Qa(s), r = new Yo(e, i, n);
17601
+ return t.asyncQueue.enqueueAndForget((async () => Wo(await ic(t), r))), () => {
17602
+ i.na(), t.asyncQueue.enqueueAndForget((async () => Go(await ic(t), r)));
17606
17603
  };
17607
- }(Ka(u), h, c, a);
17604
+ }(Kc(u), h, a, c);
17608
17605
  }
17609
17606
 
17610
- function bh(t, e) {
17611
- return la(Ka(t = Aa(t, Ba)), Fa(e) ? e : {
17607
+ function Ph(t, e) {
17608
+ return lc(Kc(t = Ac(t, Bc)), Fc(e) ? e : {
17612
17609
  next: e
17613
17610
  });
17614
17611
  }
@@ -17616,11 +17613,11 @@ function bh(t, e) {
17616
17613
  /**
17617
17614
  * Locally writes `mutations` on the async queue.
17618
17615
  * @internal
17619
- */ function Ph(t, e) {
17616
+ */ function bh(t, e) {
17620
17617
  return function(t, e) {
17621
17618
  const n = new G;
17622
- return t.asyncQueue.enqueueAndForget((async () => lc(await sa(t), e, n))), n.promise;
17623
- }(Ka(t), e);
17619
+ return t.asyncQueue.enqueueAndForget((async () => la(await sc(t), e, n))), n.promise;
17620
+ }(Kc(t), e);
17624
17621
  }
17625
17622
 
17626
17623
  /**
@@ -17731,7 +17728,7 @@ function bh(t, e) {
17731
17728
  * `updateFunction `is returned here. Otherwise, if the transaction failed, a
17732
17729
  * rejected promise with the corresponding failure error is returned.
17733
17730
  */ function Sh(t, e) {
17734
- return fa(Ka(t = Aa(t, Ba)), (n => e(new Vh(t, n))));
17731
+ return fc(Kc(t = Ac(t, Bc)), (n => e(new Vh(t, n))));
17735
17732
  }
17736
17733
 
17737
17734
  /**
@@ -17846,7 +17843,7 @@ function bh(t, e) {
17846
17843
  * @returns A {@link WriteBatch} that can be used to atomically execute multiple
17847
17844
  * writes.
17848
17845
  */ function $h(t) {
17849
- return Ka(t = Aa(t, Ba)), new lh(t, (e => Ph(t, e)));
17846
+ return Kc(t = Ac(t, Bc)), new lh(t, (e => bh(t, e)));
17850
17847
  }
17851
17848
 
17852
17849
  /**
@@ -17868,14 +17865,14 @@ function bh(t, e) {
17868
17865
  !function(t) {
17869
17866
  k = t;
17870
17867
  }(i), n(new r("firestore", ((t, {options: n}) => {
17871
- const s = t.getProvider("app").getImmediate(), i = new Ba(s, new Y(t.getProvider("auth-internal")), new et(t.getProvider("app-check-internal")));
17868
+ const s = t.getProvider("app").getImmediate(), i = new Bc(s, new Y(t.getProvider("auth-internal")), new et(t.getProvider("app-check-internal")));
17872
17869
  return n = Object.assign({
17873
17870
  useFetchStreams: e
17874
17871
  }, n), i._setSettings(n), i;
17875
- }), "PUBLIC")), s(C, "3.4.1-canary.be7ccb8ed", t),
17872
+ }), "PUBLIC")), s(C, "3.4.2", t),
17876
17873
  // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation
17877
- s(C, "3.4.1-canary.be7ccb8ed", "esm2017");
17874
+ s(C, "3.4.2", "esm2017");
17878
17875
  }("rn", /* useFetchStreams= */ !1);
17879
17876
 
17880
- export { ah as AbstractUserDataWriter, iu as Bytes, La as CACHE_SIZE_UNLIMITED, Da as CollectionReference, Va as DocumentReference, Fu as DocumentSnapshot, nu as FieldPath, ru as FieldValue, Ba as Firestore, W as FirestoreError, ou as GeoPoint, Ma as LoadBundleTask, Sa as Query, Ku as QueryConstraint, Mu as QueryDocumentSnapshot, Lu as QuerySnapshot, Ou as SnapshotMetadata, ut as Timestamp, Vh as Transaction, lh as WriteBatch, ma as _DatabaseId, Nt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, Aa as _cast, K as _debugAssert, Tt as _isBase64Available, L as _logWarn, pa as _validateIsNotUsedTogether, Ah as addDoc, kh as arrayRemove, Nh as arrayUnion, za as clearIndexedDbPersistence, Ca as collection, Na as collectionGroup, va as connectFirestoreEmulator, Ih as deleteDoc, Dh as deleteField, Ya as disableNetwork, ka as doc, su as documentId, Qa as enableIndexedDbPersistence, Wa as enableMultiTabIndexedDbPersistence, Ja as enableNetwork, sh as endAt, nh as endBefore, Ka as ensureFirestoreConfigured, Ph as executeWrite, dh as getDoc, _h as getDocFromCache, mh as getDocFromServer, gh as getDocs, yh as getDocsFromCache, ph as getDocsFromServer, qa as getFirestore, xh as increment, Ua as initializeFirestore, Ju as limit, Yu as limitToLast, Za as loadBundle, tu as namedQuery, Rh as onSnapshot, bh as onSnapshotsInSync, zu as orderBy, ju as query, $a as queryEqual, xa as refEqual, Sh as runTransaction, Ch as serverTimestamp, Th as setDoc, O as setLogLevel, Uu as snapshotEqual, th as startAfter, Zu as startAt, Xa as terminate, Eh as updateDoc, Ha as waitForPendingWrites, Wu as where, $h as writeBatch };
17877
+ export { ch as AbstractUserDataWriter, iu as Bytes, Lc as CACHE_SIZE_UNLIMITED, Dc as CollectionReference, Vc as DocumentReference, Fu as DocumentSnapshot, nu as FieldPath, ru as FieldValue, Bc as Firestore, W as FirestoreError, ou as GeoPoint, Mc as LoadBundleTask, Sc as Query, Ku as QueryConstraint, Mu as QueryDocumentSnapshot, Lu as QuerySnapshot, Ou as SnapshotMetadata, ut as Timestamp, Vh as Transaction, lh as WriteBatch, mc as _DatabaseId, Nt as _DocumentKey, nt as _EmptyAppCheckTokenProvider, H as _EmptyAuthCredentialsProvider, gt as _FieldPath, Ac as _cast, K as _debugAssert, Tt as _isBase64Available, L as _logWarn, pc as _validateIsNotUsedTogether, Ah as addDoc, kh as arrayRemove, Nh as arrayUnion, zc as clearIndexedDbPersistence, Cc as collection, Nc as collectionGroup, vc as connectFirestoreEmulator, Ih as deleteDoc, Dh as deleteField, Yc as disableNetwork, kc as doc, su as documentId, Qc as enableIndexedDbPersistence, Wc as enableMultiTabIndexedDbPersistence, Jc as enableNetwork, sh as endAt, nh as endBefore, Kc as ensureFirestoreConfigured, bh as executeWrite, dh as getDoc, _h as getDocFromCache, mh as getDocFromServer, gh as getDocs, yh as getDocsFromCache, ph as getDocsFromServer, qc as getFirestore, xh as increment, Uc as initializeFirestore, Ju as limit, Yu as limitToLast, Zc as loadBundle, tu as namedQuery, Rh as onSnapshot, Ph as onSnapshotsInSync, zu as orderBy, ju as query, $c as queryEqual, xc as refEqual, Sh as runTransaction, Ch as serverTimestamp, Th as setDoc, O as setLogLevel, Uu as snapshotEqual, th as startAfter, Zu as startAt, Xc as terminate, Eh as updateDoc, Hc as waitForPendingWrites, Wu as where, $h as writeBatch };
17881
17878
  //# sourceMappingURL=index.rn.js.map